< prev index next >

src/hotspot/share/aot/aotLoader.cpp

Print this page




  25 #include "jvm.h"
  26 
  27 #include "aot/aotCodeHeap.hpp"
  28 #include "aot/aotLoader.inline.hpp"
  29 #include "jvmci/jvmciRuntime.hpp"
  30 #include "memory/allocation.inline.hpp"
  31 #include "oops/method.hpp"
  32 #include "runtime/handles.inline.hpp"
  33 #include "runtime/os.inline.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 }
  72 
  73 void AOTLoader::oops_do(OopClosure* f) {
  74   if (UseAOT) {
  75     FOR_ALL_AOT_HEAPS(heap) {
  76       (*heap)->oops_do(f);
  77     }
  78   }
  79 }
  80 




  25 #include "jvm.h"
  26 
  27 #include "aot/aotCodeHeap.hpp"
  28 #include "aot/aotLoader.inline.hpp"
  29 #include "jvmci/jvmciRuntime.hpp"
  30 #include "memory/allocation.inline.hpp"
  31 #include "oops/method.hpp"
  32 #include "runtime/handles.inline.hpp"
  33 #include "runtime/os.inline.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_nonfindable() || 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_nonfindable() || 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 }
  72 
  73 void AOTLoader::oops_do(OopClosure* f) {
  74   if (UseAOT) {
  75     FOR_ALL_AOT_HEAPS(heap) {
  76       (*heap)->oops_do(f);
  77     }
  78   }
  79 }
  80 


< prev index next >