src/share/vm/memory/metaspaceShared.cpp

Print this page

        

*** 46,55 **** --- 46,57 ---- int MetaspaceShared::_max_alignment = 0; ReservedSpace* MetaspaceShared::_shared_rs = NULL; + MetaspaceSharedStats MetaspaceShared::_stats; + bool MetaspaceShared::_link_classes_made_progress; bool MetaspaceShared::_check_classes_made_progress; bool MetaspaceShared::_has_error_classes; bool MetaspaceShared::_archive_loading_failed = false; // Read/write a data stream for restoring/preserving metadata pointers and
*** 257,267 **** // Here's poor man's enum inheritance #define SHAREDSPACE_OBJ_TYPES_DO(f) \ METASPACE_OBJ_TYPES_DO(f) \ f(SymbolHashentry) \ ! f(SymbolBuckets) \ f(Other) #define SHAREDSPACE_OBJ_TYPE_DECLARE(name) name ## Type, #define SHAREDSPACE_OBJ_TYPE_NAME_CASE(name) case name ## Type: return #name; --- 259,269 ---- // Here's poor man's enum inheritance #define SHAREDSPACE_OBJ_TYPES_DO(f) \ METASPACE_OBJ_TYPES_DO(f) \ f(SymbolHashentry) \ ! f(SymbolBucket) \ f(Other) #define SHAREDSPACE_OBJ_TYPE_DECLARE(name) name ## Type, #define SHAREDSPACE_OBJ_TYPE_NAME_CASE(name) case name ## Type: return #name;
*** 313,334 **** void DumpAllocClosure::dump_stats(int ro_all, int rw_all, int md_all, int mc_all) { rw_all += (md_all + mc_all); // md and mc are all mapped Read/Write int other_bytes = md_all + mc_all; // Calculate size of data that was not allocated by Metaspace::allocate() ! int symbol_count = _counts[RO][MetaspaceObj::SymbolType]; ! int symhash_bytes = symbol_count * sizeof (HashtableEntry<Symbol*, mtSymbol>); ! int symbuck_count = SymbolTable::the_table()->table_size(); ! int symbuck_bytes = symbuck_count * sizeof(HashtableBucket<mtSymbol>); ! ! _counts[RW][SymbolHashentryType] = symbol_count; ! _bytes [RW][SymbolHashentryType] = symhash_bytes; ! other_bytes -= symhash_bytes; ! ! _counts[RW][SymbolBucketsType] = symbuck_count; ! _bytes [RW][SymbolBucketsType] = symbuck_bytes; ! other_bytes -= symbuck_bytes; // TODO: count things like dictionary, vtable, etc _bytes[RW][OtherType] = other_bytes; // prevent divide-by-zero --- 315,334 ---- void DumpAllocClosure::dump_stats(int ro_all, int rw_all, int md_all, int mc_all) { rw_all += (md_all + mc_all); // md and mc are all mapped Read/Write int other_bytes = md_all + mc_all; // Calculate size of data that was not allocated by Metaspace::allocate() ! MetaspaceSharedStats *stats = MetaspaceShared::stats(); ! ! // symbols ! _counts[RW][SymbolHashentryType] = stats->symbol.hashentry_count; ! _bytes [RW][SymbolHashentryType] = stats->symbol.hashentry_bytes; ! other_bytes -= stats->symbol.hashentry_bytes; ! ! _counts[RW][SymbolBucketType] = stats->symbol.bucket_count; ! _bytes [RW][SymbolBucketType] = stats->symbol.bucket_bytes; ! other_bytes -= stats->symbol.bucket_bytes; // TODO: count things like dictionary, vtable, etc _bytes[RW][OtherType] = other_bytes; // prevent divide-by-zero
*** 422,431 **** --- 422,442 ---- _class_promote_order = class_promote_order; } VMOp_Type type() const { return VMOp_PopulateDumpSharedSpace; } void doit(); // outline because gdb sucks + + private: + void handle_failure(bool success, const char* what) { + if (!success) { + tty->print_cr("Insufficient shared space: please increase -XX:%s= to increase its size", what); + exit(1); + } + } + void handle_misc_data_space_failure(bool success) { + handle_failure(success, "SharedMiscDataSize"); + } }; // class VM_PopulateDumpSharedSpace void VM_PopulateDumpSharedSpace::doit() { Thread* THREAD = VMThread::vm_thread();
*** 515,536 **** // Copy the the symbol table, and the system dictionary to the shared // space in usable form. Copy the hashtable // buckets first [read-write], then copy the linked lists of entries // [read-only]. - SymbolTable::reverse(md_top); NOT_PRODUCT(SymbolTable::verify()); ! SymbolTable::copy_buckets(&md_top, md_end); SystemDictionary::reverse(); SystemDictionary::copy_buckets(&md_top, md_end); ClassLoader::verify(); ClassLoader::copy_package_info_buckets(&md_top, md_end); ClassLoader::verify(); - SymbolTable::copy_table(&md_top, md_end); SystemDictionary::copy_table(&md_top, md_end); ClassLoader::verify(); ClassLoader::copy_package_info_table(&md_top, md_end); ClassLoader::verify(); --- 526,545 ---- // Copy the the symbol table, and the system dictionary to the shared // space in usable form. Copy the hashtable // buckets first [read-write], then copy the linked lists of entries // [read-only]. NOT_PRODUCT(SymbolTable::verify()); ! handle_misc_data_space_failure(SymbolTable::copy_compact_table(&md_top, md_end)); SystemDictionary::reverse(); SystemDictionary::copy_buckets(&md_top, md_end); ClassLoader::verify(); ClassLoader::copy_package_info_buckets(&md_top, md_end); ClassLoader::verify(); SystemDictionary::copy_table(&md_top, md_end); ClassLoader::verify(); ClassLoader::copy_package_info_table(&md_top, md_end); ClassLoader::verify();
*** 998,1027 **** intptr_t vtable_size = *(intptr_t*)buffer; buffer += sizeof(intptr_t); buffer += vtable_size; ! // Create the symbol table using the bucket array at this spot in the ! // misc data space. Since the symbol table is often modified, this ! // region (of mapped pages) will be copy-on-write. ! int symbolTableLen = *(intptr_t*)buffer; ! buffer += sizeof(intptr_t); ! int number_of_entries = *(intptr_t*)buffer; ! buffer += sizeof(intptr_t); ! SymbolTable::create_table((HashtableBucket<mtSymbol>*)buffer, symbolTableLen, ! number_of_entries); ! buffer += symbolTableLen; // Create the shared dictionary using the bucket array at this spot in // the misc data space. Since the shared dictionary table is never // modified, this region (of mapped pages) will be (effectively, if // not explicitly) read-only. int sharedDictionaryLen = *(intptr_t*)buffer; buffer += sizeof(intptr_t); ! number_of_entries = *(intptr_t*)buffer; buffer += sizeof(intptr_t); SystemDictionary::set_shared_dictionary((HashtableBucket<mtClass>*)buffer, sharedDictionaryLen, number_of_entries); buffer += sharedDictionaryLen; --- 1007,1031 ---- intptr_t vtable_size = *(intptr_t*)buffer; buffer += sizeof(intptr_t); buffer += vtable_size; ! // Create the shared symbol table using the bucket array at this spot in the ! // misc data space. (Todo: move this to read-only space. Currently ! // this is mapped copy-on-write but will never be written into). ! buffer = (char*)SymbolTable::init_shared_table(buffer); ! SymbolTable::create_table(); // Create the shared dictionary using the bucket array at this spot in // the misc data space. Since the shared dictionary table is never // modified, this region (of mapped pages) will be (effectively, if // not explicitly) read-only. int sharedDictionaryLen = *(intptr_t*)buffer; buffer += sizeof(intptr_t); ! int number_of_entries = *(intptr_t*)buffer; buffer += sizeof(intptr_t); SystemDictionary::set_shared_dictionary((HashtableBucket<mtClass>*)buffer, sharedDictionaryLen, number_of_entries); buffer += sharedDictionaryLen;
*** 1039,1060 **** number_of_entries); buffer += pkgInfoLen; ClassLoader::verify(); // The following data in the shared misc data region are the linked ! // list elements (HashtableEntry objects) for the symbol table, string ! // table, and shared dictionary. The heap objects referred to by the ! // symbol table, string table, and shared dictionary are permanent and ! // unmovable. Since new entries added to the string and symbol tables ! // are always added at the beginning of the linked lists, THESE LINKED ! // LIST ELEMENTS ARE READ-ONLY. ! ! int len = *(intptr_t*)buffer; // skip over symbol table entries ! buffer += sizeof(intptr_t); ! buffer += len; ! len = *(intptr_t*)buffer; // skip over shared dictionary entries buffer += sizeof(intptr_t); buffer += len; len = *(intptr_t*)buffer; // skip over package info table entries buffer += sizeof(intptr_t); --- 1043,1056 ---- number_of_entries); buffer += pkgInfoLen; ClassLoader::verify(); // The following data in the shared misc data region are the linked ! // list elements (HashtableEntry objects) for the shared dictionary ! // and package info table. ! int len = *(intptr_t*)buffer; // skip over shared dictionary entries buffer += sizeof(intptr_t); buffer += len; len = *(intptr_t*)buffer; // skip over package info table entries buffer += sizeof(intptr_t);