Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_api/HeapIteratorAPIRootIterator.cpp
5985 views
1
/*******************************************************************************
2
* Copyright (c) 2001, 2014 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
#include "HeapIteratorAPIRootIterator.hpp"
23
#include "HeapIteratorAPI.h"
24
25
void
26
HeapIteratorAPI_RootIterator::scanAllSlots()
27
{
28
if(!_nurseryReferencesOnly && !_nurseryReferencesPossibly) {
29
if( _flags & SCAN_CLASSES) {
30
scanClasses();
31
}
32
if( _flags & SCAN_VM_CLASS_SLOTS) {
33
scanVMClassSlots();
34
}
35
}
36
37
if(_flags & SCAN_CLASS_LOADERS) {
38
scanClassLoaders();
39
}
40
41
if(_flags & SCAN_THREADS) {
42
scanThreads();
43
}
44
45
#if defined(J9VM_GC_FINALIZATION)
46
if(_flags & SCAN_FINALIZABLE_OBJECTS) {
47
/* TODO: MM_GCExtensionCore does not contain GC_FinalizeListManager,
48
* which is required to walk finalizable objects.
49
*/
50
scanFinalizableObjects();
51
}
52
#endif /* J9VM_GC_FINALIZATION */
53
54
if(_flags & SCAN_JNI_GLOBAL) {
55
scanJNIGlobalReferences();
56
}
57
if(!_nurseryReferencesOnly && !_nurseryReferencesPossibly) {
58
if(_flags & SCAN_STRING_TABLE) {
59
scanStringTable();
60
}
61
}
62
63
#if defined(J9VM_GC_FINALIZATION)
64
if(_flags & SCAN_UNFINALIZABLE) {
65
scanUnfinalizedObjects();
66
}
67
#endif /* J9VM_GC_FINALIZATION */
68
69
if(_flags & SCAN_MONITORS) {
70
scanMonitorReferences();
71
}
72
73
if(_flags & SCAN_JNI_WEAK) {
74
scanJNIWeakGlobalReferences();
75
}
76
77
#if defined(J9VM_GC_MODRON_SCAVENGER)
78
if(!_nurseryReferencesOnly && !_nurseryReferencesPossibly) {
79
if(_flags & SCAN_REMEBERED_SET) {
80
scanRememberedSet();
81
}
82
}
83
#endif /* J9VM_GC_MODRON_SCAVENGER */
84
85
#if defined(J9VM_OPT_JVMTI)
86
if(_includeJVMTIObjectTagTables) {
87
if(_flags & SCAN_JVMTI_OBJECT_TAG_TABLE) {
88
/* TODO: The J9JVMTI_DATA_FROM_VM is OOP unsafe - convert code when it is. */
89
scanJVMTIObjectTagTables();
90
}
91
}
92
#endif /* J9VM_OPT_JVMTI */
93
94
if (_flags & SCAN_OWNABLE_SYNCHRONIZER) {
95
scanOwnableSynchronizerObjects();
96
}
97
}
98
99
100
void
101
HeapIteratorAPI_RootIterator::doSlot(J9Object** slotPtr)
102
{
103
J9MM_HeapRootSlotDescriptor rootDesc;
104
105
rootDesc.slotType = _scanningEntity;
106
rootDesc.scanType = HEAP_ROOT_SLOT_DESCRIPTOR_OBJECT;
107
rootDesc.slotReachability = _scanningEntityReachability;
108
109
if( NULL != ((void *)*slotPtr) ) {
110
_func((void *)*slotPtr, &rootDesc, _userData);
111
}
112
}
113
114
void
115
HeapIteratorAPI_RootIterator::doObject(J9Object* slotPtr)
116
{
117
J9MM_HeapRootSlotDescriptor rootDesc;
118
119
rootDesc.slotType = _scanningEntity;
120
rootDesc.scanType = HEAP_ROOT_SLOT_DESCRIPTOR_OBJECT;
121
rootDesc.slotReachability = _scanningEntityReachability;
122
123
_func( (void *)slotPtr, &rootDesc, _userData);
124
125
}
126
127
void
128
HeapIteratorAPI_RootIterator::doClass(J9Class *clazz)
129
{
130
J9MM_HeapRootSlotDescriptor rootDesc;
131
132
rootDesc.slotType = _scanningEntity;
133
rootDesc.scanType = HEAP_ROOT_SLOT_DESCRIPTOR_CLASS;
134
rootDesc.slotReachability = _scanningEntityReachability;
135
136
if( NULL != clazz ) {
137
_func( (void *)clazz, &rootDesc, _userData);
138
}
139
}
140
141