225 void set_cds_i2i_entry_code_buffers_size(size_t s) {
226 _header->_cds_i2i_entry_code_buffers_size = s;
227 }
228 void set_core_spaces_size(size_t s) { _header->_core_spaces_size = s; }
229 size_t core_spaces_size() { return _header->_core_spaces_size; }
230
231 static FileMapInfo* current_info() {
232 CDS_ONLY(return _current_info;)
233 NOT_CDS(return NULL;)
234 }
235
236 static void assert_mark(bool check);
237
238 // File manipulation.
239 bool initialize() NOT_CDS_RETURN_(false);
240 bool open_for_read();
241 void open_for_write();
242 void write_header();
243 void write_region(int region, char* base, size_t size,
244 bool read_only, bool allow_exec);
245 void write_archive_heap_regions(GrowableArray<MemRegion> *regions,
246 int first_region, int max_num_regions,
247 char** r0_start, char** r0_top,
248 char** r1_start, char** r1_top);
249 void write_bytes(const void* buffer, int count);
250 void write_bytes_aligned(const void* buffer, int count);
251 char* map_region(int i);
252 void map_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
253 void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
254 void unmap_region(int i);
255 bool verify_region_checksum(int i);
256 void close();
257 bool is_open() { return _file_open; }
258 ReservedSpace reserve_shared_memory();
259
260 // JVM/TI RedefineClasses() support:
261 // Remap the shared readonly space to shared readwrite, private.
262 bool remap_shared_readonly_as_readwrite();
263
264 // Errors.
265 static void fail_stop(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2);
266 static void fail_continue(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2);
267
268 // Return true if given address is in the mapped shared space.
278
279 static SharedClassPathEntry* shared_classpath(int index) {
280 if (index < 0) {
281 return NULL;
282 }
283 assert(index < _classpath_entry_table_size, "sanity");
284 char* p = (char*)_classpath_entry_table->data();
285 p += _classpath_entry_size * index;
286 return (SharedClassPathEntry*)p;
287 }
288 static const char* shared_classpath_name(int index) {
289 assert(index >= 0, "Sanity");
290 return shared_classpath(index)->name();
291 }
292
293 static int get_number_of_share_classpaths() {
294 return _classpath_entry_table_size;
295 }
296
297 private:
298 bool map_heap_data(MemRegion **regions, int first, int max, int* num,
299 bool is_open = false) NOT_CDS_JAVA_HEAP_RETURN_(false);
300 bool verify_mapped_heap_regions(int first, int num) NOT_CDS_JAVA_HEAP_RETURN_(false);
301 void dealloc_archive_heap_regions(MemRegion* regions, int num) NOT_CDS_JAVA_HEAP_RETURN;
302 };
303
304 #endif // SHARE_VM_MEMORY_FILEMAP_HPP
|
225 void set_cds_i2i_entry_code_buffers_size(size_t s) {
226 _header->_cds_i2i_entry_code_buffers_size = s;
227 }
228 void set_core_spaces_size(size_t s) { _header->_core_spaces_size = s; }
229 size_t core_spaces_size() { return _header->_core_spaces_size; }
230
231 static FileMapInfo* current_info() {
232 CDS_ONLY(return _current_info;)
233 NOT_CDS(return NULL;)
234 }
235
236 static void assert_mark(bool check);
237
238 // File manipulation.
239 bool initialize() NOT_CDS_RETURN_(false);
240 bool open_for_read();
241 void open_for_write();
242 void write_header();
243 void write_region(int region, char* base, size_t size,
244 bool read_only, bool allow_exec);
245 size_t write_archive_heap_regions(GrowableArray<MemRegion> *heap_mem,
246 int first_region_id, int max_num_regions);
247 void write_bytes(const void* buffer, int count);
248 void write_bytes_aligned(const void* buffer, int count);
249 char* map_region(int i);
250 void map_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
251 void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
252 void unmap_region(int i);
253 bool verify_region_checksum(int i);
254 void close();
255 bool is_open() { return _file_open; }
256 ReservedSpace reserve_shared_memory();
257
258 // JVM/TI RedefineClasses() support:
259 // Remap the shared readonly space to shared readwrite, private.
260 bool remap_shared_readonly_as_readwrite();
261
262 // Errors.
263 static void fail_stop(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2);
264 static void fail_continue(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2);
265
266 // Return true if given address is in the mapped shared space.
276
277 static SharedClassPathEntry* shared_classpath(int index) {
278 if (index < 0) {
279 return NULL;
280 }
281 assert(index < _classpath_entry_table_size, "sanity");
282 char* p = (char*)_classpath_entry_table->data();
283 p += _classpath_entry_size * index;
284 return (SharedClassPathEntry*)p;
285 }
286 static const char* shared_classpath_name(int index) {
287 assert(index >= 0, "Sanity");
288 return shared_classpath(index)->name();
289 }
290
291 static int get_number_of_share_classpaths() {
292 return _classpath_entry_table_size;
293 }
294
295 private:
296 bool map_heap_data(MemRegion **heap_mem, int first, int max, int* num,
297 bool is_open = false) NOT_CDS_JAVA_HEAP_RETURN_(false);
298 bool verify_mapped_heap_regions(int first, int num) NOT_CDS_JAVA_HEAP_RETURN_(false);
299 void dealloc_archive_heap_regions(MemRegion* regions, int num) NOT_CDS_JAVA_HEAP_RETURN;
300 };
301
302 #endif // SHARE_VM_MEMORY_FILEMAP_HPP
|