mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 06:44:10 +02:00
Comptime mid-compile rebuild guard
This commit is contained in:
parent
c3f7a996e0
commit
db8a1b6367
2 changed files with 17 additions and 4 deletions
|
@ -1201,6 +1201,18 @@ void BfContext::RebuildDependentTypes_MidCompile(BfDependedType* dType, const St
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BfContext::CanRebuild(BfType* type)
|
||||||
|
{
|
||||||
|
if (type->mRevision == mCompiler->mRevision)
|
||||||
|
return false;
|
||||||
|
if ((type->mDefineState == BfTypeDefineState_Declaring) ||
|
||||||
|
(type->mDefineState == BfTypeDefineState_ResolvingBaseType) ||
|
||||||
|
(type->mDefineState == BfTypeDefineState_CETypeInit) ||
|
||||||
|
(type->mDefineState == BfTypeDefineState_DefinedAndMethodsSlotting))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Dependencies cascade as such:
|
// Dependencies cascade as such:
|
||||||
// DerivedFrom / StructMemberData: these change the layout of memory for the dependent classes,
|
// DerivedFrom / StructMemberData: these change the layout of memory for the dependent classes,
|
||||||
// so not only do the dependent classes need to be rebuild, but any other classes relying on those derived classes
|
// so not only do the dependent classes need to be rebuild, but any other classes relying on those derived classes
|
||||||
|
@ -1272,7 +1284,7 @@ void BfContext::TypeDataChanged(BfDependedType* dType, bool isNonStaticDataChang
|
||||||
TypeMethodSignaturesChanged(dependentTypeInstance);
|
TypeMethodSignaturesChanged(dependentTypeInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dependentType->mRevision != mCompiler->mRevision)
|
if (CanRebuild(dependentType))
|
||||||
{
|
{
|
||||||
// We need to include DependencyFlag_ParamOrReturnValue because it could be a struct that changes its splatting ability
|
// We need to include DependencyFlag_ParamOrReturnValue because it could be a struct that changes its splatting ability
|
||||||
// We can't ONLY check against structs, though, because a type could change from a class to a struct
|
// We can't ONLY check against structs, though, because a type could change from a class to a struct
|
||||||
|
@ -1293,7 +1305,7 @@ void BfContext::TypeDataChanged(BfDependedType* dType, bool isNonStaticDataChang
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dependentType->mRevision != mCompiler->mRevision)
|
if (CanRebuild(dependentType))
|
||||||
{
|
{
|
||||||
// Not a type instance, probably something like a sized array
|
// Not a type instance, probably something like a sized array
|
||||||
RebuildType(dependentType);
|
RebuildType(dependentType);
|
||||||
|
@ -1301,7 +1313,7 @@ void BfContext::TypeDataChanged(BfDependedType* dType, bool isNonStaticDataChang
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dType->mRevision != mCompiler->mRevision)
|
if (CanRebuild(dType))
|
||||||
RebuildType(dType);
|
RebuildType(dType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1811,7 +1823,7 @@ void BfContext::DeleteType(BfType* type, bool deferDepRebuilds)
|
||||||
|
|
||||||
for (auto dependentType : rebuildTypeQueue)
|
for (auto dependentType : rebuildTypeQueue)
|
||||||
{
|
{
|
||||||
if (dependentType->mRevision != mCompiler->mRevision)
|
if (CanRebuild(dependentType))
|
||||||
RebuildType(dependentType);
|
RebuildType(dependentType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -477,6 +477,7 @@ public:
|
||||||
void RebuildType(BfType* type, bool deleteOnDemandTypes = true, bool rebuildModule = true, bool placeSpecializiedInPurgatory = true);
|
void RebuildType(BfType* type, bool deleteOnDemandTypes = true, bool rebuildModule = true, bool placeSpecializiedInPurgatory = true);
|
||||||
void RebuildDependentTypes(BfDependedType* dType);
|
void RebuildDependentTypes(BfDependedType* dType);
|
||||||
void RebuildDependentTypes_MidCompile(BfDependedType* dType, const String& reason);
|
void RebuildDependentTypes_MidCompile(BfDependedType* dType, const String& reason);
|
||||||
|
bool CanRebuild(BfType* type);
|
||||||
void TypeDataChanged(BfDependedType* dType, bool isNonStaticDataChange);
|
void TypeDataChanged(BfDependedType* dType, bool isNonStaticDataChange);
|
||||||
void TypeMethodSignaturesChanged(BfTypeInstance* typeInst);
|
void TypeMethodSignaturesChanged(BfTypeInstance* typeInst);
|
||||||
void TypeInlineMethodInternalsChanged(BfTypeInstance* typeInst);
|
void TypeInlineMethodInternalsChanged(BfTypeInstance* typeInst);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue