changeset 3285:89d0a5d40008

7129618: assert(obj_node->eqv_uncast(obj),""); Summary: Relax verification and locks elimination checks for new implementation (EliminateNestedLocks). Reviewed-by: iveresov
author kvn
date Fri, 13 Jan 2012 12:58:26 -0800
parents f4d8930a45b9
children e504fd26c073 eaa9557116a2
files src/share/vm/opto/locknode.cpp src/share/vm/opto/macro.cpp
diffstat 2 files changed, 13 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/locknode.cpp	Fri Jan 13 00:51:43 2012 -0800
+++ b/src/share/vm/opto/locknode.cpp	Fri Jan 13 12:58:26 2012 -0800
@@ -118,35 +118,12 @@
       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) {
--- a/src/share/vm/opto/macro.cpp	Fri Jan 13 00:51:43 2012 -0800
+++ b/src/share/vm/opto/macro.cpp	Fri Jan 13 12:58:26 2012 -0800
@@ -1802,10 +1802,14 @@
 // 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->as_BoxLock()->is_eliminated())
+    return; // This BoxLock node was processed already.
 
-  if (oldbox->is_BoxLock() &&
+  // 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 @@
         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();
         }