Skip to content

Commit

Permalink
Merge pull request #7409 from LinHu2016/off-heap-firstpart
Browse files Browse the repository at this point in the history
Remove OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION
  • Loading branch information
babsingh authored Jul 17, 2024
2 parents 3223d8d + 3397199 commit 56cb81f
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 155 deletions.
1 change: 0 additions & 1 deletion cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ set(OMR_GC_MODRON_COMPACTION OFF CACHE BOOL "TODO: Document")
set(OMR_GC_MODRON_CONCURRENT_MARK OFF CACHE BOOL "TODO: Document")
set(OMR_GC_MODRON_SCAVENGER OFF CACHE BOOL "TODO: Document")
set(OMR_GC_DOUBLE_MAP_ARRAYLETS OFF CACHE BOOL "TODO: Document")
set(OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION OFF CACHE BOOL "TODO: Document")
set(OMR_GC_CONCURRENT_SCAVENGER OFF CACHE BOOL "TODO: Document")
set(OMR_GC_CONCURRENT_SWEEP OFF CACHE BOOL "TODO: Document")
set(OMR_GC_IDLE_HEAP_MANAGER OFF CACHE BOOL "TODO: Document")
Expand Down
22 changes: 0 additions & 22 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,6 @@ OMR_GC_LEAF_BITS
OMR_GC_CONCURRENT_SWEEP
OMR_GC_CONCURRENT_SCAVENGER
OMR_GC_DOUBLE_MAP_ARRAYLETS
OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION
OMR_GC_MODRON_SCAVENGER
OMR_GC_MODRON_CONCURRENT_MARK
OMR_GC_MODRON_COMPACTION
Expand Down Expand Up @@ -859,7 +858,6 @@ enable_OMR_GC_MODRON_COMPACTION
enable_OMR_GC_MODRON_CONCURRENT_MARK
enable_OMR_GC_MODRON_SCAVENGER
enable_OMR_GC_DOUBLE_MAP_ARRAYLETS
enable_OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION
enable_OMR_GC_CONCURRENT_SCAVENGER
enable_OMR_GC_CONCURRENT_SWEEP
enable_OMR_GC_LEAF_BITS
Expand Down Expand Up @@ -1625,8 +1623,6 @@ Optional Features:
--enable-OMR_GC_DOUBLE_MAP_ARRAYLETS
--enable-OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION
--enable-OMR_GC_CONCURRENT_SCAVENGER
--enable-OMR_GC_CONCURRENT_SWEEP
Expand Down Expand Up @@ -5399,24 +5395,6 @@ else
OMR_GC_DOUBLE_MAP_ARRAYLETS=0
fi
# Check whether --enable-OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION was given.
if test "${enable_OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION+set}" = set; then :
enableval=$enable_OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION; if test "x${enableval}" = xyes; then :
OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION=1
$as_echo "#define OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION 1" >>confdefs.h
else
OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION=0
fi
else
OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION=0
fi
# Check whether --enable-OMR_GC_CONCURRENT_SCAVENGER was given.
Expand Down
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ OMRCFG_DEFINE_FLAG_OFF([OMR_GC_MODRON_COMPACTION])
OMRCFG_DEFINE_FLAG_OFF([OMR_GC_MODRON_CONCURRENT_MARK])
OMRCFG_DEFINE_FLAG_OFF([OMR_GC_MODRON_SCAVENGER])
OMRCFG_DEFINE_FLAG_OFF([OMR_GC_DOUBLE_MAP_ARRAYLETS])
OMRCFG_DEFINE_FLAG_OFF([OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION])
OMRCFG_DEFINE_FLAG_OFF([OMR_GC_CONCURRENT_SCAVENGER])
OMRCFG_DEFINE_FLAG_OFF([OMR_GC_CONCURRENT_SWEEP])
OMRCFG_DEFINE_FLAG_OFF([OMR_GC_LEAF_BITS])
Expand Down
31 changes: 0 additions & 31 deletions gc/base/SparseAddressOrderedFixedSizeDataPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,37 +127,6 @@ MM_SparseAddressOrderedFixedSizeDataPool::kill(MM_EnvironmentBase *env)
env->getForge()->free(this);
}

