Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_modron_standard/RootScannerReadBarrierVerifier.cpp
5986 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2019 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
23
#include "ReadBarrierVerifier.hpp"
24
25
#include "ObjectAccessBarrier.hpp"
26
#include "RootScannerReadBarrierVerifier.hpp"
27
28
#if defined(OMR_ENV_DATA64) && defined(OMR_GC_FULL_POINTERS)
29
30
void
31
MM_RootScannerReadBarrierVerifier::doMonitorReference(J9ObjectMonitor *objectMonitor, GC_HashTableIterator *monitorReferenceIterator)
32
{
33
J9ThreadAbstractMonitor * monitor = (J9ThreadAbstractMonitor*)objectMonitor->monitor;
34
if (_poison) {
35
((MM_ReadBarrierVerifier*)_extensions->accessBarrier)->poisonSlot(_env->getExtensions(), (omrobjectptr_t *)&monitor->userData);
36
} else {
37
((MM_ReadBarrierVerifier*)_extensions->accessBarrier)->healSlot(_env->getExtensions(), (omrobjectptr_t *)&monitor->userData);
38
}
39
}
40
41
void
42
MM_RootScannerReadBarrierVerifier::doJNIWeakGlobalReference(omrobjectptr_t *slotPtr)
43
{
44
if (_poison) {
45
((MM_ReadBarrierVerifier*)_extensions->accessBarrier)->poisonSlot(_env->getExtensions(), slotPtr);
46
} else {
47
((MM_ReadBarrierVerifier*)_extensions->accessBarrier)->healSlot(_env->getExtensions(), slotPtr);
48
}
49
}
50
51
void
52
MM_RootScannerReadBarrierVerifier::scanClass(MM_EnvironmentBase *env)
53
{
54
OMR_VMThread *omrVMThread = env->getOmrVMThread();
55
GC_SegmentIterator segmentIterator(static_cast<J9JavaVM*>(omrVMThread->_vm->_language_vm)->classMemorySegments, MEMORY_TYPE_RAM_CLASS);
56
57
while (J9MemorySegment *segment = segmentIterator.nextSegment()) {
58
GC_ClassHeapIterator classHeapIterator(static_cast<J9JavaVM*>(omrVMThread->_vm->_language_vm), segment);
59
J9Class *clazz = NULL;
60
61
while (NULL != (clazz = classHeapIterator.nextClass())) {
62
63
volatile omrobjectptr_t *slotPtr = NULL;
64
GC_ClassIterator classIterator(env, clazz);
65
while (NULL != (slotPtr = (omrobjectptr_t*)classIterator.nextSlot())) {
66
doClassVerify((omrobjectptr_t *)slotPtr);
67
}
68
}
69
}
70
}
71
72
void
73
MM_RootScannerReadBarrierVerifier::doClassVerify(omrobjectptr_t *slotPtr)
74
{
75
if (_poison) {
76
((MM_ReadBarrierVerifier*)_extensions->accessBarrier)->poisonSlot(_env->getExtensions(), slotPtr);
77
} else {
78
((MM_ReadBarrierVerifier*)_extensions->accessBarrier)->healSlot(_env->getExtensions(), slotPtr);
79
}
80
}
81
#endif /* defined(OMR_ENV_DATA64) && defined(OMR_GC_FULL_POINTERS) */
82
83