< prev index next >

src/hotspot/share/memory/metaspaceShared.cpp

Print this page

*** 62,71 **** --- 62,72 ---- #include "runtime/vmThread.hpp" #include "runtime/vm_operations.hpp" #include "utilities/align.hpp" #include "utilities/bitMap.hpp" #include "utilities/defaultStream.hpp" + #include "utilities/hashtable.hpp" #if INCLUDE_G1GC #include "gc/g1/g1CollectedHeap.hpp" #endif ReservedSpace MetaspaceShared::_shared_rs;
*** 1068,1094 **** class ArchiveCompactor : AllStatic { static DumpAllocStats* _alloc_stats; static SortedSymbolClosure* _ssc; ! static unsigned my_hash(const address& a) { ! return primitive_hash<address>(a); ! } ! static bool my_equals(const address& a0, const address& a1) { ! return primitive_equals<address>(a0, a1); ! } ! typedef ResourceHashtable< ! address, address, ! ArchiveCompactor::my_hash, // solaris compiler doesn't like: primitive_hash<address> ! ArchiveCompactor::my_equals, // solaris compiler doesn't like: primitive_equals<address> ! 16384, ResourceObj::C_HEAP> RelocationTable; static RelocationTable* _new_loc_table; public: static void initialize() { _alloc_stats = new(ResourceObj::C_HEAP, mtInternal)DumpAllocStats; ! _new_loc_table = new(ResourceObj::C_HEAP, mtInternal)RelocationTable; } static DumpAllocStats* alloc_stats() { return _alloc_stats; } --- 1069,1086 ---- class ArchiveCompactor : AllStatic { static DumpAllocStats* _alloc_stats; static SortedSymbolClosure* _ssc; ! typedef KVHashtable< ! address, address> RelocationTable; static RelocationTable* _new_loc_table; public: static void initialize() { _alloc_stats = new(ResourceObj::C_HEAP, mtInternal)DumpAllocStats; ! _new_loc_table = new RelocationTable(8087); } static DumpAllocStats* alloc_stats() { return _alloc_stats; }
*** 1134,1152 **** } p = _rw_region.allocate(bytes, alignment); newtop = _rw_region.top(); } memcpy(p, obj, bytes); ! bool isnew = _new_loc_table->put(obj, (address)p); log_trace(cds)("Copy: " PTR_FORMAT " ==> " PTR_FORMAT " %d", p2i(obj), p2i(p), bytes); ! assert(isnew, "must be"); ! _alloc_stats->record(ref->msotype(), int(newtop - oldtop), read_only); } static address get_new_loc(MetaspaceClosure::Ref* ref) { ! address* pp = _new_loc_table->get(ref->obj()); assert(pp != NULL, "must be"); return *pp; } private: --- 1126,1146 ---- } p = _rw_region.allocate(bytes, alignment); newtop = _rw_region.top(); } memcpy(p, obj, bytes); ! assert(_new_loc_table->lookup(obj) == NULL, "each object can be relocated at most once"); ! _new_loc_table->add(obj, (address)p); log_trace(cds)("Copy: " PTR_FORMAT " ==> " PTR_FORMAT " %d", p2i(obj), p2i(p), bytes); ! if (_new_loc_table->maybe_grow()) { ! log_info(cds, hashtables)("Expanded _new_loc_table to %d", _new_loc_table->table_size()); ! } _alloc_stats->record(ref->msotype(), int(newtop - oldtop), read_only); } static address get_new_loc(MetaspaceClosure::Ref* ref) { ! address* pp = _new_loc_table->lookup(ref->obj()); assert(pp != NULL, "must be"); return *pp; } private:
*** 1286,1296 **** vmSymbols::metaspace_pointers_do(it); } static Klass* get_relocated_klass(Klass* orig_klass) { assert(DumpSharedSpaces, "dump time only"); ! address* pp = _new_loc_table->get((address)orig_klass); assert(pp != NULL, "must be"); Klass* klass = (Klass*)(*pp); assert(klass->is_klass(), "must be"); return klass; } --- 1280,1290 ---- vmSymbols::metaspace_pointers_do(it); } static Klass* get_relocated_klass(Klass* orig_klass) { assert(DumpSharedSpaces, "dump time only"); ! address* pp = _new_loc_table->lookup((address)orig_klass); assert(pp != NULL, "must be"); Klass* klass = (Klass*)(*pp); assert(klass->is_klass(), "must be"); return klass; }
< prev index next >