#if defined(OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION)
struct J9PortVmemIdentifier*
MM_SparseAddressOrderedFixedSizeDataPool::findIdentifierForSparseDataPtr(void *dataPtr)
{
struct J9PortVmemIdentifier *identifier = NULL;
MM_SparseDataTableEntry lookupEntry = MM_SparseDataTableEntry(dataPtr);
MM_SparseDataTableEntry *entry = (MM_SparseDataTableEntry *)hashTableFind(_objectToSparseDataTable, &lookupEntry);
if ((NULL == entry) || (entry->dataPtr != dataPtr)) {
Trc_MM_SparseAddressOrderedFixedSizeDataPool_findEntry_failure(dataPtr);
} else {
identifier = entry->identifier;
}

return identifier;
}

void
MM_SparseAddressOrderedFixedSizeDataPool::recordDoubleMapIdentifierForData(void *dataPtr, struct J9PortVmemIdentifier *identifier)
{
MM_SparseDataTableEntry lookupEntry = MM_SparseDataTableEntry(dataPtr);
MM_SparseDataTableEntry *entry = (MM_SparseDataTableEntry *)hashTableFind(_objectToSparseDataTable, &lookupEntry);

if ((NULL == entry) || (entry->dataPtr != dataPtr)) {
Trc_MM_SparseAddressOrderedFixedSizeDataPool_findEntry_failure(dataPtr);
} else {
Trc_MM_SparseAddressOrderedFixedSizeDataPool_findEntry_success(dataPtr);
entry->identifier = identifier;
}
}
#endif /* OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION */

bool
MM_SparseAddressOrderedFixedSizeDataPool::mapSparseDataPtrToHeapProxyObjectPtr(void *dataPtr, void *proxyObjPtr, uintptr_t size)
{
Expand Down
31 changes: 0 additions & 31 deletions gc/base/SparseAddressOrderedFixedSizeDataPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ class MM_SparseDataTableEntry
void *_dataPtr; /**< Object data pointer related to proxy object */
void *_proxyObjPtr; /**< Pointer to proxy object that is residing in-heap */
uintptr_t _size; /**< Total size of the data pointed to by dataPtr */
#if defined(OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION)
struct J9PortVmemIdentifier *_identifier; /**< Identifier associated with double mapped region */
#endif /* OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION */

/*
* Function members
Expand All @@ -74,16 +71,6 @@ class MM_SparseDataTableEntry
, _size(size)
{
}

#if defined(OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION)
MM_SparseDataTableEntry(void *dataPtr, void* proxyObjPtr, uintptr_t size, struct J9PortVmemIdentifier *identifier)
: _dataPtr(dataPtr)
, _proxyObjPtr(proxyObjPtr)
, _size(size)
, _identifier(identifier)
{
}
#endif /* OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION */
};

class MM_SparseAddressOrderedFixedSizeDataPool : public MM_BaseVirtual
Expand Down Expand Up @@ -132,24 +119,6 @@ class MM_SparseAddressOrderedFixedSizeDataPool : public MM_BaseVirtual
*/
bool returnFreeListEntry(void *address, uintptr_t size);

#if defined(OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION)
/**
* Record J9PortVmemIdentifier associated with data pointer
*
* @param dataPtr void* Data pointer
* @param identifier J9PortVmemIdentifier for data pointer
*/
void recordDoubleMapIdentifierForData(void *dataPtr, struct J9PortVmemIdentifier *identifier);

/**
* Get J9PortVmemIdentifier associated with data pointer
*
* @param dataPtr void* Data pointer
* @return J9PortVmemIdentifier of data pointer
*/
struct J9PortVmemIdentifier* findIdentifierForSparseDataPtr(void *dataPtr);
#endif /* OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION */

/**
* Add object entry to the hash table that maps the proxyObjPtr to the data pointer
*
Expand Down
44 changes: 0 additions & 44 deletions gc/base/SparseVirtualMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
*******************************************************************************/

#include <string.h>
#if defined(OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION)
#include <sys/mman.h>
#include <sys/errno.h>
#endif /* OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION */

#include "omrcomp.h"
#include "omrport.h"
Expand Down Expand Up @@ -187,48 +183,8 @@ bool
MM_SparseVirtualMemory::decommitMemory(MM_EnvironmentBase* env, void* address, uintptr_t size)
{
bool ret = false;
#if defined(OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION)
ret = decommitMemoryForDoubleMapping(env, address, size);
#else /* OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION */
void *highValidAddress = (void *)((uintptr_t)address + size);
ret = MM_VirtualMemory::decommitMemory(address, size, address, highValidAddress);
#endif /* OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION */

return ret;
}

