--- a/hotspot/src/share/vm/opto/parse1.cpp Thu Jan 12 12:28:59 2012 -0800
+++ b/hotspot/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 {