mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Reworked !hasRequiredTypes state
This commit is contained in:
parent
5f5c752f5d
commit
eddbf7a984
11 changed files with 104 additions and 77 deletions
|
@ -341,11 +341,10 @@ BfCompiler::HotResolveData::~HotResolveData()
|
||||||
|
|
||||||
BfCompiler::BfCompiler(BfSystem* bfSystem, bool isResolveOnly)
|
BfCompiler::BfCompiler(BfSystem* bfSystem, bool isResolveOnly)
|
||||||
{
|
{
|
||||||
//llvm::DebugFlag = true;
|
|
||||||
|
|
||||||
memset(&mStats, 0, sizeof(mStats));
|
memset(&mStats, 0, sizeof(mStats));
|
||||||
mCompletionPct = 0;
|
mCompletionPct = 0;
|
||||||
mCanceling = false;
|
mCanceling = false;
|
||||||
|
mHasRequiredTypes = false;
|
||||||
mNeedsFullRefresh = false;
|
mNeedsFullRefresh = false;
|
||||||
mFastFinish = false;
|
mFastFinish = false;
|
||||||
mHasQueuedTypeRebuilds = false;
|
mHasQueuedTypeRebuilds = false;
|
||||||
|
@ -2146,7 +2145,7 @@ void BfCompiler::UpdateDependencyMap(bool deleteUnusued, bool& didWork)
|
||||||
madeFullPass = false;
|
madeFullPass = false;
|
||||||
if ((mResolvePassData != NULL) && (mResolvePassData->mParser != NULL))
|
if ((mResolvePassData != NULL) && (mResolvePassData->mParser != NULL))
|
||||||
madeFullPass = false;
|
madeFullPass = false;
|
||||||
|
|
||||||
SetAndRestoreValue<bool> prevAssertOnPopulateType(mContext->mAssertOnPopulateType, deleteUnusued && madeFullPass);
|
SetAndRestoreValue<bool> prevAssertOnPopulateType(mContext->mAssertOnPopulateType, deleteUnusued && madeFullPass);
|
||||||
|
|
||||||
if ((deleteUnusued) && (madeFullPass))
|
if ((deleteUnusued) && (madeFullPass))
|
||||||
|
@ -5220,7 +5219,7 @@ int BfCompiler::GetVTableMethodOffset()
|
||||||
bool BfCompiler::DoWorkLoop(bool onlyReifiedTypes, bool onlyReifiedMethods)
|
bool BfCompiler::DoWorkLoop(bool onlyReifiedTypes, bool onlyReifiedMethods)
|
||||||
{
|
{
|
||||||
bool hadAnyWork = false;
|
bool hadAnyWork = false;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
bool didWork = false;
|
bool didWork = false;
|
||||||
|
@ -6596,7 +6595,7 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
|
|
||||||
BpEnter("Compile_Start");
|
BpEnter("Compile_Start");
|
||||||
|
|
||||||
bool hasRequiredTypes = true;
|
mHasRequiredTypes = true;
|
||||||
|
|
||||||
//HashSet<BfTypeDef*> internalTypeDefs;
|
//HashSet<BfTypeDef*> internalTypeDefs;
|
||||||
|
|
||||||
|
@ -6606,7 +6605,7 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
if (typeDef == NULL)
|
if (typeDef == NULL)
|
||||||
{
|
{
|
||||||
mPassInstance->Fail(StrFormat("Unable to find system type: %s", typeName.c_str()));
|
mPassInstance->Fail(StrFormat("Unable to find system type: %s", typeName.c_str()));
|
||||||
hasRequiredTypes = false;
|
mHasRequiredTypes = false;
|
||||||
}
|
}
|
||||||
return typeDef;
|
return typeDef;
|
||||||
};
|
};
|
||||||
|
@ -6722,21 +6721,17 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
mContext->mBfTypeType = NULL;
|
mContext->mBfTypeType = NULL;
|
||||||
mContext->mBfClassVDataPtrType = NULL;
|
mContext->mBfClassVDataPtrType = NULL;
|
||||||
|
|
||||||
if (!hasRequiredTypes)
|
if (!mHasRequiredTypes)
|
||||||
{
|
{
|
||||||
// Force rebuilding
|
// Force rebuilding
|
||||||
BfLogSysM("Compile missing required types\n");
|
BfLogSysM("Compile missing required types\n");
|
||||||
mInInvalidState = true;
|
mOptions.mForceRebuildIdx++;
|
||||||
mOptions.mForceRebuildIdx++;
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
mSystem->CheckLockYield();
|
mSystem->CheckLockYield();
|
||||||
|
|
||||||
mContext->mScratchModule->ResolveTypeDef(mBfObjectTypeDef);
|
mContext->mScratchModule->ResolveTypeDef(mBfObjectTypeDef);
|
||||||
VisitSourceExteriorNodes();
|
VisitSourceExteriorNodes();
|
||||||
|
|
||||||
//BF_ASSERT(hasRequiredTypes);
|
|
||||||
|
|
||||||
if (!mIsResolveOnly)
|
if (!mIsResolveOnly)
|
||||||
{
|
{
|
||||||
|
@ -6811,19 +6806,14 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
|
|
||||||
if (mIsResolveOnly)
|
if (mIsResolveOnly)
|
||||||
VisitAutocompleteExteriorIdentifiers();
|
VisitAutocompleteExteriorIdentifiers();
|
||||||
|
|
||||||
if (!hasRequiredTypes)
|
|
||||||
{
|
|
||||||
BfLogSysM("Missing required types\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
mStats.mTypesQueued = 0;
|
mStats.mTypesQueued = 0;
|
||||||
mStats.mMethodsQueued = 0;
|
mStats.mMethodsQueued = 0;
|
||||||
|
|
||||||
mStats.mTypesQueued += (int)mContext->mPopulateTypeWorkList.size();
|
mStats.mTypesQueued += (int)mContext->mPopulateTypeWorkList.size();
|
||||||
mStats.mMethodsQueued += (int)mContext->mMethodWorkList.size();
|
mStats.mMethodsQueued += (int)mContext->mMethodWorkList.size();
|
||||||
|
|
||||||
if (hasRequiredTypes)
|
//
|
||||||
{
|
{
|
||||||
mContext->mScratchModule->ResolveTypeDef(mBfObjectTypeDef, BfPopulateType_Full);
|
mContext->mScratchModule->ResolveTypeDef(mBfObjectTypeDef, BfPopulateType_Full);
|
||||||
|
|
||||||
|
@ -6864,9 +6854,8 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasRequiredTypes)
|
ProcessPurgatory(true);
|
||||||
ProcessPurgatory(true);
|
|
||||||
|
|
||||||
// Mark used modules
|
// Mark used modules
|
||||||
if ((mOptions.mCompileOnDemandKind != BfCompileOnDemandKind_AlwaysInclude) && (!mCanceling))
|
if ((mOptions.mCompileOnDemandKind != BfCompileOnDemandKind_AlwaysInclude) && (!mCanceling))
|
||||||
|
@ -6967,7 +6956,7 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate slot nums
|
// Generate slot nums
|
||||||
if ((!mIsResolveOnly) && (hasRequiredTypes) && (!mCanceling))
|
if ((!mIsResolveOnly) && (!mCanceling))
|
||||||
{
|
{
|
||||||
if ((!IsHotCompile()) || (mHotState->mHasNewInterfaceTypes))
|
if ((!IsHotCompile()) || (mHotState->mHasNewInterfaceTypes))
|
||||||
{
|
{
|
||||||
|
@ -6996,7 +6985,7 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DoWorkLoop();
|
DoWorkLoop();
|
||||||
|
|
||||||
BfLogSysM("Compile QueueUnused\n");
|
BfLogSysM("Compile QueueUnused\n");
|
||||||
|
@ -7098,13 +7087,12 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
{
|
{
|
||||||
DoWorkLoop();
|
DoWorkLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasRequiredTypes)
|
ProcessPurgatory(false);
|
||||||
ProcessPurgatory(false);
|
|
||||||
|
|
||||||
// Old Mark used modules
|
// Old Mark used modules
|
||||||
|
|
||||||
if ((!mIsResolveOnly) && (hasRequiredTypes))
|
if (!mIsResolveOnly)
|
||||||
{
|
{
|
||||||
// if ((!mPassInstance->HasFailed()) && (!mCanceling))
|
// if ((!mPassInstance->HasFailed()) && (!mCanceling))
|
||||||
// {
|
// {
|
||||||
|
@ -7161,7 +7149,7 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
|
|
||||||
String moduleListStr;
|
String moduleListStr;
|
||||||
int numModulesWritten = 0;
|
int numModulesWritten = 0;
|
||||||
if ((hasRequiredTypes) && (!mCanceling))
|
if (!mCanceling)
|
||||||
{
|
{
|
||||||
if (!mIsResolveOnly)
|
if (!mIsResolveOnly)
|
||||||
{
|
{
|
||||||
|
@ -7250,9 +7238,7 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
//printf("Compile done, waiting for finish\n");
|
//printf("Compile done, waiting for finish\n");
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (!hasRequiredTypes)
|
|
||||||
break;
|
|
||||||
if (mCanceling)
|
if (mCanceling)
|
||||||
mCodeGen.Cancel();
|
mCodeGen.Cancel();
|
||||||
bool isDone = mCodeGen.Finish();
|
bool isDone = mCodeGen.Finish();
|
||||||
|
@ -7391,8 +7377,8 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
// gBEMemReporter.Report();
|
// gBEMemReporter.Report();
|
||||||
// int memReporterSize = gBEMemReporterSize;
|
// int memReporterSize = gBEMemReporterSize;
|
||||||
|
|
||||||
mLastRevisionAborted = mCanceling || !hasRequiredTypes;
|
mLastRevisionAborted = mCanceling;
|
||||||
bool didCancel = mCanceling && hasRequiredTypes;
|
bool didCancel = mCanceling;
|
||||||
mCanceling = false;
|
mCanceling = false;
|
||||||
|
|
||||||
mContext->ValidateDependencies();
|
mContext->ValidateDependencies();
|
||||||
|
|
|
@ -323,6 +323,7 @@ public:
|
||||||
BfCodeGen mCodeGen;
|
BfCodeGen mCodeGen;
|
||||||
String mOutputDirectory;
|
String mOutputDirectory;
|
||||||
bool mCanceling;
|
bool mCanceling;
|
||||||
|
bool mHasRequiredTypes;
|
||||||
bool mNeedsFullRefresh;
|
bool mNeedsFullRefresh;
|
||||||
bool mFastFinish;
|
bool mFastFinish;
|
||||||
bool mHasQueuedTypeRebuilds; // Infers we had a fast finish that requires a type rebuild
|
bool mHasQueuedTypeRebuilds; // Infers we had a fast finish that requires a type rebuild
|
||||||
|
|
|
@ -416,15 +416,22 @@ bool BfConstResolver::PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatch
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((argValue.mValue.IsFake()) && (!argValue.mType->IsValuelessType()))
|
bool requiresConst = false;
|
||||||
{
|
if ((mModule->mCurMethodInstance == NULL) || (mModule->mCurMethodInstance->mMethodDef->mMethodType != BfMethodType_Mixin))
|
||||||
if ((mModule->mCurMethodInstance == NULL) || (mModule->mCurMethodInstance->mMethodDef->mMethodType != BfMethodType_Mixin))
|
requiresConst = true;
|
||||||
{
|
|
||||||
mModule->Fail("Expression does not evaluate to a constant value", argExpr);
|
if ((requiresConst) && (argValue.mValue.IsFake()) && (!argValue.mType->IsValuelessType()))
|
||||||
}
|
{
|
||||||
|
mModule->Fail("Expression does not evaluate to a constant value", argExpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
llvmArgs.push_back(argValue.mValue);
|
if (!argValue.mType->IsVar())
|
||||||
|
{
|
||||||
|
if ((!requiresConst) || (argValue.mValue.IsConst()) || (argValue.mType->IsValuelessType()))
|
||||||
|
llvmArgs.push_back(argValue.mValue);
|
||||||
|
else
|
||||||
|
llvmArgs.push_back(mModule->GetDefaultValue(argValue.mType));
|
||||||
|
}
|
||||||
paramIdx++;
|
paramIdx++;
|
||||||
}
|
}
|
||||||
argIdx++;
|
argIdx++;
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
BfConstResolver(BfModule* bfModule);
|
BfConstResolver(BfModule* bfModule);
|
||||||
|
|
||||||
BfTypedValue Resolve(BfExpression* expr, BfType* wantType = NULL, BfConstResolveFlags flags = BfConstResolveFlag_None);
|
BfTypedValue Resolve(BfExpression* expr, BfType* wantType = NULL, BfConstResolveFlags flags = BfConstResolveFlag_None);
|
||||||
bool PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatcher* methodMatcher, Array<BfIRValue>& llvmArgs);
|
bool PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatcher* methodMatcher, Array<BfIRValue>& llvmArgs);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_BF_END
|
NS_BF_END
|
|
@ -2917,10 +2917,21 @@ void BfContext::Cleanup()
|
||||||
|
|
||||||
// Clean up deleted BfTypes
|
// Clean up deleted BfTypes
|
||||||
// These need to get deleted before the modules because we access mModule in the MethodInstance dtors
|
// These need to get deleted before the modules because we access mModule in the MethodInstance dtors
|
||||||
for (auto type : mTypeGraveyard)
|
for (int pass = 0; pass < 2; pass++)
|
||||||
{
|
{
|
||||||
BF_ASSERT(type->mRebuildFlags & BfTypeRebuildFlag_Deleted);
|
for (int i = 0; i < (int)mTypeGraveyard.size(); i++)
|
||||||
delete type;
|
{
|
||||||
|
auto type = mTypeGraveyard[i];
|
||||||
|
if (type == NULL)
|
||||||
|
continue;
|
||||||
|
bool deleteNow = (type->IsBoxed() == (pass == 0));
|
||||||
|
if (!deleteNow)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
BF_ASSERT(type->mRebuildFlags & BfTypeRebuildFlag_Deleted);
|
||||||
|
delete type;
|
||||||
|
mTypeGraveyard[i] = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mTypeGraveyard.Clear();
|
mTypeGraveyard.Clear();
|
||||||
|
|
||||||
|
|
|
@ -1775,24 +1775,21 @@ void BfDefBuilder::Visit(BfTypeDeclaration* typeDeclaration)
|
||||||
bool doInsertNew = true;
|
bool doInsertNew = true;
|
||||||
if (prevRevisionTypeDef != NULL)
|
if (prevRevisionTypeDef != NULL)
|
||||||
{
|
{
|
||||||
mCurTypeDef->mIsNextRevision = true;
|
mCurTypeDef->mIsNextRevision = true;
|
||||||
bfParser->mTypeDefs.Add(prevRevisionTypeDef);
|
bfParser->mTypeDefs.Add(prevRevisionTypeDef);
|
||||||
|
|
||||||
if (prevRevisionTypeDef->mDefState == BfTypeDef::DefState_AwaitingNewVersion)
|
if (prevRevisionTypeDef->mDefState == BfTypeDef::DefState_AwaitingNewVersion)
|
||||||
{
|
{
|
||||||
delete prevRevisionTypeDef->mNextRevision;
|
if (prevRevisionTypeDef->mNextRevision != NULL)
|
||||||
|
{
|
||||||
|
BfLogSysM("Deleting unused nextRevision %p from prevRevision %p\n", prevRevisionTypeDef->mNextRevision, prevRevisionTypeDef);
|
||||||
|
delete prevRevisionTypeDef->mNextRevision;
|
||||||
|
}
|
||||||
prevRevisionTypeDef->mNextRevision = mCurTypeDef;
|
prevRevisionTypeDef->mNextRevision = mCurTypeDef;
|
||||||
BF_ASSERT(mCurTypeDef->mSystem != NULL);
|
BF_ASSERT(mCurTypeDef->mSystem != NULL);
|
||||||
mCurActualTypeDef = prevRevisionTypeDef;
|
mCurActualTypeDef = prevRevisionTypeDef;
|
||||||
doInsertNew = false;
|
doInsertNew = false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (prevRevisionTypeDef->mNextRevision != NULL)
|
|
||||||
prevRevisionTypeDef = prevRevisionTypeDef->mNextRevision;
|
|
||||||
|
|
||||||
prevRevisionTypeDef = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1820,8 +1817,8 @@ void BfDefBuilder::Visit(BfTypeDeclaration* typeDeclaration)
|
||||||
outerTypeDef->mNestedTypes.push_back(mCurActualTypeDef);
|
outerTypeDef->mNestedTypes.push_back(mCurActualTypeDef);
|
||||||
}
|
}
|
||||||
|
|
||||||
BfLogSysM("Creating TypeDef %p Hash:%d from TypeDecl: %p Source: %p ResolvePass: %d AutoComplete:%d\n", mCurTypeDef, mSystem->mTypeDefs.GetHash(mCurTypeDef), typeDeclaration,
|
BfLogSysM("Creating TypeDef %p Hash:%d from TypeDecl: %p Source: %p ResolvePass: %d AutoComplete:%d PrevRevision:%d\n", mCurTypeDef, mSystem->mTypeDefs.GetHash(mCurTypeDef), typeDeclaration,
|
||||||
typeDeclaration->GetSourceData(), mResolvePassData != NULL, isAutoCompleteTempType);
|
typeDeclaration->GetSourceData(), mResolvePassData != NULL, isAutoCompleteTempType, prevRevisionTypeDef);
|
||||||
|
|
||||||
BF_ASSERT(mCurTypeDef->mNameEx == NULL);
|
BF_ASSERT(mCurTypeDef->mNameEx == NULL);
|
||||||
|
|
||||||
|
@ -1875,9 +1872,9 @@ void BfDefBuilder::Visit(BfTypeDeclaration* typeDeclaration)
|
||||||
|
|
||||||
if (mCurTypeDef->mFullHash == prevRevisionTypeDef->mFullHash)
|
if (mCurTypeDef->mFullHash == prevRevisionTypeDef->mFullHash)
|
||||||
{
|
{
|
||||||
if (!mFullRefresh)
|
if ((!mFullRefresh) && (!prevRevisionTypeDef->mForceUseNextRevision))
|
||||||
{
|
{
|
||||||
BfLogSys(bfParser->mSystem, "DefBuilder deleting typeDef with no changes %p\n", prevRevisionTypeDef);
|
BfLogSys(bfParser->mSystem, "DefBuilder deleting typeDef with no changes %p prevRevision: %p\n", mCurTypeDef, prevRevisionTypeDef);
|
||||||
prevRevisionTypeDef->mDefState = BfTypeDef::DefState_Defined;
|
prevRevisionTypeDef->mDefState = BfTypeDef::DefState_Defined;
|
||||||
BF_ASSERT(prevRevisionTypeDef->mNextRevision == mCurTypeDef);
|
BF_ASSERT(prevRevisionTypeDef->mNextRevision == mCurTypeDef);
|
||||||
prevRevisionTypeDef->mNextRevision = NULL;
|
prevRevisionTypeDef->mNextRevision = NULL;
|
||||||
|
@ -1962,7 +1959,7 @@ void BfDefBuilder::FinishTypeDef(bool wantsToString)
|
||||||
|
|
||||||
auto ctorDeclaration = (BfConstructorDeclaration*)method->mMethodDeclaration;
|
auto ctorDeclaration = (BfConstructorDeclaration*)method->mMethodDeclaration;
|
||||||
if (method->mHasAppend)
|
if (method->mHasAppend)
|
||||||
{
|
{
|
||||||
mCurTypeDef->mHasAppendCtor = true;
|
mCurTypeDef->mHasAppendCtor = true;
|
||||||
|
|
||||||
auto methodDef = new BfMethodDef();
|
auto methodDef = new BfMethodDef();
|
||||||
|
|
|
@ -10786,6 +10786,9 @@ void BfModule::ValidateCustomAttributes(BfCustomAttributes* customAttributes, Bf
|
||||||
|
|
||||||
void BfModule::GetCustomAttributes(BfCustomAttributes* customAttributes, BfAttributeDirective* attributesDirective, BfAttributeTargets attrTarget, bool allowNonConstArgs, BfCaptureInfo* captureInfo)
|
void BfModule::GetCustomAttributes(BfCustomAttributes* customAttributes, BfAttributeDirective* attributesDirective, BfAttributeTargets attrTarget, bool allowNonConstArgs, BfCaptureInfo* captureInfo)
|
||||||
{
|
{
|
||||||
|
if (!mCompiler->mHasRequiredTypes)
|
||||||
|
return;
|
||||||
|
|
||||||
if ((attributesDirective != NULL) && (mCompiler->mResolvePassData != NULL) &&
|
if ((attributesDirective != NULL) && (mCompiler->mResolvePassData != NULL) &&
|
||||||
(attributesDirective->IsFromParser(mCompiler->mResolvePassData->mParser)) && (mCompiler->mResolvePassData->mSourceClassifier != NULL))
|
(attributesDirective->IsFromParser(mCompiler->mResolvePassData->mParser)) && (mCompiler->mResolvePassData->mSourceClassifier != NULL))
|
||||||
{
|
{
|
||||||
|
@ -11076,8 +11079,10 @@ void BfModule::GetCustomAttributes(BfCustomAttributes* customAttributes, BfAttri
|
||||||
if (assignExpr->mRight != NULL)
|
if (assignExpr->mRight != NULL)
|
||||||
{
|
{
|
||||||
BfTypedValue result = constResolver.Resolve(assignExpr->mRight, propType);
|
BfTypedValue result = constResolver.Resolve(assignExpr->mRight, propType);
|
||||||
if (result)
|
if ((result) && (!result.mType->IsVar()))
|
||||||
{
|
{
|
||||||
|
if (!result.mValue.IsConst())
|
||||||
|
result = GetDefaultTypedValue(result.mType);
|
||||||
BF_ASSERT(result.mType == propType);
|
BF_ASSERT(result.mType == propType);
|
||||||
CurrentAddToConstHolder(result.mValue);
|
CurrentAddToConstHolder(result.mValue);
|
||||||
setProperty.mParam = result;
|
setProperty.mParam = result;
|
||||||
|
@ -19437,7 +19442,11 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bodyBlock = BfNodeDynCast<BfBlock>(methodDef->mBody);
|
auto bodyBlock = BfNodeDynCast<BfBlock>(methodDef->mBody);
|
||||||
if (methodDef->mBody == NULL)
|
if (!mCompiler->mHasRequiredTypes)
|
||||||
|
{
|
||||||
|
// Skip processing to avoid errors
|
||||||
|
}
|
||||||
|
else if (methodDef->mBody == NULL)
|
||||||
{
|
{
|
||||||
if (methodDeclaration != NULL)
|
if (methodDeclaration != NULL)
|
||||||
{
|
{
|
||||||
|
@ -22037,7 +22046,7 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
|
||||||
resolvedParamType = CreateArrayType(mContext->mBfObjectType, 1);
|
resolvedParamType = CreateArrayType(mContext->mBfObjectType, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addParams)
|
if ((addParams) && (resolvedParamType != NULL))
|
||||||
{
|
{
|
||||||
BfMethodParam methodParam;
|
BfMethodParam methodParam;
|
||||||
methodParam.mResolvedType = resolvedParamType;
|
methodParam.mResolvedType = resolvedParamType;
|
||||||
|
|
|
@ -5979,11 +5979,14 @@ BfArrayType* BfModule::CreateArrayType(BfType* resolvedType, int dimensions)
|
||||||
BF_ASSERT(!resolvedType->IsVar());
|
BF_ASSERT(!resolvedType->IsVar());
|
||||||
BF_ASSERT(!resolvedType->IsIntUnknown());
|
BF_ASSERT(!resolvedType->IsIntUnknown());
|
||||||
|
|
||||||
|
auto arrayTypeDef = mCompiler->GetArrayTypeDef(dimensions);
|
||||||
|
if (arrayTypeDef == NULL)
|
||||||
|
return NULL;
|
||||||
auto arrayType = mContext->mArrayTypePool.Get();
|
auto arrayType = mContext->mArrayTypePool.Get();
|
||||||
delete arrayType->mGenericTypeInfo;
|
delete arrayType->mGenericTypeInfo;
|
||||||
arrayType->mGenericTypeInfo = new BfGenericTypeInfo();
|
arrayType->mGenericTypeInfo = new BfGenericTypeInfo();
|
||||||
arrayType->mContext = mContext;
|
arrayType->mContext = mContext;
|
||||||
arrayType->mTypeDef = mCompiler->GetArrayTypeDef(dimensions);
|
arrayType->mTypeDef = arrayTypeDef;
|
||||||
arrayType->mDimensions = dimensions;
|
arrayType->mDimensions = dimensions;
|
||||||
arrayType->mGenericTypeInfo->mTypeGenericArguments.clear();
|
arrayType->mGenericTypeInfo->mTypeGenericArguments.clear();
|
||||||
arrayType->mGenericTypeInfo->mTypeGenericArguments.push_back(resolvedType);
|
arrayType->mGenericTypeInfo->mTypeGenericArguments.push_back(resolvedType);
|
||||||
|
@ -9745,12 +9748,13 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
|
||||||
}
|
}
|
||||||
|
|
||||||
auto elementType = ResolveTypeRef(arrayTypeRef->mElementType, BfPopulateType_Declaration, BfResolveTypeRefFlag_AllowGenericParamConstValue);
|
auto elementType = ResolveTypeRef(arrayTypeRef->mElementType, BfPopulateType_Declaration, BfResolveTypeRefFlag_AllowGenericParamConstValue);
|
||||||
if (elementType == NULL)
|
auto arrayTypeDef = mCompiler->GetArrayTypeDef(arrayTypeRef->mDimensions);
|
||||||
|
if ((elementType == NULL) || (arrayTypeDef == NULL))
|
||||||
{
|
{
|
||||||
mContext->mResolvedTypes.RemoveEntry(resolvedEntry);
|
mContext->mResolvedTypes.RemoveEntry(resolvedEntry);
|
||||||
return ResolveTypeResult(typeRef, NULL, populateType, resolveFlags);
|
return ResolveTypeResult(typeRef, NULL, populateType, resolveFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((arrayTypeRef->mDimensions == 1) && (arrayTypeRef->mParams.size() == 1))
|
if ((arrayTypeRef->mDimensions == 1) && (arrayTypeRef->mParams.size() == 1))
|
||||||
{
|
{
|
||||||
intptr elementCount = -1;
|
intptr elementCount = -1;
|
||||||
|
@ -9818,7 +9822,7 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
|
||||||
arrayType->mGenericTypeInfo = new BfGenericTypeInfo();
|
arrayType->mGenericTypeInfo = new BfGenericTypeInfo();
|
||||||
arrayType->mContext = mContext;
|
arrayType->mContext = mContext;
|
||||||
arrayType->mDimensions = arrayTypeRef->mDimensions;
|
arrayType->mDimensions = arrayTypeRef->mDimensions;
|
||||||
arrayType->mTypeDef = mCompiler->GetArrayTypeDef(arrayType->mDimensions);
|
arrayType->mTypeDef = arrayTypeDef;
|
||||||
arrayType->mGenericTypeInfo->mTypeGenericArguments.push_back(elementType);
|
arrayType->mGenericTypeInfo->mTypeGenericArguments.push_back(elementType);
|
||||||
resolvedEntry->mValue = arrayType;
|
resolvedEntry->mValue = arrayType;
|
||||||
|
|
||||||
|
|
|
@ -1810,7 +1810,7 @@ BfSystem::BfSystem()
|
||||||
if (gPerfManager == NULL)
|
if (gPerfManager == NULL)
|
||||||
gPerfManager = new PerfManager();
|
gPerfManager = new PerfManager();
|
||||||
//gPerfManager->StartRecording();
|
//gPerfManager->StartRecording();
|
||||||
|
|
||||||
mAtomUpdateIdx = 0;
|
mAtomUpdateIdx = 0;
|
||||||
mAtomCreateIdx = 0;
|
mAtomCreateIdx = 0;
|
||||||
mTypeMapVersion = 1;
|
mTypeMapVersion = 1;
|
||||||
|
@ -2586,6 +2586,13 @@ void BfSystem::RemoveTypeDef(BfTypeDef* typeDef)
|
||||||
mTypeDefs.Remove(typeDef);
|
mTypeDefs.Remove(typeDef);
|
||||||
AutoCrit autoCrit(mDataLock);
|
AutoCrit autoCrit(mDataLock);
|
||||||
|
|
||||||
|
if (typeDef->mOuterType != NULL)
|
||||||
|
{
|
||||||
|
// We are in the outer type's mNestedTypes list
|
||||||
|
BfLogSys(this, "Setting mForceUseNextRevision on outer type %p from %p\n", typeDef->mOuterType, typeDef);
|
||||||
|
typeDef->mOuterType->mForceUseNextRevision = true;
|
||||||
|
}
|
||||||
|
|
||||||
// This will get properly handled in UntrackName when we process the mTypeDefDeleteQueue, but this
|
// This will get properly handled in UntrackName when we process the mTypeDefDeleteQueue, but this
|
||||||
// mAtomUpdateIdx increment will trigger lookup changes in BfContext::VerifyTypeLookups
|
// mAtomUpdateIdx increment will trigger lookup changes in BfContext::VerifyTypeLookups
|
||||||
if (typeDef->mName != mEmptyAtom)
|
if (typeDef->mName != mEmptyAtom)
|
||||||
|
@ -2797,6 +2804,7 @@ void BfSystem::InjectNewRevision(BfTypeDef* typeDef)
|
||||||
typeDef->mNextRevision = NULL;
|
typeDef->mNextRevision = NULL;
|
||||||
|
|
||||||
typeDef->mDefState = BfTypeDef::DefState_Defined;
|
typeDef->mDefState = BfTypeDef::DefState_Defined;
|
||||||
|
typeDef->mForceUseNextRevision = false;
|
||||||
|
|
||||||
VerifyTypeDef(typeDef);
|
VerifyTypeDef(typeDef);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1006,6 +1006,7 @@ public:
|
||||||
bool mIsNextRevision;
|
bool mIsNextRevision;
|
||||||
bool mInDeleteQueue;
|
bool mInDeleteQueue;
|
||||||
bool mHasEmitMembers;
|
bool mHasEmitMembers;
|
||||||
|
bool mForceUseNextRevision;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BfTypeDef()
|
BfTypeDef()
|
||||||
|
@ -1048,6 +1049,7 @@ public:
|
||||||
mIsNextRevision = false;
|
mIsNextRevision = false;
|
||||||
mInDeleteQueue = false;
|
mInDeleteQueue = false;
|
||||||
mHasEmitMembers = false;
|
mHasEmitMembers = false;
|
||||||
|
mForceUseNextRevision = false;
|
||||||
mDupDetectedRevision = -1;
|
mDupDetectedRevision = -1;
|
||||||
mNestDepth = 0;
|
mNestDepth = 0;
|
||||||
mOuterType = NULL;
|
mOuterType = NULL;
|
||||||
|
@ -1500,7 +1502,7 @@ public:
|
||||||
Array<BfTypeOptions> mMergedTypeOptions;
|
Array<BfTypeOptions> mMergedTypeOptions;
|
||||||
int mUpdateCnt;
|
int mUpdateCnt;
|
||||||
bool mWorkspaceConfigChanged;
|
bool mWorkspaceConfigChanged;
|
||||||
Val128 mWorkspaceConfigHash;
|
Val128 mWorkspaceConfigHash;
|
||||||
|
|
||||||
Array<BfCompiler*> mCompilers;
|
Array<BfCompiler*> mCompilers;
|
||||||
|
|
||||||
|
|
|
@ -6255,6 +6255,9 @@ CeMachine::~CeMachine()
|
||||||
|
|
||||||
auto _RemoveFunctionInfo = [&](CeFunctionInfo* functionInfo)
|
auto _RemoveFunctionInfo = [&](CeFunctionInfo* functionInfo)
|
||||||
{
|
{
|
||||||
|
if (functionInfo->mMethodInstance != NULL)
|
||||||
|
functionInfo->mMethodInstance->mInCEMachine = false;
|
||||||
|
|
||||||
if (functionInfo->mCeFunction != NULL)
|
if (functionInfo->mCeFunction != NULL)
|
||||||
{
|
{
|
||||||
// We don't need to actually unmap it at this point
|
// We don't need to actually unmap it at this point
|
||||||
|
@ -6932,10 +6935,9 @@ CeFunction* CeMachine::GetFunction(BfMethodInstance* methodInstance, BfIRValue f
|
||||||
ceFunction->mCeMachine = this;
|
ceFunction->mCeMachine = this;
|
||||||
ceFunction->mIsVarReturn = methodInstance->mReturnType->IsVar();
|
ceFunction->mIsVarReturn = methodInstance->mReturnType->IsVar();
|
||||||
ceFunction->mCeFunctionInfo = ceFunctionInfo;
|
ceFunction->mCeFunctionInfo = ceFunctionInfo;
|
||||||
ceFunction->mMethodInstance = methodInstance;
|
ceFunction->mMethodInstance = methodInstance;
|
||||||
|
|
||||||
ceFunctionInfo->mMethodInstance = methodInstance;
|
ceFunctionInfo->mMethodInstance = methodInstance;
|
||||||
ceFunctionInfo->mCeFunction = ceFunction;
|
ceFunctionInfo->mCeFunction = ceFunction;
|
||||||
MapFunctionId(ceFunction);
|
MapFunctionId(ceFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue