Skip to content

Commit

Permalink
Support tracing both inline and out of line allocation bytes
Browse files Browse the repository at this point in the history
	- new _traceAllocationBytes include ool and inline allocation
	- new flag disableInlineAllocationForSamplingBytesGranularity

Signed-off-by: Lin Hu <linhu@ca.ibm.com>
  • Loading branch information
LinHu2016 committed Apr 17, 2020
1 parent 5666fd2 commit a793092
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
3 changes: 3 additions & 0 deletions gc/base/EnvironmentBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class MM_EnvironmentBase : public MM_BaseVirtual
MM_FreeEntrySizeClassStats _freeEntrySizeClassStats; /**< GC thread local statistics structure for heap free entry size (sizeClass) distribution */

uintptr_t _oolTraceAllocationBytes; /**< Tracks the bytes allocated since the last ool object trace */
uintptr_t _traceAllocationBytes; /**< Tracks the bytes allocated since the last object trace include ool and allocation is completed from TLH */

uintptr_t approxScanCacheCount; /**< Local copy of approximate entries in global Cache Scan List. Updated upon allocation of new cache. */

Expand Down Expand Up @@ -653,6 +654,7 @@ class MM_EnvironmentBase : public MM_BaseVirtual
,_slaveThreadCpuTimeNanos(0)
,_freeEntrySizeClassStats()
,_oolTraceAllocationBytes(0)
,_traceAllocationBytes(0)
,approxScanCacheCount(0)
,_activeValidator(NULL)
,_lastSyncPointReached(NULL)
Expand Down Expand Up @@ -705,6 +707,7 @@ class MM_EnvironmentBase : public MM_BaseVirtual
,_slaveThreadCpuTimeNanos(0)
,_freeEntrySizeClassStats()
,_oolTraceAllocationBytes(0)
,_traceAllocationBytes(0)
,approxScanCacheCount(0)
,_activeValidator(NULL)
,_lastSyncPointReached(NULL)
Expand Down
2 changes: 2 additions & 0 deletions gc/base/GCExtensionsBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {
uintptr_t lowAllocationThreshold; /**< the lower bound of the allocation threshold range */
uintptr_t highAllocationThreshold; /**< the upper bound of the allocation threshold range */
bool disableInlineCacheForAllocationThreshold; /**< true if inline allocates fall within the allocation threshold*/
bool disableInlineAllocationForSamplingBytesGranularity; /**< true if inline allocation should be "disabled" for SamplingBytesGranularity */
uintptr_t heapCeiling; /**< the highest point in memory where objects can be addressed (used for the -Xgc:lowMemHeap option) */

enum HeapInitializationFailureReason {
Expand Down Expand Up @@ -1677,6 +1678,7 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {
, lowAllocationThreshold(UDATA_MAX)
, highAllocationThreshold(UDATA_MAX)
, disableInlineCacheForAllocationThreshold(false)
, disableInlineAllocationForSamplingBytesGranularity(false)
, heapCeiling(0) /* default for normal platforms is 0 (i.e. no ceiling) */
, heapInitializationFailureReason(HEAP_INITIALIZATION_FAILURE_REASON_NO_ERROR)
, scavengerAlignHotFields(true) /* VM Design 1774: hot field alignment is on by default */
Expand Down
18 changes: 11 additions & 7 deletions gc/base/TLHAllocationInterface.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2018 IBM Corp. and others
* Copyright (c) 1991, 2020 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 @@ -200,15 +200,19 @@ MM_TLHAllocationInterface::allocateObject(MM_EnvironmentBase *env, MM_AllocateDe

}

if ((NULL != result) && !allocDescription->isCompletedFromTlh()) {
if (NULL != result) {
uintptr_t sizeInBytesAllocated = allocDescription->getContiguousBytes();
/* Increment by bytes allocated */
env->_traceAllocationBytes += sizeInBytesAllocated;

if (!allocDescription->isCompletedFromTlh()) {
#if defined(OMR_GC_OBJECT_ALLOCATION_NOTIFY)
env->objectAllocationNotify((omrobjectptr_t)result);
env->objectAllocationNotify((omrobjectptr_t)result);
#endif /* OMR_GC_OBJECT_ALLOCATION_NOTIFY */
_stats._allocationBytes += allocDescription->getContiguousBytes();
_stats._allocationCount += 1;

_stats._allocationBytes += sizeInBytesAllocated;
_stats._allocationCount += 1;
}
}

env->_oolTraceAllocationBytes += (_stats.bytesAllocated() - _bytesAllocatedBase); /* Increment by bytes allocated */

return result;
Expand Down

0 comments on commit a793092

Please sign in to comment.