< prev index next >

src/hotspot/share/aot/aotLoader.cpp

Print this page




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "aot/aotCodeHeap.hpp"
  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


 302   CodeBlob* caller_cb = caller_frame.cb();
 303   guarantee(caller_cb != NULL && caller_cb->is_compiled(), "must be called from compiled method");
 304   CompiledMethod* cm = caller_cb->as_compiled_method();
 305 
 306   if (!cm->is_aot()) {
 307     return true;
 308   }
 309   AOTCompiledMethod* aot = (AOTCompiledMethod*)cm;
 310 
 311   AOTCodeHeap* caller_heap = NULL;
 312   FOR_ALL_AOT_HEAPS(heap) {
 313     if ((*heap)->contains_blob(aot)) {
 314       caller_heap = *heap;
 315       break;
 316     }
 317   }
 318   guarantee(caller_heap != NULL, "CodeHeap not found");
 319   bool success = caller_heap->reconcile_dynamic_invoke(aot, holder, index, adapter_method, appendix_klass);
 320   vmassert(success || thread->last_frame().sender(&map).is_deoptimized_frame(), "caller not deoptimized on failure");
 321   return success;
 322 }
 323 
 324 
 325 // This should be called very early during startup before any of the AOTed methods that use boxes can deoptimize.
 326 // Deoptimization machinery expects the caches to be present and populated.
 327 void AOTLoader::initialize_box_caches(TRAPS) {
 328   if (!UseAOT || libraries_count() == 0) {
 329     return;
 330   }
 331   TraceTime timer("AOT initialization of box caches", TRACETIME_LOG(Info, aot, startuptime));
 332   Symbol* box_classes[] = { java_lang_Boolean::symbol(), java_lang_Byte_ByteCache::symbol(),
 333     java_lang_Short_ShortCache::symbol(), java_lang_Character_CharacterCache::symbol(),
 334     java_lang_Integer_IntegerCache::symbol(), java_lang_Long_LongCache::symbol() };
 335 
 336   for (unsigned i = 0; i < sizeof(box_classes) / sizeof(Symbol*); i++) {
 337     Klass* k = SystemDictionary::resolve_or_fail(box_classes[i], true, CHECK);
 338     InstanceKlass* ik = InstanceKlass::cast(k);
 339     if (ik->is_not_initialized()) {
 340       ik->initialize(CHECK);
 341     }
 342   }
 343 }


   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "aot/aotCodeHeap.hpp"
  26 #include "aot/aotLoader.inline.hpp"

  27 #include "jvm.h"
  28 #include "memory/allocation.inline.hpp"
  29 #include "memory/resourceArea.hpp"
  30 #include "oops/compressedOops.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


 301   CodeBlob* caller_cb = caller_frame.cb();
 302   guarantee(caller_cb != NULL && caller_cb->is_compiled(), "must be called from compiled method");
 303   CompiledMethod* cm = caller_cb->as_compiled_method();
 304 
 305   if (!cm->is_aot()) {
 306     return true;
 307   }
 308   AOTCompiledMethod* aot = (AOTCompiledMethod*)cm;
 309 
 310   AOTCodeHeap* caller_heap = NULL;
 311   FOR_ALL_AOT_HEAPS(heap) {
 312     if ((*heap)->contains_blob(aot)) {
 313       caller_heap = *heap;
 314       break;
 315     }
 316   }
 317   guarantee(caller_heap != NULL, "CodeHeap not found");
 318   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");
 320   return success;





















 321 }
< prev index next >