< prev index next >

src/hotspot/share/cds/metaspaceShared.hpp

Print this page
*** 29,59 ***
  #include "memory/memRegion.hpp"
  #include "memory/virtualspace.hpp"
  #include "oops/oop.hpp"
  #include "utilities/macros.hpp"
  
  class FileMapInfo;
  class outputStream;
  class SerializeClosure;
  
  template<class E> class GrowableArray;
  
  enum MapArchiveResult {
    MAP_ARCHIVE_SUCCESS,
    MAP_ARCHIVE_MMAP_FAILURE,
    MAP_ARCHIVE_OTHER_FAILURE
  };
  
  // Class Data Sharing Support
  class MetaspaceShared : AllStatic {
    static ReservedSpace _symbol_rs;  // used only during -Xshare:dump
    static VirtualSpace _symbol_vs;   // used only during -Xshare:dump
    static bool _archive_loading_failed;
    static bool _remapped_readwrite;
    static void* _shared_metaspace_static_top;
    static intx _relocation_delta;
    static char* _requested_base_address;
    static bool _use_optimized_module_handling;
   public:
    enum {
      // core archive spaces
      rw = 0,  // read-write shared space
      ro = 1,  // read-only shared space
      bm = 2,  // relocation bitmaps (freed after file mapping is finished)
      hp = 3,  // heap region
      num_core_region = 2,       // rw and ro
!     n_regions = 4              // total number of regions
    };
  
    static void prepare_for_dumping() NOT_CDS_RETURN;
    static void preload_and_dump() NOT_CDS_RETURN;
  #ifdef _LP64
    static void adjust_heap_sizes_for_dumping() NOT_CDS_JAVA_HEAP_RETURN;
  #endif
  
  private:
!   static void preload_and_dump_impl(TRAPS) NOT_CDS_RETURN;
    static void preload_classes(TRAPS) NOT_CDS_RETURN;
  
  public:
    static Symbol* symbol_rs_base() {
      return (Symbol*)_symbol_rs.base();
    }
  
    static void initialize_for_static_dump() NOT_CDS_RETURN;
    static void initialize_runtime_shared_and_meta_spaces() NOT_CDS_RETURN;
    static void post_initialize(TRAPS) NOT_CDS_RETURN;
  
    static void print_on(outputStream* st);
  
--- 29,68 ---
  #include "memory/memRegion.hpp"
  #include "memory/virtualspace.hpp"
  #include "oops/oop.hpp"
  #include "utilities/macros.hpp"
  
+ class ArchiveBuilder;
+ class ArchiveHeapInfo;
  class FileMapInfo;
+ class Method;
  class outputStream;
  class SerializeClosure;
  
+ template<class E> class Array;
  template<class E> class GrowableArray;
  
  enum MapArchiveResult {
    MAP_ARCHIVE_SUCCESS,
    MAP_ARCHIVE_MMAP_FAILURE,
    MAP_ARCHIVE_OTHER_FAILURE
  };
  
+ class StaticArchiveBuilder;
+ 
  // Class Data Sharing Support
  class MetaspaceShared : AllStatic {
    static ReservedSpace _symbol_rs;  // used only during -Xshare:dump
    static VirtualSpace _symbol_vs;   // used only during -Xshare:dump
    static bool _archive_loading_failed;
    static bool _remapped_readwrite;
    static void* _shared_metaspace_static_top;
    static intx _relocation_delta;
    static char* _requested_base_address;
    static bool _use_optimized_module_handling;
+   static Array<Method*>* _archived_method_handle_intrinsics;
   public:
    enum {
      // core archive spaces
      rw = 0,  // read-write shared space
      ro = 1,  // read-only shared space
      bm = 2,  // relocation bitmaps (freed after file mapping is finished)
      hp = 3,  // heap region
+     cc = 4,  // cached code
      num_core_region = 2,       // rw and ro
!     n_regions = 5              // total number of regions
    };
  
    static void prepare_for_dumping() NOT_CDS_RETURN;
    static void preload_and_dump() NOT_CDS_RETURN;
  #ifdef _LP64
    static void adjust_heap_sizes_for_dumping() NOT_CDS_JAVA_HEAP_RETURN;
  #endif
  
  private:
!   static void preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS) NOT_CDS_RETURN;
    static void preload_classes(TRAPS) NOT_CDS_RETURN;
  
  public:
    static Symbol* symbol_rs_base() {
      return (Symbol*)_symbol_rs.base();
    }
  
    static void initialize_for_static_dump() NOT_CDS_RETURN;
+   static void open_static_archive() NOT_CDS_RETURN;
    static void initialize_runtime_shared_and_meta_spaces() NOT_CDS_RETURN;
    static void post_initialize(TRAPS) NOT_CDS_RETURN;
  
    static void print_on(outputStream* st);
  

*** 103,10 ***
--- 112,13 ---
    static bool is_shared_static(void* p) NOT_CDS_RETURN_(false);
  
    static void unrecoverable_loading_error(const char* message = nullptr);
    static void unrecoverable_writing_error(const char* message = nullptr);
  
+   static void make_method_handle_intrinsics_shareable() NOT_CDS_RETURN;
+   static void write_method_handle_intrinsics() NOT_CDS_RETURN;
+   static Array<Method*>* archived_method_handle_intrinsics() { return _archived_method_handle_intrinsics; }
    static void serialize(SerializeClosure* sc) NOT_CDS_RETURN;
  
    // JVM/TI RedefineClasses() support:
    // Remap the shared readonly space to shared readwrite, private if
    // sharing is enabled. Simply returns true if sharing is not enabled

*** 117,11 ***
      NOT_CDS(return false);
    }
  
    static bool try_link_class(JavaThread* current, InstanceKlass* ik);
    static void link_shared_classes(bool jcmd_request, TRAPS) NOT_CDS_RETURN;
