Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/gc/z/vmStructs_z.hpp
40957 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
#ifndef SHARE_GC_Z_VMSTRUCTS_Z_HPP
25
#define SHARE_GC_Z_VMSTRUCTS_Z_HPP
26
27
#include "gc/z/zAttachedArray.hpp"
28
#include "gc/z/zCollectedHeap.hpp"
29
#include "gc/z/zForwarding.hpp"
30
#include "gc/z/zGranuleMap.hpp"
31
#include "gc/z/zHeap.hpp"
32
#include "gc/z/zPageAllocator.hpp"
33
#include "utilities/macros.hpp"
34
35
// Expose some ZGC globals to the SA agent.
36
class ZGlobalsForVMStructs {
37
static ZGlobalsForVMStructs _instance;
38
39
public:
40
static ZGlobalsForVMStructs* _instance_p;
41
42
ZGlobalsForVMStructs();
43
44
uint32_t* _ZGlobalPhase;
45
46
uint32_t* _ZGlobalSeqNum;
47
48
uintptr_t* _ZAddressOffsetMask;
49
uintptr_t* _ZAddressMetadataMask;
50
uintptr_t* _ZAddressMetadataFinalizable;
51
uintptr_t* _ZAddressGoodMask;
52
uintptr_t* _ZAddressBadMask;
53
uintptr_t* _ZAddressWeakBadMask;
54
55
const int* _ZObjectAlignmentSmallShift;
56
const int* _ZObjectAlignmentSmall;
57
};
58
59
typedef ZGranuleMap<ZPage*> ZGranuleMapForPageTable;
60
typedef ZGranuleMap<ZForwarding*> ZGranuleMapForForwarding;
61
typedef ZAttachedArray<ZForwarding, ZForwardingEntry> ZAttachedArrayForForwarding;
62
63
#define VM_STRUCTS_ZGC(nonstatic_field, volatile_nonstatic_field, static_field) \
64
static_field(ZGlobalsForVMStructs, _instance_p, ZGlobalsForVMStructs*) \
65
nonstatic_field(ZGlobalsForVMStructs, _ZGlobalPhase, uint32_t*) \
66
nonstatic_field(ZGlobalsForVMStructs, _ZGlobalSeqNum, uint32_t*) \
67
nonstatic_field(ZGlobalsForVMStructs, _ZAddressOffsetMask, uintptr_t*) \
68
nonstatic_field(ZGlobalsForVMStructs, _ZAddressMetadataMask, uintptr_t*) \
69
nonstatic_field(ZGlobalsForVMStructs, _ZAddressMetadataFinalizable, uintptr_t*) \
70
nonstatic_field(ZGlobalsForVMStructs, _ZAddressGoodMask, uintptr_t*) \
71
nonstatic_field(ZGlobalsForVMStructs, _ZAddressBadMask, uintptr_t*) \
72
nonstatic_field(ZGlobalsForVMStructs, _ZAddressWeakBadMask, uintptr_t*) \
73
nonstatic_field(ZGlobalsForVMStructs, _ZObjectAlignmentSmallShift, const int*) \
74
nonstatic_field(ZGlobalsForVMStructs, _ZObjectAlignmentSmall, const int*) \
75
\
76
nonstatic_field(ZCollectedHeap, _heap, ZHeap) \
77
\
78
nonstatic_field(ZHeap, _page_allocator, ZPageAllocator) \
79
nonstatic_field(ZHeap, _page_table, ZPageTable) \
80
nonstatic_field(ZHeap, _forwarding_table, ZForwardingTable) \
81
nonstatic_field(ZHeap, _relocate, ZRelocate) \
82
\
83
nonstatic_field(ZPage, _type, const uint8_t) \
84
nonstatic_field(ZPage, _seqnum, uint32_t) \
85
nonstatic_field(ZPage, _virtual, const ZVirtualMemory) \
86
volatile_nonstatic_field(ZPage, _top, uintptr_t) \
87
\
88
nonstatic_field(ZPageAllocator, _max_capacity, const size_t) \
89
volatile_nonstatic_field(ZPageAllocator, _capacity, size_t) \
90
volatile_nonstatic_field(ZPageAllocator, _used, size_t) \
91
\
92
nonstatic_field(ZPageTable, _map, ZGranuleMapForPageTable) \
93
\
94
nonstatic_field(ZGranuleMapForPageTable, _map, ZPage** const) \
95
nonstatic_field(ZGranuleMapForForwarding, _map, ZForwarding** const) \
96
\
97
nonstatic_field(ZForwardingTable, _map, ZGranuleMapForForwarding) \
98
\
99
nonstatic_field(ZVirtualMemory, _start, const uintptr_t) \
100
nonstatic_field(ZVirtualMemory, _end, const uintptr_t) \
101
\
102
nonstatic_field(ZForwarding, _virtual, const ZVirtualMemory) \
103
nonstatic_field(ZForwarding, _object_alignment_shift, const size_t) \
104
volatile_nonstatic_field(ZForwarding, _ref_count, int) \
105
nonstatic_field(ZForwarding, _entries, const ZAttachedArrayForForwarding) \
106
nonstatic_field(ZForwardingEntry, _entry, uint64_t) \
107
nonstatic_field(ZAttachedArrayForForwarding, _length, const size_t)
108
109
#define VM_INT_CONSTANTS_ZGC(declare_constant, declare_constant_with_value) \
110
declare_constant(ZPhaseRelocate) \
111
declare_constant(ZPageTypeSmall) \
112
declare_constant(ZPageTypeMedium) \
113
declare_constant(ZPageTypeLarge) \
114
declare_constant(ZObjectAlignmentMediumShift) \
115
declare_constant(ZObjectAlignmentLargeShift)
116
117
#define VM_LONG_CONSTANTS_ZGC(declare_constant) \
118
declare_constant(ZGranuleSizeShift) \
119
declare_constant(ZPageSizeSmallShift) \
120
declare_constant(ZPageSizeMediumShift) \
121
declare_constant(ZAddressOffsetShift) \
122
declare_constant(ZAddressOffsetBits) \
123
declare_constant(ZAddressOffsetMask) \
124
declare_constant(ZAddressOffsetMax)
125
126
#define VM_TYPES_ZGC(declare_type, declare_toplevel_type, declare_integer_type) \
127
declare_toplevel_type(ZGlobalsForVMStructs) \
128
declare_type(ZCollectedHeap, CollectedHeap) \
129
declare_toplevel_type(ZHeap) \
130
declare_toplevel_type(ZRelocate) \
131
declare_toplevel_type(ZPage) \
132
declare_toplevel_type(ZPageAllocator) \
133
declare_toplevel_type(ZPageTable) \
134
declare_toplevel_type(ZAttachedArrayForForwarding) \
135
declare_toplevel_type(ZGranuleMapForPageTable) \
136
declare_toplevel_type(ZGranuleMapForForwarding) \
137
declare_toplevel_type(ZVirtualMemory) \
138
declare_toplevel_type(ZForwardingTable) \
139
declare_toplevel_type(ZForwarding) \
140
declare_toplevel_type(ZForwardingEntry) \
141
declare_toplevel_type(ZPhysicalMemoryManager)
142
143
#endif // SHARE_GC_Z_VMSTRUCTS_Z_HPP
144
145