22 */ |
22 */ |
23 |
23 |
24 #include "precompiled.hpp" |
24 #include "precompiled.hpp" |
25 #include "aot/aotCodeHeap.hpp" |
25 #include "aot/aotCodeHeap.hpp" |
26 #include "aot/aotLoader.inline.hpp" |
26 #include "aot/aotLoader.inline.hpp" |
|
27 #include "classfile/javaClasses.hpp" |
27 #include "jvm.h" |
28 #include "jvm.h" |
28 #include "memory/allocation.inline.hpp" |
29 #include "memory/allocation.inline.hpp" |
29 #include "memory/resourceArea.hpp" |
30 #include "memory/resourceArea.hpp" |
30 #include "oops/compressedOops.hpp" |
31 #include "oops/compressedOops.hpp" |
31 #include "oops/method.hpp" |
32 #include "oops/method.hpp" |
148 |
149 |
149 // Scan the AOTLibrary option. |
150 // Scan the AOTLibrary option. |
150 if (AOTLibrary != NULL) { |
151 if (AOTLibrary != NULL) { |
151 const int len = (int)strlen(AOTLibrary); |
152 const int len = (int)strlen(AOTLibrary); |
152 char* cp = NEW_C_HEAP_ARRAY(char, len+1, mtCode); |
153 char* cp = NEW_C_HEAP_ARRAY(char, len+1, mtCode); |
153 if (cp != NULL) { // No memory? |
154 memcpy(cp, AOTLibrary, len); |
154 memcpy(cp, AOTLibrary, len); |
155 cp[len] = '\0'; |
155 cp[len] = '\0'; |
156 char* end = cp + len; |
156 char* end = cp + len; |
157 while (cp < end) { |
157 while (cp < end) { |
158 const char* name = cp; |
158 const char* name = cp; |
159 while ((*cp) != '\0' && (*cp) != '\n' && (*cp) != ',' && (*cp) != pathSep) cp++; |
159 while ((*cp) != '\0' && (*cp) != '\n' && (*cp) != ',' && (*cp) != pathSep) cp++; |
160 cp[0] = '\0'; // Terminate name |
160 cp[0] = '\0'; // Terminate name |
161 cp++; |
161 cp++; |
162 load_library(name, true); |
162 load_library(name, true); |
|
163 } |
|
164 } |
163 } |
165 } |
164 } |
166 |
165 |
167 // Load well-know AOT libraries from Java installation directory. |
166 // Load well-know AOT libraries from Java installation directory. |
168 const char* home = Arguments::get_java_home(); |
167 const char* home = Arguments::get_java_home(); |
317 guarantee(caller_heap != NULL, "CodeHeap not found"); |
316 guarantee(caller_heap != NULL, "CodeHeap not found"); |
318 bool success = caller_heap->reconcile_dynamic_invoke(aot, holder, index, adapter_method, appendix_klass); |
317 bool success = caller_heap->reconcile_dynamic_invoke(aot, holder, index, adapter_method, appendix_klass); |
319 vmassert(success || thread->last_frame().sender(&map).is_deoptimized_frame(), "caller not deoptimized on failure"); |
318 vmassert(success || thread->last_frame().sender(&map).is_deoptimized_frame(), "caller not deoptimized on failure"); |
320 return success; |
319 return success; |
321 } |
320 } |
|
321 |
|
322 |
|
323 // This should be called very early during startup before any of the AOTed methods that use boxes can deoptimize. |
|
324 // Deoptimization machinery expects the caches to be present and populated. |
|
325 void AOTLoader::initialize_box_caches(TRAPS) { |
|
326 if (!UseAOT || libraries_count() == 0) { |
|
327 return; |
|
328 } |
|
329 TraceTime timer("AOT initialization of box caches", TRACETIME_LOG(Info, aot, startuptime)); |
|
330 Symbol* box_classes[] = { java_lang_Boolean::symbol(), java_lang_Byte_ByteCache::symbol(), |
|
331 java_lang_Short_ShortCache::symbol(), java_lang_Character_CharacterCache::symbol(), |
|
332 java_lang_Integer_IntegerCache::symbol(), java_lang_Long_LongCache::symbol() }; |
|
333 |
|
334 for (unsigned i = 0; i < sizeof(box_classes) / sizeof(Symbol*); i++) { |
|
335 Klass* k = SystemDictionary::resolve_or_fail(box_classes[i], true, CHECK); |
|
336 InstanceKlass* ik = InstanceKlass::cast(k); |
|
337 if (ik->is_not_initialized()) { |
|
338 ik->initialize(CHECK); |
|
339 } |
|
340 } |
|
341 } |