--- old/src/hotspot/share/classfile/compactHashtable.cpp 2018-09-18 21:27:52.965198061 -0700 +++ new/src/hotspot/share/classfile/compactHashtable.cpp 2018-09-18 21:27:52.709188200 -0700 @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "jvm.h" -#include "classfile/compactHashtable.inline.hpp" +#include "classfile/compactHashtable.hpp" #include "classfile/javaClasses.hpp" #include "logging/logMessage.hpp" #include "memory/heapShared.inline.hpp" @@ -170,33 +170,6 @@ ///////////////////////////////////////////////////////////// // -// Customization for dumping Symbol and String tables - -void CompactSymbolTableWriter::add(unsigned int hash, Symbol *symbol) { - uintx deltax = MetaspaceShared::object_delta(symbol); - // When the symbols are stored into the archive, we already check that - // they won't be more than MAX_SHARED_DELTA from the base address, or - // else the dumping would have been aborted. - assert(deltax <= MAX_SHARED_DELTA, "must not be"); - u4 delta = u4(deltax); - - CompactHashtableWriter::add(hash, delta); -} - -void CompactStringTableWriter::add(unsigned int hash, oop string) { - CompactHashtableWriter::add(hash, CompressedOops::encode(string)); -} - -void CompactSymbolTableWriter::dump(CompactHashtable *cht) { - CompactHashtableWriter::dump(cht, "symbol"); -} - -void CompactStringTableWriter::dump(CompactHashtable *cht) { - CompactHashtableWriter::dump(cht, "string"); -} - -///////////////////////////////////////////////////////////// -// // The CompactHashtable implementation // @@ -208,95 +181,6 @@ soc->do_ptr((void**)&_entries); } -bool SimpleCompactHashtable::exists(u4 value) { - assert(!DumpSharedSpaces, "run-time only"); - - if (_entry_count == 0) { - return false; - } - - unsigned int hash = (unsigned int)value; - int index = hash % _bucket_count; - u4 bucket_info = _buckets[index]; - u4 bucket_offset = BUCKET_OFFSET(bucket_info); - int bucket_type = BUCKET_TYPE(bucket_info); - u4* entry = _entries + bucket_offset; - - if (bucket_type == VALUE_ONLY_BUCKET_TYPE) { - return (entry[0] == value); - } else { - u4*entry_max = _entries + BUCKET_OFFSET(_buckets[index + 1]); - while (entry -inline void SimpleCompactHashtable::iterate(const I& iterator) { - for (u4 i = 0; i < _bucket_count; i++) { - u4 bucket_info = _buckets[i]; - u4 bucket_offset = BUCKET_OFFSET(bucket_info); - int bucket_type = BUCKET_TYPE(bucket_info); - u4* entry = _entries + bucket_offset; - - if (bucket_type == VALUE_ONLY_BUCKET_TYPE) { - iterator.do_value(_base_address, entry[0]); - } else { - u4*entry_max = _entries + BUCKET_OFFSET(_buckets[i + 1]); - while (entry < entry_max) { - iterator.do_value(_base_address, entry[1]); - entry += 2; - } - } - } -} - -template void CompactHashtable::serialize(SerializeClosure* soc) { - SimpleCompactHashtable::serialize(soc); - soc->do_u4(&_type); -} - -class CompactHashtable_SymbolIterator { - SymbolClosure* const _closure; -public: - CompactHashtable_SymbolIterator(SymbolClosure *cl) : _closure(cl) {} - inline void do_value(address base_address, u4 offset) const { - Symbol* sym = (Symbol*)((void*)(base_address + offset)); - _closure->do_symbol(&sym); - } -}; - -template void CompactHashtable::symbols_do(SymbolClosure *cl) { - CompactHashtable_SymbolIterator iterator(cl); - iterate(iterator); -} - -class CompactHashtable_OopIterator { - OopClosure* const _closure; -public: - CompactHashtable_OopIterator(OopClosure *cl) : _closure(cl) {} - inline void do_value(address base_address, u4 offset) const { - narrowOop v = (narrowOop)offset; - oop obj = HeapShared::decode_from_archive(v); - _closure->do_oop(&obj); - } -}; - -template void CompactHashtable::oops_do(OopClosure* cl) { - assert(_type == _string_table || _bucket_count == 0, "sanity"); - CompactHashtable_OopIterator iterator(cl); - iterate(iterator); -} - -// Explicitly instantiate these types -template class CompactHashtable; -template class CompactHashtable; - #ifndef O_BINARY // if defined (Win32) use binary files. #define O_BINARY 0 // otherwise do nothing. #endif