< prev index next >

src/hotspot/share/cds/aotMetaspace.cpp

Print this page

  61 #include "classfile/vmClasses.hpp"
  62 #include "classfile/vmSymbols.hpp"
  63 #include "code/aotCodeCache.hpp"
  64 #include "code/codeCache.hpp"
  65 #include "gc/shared/gcVMOperations.hpp"
  66 #include "interpreter/bytecodes.hpp"
  67 #include "interpreter/bytecodeStream.hpp"
  68 #include "jvm_io.h"
  69 #include "logging/log.hpp"
  70 #include "logging/logMessage.hpp"
  71 #include "logging/logStream.hpp"
  72 #include "memory/memoryReserver.hpp"
  73 #include "memory/metaspace.hpp"
  74 #include "memory/metaspaceClosure.hpp"
  75 #include "memory/oopFactory.hpp"
  76 #include "memory/resourceArea.hpp"
  77 #include "memory/universe.hpp"
  78 #include "nmt/memTracker.hpp"
  79 #include "oops/compressedKlass.hpp"
  80 #include "oops/constantPool.inline.hpp"


  81 #include "oops/instanceMirrorKlass.hpp"
  82 #include "oops/klass.inline.hpp"
  83 #include "oops/objArrayOop.hpp"
  84 #include "oops/oop.inline.hpp"
  85 #include "oops/oopHandle.hpp"
  86 #include "oops/resolvedFieldEntry.hpp"
  87 #include "oops/trainingData.hpp"
  88 #include "prims/jvmtiExport.hpp"
  89 #include "runtime/arguments.hpp"
  90 #include "runtime/globals.hpp"
  91 #include "runtime/globals_extension.hpp"
  92 #include "runtime/handles.inline.hpp"
  93 #include "runtime/javaCalls.hpp"
  94 #include "runtime/os.inline.hpp"
  95 #include "runtime/safepointVerifiers.hpp"
  96 #include "runtime/sharedRuntime.hpp"
  97 #include "runtime/vmOperations.hpp"
  98 #include "runtime/vmThread.hpp"
  99 #include "sanitizers/leak.hpp"
 100 #include "utilities/align.hpp"

 463 // AOTMetaspace::early_serialize(). Such functions must not produce side effects that
 464 // assume we will always decides to map the archive.
 465 
 466 void AOTMetaspace::early_serialize(SerializeClosure* soc) {
 467   int tag = 0;
 468   soc->do_tag(--tag);
 469   CDS_JAVA_HEAP_ONLY(Modules::serialize_archived_module_info(soc);)
 470   soc->do_tag(666);
 471 }
 472 
 473 void AOTMetaspace::serialize(SerializeClosure* soc) {
 474   int tag = 0;
 475   soc->do_tag(--tag);
 476 
 477   // Verify the sizes of various metadata in the system.
 478   soc->do_tag(sizeof(Method));
 479   soc->do_tag(sizeof(ConstMethod));
 480   soc->do_tag(arrayOopDesc::base_offset_in_bytes(T_BYTE));
 481   soc->do_tag(sizeof(ConstantPool));
 482   soc->do_tag(sizeof(ConstantPoolCache));
 483   soc->do_tag(objArrayOopDesc::base_offset_in_bytes());
 484   soc->do_tag(typeArrayOopDesc::base_offset_in_bytes(T_BYTE));
 485   soc->do_tag(sizeof(Symbol));
 486 
 487   // Need to do this first, as subsequent steps may call virtual functions
 488   // in archived Metadata objects.
 489   CppVtables::serialize(soc);
 490   soc->do_tag(--tag);
 491 
 492   // Dump/restore miscellaneous metadata.
 493   JavaClasses::serialize_offsets(soc);
 494   Universe::serialize(soc);
 495   soc->do_tag(--tag);
 496 
 497   // Dump/restore references to commonly used names and signatures.
 498   vmSymbols::serialize(soc);
 499   soc->do_tag(--tag);
 500 
 501   // Dump/restore the symbol/string/subgraph_info tables
 502   SymbolTable::serialize_shared_table_header(soc);
 503   StringTable::serialize_shared_table_header(soc);

1326     }
1327     ik->link_class(THREAD);
1328     if (HAS_PENDING_EXCEPTION) {
1329       ResourceMark rm(THREAD);
1330       aot_log_warning(aot)("Preload Warning: Verification failed for %s",
1331                     ik->external_name());
1332       CLEAR_PENDING_EXCEPTION;
1333       SystemDictionaryShared::set_class_has_failed_verification(ik);
1334     } else {
1335       assert(!SystemDictionaryShared::has_class_failed_verification(ik), "sanity");
1336       ik->compute_has_loops_flag_for_methods();
1337     }
1338     BytecodeVerificationLocal = saved;
1339     return true;
1340   } else {
1341     return false;
1342   }
1343 }
1344 
1345 void VM_PopulateDumpSharedSpace::dump_java_heap_objects() {





1346   if (CDSConfig::is_dumping_heap()) {
1347     HeapShared::write_heap(&_heap_info);
1348   } else {
1349     CDSConfig::log_reasons_for_not_dumping_heap();
1350   }
1351 }
1352 
1353 void AOTMetaspace::set_aot_metaspace_range(void* base, void *static_top, void* top) {
1354   assert(base <= static_top && static_top <= top, "must be");
1355   _aot_metaspace_static_top = static_top;
1356   MetaspaceObj::set_aot_metaspace_range(base, top);
1357 }
1358 
1359 bool AOTMetaspace::in_aot_cache_dynamic_region(void* p) {
1360   if ((p < MetaspaceObj::aot_metaspace_top()) &&
1361       (p >= _aot_metaspace_static_top)) {
1362     return true;
1363   } else {
1364     return false;
1365   }

  61 #include "classfile/vmClasses.hpp"
  62 #include "classfile/vmSymbols.hpp"
  63 #include "code/aotCodeCache.hpp"
  64 #include "code/codeCache.hpp"
  65 #include "gc/shared/gcVMOperations.hpp"
  66 #include "interpreter/bytecodes.hpp"
  67 #include "interpreter/bytecodeStream.hpp"
  68 #include "jvm_io.h"
  69 #include "logging/log.hpp"
  70 #include "logging/logMessage.hpp"
  71 #include "logging/logStream.hpp"
  72 #include "memory/memoryReserver.hpp"
  73 #include "memory/metaspace.hpp"
  74 #include "memory/metaspaceClosure.hpp"
  75 #include "memory/oopFactory.hpp"
  76 #include "memory/resourceArea.hpp"
  77 #include "memory/universe.hpp"
  78 #include "nmt/memTracker.hpp"
  79 #include "oops/compressedKlass.hpp"
  80 #include "oops/constantPool.inline.hpp"
  81 #include "oops/flatArrayKlass.hpp"
  82 #include "oops/inlineKlass.hpp"
  83 #include "oops/instanceMirrorKlass.hpp"
  84 #include "oops/klass.inline.hpp"
  85 #include "oops/objArrayOop.hpp"
  86 #include "oops/oop.inline.hpp"
  87 #include "oops/oopHandle.hpp"
  88 #include "oops/resolvedFieldEntry.hpp"
  89 #include "oops/trainingData.hpp"
  90 #include "prims/jvmtiExport.hpp"
  91 #include "runtime/arguments.hpp"
  92 #include "runtime/globals.hpp"
  93 #include "runtime/globals_extension.hpp"
  94 #include "runtime/handles.inline.hpp"
  95 #include "runtime/javaCalls.hpp"
  96 #include "runtime/os.inline.hpp"
  97 #include "runtime/safepointVerifiers.hpp"
  98 #include "runtime/sharedRuntime.hpp"
  99 #include "runtime/vmOperations.hpp"
 100 #include "runtime/vmThread.hpp"
 101 #include "sanitizers/leak.hpp"
 102 #include "utilities/align.hpp"

 465 // AOTMetaspace::early_serialize(). Such functions must not produce side effects that
 466 // assume we will always decides to map the archive.
 467 
 468 void AOTMetaspace::early_serialize(SerializeClosure* soc) {
 469   int tag = 0;
 470   soc->do_tag(--tag);
 471   CDS_JAVA_HEAP_ONLY(Modules::serialize_archived_module_info(soc);)
 472   soc->do_tag(666);
 473 }
 474 
 475 void AOTMetaspace::serialize(SerializeClosure* soc) {
 476   int tag = 0;
 477   soc->do_tag(--tag);
 478 
 479   // Verify the sizes of various metadata in the system.
 480   soc->do_tag(sizeof(Method));
 481   soc->do_tag(sizeof(ConstMethod));
 482   soc->do_tag(arrayOopDesc::base_offset_in_bytes(T_BYTE));
 483   soc->do_tag(sizeof(ConstantPool));
 484   soc->do_tag(sizeof(ConstantPoolCache));
 485   soc->do_tag(refArrayOopDesc::base_offset_in_bytes());
 486   soc->do_tag(typeArrayOopDesc::base_offset_in_bytes(T_BYTE));
 487   soc->do_tag(sizeof(Symbol));
 488 
 489   // Need to do this first, as subsequent steps may call virtual functions
 490   // in archived Metadata objects.
 491   CppVtables::serialize(soc);
 492   soc->do_tag(--tag);
 493 
 494   // Dump/restore miscellaneous metadata.
 495   JavaClasses::serialize_offsets(soc);
 496   Universe::serialize(soc);
 497   soc->do_tag(--tag);
 498 
 499   // Dump/restore references to commonly used names and signatures.
 500   vmSymbols::serialize(soc);
 501   soc->do_tag(--tag);
 502 
 503   // Dump/restore the symbol/string/subgraph_info tables
 504   SymbolTable::serialize_shared_table_header(soc);
 505   StringTable::serialize_shared_table_header(soc);

1328     }
1329     ik->link_class(THREAD);
1330     if (HAS_PENDING_EXCEPTION) {
1331       ResourceMark rm(THREAD);
1332       aot_log_warning(aot)("Preload Warning: Verification failed for %s",
1333                     ik->external_name());
1334       CLEAR_PENDING_EXCEPTION;
1335       SystemDictionaryShared::set_class_has_failed_verification(ik);
1336     } else {
1337       assert(!SystemDictionaryShared::has_class_failed_verification(ik), "sanity");
1338       ik->compute_has_loops_flag_for_methods();
1339     }
1340     BytecodeVerificationLocal = saved;
1341     return true;
1342   } else {
1343     return false;
1344   }
1345 }
1346 
1347 void VM_PopulateDumpSharedSpace::dump_java_heap_objects() {
1348   if (CDSConfig::is_valhalla_preview()) {
1349     log_info(cds)("Archived java heap is not yet supported with Valhalla preview");
1350     return;
1351   }
1352 
1353   if (CDSConfig::is_dumping_heap()) {
1354     HeapShared::write_heap(&_heap_info);
1355   } else {
1356     CDSConfig::log_reasons_for_not_dumping_heap();
1357   }
1358 }
1359 
1360 void AOTMetaspace::set_aot_metaspace_range(void* base, void *static_top, void* top) {
1361   assert(base <= static_top && static_top <= top, "must be");
1362   _aot_metaspace_static_top = static_top;
1363   MetaspaceObj::set_aot_metaspace_range(base, top);
1364 }
1365 
1366 bool AOTMetaspace::in_aot_cache_dynamic_region(void* p) {
1367   if ((p < MetaspaceObj::aot_metaspace_top()) &&
1368       (p >= _aot_metaspace_static_top)) {
1369     return true;
1370   } else {
1371     return false;
1372   }
< prev index next >