diff -r cba7b5c2d53f -r 642c68c75db9 src/share/vm/opto/escape.cpp --- a/src/share/vm/opto/escape.cpp Fri Jun 03 22:31:43 2011 -0700 +++ b/src/share/vm/opto/escape.cpp Sat Jun 04 10:36:22 2011 -0700 @@ -1747,6 +1747,25 @@ _collecting = false; assert(C->unique() == nodes_size(), "there should be no new ideal nodes during ConnectionGraph build"); + if (EliminateLocks) { + // Mark locks before changing ideal graph. + int cnt = C->macro_count(); + for( int i=0; i < cnt; i++ ) { + Node *n = C->macro_node(i); + if (n->is_AbstractLock()) { // Lock and Unlock nodes + AbstractLockNode* alock = n->as_AbstractLock(); + if (!alock->is_eliminated()) { + PointsToNode::EscapeState es = escape_state(alock->obj_node()); + assert(es != PointsToNode::UnknownEscape, "should know"); + if (es != PointsToNode::UnknownEscape && es != PointsToNode::GlobalEscape) { + // Mark it eliminated + alock->set_eliminated(); + } + } + } + } + } + #ifndef PRODUCT if (PrintEscapeAnalysis) { dump(); // Dump ConnectionGraph