comparison src/share/vm/opto/live.cpp @ 550:96964ebdb154

6782232: assert("CreateEx must be first instruction in block" ) Summary: Add the missing check for CreateEx. Add new notproduct flag VerifyRegisterAllocator. Reviewed-by: never
author kvn
date Wed, 07 Jan 2009 11:04:45 -0800
parents a61af66fc99e
children 91263420e1c6
comparison
equal deleted inserted replaced
510:1a767c61ad01 550:96964ebdb154
269 tty->print("\n"); 269 tty->print("\n");
270 } 270 }
271 271
272 //------------------------------verify_base_ptrs------------------------------- 272 //------------------------------verify_base_ptrs-------------------------------
273 // Verify that base pointers and derived pointers are still sane. 273 // Verify that base pointers and derived pointers are still sane.
274 // Basically, if a derived pointer is live at a safepoint, then its
275 // base pointer must be live also.
276 void PhaseChaitin::verify_base_ptrs( ResourceArea *a ) const { 274 void PhaseChaitin::verify_base_ptrs( ResourceArea *a ) const {
275 #ifdef ASSERT
276 Unique_Node_List worklist(a);
277 for( uint i = 0; i < _cfg._num_blocks; i++ ) { 277 for( uint i = 0; i < _cfg._num_blocks; i++ ) {
278 Block *b = _cfg._blocks[i]; 278 Block *b = _cfg._blocks[i];
279 for( uint j = b->end_idx() + 1; j > 1; j-- ) { 279 for( uint j = b->end_idx() + 1; j > 1; j-- ) {
280 Node *n = b->_nodes[j-1]; 280 Node *n = b->_nodes[j-1];
281 if( n->is_Phi() ) break; 281 if( n->is_Phi() ) break;
285 JVMState* jvms = sfpt->jvms(); 285 JVMState* jvms = sfpt->jvms();
286 if (jvms != NULL) { 286 if (jvms != NULL) {
287 // Now scan for a live derived pointer 287 // Now scan for a live derived pointer
288 if (jvms->oopoff() < sfpt->req()) { 288 if (jvms->oopoff() < sfpt->req()) {
289 // Check each derived/base pair 289 // Check each derived/base pair
290 for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx += 2) { 290 for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx++) {
291 Node *check = sfpt->in(idx); 291 Node *check = sfpt->in(idx);
292 uint j = 0; 292 bool is_derived = ((idx - jvms->oopoff()) & 1) == 0;
293 // search upwards through spills and spill phis for AddP 293 // search upwards through spills and spill phis for AddP
294 while(true) { 294 worklist.clear();
295 if( !check ) break; 295 worklist.push(check);
296 int idx = check->is_Copy(); 296 uint k = 0;
297 if( idx ) { 297 while( k < worklist.size() ) {
298 check = check->in(idx); 298 check = worklist.at(k);
299 } else if( check->is_Phi() && check->_idx >= _oldphi ) { 299 assert(check,"Bad base or derived pointer");
300 check = check->in(1); 300 // See PhaseChaitin::find_base_for_derived() for all cases.
301 } else 301 int isc = check->is_Copy();
302 break; 302 if( isc ) {
303 j++; 303 worklist.push(check->in(isc));
304 assert(j < 100000,"Derived pointer checking in infinite loop"); 304 } else if( check->is_Phi() ) {
305 for (uint m = 1; m < check->req(); m++)
306 worklist.push(check->in(m));
307 } else if( check->is_Con() ) {
308 if (is_derived) {
309 // Derived is NULL+offset
310 assert(!is_derived || check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad derived pointer");
311 } else {
312 assert(check->bottom_type()->is_ptr()->_offset == 0,"Bad base pointer");
313 // Base either ConP(NULL) or loadConP
314 if (check->is_Mach()) {
315 assert(check->as_Mach()->ideal_Opcode() == Op_ConP,"Bad base pointer");
316 } else {
317 assert(check->Opcode() == Op_ConP &&
318 check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad base pointer");
319 }
320 }
321 } else if( check->bottom_type()->is_ptr()->_offset == 0 ) {
322 if(check->is_Proj() || check->is_Mach() &&
323 (check->as_Mach()->ideal_Opcode() == Op_CreateEx ||
324 check->as_Mach()->ideal_Opcode() == Op_ThreadLocal ||
325 check->as_Mach()->ideal_Opcode() == Op_CMoveP ||
326 check->as_Mach()->ideal_Opcode() == Op_CheckCastPP ||
327 #ifdef _LP64
328 UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_CastPP ||
329 UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_DecodeN ||
330 #endif
331 check->as_Mach()->ideal_Opcode() == Op_LoadP ||
332 check->as_Mach()->ideal_Opcode() == Op_LoadKlass))
333 assert(false,"Bad base or derived pointer");
334 } else {
335 assert(is_derived,"Bad base pointer");
336 assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer");
337 }
338 k++;
339 assert(k < 100000,"Derived pointer checking in infinite loop");
305 } // End while 340 } // End while
306 assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer")
307 } 341 }
308 } // End of check for derived pointers 342 } // End of check for derived pointers
309 } // End of Kcheck for debug info 343 } // End of Kcheck for debug info
310 } // End of if found a safepoint 344 } // End of if found a safepoint
311 } // End of forall instructions in block 345 } // End of forall instructions in block
312 } // End of forall blocks 346 } // End of forall blocks
313 } 347 #endif
314 #endif 348 }
349 #endif