8219634: ZGC: Rename ZAddressRangeMap to ZGranuleMap

Reviewed-by: eosterlund, stefank
This commit is contained in:
Per Lidén 2019-03-13 11:31:00 +01:00
parent 6d4374b876
commit a0847b0416
10 changed files with 71 additions and 71 deletions

View file

@ -24,8 +24,8 @@
#ifndef SHARE_GC_Z_VMSTRUCTS_Z_HPP #ifndef SHARE_GC_Z_VMSTRUCTS_Z_HPP
#define 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/zCollectedHeap.hpp"
#include "gc/z/zGranuleMap.hpp"
#include "gc/z/zHeap.hpp" #include "gc/z/zHeap.hpp"
#include "gc/z/zPageAllocator.hpp" #include "gc/z/zPageAllocator.hpp"
#include "gc/z/zPhysicalMemory.hpp" #include "gc/z/zPhysicalMemory.hpp"
@ -52,7 +52,7 @@ public:
const int* _ZObjectAlignmentSmall; const int* _ZObjectAlignmentSmall;
}; };
typedef ZAddressRangeMap<ZPageTableEntry, ZGranuleSizeShift> ZAddressRangeMapForPageTable; typedef ZGranuleMap<ZPageTableEntry> ZGranuleMapForPageTable;
#define VM_STRUCTS_ZGC(nonstatic_field, volatile_nonstatic_field, static_field) \ #define VM_STRUCTS_ZGC(nonstatic_field, volatile_nonstatic_field, static_field) \
static_field(ZGlobalsForVMStructs, _instance_p, ZGlobalsForVMStructs*) \ static_field(ZGlobalsForVMStructs, _instance_p, ZGlobalsForVMStructs*) \
@ -79,9 +79,9 @@ typedef ZAddressRangeMap<ZPageTableEntry, ZGranuleSizeShift> ZAddressRangeMapFor
nonstatic_field(ZPageAllocator, _physical, ZPhysicalMemoryManager) \ nonstatic_field(ZPageAllocator, _physical, ZPhysicalMemoryManager) \
nonstatic_field(ZPageAllocator, _used, size_t) \ 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, _start, uintptr_t) \
nonstatic_field(ZVirtualMemory, _end, uintptr_t) \ nonstatic_field(ZVirtualMemory, _end, uintptr_t) \
@ -118,7 +118,7 @@ typedef ZAddressRangeMap<ZPageTableEntry, ZGranuleSizeShift> ZAddressRangeMapFor
declare_toplevel_type(ZPageAllocator) \ declare_toplevel_type(ZPageAllocator) \
declare_toplevel_type(ZPageTable) \ declare_toplevel_type(ZPageTable) \
declare_toplevel_type(ZPageTableEntry) \ declare_toplevel_type(ZPageTableEntry) \
declare_toplevel_type(ZAddressRangeMapForPageTable) \ declare_toplevel_type(ZGranuleMapForPageTable) \
declare_toplevel_type(ZVirtualMemory) \ declare_toplevel_type(ZVirtualMemory) \
declare_toplevel_type(ZForwardingTable) \ declare_toplevel_type(ZForwardingTable) \
declare_toplevel_type(ZForwardingTableEntry) \ declare_toplevel_type(ZForwardingTableEntry) \

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,18 +21,18 @@
* questions. * questions.
*/ */
#ifndef SHARE_GC_Z_ZADDRESSRANGEMAP_HPP #ifndef SHARE_GC_Z_ZGRANULEMAP_HPP
#define SHARE_GC_Z_ZADDRESSRANGEMAP_HPP #define SHARE_GC_Z_ZGRANULEMAP_HPP
#include "memory/allocation.hpp" #include "memory/allocation.hpp"
template<typename T, size_t AddressRangeShift> template<typename T>
class ZAddressRangeMapIterator; class ZGranuleMapIterator;
template <typename T, size_t AddressRangeShift> template <typename T>
class ZAddressRangeMap { class ZGranuleMap {
friend class VMStructs; friend class VMStructs;
friend class ZAddressRangeMapIterator<T, AddressRangeShift>; friend class ZGranuleMapIterator<T>;
private: private:
T* const _map; T* const _map;
@ -41,23 +41,23 @@ private:
size_t size() const; size_t size() const;
public: public:
ZAddressRangeMap(); ZGranuleMap();
~ZAddressRangeMap(); ~ZGranuleMap();
T get(uintptr_t addr) const; T get(uintptr_t addr) const;
void put(uintptr_t addr, T value); void put(uintptr_t addr, T value);
}; };
template <typename T, size_t AddressRangeShift> template <typename T>
class ZAddressRangeMapIterator : public StackObj { class ZGranuleMapIterator : public StackObj {
public: public:
const ZAddressRangeMap<T, AddressRangeShift>* const _map; const ZGranuleMap<T>* const _map;
size_t _next; size_t _next;
public: public:
ZAddressRangeMapIterator(const ZAddressRangeMap<T, AddressRangeShift>* map); ZGranuleMapIterator(const ZGranuleMap<T>* map);
bool next(T* value); bool next(T* value);
}; };
#endif // SHARE_GC_Z_ZADDRESSRANGEMAP_HPP #endif // SHARE_GC_Z_ZGRANULEMAP_HPP

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,57 +21,57 @@
* questions. * questions.
*/ */
#ifndef SHARE_GC_Z_ZADDRESSRANGEMAP_INLINE_HPP #ifndef SHARE_GC_Z_ZGRANULEMAP_INLINE_HPP
#define SHARE_GC_Z_ZADDRESSRANGEMAP_INLINE_HPP #define SHARE_GC_Z_ZGRANULEMAP_INLINE_HPP
#include "gc/z/zAddress.inline.hpp" #include "gc/z/zAddress.inline.hpp"
#include "gc/z/zAddressRangeMap.hpp"
#include "gc/z/zGlobals.hpp" #include "gc/z/zGlobals.hpp"
#include "gc/z/zGranuleMap.hpp"
#include "memory/allocation.inline.hpp" #include "memory/allocation.inline.hpp"
template <typename T, size_t AddressRangeShift> template <typename T>
ZAddressRangeMap<T, AddressRangeShift>::ZAddressRangeMap() : inline ZGranuleMap<T>::ZGranuleMap() :
_map(MmapArrayAllocator<T>::allocate(size(), mtGC)) {} _map(MmapArrayAllocator<T>::allocate(size(), mtGC)) {}
template <typename T, size_t AddressRangeShift> template <typename T>
ZAddressRangeMap<T, AddressRangeShift>::~ZAddressRangeMap() { inline ZGranuleMap<T>::~ZGranuleMap() {
MmapArrayAllocator<T>::free(_map, size()); MmapArrayAllocator<T>::free(_map, size());
} }
template <typename T, size_t AddressRangeShift> template <typename T>
size_t ZAddressRangeMap<T, AddressRangeShift>::index_for_addr(uintptr_t addr) const { inline size_t ZGranuleMap<T>::index_for_addr(uintptr_t addr) const {
assert(!ZAddress::is_null(addr), "Invalid address"); 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"); assert(index < size(), "Invalid index");
return index; return index;
} }
template <typename T, size_t AddressRangeShift> template <typename T>
size_t ZAddressRangeMap<T, AddressRangeShift>::size() const { inline size_t ZGranuleMap<T>::size() const {
return ZAddressOffsetMax >> AddressRangeShift; return ZAddressOffsetMax >> ZGranuleSizeShift;
} }
template <typename T, size_t AddressRangeShift> template <typename T>
T ZAddressRangeMap<T, AddressRangeShift>::get(uintptr_t addr) const { inline T ZGranuleMap<T>::get(uintptr_t addr) const {
const uintptr_t index = index_for_addr(addr); const size_t index = index_for_addr(addr);
return _map[index]; return _map[index];
} }
template <typename T, size_t AddressRangeShift> template <typename T>
void ZAddressRangeMap<T, AddressRangeShift>::put(uintptr_t addr, T value) { inline void ZGranuleMap<T>::put(uintptr_t addr, T value) {
const uintptr_t index = index_for_addr(addr); const size_t index = index_for_addr(addr);
_map[index] = value; _map[index] = value;
} }
template <typename T, size_t AddressRangeShift> template <typename T>
inline ZAddressRangeMapIterator<T, AddressRangeShift>::ZAddressRangeMapIterator(const ZAddressRangeMap<T, AddressRangeShift>* map) : inline ZGranuleMapIterator<T>::ZGranuleMapIterator(const ZGranuleMap<T>* map) :
_map(map), _map(map),
_next(0) {} _next(0) {}
template <typename T, size_t AddressRangeShift> template <typename T>
inline bool ZAddressRangeMapIterator<T, AddressRangeShift>::next(T* value) { inline bool ZGranuleMapIterator<T>::next(T* value) {
if (_next < _map->size()) { if (_next < _map->size()) {
*value = _map->_map[_next++]; *value = _map->_map[_next++];
return true; return true;
@ -81,4 +81,4 @@ inline bool ZAddressRangeMapIterator<T, AddressRangeShift>::next(T* value) {
return false; return false;
} }
#endif // SHARE_GC_Z_ZADDRESSRANGEMAP_INLINE_HPP #endif // SHARE_GC_Z_ZGRANULEMAP_INLINE_HPP

View file

@ -22,9 +22,9 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "gc/z/zAddressRangeMap.inline.hpp"
#include "gc/z/zBarrier.inline.hpp" #include "gc/z/zBarrier.inline.hpp"
#include "gc/z/zGlobals.hpp" #include "gc/z/zGlobals.hpp"
#include "gc/z/zGranuleMap.inline.hpp"
#include "gc/z/zHeapIterator.hpp" #include "gc/z/zHeapIterator.hpp"
#include "gc/z/zOop.inline.hpp" #include "gc/z/zOop.inline.hpp"
#include "gc/z/zRootsIterator.hpp" #include "gc/z/zRootsIterator.hpp"

View file

@ -24,11 +24,11 @@
#ifndef SHARE_GC_Z_ZHEAPITERATOR_HPP #ifndef SHARE_GC_Z_ZHEAPITERATOR_HPP
#define SHARE_GC_Z_ZHEAPITERATOR_HPP #define SHARE_GC_Z_ZHEAPITERATOR_HPP
#include "gc/z/zAddressRangeMap.hpp" #include "gc/z/zGranuleMap.hpp"
#include "gc/z/zGlobals.hpp"
#include "memory/allocation.hpp" #include "memory/allocation.hpp"
#include "utilities/stack.hpp" #include "utilities/stack.hpp"
class ObjectClosure;
class ZHeapIteratorBitMap; class ZHeapIteratorBitMap;
class ZHeapIterator : public StackObj { class ZHeapIterator : public StackObj {
@ -36,8 +36,8 @@ class ZHeapIterator : public StackObj {
friend class ZHeapIteratorOopClosure; friend class ZHeapIteratorOopClosure;
private: private:
typedef ZAddressRangeMap<ZHeapIteratorBitMap*, ZGranuleSizeShift> ZVisitMap; typedef ZGranuleMap<ZHeapIteratorBitMap*> ZVisitMap;
typedef ZAddressRangeMapIterator<ZHeapIteratorBitMap*, ZGranuleSizeShift> ZVisitMapIterator; typedef ZGranuleMapIterator<ZHeapIteratorBitMap*> ZVisitMapIterator;
typedef Stack<oop, mtGC> ZVisitStack; typedef Stack<oop, mtGC> ZVisitStack;
ZVisitStack _visit_stack; ZVisitStack _visit_stack;

View file

@ -22,6 +22,7 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "gc/z/zAddress.inline.hpp"
#include "gc/z/zPage.inline.hpp" #include "gc/z/zPage.inline.hpp"
#include "gc/z/zPageTable.inline.hpp" #include "gc/z/zPageTable.inline.hpp"
#include "runtime/orderAccess.hpp" #include "runtime/orderAccess.hpp"

View file

@ -24,8 +24,7 @@
#ifndef SHARE_GC_Z_ZPAGETABLE_HPP #ifndef SHARE_GC_Z_ZPAGETABLE_HPP
#define SHARE_GC_Z_ZPAGETABLE_HPP #define SHARE_GC_Z_ZPAGETABLE_HPP
#include "gc/z/zAddressRangeMap.hpp" #include "gc/z/zGranuleMap.hpp"
#include "gc/z/zGlobals.hpp"
#include "gc/z/zPageTableEntry.hpp" #include "gc/z/zPageTableEntry.hpp"
#include "memory/allocation.hpp" #include "memory/allocation.hpp"
@ -36,7 +35,7 @@ class ZPageTable {
friend class ZPageTableIterator; friend class ZPageTableIterator;
private: private:
ZAddressRangeMap<ZPageTableEntry, ZGranuleSizeShift> _map; ZGranuleMap<ZPageTableEntry> _map;
ZPageTableEntry get_entry(ZPage* page) const; ZPageTableEntry get_entry(ZPage* page) const;
void put_entry(ZPage* page, ZPageTableEntry entry); void put_entry(ZPage* page, ZPageTableEntry entry);
@ -55,7 +54,7 @@ public:
class ZPageTableIterator : public StackObj { class ZPageTableIterator : public StackObj {
private: private:
ZAddressRangeMapIterator<ZPageTableEntry, ZGranuleSizeShift> _iter; ZGranuleMapIterator<ZPageTableEntry> _iter;
ZPage* _prev; ZPage* _prev;
public: public:

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
#define SHARE_GC_Z_ZPAGETABLE_INLINE_HPP #define SHARE_GC_Z_ZPAGETABLE_INLINE_HPP
#include "gc/z/zAddress.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" #include "gc/z/zPageTable.hpp"
inline ZPage* ZPageTable::get(uintptr_t addr) const { inline ZPage* ZPageTable::get(uintptr_t addr) const {

View file

@ -31,7 +31,7 @@ import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.Type; import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase; import sun.jvm.hotspot.types.TypeDataBase;
public class ZAddressRangeMapForPageTable extends VMObject { public class ZGranuleMapForPageTable extends VMObject {
private static AddressField mapField; private static AddressField mapField;
static { static {
@ -39,12 +39,12 @@ public class ZAddressRangeMapForPageTable extends VMObject {
} }
static private synchronized void initialize(TypeDataBase db) { static private synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("ZAddressRangeMapForPageTable"); Type type = db.lookupType("ZGranuleMapForPageTable");
mapField = type.getAddressField("_map"); mapField = type.getAddressField("_map");
} }
public ZAddressRangeMapForPageTable(Address addr) { public ZGranuleMapForPageTable(Address addr) {
super(addr); super(addr);
} }

View file

@ -50,8 +50,8 @@ public class ZPageTable extends VMObject {
super(addr); super(addr);
} }
private ZAddressRangeMapForPageTable map() { private ZGranuleMapForPageTable map() {
return (ZAddressRangeMapForPageTable)VMObjectFactory.newObject(ZAddressRangeMapForPageTable.class, addr.addOffsetTo(mapFieldOffset)); return (ZGranuleMapForPageTable)VMObjectFactory.newObject(ZGranuleMapForPageTable.class, addr.addOffsetTo(mapFieldOffset));
} }
private ZPageTableEntry getEntry(Address o) { private ZPageTableEntry getEntry(Address o) {
@ -67,7 +67,7 @@ public class ZPageTable extends VMObject {
} }
private class ZPagesIterator implements Iterator<ZPage> { private class ZPagesIterator implements Iterator<ZPage> {
private ZAddressRangeMapForPageTable.Iterator mapIter; private ZGranuleMapForPageTable.Iterator mapIter;
private ZPage next; private ZPage next;
ZPagesIterator() { ZPagesIterator() {