@@ -278,23 +278,38 @@ void FuncGen::DefineTopLevelGetSizeRefTyped(std::string& testCode,
278
278
pointers.initialize();
279
279
pointers.add((uintptr_t)&t);
280
280
auto data = reinterpret_cast<uintptr_t*>(dataBase);
281
+
282
+ // TODO: Replace these with types::st::Uint64 once the VarInt decoding
283
+ // logic is moved out of OIDebugger and into new TreeBuilder.
281
284
data[0] = oidMagicId;
282
285
data[1] = cookieValue;
283
286
data[2] = 0;
287
+
284
288
size_t dataSegOffset = 3 * sizeof(uintptr_t);
285
289
JLOG("%1% @");
286
290
JLOGPTR(&t);
287
- using DataBufferType = OIInternal::TypeHandler<DataBuffer::DataSegment, OIInternal::__ROOT_TYPE__>::type;
288
- DataBufferType db = DataBuffer::DataSegment(dataSegOffset);
289
- types::st::Unit<DataBuffer::DataSegment> out = OIInternal::getSizeType<DataBuffer::DataSegment>(t, db);
290
- types::st::Unit<DataBuffer::DataSegment> final = out.template cast<types::st::Pair<
291
+
292
+ using ContentType = OIInternal::TypeHandler<DataBuffer::DataSegment, OIInternal::__ROOT_TYPE__>::type;
293
+ using SuffixType = types::st::Pair<
291
294
DataBuffer::DataSegment,
292
295
types::st::VarInt<DataBuffer::DataSegment>,
293
296
types::st::VarInt<DataBuffer::DataSegment>
294
- >>()
297
+ >;
298
+ using DataBufferType = types::st::Pair<
299
+ DataBuffer::DataSegment,
300
+ ContentType,
301
+ SuffixType
302
+ >;
303
+
304
+ DataBufferType db = DataBuffer::DataSegment(dataSegOffset);
305
+ SuffixType suffix = db.delegate([&t](auto ret) {
306
+ return OIInternal::getSizeType<DataBuffer::DataSegment>(t, ret);
307
+ });
308
+ types::st::Unit<DataBuffer::DataSegment> end = suffix
295
309
.write(123456789)
296
310
.write(123456789);
297
- dataSegOffset = final.offset();
311
+
312
+ dataSegOffset = end.offset();
298
313
data[2] = dataSegOffset;
299
314
dataBase += dataSegOffset;
300
315
}
0 commit comments