src/hotspot/share/opto/cfgnode.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 52925 9c18c9d839d3
child 53623 83b40a7bf00d
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52925
diff changeset
     2
 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1432
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1432
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1432
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52925
diff changeset
    25
#ifndef SHARE_OPTO_CFGNODE_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52925
diff changeset
    26
#define SHARE_OPTO_CFGNODE_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "opto/multnode.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "opto/node.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "opto/opcodes.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "opto/type.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// Portions of code courtesy of Clifford Click
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// Optimization - Graph Style
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
class Matcher;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class Node;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
class   RegionNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
class   TypeNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
class     PhiNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
class   GotoNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
class   MultiNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
class     MultiBranchNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
class       IfNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
class       PCTableNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
class         JumpNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
class         CatchNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
class       NeverBranchNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
class   ProjNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
class     CProjNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
class       IfTrueNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
class       IfFalseNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
class       CatchProjNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
class     JProjNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
class       JumpProjNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
class     SCMemProjNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
class PhaseIdealLoop;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
//------------------------------RegionNode-------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
// The class of RegionNodes, which can be mapped to basic blocks in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
// program.  Their inputs point to Control sources.  PhiNodes (described
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
// below) have an input point to a RegionNode.  Merged data inputs to PhiNodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
// correspond 1-to-1 with RegionNode inputs.  The zero input of a PhiNode is
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
// the RegionNode, and the zero input of the RegionNode is itself.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
class RegionNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  // Node layout (parallels PhiNode):
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  enum { Region,                // Generally points to self.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
         Control                // Control arcs are [1..len)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  RegionNode( uint required ) : Node(required) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    init_class_id(Class_Region);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    init_req(0,this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  Node* is_copy() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    const Node* r = _in[Region];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    if (r == NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
      return nonnull_req();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    return NULL;  // not a copy!
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  PhiNode* has_phi() const;        // returns an arbitrary phi user, or NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  PhiNode* has_unique_phi() const; // returns the unique phi user, or NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  // Is this region node unreachable from root?
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  bool is_unreachable_region(PhaseGVN *phase) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  virtual bool pinned() const { return (const Node *)in(0) == this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  virtual bool  is_CFG   () const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  virtual uint hash() const { return NO_HASH; }  // CFG nodes do not hash
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  virtual bool depends_only_on_test() const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  virtual const Type *bottom_type() const { return Type::CONTROL; }
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
    94
  virtual const Type* Value(PhaseGVN* phase) const;
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
    95
  virtual Node* Identity(PhaseGVN* phase);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  virtual const RegMask &out_RegMask() const;
15113
823590505eb4 8005071: Incremental inlining for JSR 292
roland
parents: 10255
diff changeset
    98
  bool try_clean_mem_phi(PhaseGVN *phase);
52143
ad6384355aa3 8210215: C2 should optimize trichotomy calculations
thartmann
parents: 49877
diff changeset
    99
  bool optimize_trichotomy(PhaseIterGVN* igvn);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
//------------------------------JProjNode--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
// jump projection for node that produces multiple control-flow paths
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
class JProjNode : public ProjNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  JProjNode( Node* ctrl, uint idx ) : ProjNode(ctrl,idx) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  virtual bool  is_CFG() const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  virtual uint  hash() const { return NO_HASH; }  // CFG nodes do not hash
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  virtual const Node* is_block_proj() const { return in(0); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  virtual const RegMask& out_RegMask() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  virtual uint  ideal_reg() const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
//------------------------------PhiNode----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
// PhiNodes merge values from different Control paths.  Slot 0 points to the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
// controlling RegionNode.  Other slots map 1-for-1 with incoming control flow
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
// paths to the RegionNode.  For speed reasons (to avoid another pass) we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
// can turn PhiNodes into copys in-place by NULL'ing out their RegionNode
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
// input in slot 0.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
class PhiNode : public TypeNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  const TypePtr* const _adr_type; // non-null only for Type::MEMORY nodes.
40871
82848b0654f8 8038348: Instance field load is replaced by wrong data Phi
thartmann
parents: 35574
diff changeset
   123
  // The following fields are only used for data PhiNodes to indicate
82848b0654f8 8038348: Instance field load is replaced by wrong data Phi
thartmann
parents: 35574
diff changeset
   124
  // that the PhiNode represents the value of a known instance field.
82848b0654f8 8038348: Instance field load is replaced by wrong data Phi
thartmann
parents: 35574
diff changeset
   125
        int _inst_mem_id; // Instance memory id (node index of the memory Phi)
237
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   126
  const int _inst_id;     // Instance id of the memory slice.
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   127
  const int _inst_index;  // Alias index of the instance memory slice.
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   128
  // Array elements references have the same alias_idx but different offset.
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   129
  const int _inst_offset; // Offset of the instance memory slice.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  // Size is bigger to hold the _adr_type field.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  virtual uint hash() const;    // Check the type
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  virtual uint cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  virtual uint size_of() const { return sizeof(*this); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  // Determine if CMoveNode::is_cmove_id can be used at this join point.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  Node* is_cmove_id(PhaseTransform* phase, int true_path);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  // Node layout (parallels RegionNode):
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  enum { Region,                // Control input is the Phi's region.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
         Input                  // Input values are [1..len)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
237
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   144
  PhiNode( Node *r, const Type *t, const TypePtr* at = NULL,
40871
82848b0654f8 8038348: Instance field load is replaced by wrong data Phi
thartmann
parents: 35574
diff changeset
   145
           const int imid = -1,
769
78e5090c7a20 6716441: error in meet with +DoEscapeAnalysis
kvn
parents: 374
diff changeset
   146
           const int iid = TypeOopPtr::InstanceTop,
237
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   147
           const int iidx = Compile::AliasIdxTop,
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   148
           const int ioffs = Type::OffsetTop )
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   149
    : TypeNode(t,r->req()),
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   150
      _adr_type(at),
40871
82848b0654f8 8038348: Instance field load is replaced by wrong data Phi
thartmann
parents: 35574
diff changeset
   151
      _inst_mem_id(imid),
237
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   152
      _inst_id(iid),
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   153
      _inst_index(iidx),
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   154
      _inst_offset(ioffs)
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   155
  {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    init_class_id(Class_Phi);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    init_req(0, r);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    verify_adr_type();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  // create a new phi with in edges matching r and set (initially) to x
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  static PhiNode* make( Node* r, Node* x );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  // extra type arguments override the new phi's bottom_type and adr_type
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  static PhiNode* make( Node* r, Node* x, const Type *t, const TypePtr* at = NULL );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  // create a new phi with narrowed memory type
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  PhiNode* slice_memory(const TypePtr* adr_type) const;
247
2aeab9ac7fea 6674600: (Escape Analysis) Optimize memory graph for instance's fields
kvn
parents: 237
diff changeset
   166
  PhiNode* split_out_instance(const TypePtr* at, PhaseIterGVN *igvn) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  // like make(r, x), but does not initialize the in edges to x
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  static PhiNode* make_blank( Node* r, Node* x );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  // Accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  RegionNode* region() const { Node* r = in(Region); assert(!r || r->is_Region(), ""); return (RegionNode*)r; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  Node* is_copy() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    // The node is a real phi if _in[0] is a Region node.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    DEBUG_ONLY(const Node* r = _in[Region];)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
    assert(r != NULL && r->is_Region(), "Not valid control");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
    return NULL;  // not a copy!
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
1432
44f076e3d2a4 6667595: Set probability FAIR for pre-, post- loops and ALWAYS for main loop
kvn
parents: 781
diff changeset
   180
  bool is_tripcount() const;
44f076e3d2a4 6667595: Set probability FAIR for pre-, post- loops and ALWAYS for main loop
kvn
parents: 781
diff changeset
   181
237
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   182
  // Determine a unique non-trivial input, if any.
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   183
  // Ignore casts if it helps.  Return NULL on failure.
35545
a8f29dfd62b2 8139771: Eliminating CastPP nodes at Phis when they all come from a unique input may cause crash
roland
parents: 34164
diff changeset
   184
  Node* unique_input(PhaseTransform *phase, bool uncast);
a8f29dfd62b2 8139771: Eliminating CastPP nodes at Phis when they all come from a unique input may cause crash
roland
parents: 34164
diff changeset
   185
  Node* unique_input(PhaseTransform *phase) {
a8f29dfd62b2 8139771: Eliminating CastPP nodes at Phis when they all come from a unique input may cause crash
roland
parents: 34164
diff changeset
   186
    Node* uin = unique_input(phase, false);
a8f29dfd62b2 8139771: Eliminating CastPP nodes at Phis when they all come from a unique input may cause crash
roland
parents: 34164
diff changeset
   187
    if (uin == NULL) {
a8f29dfd62b2 8139771: Eliminating CastPP nodes at Phis when they all come from a unique input may cause crash
roland
parents: 34164
diff changeset
   188
      uin = unique_input(phase, true);
a8f29dfd62b2 8139771: Eliminating CastPP nodes at Phis when they all come from a unique input may cause crash
roland
parents: 34164
diff changeset
   189
    }
a8f29dfd62b2 8139771: Eliminating CastPP nodes at Phis when they all come from a unique input may cause crash
roland
parents: 34164
diff changeset
   190
    return uin;
a8f29dfd62b2 8139771: Eliminating CastPP nodes at Phis when they all come from a unique input may cause crash
roland
parents: 34164
diff changeset
   191
  }
237
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   192
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  // Check for a simple dead loop.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  enum LoopSafety { Safe = 0, Unsafe, UnsafeLoop };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  LoopSafety simple_data_loop_check(Node *in) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  // Is it unsafe data loop? It becomes a dead loop if this phi node removed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  bool is_unsafe_data_reference(Node *in) const;
15113
823590505eb4 8005071: Incremental inlining for JSR 292
roland
parents: 10255
diff changeset
   198
  int  is_diamond_phi(bool check_control_only = false) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  virtual bool pinned() const { return in(0) != 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; }
237
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   202
40871
82848b0654f8 8038348: Instance field load is replaced by wrong data Phi
thartmann
parents: 35574
diff changeset
   203
  void  set_inst_mem_id(int inst_mem_id) { _inst_mem_id = inst_mem_id; }
82848b0654f8 8038348: Instance field load is replaced by wrong data Phi
thartmann
parents: 35574
diff changeset
   204
  const int inst_mem_id() const { return _inst_mem_id; }
237
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   205
  const int inst_id()     const { return _inst_id; }
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   206
  const int inst_index()  const { return _inst_index; }
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   207
  const int inst_offset() const { return _inst_offset; }
40871
82848b0654f8 8038348: Instance field load is replaced by wrong data Phi
thartmann
parents: 35574
diff changeset
   208
  bool is_same_inst_field(const Type* tp, int mem_id, int id, int index, int offset) {
237
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   209
    return type()->basic_type() == tp->basic_type() &&
40871
82848b0654f8 8038348: Instance field load is replaced by wrong data Phi
thartmann
parents: 35574
diff changeset
   210
           inst_mem_id() == mem_id &&
237
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   211
           inst_id()     == id     &&
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   212
           inst_index()  == index  &&
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   213
           inst_offset() == offset &&
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   214
           type()->higher_equal(tp);
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   215
  }
fba97e902303 6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents: 190
diff changeset
   216
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
   217
  virtual const Type* Value(PhaseGVN* phase) const;
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
   218
  virtual Node* Identity(PhaseGVN* phase);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  virtual const RegMask &out_RegMask() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  virtual const RegMask &in_RegMask(uint) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
#ifndef PRODUCT
32084
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   223
  virtual void related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  void verify_adr_type(VectorSet& visited, const TypePtr* at) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  void verify_adr_type(bool recursive = false) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
#else //ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  void verify_adr_type(bool recursive = false) const {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
#endif //ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
//------------------------------GotoNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
// GotoNodes perform direct branches.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
class GotoNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
public:
10255
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 7397
diff changeset
   238
  GotoNode( Node *control ) : Node(control) {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  virtual bool pinned() const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  virtual bool  is_CFG() const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  virtual uint hash() const { return NO_HASH; }  // CFG nodes do not hash
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  virtual const Node *is_block_proj() const { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  virtual bool depends_only_on_test() const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  virtual const Type *bottom_type() const { return Type::CONTROL; }
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
   246
  virtual const Type* Value(PhaseGVN* phase) const;
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
   247
  virtual Node* Identity(PhaseGVN* phase);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  virtual const RegMask &out_RegMask() const;
32084
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   249
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   250
#ifndef PRODUCT
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   251
  virtual void related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   252
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
//------------------------------CProjNode--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
// control projection for node that produces multiple control-flow paths
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
class CProjNode : public ProjNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  CProjNode( Node *ctrl, uint idx ) : ProjNode(ctrl,idx) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  virtual bool  is_CFG() const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  virtual uint hash() const { return NO_HASH; }  // CFG nodes do not hash
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  virtual const Node *is_block_proj() const { return in(0); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  virtual const RegMask &out_RegMask() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  virtual uint ideal_reg() const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
//---------------------------MultiBranchNode-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
// This class defines a MultiBranchNode, a MultiNode which yields multiple
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
// control values. These are distinguished from other types of MultiNodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
// which yield multiple values, but control is always and only projection #0.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
class MultiBranchNode : public MultiNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  MultiBranchNode( uint required ) : MultiNode(required) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
    init_class_id(Class_MultiBranch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  }
374
585c671c9c0e 6663848: assert(i < Max(),"oob") in C2 with -Xcomp
never
parents: 247
diff changeset
   277
  // returns required number of users to be well formed.
585c671c9c0e 6663848: assert(i < Max(),"oob") in C2 with -Xcomp
never
parents: 247
diff changeset
   278
  virtual int required_outcnt() const = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
//------------------------------IfNode-----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
// Output selected Control, based on a boolean test
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
class IfNode : public MultiBranchNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  // Size is bigger to hold the probability field.  However, _prob does not
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  // change the semantics so it does not appear in the hash & cmp functions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  virtual uint size_of() const { return sizeof(*this); }
30183
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   287
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   288
private:
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   289
  // Helper methods for fold_compares
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   290
  bool cmpi_folds(PhaseIterGVN* igvn);
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   291
  bool is_ctrl_folds(Node* ctrl, PhaseIterGVN* igvn);
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   292
  bool has_shared_region(ProjNode* proj, ProjNode*& success, ProjNode*& fail);
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   293
  bool has_only_uncommon_traps(ProjNode* proj, ProjNode*& success, ProjNode*& fail, PhaseIterGVN* igvn);
34164
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   294
  Node* merge_uncommon_traps(ProjNode* proj, ProjNode* success, ProjNode* fail, PhaseIterGVN* igvn);
30183
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   295
  static void improve_address_types(Node* l, Node* r, ProjNode* fail, PhaseIterGVN* igvn);
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   296
  bool is_cmp_with_loadrange(ProjNode* proj);
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   297
  bool is_null_check(ProjNode* proj, PhaseIterGVN* igvn);
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   298
  bool is_side_effect_free_test(ProjNode* proj, PhaseIterGVN* igvn);
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   299
  void reroute_side_effect_free_unc(ProjNode* proj, ProjNode* dom_proj, PhaseIterGVN* igvn);
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   300
  ProjNode* uncommon_trap_proj(CallStaticJavaNode*& call) const;
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   301
  bool fold_compares_helper(ProjNode* proj, ProjNode* success, ProjNode* fail, PhaseIterGVN* igvn);
49875
6d1f26b1ddfd 8201368: IfNode::fold_compares() may lead to incorrect execution
roland
parents: 47216
diff changeset
   302
  static bool is_dominator_unc(CallStaticJavaNode* dom_unc, CallStaticJavaNode* unc);
30183
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   303
34164
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   304
protected:
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   305
  ProjNode* range_check_trap_proj(int& flip, Node*& l, Node*& r);
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   306
  Node* Ideal_common(PhaseGVN *phase, bool can_reshape);
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   307
  Node* search_identical(int dist);
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   308
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  // Degrees of branch prediction probability by order of magnitude:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  // PROB_UNLIKELY_1e(N) is a 1 in 1eN chance.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  // PROB_LIKELY_1e(N) is a 1 - PROB_UNLIKELY_1e(N)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
#define PROB_UNLIKELY_MAG(N)    (1e- ## N ## f)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
#define PROB_LIKELY_MAG(N)      (1.0f-PROB_UNLIKELY_MAG(N))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  // Maximum and minimum branch prediction probabilties
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  // 1 in 1,000,000 (magnitude 6)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  // Although PROB_NEVER == PROB_MIN and PROB_ALWAYS == PROB_MAX
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  // they are used to distinguish different situations:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  // The name PROB_MAX (PROB_MIN) is for probabilities which correspond to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
  // very likely (unlikely) but with a concrete possibility of a rare
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  // contrary case.  These constants would be used for pinning
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  // measurements, and as measures for assertions that have high
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  // confidence, but some evidence of occasional failure.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  // The name PROB_ALWAYS (PROB_NEVER) is to stand for situations for which
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  // there is no evidence at all that the contrary case has ever occurred.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
#define PROB_NEVER              PROB_UNLIKELY_MAG(6)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
#define PROB_ALWAYS             PROB_LIKELY_MAG(6)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
#define PROB_MIN                PROB_UNLIKELY_MAG(6)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
#define PROB_MAX                PROB_LIKELY_MAG(6)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
  // Static branch prediction probabilities
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  // 1 in 10 (magnitude 1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
#define PROB_STATIC_INFREQUENT  PROB_UNLIKELY_MAG(1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
#define PROB_STATIC_FREQUENT    PROB_LIKELY_MAG(1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  // Fair probability 50/50
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
#define PROB_FAIR               (0.5f)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
  // Unknown probability sentinel
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
#define PROB_UNKNOWN            (-1.0f)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
  // Probability "constructors", to distinguish as a probability any manifest
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
  // constant without a names
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
#define PROB_LIKELY(x)          ((float) (x))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
#define PROB_UNLIKELY(x)        (1.0f - (float)(x))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  // Other probabilities in use, but without a unique name, are documented
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  // here for lack of a better place:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  // 1 in 1000 probabilities (magnitude 3):
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  //     threshold for converting to conditional move
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
  //     likelihood of null check failure if a null HAS been seen before
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  //     likelihood of slow path taken in library calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  // 1 in 10,000 probabilities (magnitude 4):
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  //     threshold for making an uncommon trap probability more extreme
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  //     threshold for for making a null check implicit
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  //     likelihood of needing a gc if eden top moves during an allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  //     likelihood of a predicted call failure
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  // 1 in 100,000 probabilities (magnitude 5):
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
  //     threshold for ignoring counts when estimating path frequency
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  //     likelihood of FP clipping failure
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
  //     likelihood of catching an exception from a try block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  //     likelihood of null check failure if a null has NOT been seen before
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
  // Magic manifest probabilities such as 0.83, 0.7, ... can be found in
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
  // gen_subtype_check() and catch_inline_exceptions().
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
  float _prob;                  // Probability of true path being taken.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
  float _fcnt;                  // Frequency counter
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
  IfNode( Node *control, Node *b, float p, float fcnt )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
    : MultiBranchNode(2), _prob(p), _fcnt(fcnt) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
    init_class_id(Class_If);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
    init_req(0,control);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
    init_req(1,b);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  virtual bool pinned() const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
  virtual const Type *bottom_type() const { return TypeTuple::IFBOTH; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
   389
  virtual const Type* Value(PhaseGVN* phase) const;
374
585c671c9c0e 6663848: assert(i < Max(),"oob") in C2 with -Xcomp
never
parents: 247
diff changeset
   390
  virtual int required_outcnt() const { return 2; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  virtual const RegMask &out_RegMask() const;
30183
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 28486
diff changeset
   392
  Node* fold_compares(PhaseIterGVN* phase);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
  static Node* up_one_dom(Node* curr, bool linear_only = false);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents: 52143
diff changeset
   394
  Node* dominated_by(Node* prev_dom, PhaseIterGVN* igvn);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
190
e9a0a9dcd4f6 6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents: 1
diff changeset
   396
  // Takes the type of val and filters it through the test represented
e9a0a9dcd4f6 6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents: 1
diff changeset
   397
  // by if_proj and returns a more refined type if one is produced.
e9a0a9dcd4f6 6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents: 1
diff changeset
   398
  // Returns NULL is it couldn't improve the type.
e9a0a9dcd4f6 6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents: 1
diff changeset
   399
  static const TypeInt* filtered_int_type(PhaseGVN* phase, Node* val, Node* if_proj);
e9a0a9dcd4f6 6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents: 1
diff changeset
   400
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
  virtual void dump_spec(outputStream *st) const;
32084
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   403
  virtual void related(GrowableArray <Node *> *in_rel, GrowableArray <Node *> *out_rel, bool compact) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
34164
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   407
class RangeCheckNode : public IfNode {
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   408
private:
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   409
  int is_range_check(Node* &range, Node* &index, jint &offset);
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   410
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   411
public:
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   412
  RangeCheckNode(Node* control, Node *b, float p, float fcnt)
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   413
    : IfNode(control, b, p, fcnt) {
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   414
    init_class_id(Class_RangeCheck);
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   415
  }
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   416
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   417
  virtual int Opcode() const;
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   418
  virtual Node* Ideal(PhaseGVN *phase, bool can_reshape);
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   419
};
a9e6034d7707 8137168: Replace IfNode with a new RangeCheckNode for range checks
roland
parents: 32084
diff changeset
   420
28486
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   421
class IfProjNode : public CProjNode {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
public:
28486
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   423
  IfProjNode(IfNode *ifnode, uint idx) : CProjNode(ifnode,idx) {}
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
   424
  virtual Node* Identity(PhaseGVN* phase);
28486
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   425
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   426
protected:
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   427
  // Type of If input when this branch is always taken
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   428
  virtual bool always_taken(const TypeTuple* t) const = 0;
32084
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   429
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   430
#ifndef PRODUCT
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   431
public:
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   432
  virtual void related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   433
#endif
28486
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   434
};
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   435
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   436
class IfTrueNode : public IfProjNode {
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   437
public:
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   438
  IfTrueNode( IfNode *ifnode ) : IfProjNode(ifnode,1) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
    init_class_id(Class_IfTrue);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
  virtual int Opcode() const;
28486
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   442
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   443
protected:
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   444
  virtual bool always_taken(const TypeTuple* t) const { return t == TypeTuple::IFTRUE; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
28486
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   447
class IfFalseNode : public IfProjNode {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
public:
28486
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   449
  IfFalseNode( IfNode *ifnode ) : IfProjNode(ifnode,0) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
    init_class_id(Class_IfFalse);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
  virtual int Opcode() const;
28486
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   453
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   454
protected:
b0df113b962e 8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1
roland
parents: 15113
diff changeset
   455
  virtual bool always_taken(const TypeTuple* t) const { return t == TypeTuple::IFFALSE; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
//------------------------------PCTableNode------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
// Build an indirect branch table.  Given a control and a table index,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
// control is passed to the Projection matching the table index.  Used to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
// implement switch statements and exception-handling capabilities.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
// Undefined behavior if passed-in index is not inside the table.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
class PCTableNode : public MultiBranchNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
  virtual uint hash() const;    // Target count; table size
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
  virtual uint cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
  virtual uint size_of() const { return sizeof(*this); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
  const uint _size;             // Number of targets
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
  PCTableNode( Node *ctrl, Node *idx, uint size ) : MultiBranchNode(2), _size(size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
    init_class_id(Class_PCTable);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
    init_req(0, ctrl);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
    init_req(1, idx);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
  virtual int Opcode() const;
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
   478
  virtual const Type* Value(PhaseGVN* phase) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
  virtual const Type *bottom_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
  virtual bool pinned() const { return true; }
374
585c671c9c0e 6663848: assert(i < Max(),"oob") in C2 with -Xcomp
never
parents: 247
diff changeset
   482
  virtual int required_outcnt() const { return _size; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
//------------------------------JumpNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
// Indirect branch.  Uses PCTable above to implement a switch statement.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
// It emits as a table load and local branch.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
class JumpNode : public PCTableNode {
49877
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 49875
diff changeset
   489
  virtual uint size_of() const { return sizeof(*this); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
public:
49877
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 49875
diff changeset
   491
  float* _probs; // probability of each projection
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 49875
diff changeset
   492
  float _fcnt;   // total number of times this Jump was executed
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 49875
diff changeset
   493
  JumpNode( Node* control, Node* switch_val, uint size, float* probs, float cnt)
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 49875
diff changeset
   494
    : PCTableNode(control, switch_val, size),
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 49875
diff changeset
   495
      _probs(probs), _fcnt(cnt) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
    init_class_id(Class_Jump);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
  virtual int   Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
  virtual const RegMask& out_RegMask() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
  virtual const Node* is_block_proj() const { return this; }
32084
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   501
#ifndef PRODUCT
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   502
  virtual void related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   503
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
class JumpProjNode : public JProjNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
  virtual uint hash() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
  virtual uint cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
  virtual uint size_of() const { return sizeof(*this); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
  const int  _dest_bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
  const uint _proj_no;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
  const int  _switch_val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
  JumpProjNode(Node* jumpnode, uint proj_no, int dest_bci, int switch_val)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
    : JProjNode(jumpnode, proj_no), _dest_bci(dest_bci), _proj_no(proj_no), _switch_val(switch_val) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
    init_class_id(Class_JumpProj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
  virtual const Type* bottom_type() const { return Type::CONTROL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
  int  dest_bci()    const { return _dest_bci; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
  int  switch_val()  const { return _switch_val; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
  uint proj_no()     const { return _proj_no; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
  virtual void dump_spec(outputStream *st) const;
32084
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   528
  virtual void dump_compact_spec(outputStream *st) const;
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   529
  virtual void related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
//------------------------------CatchNode--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
// Helper node to fork exceptions.  "Catch" catches any exceptions thrown by
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
// a just-prior call.  Looks like a PCTableNode but emits no code - just the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
// table.  The table lookup and branch is implemented by RethrowNode.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
class CatchNode : public PCTableNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
  CatchNode( Node *ctrl, Node *idx, uint size ) : PCTableNode(ctrl,idx,size){
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
    init_class_id(Class_Catch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
  virtual int Opcode() const;
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
   543
  virtual const Type* Value(PhaseGVN* phase) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
// CatchProjNode controls which exception handler is targetted after a call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
// It is passed in the bci of the target handler, or no_handler_bci in case
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
// the projection doesn't lead to an exception handler.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
class CatchProjNode : public CProjNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
  virtual uint hash() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
  virtual uint cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
  virtual uint size_of() const { return sizeof(*this); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
  const int _handler_bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
    fall_through_index =  0,      // the fall through projection index
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
    catch_all_index    =  1,      // the projection index for catch-alls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
    no_handler_bci     = -1       // the bci for fall through or catch-all projs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
  CatchProjNode(Node* catchnode, uint proj_no, int handler_bci)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
    : CProjNode(catchnode, proj_no), _handler_bci(handler_bci) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
    init_class_id(Class_CatchProj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
    assert(proj_no != fall_through_index || handler_bci < 0, "fall through case must have bci < 0");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
  virtual int Opcode() const;
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
   571
  virtual Node* Identity(PhaseGVN* phase);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
  virtual const Type *bottom_type() const { return Type::CONTROL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
  int  handler_bci() const        { return _handler_bci; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
  bool is_handler_proj() const    { return _handler_bci >= 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
//---------------------------------CreateExNode--------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
// Helper node to create the exception coming back from a call
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
class CreateExNode : public TypeNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
  CreateExNode(const Type* t, Node* control, Node* i_o) : TypeNode(t, 2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
    init_req(0, control);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
    init_req(1, i_o);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
  virtual int Opcode() const;
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
   590
  virtual Node* Identity(PhaseGVN* phase);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
  virtual bool pinned() const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
  uint match_edge(uint idx) const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
  virtual uint ideal_reg() const { return Op_RegP; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
//------------------------------NeverBranchNode-------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
// The never-taken branch.  Used to give the appearance of exiting infinite
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
// loops to those algorithms that like all paths to be reachable.  Encodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
// empty.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
class NeverBranchNode : public MultiBranchNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
  NeverBranchNode( Node *ctrl ) : MultiBranchNode(1) { init_req(0,ctrl); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
  virtual bool pinned() const { return true; };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
  virtual const Type *bottom_type() const { return TypeTuple::IFBOTH; }
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35545
diff changeset
   606
  virtual const Type* Value(PhaseGVN* phase) const;
374
585c671c9c0e 6663848: assert(i < Max(),"oob") in C2 with -Xcomp
never
parents: 247
diff changeset
   607
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
585c671c9c0e 6663848: assert(i < Max(),"oob") in C2 with -Xcomp
never
parents: 247
diff changeset
   608
  virtual int required_outcnt() const { return 2; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
  virtual uint size(PhaseRegAlloc *ra_) const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   615
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52925
diff changeset
   616
#endif // SHARE_OPTO_CFGNODE_HPP