--- a/hotspot/src/share/vm/opto/lcm.cpp Wed Aug 06 11:57:31 2008 -0400
+++ b/hotspot/src/share/vm/opto/lcm.cpp Thu Aug 21 23:36:31 2008 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc. 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
@@ -322,7 +322,7 @@
uint choice = 0; // Bigger is most important
uint latency = 0; // Bigger is scheduled first
uint score = 0; // Bigger is better
- uint idx; // Index in worklist
+ int idx = -1; // Index in worklist
for( uint i=0; i<cnt; i++ ) { // Inspect entire worklist
// Order in worklist is used to break ties.
@@ -412,9 +412,10 @@
}
} // End of for all ready nodes in worklist
- Node *n = worklist[idx]; // Get the winner
+ assert(idx >= 0, "index should be set");
+ Node *n = worklist[(uint)idx]; // Get the winner
- worklist.map(idx,worklist.pop()); // Compress worklist
+ worklist.map((uint)idx, worklist.pop()); // Compress worklist
return n;
}
@@ -599,7 +600,14 @@
assert(cfg->_bbs[oop_store->_idx]->_dom_depth <= this->_dom_depth, "oop_store must dominate card-mark");
}
}
- if( n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_MemBarAcquire ) {
+ if( n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_MemBarAcquire &&
+ n->req() > TypeFunc::Parms ) {
+ // MemBarAcquire could be created without Precedent edge.
+ // del_req() replaces the specified edge with the last input edge
+ // and then removes the last edge. If the specified edge > number of
+ // edges the last edge will be moved outside of the input edges array
+ // and the edge will be lost. This is why this code should be
+ // executed only when Precedent (== TypeFunc::Parms) edge is present.
Node *x = n->in(TypeFunc::Parms);
n->del_req(TypeFunc::Parms);
n->add_prec(x);