< prev index next >

src/share/vm/opto/node.cpp

Print this page

        

@@ -41,13 +41,10 @@
 class RegMask;
 // #include "phase.hpp"
 class PhaseTransform;
 class PhaseGVN;
 
-// Arena we are currently building Nodes in
-const uint Node::NotAMachineReg = 0xffff0000;
-
 #ifndef PRODUCT
 extern int nodes_created;
 #endif
 #ifdef __clang__
 #pragma clang diagnostic push

@@ -697,11 +694,11 @@
 
 #ifdef ASSERT
 //------------------------------is_dead----------------------------------------
 bool Node::is_dead() const {
   // Mach and pinch point nodes may look like dead.
-  if( is_top() || is_Mach() || (Opcode() == Op_Node && _outcnt > 0) )
+  if( is_top() || is_Mach() || (Opcode() == Opcodes::Op_Node && _outcnt > 0) )
     return false;
   for( uint i = 0; i < _max; i++ )
     if( _in[i] != NULL )
       return false;
   dump();

@@ -904,29 +901,29 @@
   else
     return (Node*) this;
 }
 
 // Find out of current node that matches opcode.
-Node* Node::find_out_with(int opcode) {
+Node* Node::find_out_with(Opcodes opcode) {
   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
     Node* use = fast_out(i);
     if (use->Opcode() == opcode) {
       return use;
     }
   }
   return NULL;
 }
 
 // Return true if the current node has an out that matches opcode.
