author | pliden |
Thu, 03 Oct 2019 10:56:39 +0200 | |
changeset 58453 | ca80b8395923 |
parent 58294 | 872465abbfe3 |
child 58679 | 9c3209ff7550 |
child 58787 | 32d39d9525f9 |
permissions | -rw-r--r-- |
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
1 |
/* |
54617 | 2 |
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
4 |
* |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
8 |
* |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
13 |
* accompanied this code). |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
14 |
* |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
18 |
* |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
21 |
* questions. |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
22 |
*/ |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
23 |
|
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
24 |
#include "precompiled.hpp" |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
25 |
#include "gc/z/zGlobals.hpp" |
54617 | 26 |
#include "gc/z/zUtils.inline.hpp" |
27 |
#include "runtime/globals.hpp" |
|
28 |
#include "utilities/globalDefinitions.hpp" |
|
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff
changeset
|
29 |
|
54617 | 30 |
// |
31 |
// The heap can have three different layouts, depending on the max heap size. |
|
32 |
// |
|
33 |
// Address Space & Pointer Layout 1 |
|
34 |
// -------------------------------- |
|
35 |
// |
|
36 |
// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB) |
|
37 |
// . . |
|
38 |
// . . |
|
39 |
// . . |
|
40 |
// +--------------------------------+ 0x0000014000000000 (20TB) |
|
41 |
// | Remapped View | |
|
42 |
// +--------------------------------+ 0x0000010000000000 (16TB) |
|
58453
ca80b8395923
8231776: ZGC: Fix incorrect address space description
pliden
parents:
58294
diff
changeset
|
43 |
// . . |
54617 | 44 |
// +--------------------------------+ 0x00000c0000000000 (12TB) |
45 |
// | Marked1 View | |
|
46 |
// +--------------------------------+ 0x0000080000000000 (8TB) |
|
47 |
// | Marked0 View | |
|
48 |
// +--------------------------------+ 0x0000040000000000 (4TB) |
|
49 |
// . . |
|
50 |
// +--------------------------------+ 0x0000000000000000 |
|
51 |
// |
|
52 |
// 6 4 4 4 4 |
|
53 |
// 3 6 5 2 1 0 |
|
54 |
// +--------------------+----+-----------------------------------------------+ |
|
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 2 |
|
69 |
// -------------------------------- |
|
70 |
// |
|
71 |
// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB) |
|
72 |
// . . |
|
73 |
// . . |
|
74 |
// . . |
|
75 |
// +--------------------------------+ 0x0000280000000000 (40TB) |
|
76 |
// | Remapped View | |
|
77 |
// +--------------------------------+ 0x0000200000000000 (32TB) |
|
58453
ca80b8395923
8231776: ZGC: Fix incorrect address space description
pliden
parents:
58294
diff
changeset
|
78 |
// . . |
54617 | 79 |
// +--------------------------------+ 0x0000180000000000 (24TB) |
80 |
// | Marked1 View | |
|
81 |
// +--------------------------------+ 0x0000100000000000 (16TB) |
|
82 |
// | Marked0 View | |
|
83 |
// +--------------------------------+ 0x0000080000000000 (8TB) |
|
84 |
// . . |
|
85 |
// +--------------------------------+ 0x0000000000000000 |
|
86 |
// |
|
87 |
// 6 4 4 4 4 |
|
88 |
// 3 7 6 3 2 0 |
|
89 |
// +------------------+-----+------------------------------------------------+ |
|
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 3 |
|
104 |
// -------------------------------- |
|
105 |
// |
|
106 |
// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB) |
|
107 |
// . . |
|
108 |
// . . |
|
109 |
// . . |
|
110 |
// +--------------------------------+ 0x0000500000000000 (80TB) |
|
111 |
// | Remapped View | |
|
112 |
// +--------------------------------+ 0x0000400000000000 (64TB) |
|
58453
ca80b8395923
8231776: ZGC: Fix incorrect address space description
pliden
parents:
58294
diff
changeset
|
113 |
// . . |
54617 | 114 |
// +--------------------------------+ 0x0000300000000000 (48TB) |
115 |
// | Marked1 View | |
|
116 |
// +--------------------------------+ 0x0000200000000000 (32TB) |
|
117 |
// | Marked0 View | |
|
118 |
// +--------------------------------+ 0x0000100000000000 (16TB) |
|
119 |
// . . |
|
120 |
// +--------------------------------+ 0x0000000000000000 |
|
121 |
// |
|
122 |
// 6 4 4 4 4 |
|
123 |
// 3 8 7 4 3 0 |
|
124 |
// +------------------+----+-------------------------------------------------+ |
|
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 |
// |
|
137 |
||
138 |
uintptr_t ZPlatformAddressBase() { |
|
139 |
return 0; |
|
140 |
} |
|
141 |
||
142 |
size_t ZPlatformAddressOffsetBits() { |
|
143 |
const size_t min_address_offset_bits = 42; // 4TB |
|
144 |
const size_t max_address_offset_bits = 44; // 16TB |
|
145 |
const size_t virtual_to_physical_ratio = 7; // 7:1 |
|
146 |
const size_t address_offset = ZUtils::round_up_power_of_2(MaxHeapSize * virtual_to_physical_ratio); |
|
147 |
const size_t address_offset_bits = log2_intptr(address_offset); |
|
148 |
return MIN2(MAX2(address_offset_bits, min_address_offset_bits), max_address_offset_bits); |
|
149 |
} |
|
150 |
||
151 |
size_t ZPlatformAddressMetadataShift() { |
|
152 |
return ZPlatformAddressOffsetBits(); |
|
153 |
} |