--- old/src/hotspot/share/classfile/compactHashtable.hpp 2018-08-03 16:41:55.000000000 -0500 +++ new/src/hotspot/share/classfile/compactHashtable.hpp 2018-08-03 16:41:55.000000000 -0500 @@ -233,7 +233,7 @@ void serialize(SerializeClosure* soc); inline bool empty() { - return (_entry_count==0); + return (_entry_count == 0); } }; --- old/src/hotspot/share/classfile/stringTable.cpp 2018-08-03 16:41:56.000000000 -0500 +++ new/src/hotspot/share/classfile/stringTable.cpp 2018-08-03 16:41:55.000000000 -0500 @@ -64,9 +64,9 @@ // -------------------------------------------------------------------------- StringTable* StringTable::_the_table = NULL; -bool StringTable::_shared_string_mapped = false; CompactHashtable StringTable::_shared_table; -bool StringTable::_alt_hash = false; +volatile bool StringTable::_shared_string_mapped = false; +volatile bool StringTable::_alt_hash = false; static juint murmur_seed = 0; @@ -176,18 +176,18 @@ } }; -static size_t ceil_pow_2(uintx val) { +static size_t log2_ceil(uintx val) { size_t ret; for (ret = 1; ((size_t)1 << ret) < val; ++ret); return ret; } StringTable::StringTable() : _local_table(NULL), _current_size(0), _has_work(0), - _needs_rehashing(false), _weak_handles(NULL), _items(0), _uncleaned_items(0) { + _needs_rehashing(false), _weak_handles(NULL), _items_count(0), _uncleaned_items_count(0) { _weak_handles = new OopStorage("StringTable weak", StringTableWeakAlloc_lock, StringTableWeakActive_lock); - size_t start_size_log_2 = ceil_pow_2(StringTableSize); + size_t start_size_log_2 = log2_ceil(StringTableSize); _current_size = ((size_t)1) << start_size_log_2; log_trace(stringtable)("Start size: " SIZE_FORMAT " (" SIZE_FORMAT ")", _current_size, start_size_log_2); @@ -195,27 +195,27 @@ } size_t StringTable::item_added() { - return Atomic::add((size_t)1, &(the_table()->_items)); + return Atomic::add((size_t)1, &(the_table()->_items_count)); } -size_t StringTable::add_items_to_clean(size_t ndead) { - size_t total = Atomic::add((size_t)ndead, &(the_table()->_uncleaned_items)); +size_t StringTable::add_items_count_to_clean(size_t ndead) { + size_t total = Atomic::add((size_t)ndead, &(the_table()->_uncleaned_items_count)); log_trace(stringtable)( "Uncleaned items:" SIZE_FORMAT " added: " SIZE_FORMAT " total:" SIZE_FORMAT, - the_table()->_uncleaned_items, ndead, total); + the_table()->_uncleaned_items_count, ndead, total); return total; } void StringTable::item_removed() { - Atomic::add((size_t)-1, &(the_table()->_items)); + Atomic::add((size_t)-1, &(the_table()->_items_count)); } double StringTable::get_load_factor() { - return (_items*1.0)/_current_size; + return (double)_items_count/_current_size; } double StringTable::get_dead_factor() { - return (_uncleaned_items*1.0)/_current_size; + return (double)_uncleaned_items_count/_current_size; } size_t StringTable::table_size(Thread* thread) { @@ -406,7 +406,7 @@ // This is the serial case without ParState. // Just set the correct number and check for a cleaning phase. - the_table()->_uncleaned_items = stiac._count; + the_table()->_uncleaned_items_count = stiac._count; StringTable::the_table()->check_concurrent_work(); if (processed != NULL) { @@ -433,7 +433,7 @@ _par_state_string->weak_oops_do(&stiac, &dnc); // Accumulate the dead strings. - the_table()->add_items_to_clean(stiac._count); + the_table()->add_items_count_to_clean(stiac._count); *processed = (int) stiac._count_total; *removed = (int) stiac._count; @@ -843,7 +843,7 @@ assert(MetaspaceShared::is_heap_object_archiving_allowed(), "must be"); _shared_table.reset(); - int num_buckets = the_table()->_items / SharedSymbolTableBucketSize; + int num_buckets = the_table()->_items_count / SharedSymbolTableBucketSize; // calculation of num_buckets can result in zero buckets, we need at least one CompactStringTableWriter writer(num_buckets > 1 ? num_buckets : 1, &MetaspaceShared::stats()->string); --- old/src/hotspot/share/classfile/stringTable.hpp 2018-08-03 16:41:56.000000000 -0500 +++ new/src/hotspot/share/classfile/stringTable.hpp 2018-08-03 16:41:56.000000000 -0500 @@ -58,21 +58,22 @@ static StringTable* _the_table; // Shared string table static CompactHashtable _shared_table; - static bool _shared_string_mapped; - static bool _alt_hash; + static volatile bool _shared_string_mapped; + static volatile bool _alt_hash; + private: - // Set if one bucket is out of balance due to hash algorithm deficiency StringTableHash* _local_table; size_t _current_size; volatile bool _has_work; + // Set if one bucket is out of balance due to hash algorithm deficiency volatile bool _needs_rehashing; OopStorage* _weak_handles; - volatile size_t _items; + volatile size_t _items_count; DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t)); - volatile size_t _uncleaned_items; + volatile size_t _uncleaned_items_count; DEFINE_PAD_MINUS_SIZE(2, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t)); double get_load_factor(); @@ -83,7 +84,7 @@ static size_t item_added(); static void item_removed(); - size_t add_items_to_clean(size_t ndead); + size_t add_items_count_to_clean(size_t ndead); StringTable(); @@ -116,7 +117,7 @@ // Must be called before a parallel walk where strings might die. static void reset_dead_counter() { - the_table()->_uncleaned_items = 0; + the_table()->_uncleaned_items_count = 0; } // After the parallel walk this method must be called to trigger // cleaning. Note it might trigger a resize instead. @@ -127,7 +128,7 @@ // If GC uses ParState directly it should add the number of cleared // strings to this method. static void inc_dead_counter(size_t ndead) { - the_table()->add_items_to_clean(ndead); + the_table()->add_items_count_to_clean(ndead); } // Delete pointers to otherwise-unreachable objects. --- old/src/hotspot/share/classfile/symbolTable.cpp 2018-08-03 16:41:57.000000000 -0500 +++ new/src/hotspot/share/classfile/symbolTable.cpp 2018-08-03 16:41:56.000000000 -0500 @@ -58,29 +58,20 @@ // -------------------------------------------------------------------------- SymbolTable* SymbolTable::_the_table = NULL; CompactHashtable SymbolTable::_shared_table; -bool SymbolTable::_alt_hash = false; +volatile bool SymbolTable::_alt_hash = false; +volatile bool SymbolTable::_lookup_shared_first = false; // Static arena for symbols that are not deallocated Arena* SymbolTable::_arena = NULL; -bool SymbolTable::_lookup_shared_first = false; -int SymbolTable::_symbols_removed = 0; -int SymbolTable::_symbols_counted = 0; static juint murmur_seed = 0; static inline void _log_trace_symboltable_helper(Symbol* sym, const char* msg) { #ifndef PRODUCT if (log_is_enabled(Trace, symboltable)) { - char *s; - { - ResourceMark rm; - s = sym->as_quoted_ascii(); - s = os::strdup(s); - } - if (s == NULL) { + if (sym->as_quoted_ascii() == NULL) { log_trace(symboltable)("%s [%s]", msg, "NULL"); } else { - log_trace(symboltable)("%s [%s]", msg, s); - os::free(s); + log_trace(symboltable)("%s [%s]", msg, sym->as_quoted_ascii()); } } #endif // PRODUCT @@ -105,7 +96,7 @@ if (*is_dead) { return 0; } else { - return hash_symbol((char*)value->bytes(), value->utf8_length(), SymbolTable::_alt_hash); + return hash_symbol((const char*)value->bytes(), value->utf8_length(), SymbolTable::_alt_hash); } } // We use default allocation/deallocation but counted @@ -128,16 +119,17 @@ } }; -static size_t ceil_pow_2(uintx value) { +static size_t log2_ceil(uintx value) { size_t ret; for (ret = 1; ((size_t)1 << ret) < value; ++ret); return ret; } SymbolTable::SymbolTable() : _local_table(NULL), _current_size(0), _has_work(0), - _needs_rehashing(false), _items(0), _uncleaned_items(0) { + _needs_rehashing(false), _items_count(0), _uncleaned_items_count(0), + _symbols_removed(0), _symbols_counted(0) { - size_t start_size_log_2 = ceil_pow_2(SymbolTableSize); + size_t start_size_log_2 = log2_ceil(SymbolTableSize); _current_size = ((size_t)1) << start_size_log_2; log_trace(symboltable)("Start size: " SIZE_FORMAT " (" SIZE_FORMAT ")", _current_size, start_size_log_2); @@ -158,32 +150,32 @@ } } -size_t SymbolTable::item_added() { - return Atomic::add(1, &(SymbolTable::the_table()->_items)); +void SymbolTable::item_added() { + Atomic::inc(&(SymbolTable::the_table()->_items_count)); } void SymbolTable::set_item_clean_count(size_t ncl) { - Atomic::store((int)ncl, &(SymbolTable::the_table()->_uncleaned_items)); - log_trace(symboltable)("Set uncleaned items:" INT32_FORMAT, SymbolTable::the_table()->_uncleaned_items); + Atomic::store(ncl, &(SymbolTable::the_table()->_uncleaned_items_count)); + log_trace(symboltable)("Set uncleaned items:" SIZE_FORMAT, SymbolTable::the_table()->_uncleaned_items_count); } void SymbolTable::mark_item_clean_count() { - if (Atomic::cmpxchg(1, &(SymbolTable::the_table()->_uncleaned_items), 0) == 0) { // only mark if unset - log_trace(symboltable)("Marked uncleaned items:" INT32_FORMAT, SymbolTable::the_table()->_uncleaned_items); + if (Atomic::cmpxchg((size_t)1, &(SymbolTable::the_table()->_uncleaned_items_count), (size_t)0) == 0) { // only mark if unset + log_trace(symboltable)("Marked uncleaned items:" SIZE_FORMAT, SymbolTable::the_table()->_uncleaned_items_count); } } void SymbolTable::item_removed() { - Atomic::add(1, &(SymbolTable::the_table()->_symbols_removed)); - Atomic::sub(1, &(SymbolTable::the_table()->_items)); + Atomic::inc(&(SymbolTable::the_table()->_symbols_removed)); + Atomic::dec(&(SymbolTable::the_table()->_items_count)); } double SymbolTable::get_load_factor() { - return (_items*1.0)/_current_size; + return (double)_items_count/_current_size; } double SymbolTable::get_dead_factor() { - return (_uncleaned_items*1.0)/_current_size; + return (double)_uncleaned_items_count/_current_size; } size_t SymbolTable::table_size(Thread* thread) { @@ -197,7 +189,7 @@ Service_lock->notify_all(); } -Symbol* SymbolTable::allocate_symbol(const u1* name, int len, bool c_heap, TRAPS) { +Symbol* SymbolTable::allocate_symbol(const char* name, int len, bool c_heap, TRAPS) { assert (len <= Symbol::max_length(), "should be checked by caller"); Symbol* sym; @@ -206,12 +198,12 @@ } if (c_heap) { // refcount starts as 1 - sym = new (len, THREAD) Symbol(name, len, 1); + sym = new (len, THREAD) Symbol((const u1*)name, len, 1); assert(sym != NULL, "new should call vm_exit_out_of_memory if C_HEAP is exhausted"); } else { // Allocate to global arena MutexLocker ml(SymbolTable_lock); // Protect arena - sym = new (len, arena(), THREAD) Symbol(name, len, PERM_REFCOUNT); + sym = new (len, arena(), THREAD) Symbol((const u1*)name, len, PERM_REFCOUNT); } return sym; } @@ -269,7 +261,7 @@ Symbol* SymbolTable::lookup_dynamic(const char* name, int len, unsigned int hash) { - Symbol* sym = SymbolTable::the_table()->do_lookup((char*)name, len, hash); + Symbol* sym = SymbolTable::the_table()->do_lookup(name, len, hash); assert((sym == NULL) || sym->refcount() != 0, "refcount must not be zero"); return sym; } @@ -313,37 +305,34 @@ unsigned int hash = hash_symbol(name, len, SymbolTable::_alt_hash); Symbol* sym = SymbolTable::the_table()->lookup_common(name, len, hash); if (sym == NULL) { - sym = SymbolTable::the_table()->do_add_if_needed((char*)name, len, hash, true, CHECK_NULL); + sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, true, CHECK_NULL); } assert(sym->refcount() != 0, "lookup should have incremented the count"); - assert(sym->equals((char*)name, len), "symbol must be properly initialized"); + assert(sym->equals(name, len), "symbol must be properly initialized"); return sym; } Symbol* SymbolTable::lookup(const Symbol* sym, int begin, int end, TRAPS) { - Symbol* found = NULL; - { - debug_only(NoSafepointVerifier nsv;) - - char* name = (char*)sym->base() + begin; - int len = end - begin; - unsigned int hash = hash_symbol(name, len, SymbolTable::_alt_hash); + assert(sym->refcount() != 0, "require a valid symbol"); + const char* name = (const char*)sym->base() + begin; + int len = end - begin; + unsigned int hash = hash_symbol(name, len, SymbolTable::_alt_hash); + Symbol* found = SymbolTable::the_table()->lookup_common(name, len, hash); + if (found == NULL) { found = SymbolTable::the_table()->do_add_if_needed(name, len, hash, true, THREAD); } return found; } -class SymbolTableLookupChar : StackObj { +class SymbolTableLookup : StackObj { private: Thread* _thread; uintx _hash; int _len; const char* _str; - Symbol* _found; public: - SymbolTableLookupChar(Thread* thread, const char* key, int len, uintx hash) - : _thread(thread), _hash(hash), _str(key), _len(len) , _found(NULL) { - } + SymbolTableLookup(Thread* thread, const char* key, int len, uintx hash) + : _thread(thread), _hash(hash), _str(key), _len(len) {} uintx get_hash() const { return _hash; } @@ -354,13 +343,14 @@ if (sym->equals(_str, _len)) { if (sym->try_increment_refcount()) { // something is referencing this symbol now. - _found = sym; return true; } else { - *is_dead = (sym->refcount() == 0); + assert(sym->refcount() == 0, "expected dead symbol"); + *is_dead = true; return false; } } else { + *is_dead = (sym->refcount() == 0); return false; } } @@ -380,11 +370,11 @@ } }; -Symbol* SymbolTable::do_lookup(char* name, int len, uintx hash) { +Symbol* SymbolTable::do_lookup(const char* name, int len, uintx hash) { Thread* thread = Thread::current(); - SymbolTableLookupChar lookup(thread, name, len, hash); + SymbolTableLookup lookup(thread, name, len, hash); SymbolTableGet stg; - bool rehash_warning; + bool rehash_warning = false; _local_table->get(thread, lookup, stg, &rehash_warning); if (rehash_warning) { _needs_rehashing = true; @@ -437,15 +427,15 @@ int names_count, const char** names, int* lengths, int* cp_indices, unsigned int* hashValues, TRAPS) { bool c_heap = !loader_data->is_the_null_class_loader_data(); - for (int i=0; ilookup_common(name, len, hash); if (sym == NULL) { sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, c_heap, CHECK); } - assert(sym->refcount()!=0, "lookup should have incremented the count"); + assert(sym->refcount() != 0, "lookup should have incremented the count"); cp->symbol_at_put(cp_indices[i], sym); } } @@ -459,15 +449,15 @@ Symbol* _return; Symbol* _created; + void assert_for_name(Symbol* sym, const char* where) const { #ifdef ASSERT - void _assert_for_name(Symbol* sym, const char* where) const { assert(sym->utf8_length() == _len, "%s [%d,%d]", where, sym->utf8_length(), _len); - for (int i=0; i<_len; i++) { + for (int i = 0; i < _len; i++) { assert(sym->byte_at(i) == _name[i], "%s [%d,%d,%d]", where, i, sym->byte_at(i), _name[i]); } - } #endif + } public: SymbolTableCreateEntry(Thread* thread, const char* name, int len, bool heap) @@ -475,12 +465,10 @@ assert(_name != NULL, "expected valid name"); } Symbol* operator()() { - _created = SymbolTable::the_table()->allocate_symbol((const u1*)_name, _len, _heap, _thread); + _created = SymbolTable::the_table()->allocate_symbol(_name, _len, _heap, _thread); assert(_created != NULL, "expected created symbol"); -#ifdef ASSERT - _assert_for_name(_created, "operator()()"); -#endif - assert(_created->equals((char*)_name, _len), + assert_for_name(_created, "operator()()"); + assert(_created->equals(_name, _len), "symbol must be properly initialized [%p,%d,%d]", _name, _len, (int)_heap); return _created; } @@ -500,23 +488,19 @@ } } _return = *value; -#ifdef ASSERT - _assert_for_name(_return, "operator()"); -#endif + assert_for_name(_return, "operator()"); } Symbol* get_new_sym() const { -#ifdef ASSERT - _assert_for_name(_return, "get_new_sym"); -#endif + assert_for_name(_return, "get_new_sym"); return _return; } }; -Symbol* SymbolTable::do_add_if_needed(char* name, int len, uintx hash, bool heap, TRAPS) { - SymbolTableLookupChar lookup(THREAD, name, len, hash); +Symbol* SymbolTable::do_add_if_needed(const char* name, int len, uintx hash, bool heap, TRAPS) { + SymbolTableLookup lookup(THREAD, name, len, hash); SymbolTableCreateEntry stce(THREAD, name, len, heap); - bool rehash_warning; - bool clean_hint; + bool rehash_warning = false; + bool clean_hint = false; _local_table->get_insert_lazy(THREAD, lookup, stce, stce, &rehash_warning, &clean_hint); if (rehash_warning) { _needs_rehashing = true; @@ -540,7 +524,7 @@ int len = (int)strlen(name); Symbol* sym = SymbolTable::lookup_only(name, len, hash); if (sym == NULL) { - sym = SymbolTable::the_table()->do_add_if_needed((char*)name, len, hash, false, CHECK_NULL); + sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, false, CHECK_NULL); } if (sym->refcount() != PERM_REFCOUNT) { sym->increment_refcount(); @@ -570,7 +554,7 @@ guarantee(value != NULL, "expected valid value"); guarantee(*value != NULL, "value should point to a symbol"); Symbol* sym = *value; - guarantee(sym->equals((char*)sym->bytes(), sym->utf8_length()), + guarantee(sym->equals((const char*)sym->bytes(), sym->utf8_length()), "symbol must be internally consistent"); return true; }; @@ -625,11 +609,11 @@ assert(value != NULL, "expected valid value"); assert(*value != NULL, "value should point to a symbol"); Symbol* sym = *value; - unsigned int fixed_hash = hash_shared_symbol((char*)sym->bytes(), sym->utf8_length()); + unsigned int fixed_hash = hash_shared_symbol((const char*)sym->bytes(), sym->utf8_length()); if (fixed_hash == 0) { return true; } - assert(fixed_hash == hash_symbol((char*)sym->bytes(), sym->utf8_length(), false), + assert(fixed_hash == hash_symbol((const char*)sym->bytes(), sym->utf8_length(), false), "must not rehash during dumping"); // add to the compact table @@ -647,7 +631,7 @@ void SymbolTable::write_to_archive() { _shared_table.reset(); - int num_buckets = (SymbolTable::the_table()->_items / SharedSymbolTableBucketSize); + int num_buckets = (SymbolTable::the_table()->_items_count / SharedSymbolTableBucketSize); // calculation of num_buckets can result in zero buckets, we need at least one CompactSymbolTableWriter writer(num_buckets > 1 ? num_buckets : 1, &MetaspaceShared::stats()->symbol); @@ -715,11 +699,7 @@ assert(*value != NULL, "value should point to a symbol"); _processed++; Symbol *sym = *value; - if (sym->refcount() == 0) { - return true; - } else { - return false; - } + return (sym->refcount() == 0); } }; @@ -744,7 +724,7 @@ bdt.done(jt); } - Atomic::add(stdc._processed, &_symbols_counted); + Atomic::add((size_t)stdc._processed, &_symbols_counted); log_debug(symboltable)("Cleaned " INT32_FORMAT " of " INT32_FORMAT, stdd._deleted, stdc._processed); @@ -878,19 +858,19 @@ class HistogramIterator : StackObj { public: - static const int results_length = 100; - int counts[results_length]; - int sizes[results_length]; - int total_size; - int total_count; - int total_length; - int max_length; - int out_of_range_count; - int out_of_range_size; + static const size_t results_length = 100; + size_t counts[results_length]; + size_t sizes[results_length]; + size_t total_size; + size_t total_count; + size_t total_length; + size_t max_length; + size_t out_of_range_count; + size_t out_of_range_size; HistogramIterator() : total_size(0), total_count(0), total_length(0), max_length(0), out_of_range_count(0), out_of_range_size(0) { // initialize results to zero - for (int i = 0; i < results_length; i++) { + for (size_t i = 0; i < results_length; i++) { counts[i] = 0; sizes[i] = 0; } @@ -899,8 +879,8 @@ assert(value != NULL, "expected valid value"); assert(*value != NULL, "value should point to a symbol"); Symbol* sym = *value; - int size = sym->size(); - int len = sym->utf8_length(); + size_t size = sym->size(); + size_t len = sym->utf8_length(); if (len < results_length) { counts[len]++; sizes[len] += size; @@ -918,33 +898,35 @@ }; void SymbolTable::print_histogram() { + SymbolTable* st = SymbolTable::the_table(); HistogramIterator hi; - SymbolTable::the_table()->_local_table->do_scan(Thread::current(), hi); + st->_local_table->do_scan(Thread::current(), hi); tty->print_cr("Symbol Table Histogram:"); - tty->print_cr(" Total number of symbols %7d", hi.total_count); - tty->print_cr(" Total size in memory %7dK", - (hi.total_size*wordSize)/1024); - tty->print_cr(" Total counted %7d", _symbols_counted); - tty->print_cr(" Total removed %7d", _symbols_removed); - if (_symbols_counted > 0) { + tty->print_cr(" Total number of symbols " SIZE_FORMAT_W(7), hi.total_count); + tty->print_cr(" Total size in memory " SIZE_FORMAT_W(7) "K", + (hi.total_size * wordSize) / 1024); + tty->print_cr(" Total counted " SIZE_FORMAT_W(7), st->_symbols_counted); + tty->print_cr(" Total removed " SIZE_FORMAT_W(7), st->_symbols_removed); + if (SymbolTable::the_table()->_symbols_counted > 0) { tty->print_cr(" Percent removed %3.2f", - ((float)_symbols_removed/(float)_symbols_counted)* 100); + ((float)st->_symbols_removed / st->_symbols_counted) * 100); } - tty->print_cr(" Reference counts %7d", Symbol::_total_count); - tty->print_cr(" Symbol arena used " SIZE_FORMAT_W(7) "K", arena()->used()/1024); - tty->print_cr(" Symbol arena size " SIZE_FORMAT_W(7) "K", arena()->size_in_bytes()/1024); - tty->print_cr(" Total symbol length %7d", hi.total_length); - tty->print_cr(" Maximum symbol length %7d", hi.max_length); - tty->print_cr(" Average symbol length %7.2f", ((float) hi.total_length / (float) hi.total_count)); + tty->print_cr(" Reference counts " SIZE_FORMAT_W(7), Symbol::_total_count); + tty->print_cr(" Symbol arena used " SIZE_FORMAT_W(7) "K", arena()->used() / 1024); + tty->print_cr(" Symbol arena size " SIZE_FORMAT_W(7) "K", arena()->size_in_bytes() / 1024); + tty->print_cr(" Total symbol length " SIZE_FORMAT_W(7), hi.total_length); + tty->print_cr(" Maximum symbol length " SIZE_FORMAT_W(7), hi.max_length); + tty->print_cr(" Average symbol length %7.2f", ((float)hi.total_length / hi.total_count)); tty->print_cr(" Symbol length histogram:"); tty->print_cr(" %6s %10s %10s", "Length", "#Symbols", "Size"); - for (int i = 0; i < hi.results_length; i++) { + for (size_t i = 0; i < hi.results_length; i++) { if (hi.counts[i] > 0) { - tty->print_cr(" %6d %10d %10dK", i, hi.counts[i], (hi.sizes[i]*wordSize)/1024); + tty->print_cr(" " SIZE_FORMAT_W(6) " " SIZE_FORMAT_W(10) " " SIZE_FORMAT_W(10) "K", + i, hi.counts[i], (hi.sizes[i] * wordSize) / 1024); } } - tty->print_cr(" >=%6d %10d %10dK\n", hi.results_length, - hi.out_of_range_count, (hi.out_of_range_size*wordSize)/1024); + tty->print_cr(" >=" SIZE_FORMAT_W(6) " " SIZE_FORMAT_W(10) " " SIZE_FORMAT_W(10) "K\n", + hi.results_length, hi.out_of_range_count, (hi.out_of_range_size*wordSize) / 1024); } #endif // PRODUCT --- old/src/hotspot/share/classfile/symbolTable.hpp 2018-08-03 16:41:57.000000000 -0500 +++ new/src/hotspot/share/classfile/symbolTable.hpp 2018-08-03 16:41:57.000000000 -0500 @@ -110,23 +110,21 @@ static SymbolTable* _the_table; // Shared symbol table. static CompactHashtable _shared_table; - static bool _lookup_shared_first; - static bool _alt_hash; + static volatile bool _lookup_shared_first; + static volatile bool _alt_hash; // For statistics - static int _symbols_removed; - static int _symbols_counted; + volatile size_t _symbols_removed; + volatile size_t _symbols_counted; - // Set if one bucket is out of balance due to hash algorithm deficiency SymbolTableHash* _local_table; size_t _current_size; volatile bool _has_work; + // Set if one bucket is out of balance due to hash algorithm deficiency volatile bool _needs_rehashing; - volatile int _items; - DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile int)); - volatile int _uncleaned_items; - DEFINE_PAD_MINUS_SIZE(2, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile int)); + volatile size_t _items_count; + volatile size_t _uncleaned_items_count; double get_load_factor(); double get_dead_factor(); @@ -134,16 +132,16 @@ void check_concurrent_work(); void trigger_concurrent_work(); - static uintx item_added(); + static void item_added(); static void item_removed(); static void set_item_clean_count(size_t ncl); static void mark_item_clean_count(); SymbolTable(); - Symbol* allocate_symbol(const u1* name, int len, bool c_heap, TRAPS); // Assumes no characters larger than 0x7F - Symbol* do_lookup(char* name, int len, uintx hash); - Symbol* do_add_if_needed(char* name, int len, uintx hash, bool heap, TRAPS); + Symbol* allocate_symbol(const char* name, int len, bool c_heap, TRAPS); // Assumes no characters larger than 0x7F + Symbol* do_lookup(const char* name, int len, uintx hash); + Symbol* do_add_if_needed(const char* name, int len, uintx hash, bool heap, TRAPS); // Adding elements static void add(ClassLoaderData* loader_data, --- old/src/hotspot/share/oops/symbol.cpp 2018-08-03 16:41:57.000000000 -0500 +++ new/src/hotspot/share/oops/symbol.cpp 2018-08-03 16:41:57.000000000 -0500 @@ -318,4 +318,4 @@ } // SymbolTable prints this in its statistics -NOT_PRODUCT(int Symbol::_total_count = 0;) +NOT_PRODUCT(size_t Symbol::_total_count = 0;) --- old/src/hotspot/share/oops/symbol.hpp 2018-08-03 16:41:58.000000000 -0500 +++ new/src/hotspot/share/oops/symbol.hpp 2018-08-03 16:41:58.000000000 -0500 @@ -256,7 +256,7 @@ // only for getting its vtable pointer. Symbol() { } - static int _total_count; + static size_t _total_count; #endif };