hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
changeset 24933 c16c7a4ac386
parent 24442 4d4ae31dea26
child 25715 d5a8dbdc5150
equal deleted inserted replaced
24932:374cc5d929fb 24933:c16c7a4ac386
   464 CodeEmitInfo* LIRGenerator::state_for(Instruction* x) {
   464 CodeEmitInfo* LIRGenerator::state_for(Instruction* x) {
   465   return state_for(x, x->exception_state());
   465   return state_for(x, x->exception_state());
   466 }
   466 }
   467 
   467 
   468 
   468 
   469 void LIRGenerator::klass2reg_with_patching(LIR_Opr r, ciMetadata* obj, CodeEmitInfo* info) {
   469 void LIRGenerator::klass2reg_with_patching(LIR_Opr r, ciMetadata* obj, CodeEmitInfo* info, bool need_resolve) {
   470   if (!obj->is_loaded() || PatchALot) {
   470   /* C2 relies on constant pool entries being resolved (ciTypeFlow), so if TieredCompilation
       
   471    * is active and the class hasn't yet been resolved we need to emit a patch that resolves
       
   472    * the class. */
       
   473   if ((TieredCompilation && need_resolve) || !obj->is_loaded() || PatchALot) {
   471     assert(info != NULL, "info must be set if class is not loaded");
   474     assert(info != NULL, "info must be set if class is not loaded");
   472     __ klass2reg_patch(NULL, r, info);
   475     __ klass2reg_patch(NULL, r, info);
   473   } else {
   476   } else {
   474     // no patching needed
   477     // no patching needed
   475     __ metadata2reg(obj->constant_encoding(), r);
   478     __ metadata2reg(obj->constant_encoding(), r);
   658   CodeStub* slow_path = new MonitorExitStub(lock, UseFastLocking, monitor_no);
   661   CodeStub* slow_path = new MonitorExitStub(lock, UseFastLocking, monitor_no);
   659   __ load_stack_address_monitor(monitor_no, lock);
   662   __ load_stack_address_monitor(monitor_no, lock);
   660   __ unlock_object(hdr, object, lock, scratch, slow_path);
   663   __ unlock_object(hdr, object, lock, scratch, slow_path);
   661 }
   664 }
   662 
   665 
   663 
   666 #ifndef PRODUCT
   664 void LIRGenerator::new_instance(LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info) {
   667 void LIRGenerator::print_if_not_loaded(const NewInstance* new_instance) {
   665   klass2reg_with_patching(klass_reg, klass, info);
   668   if (PrintNotLoaded && !new_instance->klass()->is_loaded()) {
       
   669     tty->print_cr("   ###class not loaded at new bci %d", new_instance->printable_bci());
       
   670   } else if (PrintNotLoaded && (TieredCompilation && new_instance->is_unresolved())) {
       
   671     tty->print_cr("   ###class not resolved at new bci %d", new_instance->printable_bci());
       
   672   }
       
   673 }
       
   674 #endif
       
   675 
       
   676 void LIRGenerator::new_instance(LIR_Opr dst, ciInstanceKlass* klass, bool is_unresolved, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info) {
       
   677   klass2reg_with_patching(klass_reg, klass, info, is_unresolved);
   666   // If klass is not loaded we do not know if the klass has finalizers:
   678   // If klass is not loaded we do not know if the klass has finalizers:
   667   if (UseFastNewInstance && klass->is_loaded()
   679   if (UseFastNewInstance && klass->is_loaded()
   668       && !Klass::layout_helper_needs_slow_path(klass->layout_helper())) {
   680       && !Klass::layout_helper_needs_slow_path(klass->layout_helper())) {
   669 
   681 
   670     Runtime1::StubID stub_id = klass->is_initialized() ? Runtime1::fast_new_instance_id : Runtime1::fast_new_instance_init_check_id;
   682     Runtime1::StubID stub_id = klass->is_initialized() ? Runtime1::fast_new_instance_id : Runtime1::fast_new_instance_init_check_id;