Skip to content

Commit

Permalink
Passing unsuccessful state to GC cycle end event
Browse files Browse the repository at this point in the history
 - define new unsuccessful state via 31bit of cycleType
 (bit31=1 cycle end unsuccessfully(abort),
  bit31=0 cycle end successfully)
 - only passing the state to GC cycle end event via cycleType
 - GC cycle end hooks can identify cycle abort case via the
 unsuccessful state.

Signed-off-by: hulin <linhu@ca.ibm.com>
  • Loading branch information
LinHu2016 committed Jun 3, 2024
1 parent 6463b76 commit 43d759d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gc/base/standard/Scavenger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4435,6 +4435,11 @@ void
MM_Scavenger::reportGCCycleFinalIncrementEnding(MM_EnvironmentStandard *env)
{
OMRPORT_ACCESS_FROM_OMRPORT(env->getPortLibrary());
uintptr_t cycleType = env->_cycleState->_type;
/* set OMR_GC_CYCLE_TYPE_STATE_UNSUCCESSFUL bit in the cycleType of CycleEnd event in scavenge backout case */
if (env->getExtensions()->isScavengerBackOutFlagRaised()) {
cycleType |= OMR_GC_CYCLE_TYPE_STATE_UNSUCCESSFUL;
}

MM_CommonGCData commonData;

Expand All @@ -4444,7 +4449,7 @@ MM_Scavenger::reportGCCycleFinalIncrementEnding(MM_EnvironmentStandard *env)
omrtime_hires_clock(),
J9HOOK_MM_OMR_GC_CYCLE_END,
_extensions->getHeap()->initializeCommonGCData(env, &commonData),
env->_cycleState->_type,
cycleType,
omrgc_condYieldFromGC
);
}
Expand Down
6 changes: 6 additions & 0 deletions include_core/omrgcconsts.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ typedef enum MM_ScavengeScanReason {
#define OMR_GC_CYCLE_TYPE_GLOBAL 1
#define OMR_GC_CYCLE_TYPE_SCAVENGE 2
#define OMR_GC_CYCLE_TYPE_EPSILON 6
/**
* This bit represents the state to abort a cycle. It is only used in the cycleType of CycleEnd event.
* MM_CycleState->_type has uintptr_t type. This code still needs to be supported on 32-bit platforms,
* which will require the bit to fit in a 32 bit word.
*/
#define OMR_GC_CYCLE_TYPE_STATE_UNSUCCESSFUL 0x80000000

/* Core allocation flags defined for OMR are < OMR_GC_ALLOCATE_OBJECT_LANGUAGE_DEFINED_BASE */
#define OMR_GC_ALLOCATE_OBJECT_NON_INSTRUMENTABLE 0x0
Expand Down

0 comments on commit 43d759d

Please sign in to comment.