48 |
48 |
49 #define DEFAULT_SHARED_READ_ONLY_SIZE (NOT_LP64(12*M) LP64_ONLY(16*M)) |
49 #define DEFAULT_SHARED_READ_ONLY_SIZE (NOT_LP64(12*M) LP64_ONLY(16*M)) |
50 #define MIN_SHARED_READ_ONLY_SIZE (NOT_LP64(8*M) LP64_ONLY(9*M)) |
50 #define MIN_SHARED_READ_ONLY_SIZE (NOT_LP64(8*M) LP64_ONLY(9*M)) |
51 |
51 |
52 // the MIN_SHARED_MISC_DATA_SIZE and MIN_SHARED_MISC_CODE_SIZE estimates are based on |
52 // the MIN_SHARED_MISC_DATA_SIZE and MIN_SHARED_MISC_CODE_SIZE estimates are based on |
53 // MetaspaceShared::generate_vtable_methods(). |
53 // the sizes required for dumping the archive using the default classlist. The sizes |
54 // The minimum size only accounts for the vtable methods. Any size less than the |
54 // are multiplied by 1.5 for a safety margin. |
55 // minimum required size would cause vm crash when allocating the vtable methods. |
|
56 #define SHARED_MISC_SIZE_FOR(size) (DEFAULT_VTBL_VIRTUALS_COUNT*DEFAULT_VTBL_LIST_SIZE*size) |
|
57 |
55 |
58 #define DEFAULT_SHARED_MISC_DATA_SIZE (NOT_LP64(2*M) LP64_ONLY(4*M)) |
56 #define DEFAULT_SHARED_MISC_DATA_SIZE (NOT_LP64(2*M) LP64_ONLY(4*M)) |
59 #define MIN_SHARED_MISC_DATA_SIZE (SHARED_MISC_SIZE_FOR(sizeof(void*))) |
57 #define MIN_SHARED_MISC_DATA_SIZE (NOT_LP64(1*M) LP64_ONLY(1200*K)) |
60 |
58 |
61 #define DEFAULT_SHARED_MISC_CODE_SIZE (120*K) |
59 #define DEFAULT_SHARED_MISC_CODE_SIZE (120*K) |
62 #define MIN_SHARED_MISC_CODE_SIZE (SHARED_MISC_SIZE_FOR(sizeof(void*))+SHARED_MISC_SIZE_FOR(DEFAULT_VTBL_METHOD_SIZE)+DEFAULT_VTBL_COMMON_CODE_SIZE) |
60 #define MIN_SHARED_MISC_CODE_SIZE (NOT_LP64(63*K) LP64_ONLY(69*K)) |
63 |
|
64 #define DEFAULT_COMBINED_SIZE (DEFAULT_SHARED_READ_WRITE_SIZE+DEFAULT_SHARED_READ_ONLY_SIZE+DEFAULT_SHARED_MISC_DATA_SIZE+DEFAULT_SHARED_MISC_CODE_SIZE) |
61 #define DEFAULT_COMBINED_SIZE (DEFAULT_SHARED_READ_WRITE_SIZE+DEFAULT_SHARED_READ_ONLY_SIZE+DEFAULT_SHARED_MISC_DATA_SIZE+DEFAULT_SHARED_MISC_CODE_SIZE) |
65 |
62 |
66 // the max size is the MAX size (ie. 0x7FFFFFFF) - the total size of |
63 // the max size is the MAX size (ie. 0x7FFFFFFF) - the total size of |
67 // the other 3 sections - page size (to avoid overflow in case the final |
64 // the other 3 sections - page size (to avoid overflow in case the final |
68 // size will get aligned up on page size) |
65 // size will get aligned up on page size) |
126 static MetaspaceSharedStats _stats; |
123 static MetaspaceSharedStats _stats; |
127 static bool _link_classes_made_progress; |
124 static bool _link_classes_made_progress; |
128 static bool _check_classes_made_progress; |
125 static bool _check_classes_made_progress; |
129 static bool _has_error_classes; |
126 static bool _has_error_classes; |
130 static bool _archive_loading_failed; |
127 static bool _archive_loading_failed; |
|
128 static address _cds_i2i_entry_code_buffers; |
|
129 static size_t _cds_i2i_entry_code_buffers_size; |
131 |
130 |
132 // Used only during dumping. |
131 // Used only during dumping. |
133 static SharedMiscRegion _md; |
132 static SharedMiscRegion _md; |
134 static SharedMiscRegion _mc; |
133 static SharedMiscRegion _mc; |
135 public: |
134 public: |
183 static void fixup_shared_string_regions() NOT_CDS_RETURN; |
182 static void fixup_shared_string_regions() NOT_CDS_RETURN; |
184 |
183 |
185 // Return true if given address is in the mapped shared space. |
184 // Return true if given address is in the mapped shared space. |
186 static bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); |
185 static bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); |
187 |
186 |
|
187 // Return true if given address is in the shared region corresponding to the idx |
|
188 static bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false); |
|
189 |
188 static bool is_string_region(int idx) NOT_CDS_RETURN_(false); |
190 static bool is_string_region(int idx) NOT_CDS_RETURN_(false); |
189 |
191 |
190 static void generate_vtable_methods(void** vtbl_list, |
192 static void generate_vtable_methods(void** vtbl_list, |
191 void** vtable, |
193 void** vtable, |
192 char** md_top, char* md_end, |
194 char** md_top, char* md_end, |
216 |
218 |
217 // Allocate a block of memory from the "mc" or "md" regions. |
219 // Allocate a block of memory from the "mc" or "md" regions. |
218 static char* misc_code_space_alloc(size_t num_bytes) { return _mc.alloc(num_bytes); } |
220 static char* misc_code_space_alloc(size_t num_bytes) { return _mc.alloc(num_bytes); } |
219 static char* misc_data_space_alloc(size_t num_bytes) { return _md.alloc(num_bytes); } |
221 static char* misc_data_space_alloc(size_t num_bytes) { return _md.alloc(num_bytes); } |
220 |
222 |
|
223 static address cds_i2i_entry_code_buffers(size_t total_size); |
|
224 |
|
225 static address cds_i2i_entry_code_buffers() { |
|
226 return _cds_i2i_entry_code_buffers; |
|
227 } |
|
228 static size_t cds_i2i_entry_code_buffers_size() { |
|
229 return _cds_i2i_entry_code_buffers_size; |
|
230 } |
|
231 |
221 static SharedMiscRegion* misc_code_region() { |
232 static SharedMiscRegion* misc_code_region() { |
222 assert(DumpSharedSpaces, "used during dumping only"); |
233 assert(DumpSharedSpaces, "used during dumping only"); |
223 return &_mc; |
234 return &_mc; |
224 } |
235 } |
225 static SharedMiscRegion* misc_data_region() { |
236 static SharedMiscRegion* misc_data_region() { |