< prev index next >

src/hotspot/share/opto/buildOopMap.cpp

Print this page

336         uint cnt = mcall->tf()->domain()->cnt();
337         uint j;
338         for( j = TypeFunc::Parms; j < cnt; j++)
339           if( mcall->in(j) == def )
340             break;            // reaching def is an argument oop
341         if( j < cnt )         // arg oops dont go in GC map
342           continue;           // Continue on to the next register
343       }
344       omap->set_narrowoop(r);
345     } else if( OptoReg::is_valid(_callees[reg])) { // callee-save?
346       // It's a callee-save value
347       assert( dup_check[_callees[reg]]==0, "trying to callee save same reg twice" );
348       debug_only( dup_check[_callees[reg]]=1; )
349       VMReg callee = OptoReg::as_VMReg(OptoReg::Name(_callees[reg]));
350       if ( callee->is_concrete() || true ) {
351         omap->set_callee_saved( r, callee);
352       }
353 
354     } else {
355       // Other - some reaching non-oop value

356 #ifdef ASSERT
357       if( t->isa_rawptr() && C->cfg()->_raw_oops.member(def) ) {
358         def->dump();
359         n->dump();
360         assert(false, "there should be a oop in OopMap instead of a live raw oop at safepoint");
361       }
362 #endif
363     }
364 
365   }
366 
367 #ifdef ASSERT
368   /* Nice, Intel-only assert
369   int cnt_callee_saves=0;
370   int reg2 = 0;
371   while (OptoReg::is_reg(reg2)) {
372     if( dup_check[reg2] != 0) cnt_callee_saves++;
373     assert( cnt_callee_saves==3 || cnt_callee_saves==5, "missed some callee-save" );
374     reg2++;
375   }
376   */
377 #endif
378 
379 #ifdef ASSERT

380   for( OopMapStream oms1(omap); !oms1.is_done(); oms1.next()) {
381     OopMapValue omv1 = oms1.current();
382     if (omv1.type() != OopMapValue::derived_oop_value) {
383       continue;
384     }

385     bool found = false;
386     for( OopMapStream oms2(omap); !oms2.is_done(); oms2.next()) {
387       OopMapValue omv2 = oms2.current();
388       if (omv2.type() != OopMapValue::oop_value) {
389         continue;
390       }
391       if( omv1.content_reg() == omv2.reg() ) {
392         found = true;
393         break;
394       }
395     }

396     assert( found, "derived with no base in oopmap" );
397   }








398 #endif
399 
400   return omap;
401 }
402 
403 // Compute backwards liveness on registers
404 static void do_liveness(PhaseRegAlloc* regalloc, PhaseCFG* cfg, Block_List* worklist, int max_reg_ints, Arena* A, Dict* safehash) {
405   int* live = NEW_ARENA_ARRAY(A, int, (cfg->number_of_blocks() + 1) * max_reg_ints);
406   int* tmp_live = &live[cfg->number_of_blocks() * max_reg_ints];
407   Node* root = cfg->get_root_node();
408   // On CISC platforms, get the node representing the stack pointer  that regalloc
409   // used for spills
410   Node *fp = NodeSentinel;
411   if (UseCISCSpill && root->req() > 1) {
412     fp = root->in(1)->in(TypeFunc::FramePtr);
413   }
414   memset(live, 0, cfg->number_of_blocks() * (max_reg_ints << LogBytesPerInt));
415   // Push preds onto worklist
416   for (uint i = 1; i < root->req(); i++) {
417     Block* block = cfg->get_block_for_node(root->in(i));

336         uint cnt = mcall->tf()->domain()->cnt();
337         uint j;
338         for( j = TypeFunc::Parms; j < cnt; j++)
339           if( mcall->in(j) == def )
340             break;            // reaching def is an argument oop
341         if( j < cnt )         // arg oops dont go in GC map
342           continue;           // Continue on to the next register
343       }
344       omap->set_narrowoop(r);
345     } else if( OptoReg::is_valid(_callees[reg])) { // callee-save?
346       // It's a callee-save value
347       assert( dup_check[_callees[reg]]==0, "trying to callee save same reg twice" );
348       debug_only( dup_check[_callees[reg]]=1; )
349       VMReg callee = OptoReg::as_VMReg(OptoReg::Name(_callees[reg]));
350       if ( callee->is_concrete() || true ) {
351         omap->set_callee_saved( r, callee);
352       }
353 
354     } else {
355       // Other - some reaching non-oop value
356       // omap->set_value( r);
357 #ifdef ASSERT
358       if( t->isa_rawptr() && C->cfg()->_raw_oops.member(def) ) {
359         def->dump();
360         n->dump();
361         assert(false, "there should be a oop in OopMap instead of a live raw oop at safepoint");
362       }
363 #endif
364     }
365 
366   }
367 
368 #ifdef ASSERT
369   /* Nice, Intel-only assert
370   int cnt_callee_saves=0;
371   int reg2 = 0;
372   while (OptoReg::is_reg(reg2)) {
373     if( dup_check[reg2] != 0) cnt_callee_saves++;
374     assert( cnt_callee_saves==3 || cnt_callee_saves==5, "missed some callee-save" );
375     reg2++;
376   }
377   */
378 #endif
379 
380 #ifdef ASSERT
381   bool has_derived_oops = false;
382   for( OopMapStream oms1(omap); !oms1.is_done(); oms1.next()) {
383     OopMapValue omv1 = oms1.current();
384     if (omv1.type() != OopMapValue::derived_oop_value) {
385       continue;
386     }
387     has_derived_oops = true;
388     bool found = false;
389     for( OopMapStream oms2(omap); !oms2.is_done(); oms2.next()) {
390       OopMapValue omv2 = oms2.current();
391       if (omv2.type() != OopMapValue::oop_value) {
392         continue;
393       }
394       if( omv1.content_reg() == omv2.reg() ) {
395         found = true;
396         break;
397       }
398     }
399     assert(has_derived_oops == omap->has_derived_oops(), "");
400     assert( found, "derived with no base in oopmap" );
401   }
402 
403   int num_oops = 0;
404   for (OopMapStream oms2(omap); !oms2.is_done(); oms2.next()) {
405     OopMapValue omv = oms2.current();
406     if (omv.type() == OopMapValue::oop_value || omv.type() == OopMapValue::narrowoop_value)
407       num_oops++;
408   }
409   assert (num_oops == omap->num_oops(), "num_oops: %d omap->num_oops(): %d", num_oops, omap->num_oops());
410 #endif
411 
412   return omap;
413 }
414 
415 // Compute backwards liveness on registers
416 static void do_liveness(PhaseRegAlloc* regalloc, PhaseCFG* cfg, Block_List* worklist, int max_reg_ints, Arena* A, Dict* safehash) {
417   int* live = NEW_ARENA_ARRAY(A, int, (cfg->number_of_blocks() + 1) * max_reg_ints);
418   int* tmp_live = &live[cfg->number_of_blocks() * max_reg_ints];
419   Node* root = cfg->get_root_node();
420   // On CISC platforms, get the node representing the stack pointer  that regalloc
421   // used for spills
422   Node *fp = NodeSentinel;
423   if (UseCISCSpill && root->req() > 1) {
424     fp = root->in(1)->in(TypeFunc::FramePtr);
425   }
426   memset(live, 0, cfg->number_of_blocks() * (max_reg_ints << LogBytesPerInt));
427   // Push preds onto worklist
428   for (uint i = 1; i < root->req(); i++) {
429     Block* block = cfg->get_block_for_node(root->in(i));
< prev index next >