27 #include "classfile/classListParser.hpp" |
27 #include "classfile/classListParser.hpp" |
28 #include "classfile/classLoaderExt.hpp" |
28 #include "classfile/classLoaderExt.hpp" |
29 #include "classfile/dictionary.hpp" |
29 #include "classfile/dictionary.hpp" |
30 #include "classfile/loaderConstraints.hpp" |
30 #include "classfile/loaderConstraints.hpp" |
31 #include "classfile/placeholders.hpp" |
31 #include "classfile/placeholders.hpp" |
32 #include "classfile/sharedClassUtil.hpp" |
|
33 #include "classfile/symbolTable.hpp" |
32 #include "classfile/symbolTable.hpp" |
34 #include "classfile/stringTable.hpp" |
33 #include "classfile/stringTable.hpp" |
35 #include "classfile/systemDictionary.hpp" |
34 #include "classfile/systemDictionary.hpp" |
36 #include "classfile/systemDictionaryShared.hpp" |
35 #include "classfile/systemDictionaryShared.hpp" |
37 #include "code/codeCache.hpp" |
36 #include "code/codeCache.hpp" |
321 _mc_region.init(&_shared_rs); |
320 _mc_region.init(&_shared_rs); |
322 tty->print_cr("Allocated shared space: " SIZE_FORMAT " bytes at " PTR_FORMAT, |
321 tty->print_cr("Allocated shared space: " SIZE_FORMAT " bytes at " PTR_FORMAT, |
323 _shared_rs.size(), p2i(_shared_rs.base())); |
322 _shared_rs.size(), p2i(_shared_rs.base())); |
324 } |
323 } |
325 |
324 |
|
325 // Called by universe_post_init() |
|
326 void MetaspaceShared::post_initialize(TRAPS) { |
|
327 if (UseSharedSpaces) { |
|
328 int size = FileMapInfo::get_number_of_shared_paths(); |
|
329 if (size > 0) { |
|
330 SystemDictionaryShared::allocate_shared_data_arrays(size, THREAD); |
|
331 FileMapInfo::FileMapHeader* header = FileMapInfo::current_info()->header(); |
|
332 ClassLoaderExt::init_paths_start_index(header->_app_class_paths_start_index); |
|
333 ClassLoaderExt::init_app_module_paths_start_index(header->_app_module_paths_start_index); |
|
334 } |
|
335 } |
|
336 |
|
337 if (DumpSharedSpaces) { |
|
338 if (SharedArchiveConfigFile) { |
|
339 read_extra_data(SharedArchiveConfigFile, THREAD); |
|
340 } |
|
341 } |
|
342 } |
|
343 |
|
344 void MetaspaceShared::read_extra_data(const char* filename, TRAPS) { |
|
345 HashtableTextDump reader(filename); |
|
346 reader.check_version("VERSION: 1.0"); |
|
347 |
|
348 while (reader.remain() > 0) { |
|
349 int utf8_length; |
|
350 int prefix_type = reader.scan_prefix(&utf8_length); |
|
351 ResourceMark rm(THREAD); |
|
352 char* utf8_buffer = NEW_RESOURCE_ARRAY(char, utf8_length); |
|
353 reader.get_utf8(utf8_buffer, utf8_length); |
|
354 |
|
355 if (prefix_type == HashtableTextDump::SymbolPrefix) { |
|
356 SymbolTable::new_symbol(utf8_buffer, utf8_length, THREAD); |
|
357 } else{ |
|
358 assert(prefix_type == HashtableTextDump::StringPrefix, "Sanity"); |
|
359 utf8_buffer[utf8_length] = '\0'; |
|
360 oop s = StringTable::intern(utf8_buffer, THREAD); |
|
361 } |
|
362 } |
|
363 } |
|
364 |
326 void MetaspaceShared::commit_shared_space_to(char* newtop) { |
365 void MetaspaceShared::commit_shared_space_to(char* newtop) { |
327 assert(DumpSharedSpaces, "dump-time only"); |
366 assert(DumpSharedSpaces, "dump-time only"); |
328 char* base = _shared_rs.base(); |
367 char* base = _shared_rs.base(); |
329 size_t need_committed_size = newtop - base; |
368 size_t need_committed_size = newtop - base; |
330 size_t has_committed_size = _shared_vs.committed_size(); |
369 size_t has_committed_size = _shared_vs.committed_size(); |