1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-12 05:14:10 +02:00

Calling convention fix (only triggered in Win32)

This commit is contained in:
Brian Fiete 2020-04-09 14:37:17 -07:00
parent 470cf589ce
commit accc74957a

View file

@ -127,7 +127,10 @@ void BFGC::RawMarkSpan(tcmalloc_raw::Span* span, int expectedStartPage)
extraDataSize += (1 + stackTraceCount) * sizeof(intptr); extraDataSize += (1 + stackTraceCount) * sizeof(intptr);
} }
typedef void(*MarkFunc)(void*); struct MarkTarget
{
};
typedef void(MarkTarget::*MarkFunc)();
MarkFunc markFunc = *(MarkFunc*)&rawAllocData->mMarkFunc; MarkFunc markFunc = *(MarkFunc*)&rawAllocData->mMarkFunc;
// It's possible we can overestimate elemCount, particularly for large allocations. This doesn't cause a problem // It's possible we can overestimate elemCount, particularly for large allocations. This doesn't cause a problem
@ -136,8 +139,8 @@ void BFGC::RawMarkSpan(tcmalloc_raw::Span* span, int expectedStartPage)
intptr dataSize = elementSize - extraDataSize; intptr dataSize = elementSize - extraDataSize;
intptr elemCount = dataSize / elemStride; intptr elemCount = dataSize / elemStride;
for (intptr elemIdx = 0; elemIdx < elemCount; elemIdx++) for (intptr elemIdx = 0; elemIdx < elemCount; elemIdx++)
{ {
markFunc((uint8*)spanPtr + elemIdx * elemStride); (((MarkTarget*)((uint8*)spanPtr + elemIdx * elemStride))->*markFunc)();
} }
} }
} }