mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Moved Main method reification to PopulateReified
This commit is contained in:
parent
9972ff32ab
commit
0df06b9870
1 changed files with 48 additions and 45 deletions
|
@ -5595,6 +5595,7 @@ int ArrTest()
|
||||||
|
|
||||||
void BfCompiler::PopulateReified()
|
void BfCompiler::PopulateReified()
|
||||||
{
|
{
|
||||||
|
BfLogSysM("BfCompiler::PopulateReified\n");
|
||||||
BP_ZONE("PopulateReified");
|
BP_ZONE("PopulateReified");
|
||||||
|
|
||||||
BfContext* context = mContext;
|
BfContext* context = mContext;
|
||||||
|
@ -5864,6 +5865,50 @@ void BfCompiler::PopulateReified()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mOptions.mCompileOnDemandKind != BfCompileOnDemandKind_AlwaysInclude)
|
||||||
|
{
|
||||||
|
BfLogSysM("BfCompiler::PopulateReified finding Main\n");
|
||||||
|
for (auto project : mSystem->mProjects)
|
||||||
|
{
|
||||||
|
String entryClassName = project->mStartupObject;
|
||||||
|
auto typeDef = mSystem->FindTypeDef(entryClassName, 0, project, {}, NULL, BfFindTypeDefFlag_AllowGlobal);
|
||||||
|
if (typeDef != NULL)
|
||||||
|
{
|
||||||
|
typeDef->mIsAlwaysInclude = true;
|
||||||
|
auto resolvedType = mContext->mScratchModule->ResolveTypeDef(typeDef);
|
||||||
|
if (resolvedType != NULL)
|
||||||
|
{
|
||||||
|
auto resolvedTypeInst = resolvedType->ToTypeInstance();
|
||||||
|
if (resolvedTypeInst != NULL)
|
||||||
|
{
|
||||||
|
auto module = resolvedTypeInst->GetModule();
|
||||||
|
if (!module->mIsReified)
|
||||||
|
module->ReifyModule();
|
||||||
|
mContext->mScratchModule->PopulateType(resolvedType, BfPopulateType_Full);
|
||||||
|
|
||||||
|
BfMemberSetEntry* memberSetEntry;
|
||||||
|
if (resolvedTypeInst->mTypeDef->mMethodSet.TryGetWith(String("Main"), &memberSetEntry))
|
||||||
|
{
|
||||||
|
BfMethodDef* methodDef = (BfMethodDef*)memberSetEntry->mMemberDef;
|
||||||
|
while (methodDef != NULL)
|
||||||
|
{
|
||||||
|
auto moduleMethodInstance = mContext->mScratchModule->GetMethodInstanceAtIdx(resolvedTypeInst, methodDef->mIdx);
|
||||||
|
auto methodInstance = moduleMethodInstance.mMethodInstance;
|
||||||
|
if (methodInstance->GetParamCount() != 0)
|
||||||
|
{
|
||||||
|
mContext->mScratchModule->GetInternalMethod("CreateParamsArray");
|
||||||
|
mContext->mScratchModule->GetInternalMethod("DeleteStringArray");
|
||||||
|
}
|
||||||
|
|
||||||
|
methodDef = methodDef->mNextWithSameName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BfLogSysM("PopulateReified iteration done\n");
|
BfLogSysM("PopulateReified iteration done\n");
|
||||||
|
|
||||||
didWork |= DoWorkLoop(reifiedOnly, reifiedOnly);
|
didWork |= DoWorkLoop(reifiedOnly, reifiedOnly);
|
||||||
|
@ -6617,6 +6662,7 @@ void BfCompiler::ClearOldHotData()
|
||||||
|
|
||||||
void BfCompiler::CompileReified()
|
void BfCompiler::CompileReified()
|
||||||
{
|
{
|
||||||
|
BfLogSysM("BfCompiler::CompileReified\n");
|
||||||
BP_ZONE("Compile_ResolveTypeDefs");
|
BP_ZONE("Compile_ResolveTypeDefs");
|
||||||
|
|
||||||
Array<BfTypeDef*> deferTypeDefs;
|
Array<BfTypeDef*> deferTypeDefs;
|
||||||
|
@ -6696,49 +6742,6 @@ void BfCompiler::CompileReified()
|
||||||
mContext->mScratchModule->PopulateType(typeInst, BfPopulateType_Full);
|
mContext->mScratchModule->PopulateType(typeInst, BfPopulateType_Full);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mOptions.mCompileOnDemandKind != BfCompileOnDemandKind_AlwaysInclude)
|
|
||||||
{
|
|
||||||
for (auto project : mSystem->mProjects)
|
|
||||||
{
|
|
||||||
String entryClassName = project->mStartupObject;
|
|
||||||
auto typeDef = mSystem->FindTypeDef(entryClassName, 0, project, {}, NULL, BfFindTypeDefFlag_AllowGlobal);
|
|
||||||
if (typeDef != NULL)
|
|
||||||
{
|
|
||||||
typeDef->mIsAlwaysInclude = true;
|
|
||||||
auto resolvedType = mContext->mScratchModule->ResolveTypeDef(typeDef);
|
|
||||||
if (resolvedType != NULL)
|
|
||||||
{
|
|
||||||
auto resolvedTypeInst = resolvedType->ToTypeInstance();
|
|
||||||
if (resolvedTypeInst != NULL)
|
|
||||||
{
|
|
||||||
auto module = resolvedTypeInst->GetModule();
|
|
||||||
if (!module->mIsReified)
|
|
||||||
module->ReifyModule();
|
|
||||||
mContext->mScratchModule->PopulateType(resolvedType, BfPopulateType_Full);
|
|
||||||
|
|
||||||
BfMemberSetEntry* memberSetEntry;
|
|
||||||
if (resolvedTypeInst->mTypeDef->mMethodSet.TryGetWith(String("Main"), &memberSetEntry))
|
|
||||||
{
|
|
||||||
BfMethodDef* methodDef = (BfMethodDef*)memberSetEntry->mMemberDef;
|
|
||||||
while (methodDef != NULL)
|
|
||||||
{
|
|
||||||
auto moduleMethodInstance = mContext->mScratchModule->GetMethodInstanceAtIdx(resolvedTypeInst, methodDef->mIdx);
|
|
||||||
auto methodInstance = moduleMethodInstance.mMethodInstance;
|
|
||||||
if (methodInstance->GetParamCount() != 0)
|
|
||||||
{
|
|
||||||
mContext->mScratchModule->GetInternalMethod("CreateParamsArray");
|
|
||||||
mContext->mScratchModule->GetInternalMethod("DeleteStringArray");
|
|
||||||
}
|
|
||||||
|
|
||||||
methodDef = methodDef->mNextWithSameName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PopulateReified();
|
PopulateReified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue