1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Fixed Object alloc clearing with extensions

This commit is contained in:
Brian Fiete 2022-02-15 12:21:56 -05:00
parent f0b5101a67
commit 6af0f111c0
2 changed files with 14 additions and 1 deletions

View file

@ -16090,7 +16090,7 @@ void BeMCContext::Generate(BeFunction* function)
mDbgPreferredRegs[32] = X64Reg_R8;*/ mDbgPreferredRegs[32] = X64Reg_R8;*/
//mDbgPreferredRegs[8] = X64Reg_RAX; //mDbgPreferredRegs[8] = X64Reg_RAX;
mDebugging = (function->mName == "?Main@TestProgram@BeefTest@bf@@SATint@@PEAV?$Array1@PEAVString@System@bf@@@System@3@@Z"); //mDebugging = (function->mName == "?Main@TestProgram@BeefTest@bf@@SATint@@PEAV?$Array1@PEAVString@System@bf@@@System@3@@Z");
// || (function->mName == "?MethodA@TestProgram@BeefTest@bf@@CAXXZ"); // || (function->mName == "?MethodA@TestProgram@BeefTest@bf@@CAXXZ");
// || (function->mName == "?Hey@Blurg@bf@@SAXXZ") // || (function->mName == "?Hey@Blurg@bf@@SAXXZ")
// ; // ;

View file

@ -20410,7 +20410,20 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup,
auto thisVal = GetThis(); auto thisVal = GetThis();
int prevSize = 0; int prevSize = 0;
if (mContext->mBfObjectType != NULL) if (mContext->mBfObjectType != NULL)
{
prevSize = mContext->mBfObjectType->mInstSize; prevSize = mContext->mBfObjectType->mInstSize;
PopulateType(mContext->mBfObjectType);
// If we have object extensions, clear out starting at the extension
for (auto& fieldInstance : mContext->mBfObjectType->mFieldInstances)
{
if (fieldInstance.GetFieldDef()->mDeclaringType->IsExtension())
{
prevSize = fieldInstance.mDataOffset;
break;
}
}
}
int curSize = mCurTypeInstance->mInstSize; int curSize = mCurTypeInstance->mInstSize;
if (curSize > prevSize) if (curSize > prevSize)
{ {