< prev index next >

src/hotspot/share/aot/aotLoader.cpp

Print this page
rev 52319 : 8211743: [AOT] crash in ScopeDesc::decode_body() when JVMTI walks AOT frames


  30 #include "memory/allocation.inline.hpp"
  31 #include "oops/method.hpp"
  32 #include "runtime/handles.inline.hpp"
  33 #include "runtime/os.hpp"
  34 #include "runtime/timerTrace.hpp"
  35 
  36 GrowableArray<AOTCodeHeap*>* AOTLoader::_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<AOTCodeHeap*> (2, true);
  37 GrowableArray<AOTLib*>* AOTLoader::_libraries = new(ResourceObj::C_HEAP, mtCode) GrowableArray<AOTLib*> (2, true);
  38 
  39 // Iterate over all AOT CodeHeaps
  40 #define FOR_ALL_AOT_HEAPS(heap) for (GrowableArrayIterator<AOTCodeHeap*> heap = heaps()->begin(); heap != heaps()->end(); ++heap)
  41 // Iterate over all AOT Libraries
  42 #define FOR_ALL_AOT_LIBRARIES(lib) for (GrowableArrayIterator<AOTLib*> lib = libraries()->begin(); lib != libraries()->end(); ++lib)
  43 
  44 void AOTLoader::load_for_klass(InstanceKlass* ik, Thread* thread) {
  45   if (ik->is_unsafe_anonymous()) {
  46     // don't even bother
  47     return;
  48   }
  49   if (UseAOT) {
  50     if (JvmtiExport::can_hotswap_or_post_breakpoint()) {
  51       if (PrintAOT) {
  52         warning("JVMTI capability to hotswap and post breakpoint is not compatible with AOT (switching AOT off)");
  53       }
  54       FLAG_SET_DEFAULT(UseAOT, false);
  55       return;
  56     }
  57     FOR_ALL_AOT_HEAPS(heap) {
  58       (*heap)->load_klass_data(ik, thread);
  59     }
  60   }
  61 }
  62 
  63 uint64_t AOTLoader::get_saved_fingerprint(InstanceKlass* ik) {
  64   assert(UseAOT, "called only when AOT is enabled");
  65   if (ik->is_unsafe_anonymous()) {
  66     // don't even bother
  67     return 0;
  68   }
  69   FOR_ALL_AOT_HEAPS(heap) {
  70     AOTKlassData* klass_data = (*heap)->find_klass(ik);
  71     if (klass_data != NULL) {
  72       return klass_data->_fingerprint;
  73     }
  74   }
  75   return 0;
  76 }


 103   "jdk.internal.vm.compiler"
 104 };
 105 
 106 void AOTLoader::initialize() {
 107   TraceTime timer("AOT initialization", TRACETIME_LOG(Info, aot, startuptime));
 108 
 109   if (FLAG_IS_DEFAULT(UseAOT) && AOTLibrary != NULL) {
 110     // Don't need to set UseAOT on command line when AOTLibrary is specified
 111     FLAG_SET_DEFAULT(UseAOT, true);
 112   }
 113   if (UseAOT) {
 114     // EagerInitialization is not compatible with AOT
 115     if (EagerInitialization) {
 116       if (PrintAOT) {
 117         warning("EagerInitialization is not compatible with AOT (switching AOT off)");
 118       }
 119       FLAG_SET_DEFAULT(UseAOT, false);
 120       return;
 121     }
 122 
 123     if (JvmtiExport::can_hotswap_or_post_breakpoint()) {
 124       if (PrintAOT) {
 125         warning("JVMTI capability to hotswap and post breakpoint is not compatible with AOT (switching AOT off)");
 126       }
 127       FLAG_SET_DEFAULT(UseAOT, false);
 128       return;
 129     }
 130 
 131     // -Xint is not compatible with AOT
 132     if (Arguments::is_interpreter_only()) {
 133       if (PrintAOT) {
 134         warning("-Xint is not compatible with AOT (switching AOT off)");
 135       }
 136       FLAG_SET_DEFAULT(UseAOT, false);
 137       return;
 138     }
 139 
 140 #ifdef _WINDOWS
 141     const char pathSep = ';';
 142 #else
 143     const char pathSep = ':';
 144 #endif
 145 




  30 #include "memory/allocation.inline.hpp"
  31 #include "oops/method.hpp"
  32 #include "runtime/handles.inline.hpp"
  33 #include "runtime/os.hpp"
  34 #include "runtime/timerTrace.hpp"
  35 
  36 GrowableArray<AOTCodeHeap*>* AOTLoader::_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<AOTCodeHeap*> (2, true);
  37 GrowableArray<AOTLib*>* AOTLoader::_libraries = new(ResourceObj::C_HEAP, mtCode) GrowableArray<AOTLib*> (2, true);
  38 
  39 // Iterate over all AOT CodeHeaps
  40 #define FOR_ALL_AOT_HEAPS(heap) for (GrowableArrayIterator<AOTCodeHeap*> heap = heaps()->begin(); heap != heaps()->end(); ++heap)
  41 // Iterate over all AOT Libraries
  42 #define FOR_ALL_AOT_LIBRARIES(lib) for (GrowableArrayIterator<AOTLib*> lib = libraries()->begin(); lib != libraries()->end(); ++lib)
  43 
  44 void AOTLoader::load_for_klass(InstanceKlass* ik, Thread* thread) {
  45   if (ik->is_unsafe_anonymous()) {
  46     // don't even bother
  47     return;
  48   }
  49   if (UseAOT) {
  50     // We allow hotswap to be enabled after the onload phase, but not breakpoints
  51     assert(!JvmtiExport::can_post_breakpoint(), "AOT should have been disabled.");





  52     FOR_ALL_AOT_HEAPS(heap) {
  53       (*heap)->load_klass_data(ik, thread);
  54     }
  55   }
  56 }
  57 
  58 uint64_t AOTLoader::get_saved_fingerprint(InstanceKlass* ik) {
  59   assert(UseAOT, "called only when AOT is enabled");
  60   if (ik->is_unsafe_anonymous()) {
  61     // don't even bother
  62     return 0;
  63   }
  64   FOR_ALL_AOT_HEAPS(heap) {
  65     AOTKlassData* klass_data = (*heap)->find_klass(ik);
  66     if (klass_data != NULL) {
  67       return klass_data->_fingerprint;
  68     }
  69   }
  70   return 0;
  71 }


  98   "jdk.internal.vm.compiler"
  99 };
 100 
 101 void AOTLoader::initialize() {
 102   TraceTime timer("AOT initialization", TRACETIME_LOG(Info, aot, startuptime));
 103 
 104   if (FLAG_IS_DEFAULT(UseAOT) && AOTLibrary != NULL) {
 105     // Don't need to set UseAOT on command line when AOTLibrary is specified
 106     FLAG_SET_DEFAULT(UseAOT, true);
 107   }
 108   if (UseAOT) {
 109     // EagerInitialization is not compatible with AOT
 110     if (EagerInitialization) {
 111       if (PrintAOT) {
 112         warning("EagerInitialization is not compatible with AOT (switching AOT off)");
 113       }
 114       FLAG_SET_DEFAULT(UseAOT, false);
 115       return;
 116     }
 117 
 118     if (JvmtiExport::can_post_breakpoint()) {
 119       if (PrintAOT) {
 120         warning("JVMTI capability to post breakpoint is not compatible with AOT (switching AOT off)");
 121       }
 122       FLAG_SET_DEFAULT(UseAOT, false);
 123       return;
 124     }
 125 
 126     // -Xint is not compatible with AOT
 127     if (Arguments::is_interpreter_only()) {
 128       if (PrintAOT) {
 129         warning("-Xint is not compatible with AOT (switching AOT off)");
 130       }
 131       FLAG_SET_DEFAULT(UseAOT, false);
 132       return;
 133     }
 134 
 135 #ifdef _WINDOWS
 136     const char pathSep = ';';
 137 #else
 138     const char pathSep = ':';
 139 #endif
 140 


< prev index next >