Skip to content

Commit

Permalink
Remove unused off heap related APIs
Browse files Browse the repository at this point in the history
caller has been updated to use new signature of
the below APIs, remove the old unused APIs.

class MM_SparseVirtualMemory
updateSparseDataEntryAfterObjectHasMoved()
freeSparseRegionAndUnmapFromHeapObject()

class MM_SparseAddressOrderedFixedSizeDataPool
isValidDataPtr()
unmapSparseDataPtrFromHeapProxyObjectPtr()
updateSparseDataEntryAfterObjectHasMoved()

Signed-off-by: lhu <[email protected]>
  • Loading branch information
LinHu2016 committed Feb 7, 2025
1 parent 74871b1 commit 0dba1f8
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 127 deletions.
47 changes: 0 additions & 47 deletions gc/base/SparseAddressOrderedFixedSizeDataPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,6 @@ MM_SparseAddressOrderedFixedSizeDataPool::mapSparseDataPtrToHeapProxyObjectPtr(v
return ret;
}

bool
MM_SparseAddressOrderedFixedSizeDataPool::unmapSparseDataPtrFromHeapProxyObjectPtr(void *dataPtr)
{
bool ret = true;
MM_SparseDataTableEntry entryToRemove = MM_SparseDataTableEntry(dataPtr);

if (0 != hashTableRemove(_objectToSparseDataTable, &entryToRemove)) {
Trc_MM_SparseAddressOrderedFixedSizeDataPool_removeEntry_failure(dataPtr);
ret = false;
} else {
Trc_MM_SparseAddressOrderedFixedSizeDataPool_removeEntry_success(dataPtr);
}

return ret;
}

bool
MM_SparseAddressOrderedFixedSizeDataPool::unmapSparseDataPtrFromHeapProxyObjectPtr(void *dataPtr, void *proxyObjPtr, uintptr_t size)
{
Expand Down Expand Up @@ -217,19 +201,6 @@ MM_SparseAddressOrderedFixedSizeDataPool::findHeapProxyObjectPtrForSparseDataPtr
return proxyObjPtr;
}

bool
MM_SparseAddressOrderedFixedSizeDataPool::isValidDataPtr(void *dataPtr)
{
MM_SparseDataTableEntry *entry = findSparseDataTableEntryForSparseDataPtr(dataPtr);
bool ret = true;

if (entry != NULL) {
ret = (entry->_dataPtr == dataPtr);
}

return ret;
}

