< prev index next >
src/share/vm/opto/macro.cpp
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -1897,10 +1897,13 @@
if (u->is_AbstractLock() && !u->as_AbstractLock()->is_non_esc_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) {
// Mark eliminated all related locks and unlocks.
+#ifdef ASSERT
+ alock->log_lock_optimization(C, "eliminate_lock_set_non_esc4");
+#endif
alock->set_non_esc_obj();
}
}
}
return;
@@ -1923,10 +1926,13 @@
Node* u = oldbox->raw_out(i);
if (u->is_AbstractLock()) {
AbstractLockNode* alock = u->as_AbstractLock();
if (alock->box_node() == oldbox && alock->obj_node()->eqv_uncast(obj)) {
// Replace Box and mark eliminated all related locks and unlocks.
+#ifdef ASSERT
+ alock->log_lock_optimization(C, "eliminate_lock_set_non_esc5");
+#endif
alock->set_non_esc_obj();
_igvn.rehash_node_delayed(alock);
alock->set_box_node(newbox);
next_edge = false;
}
@@ -1969,11 +1975,13 @@
if (alock->is_nested()) {
assert(alock->box_node()->as_BoxLock()->is_eliminated(), "sanity");
return;
} else if (!alock->is_non_esc_obj()) { // Not eliminated or coarsened
// Only Lock node has JVMState needed here.
- if (alock->jvms() != NULL && alock->as_Lock()->is_nested_lock_region()) {
+ // Not that preceding claim is documented anywhere else.
+ if (alock->jvms() != NULL) {
+ if (alock->as_Lock()->is_nested_lock_region()) {
// Mark eliminated related nested locks and unlocks.
Node* obj = alock->obj_node();
BoxLockNode* box_node = alock->box_node()->as_BoxLock();
assert(!box_node->is_eliminated(), "should not be marked yet");
// Note: BoxLock node is marked eliminated only here
@@ -1986,14 +1994,24 @@
alock = u->as_AbstractLock();
if (alock->box_node() == box_node) {
// Verify that this Box is referenced only by related locks.
assert(alock->obj_node()->eqv_uncast(obj), "");
// Mark all related locks and unlocks.
+#ifdef ASSERT
+ alock->log_lock_optimization(C, "eliminate_lock_set_nested");
+#endif
alock->set_nested();
}
}
}
+ } else {
+#ifdef ASSERT
+ alock->log_lock_optimization(C, "eliminate_lock_NOT_nested_lock_region");
+ if (C != NULL)
+ alock->as_Lock()->is_nested_lock_region(C); // rerun for debugging output
+#endif
+ }
}
return;
}
// Process locks for non escaping object
assert(alock->is_non_esc_obj(), "");
@@ -2033,31 +2051,22 @@
// Check that new "eliminated" BoxLock node is created.
BoxLockNode* oldbox = alock->box_node()->as_BoxLock();
assert(oldbox->is_eliminated(), "should be done already");
}
#endif
- CompileLog* log = C->log();
- if (log != NULL) {
- log->head("eliminate_lock lock='%d'",
- alock->is_Lock());
- JVMState* p = alock->jvms();
- while (p != NULL) {
- log->elem("jvms bci='%d' method='%d'", p->bci(), log->identify(p->method()));
- p = p->caller();
- }
- log->tail("eliminate_lock");
- }
- #ifndef PRODUCT
+ alock->log_lock_optimization(C, "eliminate_lock");
+
+#ifndef PRODUCT
if (PrintEliminateLocks) {
if (alock->is_Lock()) {
tty->print_cr("++++ Eliminated: %d Lock", alock->_idx);
} else {
tty->print_cr("++++ Eliminated: %d Unlock", alock->_idx);
}
}
- #endif
+#endif
Node* mem = alock->in(TypeFunc::Memory);
Node* ctrl = alock->in(TypeFunc::Control);
extract_call_projections(alock);
< prev index next >