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

Method SlowGenerateSlotNums

IDEHelper/Compiler/BfCompiler.cpp:2828–3015  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2826};
2827
2828bool BfCompiler::SlowGenerateSlotNums()
2829{
2830 BP_ZONE("BfCompiler::SlowGenerateSlotNums");
2831
2832 SlotEntryMap ifaceUseMap;
2833
2834 std::unordered_set<InterfacePair, InterfacePairHash> concurrentInterfaceSet;
2835 HashSet<BfTypeInstance*> foundIFaces;
2836
2837 if (mMaxInterfaceSlots < 0)
2838 {
2839 mMaxInterfaceSlots = 0;
2840 }
2841
2842 bool isHotCompile = IsHotCompile();
2843
2844 for (auto type : mContext->mResolvedTypes)
2845 {
2846 if (!type->IsReified())
2847 continue;
2848
2849 auto typeInst = type->ToTypeInstance();
2850 if (typeInst == NULL)
2851 continue;
2852
2853 if (typeInst->IsUnspecializedType())
2854 continue;
2855
2856 if (typeInst->IsInterface())
2857 {
2858 if (typeInst->mSlotNum == -2) // Not needed
2859 continue;
2860 if (!isHotCompile) // Hot compiles cannot remap slot numbers
2861 typeInst->mSlotNum = -1;
2862 if (typeInst->mVirtualMethodTableSize > 0)
2863 {
2864 GetSlotEntry(ifaceUseMap, typeInst);
2865 }
2866 continue;
2867 }
2868
2869 foundIFaces.Clear();
2870 auto checkTypeInst = typeInst;
2871 while (checkTypeInst != NULL)
2872 {
2873 for (auto iface : checkTypeInst->mInterfaces)
2874 {
2875 auto interfaceType = iface.mInterfaceType;
2876 if (interfaceType->mSlotNum == -2)
2877 continue; // Not needed
2878
2879 if ((isHotCompile) && (interfaceType->mSlotNum == -1))
2880 checkTypeInst->mDirty = true; // We're about to slot an interface here
2881
2882 if (interfaceType->mVirtualMethodTableSize > 0)
2883 {
2884 BfSlotEntry* slotEntry = GetSlotEntry(ifaceUseMap, interfaceType);
2885 slotEntry->mRefCount++;

Callers

nothing calls this directly

Calls 14

GetSlotEntryFunction · 0.85
MakeInterfacePairFunction · 0.85
IsReifiedMethod · 0.45
ToTypeInstanceMethod · 0.45
IsUnspecializedTypeMethod · 0.45
IsInterfaceMethod · 0.45
ClearMethod · 0.45
AddMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected