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
#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<ZPageTableEntry, ZGranuleSizeShift> ZAddressRangeMapForPageTable;
typedef ZGranuleMap<ZPageTableEntry> ZGranuleMapForPageTable;
#define VM_STRUCTS_ZGC(nonstatic_field, volatile_nonstatic_field, static_field) \
static_field(ZGlobalsForVMStructs, _instance_p, ZGlobalsForVMStructs*) \
@ -79,18 +79,18 @@ typedef ZAddressRangeMap<ZPageTableEntry, ZGranuleSizeShift> 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<ZPageTableEntry, ZGranuleSizeShift> 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) \

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.
*
* 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<typename T, size_t AddressRangeShift>
class ZAddressRangeMapIterator;
template<typename T>
class ZGranuleMapIterator;
template <typename T, size_t AddressRangeShift>
class ZAddressRangeMap {
template <typename T>
class ZGranuleMap {
friend class VMStructs;
friend class ZAddressRangeMapIterator<T, AddressRangeShift>;
friend class ZGranuleMapIterator<T>;
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 <typename T, size_t AddressRangeShift>
class ZAddressRangeMapIterator : public StackObj {
template <typename T>
class ZGranuleMapIterator : public StackObj {
public:
const ZAddressRangeMap<T, AddressRangeShift>* const _map;
size_t _next;
const ZGranuleMap<T>* const _map;
size_t _next;
public:
ZAddressRangeMapIterator(const ZAddressRangeMap<T, AddressRangeShift>* map);
ZGranuleMapIterator(const ZGranuleMap<T>* map);
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.
*
* 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 <typename T, size_t AddressRangeShift>
ZAddressRangeMap<T, AddressRangeShift>::ZAddressRangeMap() :
template <typename T>
inline ZGranuleMap<T>::ZGranuleMap() :
_map(MmapArrayAllocator<T>::allocate(size(), mtGC)) {}
template <typename T, size_t AddressRangeShift>
ZAddressRangeMap<T, AddressRangeShift>::~ZAddressRangeMap() {
template <typename T>
inline ZGranuleMap<T>::~ZGranuleMap() {
MmapArrayAllocator<T>::free(_map, size());
}
template <typename T, size_t AddressRangeShift>
size_t ZAddressRangeMap<T, AddressRangeShift>::index_for_addr(uintptr_t addr) const {
template <typename T>
inline size_t ZGranuleMap<T>::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 <typename T, size_t AddressRangeShift>
size_t ZAddressRangeMap<T, AddressRangeShift>::size() const {
return ZAddressOffsetMax >> AddressRangeShift;
template <typename T>
inline size_t ZGranuleMap<T>::size() const {
return ZAddressOffsetMax >> ZGranuleSizeShift;
}
template <typename T, size_t AddressRangeShift>
T ZAddressRangeMap<T, AddressRangeShift>::get(uintptr_t addr) const {
const uintptr_t index = index_for_addr(addr);
template <typename T>
inline T ZGranuleMap<T>::get(uintptr_t addr) const {
const size_t index = index_for_addr(addr);
return _map[index];
}
template <typename T, size_t AddressRangeShift>
void ZAddressRangeMap<T, AddressRangeShift>::put(uintptr_t addr, T value) {
const uintptr_t index = index_for_addr(addr);
template <typename T>
inline void ZGranuleMap<T>::put(uintptr_t addr, T value) {
const size_t index = index_for_addr(addr);
_map[index] = value;
}
template <typename T, size_t AddressRangeShift>
inline ZAddressRangeMapIterator<T, AddressRangeShift>::ZAddressRangeMapIterator(const ZAddressRangeMap<T, AddressRangeShift>* map) :
template <typename T>
inline ZGranuleMapIterator<T>::ZGranuleMapIterator(const ZGranuleMap<T>* map) :
_map(map),
_next(0) {}
template <typename T, size_t AddressRangeShift>
inline bool ZAddressRangeMapIterator<T, AddressRangeShift>::next(T* value) {
template <typename T>
inline bool ZGranuleMapIterator<T>::next(T* value) {
if (_next < _map->size()) {
*value = _map->_map[_next++];
return true;
@ -81,4 +81,4 @@ inline bool ZAddressRangeMapIterator<T, AddressRangeShift>::next(T* value) {
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 "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"

View file

@ -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<ZHeapIteratorBitMap*, ZGranuleSizeShift> ZVisitMap;
typedef ZAddressRangeMapIterator<ZHeapIteratorBitMap*, ZGranuleSizeShift> ZVisitMapIterator;
typedef Stack<oop, mtGC> ZVisitStack;
typedef ZGranuleMap<ZHeapIteratorBitMap*> ZVisitMap;
typedef ZGranuleMapIterator<ZHeapIteratorBitMap*> ZVisitMapIterator;
typedef Stack<oop, mtGC> ZVisitStack;
ZVisitStack _visit_stack;
ZVisitMap _visit_map;

View file

@ -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"

View file

@ -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<ZPageTableEntry, ZGranuleSizeShift> _map;
ZGranuleMap<ZPageTableEntry> _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<ZPageTableEntry, ZGranuleSizeShift> _iter;
ZPage* _prev;
ZGranuleMapIterator<ZPageTableEntry> _iter;
ZPage* _prev;
public:
ZPageTableIterator(const ZPageTable* pagetable);

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.
*
* 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 {

View file

@ -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);
}

View file

@ -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<ZPage> {
private ZAddressRangeMapForPageTable.Iterator mapIter;
private ZGranuleMapForPageTable.Iterator mapIter;
private ZPage next;
ZPagesIterator() {