diff --git a/src/hotspot/share/gc/z/vmStructs_z.hpp b/src/hotspot/share/gc/z/vmStructs_z.hpp index 15b1933c258..c194063e260 100644 --- a/src/hotspot/share/gc/z/vmStructs_z.hpp +++ b/src/hotspot/share/gc/z/vmStructs_z.hpp @@ -24,8 +24,8 @@ #ifndef SHARE_GC_Z_VMSTRUCTS_Z_HPP #define SHARE_GC_Z_VMSTRUCTS_Z_HPP -#include "gc/z/zAddressRangeMap.hpp" #include "gc/z/zCollectedHeap.hpp" +#include "gc/z/zGranuleMap.hpp" #include "gc/z/zHeap.hpp" #include "gc/z/zPageAllocator.hpp" #include "gc/z/zPhysicalMemory.hpp" @@ -52,7 +52,7 @@ public: const int* _ZObjectAlignmentSmall; }; -typedef ZAddressRangeMap ZAddressRangeMapForPageTable; +typedef ZGranuleMap ZGranuleMapForPageTable; #define VM_STRUCTS_ZGC(nonstatic_field, volatile_nonstatic_field, static_field) \ static_field(ZGlobalsForVMStructs, _instance_p, ZGlobalsForVMStructs*) \ @@ -79,18 +79,18 @@ typedef ZAddressRangeMap ZAddressRangeMapFor nonstatic_field(ZPageAllocator, _physical, ZPhysicalMemoryManager) \ nonstatic_field(ZPageAllocator, _used, size_t) \ \ - nonstatic_field(ZPageTable, _map, ZAddressRangeMapForPageTable) \ + nonstatic_field(ZPageTable, _map, ZGranuleMapForPageTable) \ \ - nonstatic_field(ZAddressRangeMapForPageTable, _map, ZPageTableEntry* const) \ + nonstatic_field(ZGranuleMapForPageTable, _map, ZPageTableEntry* const) \ \ - nonstatic_field(ZVirtualMemory, _start, uintptr_t) \ - nonstatic_field(ZVirtualMemory, _end, uintptr_t) \ + nonstatic_field(ZVirtualMemory, _start, uintptr_t) \ + nonstatic_field(ZVirtualMemory, _end, uintptr_t) \ \ - nonstatic_field(ZForwardingTable, _table, ZForwardingTableEntry*) \ - nonstatic_field(ZForwardingTable, _size, size_t) \ + nonstatic_field(ZForwardingTable, _table, ZForwardingTableEntry*) \ + nonstatic_field(ZForwardingTable, _size, size_t) \ \ - nonstatic_field(ZPhysicalMemoryManager, _max_capacity, const size_t) \ - nonstatic_field(ZPhysicalMemoryManager, _capacity, size_t) + nonstatic_field(ZPhysicalMemoryManager, _max_capacity, const size_t) \ + nonstatic_field(ZPhysicalMemoryManager, _capacity, size_t) #define VM_INT_CONSTANTS_ZGC(declare_constant, declare_constant_with_value) \ declare_constant(ZPhaseRelocate) \ @@ -118,7 +118,7 @@ typedef ZAddressRangeMap ZAddressRangeMapFor declare_toplevel_type(ZPageAllocator) \ declare_toplevel_type(ZPageTable) \ declare_toplevel_type(ZPageTableEntry) \ - declare_toplevel_type(ZAddressRangeMapForPageTable) \ + declare_toplevel_type(ZGranuleMapForPageTable) \ declare_toplevel_type(ZVirtualMemory) \ declare_toplevel_type(ZForwardingTable) \ declare_toplevel_type(ZForwardingTableEntry) \ diff --git a/src/hotspot/share/gc/z/zAddressRangeMap.hpp b/src/hotspot/share/gc/z/zGranuleMap.hpp similarity index 63% rename from src/hotspot/share/gc/z/zAddressRangeMap.hpp rename to src/hotspot/share/gc/z/zGranuleMap.hpp index 0d441de626e..2704bbf8fce 100644 --- a/src/hotspot/share/gc/z/zAddressRangeMap.hpp +++ b/src/hotspot/share/gc/z/zGranuleMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,18 +21,18 @@ * questions. */ -#ifndef SHARE_GC_Z_ZADDRESSRANGEMAP_HPP -#define SHARE_GC_Z_ZADDRESSRANGEMAP_HPP +#ifndef SHARE_GC_Z_ZGRANULEMAP_HPP +#define SHARE_GC_Z_ZGRANULEMAP_HPP #include "memory/allocation.hpp" -template -class ZAddressRangeMapIterator; +template +class ZGranuleMapIterator; -template -class ZAddressRangeMap { +template +class ZGranuleMap { friend class VMStructs; - friend class ZAddressRangeMapIterator; + friend class ZGranuleMapIterator; private: T* const _map; @@ -41,23 +41,23 @@ private: size_t size() const; public: - ZAddressRangeMap(); - ~ZAddressRangeMap(); + ZGranuleMap(); + ~ZGranuleMap(); T get(uintptr_t addr) const; void put(uintptr_t addr, T value); }; -template -class ZAddressRangeMapIterator : public StackObj { +template +class ZGranuleMapIterator : public StackObj { public: - const ZAddressRangeMap* const _map; - size_t _next; + const ZGranuleMap* const _map; + size_t _next; public: - ZAddressRangeMapIterator(const ZAddressRangeMap* map); + ZGranuleMapIterator(const ZGranuleMap* map); bool next(T* value); }; -#endif // SHARE_GC_Z_ZADDRESSRANGEMAP_HPP +#endif // SHARE_GC_Z_ZGRANULEMAP_HPP diff --git a/src/hotspot/share/gc/z/zAddressRangeMap.inline.hpp b/src/hotspot/share/gc/z/zGranuleMap.inline.hpp similarity index 50% rename from src/hotspot/share/gc/z/zAddressRangeMap.inline.hpp rename to src/hotspot/share/gc/z/zGranuleMap.inline.hpp index f091e0295dd..bac7b817a33 100644 --- a/src/hotspot/share/gc/z/zAddressRangeMap.inline.hpp +++ b/src/hotspot/share/gc/z/zGranuleMap.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,57 +21,57 @@ * questions. */ -#ifndef SHARE_GC_Z_ZADDRESSRANGEMAP_INLINE_HPP -#define SHARE_GC_Z_ZADDRESSRANGEMAP_INLINE_HPP +#ifndef SHARE_GC_Z_ZGRANULEMAP_INLINE_HPP +#define SHARE_GC_Z_ZGRANULEMAP_INLINE_HPP #include "gc/z/zAddress.inline.hpp" -#include "gc/z/zAddressRangeMap.hpp" #include "gc/z/zGlobals.hpp" +#include "gc/z/zGranuleMap.hpp" #include "memory/allocation.inline.hpp" -template -ZAddressRangeMap::ZAddressRangeMap() : +template +inline ZGranuleMap::ZGranuleMap() : _map(MmapArrayAllocator::allocate(size(), mtGC)) {} -template -ZAddressRangeMap::~ZAddressRangeMap() { +template +inline ZGranuleMap::~ZGranuleMap() { MmapArrayAllocator::free(_map, size()); } -template -size_t ZAddressRangeMap::index_for_addr(uintptr_t addr) const { +template +inline size_t ZGranuleMap::index_for_addr(uintptr_t addr) const { assert(!ZAddress::is_null(addr), "Invalid address"); - const size_t index = ZAddress::offset(addr) >> AddressRangeShift; + const size_t index = ZAddress::offset(addr) >> ZGranuleSizeShift; assert(index < size(), "Invalid index"); return index; } -template -size_t ZAddressRangeMap::size() const { - return ZAddressOffsetMax >> AddressRangeShift; +template +inline size_t ZGranuleMap::size() const { + return ZAddressOffsetMax >> ZGranuleSizeShift; } -template -T ZAddressRangeMap::get(uintptr_t addr) const { - const uintptr_t index = index_for_addr(addr); +template +inline T ZGranuleMap::get(uintptr_t addr) const { + const size_t index = index_for_addr(addr); return _map[index]; } -template -void ZAddressRangeMap::put(uintptr_t addr, T value) { - const uintptr_t index = index_for_addr(addr); +template +inline void ZGranuleMap::put(uintptr_t addr, T value) { + const size_t index = index_for_addr(addr); _map[index] = value; } -template -inline ZAddressRangeMapIterator::ZAddressRangeMapIterator(const ZAddressRangeMap* map) : +template +inline ZGranuleMapIterator::ZGranuleMapIterator(const ZGranuleMap* map) : _map(map), _next(0) {} -template -inline bool ZAddressRangeMapIterator::next(T* value) { +template +inline bool ZGranuleMapIterator::next(T* value) { if (_next < _map->size()) { *value = _map->_map[_next++]; return true; @@ -81,4 +81,4 @@ inline bool ZAddressRangeMapIterator::next(T* value) { return false; } -#endif // SHARE_GC_Z_ZADDRESSRANGEMAP_INLINE_HPP +#endif // SHARE_GC_Z_ZGRANULEMAP_INLINE_HPP diff --git a/src/hotspot/share/gc/z/zHeapIterator.cpp b/src/hotspot/share/gc/z/zHeapIterator.cpp index 5669221c808..497b1b35161 100644 --- a/src/hotspot/share/gc/z/zHeapIterator.cpp +++ b/src/hotspot/share/gc/z/zHeapIterator.cpp @@ -22,9 +22,9 @@ */ #include "precompiled.hpp" -#include "gc/z/zAddressRangeMap.inline.hpp" #include "gc/z/zBarrier.inline.hpp" #include "gc/z/zGlobals.hpp" +#include "gc/z/zGranuleMap.inline.hpp" #include "gc/z/zHeapIterator.hpp" #include "gc/z/zOop.inline.hpp" #include "gc/z/zRootsIterator.hpp" diff --git a/src/hotspot/share/gc/z/zHeapIterator.hpp b/src/hotspot/share/gc/z/zHeapIterator.hpp index aced22dba41..f04f655ab54 100644 --- a/src/hotspot/share/gc/z/zHeapIterator.hpp +++ b/src/hotspot/share/gc/z/zHeapIterator.hpp @@ -24,11 +24,11 @@ #ifndef SHARE_GC_Z_ZHEAPITERATOR_HPP #define SHARE_GC_Z_ZHEAPITERATOR_HPP -#include "gc/z/zAddressRangeMap.hpp" -#include "gc/z/zGlobals.hpp" +#include "gc/z/zGranuleMap.hpp" #include "memory/allocation.hpp" #include "utilities/stack.hpp" +class ObjectClosure; class ZHeapIteratorBitMap; class ZHeapIterator : public StackObj { @@ -36,9 +36,9 @@ class ZHeapIterator : public StackObj { friend class ZHeapIteratorOopClosure; private: - typedef ZAddressRangeMap ZVisitMap; - typedef ZAddressRangeMapIterator ZVisitMapIterator; - typedef Stack ZVisitStack; + typedef ZGranuleMap ZVisitMap; + typedef ZGranuleMapIterator ZVisitMapIterator; + typedef Stack ZVisitStack; ZVisitStack _visit_stack; ZVisitMap _visit_map; diff --git a/src/hotspot/share/gc/z/zPageTable.cpp b/src/hotspot/share/gc/z/zPageTable.cpp index 74c4aabca37..dd8b597cec1 100644 --- a/src/hotspot/share/gc/z/zPageTable.cpp +++ b/src/hotspot/share/gc/z/zPageTable.cpp @@ -22,6 +22,7 @@ */ #include "precompiled.hpp" +#include "gc/z/zAddress.inline.hpp" #include "gc/z/zPage.inline.hpp" #include "gc/z/zPageTable.inline.hpp" #include "runtime/orderAccess.hpp" diff --git a/src/hotspot/share/gc/z/zPageTable.hpp b/src/hotspot/share/gc/z/zPageTable.hpp index 96aee4365ec..6611899970e 100644 --- a/src/hotspot/share/gc/z/zPageTable.hpp +++ b/src/hotspot/share/gc/z/zPageTable.hpp @@ -24,8 +24,7 @@ #ifndef SHARE_GC_Z_ZPAGETABLE_HPP #define SHARE_GC_Z_ZPAGETABLE_HPP -#include "gc/z/zAddressRangeMap.hpp" -#include "gc/z/zGlobals.hpp" +#include "gc/z/zGranuleMap.hpp" #include "gc/z/zPageTableEntry.hpp" #include "memory/allocation.hpp" @@ -36,7 +35,7 @@ class ZPageTable { friend class ZPageTableIterator; private: - ZAddressRangeMap _map; + ZGranuleMap _map; ZPageTableEntry get_entry(ZPage* page) const; void put_entry(ZPage* page, ZPageTableEntry entry); @@ -55,8 +54,8 @@ public: class ZPageTableIterator : public StackObj { private: - ZAddressRangeMapIterator _iter; - ZPage* _prev; + ZGranuleMapIterator _iter; + ZPage* _prev; public: ZPageTableIterator(const ZPageTable* pagetable); diff --git a/src/hotspot/share/gc/z/zPageTable.inline.hpp b/src/hotspot/share/gc/z/zPageTable.inline.hpp index 59deb8834c4..94f7623a984 100644 --- a/src/hotspot/share/gc/z/zPageTable.inline.hpp +++ b/src/hotspot/share/gc/z/zPageTable.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #define SHARE_GC_Z_ZPAGETABLE_INLINE_HPP #include "gc/z/zAddress.inline.hpp" -#include "gc/z/zAddressRangeMap.inline.hpp" +#include "gc/z/zGranuleMap.inline.hpp" #include "gc/z/zPageTable.hpp" inline ZPage* ZPageTable::get(uintptr_t addr) const { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddressRangeMapForPageTable.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGranuleMapForPageTable.java similarity index 93% rename from src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddressRangeMapForPageTable.java rename to src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGranuleMapForPageTable.java index df10b426c09..a6221a7c2d5 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddressRangeMapForPageTable.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGranuleMapForPageTable.java @@ -31,7 +31,7 @@ import sun.jvm.hotspot.types.AddressField; import sun.jvm.hotspot.types.Type; import sun.jvm.hotspot.types.TypeDataBase; -public class ZAddressRangeMapForPageTable extends VMObject { +public class ZGranuleMapForPageTable extends VMObject { private static AddressField mapField; static { @@ -39,12 +39,12 @@ public class ZAddressRangeMapForPageTable extends VMObject { } static private synchronized void initialize(TypeDataBase db) { - Type type = db.lookupType("ZAddressRangeMapForPageTable"); + Type type = db.lookupType("ZGranuleMapForPageTable"); mapField = type.getAddressField("_map"); } - public ZAddressRangeMapForPageTable(Address addr) { + public ZGranuleMapForPageTable(Address addr) { super(addr); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTable.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTable.java index ae11742093e..a2599565680 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTable.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTable.java @@ -50,8 +50,8 @@ public class ZPageTable extends VMObject { super(addr); } - private ZAddressRangeMapForPageTable map() { - return (ZAddressRangeMapForPageTable)VMObjectFactory.newObject(ZAddressRangeMapForPageTable.class, addr.addOffsetTo(mapFieldOffset)); + private ZGranuleMapForPageTable map() { + return (ZGranuleMapForPageTable)VMObjectFactory.newObject(ZGranuleMapForPageTable.class, addr.addOffsetTo(mapFieldOffset)); } private ZPageTableEntry getEntry(Address o) { @@ -67,7 +67,7 @@ public class ZPageTable extends VMObject { } private class ZPagesIterator implements Iterator { - private ZAddressRangeMapForPageTable.Iterator mapIter; + private ZGranuleMapForPageTable.Iterator mapIter; private ZPage next; ZPagesIterator() {