Skip to content

Commit

Permalink
Merge pull request eclipse-omr#7164 from dmitripivkine/master
Browse files Browse the repository at this point in the history
Use small page size/flags for Sparse Virtual Memory
  • Loading branch information
babsingh authored Oct 30, 2023
2 parents e2086cf + 5b5acde commit 3739ae8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
8 changes: 8 additions & 0 deletions gc/base/GCExtensionsBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ MM_GCExtensionsBase::initialize(MM_EnvironmentBase* env)
gcmetadataPageSize = pageSizes[0];
gcmetadataPageFlags = OMRPORT_VMEM_PAGE_FLAG_NOT_USED;

sparseHeapPageSize = pageSizes[0];
sparseHeapPageFlags = OMRPORT_VMEM_PAGE_FLAG_NOT_USED;


#define SIXTY_FOUR_KB ((uintptr_t)64 * 1024)
#define ONE_MB ((uintptr_t)1 * 1024 * 1024)
#define TWO_MB ((uintptr_t)2 * 1024 * 1024)
Expand All @@ -160,6 +164,10 @@ MM_GCExtensionsBase::initialize(MM_EnvironmentBase* env)
gcmetadataPageFlags = pageFlags[0];
}

if (!validateDefaultPageParameters(sparseHeapPageSize, sparseHeapPageFlags, pageSizes, pageFlags)) {
sparseHeapPageSize = pageSizes[0];
sparseHeapPageFlags = pageFlags[0];
}

if (!_forge.initialize(env->getPortLibrary())) {
goto failed;
Expand Down
13 changes: 9 additions & 4 deletions gc/base/GCExtensionsBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,13 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {
#endif /* OMR_GC_DOUBLE_MAP_ARRAYLETS */
bool isVirtualLargeObjectHeapRequested;
bool isVirtualLargeObjectHeapEnabled;
uintptr_t requestedPageSize;
uintptr_t requestedPageFlags;
uintptr_t gcmetadataPageSize;
uintptr_t gcmetadataPageFlags;

uintptr_t requestedPageSize; /**< Memory page size for Object Heap */
uintptr_t requestedPageFlags; /**< Memory page flags for Object Heap */
uintptr_t gcmetadataPageSize; /**< Memory page size for GC Meta data */
uintptr_t gcmetadataPageFlags; /**< Memory page flags for GC Meta data */
uintptr_t sparseHeapPageSize; /**< Memory page size for Sparse Object Heap */
uintptr_t sparseHeapPageFlags; /**< Memory page flags for Sparse Object Heap */

#if defined(OMR_GC_MODRON_SCAVENGER)
MM_SublistPool rememberedSet;
Expand Down Expand Up @@ -1516,6 +1519,8 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {
, requestedPageFlags(OMRPORT_VMEM_PAGE_FLAG_NOT_USED)
, gcmetadataPageSize(0)
, gcmetadataPageFlags(OMRPORT_VMEM_PAGE_FLAG_NOT_USED)
, sparseHeapPageSize(0)
, sparseHeapPageFlags(OMRPORT_VMEM_PAGE_FLAG_NOT_USED)
#if defined(OMR_GC_MODRON_SCAVENGER)
, rememberedSet()
, oldHeapSizeOnLastGlobalGC(UDATA_MAX)
Expand Down
5 changes: 3 additions & 2 deletions gc/base/SparseVirtualMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@
****************************************
*/

MM_SparseVirtualMemory*
MM_SparseVirtualMemory *
MM_SparseVirtualMemory::newInstance(MM_EnvironmentBase* env, uint32_t memoryCategory, MM_Heap *in_heap)
{
MM_GCExtensionsBase *extensions = env->getExtensions();
MM_SparseVirtualMemory* vmem = NULL;
vmem = (MM_SparseVirtualMemory*)env->getForge()->allocate(sizeof(MM_SparseVirtualMemory), OMR::GC::AllocationCategory::FIXED, OMR_GET_CALLSITE());

if (vmem) {
new (vmem) MM_SparseVirtualMemory(env, in_heap->getPageSize(), in_heap);
new (vmem) MM_SparseVirtualMemory(env, extensions->sparseHeapPageSize, extensions->sparseHeapPageFlags, in_heap);
if (!vmem->initialize(env, memoryCategory)) {
vmem->kill(env);
vmem = NULL;
Expand Down
4 changes: 2 additions & 2 deletions gc/base/SparseVirtualMemory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class MM_SparseVirtualMemory : public MM_VirtualMemory {
bool initialize(MM_EnvironmentBase* env, uint32_t memoryCategory);
void tearDown(MM_EnvironmentBase *env);

MM_SparseVirtualMemory(MM_EnvironmentBase* env, uintptr_t pageSize, MM_Heap *in_heap)
: MM_VirtualMemory(env, env->getExtensions()->heapAlignment, pageSize, env->getExtensions()->requestedPageFlags, 0, OMRPORT_VMEM_MEMORY_MODE_READ | OMRPORT_VMEM_MEMORY_MODE_WRITE)
MM_SparseVirtualMemory(MM_EnvironmentBase* env, uintptr_t pageSize, uintptr_t pageFlags, MM_Heap *in_heap)
: MM_VirtualMemory(env, env->getExtensions()->heapAlignment, pageSize, pageFlags, 0, OMRPORT_VMEM_MEMORY_MODE_READ | OMRPORT_VMEM_MEMORY_MODE_WRITE)
, _heap(in_heap)
, _sparseDataPool(NULL)
, _largeObjectVirtualMemoryMutex(NULL)
Expand Down

0 comments on commit 3739ae8

Please sign in to comment.