From 0dba1f8dc34bf8528887075e0c5c9fef6220c520 Mon Sep 17 00:00:00 2001 From: lhu Date: Fri, 7 Feb 2025 13:11:04 -0500 Subject: [PATCH] Remove unused off heap related APIs 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 --- .../SparseAddressOrderedFixedSizeDataPool.cpp | 47 ------------------- .../SparseAddressOrderedFixedSizeDataPool.hpp | 26 ---------- gc/base/SparseVirtualMemory.cpp | 33 ------------- gc/base/SparseVirtualMemory.hpp | 21 --------- 4 files changed, 127 deletions(-) diff --git a/gc/base/SparseAddressOrderedFixedSizeDataPool.cpp b/gc/base/SparseAddressOrderedFixedSizeDataPool.cpp index 19ef19feeca..4c1063f8514 100644 --- a/gc/base/SparseAddressOrderedFixedSizeDataPool.cpp +++ b/gc/base/SparseAddressOrderedFixedSizeDataPool.cpp @@ -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) { @@ -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) { @@ -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) { diff --git a/gc/base/SparseAddressOrderedFixedSizeDataPool.hpp b/gc/base/SparseAddressOrderedFixedSizeDataPool.hpp index dca41a7f204..bf28f92f5c0 100644 --- a/gc/base/SparseAddressOrderedFixedSizeDataPool.hpp +++ b/gc/base/SparseAddressOrderedFixedSizeDataPool.hpp @@ -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. @@ -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) * @@ -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. diff --git a/gc/base/SparseVirtualMemory.cpp b/gc/base/SparseVirtualMemory.cpp index 2b495dcb1b5..d7b7b770864 100644 --- a/gc/base/SparseVirtualMemory.cpp +++ b/gc/base/SparseVirtualMemory.cpp @@ -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) { @@ -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) { diff --git a/gc/base/SparseVirtualMemory.hpp b/gc/base/SparseVirtualMemory.hpp index 26707331c55..961d5fc02f8 100644 --- a/gc/base/SparseVirtualMemory.hpp +++ b/gc/base/SparseVirtualMemory.hpp @@ -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. @@ -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