Skip to content

Commit

Permalink
Merge pull request #5125 from jason-hall/metronome14
Browse files Browse the repository at this point in the history
Modify HeapRegionDescriptorRealtime for moving into OMR
  • Loading branch information
dmitripivkine committed Mar 19, 2019
2 parents 288be72 + c445c8c commit 57a0ffc
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 41 deletions.
6 changes: 3 additions & 3 deletions runtime/gc_glue_java/RealtimeGCDelegate.cpp
Expand Up @@ -93,7 +93,7 @@ MM_RealtimeGCDelegate::initialize(MM_EnvironmentBase *env)
bool
MM_RealtimeGCDelegate::allocateAndInitializeReferenceObjectLists(MM_EnvironmentBase *env)
{
const UDATA listCount = MM_HeapRegionDescriptorRealtime::getReferenceObjectListCount(env);
const UDATA listCount = getReferenceObjectListCount(env);
Assert_MM_true(0 < listCount);
_extensions->referenceObjectLists = (MM_ReferenceObjectList *)env->getForge()->allocate((sizeof(MM_ReferenceObjectList) * listCount), MM_AllocationCategory::FIXED, J9_GET_CALLSITE());
if (NULL == _extensions->referenceObjectLists) {
Expand All @@ -108,7 +108,7 @@ MM_RealtimeGCDelegate::allocateAndInitializeReferenceObjectLists(MM_EnvironmentB
bool
MM_RealtimeGCDelegate::allocateAndInitializeUnfinalizedObjectLists(MM_EnvironmentBase *env)
{
const UDATA listCount = MM_HeapRegionDescriptorRealtime::getUnfinalizedObjectListCount(env);
const UDATA listCount = getUnfinalizedObjectListCount(env);
Assert_MM_true(0 < listCount);
MM_UnfinalizedObjectList *unfinalizedObjectLists = (MM_UnfinalizedObjectList *)env->getForge()->allocate((sizeof(MM_UnfinalizedObjectList) * listCount), MM_AllocationCategory::FIXED, J9_GET_CALLSITE());
if (NULL == unfinalizedObjectLists) {
Expand All @@ -132,7 +132,7 @@ MM_RealtimeGCDelegate::allocateAndInitializeUnfinalizedObjectLists(MM_Environmen
bool
MM_RealtimeGCDelegate::allocateAndInitializeOwnableSynchronizerObjectLists(MM_EnvironmentBase *env)
{
const UDATA listCount = MM_HeapRegionDescriptorRealtime::getOwnableSynchronizerObjectListCount(env);
const UDATA listCount = getOwnableSynchronizerObjectListCount(env);
Assert_MM_true(0 < listCount);
MM_OwnableSynchronizerObjectList *ownableSynchronizerObjectLists = (MM_OwnableSynchronizerObjectList *)env->getForge()->allocate((sizeof(MM_OwnableSynchronizerObjectList) * listCount), MM_AllocationCategory::FIXED, J9_GET_CALLSITE());
if (NULL == ownableSynchronizerObjectLists) {
Expand Down
4 changes: 4 additions & 0 deletions runtime/gc_glue_java/RealtimeGCDelegate.hpp
Expand Up @@ -117,6 +117,10 @@ class MM_RealtimeGCDelegate : public MM_BaseNonVirtual
void lockClassUnloadMonitor(MM_EnvironmentRealtime *env);
void unlockClassUnloadMonitor(MM_EnvironmentRealtime *env);

UDATA getUnfinalizedObjectListCount(MM_EnvironmentBase *env) { return _extensions->gcThreadCount; }
UDATA getOwnableSynchronizerObjectListCount(MM_EnvironmentBase *env) { return _extensions->gcThreadCount; }
UDATA getReferenceObjectListCount(MM_EnvironmentBase *env) { return _extensions->gcThreadCount; }

/*
* Friends
*/
Expand Down
14 changes: 6 additions & 8 deletions runtime/gc_realtime/HeapRegionDescriptorRealtime.cpp 100644 → 100755
@@ -1,6 +1,5 @@

/*******************************************************************************
* Copyright (c) 1991, 2014 IBM Corp. and others
* Copyright (c) 1991, 2019 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 All @@ -21,20 +20,19 @@
* 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
*******************************************************************************/

#include "j9.h"
#include "j9cfg.h"
#include "ModronAssertions.h"
#include "omr.h"
#include "omrcfg.h"

#include "EnvironmentBase.hpp"

#include "HeapRegionDescriptorRealtime.hpp"

#if defined(J9VM_GC_REALTIME)
#if defined(OMR_GC_REALTIME)

MM_HeapRegionDescriptorRealtime::MM_HeapRegionDescriptorRealtime(MM_EnvironmentBase *env, void *lowAddress, void *highAddress)
: MM_HeapRegionDescriptorSegregated(env, lowAddress, highAddress)
{
_arrayletBackPointers = ((UDATA **)(this + 1));
_arrayletBackPointers = ((uintptr_t **)(this + 1));
_typeId = __FUNCTION__;
}

Expand Down Expand Up @@ -63,4 +61,4 @@ MM_HeapRegionDescriptorRealtime::destructor(MM_EnvironmentBase *env, MM_HeapRegi
((MM_HeapRegionDescriptorRealtime*)descriptor)->tearDown(env);
}

#endif /* J9VM_GC_REALTIME */
#endif /* OMR_GC_REALTIME */
18 changes: 6 additions & 12 deletions runtime/gc_realtime/HeapRegionDescriptorRealtime.hpp 100644 → 100755
@@ -1,6 +1,5 @@

/*******************************************************************************
* Copyright (c) 1991, 2014 IBM Corp. and others
* Copyright (c) 1991, 2019 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 All @@ -24,15 +23,13 @@
#if !defined(HEAPREGIONDESCRIPTORREALTIME_HPP)
#define HEAPREGIONDESCRIPTORREALTIME_HPP

#include "j9.h"
#include "j9cfg.h"
#include "omr.h"
#include "omrcfg.h"

#include "HeapRegionDescriptorSegregated.hpp"
#include "OwnableSynchronizerObjectList.hpp"
#include "ReferenceObjectList.hpp"
#include "UnfinalizedObjectList.hpp"
#include "GCExtensionsBase.hpp"

#if defined(J9VM_GC_REALTIME)
#if defined(OMR_GC_REALTIME)

class MM_EnvironmentBase;

Expand All @@ -52,14 +49,11 @@ class MM_HeapRegionDescriptorRealtime : public MM_HeapRegionDescriptorSegregated

static bool initializer(MM_EnvironmentBase *env, MM_HeapRegionManager *regionManager, MM_HeapRegionDescriptor *descriptor, void *lowAddress, void *highAddress);
static void destructor(MM_EnvironmentBase *env, MM_HeapRegionManager *regionManager, MM_HeapRegionDescriptor *descriptor);
static UDATA getUnfinalizedObjectListCount(MM_EnvironmentBase *env) {return MM_GCExtensions::getExtensions(env)->gcThreadCount;}
static UDATA getOwnableSynchronizerObjectListCount(MM_EnvironmentBase *env) {return MM_GCExtensions::getExtensions(env)->gcThreadCount;}
static UDATA getReferenceObjectListCount(MM_EnvironmentBase *env) {return MM_GCExtensions::getExtensions(env)->gcThreadCount;}

MM_HeapRegionDescriptorRealtime *getNextOverflowRegion() {return _nextOverflowedRegion;}
void setNextOverflowRegion(MM_HeapRegionDescriptorRealtime *region) {_nextOverflowedRegion = region;}
};

#endif /* J9VM_GC_REALTIME */
#endif /* OMR_GC_REALTIME */

#endif /* HEAPREGIONDESCRIPTORREALTIME_HPP */
8 changes: 4 additions & 4 deletions runtime/gc_realtime/OwnableSynchronizerObjectBufferRealtime.cpp 100644 → 100755
@@ -1,6 +1,5 @@

/*******************************************************************************
* Copyright (c) 1991, 2014 IBM Corp. and others
* Copyright (c) 1991, 2019 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 All @@ -27,8 +26,9 @@

#include "OwnableSynchronizerObjectBufferRealtime.hpp"

#include "HeapRegionDescriptorRealtime.hpp"
#include "OwnableSynchronizerObjectList.hpp"
#include "RealtimeGC.hpp"
#include "RealtimeGCDelegate.hpp"

MM_OwnableSynchronizerObjectBufferRealtime::MM_OwnableSynchronizerObjectBufferRealtime(MM_GCExtensions *extensions, UDATA maxObjectCount)
: MM_OwnableSynchronizerObjectBuffer(extensions, maxObjectCount)
Expand Down Expand Up @@ -74,7 +74,7 @@ MM_OwnableSynchronizerObjectBufferRealtime::flushImpl(MM_EnvironmentBase* env)
MM_OwnableSynchronizerObjectList *ownableSynchronizerObjectList = &extensions->ownableSynchronizerObjectLists[_ownableSynchronizerObjectListIndex];
ownableSynchronizerObjectList->addAll(env, _head, _tail);
_ownableSynchronizerObjectListIndex += 1;
if (MM_HeapRegionDescriptorRealtime::getOwnableSynchronizerObjectListCount(env) == _ownableSynchronizerObjectListIndex) {
if (extensions->realtimeGC->getRealtimeDelegate()->getOwnableSynchronizerObjectListCount(env) == _ownableSynchronizerObjectListIndex) {
_ownableSynchronizerObjectListIndex = 0;
}
}
16 changes: 11 additions & 5 deletions runtime/gc_realtime/RealtimeMarkingScheme.cpp
Expand Up @@ -35,11 +35,17 @@
#include "MarkMap.hpp"
#include "ObjectAccessBarrier.hpp"
#include "ObjectAllocationInterface.hpp"
#include "OwnableSynchronizerObjectBufferRealtime.hpp"
#include "OwnableSynchronizerObjectList.hpp"
#include "RealtimeGC.hpp"
#include "RealtimeRootScanner.hpp"
#include "RealtimeMarkingScheme.hpp"
#include "ReferenceObjectBufferRealtime.hpp"
#include "ReferenceObjectList.hpp"
#include "SlotObject.hpp"
#include "StackSlotValidator.hpp"
#include "UnfinalizedObjectBufferRealtime.hpp"
#include "UnfinalizedObjectList.hpp"
#include "WorkPacketsRealtime.hpp"

/**
Expand Down Expand Up @@ -1021,7 +1027,7 @@ MM_RealtimeMarkingScheme::incrementalConsumeQueue(MM_EnvironmentRealtime *env, U
void
MM_RealtimeMarkingScheme::scanUnfinalizedObjects(MM_EnvironmentRealtime *env)
{
const UDATA maxIndex = MM_HeapRegionDescriptorRealtime::getUnfinalizedObjectListCount(env);
const UDATA maxIndex = _realtimeGC->getRealtimeDelegate()->getUnfinalizedObjectListCount(env);
/* first we need to move the current list to the prior list and process the prior list,
* because if object has not yet become finalizable, we have to re-insert it back to the current list.
*/
Expand Down Expand Up @@ -1078,7 +1084,7 @@ MM_RealtimeMarkingScheme::scanUnfinalizedObjects(MM_EnvironmentRealtime *env)
void
MM_RealtimeMarkingScheme::scanOwnableSynchronizerObjects(MM_EnvironmentRealtime *env)
{
const UDATA maxIndex = MM_HeapRegionDescriptorRealtime::getOwnableSynchronizerObjectListCount(env);
const UDATA maxIndex = _realtimeGC->getRealtimeDelegate()->getOwnableSynchronizerObjectListCount(env);

/* first we need to move the current list to the prior list and process the prior list,
* because if object has been marked, we have to re-insert it back to the current list.
Expand Down Expand Up @@ -1133,7 +1139,7 @@ MM_RealtimeMarkingScheme::scanWeakReferenceObjects(MM_EnvironmentRealtime *env)
{
GC_Environment *gcEnv = env->getGCEnvironment();
Assert_MM_true(gcEnv->_referenceObjectBuffer->isEmpty());
const UDATA maxIndex = MM_HeapRegionDescriptorRealtime::getReferenceObjectListCount(env);
const UDATA maxIndex = _realtimeGC->getRealtimeDelegate()->getReferenceObjectListCount(env);
UDATA listIndex;
for (listIndex = 0; listIndex < maxIndex; ++listIndex) {
if(J9MODRON_HANDLE_NEXT_WORK_UNIT(env)) {
Expand All @@ -1151,7 +1157,7 @@ MM_RealtimeMarkingScheme::scanSoftReferenceObjects(MM_EnvironmentRealtime *env)
{
GC_Environment *gcEnv = env->getGCEnvironment();
Assert_MM_true(gcEnv->_referenceObjectBuffer->isEmpty());
const UDATA maxIndex = MM_HeapRegionDescriptorRealtime::getReferenceObjectListCount(env);
const UDATA maxIndex = _realtimeGC->getRealtimeDelegate()->getReferenceObjectListCount(env);
UDATA listIndex;
for (listIndex = 0; listIndex < maxIndex; ++listIndex) {
if(J9MODRON_HANDLE_NEXT_WORK_UNIT(env)) {
Expand All @@ -1170,7 +1176,7 @@ MM_RealtimeMarkingScheme::scanPhantomReferenceObjects(MM_EnvironmentRealtime *en
GC_Environment *gcEnv = env->getGCEnvironment();
/* unfinalized processing may discover more phantom reference objects */
gcEnv->_referenceObjectBuffer->flush(env);
const UDATA maxIndex = MM_HeapRegionDescriptorRealtime::getReferenceObjectListCount(env);
const UDATA maxIndex = _realtimeGC->getRealtimeDelegate()->getReferenceObjectListCount(env);
UDATA listIndex;
for (listIndex = 0; listIndex < maxIndex; ++listIndex) {
if(J9MODRON_HANDLE_NEXT_WORK_UNIT(env)) {
Expand Down
11 changes: 6 additions & 5 deletions runtime/gc_realtime/ReferenceObjectBufferRealtime.cpp
@@ -1,6 +1,5 @@

/*******************************************************************************
* Copyright (c) 1991, 2014 IBM Corp. and others
* Copyright (c) 1991, 2019 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 All @@ -25,9 +24,11 @@
#include "j9cfg.h"
#include "ModronAssertions.h"

#include "GCExtensions.hpp"
#include "HeapRegionDescriptorRealtime.hpp"
#include "ReferenceObjectBufferRealtime.hpp"

#include "GCExtensions.hpp"
#include "RealtimeGC.hpp"
#include "RealtimeGCDelegate.hpp"
#include "ReferenceObjectList.hpp"

MM_ReferenceObjectBufferRealtime::MM_ReferenceObjectBufferRealtime(UDATA maxObjectCount)
Expand Down Expand Up @@ -73,7 +74,7 @@ MM_ReferenceObjectBufferRealtime::flushImpl(MM_EnvironmentBase* env)
MM_ReferenceObjectList *referenceObjectList = &extensions->referenceObjectLists[_referenceObjectListIndex];
referenceObjectList->addAll(env, _referenceObjectType, _head, _tail);
_referenceObjectListIndex += 1;
if (MM_HeapRegionDescriptorRealtime::getReferenceObjectListCount(env) == _referenceObjectListIndex) {
if (extensions->realtimeGC->getRealtimeDelegate()->getReferenceObjectListCount(env) == _referenceObjectListIndex) {
_referenceObjectListIndex = 0;
}
}
9 changes: 5 additions & 4 deletions runtime/gc_realtime/UnfinalizedObjectBufferRealtime.cpp
@@ -1,6 +1,5 @@

/*******************************************************************************
* Copyright (c) 1991, 2014 IBM Corp. and others
* Copyright (c) 1991, 2019 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 All @@ -27,7 +26,9 @@

#include "UnfinalizedObjectBufferRealtime.hpp"

#include "HeapRegionDescriptorRealtime.hpp"
#include "GCExtensions.hpp"
#include "RealtimeGC.hpp"
#include "RealtimeGCDelegate.hpp"
#include "UnfinalizedObjectList.hpp"

MM_UnfinalizedObjectBufferRealtime::MM_UnfinalizedObjectBufferRealtime(MM_GCExtensions *extensions, UDATA maxObjectCount)
Expand Down Expand Up @@ -74,7 +75,7 @@ MM_UnfinalizedObjectBufferRealtime::flushImpl(MM_EnvironmentBase* env)
MM_UnfinalizedObjectList *unfinalizedObjectList = &extensions->unfinalizedObjectLists[_unfinalizedObjectListIndex];
unfinalizedObjectList->addAll(env, _head, _tail);
_unfinalizedObjectListIndex += 1;
if (MM_HeapRegionDescriptorRealtime::getUnfinalizedObjectListCount(env) == _unfinalizedObjectListIndex) {
if (extensions->realtimeGC->getRealtimeDelegate()->getUnfinalizedObjectListCount(env) == _unfinalizedObjectListIndex) {
_unfinalizedObjectListIndex = 0;
}
}

0 comments on commit 57a0ffc

Please sign in to comment.