| 19900 | } |
| 19901 | |
| 19902 | void 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++) |
nothing calls this directly
no test coverage detected