src/hotspot/share/code/compiledMethod.cpp
changeset 55293 d19dc5b10fbb
parent 54839 e9db10a375d9
child 58226 408c445d04e8
equal deleted inserted replaced
55292:f4b2d5b83ebf 55293:d19dc5b10fbb
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "code/compiledIC.hpp"
    26 #include "code/compiledIC.hpp"
    27 #include "code/compiledMethod.inline.hpp"
    27 #include "code/compiledMethod.inline.hpp"
       
    28 #include "code/exceptionHandlerTable.hpp"
    28 #include "code/scopeDesc.hpp"
    29 #include "code/scopeDesc.hpp"
    29 #include "code/codeCache.hpp"
    30 #include "code/codeCache.hpp"
    30 #include "code/icBuffer.hpp"
    31 #include "code/icBuffer.hpp"
    31 #include "gc/shared/barrierSet.hpp"
    32 #include "gc/shared/barrierSet.hpp"
    32 #include "gc/shared/gcBehaviours.hpp"
    33 #include "gc/shared/gcBehaviours.hpp"
    35 #include "logging/logTag.hpp"
    36 #include "logging/logTag.hpp"
    36 #include "memory/resourceArea.hpp"
    37 #include "memory/resourceArea.hpp"
    37 #include "oops/methodData.hpp"
    38 #include "oops/methodData.hpp"
    38 #include "oops/method.inline.hpp"
    39 #include "oops/method.inline.hpp"
    39 #include "prims/methodHandles.hpp"
    40 #include "prims/methodHandles.hpp"
       
    41 #include "runtime/deoptimization.hpp"
    40 #include "runtime/handles.inline.hpp"
    42 #include "runtime/handles.inline.hpp"
    41 #include "runtime/mutexLocker.hpp"
    43 #include "runtime/mutexLocker.hpp"
       
    44 #include "runtime/sharedRuntime.hpp"
    42 
    45 
    43 CompiledMethod::CompiledMethod(Method* method, const char* name, CompilerType type, const CodeBlobLayout& layout,
    46 CompiledMethod::CompiledMethod(Method* method, const char* name, CompilerType type, const CodeBlobLayout& layout,
    44                                int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps,
    47                                int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps,
    45                                bool caller_must_gc_arguments)
    48                                bool caller_must_gc_arguments)
    46   : CodeBlob(name, type, layout, frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments),
    49   : CodeBlob(name, type, layout, frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments),
   636          os::is_readable_pointer(method) &&
   639          os::is_readable_pointer(method) &&
   637          os::is_readable_pointer(method->constants()) &&
   640          os::is_readable_pointer(method->constants()) &&
   638          os::is_readable_pointer(method->signature());
   641          os::is_readable_pointer(method->signature());
   639 }
   642 }
   640 
   643 
       
   644 address CompiledMethod::continuation_for_implicit_exception(address pc, bool for_div0_check) {
       
   645   // Exception happened outside inline-cache check code => we are inside
       
   646   // an active nmethod => use cpc to determine a return address
       
   647   int exception_offset = pc - code_begin();
       
   648   int cont_offset = ImplicitExceptionTable(this).continuation_offset( exception_offset );
       
   649 #ifdef ASSERT
       
   650   if (cont_offset == 0) {
       
   651     Thread* thread = Thread::current();
       
   652     ResetNoHandleMark rnm; // Might be called from LEAF/QUICK ENTRY
       
   653     HandleMark hm(thread);
       
   654     ResourceMark rm(thread);
       
   655     CodeBlob* cb = CodeCache::find_blob(pc);
       
   656     assert(cb != NULL && cb == this, "");
       
   657     ttyLocker ttyl;
       
   658     tty->print_cr("implicit exception happened at " INTPTR_FORMAT, p2i(pc));
       
   659     print();
       
   660     method()->print_codes();
       
   661     print_code();
       
   662     print_pcs();
       
   663   }
       
   664 #endif
       
   665   if (cont_offset == 0) {
       
   666     // Let the normal error handling report the exception
       
   667     return NULL;
       
   668   }
       
   669   if (cont_offset == exception_offset) {
       
   670 #if INCLUDE_JVMCI
       
   671     Deoptimization::DeoptReason deopt_reason = for_div0_check ? Deoptimization::Reason_div0_check : Deoptimization::Reason_null_check;
       
   672     JavaThread *thread = JavaThread::current();
       
   673     thread->set_jvmci_implicit_exception_pc(pc);
       
   674     thread->set_pending_deoptimization(Deoptimization::make_trap_request(deopt_reason,
       
   675                                                                          Deoptimization::Action_reinterpret));
       
   676     return (SharedRuntime::deopt_blob()->implicit_exception_uncommon_trap());
       
   677 #else
       
   678     ShouldNotReachHere();
       
   679 #endif
       
   680   }
       
   681   return code_begin() + cont_offset;
       
   682 }
       
   683 
   641 class HasEvolDependency : public MetadataClosure {
   684 class HasEvolDependency : public MetadataClosure {
   642   bool _has_evol_dependency;
   685   bool _has_evol_dependency;
   643  public:
   686  public:
   644   HasEvolDependency() : _has_evol_dependency(false) {}
   687   HasEvolDependency() : _has_evol_dependency(false) {}
   645   void do_metadata(Metadata* md) {
   688   void do_metadata(Metadata* md) {