src/hotspot/share/runtime/deoptimization.cpp
changeset 59056 15936b142f86
parent 58662 5b7a967da646
child 59252 623722a6aeb9
equal deleted inserted replaced
59055:57ad70bcf06c 59056:15936b142f86
    42 #include "oops/constantPool.hpp"
    42 #include "oops/constantPool.hpp"
    43 #include "oops/method.hpp"
    43 #include "oops/method.hpp"
    44 #include "oops/objArrayKlass.hpp"
    44 #include "oops/objArrayKlass.hpp"
    45 #include "oops/objArrayOop.inline.hpp"
    45 #include "oops/objArrayOop.inline.hpp"
    46 #include "oops/oop.inline.hpp"
    46 #include "oops/oop.inline.hpp"
    47 #include "oops/fieldStreams.hpp"
    47 #include "oops/fieldStreams.inline.hpp"
    48 #include "oops/typeArrayOop.inline.hpp"
    48 #include "oops/typeArrayOop.inline.hpp"
    49 #include "oops/verifyOopClosure.hpp"
    49 #include "oops/verifyOopClosure.hpp"
    50 #include "prims/jvmtiThreadState.hpp"
    50 #include "prims/jvmtiThreadState.hpp"
    51 #include "runtime/biasedLocking.hpp"
    51 #include "runtime/biasedLocking.hpp"
    52 #include "runtime/deoptimization.hpp"
    52 #include "runtime/deoptimization.hpp"
   426   // handles are used.  If the caller is interpreted get the real
   426   // handles are used.  If the caller is interpreted get the real
   427   // value so that the proper amount of space can be added to it's
   427   // value so that the proper amount of space can be added to it's
   428   // frame.
   428   // frame.
   429   bool caller_was_method_handle = false;
   429   bool caller_was_method_handle = false;
   430   if (deopt_sender.is_interpreted_frame()) {
   430   if (deopt_sender.is_interpreted_frame()) {
   431     methodHandle method = deopt_sender.interpreter_frame_method();
   431     methodHandle method(thread, deopt_sender.interpreter_frame_method());
   432     Bytecode_invoke cur = Bytecode_invoke_check(method, deopt_sender.interpreter_frame_bci());
   432     Bytecode_invoke cur = Bytecode_invoke_check(method, deopt_sender.interpreter_frame_bci());
   433     if (cur.is_invokedynamic() || cur.is_invokehandle()) {
   433     if (cur.is_invokedynamic() || cur.is_invokehandle()) {
   434       // Method handle invokes may involve fairly arbitrary chains of
   434       // Method handle invokes may involve fairly arbitrary chains of
   435       // calls so it's impossible to know how much actual space the
   435       // calls so it's impossible to know how much actual space the
   436       // caller has for locals.
   436       // caller has for locals.
  1534   frame runtime_frame = thread->last_frame();
  1534   frame runtime_frame = thread->last_frame();
  1535   frame caller_frame = runtime_frame.sender(&reg_map);
  1535   frame caller_frame = runtime_frame.sender(&reg_map);
  1536   assert(caller_frame.cb()->as_compiled_method_or_null() == cm, "expect top frame compiled method");
  1536   assert(caller_frame.cb()->as_compiled_method_or_null() == cm, "expect top frame compiled method");
  1537   Deoptimization::deoptimize(thread, caller_frame, &reg_map, Deoptimization::Reason_not_compiled_exception_handler);
  1537   Deoptimization::deoptimize(thread, caller_frame, &reg_map, Deoptimization::Reason_not_compiled_exception_handler);
  1538 
  1538 
  1539   MethodData* trap_mdo = get_method_data(thread, cm->method(), true);
  1539   MethodData* trap_mdo = get_method_data(thread, methodHandle(thread, cm->method()), true);
  1540   if (trap_mdo != NULL) {
  1540   if (trap_mdo != NULL) {
  1541     trap_mdo->inc_trap_count(Deoptimization::Reason_not_compiled_exception_handler);
  1541     trap_mdo->inc_trap_count(Deoptimization::Reason_not_compiled_exception_handler);
  1542   }
  1542   }
  1543 
  1543 
  1544   return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
  1544   return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
  1699           , debug_id
  1699           , debug_id
  1700 #endif
  1700 #endif
  1701           );
  1701           );
  1702     }
  1702     }
  1703 
  1703 
  1704     methodHandle    trap_method = trap_scope->method();
  1704     methodHandle    trap_method(THREAD, trap_scope->method());
  1705     int             trap_bci    = trap_scope->bci();
  1705     int             trap_bci    = trap_scope->bci();
  1706 #if INCLUDE_JVMCI
  1706 #if INCLUDE_JVMCI
  1707     jlong           speculation = thread->pending_failed_speculation();
  1707     jlong           speculation = thread->pending_failed_speculation();
  1708     if (nm->is_compiled_by_jvmci() && nm->is_nmethod()) { // Exclude AOTed methods
  1708     if (nm->is_compiled_by_jvmci() && nm->is_nmethod()) { // Exclude AOTed methods
  1709       nm->as_nmethod()->update_speculation(thread);
  1709       nm->as_nmethod()->update_speculation(thread);
  1730     bool create_if_missing = ProfileTraps || UseCodeAging RTM_OPT_ONLY( || UseRTMLocking );
  1730     bool create_if_missing = ProfileTraps || UseCodeAging RTM_OPT_ONLY( || UseRTMLocking );
  1731 
  1731 
  1732     methodHandle profiled_method;
  1732     methodHandle profiled_method;
  1733 #if INCLUDE_JVMCI
  1733 #if INCLUDE_JVMCI
  1734     if (nm->is_compiled_by_jvmci()) {
  1734     if (nm->is_compiled_by_jvmci()) {
  1735       profiled_method = nm->method();
  1735       profiled_method = methodHandle(THREAD, nm->method());
  1736     } else {
  1736     } else {
  1737       profiled_method = trap_method;
  1737       profiled_method = trap_method;
  1738     }
  1738     }
  1739 #else
  1739 #else
  1740     profiled_method = trap_method;
  1740     profiled_method = trap_method;