-bool Node::has_out_with(int opcode) {
+bool Node::has_out_with(Opcodes opcode) {
   return (find_out_with(opcode) != NULL);
 }
 
 // Return true if the current node has an out that matches any of the opcodes.
-bool Node::has_out_with(int opcode1, int opcode2, int opcode3, int opcode4) {
+bool Node::has_out_with(Opcodes opcode1, Opcodes opcode2, Opcodes opcode3, Opcodes opcode4) {
   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
-      int opcode = fast_out(i)->Opcode();
+      Opcodes opcode = fast_out(i)->Opcode();
       if (opcode == opcode1 || opcode == opcode2 || opcode == opcode3 || opcode == opcode4) {
         return true;
       }
   }
   return false;

@@ -997,11 +994,11 @@
 
 //------------------------------size_of----------------------------------------
 uint Node::size_of() const { return sizeof(*this); }
 
 //------------------------------ideal_reg--------------------------------------
-uint Node::ideal_reg() const { return 0; }
+Opcodes Node::ideal_reg() const { return Opcodes::Op_Node; }
 
 //------------------------------jvms-------------------------------------------
 JVMState* Node::jvms() const { return NULL; }
 
 #ifdef ASSERT

@@ -1130,21 +1127,21 @@
 // unique users of specific nodes. Such nodes should be put on IGVN worklist
 // for the transformations to happen.
 bool Node::has_special_unique_user() const {
   assert(outcnt() == 1, "match only for unique out");
   Node* n = unique_out();
-  int op  = Opcode();
+  Opcodes op  = Opcode();
   if (this->is_Store()) {
     // Condition for back-to-back stores folding.
     return n->Opcode() == op && n->in(MemNode::Memory) == this;
   } else if (this->is_Load()) {
     // Condition for removing an unused LoadNode from the MemBarAcquire precedence input
-    return n->Opcode() == Op_MemBarAcquire;
-  } else if (op == Op_AddL) {
+    return n->Opcode() == Opcodes::Op_MemBarAcquire;
+  } else if (op == Opcodes::Op_AddL) {
     // Condition for convL2I(addL(x,y)) ==> addI(convL2I(x),convL2I(y))
-    return n->Opcode() == Op_ConvL2I && n->in(1) == this;
-  } else if (op == Op_SubI || op == Op_SubL) {
+    return n->Opcode() == Opcodes::Op_ConvL2I && n->in(1) == this;
+  } else if (op == Opcodes::Op_SubI || op == Opcodes::Op_SubL) {
     // Condition for subI(x,subI(y,z)) ==> subI(addI(x,z),y)
     return n->Opcode() == op && n->in(2) == this;
   } else if (is_If() && (n->is_IfFalse() || n->is_IfTrue())) {
     // See IfProjNode::Identity()
     return true;

@@ -1420,11 +1417,11 @@
 // Hash function over Nodes.
 uint Node::hash() const {
   uint sum = 0;
   for( uint i=0; i<_cnt; i++ )  // Add in all inputs
     sum = (sum<<1)-(uintptr_t)in(i);        // Ignore embedded NULLs
-  return (sum>>2) + _cnt + Opcode();
+  return (sum>>2) + _cnt + static_cast<uint>(Opcode());
 }
 
 //------------------------------cmp--------------------------------------------
 // Compare special parts of simple Nodes
 uint Node::cmp( const Node &n ) const {

@@ -1463,17 +1460,17 @@
 }
 
 // Get a pointer constant from a ConstNode.
 // Returns the constant if it is a pointer ConstNode
 intptr_t Node::get_ptr() const {
-  assert( Opcode() == Op_ConP, "" );
+  assert( Opcode() == Opcodes::Op_ConP, "" );
   return ((ConPNode*)this)->type()->is_ptr()->get_con();
 }
 
 // Get a narrow oop constant from a ConNNode.
 intptr_t Node::get_narrowcon() const {
-  assert( Opcode() == Op_ConN, "" );
+  assert( Opcode() == Opcodes::Op_ConN, "" );
   return ((ConNNode*)this)->type()->is_narrowoop()->get_con();
 }
 
 // Get a long constant from a ConNode.
 // Return a default value if there is no apparent constant here.

@@ -1503,18 +1500,18 @@
 }
 
 // Get a double constant from a ConstNode.
 // Returns the constant if it is a double ConstNode
 jdouble Node::getd() const {
-  assert( Opcode() == Op_ConD, "" );
+  assert( Opcode() == Opcodes::Op_ConD, "" );
   return ((ConDNode*)this)->type()->is_double_constant()->getd();
 }
 
 // Get a float constant from a ConstNode.
 // Returns the constant if it is a float ConstNode
 jfloat Node::getf() const {
-  assert( Opcode() == Op_ConF, "" );
+  assert( Opcode() == Opcodes::Op_ConF, "" );
   return ((ConFNode*)this)->type()->is_float_constant()->getf();
 }
 
 #ifndef PRODUCT
 

@@ -1535,11 +1532,11 @@
                  (uintptr_t)result, (uintptr_t)n, node_idx);
     result = n;
   }
   v->set(n->_idx);
   for( uint i=0; i<n->len(); i++ ) {
-    if( only_ctrl && !(n->is_Region()) && (n->Opcode() != Op_Root) && (i != TypeFunc::Control) ) continue;
+    if( only_ctrl && !(n->is_Region()) && (n->Opcode() != Opcodes::Op_Root) && (i != TypeFunc::Control) ) continue;
     find_recur(C, result, n->in(i), idx, only_ctrl, old_space, new_space );
   }
   // Search along forward edges also:
   if (idx < 0 && !only_ctrl) {
     for( uint j=0; j<n->outcnt(); j++ ) {

@@ -1588,11 +1585,11 @@
 
 #ifndef PRODUCT
 
 // -----------------------------Name-------------------------------------------
 extern const char *NodeClassNames[];
-const char *Node::Name() const { return NodeClassNames[Opcode()]; }
+const char *Node::Name() const { return NodeClassNames[static_cast<uint>(Opcode())]; }
 
 static bool is_disconnected(const Node* n) {
   for (uint i = 0; i < n->req(); i++) {
     if (n->in(i) != NULL)  return false;
   }

@@ -2271,11 +2268,11 @@
 //--------------------------is_iteratively_computed------------------------------
 // Operation appears to be iteratively computed (such as an induction variable)
 // It is possible for this operation to return false for a loop-varying
 // value, if it appears (by local graph inspection) to be computed by a simple conditional.
 bool Node::is_iteratively_computed() {
-  if (ideal_reg()) { // does operation have a result register?
+  if (ideal_reg() != Opcodes::Op_Node) { // does operation have a result register?
     for (uint i = 1; i < req(); i++) {
       Node* n = in(i);
       if (n != NULL && n->is_Phi()) {
         for (uint j = 1; j < n->req(); j++) {
           if (n->in(j) == this) {

@@ -2289,11 +2286,11 @@
 }
 
 //--------------------------find_similar------------------------------
 // Return a node with opcode "opc" and same inputs as "this" if one can
 // be found; Otherwise return NULL;
-Node* Node::find_similar(int opc) {
+Node* Node::find_similar(Opcodes opc) {
   if (req() >= 2) {
     Node* def = in(1);
     if (def && def->outcnt() >= 2) {
       for (DUIterator_Fast dmax, i = def->fast_outs(dmax); i < dmax; i++) {
         Node* use = def->fast_out(i);

@@ -2450,8 +2447,8 @@
 { return !Type::cmp( _type, ((TypeNode&)n)._type ); }
 const Type *TypeNode::bottom_type() const { return _type; }
 const Type* TypeNode::Value(PhaseGVN* phase) const { return _type; }
 
 //------------------------------ideal_reg--------------------------------------
-uint TypeNode::ideal_reg() const {
+Opcodes TypeNode::ideal_reg() const {
   return _type->ideal_reg();
 }
< prev index next >