hotspot/src/share/vm/c1/c1_Runtime1.cpp
changeset 24442 4d4ae31dea26
parent 24424 2658d7834c6e
child 24944 5b01505efb7a
equal deleted inserted replaced
24441:50946251753f 24442:4d4ae31dea26
   683     ObjectSynchronizer::fast_exit(obj, lock->lock(), THREAD);
   683     ObjectSynchronizer::fast_exit(obj, lock->lock(), THREAD);
   684   }
   684   }
   685 JRT_END
   685 JRT_END
   686 
   686 
   687 // Cf. OptoRuntime::deoptimize_caller_frame
   687 // Cf. OptoRuntime::deoptimize_caller_frame
   688 JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread))
   688 JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread, jint trap_request))
   689   // Called from within the owner thread, so no need for safepoint
   689   // Called from within the owner thread, so no need for safepoint
   690   RegisterMap reg_map(thread, false);
   690   RegisterMap reg_map(thread, false);
   691   frame stub_frame = thread->last_frame();
   691   frame stub_frame = thread->last_frame();
   692   assert(stub_frame.is_runtime_frame(), "sanity check");
   692   assert(stub_frame.is_runtime_frame(), "Sanity check");
   693   frame caller_frame = stub_frame.sender(&reg_map);
   693   frame caller_frame = stub_frame.sender(&reg_map);
   694 
   694   nmethod* nm = caller_frame.cb()->as_nmethod_or_null();
   695   // We are coming from a compiled method; check this is true.
   695   assert(nm != NULL, "Sanity check");
   696   assert(CodeCache::find_nmethod(caller_frame.pc()) != NULL, "sanity");
   696   methodHandle method(thread, nm->method());
       
   697   assert(nm == CodeCache::find_nmethod(caller_frame.pc()), "Should be the same");
       
   698   Deoptimization::DeoptAction action = Deoptimization::trap_request_action(trap_request);
       
   699   Deoptimization::DeoptReason reason = Deoptimization::trap_request_reason(trap_request);
       
   700 
       
   701   if (action == Deoptimization::Action_make_not_entrant) {
       
   702     if (nm->make_not_entrant()) {
       
   703       if (reason == Deoptimization::Reason_tenured) {
       
   704         MethodData* trap_mdo = Deoptimization::get_method_data(thread, method, true /*create_if_missing*/);
       
   705         if (trap_mdo != NULL) {
       
   706           trap_mdo->inc_tenure_traps();
       
   707         }
       
   708       }
       
   709     }
       
   710   }
   697 
   711 
   698   // Deoptimize the caller frame.
   712   // Deoptimize the caller frame.
   699   Deoptimization::deoptimize_frame(thread, caller_frame.id());
   713   Deoptimization::deoptimize_frame(thread, caller_frame.id());
   700 
       
   701   // Return to the now deoptimized frame.
   714   // Return to the now deoptimized frame.
   702 JRT_END
   715 JRT_END
   703 
   716 
   704 
   717 
   705 static Klass* resolve_field_return_klass(methodHandle caller, int bci, TRAPS) {
   718 static Klass* resolve_field_return_klass(methodHandle caller, int bci, TRAPS) {