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

Method ClearOldHotData

IDEHelper/Compiler/BfCompiler.cpp:6805–6932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6803}
6804
6805void BfCompiler::ClearOldHotData()
6806{
6807 if (mHotData == NULL)
6808 return;
6809
6810 // TODO: Get rid of old hot data during hot compiles, too
6811// if (IsHotCompile())
6812// return;
6813
6814 BP_ZONE("BfCompiler::ClearOldHotData");
6815
6816 bool isHotCompile = IsHotCompile();
6817
6818 auto itr = mHotData->mMethodMap.begin();
6819 while (itr != mHotData->mMethodMap.end())
6820 {
6821 String& methodName = itr->mKey;
6822 auto hotMethod = itr->mValue;
6823
6824 bool doDelete = false;
6825
6826 // If a previous version of a method is not currently active then it should be impossible to ever reach it
6827 while (hotMethod->mPrevVersion != NULL)
6828 {
6829 auto prevMethod = hotMethod->mPrevVersion;
6830 if (prevMethod->mRefCount > 1)
6831 {
6832 BF_ASSERT((mHotResolveData != NULL) && (mHotResolveData->mActiveMethods.Contains(prevMethod)));
6833 break;
6834 }
6835
6836 hotMethod->mPrevVersion = prevMethod->mPrevVersion;
6837 prevMethod->mPrevVersion = NULL;
6838 prevMethod->Deref();
6839 }
6840
6841 BF_ASSERT(hotMethod->mRefCount >= 1);
6842 if (hotMethod->mPrevVersion == NULL)
6843 {
6844 if (hotMethod->mRefCount <= 1)
6845 {
6846 doDelete = true;
6847 }
6848 else if ((!isHotCompile) && ((hotMethod->mFlags & (BfHotDepDataFlag_IsBound | BfHotDepDataFlag_RetainMethodWithoutBinding)) == 0))
6849 {
6850 doDelete = true;
6851 }
6852 }
6853
6854 bool doRemove = doDelete;
6855 if ((hotMethod->mFlags & BfHotDepDataFlag_HasDup) != 0)
6856 {
6857 bool hasDupMethod = false;
6858 for (int idx = 0; idx < (int)hotMethod->mReferences.size(); idx++)
6859 {
6860 auto depData = hotMethod->mReferences[idx];
6861 if (depData->mDataKind == BfHotDepDataKind_DupMethod)
6862 {

Callers

nothing calls this directly

Calls 12

ClearUnusedMethod · 0.80
GetLatestVersionHeadMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
ContainsMethod · 0.45
DerefMethod · 0.45
sizeMethod · 0.45
RemoveAtMethod · 0.45
c_strMethod · 0.45
ClearMethod · 0.45
RemoveMethod · 0.45
ToTypeInstanceMethod · 0.45

Tested by

no test coverage detected