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

Method GetDictionaryItems

IDEHelper/Compiler/CeDebugger.cpp:2131–2207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2129}
2130
2131String CeDebugger::GetDictionaryItems(DebugVisualizerEntry* debugVis, BfTypedValue dictValue, int bucketIdx, int nodeIdx, int& count, String* outContinuationData)
2132{
2133 CeEvaluationContext nextEvaluationContext(this, debugVis->mNextPointer);
2134 auto ceModule = mCeMachine->mCeModule;
2135
2136 BfTypedValue bucketsPtr = EvaluateInContext(dictValue, debugVis->mBuckets);
2137 BfTypedValue entriesPtr = EvaluateInContext(dictValue, debugVis->mEntries);
2138 if ((!bucketsPtr) || (!entriesPtr))
2139 {
2140 count = -1;
2141 return "";
2142 }
2143
2144 auto ceDictTypedVal = GetAddr(dictValue);
2145 if (!ceDictTypedVal)
2146 return "";
2147
2148 auto ceBucketsTypedVal = GetAddr(bucketsPtr);
2149 if (!ceBucketsTypedVal)
2150 return "";
2151
2152 String addrs;
2153
2154 if ((!entriesPtr) || (!entriesPtr.mType->IsPointer()))
2155 return "";
2156 if ((!bucketsPtr) || (!bucketsPtr.mType->IsPointer()))
2157 return "";
2158
2159 auto entryType = entriesPtr.mType->GetUnderlyingType();
2160 int entrySize = entryType->GetStride();
2161 int bucketIdxSize = bucketsPtr.mType->GetUnderlyingType()->GetStride();
2162
2163 auto ceElemTypedVal = GetAddr(entriesPtr);
2164 if (!ceElemTypedVal)
2165 return "";
2166
2167 bool checkLeft = true;
2168
2169 int encodeCount = 0;
2170 while (encodeCount < count)
2171 {
2172 if (nodeIdx != -1)
2173 {
2174 addr_ce entryAddr = (addr_ce)ceElemTypedVal.mAddr + (nodeIdx * entrySize);
2175
2176 BfTypedValue entryValue = BfTypedValue(ceModule->mBfIRBuilder->CreateConstAggCE(ceModule->mBfIRBuilder->MapType(entryType), entryAddr), entryType);
2177 addrs += EncodeDataPtr(entryAddr, false);
2178
2179 BfTypedValue nextValue = nextEvaluationContext.EvaluateInContext(entryValue);
2180 if ((!nextValue) || (!nextValue.mType->IsInteger()))
2181 {
2182 break;
2183 }
2184
2185 nodeIdx = (int)ValueToInt(nextValue);
2186 encodeCount++;
2187 }
2188 else

Callers

nothing calls this directly

Calls 8

BfTypedValueClass · 0.85
CreateConstAggCEMethod · 0.80
MapTypeMethod · 0.80
IsPointerMethod · 0.45
GetUnderlyingTypeMethod · 0.45
GetStrideMethod · 0.45
EvaluateInContextMethod · 0.45
IsIntegerMethod · 0.45

Tested by

no test coverage detected