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