20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 #include "precompiled.hpp"
25
26 #include "aot/aotCodeHeap.hpp"
27 #include "aot/aotLoader.inline.hpp"
28 #include "jvmci/jvmciRuntime.hpp"
29 #include "oops/method.hpp"
30 #include "runtime/os.hpp"
31
32 GrowableArray<AOTCodeHeap*>* AOTLoader::_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<AOTCodeHeap*> (2, true);
33 GrowableArray<AOTLib*>* AOTLoader::_libraries = new(ResourceObj::C_HEAP, mtCode) GrowableArray<AOTLib*> (2, true);
34
35 // Iterate over all AOT CodeHeaps
36 #define FOR_ALL_AOT_HEAPS(heap) for (GrowableArrayIterator<AOTCodeHeap*> heap = heaps()->begin(); heap != heaps()->end(); ++heap)
37 // Iterate over all AOT Libraries
38 #define FOR_ALL_AOT_LIBRARIES(lib) for (GrowableArrayIterator<AOTLib*> lib = libraries()->begin(); lib != libraries()->end(); ++lib)
39
40 void AOTLoader::load_for_klass(instanceKlassHandle kh, Thread* thread) {
41 if (UseAOT) {
42 FOR_ALL_AOT_HEAPS(heap) {
43 (*heap)->load_klass_data(kh, thread);
44 }
45 }
46 }
47
48 uint64_t AOTLoader::get_saved_fingerprint(InstanceKlass* ik) {
49 FOR_ALL_AOT_HEAPS(heap) {
50 AOTKlassData* klass_data = (*heap)->find_klass(ik);
51 if (klass_data != NULL) {
52 return klass_data->_fingerprint;
53 }
54 }
55 return 0;
56 }
57
58 bool AOTLoader::find_klass(InstanceKlass* ik) {
59 FOR_ALL_AOT_HEAPS(heap) {
60 if ((*heap)->find_klass(ik) != NULL) {
61 return true;
62 }
63 }
81 }
82 }
83
84 void AOTLoader::metadata_do(void f(Metadata*)) {
85 if (UseAOT) {
86 FOR_ALL_AOT_HEAPS(heap) {
87 (*heap)->metadata_do(f);
88 }
89 }
90 }
91
92 address AOTLoader::exception_begin(JavaThread* thread, CodeBlob* blob, address return_address) {
93 assert(blob->is_aot(), "sanity");
94 AOTCompiledMethod* aotm = (AOTCompiledMethod*)blob;
95 // Set flag if return address is a method handle call site.
96 thread->set_is_method_handle_return(aotm->is_method_handle_return(return_address));
97 return aotm->exception_begin();
98 }
99
100 // Flushing and deoptimization in case of evolution
101 void AOTLoader::flush_evol_dependents_on(instanceKlassHandle dependee) {
102 // make non entrant and mark for deoptimization
103 FOR_ALL_AOT_HEAPS(heap) {
104 (*heap)->flush_evol_dependents_on(dependee);
105 }
106 Deoptimization::deoptimize_dependents();
107 }
108
109 /**
110 * List of core modules for which we search for shared libraries.
111 */
112 static const char* modules[] = {
113 "java.base",
114 "java.logging",
115 "jdk.compiler",
116 "jdk.scripting.nashorn",
117 "jdk.vm.ci",
118 "jdk.vm.compiler"
119 };
120
121 void AOTLoader::initialize() {
|
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 #include "precompiled.hpp"
25
26 #include "aot/aotCodeHeap.hpp"
27 #include "aot/aotLoader.inline.hpp"
28 #include "jvmci/jvmciRuntime.hpp"
29 #include "oops/method.hpp"
30 #include "runtime/os.hpp"
31
32 GrowableArray<AOTCodeHeap*>* AOTLoader::_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<AOTCodeHeap*> (2, true);
33 GrowableArray<AOTLib*>* AOTLoader::_libraries = new(ResourceObj::C_HEAP, mtCode) GrowableArray<AOTLib*> (2, true);
34
35 // Iterate over all AOT CodeHeaps
36 #define FOR_ALL_AOT_HEAPS(heap) for (GrowableArrayIterator<AOTCodeHeap*> heap = heaps()->begin(); heap != heaps()->end(); ++heap)
37 // Iterate over all AOT Libraries
38 #define FOR_ALL_AOT_LIBRARIES(lib) for (GrowableArrayIterator<AOTLib*> lib = libraries()->begin(); lib != libraries()->end(); ++lib)
39
40 void AOTLoader::load_for_klass(InstanceKlass* ik, Thread* thread) {
41 if (UseAOT) {
42 FOR_ALL_AOT_HEAPS(heap) {
43 (*heap)->load_klass_data(ik, thread);
44 }
45 }
46 }
47
48 uint64_t AOTLoader::get_saved_fingerprint(InstanceKlass* ik) {
49 FOR_ALL_AOT_HEAPS(heap) {
50 AOTKlassData* klass_data = (*heap)->find_klass(ik);
51 if (klass_data != NULL) {
52 return klass_data->_fingerprint;
53 }
54 }
55 return 0;
56 }
57
58 bool AOTLoader::find_klass(InstanceKlass* ik) {
59 FOR_ALL_AOT_HEAPS(heap) {
60 if ((*heap)->find_klass(ik) != NULL) {
61 return true;
62 }
63 }
81 }
82 }
83
84 void AOTLoader::metadata_do(void f(Metadata*)) {
85 if (UseAOT) {
86 FOR_ALL_AOT_HEAPS(heap) {
87 (*heap)->metadata_do(f);
88 }
89 }
90 }
91
92 address AOTLoader::exception_begin(JavaThread* thread, CodeBlob* blob, address return_address) {
93 assert(blob->is_aot(), "sanity");
94 AOTCompiledMethod* aotm = (AOTCompiledMethod*)blob;
95 // Set flag if return address is a method handle call site.
96 thread->set_is_method_handle_return(aotm->is_method_handle_return(return_address));
97 return aotm->exception_begin();
98 }
99
100 // Flushing and deoptimization in case of evolution
101 void AOTLoader::flush_evol_dependents_on(InstanceKlass* dependee) {
102 // make non entrant and mark for deoptimization
103 FOR_ALL_AOT_HEAPS(heap) {
104 (*heap)->flush_evol_dependents_on(dependee);
105 }
106 Deoptimization::deoptimize_dependents();
107 }
108
109 /**
110 * List of core modules for which we search for shared libraries.
111 */
112 static const char* modules[] = {
113 "java.base",
114 "java.logging",
115 "jdk.compiler",
116 "jdk.scripting.nashorn",
117 "jdk.vm.ci",
118 "jdk.vm.compiler"
119 };
120
121 void AOTLoader::initialize() {
|