提交 85014bf4 编写于 作者: K kvn

6782232: assert("CreateEx must be first instruction in block" )

Summary: Add the missing check for CreateEx. Add new notproduct flag VerifyRegisterAllocator.
Reviewed-by: never
上级 3daa602c
...@@ -191,6 +191,9 @@ ...@@ -191,6 +191,9 @@
notproduct(bool, VerifyHashTableKeys, true, \ notproduct(bool, VerifyHashTableKeys, true, \
"Verify the immutability of keys in the VN hash tables") \ "Verify the immutability of keys in the VN hash tables") \
\ \
notproduct(bool, VerifyRegisterAllocator , false, \
"Verify Register Allocator") \
\
develop_pd(intx, FLOATPRESSURE, \ develop_pd(intx, FLOATPRESSURE, \
"Number of float LRG's that constitute high register pressure") \ "Number of float LRG's that constitute high register pressure") \
\ \
......
...@@ -307,7 +307,7 @@ void PhaseChaitin::Register_Allocate() { ...@@ -307,7 +307,7 @@ void PhaseChaitin::Register_Allocate() {
if (C->failing()) return; if (C->failing()) return;
#ifdef ASSERT #ifdef ASSERT
if( VerifyOpto ) { if( VerifyOpto || VerifyRegisterAllocator ) {
_cfg.verify(); _cfg.verify();
verify_base_ptrs(&live_arena); verify_base_ptrs(&live_arena);
} }
...@@ -340,7 +340,7 @@ void PhaseChaitin::Register_Allocate() { ...@@ -340,7 +340,7 @@ void PhaseChaitin::Register_Allocate() {
compress_uf_map_for_nodes(); compress_uf_map_for_nodes();
#ifdef ASSERT #ifdef ASSERT
if( VerifyOpto ) _ifg->verify(this); if( VerifyOpto || VerifyRegisterAllocator ) _ifg->verify(this);
#endif #endif
} else { } else {
ifg.SquareUp(); ifg.SquareUp();
...@@ -377,7 +377,7 @@ void PhaseChaitin::Register_Allocate() { ...@@ -377,7 +377,7 @@ void PhaseChaitin::Register_Allocate() {
C->check_node_count(2*NodeLimitFudgeFactor, "out of nodes after split"); C->check_node_count(2*NodeLimitFudgeFactor, "out of nodes after split");
if (C->failing()) return; if (C->failing()) return;
#ifdef ASSERT #ifdef ASSERT
if( VerifyOpto ) { if( VerifyOpto || VerifyRegisterAllocator ) {
_cfg.verify(); _cfg.verify();
verify_base_ptrs(&live_arena); verify_base_ptrs(&live_arena);
} }
...@@ -412,7 +412,7 @@ void PhaseChaitin::Register_Allocate() { ...@@ -412,7 +412,7 @@ void PhaseChaitin::Register_Allocate() {
} }
compress_uf_map_for_nodes(); compress_uf_map_for_nodes();
#ifdef ASSERT #ifdef ASSERT
if( VerifyOpto ) _ifg->verify(this); if( VerifyOpto || VerifyRegisterAllocator ) _ifg->verify(this);
#endif #endif
cache_lrg_info(); // Count degree of LRGs cache_lrg_info(); // Count degree of LRGs
...@@ -956,7 +956,7 @@ void PhaseChaitin::Simplify( ) { ...@@ -956,7 +956,7 @@ void PhaseChaitin::Simplify( ) {
while ((neighbor = elements.next()) != 0) { while ((neighbor = elements.next()) != 0) {
LRG *n = &lrgs(neighbor); LRG *n = &lrgs(neighbor);
#ifdef ASSERT #ifdef ASSERT
if( VerifyOpto ) { if( VerifyOpto || VerifyRegisterAllocator ) {
assert( _ifg->effective_degree(neighbor) == n->degree(), "" ); assert( _ifg->effective_degree(neighbor) == n->degree(), "" );
} }
#endif #endif
......
...@@ -271,9 +271,9 @@ void PhaseLive::dump( const Block *b ) const { ...@@ -271,9 +271,9 @@ void PhaseLive::dump( const Block *b ) const {
//------------------------------verify_base_ptrs------------------------------- //------------------------------verify_base_ptrs-------------------------------
// Verify that base pointers and derived pointers are still sane. // Verify that base pointers and derived pointers are still sane.
// Basically, if a derived pointer is live at a safepoint, then its
// base pointer must be live also.
void PhaseChaitin::verify_base_ptrs( ResourceArea *a ) const { void PhaseChaitin::verify_base_ptrs( ResourceArea *a ) const {
#ifdef ASSERT
Unique_Node_List worklist(a);
for( uint i = 0; i < _cfg._num_blocks; i++ ) { for( uint i = 0; i < _cfg._num_blocks; i++ ) {
Block *b = _cfg._blocks[i]; Block *b = _cfg._blocks[i];
for( uint j = b->end_idx() + 1; j > 1; j-- ) { for( uint j = b->end_idx() + 1; j > 1; j-- ) {
...@@ -287,28 +287,63 @@ void PhaseChaitin::verify_base_ptrs( ResourceArea *a ) const { ...@@ -287,28 +287,63 @@ void PhaseChaitin::verify_base_ptrs( ResourceArea *a ) const {
// Now scan for a live derived pointer // Now scan for a live derived pointer
if (jvms->oopoff() < sfpt->req()) { if (jvms->oopoff() < sfpt->req()) {
// Check each derived/base pair // Check each derived/base pair
for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx += 2) { for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx++) {
Node *check = sfpt->in(idx); Node *check = sfpt->in(idx);
uint j = 0; bool is_derived = ((idx - jvms->oopoff()) & 1) == 0;
// search upwards through spills and spill phis for AddP // search upwards through spills and spill phis for AddP
while(true) { worklist.clear();
if( !check ) break; worklist.push(check);
int idx = check->is_Copy(); uint k = 0;
if( idx ) { while( k < worklist.size() ) {
check = check->in(idx); check = worklist.at(k);
} else if( check->is_Phi() && check->_idx >= _oldphi ) { assert(check,"Bad base or derived pointer");
check = check->in(1); // See PhaseChaitin::find_base_for_derived() for all cases.
} else int isc = check->is_Copy();
break; if( isc ) {
j++; worklist.push(check->in(isc));
assert(j < 100000,"Derived pointer checking in infinite loop"); } else if( check->is_Phi() ) {
for (uint m = 1; m < check->req(); m++)
worklist.push(check->in(m));
} else if( check->is_Con() ) {
if (is_derived) {
// Derived is NULL+offset
assert(!is_derived || check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad derived pointer");
} else {
assert(check->bottom_type()->is_ptr()->_offset == 0,"Bad base pointer");
// Base either ConP(NULL) or loadConP
if (check->is_Mach()) {
assert(check->as_Mach()->ideal_Opcode() == Op_ConP,"Bad base pointer");
} else {
assert(check->Opcode() == Op_ConP &&
check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad base pointer");
}
}
} else if( check->bottom_type()->is_ptr()->_offset == 0 ) {
if(check->is_Proj() || check->is_Mach() &&
(check->as_Mach()->ideal_Opcode() == Op_CreateEx ||
check->as_Mach()->ideal_Opcode() == Op_ThreadLocal ||
check->as_Mach()->ideal_Opcode() == Op_CMoveP ||
check->as_Mach()->ideal_Opcode() == Op_CheckCastPP ||
#ifdef _LP64
UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_CastPP ||
UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_DecodeN ||
#endif
check->as_Mach()->ideal_Opcode() == Op_LoadP ||
check->as_Mach()->ideal_Opcode() == Op_LoadKlass))
assert(false,"Bad base or derived pointer");
} else {
assert(is_derived,"Bad base pointer");
assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer");
}
k++;
assert(k < 100000,"Derived pointer checking in infinite loop");
} // End while } // End while
assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer")
} }
} // End of check for derived pointers } // End of check for derived pointers
} // End of Kcheck for debug info } // End of Kcheck for debug info
} // End of if found a safepoint } // End of if found a safepoint
} // End of forall instructions in block } // End of forall instructions in block
} // End of forall blocks } // End of forall blocks
#endif
} }
#endif #endif
...@@ -96,7 +96,9 @@ void PhaseChaitin::insert_proj( Block *b, uint i, Node *spill, uint maxlrg ) { ...@@ -96,7 +96,9 @@ void PhaseChaitin::insert_proj( Block *b, uint i, Node *spill, uint maxlrg ) {
// its definer. // its definer.
while( i < b->_nodes.size() && while( i < b->_nodes.size() &&
(b->_nodes[i]->is_Proj() || (b->_nodes[i]->is_Proj() ||
b->_nodes[i]->is_Phi() ) ) b->_nodes[i]->is_Phi() ||
(b->_nodes[i]->is_Mach() &&
b->_nodes[i]->as_Mach()->ideal_Opcode() == Op_CreateEx)) )
i++; i++;
// Do not insert between a call and his Catch // Do not insert between a call and his Catch
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册