-   static bool link_class_for_cds(InstanceKlass* ik, TRAPS) NOT_CDS_RETURN_(false);
    static bool may_be_eagerly_linked(InstanceKlass* ik) NOT_CDS_RETURN_(false);
  
  #if INCLUDE_CDS
    // Alignment for the 2 core CDS regions (RW/RO) only.
    // (Heap region alignments are decided by GC).
--- 129,10 ---

*** 163,11 ***
    static bool use_optimized_module_handling() { return NOT_CDS(false) CDS_ONLY(_use_optimized_module_handling); }
    static void disable_optimized_module_handling() { _use_optimized_module_handling = false; }
  
  private:
    static void read_extra_data(JavaThread* current, const char* filename) NOT_CDS_RETURN;
!   static FileMapInfo* open_static_archive();
    static FileMapInfo* open_dynamic_archive();
    // use_requested_addr: If true (default), attempt to map at the address the
    static MapArchiveResult map_archives(FileMapInfo* static_mapinfo, FileMapInfo* dynamic_mapinfo,
                                         bool use_requested_addr);
    static char* reserve_address_space_for_archives(FileMapInfo* static_mapinfo,
--- 174,12 ---
    static bool use_optimized_module_handling() { return NOT_CDS(false) CDS_ONLY(_use_optimized_module_handling); }
    static void disable_optimized_module_handling() { _use_optimized_module_handling = false; }
  
  private:
    static void read_extra_data(JavaThread* current, const char* filename) NOT_CDS_RETURN;
!   static void write_static_archive(ArchiveBuilder* builder, FileMapInfo *mapinfo, ArchiveHeapInfo* heap_info);
+   static void fork_and_dump_final_static_archive();
    static FileMapInfo* open_dynamic_archive();
    // use_requested_addr: If true (default), attempt to map at the address the
    static MapArchiveResult map_archives(FileMapInfo* static_mapinfo, FileMapInfo* dynamic_mapinfo,
                                         bool use_requested_addr);
    static char* reserve_address_space_for_archives(FileMapInfo* static_mapinfo,
< prev index next >