mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Fixed dependency of alias types
This commit is contained in:
parent
ad35a8a254
commit
c6a7af2a4b
4 changed files with 31 additions and 12 deletions
|
@ -411,11 +411,6 @@ void BfCodeGenThread::RunLoop()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
if (request->mOutFileName.Contains("RuntimeThreadInit"))
|
|
||||||
{
|
|
||||||
NOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((hasCacheMatch) || (!errorMsg.IsEmpty()))
|
if ((hasCacheMatch) || (!errorMsg.IsEmpty()))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
|
@ -3497,7 +3497,7 @@ bool BfModule::CheckDefineMemberProtection(BfProtection protection, BfType* memb
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfModule::AddDependency(BfType* usedType, BfType* userType, BfDependencyMap::DependencyFlags flags)
|
void BfModule::AddDependency(BfType* usedType, BfType* userType, BfDependencyMap::DependencyFlags flags, BfDepContext* depContext)
|
||||||
{
|
{
|
||||||
if (usedType == userType)
|
if (usedType == userType)
|
||||||
return;
|
return;
|
||||||
|
@ -3650,12 +3650,23 @@ void BfModule::AddDependency(BfType* usedType, BfType* userType, BfDependencyMap
|
||||||
|
|
||||||
if (usedType->IsTypeAlias())
|
if (usedType->IsTypeAlias())
|
||||||
{
|
{
|
||||||
usedType = SafeResolveAliasType((BfTypeAliasType*)usedType);
|
auto underlyingType = usedType->GetUnderlyingType();
|
||||||
if (usedType == NULL)
|
if (underlyingType != NULL)
|
||||||
return;
|
{
|
||||||
}
|
BfDepContext newDepContext;
|
||||||
|
if (depContext == NULL)
|
||||||
|
depContext = &newDepContext;
|
||||||
|
|
||||||
if (!usedType->IsGenericTypeInstance())
|
if (++depContext->mAliasDepth > 8)
|
||||||
|
{
|
||||||
|
if (!depContext->mDeepSeenAliases.Add(underlyingType))
|
||||||
|
return; // Circular!
|
||||||
|
}
|
||||||
|
|
||||||
|
AddDependency(underlyingType, userType, depFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!usedType->IsGenericTypeInstance())
|
||||||
{
|
{
|
||||||
auto underlyingType = usedType->GetUnderlyingType();
|
auto underlyingType = usedType->GetUnderlyingType();
|
||||||
if (underlyingType != NULL)
|
if (underlyingType != NULL)
|
||||||
|
|
|
@ -1758,7 +1758,7 @@ public:
|
||||||
bool CheckAccessMemberProtection(BfProtection protection, BfTypeInstance* memberType);
|
bool CheckAccessMemberProtection(BfProtection protection, BfTypeInstance* memberType);
|
||||||
bool CheckDefineMemberProtection(BfProtection protection, BfType* memberType);
|
bool CheckDefineMemberProtection(BfProtection protection, BfType* memberType);
|
||||||
void CheckMemberNames(BfTypeInstance* typeInst);
|
void CheckMemberNames(BfTypeInstance* typeInst);
|
||||||
void AddDependency(BfType* usedType, BfType* userType, BfDependencyMap::DependencyFlags flags);
|
void AddDependency(BfType* usedType, BfType* userType, BfDependencyMap::DependencyFlags flags, BfDepContext* depContext = NULL);
|
||||||
void AddDependency(BfGenericParamInstance* genericParam, BfTypeInstance* usingType);
|
void AddDependency(BfGenericParamInstance* genericParam, BfTypeInstance* usingType);
|
||||||
void AddCallDependency(BfMethodInstance* methodInstance, bool devirtualized = false);
|
void AddCallDependency(BfMethodInstance* methodInstance, bool devirtualized = false);
|
||||||
void AddFieldDependency(BfTypeInstance* typeInstance, BfFieldInstance* fieldInstance, BfType* fieldType);
|
void AddFieldDependency(BfTypeInstance* typeInstance, BfFieldInstance* fieldInstance, BfType* fieldType);
|
||||||
|
|
|
@ -160,6 +160,19 @@ public:
|
||||||
TypeMap::iterator erase(TypeMap::iterator& itr);
|
TypeMap::iterator erase(TypeMap::iterator& itr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BfDepContext
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HashSet<BfType*> mDeepSeenAliases;
|
||||||
|
int mAliasDepth;
|
||||||
|
|
||||||
|
public:
|
||||||
|
BfDepContext()
|
||||||
|
{
|
||||||
|
mAliasDepth = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
enum BfHotDepDataKind : int8
|
enum BfHotDepDataKind : int8
|
||||||
{
|
{
|
||||||
BfHotDepDataKind_Unknown,
|
BfHotDepDataKind_Unknown,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue