Skip to content

Commit

Permalink
Fix 0 getContractionSize() in MemorySubSpaceGenerational
Browse files Browse the repository at this point in the history
getContractionSize() in MemorySubSpaceGenerational seems to always be 0.
MM_MemorySubSpace::getContractionSize() returns _contractionSize.
MM_MemorySubSpaceGenerational::checkResize() calls getMemorySubSpaceOld()->checkResize()
which sets the _contractionSize in its _memorySubSpaceOld but not its own.

env->_cycleState->_activeSubSpace->getContractionSize() != 0 is checked before calling
MM_ParallelGlobalGC::compactRequiredBeforeHeapContraction() in MM_ParallelGlobalGC::sweep().

Signed-off-by: Jason Hall <jasonhal@ca.ibm.com>
  • Loading branch information
jason-hall committed Sep 14, 2020
1 parent 2ffef1f commit 7dab858
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gc/base/MemorySubSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ friend class GC_MemorySubSpaceRegionIterator;
MMINLINE void isAllocatable(bool isAllocatable) {_isAllocatable = isAllocatable; }
MMINLINE bool isAllocatable() { return _isAllocatable; }

MMINLINE uintptr_t getContractionSize() const { return _contractionSize; }
virtual MMINLINE uintptr_t getContractionSize() const { return _contractionSize; }
MMINLINE uintptr_t getExpansionSize() const { return _expansionSize; }
MMINLINE void setContractionSize(uintptr_t size) { _contractionSize = size; }
MMINLINE void setExpansionSize(uintptr_t size) { _expansionSize = size; }
Expand Down
4 changes: 3 additions & 1 deletion gc/base/MemorySubSpaceGenerational.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2015 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 @@ -109,6 +109,8 @@ class MM_MemorySubSpaceGenerational : public MM_MemorySubSpace
virtual uintptr_t releaseFreeMemoryPages(MM_EnvironmentBase* env);
#endif

virtual MMINLINE uintptr_t getContractionSize() const { return _memorySubSpaceOld->getContractionSize(); }

/**
* Create a MemorySubSpaceGenerational object.
*/
Expand Down

0 comments on commit 7dab858

Please sign in to comment.