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

Fixed erroneous data cycle detection in unions

This commit is contained in:
Brian Fiete 2021-02-08 07:56:23 -08:00
parent cf878097fe
commit fd001a2f69
3 changed files with 12 additions and 5 deletions

View file

@ -2642,8 +2642,8 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
if (typeInstance->mIsFinishingType) if (typeInstance->mIsFinishingType)
{ {
// This type already failed if (typeInstance->mTypeFailed)
return; return;
} }
if (!typeInstance->mTypeFailed) if (!typeInstance->mTypeFailed)
@ -3736,7 +3736,12 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
if (populateChildType) if (populateChildType)
{ {
BF_ASSERT(!resolvedFieldType->IsDataIncomplete()); if (resolvedFieldType->IsFinishingType())
{
AssertErrorState();
}
else
BF_ASSERT(!resolvedFieldType->IsDataIncomplete());
} }
else else
{ {

View file

@ -1686,7 +1686,7 @@ BfType* BfTypeInstance::GetUnionInnerType(bool* wantSplat)
{ {
SetAndRestoreValue<BfFieldDef*> prevTypeRef(mContext->mCurTypeState->mCurFieldDef, fieldDef); SetAndRestoreValue<BfFieldDef*> prevTypeRef(mContext->mCurTypeState->mCurFieldDef, fieldDef);
mModule->PopulateType(checkInnerType); mModule->PopulateType(checkInnerType, checkInnerType->IsValueType() ? BfPopulateType_Data : BfPopulateType_Declaration);
if (checkInnerType->mSize > unionSize) if (checkInnerType->mSize > unionSize)
unionSize = checkInnerType->mSize; unionSize = checkInnerType->mSize;
@ -2196,7 +2196,7 @@ bool BfTypeInstance::WantsGCMarking()
return true; return true;
if ((IsEnum()) && (!IsPayloadEnum())) if ((IsEnum()) && (!IsPayloadEnum()))
return false; return false;
BF_ASSERT(mDefineState >= BfTypeDefineState_Defined); BF_ASSERT((mDefineState >= BfTypeDefineState_Defined) || (mTypeFailed));
return mWantsGCMarking; return mWantsGCMarking;
} }

View file

@ -501,6 +501,7 @@ public:
virtual bool HasBeenReferenced() { return mDefineState != BfTypeDefineState_Undefined; } virtual bool HasBeenReferenced() { return mDefineState != BfTypeDefineState_Undefined; }
virtual bool HasTypeFailed() { return false; } virtual bool HasTypeFailed() { return false; }
virtual bool IsDataIncomplete() { return mDefineState == BfTypeDefineState_Undefined; } virtual bool IsDataIncomplete() { return mDefineState == BfTypeDefineState_Undefined; }
virtual bool IsFinishingType() { return false; }
virtual bool IsIncomplete() { return mDefineState < BfTypeDefineState_Defined; } virtual bool IsIncomplete() { return mDefineState < BfTypeDefineState_Defined; }
virtual bool IsDeleting() { return ((mRebuildFlags & (BfTypeRebuildFlag_Deleted | BfTypeRebuildFlag_DeleteQueued)) != 0); } virtual bool IsDeleting() { return ((mRebuildFlags & (BfTypeRebuildFlag_Deleted | BfTypeRebuildFlag_DeleteQueued)) != 0); }
virtual bool IsDeclared() { return mDefineState >= BfTypeDefineState_Declared; } virtual bool IsDeclared() { return mDefineState >= BfTypeDefineState_Declared; }
@ -1954,6 +1955,7 @@ public:
virtual bool IsReified() override { return mIsReified; } virtual bool IsReified() override { return mIsReified; }
virtual bool NeedsExplicitAlignment() override { return !IsSizeAligned() || mIsPacked; } virtual bool NeedsExplicitAlignment() override { return !IsSizeAligned() || mIsPacked; }
virtual bool IsDataIncomplete() override { return ((mTypeIncomplete) || (mBaseTypeMayBeIncomplete)) && (!mNeedsMethodProcessing); } virtual bool IsDataIncomplete() override { return ((mTypeIncomplete) || (mBaseTypeMayBeIncomplete)) && (!mNeedsMethodProcessing); }
virtual bool IsFinishingType() override { return mIsFinishingType; }
virtual bool IsIncomplete() override { return (mTypeIncomplete) || (mBaseTypeMayBeIncomplete); } virtual bool IsIncomplete() override { return (mTypeIncomplete) || (mBaseTypeMayBeIncomplete); }
virtual bool IsSplattable() override { BF_ASSERT((mInstSize >= 0) || (!IsComposite())); return mIsSplattable; } virtual bool IsSplattable() override { BF_ASSERT((mInstSize >= 0) || (!IsComposite())); return mIsSplattable; }
virtual int GetSplatCount() override; virtual int GetSplatCount() override;