254 _free_IndexSet = delta; // Drop onto free list
255 }
256 }
257
258 #ifndef PRODUCT
259 //------------------------------dump-------------------------------------------
260 // Dump the live-out set for a block
261 void PhaseLive::dump( const Block *b ) const {
262 tty->print("Block %d: ",b->_pre_order);
263 tty->print("LiveOut: "); _live[b->_pre_order-1].dump();
264 uint cnt = b->_nodes.size();
265 for( uint i=0; i<cnt; i++ ) {
266 tty->print("L%d/", _names[b->_nodes[i]->_idx] );
267 b->_nodes[i]->dump();
268 }
269 tty->print("\n");
270 }
271
272 //------------------------------verify_base_ptrs-------------------------------
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 {
277 for( uint i = 0; i < _cfg._num_blocks; i++ ) {
278 Block *b = _cfg._blocks[i];
279 for( uint j = b->end_idx() + 1; j > 1; j-- ) {
280 Node *n = b->_nodes[j-1];
281 if( n->is_Phi() ) break;
282 // Found a safepoint?
283 if( n->is_MachSafePoint() ) {
284 MachSafePointNode *sfpt = n->as_MachSafePoint();
285 JVMState* jvms = sfpt->jvms();
286 if (jvms != NULL) {
287 // Now scan for a live derived pointer
288 if (jvms->oopoff() < sfpt->req()) {
289 // Check each derived/base pair
290 for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx += 2) {
291 Node *check = sfpt->in(idx);
292 uint j = 0;
293 // search upwards through spills and spill phis for AddP
294 while(true) {
295 if( !check ) break;
296 int idx = check->is_Copy();
297 if( idx ) {
298 check = check->in(idx);
299 } else if( check->is_Phi() && check->_idx >= _oldphi ) {
300 check = check->in(1);
301 } else
302 break;
303 j++;
304 assert(j < 100000,"Derived pointer checking in infinite loop");
305 } // End while
306 assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer")
307 }
308 } // End of check for derived pointers
309 } // End of Kcheck for debug info
310 } // End of if found a safepoint
311 } // End of forall instructions in block
312 } // End of forall blocks
313 }
314 #endif
|
254 _free_IndexSet = delta; // Drop onto free list
255 }
256 }
257
258 #ifndef PRODUCT
259 //------------------------------dump-------------------------------------------
260 // Dump the live-out set for a block
261 void PhaseLive::dump( const Block *b ) const {
262 tty->print("Block %d: ",b->_pre_order);
263 tty->print("LiveOut: "); _live[b->_pre_order-1].dump();
264 uint cnt = b->_nodes.size();
265 for( uint i=0; i<cnt; i++ ) {
266 tty->print("L%d/", _names[b->_nodes[i]->_idx] );
267 b->_nodes[i]->dump();
268 }
269 tty->print("\n");
270 }
271
272 //------------------------------verify_base_ptrs-------------------------------
273 // Verify that base pointers and derived pointers are still sane.
274 void PhaseChaitin::verify_base_ptrs( ResourceArea *a ) const {
275 Unique_Node_List worklist(a);
276 for( uint i = 0; i < _cfg._num_blocks; i++ ) {
277 Block *b = _cfg._blocks[i];
278 for( uint j = b->end_idx() + 1; j > 1; j-- ) {
279 Node *n = b->_nodes[j-1];
280 if( n->is_Phi() ) break;
281 // Found a safepoint?
282 if( n->is_MachSafePoint() ) {
283 MachSafePointNode *sfpt = n->as_MachSafePoint();
284 JVMState* jvms = sfpt->jvms();
285 if (jvms != NULL) {
286 // Now scan for a live derived pointer
287 if (jvms->oopoff() < sfpt->req()) {
288 // Check each derived/base pair
289 for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx++) {
290 Node *check = sfpt->in(idx);
291 bool is_derived = ((idx - jvms->oopoff()) & 1) == 0;
292 // search upwards through spills and spill phis for AddP
293 worklist.clear();
294 worklist.push(check);
295 uint k = 0;
296 while( k < worklist.size() ) {
297 check = worklist.at(k);
298 assert(check,"Bad base or derived pointer");
299 // See PhaseChaitin::find_base_for_derived() for all cases.
300 int isc = check->is_Copy();
301 if( isc ) {
302 worklist.push(check->in(isc));
303 } else if( check->is_Phi() ) {
304 for (uint m = 1; m < check->req(); m++)
305 worklist.push(check->in(m));
306 } else if( check->is_Con() ) {
307 if (is_derived) {
308 // Derived is NULL+offset
309 assert(!is_derived || check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad derived pointer");
310 } else {
311 assert(check->bottom_type()->is_ptr()->_offset == 0,"Bad base pointer");
312 // Base either ConP(NULL) or loadConP
313 if (check->is_Mach()) {
314 assert(check->as_Mach()->ideal_Opcode() == Op_ConP,"Bad base pointer");
315 } else {
316 assert(check->Opcode() == Op_ConP &&
317 check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad base pointer");
318 }
319 }
320 } else if( check->bottom_type()->is_ptr()->_offset == 0 ) {
321 assert(check->is_Proj() || check->is_Mach() &&
322 (check->as_Mach()->ideal_Opcode() == Op_CreateEx ||
323 check->as_Mach()->ideal_Opcode() == Op_ThreadLocal ||
324 check->as_Mach()->ideal_Opcode() == Op_CMoveP ||
325 check->as_Mach()->ideal_Opcode() == Op_CheckCastPP ||
326 #ifdef _LP64
327 UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_CastPP ||
328 UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_DecodeN ||
329 #endif
330 check->as_Mach()->ideal_Opcode() == Op_LoadP ||
331 check->as_Mach()->ideal_Opcode() == Op_LoadKlass),"Bad base or derived pointer");
332 } else {
333 assert(is_derived,"Bad base pointer");
334 assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer");
335 }
336 k++;
337 assert(k < 100000,"Derived pointer checking in infinite loop");
338 } // End while
339 }
340 } // End of check for derived pointers
341 } // End of Kcheck for debug info
342 } // End of if found a safepoint
343 } // End of forall instructions in block
344 } // End of forall blocks
345 }
346 #endif
|