Wed, 07 Jan 2009 11:04:45 -0800
6782232: assert("CreateEx must be first instruction in block" )
Summary: Add the missing check for CreateEx. Add new notproduct flag VerifyRegisterAllocator.
Reviewed-by: never
1.1 --- a/src/share/vm/opto/c2_globals.hpp Tue Jan 06 16:10:11 2009 -0800 1.2 +++ b/src/share/vm/opto/c2_globals.hpp Wed Jan 07 11:04:45 2009 -0800 1.3 @@ -191,6 +191,9 @@ 1.4 notproduct(bool, VerifyHashTableKeys, true, \ 1.5 "Verify the immutability of keys in the VN hash tables") \ 1.6 \ 1.7 + notproduct(bool, VerifyRegisterAllocator , false, \ 1.8 + "Verify Register Allocator") \ 1.9 + \ 1.10 develop_pd(intx, FLOATPRESSURE, \ 1.11 "Number of float LRG's that constitute high register pressure") \ 1.12 \
2.1 --- a/src/share/vm/opto/chaitin.cpp Tue Jan 06 16:10:11 2009 -0800 2.2 +++ b/src/share/vm/opto/chaitin.cpp Wed Jan 07 11:04:45 2009 -0800 2.3 @@ -307,7 +307,7 @@ 2.4 if (C->failing()) return; 2.5 2.6 #ifdef ASSERT 2.7 - if( VerifyOpto ) { 2.8 + if( VerifyOpto || VerifyRegisterAllocator ) { 2.9 _cfg.verify(); 2.10 verify_base_ptrs(&live_arena); 2.11 } 2.12 @@ -340,7 +340,7 @@ 2.13 compress_uf_map_for_nodes(); 2.14 2.15 #ifdef ASSERT 2.16 - if( VerifyOpto ) _ifg->verify(this); 2.17 + if( VerifyOpto || VerifyRegisterAllocator ) _ifg->verify(this); 2.18 #endif 2.19 } else { 2.20 ifg.SquareUp(); 2.21 @@ -377,7 +377,7 @@ 2.22 C->check_node_count(2*NodeLimitFudgeFactor, "out of nodes after split"); 2.23 if (C->failing()) return; 2.24 #ifdef ASSERT 2.25 - if( VerifyOpto ) { 2.26 + if( VerifyOpto || VerifyRegisterAllocator ) { 2.27 _cfg.verify(); 2.28 verify_base_ptrs(&live_arena); 2.29 } 2.30 @@ -412,7 +412,7 @@ 2.31 } 2.32 compress_uf_map_for_nodes(); 2.33 #ifdef ASSERT 2.34 - if( VerifyOpto ) _ifg->verify(this); 2.35 + if( VerifyOpto || VerifyRegisterAllocator ) _ifg->verify(this); 2.36 #endif 2.37 cache_lrg_info(); // Count degree of LRGs 2.38 2.39 @@ -956,7 +956,7 @@ 2.40 while ((neighbor = elements.next()) != 0) { 2.41 LRG *n = &lrgs(neighbor); 2.42 #ifdef ASSERT 2.43 - if( VerifyOpto ) { 2.44 + if( VerifyOpto || VerifyRegisterAllocator ) { 2.45 assert( _ifg->effective_degree(neighbor) == n->degree(), "" ); 2.46 } 2.47 #endif
3.1 --- a/src/share/vm/opto/live.cpp Tue Jan 06 16:10:11 2009 -0800 3.2 +++ b/src/share/vm/opto/live.cpp Wed Jan 07 11:04:45 2009 -0800 3.3 @@ -271,9 +271,9 @@ 3.4 3.5 //------------------------------verify_base_ptrs------------------------------- 3.6 // Verify that base pointers and derived pointers are still sane. 3.7 -// Basically, if a derived pointer is live at a safepoint, then its 3.8 -// base pointer must be live also. 3.9 void PhaseChaitin::verify_base_ptrs( ResourceArea *a ) const { 3.10 +#ifdef ASSERT 3.11 + Unique_Node_List worklist(a); 3.12 for( uint i = 0; i < _cfg._num_blocks; i++ ) { 3.13 Block *b = _cfg._blocks[i]; 3.14 for( uint j = b->end_idx() + 1; j > 1; j-- ) { 3.15 @@ -287,28 +287,63 @@ 3.16 // Now scan for a live derived pointer 3.17 if (jvms->oopoff() < sfpt->req()) { 3.18 // Check each derived/base pair 3.19 - for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx += 2) { 3.20 + for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx++) { 3.21 Node *check = sfpt->in(idx); 3.22 - uint j = 0; 3.23 + bool is_derived = ((idx - jvms->oopoff()) & 1) == 0; 3.24 // search upwards through spills and spill phis for AddP 3.25 - while(true) { 3.26 - if( !check ) break; 3.27 - int idx = check->is_Copy(); 3.28 - if( idx ) { 3.29 - check = check->in(idx); 3.30 - } else if( check->is_Phi() && check->_idx >= _oldphi ) { 3.31 - check = check->in(1); 3.32 - } else 3.33 - break; 3.34 - j++; 3.35 - assert(j < 100000,"Derived pointer checking in infinite loop"); 3.36 + worklist.clear(); 3.37 + worklist.push(check); 3.38 + uint k = 0; 3.39 + while( k < worklist.size() ) { 3.40 + check = worklist.at(k); 3.41 + assert(check,"Bad base or derived pointer"); 3.42 + // See PhaseChaitin::find_base_for_derived() for all cases. 3.43 + int isc = check->is_Copy(); 3.44 + if( isc ) { 3.45 + worklist.push(check->in(isc)); 3.46 + } else if( check->is_Phi() ) { 3.47 + for (uint m = 1; m < check->req(); m++) 3.48 + worklist.push(check->in(m)); 3.49 + } else if( check->is_Con() ) { 3.50 + if (is_derived) { 3.51 + // Derived is NULL+offset 3.52 + assert(!is_derived || check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad derived pointer"); 3.53 + } else { 3.54 + assert(check->bottom_type()->is_ptr()->_offset == 0,"Bad base pointer"); 3.55 + // Base either ConP(NULL) or loadConP 3.56 + if (check->is_Mach()) { 3.57 + assert(check->as_Mach()->ideal_Opcode() == Op_ConP,"Bad base pointer"); 3.58 + } else { 3.59 + assert(check->Opcode() == Op_ConP && 3.60 + check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad base pointer"); 3.61 + } 3.62 + } 3.63 + } else if( check->bottom_type()->is_ptr()->_offset == 0 ) { 3.64 + if(check->is_Proj() || check->is_Mach() && 3.65 + (check->as_Mach()->ideal_Opcode() == Op_CreateEx || 3.66 + check->as_Mach()->ideal_Opcode() == Op_ThreadLocal || 3.67 + check->as_Mach()->ideal_Opcode() == Op_CMoveP || 3.68 + check->as_Mach()->ideal_Opcode() == Op_CheckCastPP || 3.69 +#ifdef _LP64 3.70 + UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_CastPP || 3.71 + UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_DecodeN || 3.72 +#endif 3.73 + check->as_Mach()->ideal_Opcode() == Op_LoadP || 3.74 + check->as_Mach()->ideal_Opcode() == Op_LoadKlass)) 3.75 + assert(false,"Bad base or derived pointer"); 3.76 + } else { 3.77 + assert(is_derived,"Bad base pointer"); 3.78 + assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer"); 3.79 + } 3.80 + k++; 3.81 + assert(k < 100000,"Derived pointer checking in infinite loop"); 3.82 } // End while 3.83 - assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer") 3.84 } 3.85 } // End of check for derived pointers 3.86 } // End of Kcheck for debug info 3.87 } // End of if found a safepoint 3.88 } // End of forall instructions in block 3.89 } // End of forall blocks 3.90 +#endif 3.91 } 3.92 #endif
4.1 --- a/src/share/vm/opto/reg_split.cpp Tue Jan 06 16:10:11 2009 -0800 4.2 +++ b/src/share/vm/opto/reg_split.cpp Wed Jan 07 11:04:45 2009 -0800 4.3 @@ -96,7 +96,9 @@ 4.4 // its definer. 4.5 while( i < b->_nodes.size() && 4.6 (b->_nodes[i]->is_Proj() || 4.7 - b->_nodes[i]->is_Phi() ) ) 4.8 + b->_nodes[i]->is_Phi() || 4.9 + (b->_nodes[i]->is_Mach() && 4.10 + b->_nodes[i]->as_Mach()->ideal_Opcode() == Op_CreateEx)) ) 4.11 i++; 4.12 4.13 // Do not insert between a call and his Catch