From 876ef744ab1a0ad1d3a65ab249d0d56f9bebfa22 Mon Sep 17 00:00:00 2001 From: kvn Date: Fri, 13 Jan 2012 12:58:26 -0800 Subject: [PATCH] 7129618: assert(obj_node->eqv_uncast(obj),""); Summary: Relax verification and locks elimination checks for new implementation (EliminateNestedLocks). Reviewed-by: iveresov --- hotspot/src/share/vm/opto/locknode.cpp | 35 +++++--------------------- hotspot/src/share/vm/opto/macro.cpp | 13 ++++++---- 2 files changed, 14 insertions(+), 34 deletions(-) diff --git a/hotspot/src/share/vm/opto/locknode.cpp b/hotspot/src/share/vm/opto/locknode.cpp index d090c86825..4147ed33dc 100644 --- a/hotspot/src/share/vm/opto/locknode.cpp +++ b/hotspot/src/share/vm/opto/locknode.cpp @@ -118,35 +118,12 @@ bool BoxLockNode::is_simple_lock_region(LockNode** unique_lock, Node* obj) { FastLockNode* flock = n->as_FastLock(); assert((flock->box_node() == this) && flock->obj_node()->eqv_uncast(obj),""); } - if (n->is_SafePoint() && n->as_SafePoint()->jvms()) { - SafePointNode* sfn = n->as_SafePoint(); - JVMState* youngest_jvms = sfn->jvms(); - int max_depth = youngest_jvms->depth(); - for (int depth = 1; depth <= max_depth; depth++) { - JVMState* jvms = youngest_jvms->of_depth(depth); - int num_mon = jvms->nof_monitors(); - // Loop over monitors - for (int idx = 0; idx < num_mon; idx++) { - Node* obj_node = sfn->monitor_obj(jvms, idx); - Node* box_node = sfn->monitor_box(jvms, idx); - if (box_node == this) { - if (!obj_node->eqv_uncast(obj)) { - tty->cr(); - tty->print_cr("=====monitor info has different obj====="); - tty->print_cr("obj:"); - obj->dump(1); tty->cr(); - tty->print_cr("obj uncast:"); - obj->uncast()->dump(); tty->cr(); - tty->print_cr("obj_node:"); - obj_node->dump(1); tty->cr(); - tty->print_cr("obj_node uncast:"); - obj_node->uncast()->dump(); - } - assert(obj_node->eqv_uncast(obj),"monitor info has different obj"); - } - } - } - } + // Don't check monitor info in safepoints since the referenced object could + // be different from the locked object. It could be Phi node of different + // cast nodes which point to this locked object. + // We assume that no other objects could be referenced in monitor info + // associated with this BoxLock node because all associated locks and + // unlocks are reference only this one object. } #endif if (unique_lock != NULL && has_one_lock) { diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp index 45ac982cb6..adcf8e48f5 100644 --- a/hotspot/src/share/vm/opto/macro.cpp +++ b/hotspot/src/share/vm/opto/macro.cpp @@ -1802,10 +1802,14 @@ void PhaseMacroExpand::expand_allocate_array(AllocateArrayNode *alloc) { // Mark all associated (same box and obj) lock and unlock nodes for // elimination if some of them marked already. void PhaseMacroExpand::mark_eliminated_box(Node* oldbox, Node* obj) { - if (oldbox->is_BoxLock() && oldbox->as_BoxLock()->is_eliminated()) - return; - - if (oldbox->is_BoxLock() && + if (oldbox->as_BoxLock()->is_eliminated()) + return; // This BoxLock node was processed already. + + // New implementation (EliminateNestedLocks) has separate BoxLock + // node for each locked region so mark all associated locks/unlocks as + // eliminated even if different objects are referenced in one locked region + // (for example, OSR compilation of nested loop inside locked scope). + if (EliminateNestedLocks || oldbox->as_BoxLock()->is_simple_lock_region(NULL, obj)) { // Box is used only in one lock region. Mark this box as eliminated. _igvn.hash_delete(oldbox); @@ -1818,7 +1822,6 @@ void PhaseMacroExpand::mark_eliminated_box(Node* oldbox, Node* obj) { AbstractLockNode* alock = u->as_AbstractLock(); // Check lock's box since box could be referenced by Lock's debug info. if (alock->box_node() == oldbox) { - assert(alock->obj_node()->eqv_uncast(obj), ""); // Mark eliminated all related locks and unlocks. alock->set_non_esc_obj(); } -- GitLab