#if defined(OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION)
bool
MM_SparseVirtualMemory::decommitMemoryForDoubleMapping(MM_EnvironmentBase* env, void *dataPtr, uintptr_t dataSize)
{
int rc = 0;
OMRPORT_ACCESS_FROM_OMRPORT(env->getPortLibrary());
struct J9PortVmemIdentifier *identifier = _sparseDataPool->findIdentifierForSparseDataPtr(dataPtr);

if ((0 == identifier->size) || (NULL == identifier->address)) {
/* Maybe this address was already returned to the pool - Should be unreachable, but should we assert? */
Assert_MM_unreachable();
} else {
Assert_GC_true_with_message4(env, ((identifier->size == dataSize) && (identifier->address == dataPtr)),
"dataPtr: %p, identifier->address: %p, dataSize: %zu, identifier->size: %zu\n", dataPtr, identifier->address, dataSize, identifier->size);
Assert_MM_true((getHeapBase() <= dataPtr) && (getHeapTop() > dataPtr));

rc = omrvmem_release_double_mapped_region(dataPtr, dataSize, identifier);

if (-1 == rc) {
Trc_MM_SparseVirtualMemory_releaseDoubleMappedRegion_failure(dataPtr, identifier->address, (void *)dataSize, (void *)identifier->size);
} else {
Trc_MM_SparseVirtualMemory_releaseDoubleMappedRegion_success(dataPtr, identifier->address, (void *)dataSize, (void *)identifier->size);
}
}
return -1 != rc;
}

void
MM_SparseVirtualMemory::recordDoubleMapIdentifierForData(void *dataPtr, struct J9PortVmemIdentifier *identifier)
{
omrthread_monitor_enter(_largeObjectVirtualMemoryMutex);
_sparseDataPool->recordDoubleMapIdentifierForData(dataPtr, identifier);
omrthread_monitor_exit(_largeObjectVirtualMemoryMutex);
}
#endif /* OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION */
23 changes: 0 additions & 23 deletions gc/base/SparseVirtualMemory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,6 @@ class MM_SparseVirtualMemory : public MM_VirtualMemory {
* Function members
*/
private:
#if defined(OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION)
/**
* This is primarily meant for OSX since OSX is very lazy when it comes to releasing memory. Simply calling msync, or
* madvise is not enough to decommit memory. Therefore, we need to force the OS to return the pages to the OS, and
* we do so by mmaping the region in interest.
*
* @param dataSize uintptr_t size of region to be mmaped
* @param dataPtr dataPtr Region location that'll be mmaped
*
* @return true if sparse region was successfully mmaped, false otherwise
*/
bool decommitMemoryForDoubleMapping(MM_EnvironmentBase* env, void *dataPtr, uintptr_t dataSize);
#endif /* OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION */

protected:
bool initialize(MM_EnvironmentBase* env, uint32_t memoryCategory);
Expand Down Expand Up @@ -107,16 +94,6 @@ class MM_SparseVirtualMemory : public MM_VirtualMemory {
*/
bool updateSparseDataEntryAfterObjectHasMoved(void *dataPtr, void *proxyObjPtr);

#if defined(OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION)
/**
* Record J9PortVmemIdentifier associated with data pointer
*
* @param dataPtr void* Data pointer
* @param identifier J9PortVmemIdentifier for data pointer
*/
void recordDoubleMapIdentifierForData(void *dataPtr, struct J9PortVmemIdentifier *identifier);
#endif /* OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION */

/**
* Find free space at sparse heap address space that satisfies the given size
*
Expand Down
1 change: 0 additions & 1 deletion include_core/omrcfg.cmake.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
#cmakedefine OMR_GC_THREAD_LOCAL_HEAP
#cmakedefine OMR_GC_VLHGC
#cmakedefine OMR_GC_DOUBLE_MAP_ARRAYLETS
#cmakedefine OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION
#cmakedefine OMR_GC_VLHGC_CONCURRENT_COPY_FORWARD

/**
Expand Down
1 change: 0 additions & 1 deletion include_core/omrcfg.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
#undef OMR_GC_SEGREGATED_HEAP
#undef OMR_GC_THREAD_LOCAL_HEAP
#undef OMR_GC_DOUBLE_MAP_ARRAYLETS
#undef OMR_GC_DOUBLE_MAPPING_FOR_SPARSE_HEAP_ALLOCATION
#undef OMR_GC_VLHGC_CONCURRENT_COPY_FORWARD

/**
Expand Down

0 comments on commit 56cb81f

Please sign in to comment.