Skip to content

Commit

Permalink
Add assert to Heap_Relocate (#2775)
Browse files Browse the repository at this point in the history
***NO_CI***
  • Loading branch information
josesimoes authored Sep 26, 2023
1 parent bd3bd05 commit 86df4b1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/CLR/Core/GarbageCollector_Compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ void CLR_RT_GarbageCollector::Heap_Relocate(void **ref)
NATIVE_PROFILE_CLR_CORE();
CLR_UINT8 *dst = (CLR_UINT8 *)*ref;

#if NANOCLR_VALIDATE_HEAP == NANOCLR_VALIDATE_HEAP_0_None
void *destinationAddress;
#endif

#if NANOCLR_VALIDATE_HEAP > NANOCLR_VALIDATE_HEAP_0_None
if (g_CLR_RT_GarbageCollector.m_relocWorker)
{
Expand Down Expand Up @@ -476,7 +480,11 @@ void CLR_RT_GarbageCollector::Heap_Relocate(void **ref)
}
else
{
*ref = (void *)(dst + relocCurrent.m_offset);
destinationAddress = (void *)(dst + relocCurrent.m_offset);
_ASSERTE(destinationAddress >= (void *)s_CLR_RT_Heap.m_location);
_ASSERTE(destinationAddress < (void *)(s_CLR_RT_Heap.m_location + s_CLR_RT_Heap.m_size));

*ref = destinationAddress;

return;
}
Expand Down

0 comments on commit 86df4b1

Please sign in to comment.