From 2abca9bf44672ba5d57429c9668e9df5a815922a Mon Sep 17 00:00:00 2001 From: Evgenia Badyanova Date: Tue, 4 Sep 2018 11:46:13 -0400 Subject: [PATCH] Initial changes to refactor snapshot at the beginning barrier SATB barrier is used in metronome gc policy. We would like to enable it for other gc polices under option -Xgc:snapshotAtTheBeginningBarrier. These are initial changes to add the option and start decoupling barrier code from metronome gc. Signed-off-by: Evgenia Badyanova --- runtime/compiler/control/J9Options.cpp | 3 +- runtime/compiler/env/VMJ9.cpp | 2 +- runtime/gc_base/modron.h | 4 +- .../ConcurrentMarkingDelegate.cpp | 33 +++- .../ConcurrentMarkingDelegate.hpp | 8 +- .../gc_glue_java/ConfigurationDelegate.hpp | 1 + runtime/gc_include/ObjectAccessBarrierAPI.hpp | 25 +-- runtime/gc_include/j9modron.h | 3 +- .../StandardAccessBarrier.cpp | 145 +++++++++++++++++- .../StandardAccessBarrier.hpp | 46 +++++- runtime/gc_modron_startup/arrayCopy.cpp | 8 +- runtime/gc_modron_startup/mminit.cpp | 2 +- runtime/gc_modron_startup/mmparseXgc.cpp | 5 + .../gc_realtime/AllocationContextRealtime.cpp | 4 +- runtime/gc_realtime/CMakeLists.txt | 1 - runtime/gc_realtime/ConfigurationRealtime.hpp | 4 +- runtime/gc_realtime/WorkPacketsRealtime.cpp | 4 +- runtime/gc_realtime/WorkPacketsRealtime.hpp | 22 ++- runtime/gc_staccato/StaccatoAccessBarrier.cpp | 10 +- runtime/gc_staccato/StaccatoAccessBarrier.hpp | 8 +- runtime/gc_staccato/StaccatoGC.cpp | 20 +-- runtime/oti/j9accessbarrier.h | 12 +- runtime/oti/j9consts.h | 2 +- runtime/oti/j9nonbuilder.h | 2 +- 24 files changed, 302 insertions(+), 72 deletions(-) diff --git a/runtime/compiler/control/J9Options.cpp b/runtime/compiler/control/J9Options.cpp index e02bad0e478..ef6313f2fe1 100644 --- a/runtime/compiler/control/J9Options.cpp +++ b/runtime/compiler/control/J9Options.cpp @@ -1106,7 +1106,8 @@ J9::Options::fePreProcess(void * base) case j9gc_modron_wrtbar_cardmark: wrtbarMode = TR_WrtbarCardMark; break; case j9gc_modron_wrtbar_cardmark_and_oldcheck: wrtbarMode = TR_WrtbarCardMarkAndOldCheck; break; case j9gc_modron_wrtbar_cardmark_incremental: wrtbarMode = TR_WrtbarCardMarkIncremental; break; - case j9gc_modron_wrtbar_realtime: wrtbarMode = TR_WrtbarRealTime; break; + case j9gc_modron_wrtbar_satb: + case j9gc_modron_wrtbar_satb_and_oldcheck: wrtbarMode = TR_WrtbarRealTime; break; } #if defined(J9VM_GC_HEAP_CARD_TABLE) diff --git a/runtime/compiler/env/VMJ9.cpp b/runtime/compiler/env/VMJ9.cpp index 490e50f1a12..3797c49f322 100644 --- a/runtime/compiler/env/VMJ9.cpp +++ b/runtime/compiler/env/VMJ9.cpp @@ -1677,7 +1677,7 @@ TR_J9VMBase::thisThreadRememberedSetFragmentOffset() { #if defined(J9VM_GC_REALTIME) - return offsetof(J9VMThread, staccatoRememberedSetFragment); + return offsetof(J9VMThread, sATBBarrierRememberedSetFragment); #endif return 0; } diff --git a/runtime/gc_base/modron.h b/runtime/gc_base/modron.h index 331118e5523..14c462be31a 100644 --- a/runtime/gc_base/modron.h +++ b/runtime/gc_base/modron.h @@ -1,6 +1,6 @@ /******************************************************************************* - * Copyright (c) 1991, 2017 IBM Corp. and others + * Copyright (c) 1991, 2018 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 @@ -123,7 +123,7 @@ extern "C" fj9object_t j9gc_objaccess_tokenFromPointer(J9VMThread *vmThread, mm_ #if defined(J9VM_GC_STACCATO) /* Note that the "reserved" index is used for 2 different purposes with the - * staccatoRememberedSet: + * sATBBarrierRememberedSet: * 1) As a per-thread flag indicating the double barrier is on. * 2) As a global flag indicating the barrier is disabled. * diff --git a/runtime/gc_glue_java/ConcurrentMarkingDelegate.cpp b/runtime/gc_glue_java/ConcurrentMarkingDelegate.cpp index 7c24f07965d..8ab41a1ae66 100644 --- a/runtime/gc_glue_java/ConcurrentMarkingDelegate.cpp +++ b/runtime/gc_glue_java/ConcurrentMarkingDelegate.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2017 IBM Corp. and others + * Copyright (c) 1991, 2018 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 @@ -93,6 +93,37 @@ MM_ConcurrentMarkingDelegate::signalThreadsToTraceStacks(MM_EnvironmentBase *env _collector->getConcurrentGCStats()->setThreadsToScanCount(threadCount); } +void +MM_ConcurrentMarkingDelegate::signalThreadsToActivateWriteBarrier(MM_EnvironmentBase *env) +{ + MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(env); + GC_VMInterface::lockVMThreadList(extensions); + + J9VMThread *walkThread; + GC_VMThreadListIterator vmThreadListIterator(_javaVM); + while ((walkThread = vmThreadListIterator.nextVMThread()) != NULL) { + walkThread->privateFlags |= J9_PRIVATE_FLAGS_CONCURRENT_MARK_ACTIVE; + } + GC_VMInterface::unlockVMThreadList(extensions); +} + +void +MM_ConcurrentMarkingDelegate::signalThreadsToDeactivateWriteBarrier(MM_EnvironmentBase *env) +{ + MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(_javaVM); + if (extensions->optimizeConcurrentWB) { + GC_VMInterface::lockVMThreadList(extensions); + GC_VMThreadListIterator vmThreadListIterator(_javaVM); + J9VMThread *walkThread; + + /* Reset vmThread flag so mutators don't dirty cards or run write barriers until next concurrent KO */ + while ((walkThread = vmThreadListIterator.nextVMThread()) != NULL) { + walkThread->privateFlags &= ~J9_PRIVATE_FLAGS_CONCURRENT_MARK_ACTIVE; + } + GC_VMInterface::unlockVMThreadList(extensions); + } +} + void MM_ConcurrentMarkingDelegate::signalThreadsToDirtyCards(MM_EnvironmentBase *env) { diff --git a/runtime/gc_glue_java/ConcurrentMarkingDelegate.hpp b/runtime/gc_glue_java/ConcurrentMarkingDelegate.hpp index 5fcddf4aa1c..2cfa5426c73 100644 --- a/runtime/gc_glue_java/ConcurrentMarkingDelegate.hpp +++ b/runtime/gc_glue_java/ConcurrentMarkingDelegate.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2017 IBM Corp. and others + * Copyright (c) 1991, 2018 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 @@ -245,10 +245,16 @@ class MM_ConcurrentMarkingDelegate */ void signalThreadsToTraceStacks(MM_EnvironmentBase *env); + void signalThreadsToActivateWriteBarrier(MM_EnvironmentBase *env); + + void signalThreadsToDeactivateWriteBarrier(MM_EnvironmentBase *env); + + //TODO: STAB remove two methods bellow after the initial changes are in void signalThreadsToDirtyCards(MM_EnvironmentBase *env); void signalThreadsToStopDirtyingCards(MM_EnvironmentBase *env); + /** * This method is called during card cleaning for each object associated with an uncleaned, dirty card in the card * table. No client actions are necessary but this method may be overridden if desired to hook into card cleaning. diff --git a/runtime/gc_glue_java/ConfigurationDelegate.hpp b/runtime/gc_glue_java/ConfigurationDelegate.hpp index 1b2fc2903bc..204b6b8ac20 100644 --- a/runtime/gc_glue_java/ConfigurationDelegate.hpp +++ b/runtime/gc_glue_java/ConfigurationDelegate.hpp @@ -88,6 +88,7 @@ class MM_ConfigurationDelegate if (extensions->alwaysCallWriteBarrier) { writeBarrierType = gc_modron_wrtbar_always; } + Assert_MM_true(gc_modron_wrtbar_illegal != writeBarrierType); javaVM->gcWriteBarrierType = writeBarrierType; diff --git a/runtime/gc_include/ObjectAccessBarrierAPI.hpp b/runtime/gc_include/ObjectAccessBarrierAPI.hpp index 2a3e68f6762..e4fd291baad 100644 --- a/runtime/gc_include/ObjectAccessBarrierAPI.hpp +++ b/runtime/gc_include/ObjectAccessBarrierAPI.hpp @@ -2625,8 +2625,9 @@ class MM_ObjectAccessBarrierAPI VMINLINE void internalPreStoreObject(J9VMThread *vmThread, j9object_t object, fj9object_t *destAddress, j9object_t value) { - if (j9gc_modron_wrtbar_realtime == _writeBarrierType) { - internalPreStoreObjectRealtime(vmThread, object, destAddress, value); + if ((j9gc_modron_wrtbar_satb == _writeBarrierType) || + (j9gc_modron_wrtbar_satb_and_oldcheck == _writeBarrierType)) { + internalPreStoreObjectSATB(vmThread, object, destAddress, value); } } @@ -2644,8 +2645,9 @@ class MM_ObjectAccessBarrierAPI VMINLINE void internalStaticPreStoreObject(J9VMThread *vmThread, j9object_t object, j9object_t *destAddress, j9object_t value) { - if (j9gc_modron_wrtbar_realtime == _writeBarrierType) { - internalStaticPreStoreObjectRealtime(vmThread, object, destAddress, value); + if ((j9gc_modron_wrtbar_satb == _writeBarrierType) || + (j9gc_modron_wrtbar_satb_and_oldcheck == _writeBarrierType)) { + internalStaticPreStoreObjectSATB(vmThread, object, destAddress, value); } } @@ -2658,10 +2660,10 @@ class MM_ObjectAccessBarrierAPI * */ VMINLINE void - internalPreStoreObjectRealtime(J9VMThread *vmThread, j9object_t object, fj9object_t *destAddress, j9object_t value) + internalPreStoreObjectSATB(J9VMThread *vmThread, j9object_t object, fj9object_t *destAddress, j9object_t value) { #if defined(J9VM_GC_REALTIME) - J9VMGCRememberedSetFragment *fragment = &vmThread->staccatoRememberedSetFragment; + J9VMGCRememberedSetFragment *fragment = &vmThread->sATBBarrierRememberedSetFragment; J9VMGCRememberedSet *parent = fragment->fragmentParent; /* Check if the barrier is enabled. No work if barrier is not enabled */ if (0 != parent->globalFragmentIndex) { @@ -2689,10 +2691,10 @@ class MM_ObjectAccessBarrierAPI * */ VMINLINE void - internalStaticPreStoreObjectRealtime(J9VMThread *vmThread, j9object_t object, j9object_t *destAddress, j9object_t value) + internalStaticPreStoreObjectSATB(J9VMThread *vmThread, j9object_t object, j9object_t *destAddress, j9object_t value) { #if defined(J9VM_GC_REALTIME) - J9VMGCRememberedSetFragment *fragment = &vmThread->staccatoRememberedSetFragment; + J9VMGCRememberedSetFragment *fragment = &vmThread->sATBBarrierRememberedSetFragment; J9VMGCRememberedSet *parent = fragment->fragmentParent; /* Check if the barrier is enabled. No work if barrier is not enabled */ if (0 != parent->globalFragmentIndex) { @@ -2763,7 +2765,9 @@ class MM_ObjectAccessBarrierAPI internalPostObjectStoreCardTable(vmThread, object, value); break; case j9gc_modron_wrtbar_none: - case j9gc_modron_wrtbar_realtime: + case j9gc_modron_wrtbar_satb: + case j9gc_modron_wrtbar_satb_and_oldcheck: + //TODO SATB change to handle gencon, decide where to do it in pre/post store break; default: /* Should assert as all real types are handled. Should never get here @@ -2790,7 +2794,8 @@ class MM_ObjectAccessBarrierAPI internalPostBatchStoreObjectCardTable(vmThread, object); break; case j9gc_modron_wrtbar_none: - case j9gc_modron_wrtbar_realtime: + case j9gc_modron_wrtbar_satb: + case j9gc_modron_wrtbar_satb_and_oldcheck: break; default: /* Should assert as all real types are handled. Should never get here diff --git a/runtime/gc_include/j9modron.h b/runtime/gc_include/j9modron.h index 29115703d88..938ef3b2a43 100644 --- a/runtime/gc_include/j9modron.h +++ b/runtime/gc_include/j9modron.h @@ -47,7 +47,8 @@ typedef enum { j9gc_modron_wrtbar_cardmark = gc_modron_wrtbar_cardmark, j9gc_modron_wrtbar_cardmark_incremental = gc_modron_wrtbar_cardmark_incremental, j9gc_modron_wrtbar_cardmark_and_oldcheck = gc_modron_wrtbar_cardmark_and_oldcheck, - j9gc_modron_wrtbar_realtime = gc_modron_wrtbar_realtime, + j9gc_modron_wrtbar_satb = gc_modron_wrtbar_satb, + j9gc_modron_wrtbar_satb_and_oldcheck = gc_modron_wrtbar_satb_and_oldcheck, j9gc_modron_wrtbar_count = gc_modron_wrtbar_count } J9WriteBarrierType; diff --git a/runtime/gc_modron_standard/StandardAccessBarrier.cpp b/runtime/gc_modron_standard/StandardAccessBarrier.cpp index 55d859e989c..700a15da6e3 100644 --- a/runtime/gc_modron_standard/StandardAccessBarrier.cpp +++ b/runtime/gc_modron_standard/StandardAccessBarrier.cpp @@ -63,6 +63,29 @@ MM_StandardAccessBarrier::newInstance(MM_EnvironmentBase *env) return barrier; } +/** + * Enables the double barrier on the provided thread. + */ +void +MM_StandardAccessBarrier::setDoubleBarrierActiveOnThread(MM_EnvironmentBase* env) +{ + MM_GCExtensions::getExtensions(env)->sATBBarrierRememberedSet->preserveLocalFragmentIndex(env, &(((J9VMThread *)env->getLanguageVMThread())->sATBBarrierRememberedSetFragment)); +} + +void +MM_StandardAccessBarrier::initializeForNewThread(MM_EnvironmentBase* env) +{ +#if defined(OMR_GC_REALTIME) + if (_extensions->configuration->isSnapshotAtTheBeginningBarrierEnabled()) { + + _extensions->sATBBarrierRememberedSet->initializeFragment(env, &(((J9VMThread *)env->getLanguageVMThread())->sATBBarrierRememberedSetFragment)); + if (isDoubleBarrierActive()) { + setDoubleBarrierActiveOnThread(env); + } + } +#endif /* OMR_GC_REALTIME */ +} + bool MM_StandardAccessBarrier::initialize(MM_EnvironmentBase *env) { @@ -92,6 +115,114 @@ MM_StandardAccessBarrier::tearDown(MM_EnvironmentBase *env) MM_ObjectAccessBarrier::tearDown(env); } +/** + * Unmarked, heap reference, about to be deleted (or overwritten), while marking + * is in progress is to be remembered for later marking and scanning. + */ +void +MM_StandardAccessBarrier::rememberObjectToRescan(MM_EnvironmentBase *env, J9Object *object) +{ + MM_ParallelGlobalGC *globalCollector = (MM_ParallelGlobalGC *)_extensions->getGlobalCollector(); + + if (globalCollector->getMarkingScheme()->markObject(env, object, true)) { + rememberObjectImpl(env, object); + } +} + +/** + * Unmarked, heap reference, about to be deleted (or overwritten), while marking + * is in progress is to be remembered for later marking and scanning. + * This method is called by MM_StandardAccessBarrier::rememberObject() + */ +void +MM_StandardAccessBarrier::rememberObjectImpl(MM_EnvironmentBase *env, J9Object* object) +{ + J9VMThread *vmThread = (J9VMThread *)env->getLanguageVMThread(); + _extensions->sATBBarrierRememberedSet->storeInFragment(env, &vmThread->sATBBarrierRememberedSetFragment, (UDATA *)object); +} + + +bool +MM_StandardAccessBarrier::preObjectStoreImpl(J9VMThread *vmThread, J9Object *destObject, fj9object_t *destAddress, J9Object *value, bool isVolatile) +{ + MM_EnvironmentBase* env = MM_EnvironmentBase::getEnvironment(vmThread->omrVMThread); + + if (isSATBBarrierActive(env)) { + if (NULL != destObject) { + if (isDoubleBarrierActiveOnThread(vmThread)) { + rememberObjectToRescan(env, value); + } + + J9Object *oldObject = NULL; + protectIfVolatileBefore(vmThread, isVolatile, true, false); + oldObject = mmPointerFromToken(vmThread, *destAddress); + protectIfVolatileAfter(vmThread, isVolatile, true, false); + rememberObjectToRescan(env, oldObject); + } + } + + return true; +} + +bool +MM_StandardAccessBarrier::preObjectStoreImpl(J9VMThread *vmThread, J9Object **destAddress, J9Object *value, bool isVolatile) +{ + MM_EnvironmentBase* env = MM_EnvironmentBase::getEnvironment(vmThread->omrVMThread); + + if (isSATBBarrierActive(env)) { + if (isDoubleBarrierActiveOnThread(vmThread)) { + rememberObjectToRescan(env, value); + } + J9Object* oldObject = NULL; + protectIfVolatileBefore(vmThread, isVolatile, true, false); + oldObject = *destAddress; + protectIfVolatileAfter(vmThread, isVolatile, true, false); + rememberObjectToRescan(env, oldObject); + } + + return true; +} +/** + * @copydoc MM_ObjectAccessBarrier::preObjectStore() + * + * Metronome uses a snapshot-at-the-beginning algorithm, but with a fuzzy snapshot in the + * sense that threads are allowed to run during the root scan. This requires a "double + * barrier." The barrier is active from the start of root scanning through the end of + * tracing. For an unscanned thread performing a store, the new value is remembered by + * the collector. For any thread performing a store (whether scanned or not), the old + * value is remembered by the collector before being overwritten (thus this barrier must be + * positioned as a pre-store barrier). For the latter ("Yuasa barrier") aspect of the + * double barrier, only the first overwritten value needs to be remembered (remembering + * others is harmless but not needed), and so we omit synchronization on the reading of the + * old value. + **/ +bool +MM_StandardAccessBarrier::preObjectStore(J9VMThread *vmThread, J9Object *destObject, fj9object_t *destAddress, J9Object *value, bool isVolatile) +{ + return preObjectStoreImpl(vmThread, destObject, destAddress, value, isVolatile); +} + +/** + * @copydoc MM_MetronomeAccessBarrier::preObjectStore() + * + * Used for stores into classes + */ +bool +MM_StandardAccessBarrier::preObjectStore(J9VMThread *vmThread, J9Object *destClass, J9Object **destAddress, J9Object *value, bool isVolatile) +{ + return preObjectStoreImpl(vmThread, destAddress, value, isVolatile); +} + +/** + * @copydoc MM_MetronomeAccessBarrier::preObjectStore() + * + * Used for stores into internal structures + */ +bool +MM_StandardAccessBarrier::preObjectStore(J9VMThread *vmThread, J9Object **destAddress, J9Object *value, bool isVolatile) +{ + return preObjectStoreImpl(vmThread, destAddress, value, isVolatile); +} /** * Called after an object is stored into another object. */ @@ -99,6 +230,7 @@ void MM_StandardAccessBarrier::postObjectStore(J9VMThread *vmThread, J9Object *destObject, fj9object_t *destAddress, J9Object *value, bool isVolatile) { postObjectStoreImpl(vmThread, destObject, value); + } /** @@ -159,9 +291,7 @@ MM_StandardAccessBarrier::postObjectStoreImpl(J9VMThread *vmThread, J9Object *ds #if defined(OMR_GC_MODRON_CONCURRENT_MARK) /* Call the concurrent write barrier if required */ - if(_extensions->concurrentMark && - (vmThread->privateFlags & J9_PRIVATE_FLAGS_CONCURRENT_MARK_ACTIVE) && - _extensions->isOld(dstObject)) { + if(isIncrementalUpdateBarrierActive(vmThread) && _extensions->isOld(dstObject)) { J9ConcurrentWriteBarrierStore(vmThread->omrVMThread, dstObject, srcObject); } #endif /* OMR_GC_MODRON_CONCURRENT_MARK */ @@ -481,6 +611,10 @@ I_32 MM_StandardAccessBarrier::backwardReferenceArrayCopyIndex(J9VMThread *vmThread, J9IndexableObject *srcObject, J9IndexableObject *destObject, I_32 srcIndex, I_32 destIndex, I_32 lengthInSlots) { I_32 retValue = ARRAY_COPY_NOT_DONE; + //TODO SATB re-enable opt? + if (_extensions->configuration->isSnapshotAtTheBeginningBarrierEnabled()) { + return retValue; + } if(0 == lengthInSlots) { retValue = ARRAY_COPY_SUCCESSFUL; @@ -507,8 +641,13 @@ MM_StandardAccessBarrier::backwardReferenceArrayCopyIndex(J9VMThread *vmThread, I_32 MM_StandardAccessBarrier::forwardReferenceArrayCopyIndex(J9VMThread *vmThread, J9IndexableObject *srcObject, J9IndexableObject *destObject, I_32 srcIndex, I_32 destIndex, I_32 lengthInSlots) { + //TODO SATB re-enable opt I_32 retValue = ARRAY_COPY_NOT_DONE; + if (_extensions->configuration->isSnapshotAtTheBeginningBarrierEnabled()) { + return retValue; + } + if(0 == lengthInSlots) { retValue = ARRAY_COPY_SUCCESSFUL; } else { diff --git a/runtime/gc_modron_standard/StandardAccessBarrier.hpp b/runtime/gc_modron_standard/StandardAccessBarrier.hpp index da3365a48a4..2f9e67b2091 100644 --- a/runtime/gc_modron_standard/StandardAccessBarrier.hpp +++ b/runtime/gc_modron_standard/StandardAccessBarrier.hpp @@ -33,9 +33,10 @@ #include "j9.h" #include "j9cfg.h" - #include "ObjectAccessBarrier.hpp" +#include "Configuration.hpp" #include "GenerationalAccessBarrierComponent.hpp" +#include "RememberedSetSATB.hpp" /** * Access barrier for Modron collector. @@ -47,7 +48,9 @@ class MM_StandardAccessBarrier : public MM_ObjectAccessBarrier #if defined(J9VM_GC_GENERATIONAL) MM_GenerationalAccessBarrierComponent _generationalAccessBarrierComponent; /**< Generational Component of Access Barrier */ #endif /* J9VM_GC_GENERATIONAL */ - +#if defined(OMR_GC_REALTIME) + bool _doubleBarrierActive; /**< Global indicator that the double barrier is active. New threads will be set to double barrier mode if this falg is true. */ +#endif /* OMR_GC_REALTIME */ void postObjectStoreImpl(J9VMThread *vmThread, J9Object *dstObject, J9Object *srcObject); void preBatchObjectStoreImpl(J9VMThread *vmThread, J9Object *dstObject); @@ -67,6 +70,11 @@ class MM_StandardAccessBarrier : public MM_ObjectAccessBarrier virtual J9Object* asConstantPoolObject(J9VMThread *vmThread, J9Object* toConvert, UDATA allocationFlags); + virtual void rememberObjectImpl(MM_EnvironmentBase *env, J9Object* object); + virtual bool preObjectStore(J9VMThread *vmThread, J9Object *destObject, fj9object_t *destAddress, J9Object *value, bool isVolatile=false); + virtual bool preObjectStore(J9VMThread *vmThread, J9Object *destClass, J9Object **destAddress, J9Object *value, bool isVolatile=false); + virtual bool preObjectStore(J9VMThread *vmThread, J9Object **destAddress, J9Object *value, bool isVolatile=false); + virtual void postObjectStore(J9VMThread *vmThread, J9Object *destObject, fj9object_t *destAddress, J9Object *value, bool isVolatile=false); virtual void postObjectStore(J9VMThread *vmThread, J9Class *destClass, J9Object **destAddress, J9Object *value, bool isVolatile=false); virtual bool preBatchObjectStore(J9VMThread *vmThread, J9Object *destObject, bool isVolatile=false); @@ -77,6 +85,7 @@ class MM_StandardAccessBarrier : public MM_ObjectAccessBarrier virtual void jniReleasePrimitiveArrayCritical(J9VMThread* vmThread, jarray array, void * elems, jint mode); virtual const jchar* jniGetStringCritical(J9VMThread* vmThread, jstring str, jboolean *isCopy); virtual void jniReleaseStringCritical(J9VMThread* vmThread, jstring str, const jchar* elems); + virtual void initializeForNewThread(MM_EnvironmentBase* env); #if defined(J9VM_GC_ARRAYLETS) virtual I_32 backwardReferenceArrayCopyIndex(J9VMThread *vmThread, J9IndexableObject *srcObject, J9IndexableObject *destObject, I_32 srcIndex, I_32 destIndex, I_32 lengthInSlots); @@ -92,6 +101,39 @@ class MM_StandardAccessBarrier : public MM_ObjectAccessBarrier virtual bool preMonitorTableSlotRead(J9JavaVM *vm, j9object_t *srcAddress); #endif + bool preObjectStoreImpl(J9VMThread *vmThread, J9Object *destObject, fj9object_t *destAddress, J9Object *value, bool isVolatile); + bool preObjectStoreImpl(J9VMThread *vmThread, J9Object **destAddress, J9Object *value, bool isVolatile); + + void rememberObjectToRescan(MM_EnvironmentBase *env, J9Object *object); + + MMINLINE bool isSATBBarrierActive(MM_EnvironmentBase* env) + { + return ((_extensions->configuration->isSnapshotAtTheBeginningBarrierEnabled()) && + (!_extensions->sATBBarrierRememberedSet->isGlobalFragmentIndexPreserved(env))); + } + + MMINLINE bool isIncrementalUpdateBarrierActive(J9VMThread *vmThread) + { + return ((vmThread->privateFlags & J9_PRIVATE_FLAGS_CONCURRENT_MARK_ACTIVE) && + _extensions->configuration->isIncrementalUpdateBarrierEnabled()); + } + +#if defined(OMR_GC_REALTIME) + MMINLINE void setDoubleBarrierActive() { _doubleBarrierActive = true; } + MMINLINE void setDoubleBarrierInactive() { _doubleBarrierActive = false; } + MMINLINE bool isDoubleBarrierActive() { return _doubleBarrierActive; } +#endif /* OMR_GC_REALTIME */ + + MMINLINE bool isDoubleBarrierActiveOnThread(J9VMThread *vmThread) + { + /* The double barrier is enabled in by setting the threads remembered set fragment index + * to the special value, this ensures the JIT will go out-of line. We can determine if the double + * barrier is active simply by checking if the fragment index corresponds to the special value. + */ + return (J9GC_REMEMBERED_SET_RESERVED_INDEX == vmThread->sATBBarrierRememberedSetFragment.localFragmentIndex); + } + void setDoubleBarrierActiveOnThread(MM_EnvironmentBase* env); + /** * Return the number of currently active JNI critical regions. * diff --git a/runtime/gc_modron_startup/arrayCopy.cpp b/runtime/gc_modron_startup/arrayCopy.cpp index 547ae3f50da..88aa392b942 100644 --- a/runtime/gc_modron_startup/arrayCopy.cpp +++ b/runtime/gc_modron_startup/arrayCopy.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - * Copyright (c) 1991, 2017 IBM Corp. and others + * Copyright (c) 1991, 2018 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 @@ -264,7 +264,7 @@ initializeReferenceArrayCopyTable(J9ReferenceArrayCopyTable *table) table->backwardReferenceArrayCopyIndex[j9gc_modron_wrtbar_cardmark] = backwardReferenceArrayCopyAndAlwaysWrtbarIndex; table->backwardReferenceArrayCopyIndex[j9gc_modron_wrtbar_cardmark_incremental] = backwardReferenceArrayCopyAndAlwaysWrtbarIndex; table->backwardReferenceArrayCopyIndex[j9gc_modron_wrtbar_cardmark_and_oldcheck] = backwardReferenceArrayCopyAndAlwaysWrtbarIndex; - table->backwardReferenceArrayCopyIndex[j9gc_modron_wrtbar_realtime] = backwardReferenceArrayCopyAndAlwaysWrtbarIndex; + table->backwardReferenceArrayCopyIndex[j9gc_modron_wrtbar_satb] = backwardReferenceArrayCopyAndAlwaysWrtbarIndex; /* Forward copies with type check on each element (check for ArrayStoreException) */ table->forwardReferenceArrayCopyWithCheckIndex[j9gc_modron_wrtbar_illegal] = copyVariantUndefinedIndex; @@ -274,7 +274,7 @@ initializeReferenceArrayCopyTable(J9ReferenceArrayCopyTable *table) table->forwardReferenceArrayCopyWithCheckIndex[j9gc_modron_wrtbar_cardmark] = forwardReferenceArrayCopyWithCheckAndAlwaysWrtbarIndex; table->forwardReferenceArrayCopyWithCheckIndex[j9gc_modron_wrtbar_cardmark_incremental] = forwardReferenceArrayCopyWithCheckAndAlwaysWrtbarIndex; table->forwardReferenceArrayCopyWithCheckIndex[j9gc_modron_wrtbar_cardmark_and_oldcheck] = forwardReferenceArrayCopyWithCheckAndAlwaysWrtbarIndex; - table->forwardReferenceArrayCopyWithCheckIndex[j9gc_modron_wrtbar_realtime] = forwardReferenceArrayCopyWithCheckAndAlwaysWrtbarIndex; + table->forwardReferenceArrayCopyWithCheckIndex[j9gc_modron_wrtbar_satb] = forwardReferenceArrayCopyWithCheckAndAlwaysWrtbarIndex; /* Forward copies with no type check */ table->forwardReferenceArrayCopyWithoutCheckIndex[j9gc_modron_wrtbar_illegal] = copyVariantUndefinedIndex; @@ -284,7 +284,7 @@ initializeReferenceArrayCopyTable(J9ReferenceArrayCopyTable *table) table->forwardReferenceArrayCopyWithoutCheckIndex[j9gc_modron_wrtbar_cardmark] = forwardReferenceArrayCopyWithoutCheckAndAlwaysWrtbarIndex; table->forwardReferenceArrayCopyWithoutCheckIndex[j9gc_modron_wrtbar_cardmark_incremental] = forwardReferenceArrayCopyWithoutCheckAndAlwaysWrtbarIndex; table->forwardReferenceArrayCopyWithoutCheckIndex[j9gc_modron_wrtbar_cardmark_and_oldcheck] = forwardReferenceArrayCopyWithoutCheckAndAlwaysWrtbarIndex; - table->forwardReferenceArrayCopyWithoutCheckIndex[j9gc_modron_wrtbar_realtime] = forwardReferenceArrayCopyWithoutCheckAndAlwaysWrtbarIndex; + table->forwardReferenceArrayCopyWithoutCheckIndex[j9gc_modron_wrtbar_satb] = forwardReferenceArrayCopyWithoutCheckAndAlwaysWrtbarIndex; } } /* extern "C" */ diff --git a/runtime/gc_modron_startup/mminit.cpp b/runtime/gc_modron_startup/mminit.cpp index 6f641e676b6..9b6052f35a8 100644 --- a/runtime/gc_modron_startup/mminit.cpp +++ b/runtime/gc_modron_startup/mminit.cpp @@ -100,7 +100,7 @@ #include "SizeClasses.hpp" #endif /* J9VM_GC_SEGRGATED_HEAP */ #if defined(J9VM_GC_STACCATO) -#include "RememberedSetWorkPackets.hpp" +#include "RememberedSetSATB.hpp" #endif /* J9VM_GC_STACCATO */ #include "Scavenger.hpp" #include "StringTable.hpp" diff --git a/runtime/gc_modron_startup/mmparseXgc.cpp b/runtime/gc_modron_startup/mmparseXgc.cpp index d945029b306..008ec632ea6 100644 --- a/runtime/gc_modron_startup/mmparseXgc.cpp +++ b/runtime/gc_modron_startup/mmparseXgc.cpp @@ -232,6 +232,11 @@ j9gc_initialize_parse_gc_colon(J9JavaVM *javaVM, char **scan_start) goto _exit; } + if (try_scan(scan_start, "snapshotAtTheBeginningBarrier")) { + extensions->configurationOptions._forceOptionWriteBarrierSATB = true; + goto _exit; + } + #if defined(J9VM_GC_MODRON_SCAVENGER) if(try_scan(scan_start, "scavenge")) { extensions->configurationOptions._forceOptionScavenge = true; diff --git a/runtime/gc_realtime/AllocationContextRealtime.cpp b/runtime/gc_realtime/AllocationContextRealtime.cpp index 563f7b0d717..83a7b28f22f 100644 --- a/runtime/gc_realtime/AllocationContextRealtime.cpp +++ b/runtime/gc_realtime/AllocationContextRealtime.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2014 IBM Corp. and others + * Copyright (c) 1991, 2018 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 @@ -143,7 +143,7 @@ MM_AllocationContextRealtime::allocateLarge(MM_EnvironmentBase *env, UDATA sizeI /* Call parent to try to get a large object region */ UDATA *result = MM_AllocationContextSegregated::allocateLarge(env, sizeInBytesRequired); - +//TODO SATB extract into a method if ((NULL != result) && (GC_MARK == ((MM_EnvironmentRealtime *) env)->getAllocationColor())) { ext->realtimeGC->getMarkingScheme()->mark((omrobjectptr_t)result); } diff --git a/runtime/gc_realtime/CMakeLists.txt b/runtime/gc_realtime/CMakeLists.txt index 74c4e3cb8db..e6993d31d05 100644 --- a/runtime/gc_realtime/CMakeLists.txt +++ b/runtime/gc_realtime/CMakeLists.txt @@ -42,7 +42,6 @@ add_library(j9realtime STATIC RealtimeRootScanner.cpp RealtimeSweepTask.cpp ReferenceObjectBufferRealtime.cpp - RememberedSetWorkPackets.cpp Scheduler.cpp SweepSchemeRealtime.cpp Timer.cpp diff --git a/runtime/gc_realtime/ConfigurationRealtime.hpp b/runtime/gc_realtime/ConfigurationRealtime.hpp index 5037aa26b71..8cded120393 100644 --- a/runtime/gc_realtime/ConfigurationRealtime.hpp +++ b/runtime/gc_realtime/ConfigurationRealtime.hpp @@ -1,6 +1,6 @@ /******************************************************************************* - * Copyright (c) 1991, 2017 IBM Corp. and others + * Copyright (c) 1991, 2018 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 @@ -62,7 +62,7 @@ class MM_ConfigurationRealtime : public MM_Configuration virtual void defaultMemorySpaceAllocated(MM_GCExtensionsBase *extensions, void* defaultMemorySpace); MM_ConfigurationRealtime(MM_EnvironmentBase *env) - : MM_Configuration(env, gc_policy_metronome, mm_regionAlignment, REALTIME_REGION_SIZE_BYTES, REALTIME_ARRAYLET_LEAF_SIZE_BYTES, gc_modron_wrtbar_realtime, gc_modron_allocation_type_segregated) + : MM_Configuration(env, gc_policy_metronome, mm_regionAlignment, REALTIME_REGION_SIZE_BYTES, REALTIME_ARRAYLET_LEAF_SIZE_BYTES, gc_modron_wrtbar_satb, gc_modron_allocation_type_segregated) { _typeId = __FUNCTION__; }; diff --git a/runtime/gc_realtime/WorkPacketsRealtime.cpp b/runtime/gc_realtime/WorkPacketsRealtime.cpp index 927cf2fbdd3..e919e24cf64 100644 --- a/runtime/gc_realtime/WorkPacketsRealtime.cpp +++ b/runtime/gc_realtime/WorkPacketsRealtime.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - * Copyright (c) 1991, 2014 IBM Corp. and others + * Copyright (c) 1991, 2018 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 @@ -32,7 +32,7 @@ #include "GCExtensions.hpp" #include "IncrementalOverflow.hpp" #include "IncrementalParallelTask.hpp" -#include "RememberedSetWorkPackets.hpp" +#include "RememberedSetSATB.hpp" #include "RealtimeGC.hpp" #include "WorkPacketsRealtime.hpp" diff --git a/runtime/gc_realtime/WorkPacketsRealtime.hpp b/runtime/gc_realtime/WorkPacketsRealtime.hpp index cda8f32a9aa..fcf497067d0 100644 --- a/runtime/gc_realtime/WorkPacketsRealtime.hpp +++ b/runtime/gc_realtime/WorkPacketsRealtime.hpp @@ -1,6 +1,6 @@ /******************************************************************************* - * Copyright (c) 1991, 2014 IBM Corp. and others + * Copyright (c) 1991, 2018 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 @@ -25,20 +25,17 @@ #define WORKPACKETSREALTIME_HPP_ #include "EnvironmentBase.hpp" -#include "WorkPackets.hpp" +#include "WorkPacketsSATB.hpp" #include "YieldCollaborator.hpp" class MM_IncrementalOverflow; -class MM_WorkPacketsRealtime : public MM_WorkPackets +class MM_WorkPacketsRealtime : public MM_WorkPacketsSATB { public: protected: MM_YieldCollaborator _yieldCollaborator; -private: - MM_PacketList _inUseBarrierPacketList; /**< List for packets currently being used for the remembered set*/ - public: static MM_WorkPacketsRealtime *newInstance(MM_EnvironmentBase *env); @@ -50,21 +47,20 @@ class MM_WorkPacketsRealtime : public MM_WorkPackets virtual MM_Packet *getInputPacket(MM_EnvironmentBase *env); - MMINLINE bool inUsePacketsAvailable(MM_EnvironmentBase *env) { return !_inUseBarrierPacketList.isEmpty();} + virtual bool inUsePacketsAvailable(MM_EnvironmentBase *env) { return !_inUseBarrierPacketList.isEmpty();} - MM_Packet *getBarrierPacket(MM_EnvironmentBase *env); - void putInUsePacket(MM_EnvironmentBase *env, MM_Packet *packet); - void removePacketFromInUseList(MM_EnvironmentBase *env, MM_Packet *packet); - void putFullPacket(MM_EnvironmentBase *env, MM_Packet *packet); + virtual MM_Packet *getBarrierPacket(MM_EnvironmentBase *env); + virtual void putInUsePacket(MM_EnvironmentBase *env, MM_Packet *packet); + virtual void removePacketFromInUseList(MM_EnvironmentBase *env, MM_Packet *packet); + virtual void putFullPacket(MM_EnvironmentBase *env, MM_Packet *packet); void moveInUseToNonEmpty(MM_EnvironmentBase *env); /** * Create a MM_WorkPacketsRealtime object. */ MM_WorkPacketsRealtime(MM_EnvironmentBase *env) : - MM_WorkPackets(env) + MM_WorkPacketsSATB(env) , _yieldCollaborator(&_inputListMonitor, &_inputListWaitCount, MM_YieldCollaborator::WorkPacketsRealtime) - , _inUseBarrierPacketList(NULL) { _typeId = __FUNCTION__; }; diff --git a/runtime/gc_staccato/StaccatoAccessBarrier.cpp b/runtime/gc_staccato/StaccatoAccessBarrier.cpp index 94349bc1969..9094c47a17d 100644 --- a/runtime/gc_staccato/StaccatoAccessBarrier.cpp +++ b/runtime/gc_staccato/StaccatoAccessBarrier.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - * Copyright (c) 1991, 2014 IBM Corp. and others + * Copyright (c) 1991, 2018 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 @@ -81,7 +81,7 @@ MM_StaccatoAccessBarrier::rememberObjectImpl(MM_EnvironmentBase *env, J9Object* J9VMThread *vmThread = (J9VMThread *)env->getLanguageVMThread(); MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(vmThread->javaVM); - extensions->staccatoRememberedSet->storeInFragment(env, &vmThread->staccatoRememberedSetFragment, (UDATA *)object); + extensions->sATBBarrierRememberedSet->storeInFragment(env, &vmThread->sATBBarrierRememberedSetFragment, (UDATA *)object); } void @@ -221,7 +221,7 @@ MM_StaccatoAccessBarrier::preObjectStore(J9VMThread *vmThread, J9Object **destAd void MM_StaccatoAccessBarrier::setDoubleBarrierActiveOnThread(MM_EnvironmentBase* env) { - MM_GCExtensions::getExtensions(env)->staccatoRememberedSet->preserveLocalFragmentIndex(env, &(((J9VMThread *)env->getLanguageVMThread())->staccatoRememberedSetFragment)); + MM_GCExtensions::getExtensions(env)->sATBBarrierRememberedSet->preserveLocalFragmentIndex(env, &(((J9VMThread *)env->getLanguageVMThread())->sATBBarrierRememberedSetFragment)); } /** @@ -230,14 +230,14 @@ MM_StaccatoAccessBarrier::setDoubleBarrierActiveOnThread(MM_EnvironmentBase* env void MM_StaccatoAccessBarrier::setDoubleBarrierInactiveOnThread(MM_EnvironmentBase* env) { - MM_GCExtensions::getExtensions(env)->staccatoRememberedSet->restoreLocalFragmentIndex(env, &(((J9VMThread *)env->getLanguageVMThread())->staccatoRememberedSetFragment)); + MM_GCExtensions::getExtensions(env)->sATBBarrierRememberedSet->restoreLocalFragmentIndex(env, &(((J9VMThread *)env->getLanguageVMThread())->sATBBarrierRememberedSetFragment)); } void MM_StaccatoAccessBarrier::initializeForNewThread(MM_EnvironmentBase* env) { MM_GCExtensions* extensions = MM_GCExtensions::getExtensions(env); - extensions->staccatoRememberedSet->initializeFragment(env, &(((J9VMThread *)env->getLanguageVMThread())->staccatoRememberedSetFragment)); + extensions->sATBBarrierRememberedSet->initializeFragment(env, &(((J9VMThread *)env->getLanguageVMThread())->sATBBarrierRememberedSetFragment)); if (isDoubleBarrierActive()) { setDoubleBarrierActiveOnThread(env); } diff --git a/runtime/gc_staccato/StaccatoAccessBarrier.hpp b/runtime/gc_staccato/StaccatoAccessBarrier.hpp index f5aa1186757..4bf63553e4d 100644 --- a/runtime/gc_staccato/StaccatoAccessBarrier.hpp +++ b/runtime/gc_staccato/StaccatoAccessBarrier.hpp @@ -1,6 +1,6 @@ /******************************************************************************* - * Copyright (c) 1991, 2014 IBM Corp. and others + * Copyright (c) 1991, 2018 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 @@ -34,7 +34,7 @@ */ #include "RealtimeAccessBarrier.hpp" -#include "RememberedSetWorkPackets.hpp" +#include "RememberedSetSATB.hpp" class MM_EnvironmentBase; class MM_EnvironmentRealtime; @@ -107,7 +107,7 @@ class MM_StaccatoAccessBarrier : public MM_RealtimeAccessBarrier MMINLINE bool isBarrierActive(MM_EnvironmentBase* env) { MM_GCExtensions* extensions = MM_GCExtensions::getExtensions(env); - return !extensions->staccatoRememberedSet->isGlobalFragmentIndexPreserved(env); + return !extensions->sATBBarrierRememberedSet->isGlobalFragmentIndexPreserved(env); } MMINLINE bool isDoubleBarrierActiveOnThread(J9VMThread *vmThread) @@ -116,7 +116,7 @@ class MM_StaccatoAccessBarrier : public MM_RealtimeAccessBarrier * to the special value, this ensures the JIT will go out-of line. We can determine if the double * barrier is active simply by checking if the fragment index corresponds to the special value. */ - return (J9GC_REMEMBERED_SET_RESERVED_INDEX == vmThread->staccatoRememberedSetFragment.localFragmentIndex); + return (J9GC_REMEMBERED_SET_RESERVED_INDEX == vmThread->sATBBarrierRememberedSetFragment.localFragmentIndex); } bool markAndScanContiguousArray(MM_EnvironmentRealtime *env, J9IndexableObject *objectPtr); diff --git a/runtime/gc_staccato/StaccatoGC.cpp b/runtime/gc_staccato/StaccatoGC.cpp index d7424ad769f..b654a3c3b66 100644 --- a/runtime/gc_staccato/StaccatoGC.cpp +++ b/runtime/gc_staccato/StaccatoGC.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - * Copyright (c) 1991, 2017 IBM Corp. and others + * Copyright (c) 1991, 2018 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 @@ -29,7 +29,7 @@ #include "IncrementalParallelTask.hpp" #include "LockingFreeHeapRegionList.hpp" #include "ModronTypes.hpp" -#include "RememberedSetWorkPackets.hpp" +#include "RememberedSetSATB.hpp" #include "StaccatoAccessBarrier.hpp" #include "StaccatoGC.hpp" #include "RealtimeMarkingScheme.hpp" @@ -70,8 +70,8 @@ MM_StaccatoGC::initialize(MM_EnvironmentBase *env) return false; } - _extensions->staccatoRememberedSet = MM_RememberedSetWorkPackets::newInstance(env, _workPackets); - if (NULL == _extensions->staccatoRememberedSet) { + _extensions->sATBBarrierRememberedSet = MM_RememberedSetSATB::newInstance(env, _workPackets); + if (NULL == _extensions->sATBBarrierRememberedSet) { return false; } @@ -81,9 +81,9 @@ MM_StaccatoGC::initialize(MM_EnvironmentBase *env) void MM_StaccatoGC::tearDown(MM_EnvironmentBase *env) { - if (NULL != _extensions->staccatoRememberedSet) { - _extensions->staccatoRememberedSet->kill(env); - _extensions->staccatoRememberedSet = NULL; + if (NULL != _extensions->sATBBarrierRememberedSet) { + _extensions->sATBBarrierRememberedSet->kill(env); + _extensions->sATBBarrierRememberedSet = NULL; } MM_RealtimeGC::tearDown(env); @@ -106,7 +106,7 @@ void MM_StaccatoGC::enableWriteBarrier(MM_EnvironmentBase* env) { MM_GCExtensions* extensions = MM_GCExtensions::getExtensions(env); - extensions->staccatoRememberedSet->restoreGlobalFragmentIndex(env); + extensions->sATBBarrierRememberedSet->restoreGlobalFragmentIndex(env); } /** @@ -116,7 +116,7 @@ void MM_StaccatoGC::disableWriteBarrier(MM_EnvironmentBase* env) { MM_GCExtensions* extensions = MM_GCExtensions::getExtensions(env); - extensions->staccatoRememberedSet->preserveGlobalFragmentIndex(env); + extensions->sATBBarrierRememberedSet->preserveGlobalFragmentIndex(env); } /** @@ -167,7 +167,7 @@ MM_StaccatoGC::flushRememberedSet(MM_EnvironmentRealtime *env) { if (_workPackets->inUsePacketsAvailable(env)) { _workPackets->moveInUseToNonEmpty(env); - _extensions->staccatoRememberedSet->flushFragments(env); + _extensions->sATBBarrierRememberedSet->flushFragments(env); } } diff --git a/runtime/oti/j9accessbarrier.h b/runtime/oti/j9accessbarrier.h index 49c40ac29b6..d42face0bb0 100644 --- a/runtime/oti/j9accessbarrier.h +++ b/runtime/oti/j9accessbarrier.h @@ -171,13 +171,15 @@ typedef struct J9IndexableObject* mm_j9array_t; (void)0) #define J9OBJECT__PRE_OBJECT_STORE_ADDRESS(vmThread, object, address, value) \ ((void)0, \ - (OMR_GC_ALLOCATION_TYPE_SEGREGATED == (J9VMTHREAD_JAVAVM((vmThread)))->gcAllocationType) ? \ + ((OMR_GC_WRITE_BARRIER_TYPE_SATB == (J9VMTHREAD_JAVAVM((vmThread)))->gcWriteBarrierType) || \ + (OMR_GC_WRITE_BARRIER_TYPE_SATB_AND_OLDCHECK == (J9VMTHREAD_JAVAVM((vmThread)))->gcWriteBarrierType)) ? \ J9VMTHREAD_JAVAVM((vmThread))->memoryManagerFunctions->J9MetronomeWriteBarrierStore((vmThread), (j9object_t)(object), (fj9object_t*)(address), (j9object_t)(value)) : \ (void)0 \ ) #define J9OBJECT__PRE_OBJECT_STORE_ADDRESS_VM(javaVM, object, address, value) \ ((void)0, \ - (OMR_GC_ALLOCATION_TYPE_SEGREGATED == javaVM->gcAllocationType) ? \ + ((OMR_GC_WRITE_BARRIER_TYPE_SATB == javaVM->gcWriteBarrierType) || \ + (OMR_GC_WRITE_BARRIER_TYPE_SATB_AND_OLDCHECK == javaVM->gcWriteBarrierType)) ? \ javaVM->memoryManagerFunctions->J9MetronomeWriteBarrierStore(J9JAVAVM_VMTHREAD(javaVM), (j9object_t)(object), (fj9object_t*)(address), (j9object_t)(value)) : \ (void)0 \ ) @@ -195,13 +197,15 @@ typedef struct J9IndexableObject* mm_j9array_t; ) #define J9STATIC__PRE_OBJECT_STORE(vmThread, clazz, address, value) \ ((void)0, \ - (OMR_GC_ALLOCATION_TYPE_SEGREGATED == (J9VMTHREAD_JAVAVM((vmThread)))->gcAllocationType) ? \ + ((OMR_GC_WRITE_BARRIER_TYPE_SATB == (J9VMTHREAD_JAVAVM((vmThread)))->gcWriteBarrierType) || \ + (OMR_GC_WRITE_BARRIER_TYPE_SATB_AND_OLDCHECK == (J9VMTHREAD_JAVAVM((vmThread)))->gcWriteBarrierType)) ? \ J9VMTHREAD_JAVAVM((vmThread))->memoryManagerFunctions->J9MetronomeWriteBarrierJ9ClassStore((vmThread), J9VM_J9CLASS_TO_HEAPCLASS((clazz)), (j9object_t*)(address), (j9object_t)(value)) : \ (void)0 \ ) #define J9STATIC__PRE_OBJECT_STORE_VM(javaVM, object, address, value) \ ((void)0, \ - (OMR_GC_ALLOCATION_TYPE_SEGREGATED == javaVM->gcAllocationType) ? \ + ((OMR_GC_WRITE_BARRIER_TYPE_SATB == javaVM->gcWriteBarrierType) || \ + (OMR_GC_WRITE_BARRIER_TYPE_SATB_AND_OLDCHECK == javaVM->gcWriteBarrierType)) ? \ javaVM->memoryManagerFunctions->J9MetronomeWriteBarrierJ9ClassStore(J9JAVAVM_VMTHREAD(javaVM), J9VM_J9CLASS_TO_HEAPCLASS((clazz)), (j9object_t*)(address), (j9object_t)(value)) : \ (void)0 \ ) diff --git a/runtime/oti/j9consts.h b/runtime/oti/j9consts.h index 65805713573..a18993c8213 100644 --- a/runtime/oti/j9consts.h +++ b/runtime/oti/j9consts.h @@ -463,7 +463,7 @@ extern "C" { #define J9_GC_WRITE_BARRIER_TYPE_CARDMARK OMR_GC_WRITE_BARRIER_TYPE_CARDMARK #define J9_GC_WRITE_BARRIER_TYPE_CARDMARK_INCREMENTAL OMR_GC_WRITE_BARRIER_TYPE_CARDMARK_INCREMENTAL #define J9_GC_WRITE_BARRIER_TYPE_CARDMARK_AND_OLDCHECK OMR_GC_WRITE_BARRIER_TYPE_CARDMARK_AND_OLDCHECK -#define J9_GC_WRITE_BARRIER_TYPE_REALTIME OMR_GC_WRITE_BARRIER_TYPE_REALTIME +#define J9_GC_WRITE_BARRIER_TYPE_REALTIME OMR_GC_WRITE_BARRIER_TYPE_SATB #define J9_GC_WRITE_BARRIER_TYPE_COUNT OMR_GC_WRITE_BARRIER_TYPE_COUNT #define J9_GC_READ_BARRIER_TYPE_ILLEGAL OMR_GC_READ_BARRIER_TYPE_ILLEGAL diff --git a/runtime/oti/j9nonbuilder.h b/runtime/oti/j9nonbuilder.h index fee10aaf1a6..3f85bb8b92a 100644 --- a/runtime/oti/j9nonbuilder.h +++ b/runtime/oti/j9nonbuilder.h @@ -4908,7 +4908,7 @@ typedef struct J9VMThread { struct J9VMEntryLocalStorage* entryLocalStorage; UDATA gpProtected; struct J9VMGCSublistFragment gcRememberedSet; - struct J9VMGCRememberedSetFragment staccatoRememberedSetFragment; + struct J9VMGCRememberedSetFragment sATBBarrierRememberedSetFragment; void* gcTaskListPtr; UDATA* dropBP; UDATA dropFlags;