8221786: ZGC: Increase max heap size to 16TB

Reviewed-by: stefank
This commit is contained in:
Per Lidén 2019-04-25 08:55:50 +02:00
parent 2accc59e60
commit 86808b9d47
14 changed files with 294 additions and 174 deletions

View File

@ -1,31 +0,0 @@
/*
* Copyright (c) 2016, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifndef OS_CPU_LINUX_X86_GC_Z_ZADDRESS_LINUX_X86_INLINE_HPP
#define OS_CPU_LINUX_X86_GC_Z_ZADDRESS_LINUX_X86_INLINE_HPP
inline uintptr_t ZAddress::address(uintptr_t value) {
return value;
}
#endif // OS_CPU_LINUX_X86_GC_Z_ZADDRESS_LINUX_X86_INLINE_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
@ -23,11 +23,151 @@
#include "precompiled.hpp"
#include "gc/z/zGlobals.hpp"
#include "gc/z/zUtils.inline.hpp"
#include "runtime/globals.hpp"
#include "utilities/globalDefinitions.hpp"
uintptr_t ZAddressReservedStart() {
return ZAddressMetadataMarked0;
//
// The heap can have three different layouts, depending on the max heap size.
//
// Address Space & Pointer Layout 1
// --------------------------------
//
// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB)
// . .
// . .
// . .
// +--------------------------------+ 0x0000014000000000 (20TB)
// | Remapped View |
// +--------------------------------+ 0x0000010000000000 (16TB)
// | (Reserved, but unused) |
// +--------------------------------+ 0x00000c0000000000 (12TB)
// | Marked1 View |
// +--------------------------------+ 0x0000080000000000 (8TB)
// | Marked0 View |
// +--------------------------------+ 0x0000040000000000 (4TB)
// . .
// +--------------------------------+ 0x0000000000000000
//
// 6 4 4 4 4
// 3 6 5 2 1 0
// +--------------------+----+-----------------------------------------------+
// |00000000 00000000 00|1111|11 11111111 11111111 11111111 11111111 11111111|
// +--------------------+----+-----------------------------------------------+
// | | |
// | | * 41-0 Object Offset (42-bits, 4TB address space)
// | |
// | * 45-42 Metadata Bits (4-bits) 0001 = Marked0 (Address view 4-8TB)
// | 0010 = Marked1 (Address view 8-12TB)
// | 0100 = Remapped (Address view 16-20TB)
// | 1000 = Finalizable (Address view N/A)
// |
// * 63-46 Fixed (18-bits, always zero)
//
//
// Address Space & Pointer Layout 2
// --------------------------------
//
// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB)
// . .
// . .
// . .
// +--------------------------------+ 0x0000280000000000 (40TB)
// | Remapped View |
// +--------------------------------+ 0x0000200000000000 (32TB)
// | (Reserved, but unused) |
// +--------------------------------+ 0x0000180000000000 (24TB)
// | Marked1 View |
// +--------------------------------+ 0x0000100000000000 (16TB)
// | Marked0 View |
// +--------------------------------+ 0x0000080000000000 (8TB)
// . .
// +--------------------------------+ 0x0000000000000000
//
// 6 4 4 4 4
// 3 7 6 3 2 0
// +------------------+-----+------------------------------------------------+
// |00000000 00000000 0|1111|111 11111111 11111111 11111111 11111111 11111111|
// +-------------------+----+------------------------------------------------+
// | | |
// | | * 42-0 Object Offset (43-bits, 8TB address space)
// | |
// | * 46-43 Metadata Bits (4-bits) 0001 = Marked0 (Address view 8-16TB)
// | 0010 = Marked1 (Address view 16-24TB)
// | 0100 = Remapped (Address view 32-40TB)
// | 1000 = Finalizable (Address view N/A)
// |
// * 63-47 Fixed (17-bits, always zero)
//
//
// Address Space & Pointer Layout 3
// --------------------------------
//
// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB)
// . .
// . .
// . .
// +--------------------------------+ 0x0000500000000000 (80TB)
// | Remapped View |
// +--------------------------------+ 0x0000400000000000 (64TB)
// | (Reserved, but unused) |
// +--------------------------------+ 0x0000300000000000 (48TB)
// | Marked1 View |
// +--------------------------------+ 0x0000200000000000 (32TB)
// | Marked0 View |
// +--------------------------------+ 0x0000100000000000 (16TB)
// . .
// +--------------------------------+ 0x0000000000000000
//
// 6 4 4 4 4
// 3 8 7 4 3 0
// +------------------+----+-------------------------------------------------+
// |00000000 00000000 |1111|1111 11111111 11111111 11111111 11111111 11111111|
// +------------------+----+-------------------------------------------------+
// | | |
// | | * 43-0 Object Offset (44-bits, 16TB address space)
// | |
// | * 47-44 Metadata Bits (4-bits) 0001 = Marked0 (Address view 16-32TB)
// | 0010 = Marked1 (Address view 32-48TB)
// | 0100 = Remapped (Address view 64-80TB)
// | 1000 = Finalizable (Address view N/A)
// |
// * 63-48 Fixed (16-bits, always zero)
//
uintptr_t ZPlatformAddressSpaceStart() {
const uintptr_t first_heap_view_address = (uintptr_t)1 << (ZPlatformAddressMetadataShift() + 0);
const size_t min_address_offset = 0;
return first_heap_view_address + min_address_offset;
}
uintptr_t ZAddressReservedEnd() {
return ZAddressMetadataRemapped + ZAddressOffsetMax;
uintptr_t ZPlatformAddressSpaceEnd() {
const uintptr_t last_heap_view_address = (uintptr_t)1 << (ZPlatformAddressMetadataShift() + 2);
const size_t max_address_offset = (size_t)1 << ZPlatformAddressOffsetBits();
return last_heap_view_address + max_address_offset;
}
uintptr_t ZPlatformAddressReservedStart() {
return ZPlatformAddressSpaceStart();
}
uintptr_t ZPlatformAddressReservedEnd() {
return ZPlatformAddressSpaceEnd();
}
uintptr_t ZPlatformAddressBase() {
return 0;
}
size_t ZPlatformAddressOffsetBits() {
const size_t min_address_offset_bits = 42; // 4TB
const size_t max_address_offset_bits = 44; // 16TB
const size_t virtual_to_physical_ratio = 7; // 7:1
const size_t address_offset = ZUtils::round_up_power_of_2(MaxHeapSize * virtual_to_physical_ratio);
const size_t address_offset_bits = log2_intptr(address_offset);
return MIN2(MAX2(address_offset_bits, min_address_offset_bits), max_address_offset_bits);
}
size_t ZPlatformAddressMetadataShift() {
return ZPlatformAddressOffsetBits();
}

View File

@ -35,56 +35,17 @@
// Large X*M > 4M 2M
// ------------------------------------------------------------------
//
//
// Address Space & Pointer Layout
// ------------------------------
//
// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB)
// . .
// . .
// . .
// +--------------------------------+ 0x0000140000000000 (20TB)
// | Remapped View |
// +--------------------------------+ 0x0000100000000000 (16TB)
// | (Reserved, but unused) |
// +--------------------------------+ 0x00000c0000000000 (12TB)
// | Marked1 View |
// +--------------------------------+ 0x0000080000000000 (8TB)
// | Marked0 View |
// +--------------------------------+ 0x0000040000000000 (4TB)
// . .
// +--------------------------------+ 0x0000000000000000
//
//
// 6 4 4 4 4 4 0
// 3 7 6 5 2 1 0
// +-------------------+-+----+-----------------------------------------------+
// |00000000 00000000 0|0|1111|11 11111111 11111111 11111111 11111111 11111111|
// +-------------------+-+----+-----------------------------------------------+
// | | | |
// | | | * 41-0 Object Offset (42-bits, 4TB address space)
// | | |
// | | * 45-42 Metadata Bits (4-bits) 0001 = Marked0 (Address view 4-8TB)
// | | 0010 = Marked1 (Address view 8-12TB)
// | | 0100 = Remapped (Address view 16-20TB)
// | | 1000 = Finalizable (Address view N/A)
// | |
// | * 46-46 Unused (1-bit, always zero)
// |
// * 63-47 Fixed (17-bits, always zero)
//
const size_t ZPlatformGranuleSizeShift = 21; // 2MB
const size_t ZPlatformMaxHeapSizeShift = 46; // 16TB
const size_t ZPlatformNMethodDisarmedOffset = 4;
const size_t ZPlatformCacheLineSize = 64;
const size_t ZPlatformGranuleSizeShift = 21; // 2M
const size_t ZPlatformAddressOffsetBits = 42; // 4TB
const uintptr_t ZPlatformAddressMetadataShift = ZPlatformAddressOffsetBits;
const uintptr_t ZPlatformAddressSpaceStart = (uintptr_t)1 << ZPlatformAddressOffsetBits;
const uintptr_t ZPlatformAddressSpaceSize = ((uintptr_t)1 << ZPlatformAddressOffsetBits) * 4;
const size_t ZPlatformNMethodDisarmedOffset = 4;
const size_t ZPlatformCacheLineSize = 64;
uintptr_t ZPlatformAddressSpaceStart();
uintptr_t ZPlatformAddressSpaceEnd();
uintptr_t ZPlatformAddressReservedStart();
uintptr_t ZPlatformAddressReservedEnd();
uintptr_t ZPlatformAddressBase();
size_t ZPlatformAddressOffsetBits();
size_t ZPlatformAddressMetadataShift();
#endif // OS_CPU_LINUX_X86_GC_Z_ZGLOBALS_LINUX_X86_HPP

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, 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
@ -22,27 +22,47 @@
*/
#include "precompiled.hpp"
#include "gc/z/zAddress.inline.hpp"
#include "gc/z/zAddress.hpp"
#include "gc/z/zGlobals.hpp"
#include "runtime/thread.hpp"
void ZAddressMasks::set_good_mask(uintptr_t mask) {
uintptr_t old_bad_mask = ZAddressBadMask;
void ZAddress::set_good_mask(uintptr_t mask) {
ZAddressGoodMask = mask;
ZAddressBadMask = ZAddressGoodMask ^ ZAddressMetadataMask;
ZAddressWeakBadMask = (ZAddressGoodMask | ZAddressMetadataRemapped | ZAddressMetadataFinalizable) ^ ZAddressMetadataMask;
}
void ZAddressMasks::initialize() {
void ZAddress::initialize() {
ZAddressSpaceStart = ZPlatformAddressSpaceStart();
ZAddressSpaceEnd = ZPlatformAddressSpaceEnd();
ZAddressSpaceSize = ZAddressSpaceEnd - ZAddressSpaceStart;
ZAddressReservedStart = ZPlatformAddressReservedStart();
ZAddressReservedEnd = ZPlatformAddressReservedEnd();
ZAddressReservedSize = ZAddressReservedEnd - ZAddressReservedStart;
ZAddressBase = ZPlatformAddressBase();
ZAddressOffsetBits = ZPlatformAddressOffsetBits();
ZAddressOffsetMask = (((uintptr_t)1 << ZAddressOffsetBits) - 1) << ZAddressOffsetShift;
ZAddressOffsetMax = (uintptr_t)1 << ZAddressOffsetBits;
ZAddressMetadataShift = ZPlatformAddressMetadataShift();
ZAddressMetadataMask = (((uintptr_t)1 << ZAddressMetadataBits) - 1) << ZAddressMetadataShift;
ZAddressMetadataMarked0 = (uintptr_t)1 << (ZAddressMetadataShift + 0);
ZAddressMetadataMarked1 = (uintptr_t)1 << (ZAddressMetadataShift + 1);
ZAddressMetadataRemapped = (uintptr_t)1 << (ZAddressMetadataShift + 2);
ZAddressMetadataFinalizable = (uintptr_t)1 << (ZAddressMetadataShift + 3);
ZAddressMetadataMarked = ZAddressMetadataMarked0;
set_good_mask(ZAddressMetadataRemapped);
}
void ZAddressMasks::flip_to_marked() {
void ZAddress::flip_to_marked() {
ZAddressMetadataMarked ^= (ZAddressMetadataMarked0 | ZAddressMetadataMarked1);
set_good_mask(ZAddressMetadataMarked);
}
void ZAddressMasks::flip_to_remapped() {
void ZAddress::flip_to_remapped() {
set_good_mask(ZAddressMetadataRemapped);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, 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
@ -27,7 +27,17 @@
#include "memory/allocation.hpp"
class ZAddress : public AllStatic {
friend class ZAddressTest;
private:
static void set_good_mask(uintptr_t mask);
public:
static void initialize();
static void flip_to_marked();
static void flip_to_remapped();
static bool is_null(uintptr_t value);
static bool is_bad(uintptr_t value);
static bool is_good(uintptr_t value);
@ -52,16 +62,4 @@ public:
static uintptr_t remapped_or_null(uintptr_t value);
};
class ZAddressMasks : public AllStatic {
friend class ZAddressTest;
private:
static void set_good_mask(uintptr_t mask);
public:
static void initialize();
static void flip_to_marked();
static void flip_to_remapped();
};
#endif // SHARE_GC_Z_ZADDRESS_HPP

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
@ -27,7 +27,6 @@
#include "gc/z/zAddress.hpp"
#include "gc/z/zGlobals.hpp"
#include "utilities/macros.hpp"
#include OS_CPU_HEADER_INLINE(gc/z/zAddress)
inline bool ZAddress::is_null(uintptr_t value) {
return value == 0;
@ -82,6 +81,10 @@ inline bool ZAddress::is_remapped(uintptr_t value) {
return value & ZAddressMetadataRemapped;
}
inline uintptr_t ZAddress::address(uintptr_t value) {
return value | ZAddressBase;
}
inline uintptr_t ZAddress::offset(uintptr_t value) {
return value & ZAddressOffsetMask;
}

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
@ -30,13 +30,14 @@
#include "runtime/globals.hpp"
#include "runtime/globals_extension.hpp"
size_t ZArguments::conservative_max_heap_alignment() {
return 0;
}
void ZArguments::initialize() {
GCArguments::initialize();
// Check max heap size
if (MaxHeapSize > ZMaxHeapSize) {
vm_exit_during_initialization("Java heap too large");
}
// Enable NUMA by default
if (FLAG_IS_DEFAULT(UseNUMA)) {
FLAG_SET_DEFAULT(UseNUMA, true);
@ -95,6 +96,10 @@ void ZArguments::initialize() {
initialize_platform();
}
size_t ZArguments::conservative_max_heap_alignment() {
return 0;
}
CollectedHeap* ZArguments::create_heap() {
return create_heap_with_policy<ZCollectedHeap, ZCollectorPolicy>();
}

View File

@ -56,7 +56,7 @@ CollectedHeap::Name ZCollectedHeap::kind() const {
}
const char* ZCollectedHeap::name() const {
return ZGCName;
return ZName;
}
jint ZCollectedHeap::initialize() {
@ -64,8 +64,8 @@ jint ZCollectedHeap::initialize() {
return JNI_ENOMEM;
}
initialize_reserved_region((HeapWord*)ZAddressReservedStart(),
(HeapWord*)ZAddressReservedEnd());
initialize_reserved_region((HeapWord*)ZAddressReservedStart,
(HeapWord*)ZAddressReservedEnd);
return JNI_OK;
}

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
@ -31,7 +31,28 @@ const int& ZObjectAlignmentSmallShift = LogMinObjAlignmentInBytes;
const int& ZObjectAlignmentSmall = MinObjAlignmentInBytes;
uintptr_t ZAddressGoodMask;
uintptr_t ZAddressBadMask = 0;
uintptr_t ZAddressBadMask;
uintptr_t ZAddressWeakBadMask;
uintptr_t ZAddressBase;
size_t ZAddressOffsetBits;
uintptr_t ZAddressOffsetMask;
size_t ZAddressOffsetMax;
size_t ZAddressMetadataShift;
uintptr_t ZAddressMetadataMask;
uintptr_t ZAddressMetadataMarked;
uintptr_t ZAddressMetadataMarked0;
uintptr_t ZAddressMetadataMarked1;
uintptr_t ZAddressMetadataRemapped;
uintptr_t ZAddressMetadataFinalizable;
uintptr_t ZAddressSpaceStart;
uintptr_t ZAddressSpaceEnd;
size_t ZAddressSpaceSize;
uintptr_t ZAddressReservedStart;
uintptr_t ZAddressReservedEnd;
size_t ZAddressReservedSize;

View File

@ -29,7 +29,7 @@
#include OS_CPU_HEADER(gc/z/zGlobals)
// Collector name
const char* const ZGCName = "The Z Garbage Collector";
const char* const ZName = "The Z Garbage Collector";
// Global phase state
extern uint32_t ZGlobalPhase;
@ -44,6 +44,10 @@ extern uint32_t ZGlobalSeqNum;
const size_t ZGranuleSizeShift = ZPlatformGranuleSizeShift;
const size_t ZGranuleSize = (size_t)1 << ZGranuleSizeShift;
// Max heap size shift/size
const size_t ZMaxHeapSizeShift = ZPlatformMaxHeapSizeShift;
const size_t ZMaxHeapSize = (size_t)1 << ZMaxHeapSizeShift;
// Page types
const uint8_t ZPageTypeSmall = 0;
const uint8_t ZPageTypeMedium = 1;
@ -71,38 +75,6 @@ extern const int& ZObjectAlignmentSmall;
const int ZObjectAlignmentMedium = 1 << ZObjectAlignmentMediumShift;
const int ZObjectAlignmentLarge = 1 << ZObjectAlignmentLargeShift;
// Pointer part of address
const uintptr_t ZAddressOffsetShift = 0;
const uintptr_t ZAddressOffsetBits = ZPlatformAddressOffsetBits;
const uintptr_t ZAddressOffsetMask = (((uintptr_t)1 << ZAddressOffsetBits) - 1) << ZAddressOffsetShift;
const size_t ZAddressOffsetMax = (uintptr_t)1 << ZAddressOffsetBits;
// Metadata part of address
const uintptr_t ZAddressMetadataShift = ZPlatformAddressMetadataShift;
const uintptr_t ZAddressMetadataBits = 4;
const uintptr_t ZAddressMetadataMask = (((uintptr_t)1 << ZAddressMetadataBits) - 1) << ZAddressMetadataShift;
// Metadata types
const uintptr_t ZAddressMetadataMarked0 = (uintptr_t)1 << (ZAddressMetadataShift + 0);
const uintptr_t ZAddressMetadataMarked1 = (uintptr_t)1 << (ZAddressMetadataShift + 1);
const uintptr_t ZAddressMetadataRemapped = (uintptr_t)1 << (ZAddressMetadataShift + 2);
const uintptr_t ZAddressMetadataFinalizable = (uintptr_t)1 << (ZAddressMetadataShift + 3);
// Address space start/end/size
const uintptr_t ZAddressSpaceStart = ZPlatformAddressSpaceStart;
const uintptr_t ZAddressSpaceSize = ZPlatformAddressSpaceSize;
const uintptr_t ZAddressSpaceEnd = ZAddressSpaceStart + ZAddressSpaceSize;
// NMethod entry barrier
const size_t ZNMethodDisarmedOffset = ZPlatformNMethodDisarmedOffset;
// Cache line size
const size_t ZCacheLineSize = ZPlatformCacheLineSize;
// Reserved start/end
uintptr_t ZAddressReservedStart();
uintptr_t ZAddressReservedEnd();
//
// Good/Bad mask states
// --------------------
@ -119,8 +91,42 @@ extern uintptr_t ZAddressGoodMask;
extern uintptr_t ZAddressBadMask;
extern uintptr_t ZAddressWeakBadMask;
// Marked state
// Pointer base address
extern uintptr_t ZAddressBase;
// Pointer part of address
extern size_t ZAddressOffsetBits;
const size_t ZAddressOffsetShift = 0;
extern uintptr_t ZAddressOffsetMask;
extern size_t ZAddressOffsetMax;
// Metadata part of address
const size_t ZAddressMetadataBits = 4;
extern size_t ZAddressMetadataShift;
extern uintptr_t ZAddressMetadataMask;
// Metadata types
extern uintptr_t ZAddressMetadataMarked;
extern uintptr_t ZAddressMetadataMarked0;
extern uintptr_t ZAddressMetadataMarked1;
extern uintptr_t ZAddressMetadataRemapped;
extern uintptr_t ZAddressMetadataFinalizable;
// Address space start/end/size
extern uintptr_t ZAddressSpaceStart;
extern uintptr_t ZAddressSpaceEnd;
extern size_t ZAddressSpaceSize;
// Reserved space start/end
extern uintptr_t ZAddressReservedStart;
extern uintptr_t ZAddressReservedEnd;
extern size_t ZAddressReservedSize;
// NMethod entry barrier
const size_t ZNMethodDisarmedOffset = ZPlatformNMethodDisarmedOffset;
// Cache line size
const size_t ZCacheLineSize = ZPlatformCacheLineSize;
// Mark stack space
extern uintptr_t ZMarkStackSpaceStart;

View File

@ -173,7 +173,7 @@ size_t ZHeap::unsafe_max_tlab_alloc() const {
}
bool ZHeap::is_in(uintptr_t addr) const {
if (addr < ZAddressReservedStart() || addr >= ZAddressReservedEnd()) {
if (addr < ZAddressReservedStart || addr >= ZAddressReservedEnd) {
return false;
}
@ -269,13 +269,13 @@ void ZHeap::after_flip() {
void ZHeap::flip_to_marked() {
before_flip();
ZAddressMasks::flip_to_marked();
ZAddress::flip_to_marked();
after_flip();
}
void ZHeap::flip_to_remapped() {
before_flip();
ZAddressMasks::flip_to_remapped();
ZAddress::flip_to_remapped();
after_flip();
}

View File

@ -36,13 +36,13 @@
#include "runtime/vm_version.hpp"
ZInitialize::ZInitialize(ZBarrierSet* barrier_set) {
log_info(gc, init)("Initializing %s", ZGCName);
log_info(gc, init)("Initializing %s", ZName);
log_info(gc, init)("Version: %s (%s)",
VM_Version::vm_release(),
VM_Version::jdk_debug_level());
// Early initialization
ZAddressMasks::initialize();
ZAddress::initialize();
ZNUMA::initialize();
ZCPU::initialize();
ZStatValue::initialize();

View File

@ -24,11 +24,16 @@
#include "precompiled.hpp"
#include "gc/z/zGlobals.hpp"
#include "gc/z/zVirtualMemory.inline.hpp"
#include "logging/log.hpp"
#include "services/memTracker.hpp"
ZVirtualMemoryManager::ZVirtualMemoryManager() :
_manager(),
_initialized(false) {
log_info(gc, init)("Address Space: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "T)",
ZAddressSpaceStart, ZAddressSpaceEnd, ZAddressSpaceSize / K / G);
// Reserve address space
if (!reserve(ZAddressSpaceStart, ZAddressSpaceSize)) {
return;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, 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
@ -30,9 +30,8 @@ class ZAddressTest : public ::testing::Test {
protected:
static void is_good_bit(uintptr_t bit_mask) {
// Setup
uintptr_t mask_before = ZAddressGoodMask;
ZAddressMasks::set_good_mask(bit_mask);
ZAddress::initialize();
ZAddress::set_good_mask(bit_mask);
// Test that a pointer with only the given bit is considered good.
EXPECT_EQ(ZAddress::is_good(ZAddressMetadataMarked0), (bit_mask == ZAddressMetadataMarked0));
@ -46,16 +45,12 @@ protected:
// Test that null is not considered good.
EXPECT_FALSE(ZAddress::is_good(0));
// Teardown
ZAddressMasks::set_good_mask(mask_before);
}
static void is_good_or_null_bit(uintptr_t bit_mask) {
// Setup
uintptr_t mask_before = ZAddressGoodMask;
ZAddressMasks::set_good_mask(bit_mask);
ZAddress::initialize();
ZAddress::set_good_mask(bit_mask);
// Test that a pointer with only the given bit is considered good.
EXPECT_EQ(ZAddress::is_good_or_null(ZAddressMetadataMarked0), (bit_mask == ZAddressMetadataMarked0));
@ -69,15 +64,12 @@ protected:
// Test that null is considered good_or_null.
EXPECT_TRUE(ZAddress::is_good_or_null(0));
// Teardown
ZAddressMasks::set_good_mask(mask_before);
}
static void finalizable() {
// Setup
ZAddressMasks::initialize();
ZAddressMasks::flip_to_marked();
ZAddress::initialize();
ZAddress::flip_to_marked();
// Test that a normal good pointer is good and weak good, but not finalizable
const uintptr_t addr1 = ZAddress::good(1);
@ -100,7 +92,7 @@ protected:
EXPECT_FALSE(ZAddress::is_good_or_null(addr2));
// Flip to remapped and test that it's no longer weak good
ZAddressMasks::flip_to_remapped();
ZAddress::flip_to_remapped();
EXPECT_TRUE(ZAddress::is_finalizable(addr2));
EXPECT_TRUE(ZAddress::is_marked(addr2));
EXPECT_FALSE(ZAddress::is_remapped(addr2));