1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed HotTypeVersion base type dependency

This commit is contained in:
Brian Fiete 2022-08-26 07:08:57 -07:00
parent 9062662ffb
commit 2f6484894e

View file

@ -4489,42 +4489,45 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
return;
}
if ((mCompiler->mOptions.mAllowHotSwapping) &&
(typeInstance->mDefineState < BfTypeDefineState_HasInterfaces_Direct) &&
(typeInstance->mDefineState != BfTypeDefineState_ResolvingBaseType))
if (mCompiler->mOptions.mAllowHotSwapping)
{
if (typeInstance->mHotTypeData == NULL)
if (typeInstance->mDefineState < BfTypeDefineState_HasInterfaces_Direct)
{
typeInstance->mHotTypeData = new BfHotTypeData();
BfLogSysM("Created HotTypeData %p created for type %p in DoPopulateType\n", typeInstance->mHotTypeData, typeInstance);
if (typeInstance->mHotTypeData == NULL)
{
typeInstance->mHotTypeData = new BfHotTypeData();
BfLogSysM("Created HotTypeData %p created for type %p in DoPopulateType\n", typeInstance->mHotTypeData, typeInstance);
}
// Clear any unused versions (if we have errors, etc)
if (mCompiler->mHotState != NULL)
typeInstance->mHotTypeData->ClearVersionsAfter(mCompiler->mHotState->mCommittedHotCompileIdx);
else
BF_ASSERT(typeInstance->mHotTypeData->mTypeVersions.IsEmpty()); // We should have created a new HotTypeData when rebuilding the type
BfHotTypeVersion* hotTypeVersion = new BfHotTypeVersion();
hotTypeVersion->mTypeId = typeInstance->mTypeId;
hotTypeVersion->mDeclHotCompileIdx = mCompiler->mOptions.mHotCompileIdx;
if (mCompiler->IsHotCompile())
hotTypeVersion->mCommittedHotCompileIdx = -1;
else
hotTypeVersion->mCommittedHotCompileIdx = 0;
hotTypeVersion->mRefCount++;
typeInstance->mHotTypeData->mTypeVersions.Add(hotTypeVersion);
BfLogSysM("BfHotTypeVersion %p created for type %p\n", hotTypeVersion, typeInstance);
}
// Clear any unused versions (if we have errors, etc)
if (mCompiler->mHotState != NULL)
typeInstance->mHotTypeData->ClearVersionsAfter(mCompiler->mHotState->mCommittedHotCompileIdx);
else
BF_ASSERT(typeInstance->mHotTypeData->mTypeVersions.IsEmpty()); // We should have created a new HotTypeData when rebuilding the type
BfHotTypeVersion* hotTypeVersion = new BfHotTypeVersion();
hotTypeVersion->mTypeId = typeInstance->mTypeId;
auto hotTypeVersion = typeInstance->mHotTypeData->mTypeVersions.back();
if (typeInstance->mBaseType != NULL)
{
if (typeInstance->mBaseType->mHotTypeData != NULL)
hotTypeVersion->mBaseType = typeInstance->mBaseType->mHotTypeData->GetLatestVersion();
else
else if (populateType >= BfPopulateType_Interfaces_All)
{
AssertErrorState();
}
}
hotTypeVersion->mDeclHotCompileIdx = mCompiler->mOptions.mHotCompileIdx;
if (mCompiler->IsHotCompile())
hotTypeVersion->mCommittedHotCompileIdx = -1;
else
hotTypeVersion->mCommittedHotCompileIdx = 0;
hotTypeVersion->mRefCount++;
typeInstance->mHotTypeData->mTypeVersions.Add(hotTypeVersion);
BfLogSysM("BfHotTypeVersion %p created for type %p\n", hotTypeVersion, typeInstance);
}
BF_ASSERT(!typeInstance->mNeedsMethodProcessing);