bool
MM_SparseAddressOrderedFixedSizeDataPool::isValidDataPtr(void *dataPtr, void *proxyObjPtr, uintptr_t size)
{
Expand Down Expand Up @@ -390,24 +361,6 @@ MM_SparseAddressOrderedFixedSizeDataPool::returnFreeListEntry(void *dataAddr, ui
return true;
}

bool
MM_SparseAddressOrderedFixedSizeDataPool::updateSparseDataEntryAfterObjectHasMoved(void *dataPtr, void *proxyObjPtr)
{
bool ret = true;
MM_SparseDataTableEntry lookupEntry = MM_SparseDataTableEntry(dataPtr);
MM_SparseDataTableEntry *entry = (MM_SparseDataTableEntry *)hashTableFind(_objectToSparseDataTable, &lookupEntry);

if ((NULL != entry) && (entry->_dataPtr == dataPtr)) {
Trc_MM_SparseAddressOrderedFixedSizeDataPool_updateEntry_success(dataPtr, entry->_proxyObjPtr, proxyObjPtr);
entry->_proxyObjPtr = proxyObjPtr;
} else {
Trc_MM_SparseAddressOrderedFixedSizeDataPool_findEntry_failure(dataPtr);
ret = false;
}

return ret;
}

bool
MM_SparseAddressOrderedFixedSizeDataPool::updateSparseDataEntryAfterObjectHasMoved(void *dataPtr, void *oldProxyObjPtr, uintptr_t size, void *newProxyObjPtr)
{
Expand Down
26 changes: 0 additions & 26 deletions gc/base/SparseAddressOrderedFixedSizeDataPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,6 @@ class MM_SparseAddressOrderedFixedSizeDataPool : public MM_BaseVirtual
*/
bool mapSparseDataPtrToHeapProxyObjectPtr(void *dataPtr, void *proxyObjPtr, uintptr_t size);

/**
* Remove entry from the hash table that is associated the object data pointer provided
*
* @param dataPtr void* Data pointer
*
* @return true if key associated to dataPtr is removed successfully, false otherwise
*/
bool unmapSparseDataPtrFromHeapProxyObjectPtr(void *dataPtr);

/**
* Remove entry from the hash table that is associated the object data pointer provided.
* Verify if the entry is consistent(the size and associated the object) before removing.
Expand Down Expand Up @@ -176,13 +167,6 @@ class MM_SparseAddressOrderedFixedSizeDataPool : public MM_BaseVirtual
*/
void *findHeapProxyObjectPtrForSparseDataPtr(void *dataPtr);

/**
* Check if the given data pointer is valid
*
* @param dataPtr void* Data pointer
* @return true if data pointer is valid
*/
bool isValidDataPtr(void *dataPtr);
/**
* Check if the given data pointer is valid and consistent(dataPtr, proxyObjPtr and size)
*
Expand Down Expand Up @@ -225,16 +209,6 @@ class MM_SparseAddressOrderedFixedSizeDataPool : public MM_BaseVirtual
return _allocObjectCount;
}

/**
* Update the proxyObjPtr after an object has moved for the sparse data entry associated with the given dataPtr.
*
* @param dataPtr void* Data pointer
* @param proxyObjPtr void* Updated in-heap proxy object pointer for data pointer
*
* @return true if the sparse data entry was successfully updated, false otherwise
*/
bool updateSparseDataEntryAfterObjectHasMoved(void *dataPtr, void *proxyObjPtr);

/**
* Update the newProxyObjPtr after an object has moved for the sparse data entry associated with the given dataPtr.
* Verify if the entry is consistent(the size and associated the object) before updating.
Expand Down
33 changes: 0 additions & 33 deletions gc/base/SparseVirtualMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,6 @@ MM_SparseVirtualMemory::kill(MM_EnvironmentBase *env)
env->getForge()->free(this);
}

bool
MM_SparseVirtualMemory::updateSparseDataEntryAfterObjectHasMoved(void *dataPtr, void *objPtr)
{
omrthread_monitor_enter(_largeObjectVirtualMemoryMutex);
bool ret = _sparseDataPool->updateSparseDataEntryAfterObjectHasMoved(dataPtr, objPtr);
omrthread_monitor_exit(_largeObjectVirtualMemoryMutex);
return ret;
}

bool
MM_SparseVirtualMemory::updateSparseDataEntryAfterObjectHasMoved(void *dataPtr, void *oldProxyObjPtr, uintptr_t size, void *newProxyObjPtr)
{
Expand Down Expand Up @@ -167,30 +158,6 @@ MM_SparseVirtualMemory::allocateSparseFreeEntryAndMapToHeapObject(void *proxyObj
return sparseHeapAddr;
}

bool
MM_SparseVirtualMemory::freeSparseRegionAndUnmapFromHeapObject(MM_EnvironmentBase *env, void *dataPtr)
{
uintptr_t dataSize = _sparseDataPool->findObjectDataSizeForSparseDataPtr(dataPtr);
bool ret = true;

if ((NULL != dataPtr) && (0 != dataSize)) {
uintptr_t adjustedSize = adjustSize(dataSize);
ret = decommitMemory(env, dataPtr, adjustedSize);
if (ret) {
omrthread_monitor_enter(_largeObjectVirtualMemoryMutex);
ret = (_sparseDataPool->returnFreeListEntry(dataPtr, adjustedSize) && _sparseDataPool->unmapSparseDataPtrFromHeapProxyObjectPtr(dataPtr));
omrthread_monitor_exit(_largeObjectVirtualMemoryMutex);
Trc_MM_SparseVirtualMemory_decommitMemory_success(dataPtr, (void *)adjustedSize);
} else {
Trc_MM_SparseVirtualMemory_decommitMemory_failure(dataPtr, (void *)adjustedSize);
/* TODO: Assert Fatal in case of failure? */
Assert_MM_true(false);
}
}

return ret;
}

bool
MM_SparseVirtualMemory::freeSparseRegionAndUnmapFromHeapObject(MM_EnvironmentBase *env, void *dataPtr, void *proxyObjPtr, uintptr_t size)
{
Expand Down
21 changes: 0 additions & 21 deletions gc/base/SparseVirtualMemory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,6 @@ class MM_SparseVirtualMemory : public MM_VirtualMemory {
static MM_SparseVirtualMemory* newInstance(MM_EnvironmentBase* env, uint32_t memoryCategory, MM_Heap *in_heap);
virtual void kill(MM_EnvironmentBase *env);

/**
* After the in-heap proxy object pointer has moved, update the proxyObjPtr for the sparse data entry associated with the dataPtr.
*
* @param dataPtr void* Data pointer
* @param proxyObjPtr void* Updated in-heap proxy object pointer for the data pointer
*
* @return true if the table entry was successfully updated, false otherwise
*/
bool updateSparseDataEntryAfterObjectHasMoved(void *dataPtr, void *proxyObjPtr);

/**
* After the in-heap proxy object pointer has moved, update the proxyObjPtr for the sparse data entry associated with the dataPtr.
* Verify if the entry is consistent(the size and associated the object) before updating.
Expand All @@ -122,17 +112,6 @@ class MM_SparseVirtualMemory : public MM_VirtualMemory {
*/
void *allocateSparseFreeEntryAndMapToHeapObject(void *proxyObjPtr, uintptr_t size);

/**
* Once object is collected by GC, we need to free the sparse region associated
* with the object pointer. Therefore we decommit sparse region and return free
* region to the sparse free region pool.
*
* @param dataPtr void* Data pointer
*
* @return true if region associated to object was decommited and freed successfully, false otherwise
*/
bool freeSparseRegionAndUnmapFromHeapObject(MM_EnvironmentBase* env, void *dataPtr);

/**
* Once object is collected by GC, we need to free the sparse region associated
* with the object pointer. Therefore we decommit sparse region and return free
Expand Down

0 comments on commit 0dba1f8

Please sign in to comment.