Skip to content

Commit

Permalink
Merge pull request #14039 from RSalman/satb-bar
Browse files Browse the repository at this point in the history
Standard SATB Barrier Implementation
  • Loading branch information
amicic committed Dec 8, 2021
2 parents 6ee9560 + 0745f99 commit 95691de
Show file tree
Hide file tree
Showing 13 changed files with 209 additions and 109 deletions.
4 changes: 2 additions & 2 deletions runtime/gc_base/GenerationalAccessBarrierComponent.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*******************************************************************************
* Copyright (c) 1991, 2017 IBM Corp. and others
* Copyright (c) 1991, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -133,7 +133,7 @@ MM_GenerationalAccessBarrierComponent::postObjectStore(J9VMThread *vmThread, J9O
* to optimistically add an object to the remembered set without checking too hard.
*/
void
MM_GenerationalAccessBarrierComponent::preBatchObjectStore(J9VMThread *vmThread, J9Object *dstObject)
MM_GenerationalAccessBarrierComponent::postBatchObjectStore(J9VMThread *vmThread, J9Object *dstObject)
{
MM_EnvironmentBase *env = MM_EnvironmentBase::getEnvironment(vmThread->omrVMThread);
MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(env);
Expand Down
4 changes: 2 additions & 2 deletions runtime/gc_base/GenerationalAccessBarrierComponent.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*******************************************************************************
* Copyright (c) 1991, 2014 IBM Corp. and others
* Copyright (c) 1991, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -53,7 +53,7 @@ class MM_GenerationalAccessBarrierComponent : public MM_BaseNonVirtual
void tearDown(MM_EnvironmentBase *env);

void postObjectStore(J9VMThread *vmThread, J9Object *dstObject, J9Object *srcObject);
void preBatchObjectStore(J9VMThread *vmThread, J9Object *dstObject);
void postBatchObjectStore(J9VMThread *vmThread, J9Object *dstObject);

MM_GenerationalAccessBarrierComponent()
{
Expand Down
4 changes: 2 additions & 2 deletions runtime/gc_base/ObjectAccessBarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,7 @@ MM_ObjectAccessBarrier::postObjectStore(J9VMThread *vmThread, J9Object **destAdd
* TODO: This should probably be postBatchObjectStore, not pre-.
*/
bool
MM_ObjectAccessBarrier::preBatchObjectStore(J9VMThread *vmThread, J9Object *destObject, bool isVolatile)
MM_ObjectAccessBarrier::postBatchObjectStore(J9VMThread *vmThread, J9Object *destObject, bool isVolatile)
{
#if defined(J9VM_GC_COMBINATION_SPEC)
/* (assert here to verify that we aren't defaulting to this implementation through some unknown path - delete once combination is stable) */
Expand All @@ -2057,7 +2057,7 @@ MM_ObjectAccessBarrier::preBatchObjectStore(J9VMThread *vmThread, J9Object *dest
}

bool
MM_ObjectAccessBarrier::preBatchObjectStore(J9VMThread *vmThread, J9Class *destClass, bool isVolatile)
MM_ObjectAccessBarrier::postBatchObjectStore(J9VMThread *vmThread, J9Class *destClass, bool isVolatile)
{
#if defined(J9VM_GC_COMBINATION_SPEC)
/* (assert here to verify that we aren't defaulting to this implementation through some unknown path - delete once combination is stable) */
Expand Down
4 changes: 2 additions & 2 deletions runtime/gc_base/ObjectAccessBarrier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ class MM_ObjectAccessBarrier : public MM_BaseVirtual
virtual void postObjectStore(J9VMThread *vmThread, J9Class *destClass, J9Object **destAddress, J9Object *value, bool isVolatile=false);
virtual void postObjectStore(J9VMThread *vmThread, J9Object **destAddress, J9Object *value, bool isVolatile=false);

virtual bool preBatchObjectStore(J9VMThread *vmThread, J9Object *destObject, bool isVolatile=false);
virtual bool preBatchObjectStore(J9VMThread *vmThread, J9Class *destClass, bool isVolatile=false);
virtual bool postBatchObjectStore(J9VMThread *vmThread, J9Object *destObject, bool isVolatile=false);
virtual bool postBatchObjectStore(J9VMThread *vmThread, J9Class *destClass, bool isVolatile=false);

virtual bool preObjectRead(J9VMThread *vmThread, J9Object *srcObject, fj9object_t *srcAddress);
virtual bool preObjectRead(J9VMThread *vmThread, J9Class *srcClass, j9object_t *srcAddress);
Expand Down
4 changes: 2 additions & 2 deletions runtime/gc_base/accessBarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,15 +698,15 @@ J9WriteBarrierBatch(J9VMThread *vmThread, J9Object *dstObject)
{
MM_ObjectAccessBarrier *barrier = MM_GCExtensions::getExtensions(vmThread->javaVM)->accessBarrier;
/* In Metronome, write barriers are always pre-store */
barrier->preBatchObjectStore(vmThread, dstObject);
barrier->postBatchObjectStore(vmThread, dstObject);
}

void
J9WriteBarrierClassBatch(J9VMThread *vmThread, J9Class *dstClazz)
{
MM_ObjectAccessBarrier *barrier = MM_GCExtensions::getExtensions(vmThread->javaVM)->accessBarrier;
/* In Metronome, write barriers are always pre-store */
barrier->preBatchObjectStore(vmThread, dstClazz);
barrier->postBatchObjectStore(vmThread, dstClazz);
}

void
Expand Down
6 changes: 3 additions & 3 deletions runtime/gc_glue_java/GlobalCollectorDelegate.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2020 IBM Corp. and others
* Copyright (c) 2017, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -103,11 +103,11 @@ MM_GlobalCollectorDelegate::initialize(MM_EnvironmentBase *env, MM_GlobalCollect

#if defined(OMR_ENV_DATA64) && defined(OMR_GC_FULL_POINTERS)
if (1 == _extensions->fvtest_enableReadBarrierVerification) {
_extensions->accessBarrier = MM_ReadBarrierVerifier::newInstance(env);
_extensions->accessBarrier = MM_ReadBarrierVerifier::newInstance(env, _markingScheme);
} else
#endif /* defined(OMR_ENV_DATA64) && defined(OMR_GC_FULL_POINTERS) */
{
_extensions->accessBarrier = MM_StandardAccessBarrier::newInstance(env);
_extensions->accessBarrier = MM_StandardAccessBarrier::newInstance(env, _markingScheme);
}

if (NULL == _extensions->accessBarrier) {
Expand Down
6 changes: 3 additions & 3 deletions runtime/gc_modron_standard/ReadBarrierVerifier.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2020 IBM Corp. and others
* Copyright (c) 1991, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -44,13 +44,13 @@
#if defined(OMR_ENV_DATA64) && defined(OMR_GC_FULL_POINTERS)

MM_ReadBarrierVerifier *
MM_ReadBarrierVerifier::newInstance(MM_EnvironmentBase *env)
MM_ReadBarrierVerifier::newInstance(MM_EnvironmentBase *env, MM_MarkingScheme *markingScheme)
{
MM_ReadBarrierVerifier *barrier;

barrier = (MM_ReadBarrierVerifier *)env->getForge()->allocate(sizeof(MM_ReadBarrierVerifier), MM_AllocationCategory::FIXED, J9_GET_CALLSITE());
if (barrier) {
new(barrier) MM_ReadBarrierVerifier(env);
new(barrier) MM_ReadBarrierVerifier(env, markingScheme);
if (!barrier->initialize(env)) {
barrier->kill(env);
barrier = NULL;
Expand Down
8 changes: 4 additions & 4 deletions runtime/gc_modron_standard/ReadBarrierVerifier.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2020 IBM Corp. and others
* Copyright (c) 1991, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -48,11 +48,11 @@
virtual bool initialize(MM_EnvironmentBase *env);
virtual void tearDown(MM_EnvironmentBase *env);
public:
static MM_ReadBarrierVerifier *newInstance(MM_EnvironmentBase *env);
static MM_ReadBarrierVerifier *newInstance(MM_EnvironmentBase *env, MM_MarkingScheme *markingScheme);
virtual void kill(MM_EnvironmentBase *env);

MM_ReadBarrierVerifier(MM_EnvironmentBase *env) :
MM_StandardAccessBarrier(env)
MM_ReadBarrierVerifier(MM_EnvironmentBase *env, MM_MarkingScheme *markingScheme) :
MM_StandardAccessBarrier(env, markingScheme)
{
_typeId = __FUNCTION__;
}
Expand Down

0 comments on commit 95691de

Please sign in to comment.