26 #include "aot/aotLoader.inline.hpp" 27 #include "classfile/javaClasses.hpp" 28 #include "jvm.h" 29 #include "memory/allocation.inline.hpp" 30 #include "memory/resourceArea.hpp" 31 #include "oops/compressedOops.hpp" 32 #include "oops/method.hpp" 33 #include "runtime/handles.inline.hpp" 34 #include "runtime/os.inline.hpp" 35 #include "runtime/timerTrace.hpp" 36 37 GrowableArray<AOTCodeHeap*>* AOTLoader::_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<AOTCodeHeap*> (2, true); 38 GrowableArray<AOTLib*>* AOTLoader::_libraries = new(ResourceObj::C_HEAP, mtCode) GrowableArray<AOTLib*> (2, true); 39 40 // Iterate over all AOT CodeHeaps 41 #define FOR_ALL_AOT_HEAPS(heap) for (GrowableArrayIterator<AOTCodeHeap*> heap = heaps()->begin(); heap != heaps()->end(); ++heap) 42 // Iterate over all AOT Libraries 43 #define FOR_ALL_AOT_LIBRARIES(lib) for (GrowableArrayIterator<AOTLib*> lib = libraries()->begin(); lib != libraries()->end(); ++lib) 44 45 void AOTLoader::load_for_klass(InstanceKlass* ik, Thread* thread) { 46 if (ik->is_unsafe_anonymous()) { 47 // don't even bother 48 return; 49 } 50 if (UseAOT) { 51 // We allow hotswap to be enabled after the onload phase, but not breakpoints 52 assert(!JvmtiExport::can_post_breakpoint(), "AOT should have been disabled."); 53 FOR_ALL_AOT_HEAPS(heap) { 54 (*heap)->load_klass_data(ik, thread); 55 } 56 } 57 } 58 59 uint64_t AOTLoader::get_saved_fingerprint(InstanceKlass* ik) { 60 assert(UseAOT, "called only when AOT is enabled"); 61 if (ik->is_unsafe_anonymous()) { 62 // don't even bother 63 return 0; 64 } 65 FOR_ALL_AOT_HEAPS(heap) { 66 AOTKlassData* klass_data = (*heap)->find_klass(ik); 67 if (klass_data != NULL) { 68 return klass_data->_fingerprint; 69 } 70 } 71 return 0; 72 } 73 74 void AOTLoader::oops_do(OopClosure* f) { 75 if (UseAOT) { 76 FOR_ALL_AOT_HEAPS(heap) { 77 (*heap)->oops_do(f); 78 } 79 } 80 } 81 | 26 #include "aot/aotLoader.inline.hpp" 27 #include "classfile/javaClasses.hpp" 28 #include "jvm.h" 29 #include "memory/allocation.inline.hpp" 30 #include "memory/resourceArea.hpp" 31 #include "oops/compressedOops.hpp" 32 #include "oops/method.hpp" 33 #include "runtime/handles.inline.hpp" 34 #include "runtime/os.inline.hpp" 35 #include "runtime/timerTrace.hpp" 36 37 GrowableArray<AOTCodeHeap*>* AOTLoader::_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<AOTCodeHeap*> (2, true); 38 GrowableArray<AOTLib*>* AOTLoader::_libraries = new(ResourceObj::C_HEAP, mtCode) GrowableArray<AOTLib*> (2, true); 39 40 // Iterate over all AOT CodeHeaps 41 #define FOR_ALL_AOT_HEAPS(heap) for (GrowableArrayIterator<AOTCodeHeap*> heap = heaps()->begin(); heap != heaps()->end(); ++heap) 42 // Iterate over all AOT Libraries 43 #define FOR_ALL_AOT_LIBRARIES(lib) for (GrowableArrayIterator<AOTLib*> lib = libraries()->begin(); lib != libraries()->end(); ++lib) 44 45 void AOTLoader::load_for_klass(InstanceKlass* ik, Thread* thread) { 46 if (ik->is_hidden() || ik->is_unsafe_anonymous()) { 47 // don't even bother 48 return; 49 } 50 if (UseAOT) { 51 // We allow hotswap to be enabled after the onload phase, but not breakpoints 52 assert(!JvmtiExport::can_post_breakpoint(), "AOT should have been disabled."); 53 FOR_ALL_AOT_HEAPS(heap) { 54 (*heap)->load_klass_data(ik, thread); 55 } 56 } 57 } 58 59 uint64_t AOTLoader::get_saved_fingerprint(InstanceKlass* ik) { 60 assert(UseAOT, "called only when AOT is enabled"); 61 if (ik->is_hidden() || ik->is_unsafe_anonymous()) { 62 // don't even bother 63 return 0; 64 } 65 FOR_ALL_AOT_HEAPS(heap) { 66 AOTKlassData* klass_data = (*heap)->find_klass(ik); 67 if (klass_data != NULL) { 68 return klass_data->_fingerprint; 69 } 70 } 71 return 0; 72 } 73 74 void AOTLoader::oops_do(OopClosure* f) { 75 if (UseAOT) { 76 FOR_ALL_AOT_HEAPS(heap) { 77 (*heap)->oops_do(f); 78 } 79 } 80 } 81 |