MCPcopy Create free account
hub / github.com/beefytech/Beef / PopulateReified

Method PopulateReified

IDEHelper/Compiler/BfCompiler.cpp:5809–6205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5807//////////////////////////////////////////////////////////////////////////
5808
5809void BfCompiler::PopulateReified()
5810{
5811 BfLogSysM("BfCompiler::PopulateReified\n");
5812 BP_ZONE("PopulateReified");
5813
5814 BfContext* context = mContext;
5815 bool hasTests = mSystem->HasTestProjects();
5816
5817 Array<BfMethodInstance*> impChainHeadMethods;
5818
5819 // Types can pull in new dependencies, so fully populate types until they stop
5820 bool reifiedOnly = mOptions.mCompileOnDemandKind != BfCompileOnDemandKind_AlwaysInclude;
5821 while (true)
5822 {
5823 BP_ZONE("Compile_PopulateTypes");
5824
5825 int startTypeInitCount = mTypeInitCount;
5826
5827 bool didWork = false;
5828
5829 BfLogSysM("PopulateReified iteration start\n");
5830
5831 Array<BfType*> typeList;
5832 typeList.Reserve(context->mResolvedTypes.GetCount());
5833 for (auto type : context->mResolvedTypes)
5834 typeList.Add(type);
5835
5836 int typeCount = 0;
5837 for (auto type : typeList)
5838 {
5839 auto module = type->GetModule();
5840 typeCount++;
5841
5842 if (module == NULL)
5843 continue;
5844
5845 if (!type->IsReified())
5846 {
5847 // On compiles, only handle reified types in this loop. This fixes cases where our first instance of a dependent type
5848 // is found to be unreified and then we have to reify it later. It's not an error, just a compile perf issue
5849 continue;
5850 }
5851
5852 // We have to not populate generic type instances because that may force us to populate a type that SHOULD be deleted
5853 if ((type->IsIncomplete()) && (type->IsTypeInstance()) && (!type->IsGenericTypeInstance()))
5854 {
5855 mSystem->CheckLockYield();
5856 module->PopulateType(type, BfPopulateType_Full);
5857 }
5858
5859 auto typeInst = type->ToTypeInstance();
5860
5861 if ((typeInst != NULL) && (typeInst->IsGenericTypeInstance()) && (!typeInst->IsUnspecializedType()) &&
5862 (!typeInst->IsDelegateFromTypeRef()) && (!typeInst->IsFunctionFromTypeRef()) && (!typeInst->IsTuple()))
5863 {
5864 auto unspecializedType = module->GetUnspecializedTypeInstance(typeInst);
5865 if (!unspecializedType->mIsReified)
5866 unspecializedType->mIsReified = true;

Callers

nothing calls this directly

Calls 15

StringClass · 0.85
HasTestProjectsMethod · 0.80
GetReflectKindMethod · 0.80
CreateBoxedTypeMethod · 0.80
AddDependencyMethod · 0.80
PopulateMemberSetsMethod · 0.80
IsDefaultCtorMethod · 0.80
TryGetWithMethod · 0.80
HasBeenInstantiatedMethod · 0.80

Tested by

no test coverage detected