< prev index next >

src/hotspot/share/memory/metaspaceShared.cpp

Print this page


  47 #include "memory/resourceArea.hpp"
  48 #include "oops/compressedOops.inline.hpp"
  49 #include "oops/instanceClassLoaderKlass.hpp"
  50 #include "oops/instanceMirrorKlass.hpp"
  51 #include "oops/instanceRefKlass.hpp"
  52 #include "oops/objArrayKlass.hpp"
  53 #include "oops/objArrayOop.hpp"
  54 #include "oops/oop.inline.hpp"
  55 #include "oops/typeArrayKlass.hpp"
  56 #include "prims/jvmtiRedefineClasses.hpp"
  57 #include "runtime/handles.inline.hpp"
  58 #include "runtime/os.hpp"
  59 #include "runtime/safepointVerifiers.hpp"
  60 #include "runtime/signature.hpp"
  61 #include "runtime/timerTrace.hpp"
  62 #include "runtime/vmThread.hpp"
  63 #include "runtime/vm_operations.hpp"
  64 #include "utilities/align.hpp"
  65 #include "utilities/bitMap.hpp"
  66 #include "utilities/defaultStream.hpp"
  67 #include "utilities/hashtable.hpp"
  68 #if INCLUDE_G1GC
  69 #include "gc/g1/g1CollectedHeap.hpp"
  70 #endif
  71 
  72 ReservedSpace MetaspaceShared::_shared_rs;
  73 VirtualSpace MetaspaceShared::_shared_vs;
  74 MetaspaceSharedStats MetaspaceShared::_stats;
  75 bool MetaspaceShared::_has_error_classes;
  76 bool MetaspaceShared::_archive_loading_failed = false;
  77 bool MetaspaceShared::_remapped_readwrite = false;
  78 address MetaspaceShared::_cds_i2i_entry_code_buffers = NULL;
  79 size_t MetaspaceShared::_cds_i2i_entry_code_buffers_size = 0;
  80 size_t MetaspaceShared::_core_spaces_size = 0;
  81 
  82 // The CDS archive is divided into the following regions:
  83 //     mc  - misc code (the method entry trampolines)
  84 //     rw  - read-write metadata
  85 //     ro  - read-only metadata and read-only tables
  86 //     md  - misc data (the c++ vtables)
  87 //     od  - optional data (original class files)


