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

Method AddHotDataReferences

IDEHelper/Compiler/BfModule.cpp:19902–19965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19900}
19901
19902void BfModule::AddHotDataReferences(BfHotDataReferenceBuilder* builder)
19903{
19904 BF_ASSERT(mCurMethodInstance->mIsReified);
19905
19906 if (mCurTypeInstance->mHotTypeData == NULL)
19907 {
19908 mCurTypeInstance->mHotTypeData = new BfHotTypeData();
19909 BfLogSysM("Created HotTypeData %p created for type %p in AddHotDataReferences\n", mCurTypeInstance->mHotTypeData, mCurTypeInstance);
19910 }
19911
19912 auto hotMethod = mCurMethodInstance->mHotMethod;
19913 for (auto depData : hotMethod->mReferences)
19914 {
19915 // Only virtual decls are allowed to already be there
19916 BF_ASSERT((depData->mDataKind == BfHotDepDataKind_VirtualDecl) || (depData->mDataKind == BfHotDepDataKind_DupMethod));
19917 }
19918
19919 BF_ASSERT(hotMethod->mSrcTypeVersion != NULL);
19920
19921 int prevSize = (int)hotMethod->mReferences.size();
19922 int refCount = (int)(prevSize + builder->mUsedData.size() + builder->mCalledMethods.size() + builder->mDevirtualizedCalledMethods.size());
19923 if (!mCurMethodInstance->mMethodDef->mIsStatic)
19924 refCount++;
19925
19926 hotMethod->mReferences.Reserve(refCount);
19927 if (!mCurMethodInstance->mMethodDef->mIsStatic)
19928 {
19929 auto hotThis = mCompiler->mHotData->GetThisType(mCurMethodInstance->GetOwner()->mHotTypeData->GetLatestVersion());
19930 hotThis->mRefCount++;
19931 hotMethod->mReferences.Insert(0, hotThis);
19932 prevSize++;
19933 }
19934 for (auto val : builder->mAllocatedData)
19935 {
19936 auto hotAllocation = mCompiler->mHotData->GetAllocation(val);
19937 hotMethod->mReferences.Add(hotAllocation);
19938 }
19939 for (auto val : builder->mUsedData)
19940 hotMethod->mReferences.Add(val);
19941 for (auto val : builder->mCalledMethods)
19942 hotMethod->mReferences.Add(val);
19943 for (auto val : builder->mDevirtualizedCalledMethods)
19944 {
19945 auto devirtualizedMethod = mCompiler->mHotData->GetDevirtualizedMethod(val);
19946 hotMethod->mReferences.Add(devirtualizedMethod);
19947 }
19948 for (auto val : builder->mFunctionPtrs)
19949 {
19950 auto funcRef = mCompiler->mHotData->GetFunctionReference(val);
19951 hotMethod->mReferences.Add(funcRef);
19952 }
19953 for (auto val : builder->mInnerMethods)
19954 {
19955 auto innerMethod = mCompiler->mHotData->GetInnerMethod(val);
19956 hotMethod->mReferences.Add(innerMethod);
19957 }
19958
19959 for (int refIdx = prevSize; refIdx < (int)hotMethod->mReferences.size(); refIdx++)

Callers

nothing calls this directly

Calls 11

GetLatestVersionMethod · 0.80
GetAllocationMethod · 0.80
GetFunctionReferenceMethod · 0.80
GetInnerMethodMethod · 0.80
sizeMethod · 0.45
ReserveMethod · 0.45
GetThisTypeMethod · 0.45
GetOwnerMethod · 0.45
InsertMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected