< prev index next >

src/hotspot/share/cds/aotMetaspace.cpp

Print this page

  60 #include "classfile/systemDictionaryShared.hpp"
  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/instanceMirrorKlass.hpp"
  81 #include "oops/klass.inline.hpp"
  82 #include "oops/objArrayOop.hpp"
  83 #include "oops/oop.inline.hpp"
  84 #include "oops/oopHandle.hpp"
  85 #include "oops/trainingData.hpp"
  86 #include "prims/jvmtiExport.hpp"
  87 #include "runtime/arguments.hpp"
  88 #include "runtime/globals.hpp"
  89 #include "runtime/globals_extension.hpp"
  90 #include "runtime/handles.inline.hpp"
  91 #include "runtime/javaCalls.hpp"
  92 #include "runtime/os.inline.hpp"
  93 #include "runtime/safepointVerifiers.hpp"
  94 #include "runtime/sharedRuntime.hpp"
  95 #include "runtime/vmOperations.hpp"
  96 #include "runtime/vmThread.hpp"
  97 #include "sanitizers/leak.hpp"
  98 #include "utilities/align.hpp"
  99 #include "utilities/bitMap.inline.hpp"

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

1243     }
1244     ik->link_class(THREAD);
1245     if (HAS_PENDING_EXCEPTION) {
1246       ResourceMark rm(THREAD);
1247       aot_log_warning(aot)("Preload Warning: Verification failed for %s",
1248                     ik->external_name());
1249       CLEAR_PENDING_EXCEPTION;
1250       SystemDictionaryShared::set_class_has_failed_verification(ik);
1251     } else {
1252       assert(!SystemDictionaryShared::has_class_failed_verification(ik), "sanity");
1253       ik->compute_has_loops_flag_for_methods();
1254     }
1255     BytecodeVerificationLocal = saved;
1256     return true;
1257   } else {
1258     return false;
1259   }
1260 }
1261 
1262 void VM_PopulateDumpSharedSpace::dump_java_heap_objects() {





1263   if (CDSConfig::is_dumping_heap()) {
1264     HeapShared::write_heap(&_heap_info);
1265   } else {
1266     CDSConfig::log_reasons_for_not_dumping_heap();
1267   }
1268 }
1269 
1270 void AOTMetaspace::set_aot_metaspace_range(void* base, void *static_top, void* top) {
1271   assert(base <= static_top && static_top <= top, "must be");
1272   _aot_metaspace_static_top = static_top;
1273   MetaspaceObj::set_aot_metaspace_range(base, top);
1274 }
1275 
1276 bool AOTMetaspace::in_aot_cache_dynamic_region(void* p) {
1277   if ((p < MetaspaceObj::aot_metaspace_top()) &&
1278       (p >= _aot_metaspace_static_top)) {
1279     return true;
1280   } else {
1281     return false;
1282   }

  60 #include "classfile/systemDictionaryShared.hpp"
  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/flatArrayKlass.hpp"
  81 #include "oops/inlineKlass.hpp"
  82 #include "oops/instanceMirrorKlass.hpp"
  83 #include "oops/klass.inline.hpp"
  84 #include "oops/objArrayOop.hpp"
  85 #include "oops/oop.inline.hpp"
  86 #include "oops/oopHandle.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"
 101 #include "utilities/bitMap.inline.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(refArrayOopDesc::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);

1245     }
1246     ik->link_class(THREAD);
1247     if (HAS_PENDING_EXCEPTION) {
1248       ResourceMark rm(THREAD);
1249       aot_log_warning(aot)("Preload Warning: Verification failed for %s",
1250                     ik->external_name());
1251       CLEAR_PENDING_EXCEPTION;
1252       SystemDictionaryShared::set_class_has_failed_verification(ik);
1253     } else {
1254       assert(!SystemDictionaryShared::has_class_failed_verification(ik), "sanity");
1255       ik->compute_has_loops_flag_for_methods();
1256     }
1257     BytecodeVerificationLocal = saved;
1258     return true;
1259   } else {
1260     return false;
1261   }
1262 }
1263 
1264 void VM_PopulateDumpSharedSpace::dump_java_heap_objects() {
1265   if (CDSConfig::is_valhalla_preview()) {
1266     log_info(cds)("Archived java heap is not yet supported with Valhalla preview");
1267     return;
1268   }
1269 
1270   if (CDSConfig::is_dumping_heap()) {
1271     HeapShared::write_heap(&_heap_info);
1272   } else {
1273     CDSConfig::log_reasons_for_not_dumping_heap();
1274   }
1275 }
1276 
1277 void AOTMetaspace::set_aot_metaspace_range(void* base, void *static_top, void* top) {
1278   assert(base <= static_top && static_top <= top, "must be");
1279   _aot_metaspace_static_top = static_top;
1280   MetaspaceObj::set_aot_metaspace_range(base, top);
1281 }
1282 
1283 bool AOTMetaspace::in_aot_cache_dynamic_region(void* p) {
1284   if ((p < MetaspaceObj::aot_metaspace_top()) &&
1285       (p >= _aot_metaspace_static_top)) {
1286     return true;
1287   } else {
1288     return false;
1289   }
< prev index next >