1054 public:
1055   SortedSymbolClosure() {
1056     SymbolTable::symbols_do(this);
1057     _symbols.sort(compare_symbols_by_address);
1058   }
1059   GrowableArray<Symbol*>* get_sorted_symbols() {
1060     return &_symbols;
1061   }
1062 };
1063 
1064 // ArchiveCompactor --
1065 //
1066 // This class is the central piece of shared archive compaction -- all metaspace data are
1067 // initially allocated outside of the shared regions. ArchiveCompactor copies the
1068 // metaspace data into their final location in the shared regions.
1069 
1070 class ArchiveCompactor : AllStatic {
1071   static DumpAllocStats* _alloc_stats;
1072   static SortedSymbolClosure* _ssc;
1073 
1074   typedef KVHashtable<
1075       address, address> RelocationTable;
1076   static RelocationTable* _new_loc_table;
1077 
1078 public:
1079   static void initialize() {
1080     _alloc_stats = new(ResourceObj::C_HEAP, mtInternal)DumpAllocStats;
1081     _new_loc_table = new RelocationTable(8087);
1082   }
1083   static DumpAllocStats* alloc_stats() {
1084     return _alloc_stats;
1085   }
1086 
1087   // Use this when you allocate space with MetaspaceShare::read_only_space_alloc()
1088   // outside of ArchiveCompactor::allocate(). These are usually for misc tables
1089   // that are allocated in the RO space.
1090   class OtherROAllocMark {
1091     char* _oldtop;
1092   public:
1093     OtherROAllocMark() {
1094       _oldtop = _ro_region.top();
1095     }




  47 #include "memory/resourceArea.hpp"
  48 #include "oops/compressedOops.inline.hpp"
  49 #include "oops/instanceClassLoaderKlass.hpp"
  50 #include "oops/instanceMirrorKlass.hpp"
  51 #include "oops/instanceRefKlass.hpp"
  52 #include "oops/objArrayKlass.hpp"
  53 #include "oops/objArrayOop.hpp"
  54 #include "oops/oop.inline.hpp"
  55 #include "oops/typeArrayKlass.hpp"
  56 #include "prims/jvmtiRedefineClasses.hpp"
  57 #include "runtime/handles.inline.hpp"
  58 #include "runtime/os.hpp"
  59 #include "runtime/safepointVerifiers.hpp"
  60 #include "runtime/signature.hpp"
  61 #include "runtime/timerTrace.hpp"
  62 #include "runtime/vmThread.hpp"
  63 #include "runtime/vm_operations.hpp"
  64 #include "utilities/align.hpp"
  65 #include "utilities/bitMap.hpp"
  66 #include "utilities/defaultStream.hpp"
  67 #include "utilities/hashtable.inline.hpp"
  68 #if INCLUDE_G1GC
  69 #include "gc/g1/g1CollectedHeap.hpp"
  70 #endif
  71 
  72 ReservedSpace MetaspaceShared::_shared_rs;
  73 VirtualSpace MetaspaceShared::_shared_vs;
  74 MetaspaceSharedStats MetaspaceShared::_stats;
  75 bool MetaspaceShared::_has_error_classes;
  76 bool MetaspaceShared::_archive_loading_failed = false;
  77 bool MetaspaceShared::_remapped_readwrite = false;
  78 address MetaspaceShared::_cds_i2i_entry_code_buffers = NULL;
  79 size_t MetaspaceShared::_cds_i2i_entry_code_buffers_size = 0;
  80 size_t MetaspaceShared::_core_spaces_size = 0;
  81 
  82 // The CDS archive is divided into the following regions:
  83 //     mc  - misc code (the method entry trampolines)
  84 //     rw  - read-write metadata
  85 //     ro  - read-only metadata and read-only tables
  86 //     md  - misc data (the c++ vtables)
  87 //     od  - optional data (original class files)


1054 public:
1055   SortedSymbolClosure() {
1056     SymbolTable::symbols_do(this);
1057     _symbols.sort(compare_symbols_by_address);
1058   }
1059   GrowableArray<Symbol*>* get_sorted_symbols() {
1060     return &_symbols;
1061   }
1062 };
1063 
1064 // ArchiveCompactor --
1065 //
1066 // This class is the central piece of shared archive compaction -- all metaspace data are
1067 // initially allocated outside of the shared regions. ArchiveCompactor copies the
1068 // metaspace data into their final location in the shared regions.
1069 
1070 class ArchiveCompactor : AllStatic {
1071   static DumpAllocStats* _alloc_stats;
1072   static SortedSymbolClosure* _ssc;
1073 
1074   typedef KVHashtable<address, address, mtInternal> RelocationTable;

1075   static RelocationTable* _new_loc_table;
1076 
1077 public:
1078   static void initialize() {
1079     _alloc_stats = new(ResourceObj::C_HEAP, mtInternal)DumpAllocStats;
1080     _new_loc_table = new RelocationTable(8087);
1081   }
1082   static DumpAllocStats* alloc_stats() {
1083     return _alloc_stats;
1084   }
1085 
1086   // Use this when you allocate space with MetaspaceShare::read_only_space_alloc()
1087   // outside of ArchiveCompactor::allocate(). These are usually for misc tables
1088   // that are allocated in the RO space.
1089   class OtherROAllocMark {
1090     char* _oldtop;
1091   public:
1092     OtherROAllocMark() {
1093       _oldtop = _ro_region.top();
1094     }


< prev index next >