< prev index next >

src/hotspot/share/cds/dynamicArchive.cpp

Print this page
@@ -28,10 +28,11 @@
  #include "cds/archiveHeapWriter.hpp"
  #include "cds/archiveUtils.inline.hpp"
  #include "cds/cds_globals.hpp"
  #include "cds/cdsConfig.hpp"
  #include "cds/dynamicArchive.hpp"
+ #include "cds/metaspaceShared.hpp"
  #include "cds/regeneratedClasses.hpp"
  #include "classfile/classLoader.hpp"
  #include "classfile/classLoaderData.inline.hpp"
  #include "classfile/symbolTable.hpp"
  #include "classfile/systemDictionaryShared.hpp"

@@ -149,12 +150,14 @@
        assert(current_dump_region() == ro_region(), "Must be RO space");
        SymbolTable::write_to_archive(symbols());
  
        ArchiveBuilder::OtherROAllocMark mark;
        SystemDictionaryShared::write_to_archive(false);
+ 
        DynamicArchive::dump_array_klasses();
        AOTClassLinker::write_to_archive();
+       TrainingData::dump_training_data();
  
        serialized_data = ro_region()->top();
        WriteClosure wc(ro_region());
        ArchiveBuilder::serialize_dynamic_archivable_items(&wc);
      }

@@ -162,10 +165,13 @@
      verify_estimate_size(_estimated_hashtable_bytes, "Hashtables");
  
      log_info(cds)("Adjust lambda proxy class dictionary");
      SystemDictionaryShared::adjust_lambda_proxy_class_dictionary();
  
+     log_info(cds)("Make training data shareable");
+     make_training_data_shareable();
+ 
      relocate_to_requested();
  
      write_archive(serialized_data);
      release_header();
      DynamicArchive::post_dump();

@@ -177,10 +183,11 @@
    }
  
    virtual void iterate_roots(MetaspaceClosure* it) {
      FileMapInfo::metaspace_pointers_do(it);
      SystemDictionaryShared::dumptime_classes_do(it);
+     TrainingData::iterate_roots(it);
      iterate_primitive_array_klasses(it);
    }
  
    void iterate_primitive_array_klasses(MetaspaceClosure* it) {
      for (int i = T_BOOLEAN; i <= T_LONG; i++) {

@@ -505,13 +512,22 @@
    }
  
    log_info(cds, dynamic)("Preparing for dynamic dump at exit in thread %s", current->name());
  
    JavaThread* THREAD = current; // For TRAPS processing related to link_shared_classes
+ 
+   {
+     // FIXME-HACK - make sure we have at least one class in the dynamic archive
+     TempNewSymbol class_name = SymbolTable::new_symbol("sun/nio/cs/IBM850"); // unusual class; shouldn't be used by our tests cases.
+     SystemDictionary::resolve_or_null(class_name, Handle(), Handle(), THREAD);
+     guarantee(!HAS_PENDING_EXCEPTION, "must have this class");
+   }
+ 
    MetaspaceShared::link_shared_classes(false/*not from jcmd*/, THREAD);
    if (!HAS_PENDING_EXCEPTION) {
      // copy shared path table to saved.
+     TrainingData::init_dumptime_table(CHECK); // captures TrainingDataSetLocker
      if (!HAS_PENDING_EXCEPTION) {
        VM_PopulateDynamicDumpSharedSpace op(archive_name);
        VMThread::execute(&op);
        return;
      }

@@ -532,10 +548,11 @@
    assert(CDSConfig::is_using_archive() && RecordDynamicDumpInfo, "already checked in arguments.cpp");
    assert(ArchiveClassesAtExit == nullptr, "already checked in arguments.cpp");
    assert(CDSConfig::is_dumping_dynamic_archive(), "already checked by check_for_dynamic_dump() during VM startup");
    MetaspaceShared::link_shared_classes(true/*from jcmd*/, CHECK);
    // copy shared path table to saved.
+   TrainingData::init_dumptime_table(CHECK); // captures TrainingDataSetLocker
    VM_PopulateDynamicDumpSharedSpace op(archive_name);
    VMThread::execute(&op);
  }
  
  bool DynamicArchive::validate(FileMapInfo* dynamic_info) {
< prev index next >