diff src/share/vm/opto/parse1.cpp @ 4790:b0ff910edfc9

7128355: assert(!nocreate) failed: Cannot build a phi for a block already parsed Summary: Do not common BoxLock nodes and avoid creating phis of boxes. Reviewed-by: never
author kvn
date Thu, 12 Jan 2012 14:45:04 -0800
parents e9a5e0a812c8
children 1d7922586cf6
line wrap: on
line diff
--- a/src/share/vm/opto/parse1.cpp	Thu Jan 12 12:28:59 2012 -0800
+++ b/src/share/vm/opto/parse1.cpp	Thu Jan 12 14:45:04 2012 -0800
@@ -1604,7 +1604,16 @@
           continue;
         default:                // All normal stuff
           if (phi == NULL) {
-            if (!check_elide_phi || !target->can_elide_SEL_phi(j)) {
+            const JVMState* jvms = map()->jvms();
+            if (EliminateNestedLocks &&
+                jvms->is_mon(j) && jvms->is_monitor_box(j)) {
+              // BoxLock nodes are not commoning.
+              // Use old BoxLock node as merged box.
+              assert(newin->jvms()->is_monitor_box(j), "sanity");
+              // This assert also tests that nodes are BoxLock.
+              assert(BoxLockNode::same_slot(n, m), "sanity");
+              C->gvn_replace_by(n, m);
+            } else if (!check_elide_phi || !target->can_elide_SEL_phi(j)) {
               phi = ensure_phi(j, nophi);
             }
           }
@@ -1819,12 +1828,8 @@
   } else if (jvms->is_stk(idx)) {
     t = block()->stack_type_at(idx - jvms->stkoff());
   } else if (jvms->is_mon(idx)) {
-    if (EliminateNestedLocks && jvms->is_monitor_box(idx)) {
-      // BoxLock nodes are not commoning. Create Phi.
-      t = o->bottom_type(); // TypeRawPtr::BOTTOM
-    } else {
-      t = TypeInstPtr::BOTTOM; // this is sufficient for a lock object
-    }
+    assert(!jvms->is_monitor_box(idx), "no phis for boxes");
+    t = TypeInstPtr::BOTTOM; // this is sufficient for a lock object
   } else if ((uint)idx < TypeFunc::Parms) {
     t = o->bottom_type();  // Type::RETURN_ADDRESS or such-like.
   } else {