1.1 --- a/src/share/vm/opto/macro.cpp Fri Jan 13 00:51:43 2012 -0800 1.2 +++ b/src/share/vm/opto/macro.cpp Fri Jan 13 12:58:26 2012 -0800 1.3 @@ -1802,10 +1802,14 @@ 1.4 // Mark all associated (same box and obj) lock and unlock nodes for 1.5 // elimination if some of them marked already. 1.6 void PhaseMacroExpand::mark_eliminated_box(Node* oldbox, Node* obj) { 1.7 - if (oldbox->is_BoxLock() && oldbox->as_BoxLock()->is_eliminated()) 1.8 - return; 1.9 + if (oldbox->as_BoxLock()->is_eliminated()) 1.10 + return; // This BoxLock node was processed already. 1.11 1.12 - if (oldbox->is_BoxLock() && 1.13 + // New implementation (EliminateNestedLocks) has separate BoxLock 1.14 + // node for each locked region so mark all associated locks/unlocks as 1.15 + // eliminated even if different objects are referenced in one locked region 1.16 + // (for example, OSR compilation of nested loop inside locked scope). 1.17 + if (EliminateNestedLocks || 1.18 oldbox->as_BoxLock()->is_simple_lock_region(NULL, obj)) { 1.19 // Box is used only in one lock region. Mark this box as eliminated. 1.20 _igvn.hash_delete(oldbox); 1.21 @@ -1818,7 +1822,6 @@ 1.22 AbstractLockNode* alock = u->as_AbstractLock(); 1.23 // Check lock's box since box could be referenced by Lock's debug info. 1.24 if (alock->box_node() == oldbox) { 1.25 - assert(alock->obj_node()->eqv_uncast(obj), ""); 1.26 // Mark eliminated all related locks and unlocks. 1.27 alock->set_non_esc_obj(); 1.28 }