Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_modron_standard/StandardAccessBarrier.hpp
5986 views
1
2
/*******************************************************************************
3
* Copyright (c) 1991, 2021 IBM Corp. and others
4
*
5
* This program and the accompanying materials are made available under
6
* the terms of the Eclipse Public License 2.0 which accompanies this
7
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
8
* or the Apache License, Version 2.0 which accompanies this distribution and
9
* is available at https://www.apache.org/licenses/LICENSE-2.0.
10
*
11
* This Source Code may also be made available under the following
12
* Secondary Licenses when the conditions for such availability set
13
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
14
* General Public License, version 2 with the GNU Classpath
15
* Exception [1] and GNU General Public License, version 2 with the
16
* OpenJDK Assembly Exception [2].
17
*
18
* [1] https://www.gnu.org/software/classpath/license.html
19
* [2] http://openjdk.java.net/legal/assembly-exception.html
20
*
21
* 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
22
*******************************************************************************/
23
24
25
/**
26
* @file
27
* @ingroup GC_Modron_Standard
28
*/
29
30
#if !defined(STANDARDACCESSBARRIER_HPP_)
31
#define STANDARDACCESSBARRIER_HPP_
32
33
34
#include "j9.h"
35
#include "j9cfg.h"
36
#include "ObjectAccessBarrier.hpp"
37
#include "Configuration.hpp"
38
#include "GenerationalAccessBarrierComponent.hpp"
39
#if defined(OMR_GC_REALTIME)
40
#include "RememberedSetSATB.hpp"
41
#endif /* OMR_GC_REALTIME */
42
43
/**
44
* Access barrier for Modron collector.
45
*/
46
47
class MM_StandardAccessBarrier : public MM_ObjectAccessBarrier
48
{
49
private:
50
#if defined(J9VM_GC_GENERATIONAL)
51
MM_GenerationalAccessBarrierComponent _generationalAccessBarrierComponent; /**< Generational Component of Access Barrier */
52
#endif /* J9VM_GC_GENERATIONAL */
53
MM_MarkingScheme *_markingScheme;
54
55
void postObjectStoreImpl(J9VMThread *vmThread, J9Object *dstObject, J9Object *srcObject);
56
void postBatchObjectStoreImpl(J9VMThread *vmThread, J9Object *dstObject);
57
58
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
59
I_32 doCopyContiguousBackwardWithReadBarrier(J9VMThread *vmThread, J9IndexableObject *srcObject, J9IndexableObject *destObject, I_32 srcIndex, I_32 destIndex, I_32 lengthInSlots);
60
I_32 doCopyContiguousForwardWithReadBarrier(J9VMThread *vmThread, J9IndexableObject *srcObject, J9IndexableObject *destObject, I_32 srcIndex, I_32 destIndex, I_32 lengthInSlots);
61
#endif /* OMR_GC_CONCURRENT_SCAVENGER */
62
63
protected:
64
virtual bool initialize(MM_EnvironmentBase *env);
65
virtual void tearDown(MM_EnvironmentBase *env);
66
67
public:
68
static MM_StandardAccessBarrier *newInstance(MM_EnvironmentBase *env, MM_MarkingScheme *markingScheme);
69
virtual void kill(MM_EnvironmentBase *env);
70
71
MM_StandardAccessBarrier(MM_EnvironmentBase *env, MM_MarkingScheme *markingScheme) :
72
MM_ObjectAccessBarrier(env)
73
, _markingScheme(markingScheme)
74
{
75
_typeId = __FUNCTION__;
76
}
77
78
virtual J9Object* asConstantPoolObject(J9VMThread *vmThread, J9Object* toConvert, UDATA allocationFlags);
79
80
virtual void rememberObjectImpl(MM_EnvironmentBase *env, J9Object* object);
81
virtual bool preObjectStore(J9VMThread *vmThread, J9Object *destObject, fj9object_t *destAddress, J9Object *value, bool isVolatile=false);
82
virtual bool preObjectStore(J9VMThread *vmThread, J9Object *destClass, J9Object **destAddress, J9Object *value, bool isVolatile=false);
83
virtual bool preObjectStore(J9VMThread *vmThread, J9Object **destAddress, J9Object *value, bool isVolatile=false);
84
85
virtual void postObjectStore(J9VMThread *vmThread, J9Object *destObject, fj9object_t *destAddress, J9Object *value, bool isVolatile=false);
86
virtual void postObjectStore(J9VMThread *vmThread, J9Class *destClass, J9Object **destAddress, J9Object *value, bool isVolatile=false);
87
virtual bool postBatchObjectStore(J9VMThread *vmThread, J9Object *destObject, bool isVolatile=false);
88
virtual bool postBatchObjectStore(J9VMThread *vmThread, J9Class *destClass, bool isVolatile=false);
89
virtual void recentlyAllocatedObject(J9VMThread *vmThread, J9Object *object);
90
91
virtual void* jniGetPrimitiveArrayCritical(J9VMThread* vmThread, jarray array, jboolean *isCopy);
92
virtual void jniReleasePrimitiveArrayCritical(J9VMThread* vmThread, jarray array, void * elems, jint mode);
93
virtual const jchar* jniGetStringCritical(J9VMThread* vmThread, jstring str, jboolean *isCopy);
94
virtual void jniReleaseStringCritical(J9VMThread* vmThread, jstring str, const jchar* elems);
95
virtual void initializeForNewThread(MM_EnvironmentBase* env);
96
97
virtual I_32 backwardReferenceArrayCopyIndex(J9VMThread *vmThread, J9IndexableObject *srcObject, J9IndexableObject *destObject, I_32 srcIndex, I_32 destIndex, I_32 lengthInSlots);
98
virtual I_32 forwardReferenceArrayCopyIndex(J9VMThread *vmThread, J9IndexableObject *srcObject, J9IndexableObject *destObject, I_32 srcIndex, I_32 destIndex, I_32 lengthInSlots);
99
100
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
101
/* heap slot (possibly compressed refs) */
102
virtual bool preObjectRead(J9VMThread *vmThread, J9Object *srcObject, fj9object_t *srcAddress);
103
/* off-heap slot (always non-compressed) */
104
virtual bool preObjectRead(J9VMThread *vmThread, J9Class *srcClass, j9object_t *srcAddress);
105
virtual bool preWeakRootSlotRead(J9VMThread *vmThread, j9object_t *srcAddress);
106
virtual bool preWeakRootSlotRead(J9JavaVM *vm, j9object_t *srcAddress);
107
#endif
108
109
bool preObjectStoreImpl(J9VMThread *vmThread, J9Object *destObject, fj9object_t *destAddress, J9Object *value, bool isVolatile);
110
bool preObjectStoreImpl(J9VMThread *vmThread, J9Object **destAddress, J9Object *value, bool isVolatile);
111
112
void rememberObjectToRescan(MM_EnvironmentBase *env, J9Object *object);
113
114
MMINLINE bool isIncrementalUpdateBarrierActive(J9VMThread *vmThread)
115
{
116
return ((vmThread->privateFlags & J9_PRIVATE_FLAGS_CONCURRENT_MARK_ACTIVE) &&
117
_extensions->configuration->isIncrementalUpdateBarrierEnabled());
118
}
119
120
virtual J9Object* referenceGet(J9VMThread *vmThread, J9Object *refObject);
121
virtual void referenceReprocess(J9VMThread *vmThread, J9Object *refObject);
122
123
/**
124
* Return the number of currently active JNI critical regions.
125
*
126
* Must hold exclusive VM access to call this!
127
*/
128
static UDATA getJNICriticalRegionCount(MM_GCExtensions *extensions);
129
130
virtual void forcedToFinalizableObject(J9VMThread* vmThread, J9Object *object);
131
132
virtual void jniDeleteGlobalReference(J9VMThread *vmThread, J9Object *reference);
133
134
virtual void stringConstantEscaped(J9VMThread *vmThread, J9Object *stringConst);
135
virtual bool checkStringConstantsLive(J9JavaVM *javaVM, j9object_t stringOne, j9object_t stringTwo);
136
virtual bool checkStringConstantLive(J9JavaVM *javaVM, j9object_t string);
137
138
#if defined(J9VM_GC_DYNAMIC_CLASS_UNLOADING)
139
/**
140
* Check is class alive
141
* Required to prevent visibility of dead classes in SATB GC policies
142
* Check is J9_GC_CLASS_LOADER_DEAD flag set for classloader and try to mark
143
* class loader object if bit is not set to force class to be alive
144
* @param javaVM pointer to J9JavaVM
145
* @param classPtr class to check
146
* @return true if class is alive
147
*/
148
virtual bool checkClassLive(J9JavaVM *javaVM, J9Class *classPtr);
149
#endif /* defined(J9VM_GC_DYNAMIC_CLASS_UNLOADING) */
150
};
151
152
#endif /* STANDARDACCESSBARRIER_HPP_ */
153
154