src/share/vm/opto/graphKit.hpp

Print this page

        

@@ -752,17 +752,43 @@
   // Generate a check-cast idiom.  Used by both the check-cast bytecode
   // and the array-store bytecode
   Node* gen_checkcast( Node *subobj, Node* superkls,
                        Node* *failure_control = NULL );
 
+  // helper functions that correctly interacts with the GVN depending
+  // on the current compiler phase
+  static Node *gvn_transform(Node *n, PhaseGVN* gvn) {
+    if (gvn->is_IterGVN() == NULL) {
+      return gvn->transform(n);
+    } else {
+      gvn->is_IterGVN()->register_new_node_with_optimizer(n);
+      return n;
+    }
+    return NULL;
+  }
+
+  static void gvn_transform_ctrl(Node *n, PhaseGVN* gvn) {
+    if (gvn->is_IterGVN() == NULL) {
+      gvn->C->record_for_igvn(n);
+    }
+  }
+
   // Generate a subtyping check.  Takes as input the subtype and supertype.
   // Returns 2 values: sets the default control() to the true path and
   // returns the false path.  Only reads from constant memory taken from the
   // default memory; does not write anything.  It also doesn't take in an
   // Object; if you wish to check an Object you need to load the Object's
   // class prior to coming here.
-  Node* gen_subtype_check(Node* subklass, Node* superklass);
+  static Node* gen_subtype_check_any_phase(Node* subklass, Node* superklass, Node** ctrl, MergeMemNode* mem, PhaseGVN* gvn);
+
+  Node* gen_subtype_check(Node* subklass, Node* superklass) {
+    MergeMemNode* mem = merged_memory();
+    Node* ctrl = control();
+    Node* n = gen_subtype_check_any_phase(subklass, superklass, &ctrl, mem, &_gvn);
+    set_control(ctrl);
+    return n;
+  }
 
   // Exact type check used for predicted calls and casts.
   // Rewrites (*casted_receiver) to be casted to the stronger type.
   // (Caller is responsible for doing replace_in_map.)
   Node* type_check_receiver(Node* receiver, ciKlass* klass, float prob,