Path: blob/master/src/hotspot/cpu/x86/gc/z/zGlobals_x86.cpp
41153 views
/*1* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223#include "precompiled.hpp"24#include "gc/shared/gc_globals.hpp"25#include "gc/z/zGlobals.hpp"26#include "runtime/globals.hpp"27#include "utilities/globalDefinitions.hpp"28#include "utilities/powerOfTwo.hpp"2930//31// The heap can have three different layouts, depending on the max heap size.32//33// Address Space & Pointer Layout 134// --------------------------------35//36// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB)37// . .38// . .39// . .40// +--------------------------------+ 0x0000014000000000 (20TB)41// | Remapped View |42// +--------------------------------+ 0x0000010000000000 (16TB)43// . .44// +--------------------------------+ 0x00000c0000000000 (12TB)45// | Marked1 View |46// +--------------------------------+ 0x0000080000000000 (8TB)47// | Marked0 View |48// +--------------------------------+ 0x0000040000000000 (4TB)49// . .50// +--------------------------------+ 0x000000000000000051//52// 6 4 4 4 453// 3 6 5 2 1 054// +--------------------+----+-----------------------------------------------+55// |00000000 00000000 00|1111|11 11111111 11111111 11111111 11111111 11111111|56// +--------------------+----+-----------------------------------------------+57// | | |58// | | * 41-0 Object Offset (42-bits, 4TB address space)59// | |60// | * 45-42 Metadata Bits (4-bits) 0001 = Marked0 (Address view 4-8TB)61// | 0010 = Marked1 (Address view 8-12TB)62// | 0100 = Remapped (Address view 16-20TB)63// | 1000 = Finalizable (Address view N/A)64// |65// * 63-46 Fixed (18-bits, always zero)66//67//68// Address Space & Pointer Layout 269// --------------------------------70//71// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB)72// . .73// . .74// . .75// +--------------------------------+ 0x0000280000000000 (40TB)76// | Remapped View |77// +--------------------------------+ 0x0000200000000000 (32TB)78// . .79// +--------------------------------+ 0x0000180000000000 (24TB)80// | Marked1 View |81// +--------------------------------+ 0x0000100000000000 (16TB)82// | Marked0 View |83// +--------------------------------+ 0x0000080000000000 (8TB)84// . .85// +--------------------------------+ 0x000000000000000086//87// 6 4 4 4 488// 3 7 6 3 2 089// +------------------+-----+------------------------------------------------+90// |00000000 00000000 0|1111|111 11111111 11111111 11111111 11111111 11111111|91// +-------------------+----+------------------------------------------------+92// | | |93// | | * 42-0 Object Offset (43-bits, 8TB address space)94// | |95// | * 46-43 Metadata Bits (4-bits) 0001 = Marked0 (Address view 8-16TB)96// | 0010 = Marked1 (Address view 16-24TB)97// | 0100 = Remapped (Address view 32-40TB)98// | 1000 = Finalizable (Address view N/A)99// |100// * 63-47 Fixed (17-bits, always zero)101//102//103// Address Space & Pointer Layout 3104// --------------------------------105//106// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB)107// . .108// . .109// . .110// +--------------------------------+ 0x0000500000000000 (80TB)111// | Remapped View |112// +--------------------------------+ 0x0000400000000000 (64TB)113// . .114// +--------------------------------+ 0x0000300000000000 (48TB)115// | Marked1 View |116// +--------------------------------+ 0x0000200000000000 (32TB)117// | Marked0 View |118// +--------------------------------+ 0x0000100000000000 (16TB)119// . .120// +--------------------------------+ 0x0000000000000000121//122// 6 4 4 4 4123// 3 8 7 4 3 0124// +------------------+----+-------------------------------------------------+125// |00000000 00000000 |1111|1111 11111111 11111111 11111111 11111111 11111111|126// +------------------+----+-------------------------------------------------+127// | | |128// | | * 43-0 Object Offset (44-bits, 16TB address space)129// | |130// | * 47-44 Metadata Bits (4-bits) 0001 = Marked0 (Address view 16-32TB)131// | 0010 = Marked1 (Address view 32-48TB)132// | 0100 = Remapped (Address view 64-80TB)133// | 1000 = Finalizable (Address view N/A)134// |135// * 63-48 Fixed (16-bits, always zero)136//137138size_t ZPlatformAddressOffsetBits() {139const size_t min_address_offset_bits = 42; // 4TB140const size_t max_address_offset_bits = 44; // 16TB141const size_t address_offset = round_up_power_of_2(MaxHeapSize * ZVirtualToPhysicalRatio);142const size_t address_offset_bits = log2i_exact(address_offset);143return clamp(address_offset_bits, min_address_offset_bits, max_address_offset_bits);144}145146size_t ZPlatformAddressMetadataShift() {147return ZPlatformAddressOffsetBits();148}149150151