@@ -34,9 +34,6 @@ const StringLiteral BlockContentRef::KindString;
3434
3535void ObjectFileSchema::anchor () {}
3636
37- cl::opt<bool > DirectIndexEncode (" direct-index-encode" ,
38- cl::desc (" Encode all indexes directly" ),
39- cl::init(false ));
4037cl::opt<bool >
4138 UseIndirectSymbolName (" indirect-symbol-name" ,
4239 cl::desc (" Encode symbol name into its own node" ),
@@ -304,10 +301,7 @@ static Error encodeEdge(CompileUnitBuilder &CUB, SmallVectorImpl<char> &Data,
304301 return SymbolIndex.takeError ();
305302
306303 unsigned IdxAndHasAddend = *SymbolIndex << 1 | (E->getAddend () != 0 );
307- if (!DirectIndexEncode)
308- CUB.encodeIndex (IdxAndHasAddend);
309- else
310- encoding::writeVBR8 (IdxAndHasAddend, Data);
304+ CUB.encodeIndex (IdxAndHasAddend);
311305
312306 if (E->getAddend () != 0 )
313307 encoding::writeVBR8 (E->getAddend (), Data);
@@ -317,11 +311,7 @@ static Error encodeEdge(CompileUnitBuilder &CUB, SmallVectorImpl<char> &Data,
317311static Error decodeEdge (LinkGraphBuilder &LGB, StringRef &Data,
318312 jitlink::Block &Parent, unsigned BlockIdx,
319313 const data::Fixup &Fixup) {
320- unsigned SymbolIdx;
321- if (!DirectIndexEncode)
322- SymbolIdx = LGB.nextIdxForBlock (BlockIdx);
323- else if (auto E = encoding::consumeVBR8 (Data, SymbolIdx))
324- return E;
314+ unsigned SymbolIdx = LGB.nextIdxForBlock (BlockIdx);
325315
326316 bool HasAddend = SymbolIdx & 1U ;
327317 auto Symbol = LGB.getSymbol (SymbolIdx >> 1 );
@@ -352,10 +342,7 @@ Expected<BlockRef> BlockRef::create(CompileUnitBuilder &CUB,
352342 auto SectionIndex = CUB.getSectionIndex (Block.getSection ());
353343 if (!SectionIndex)
354344 return SectionIndex.takeError ();
355- if (!DirectIndexEncode)
356- CUB.encodeIndex (*SectionIndex);
357- else
358- encoding::writeVBR8 (*SectionIndex, B->Data );
345+ CUB.encodeIndex (*SectionIndex);
359346
360347 // Do a simple sorting based on offset so it has stable ordering for the same
361348 // block.
@@ -420,10 +407,7 @@ Error BlockRef::materializeBlock(LinkGraphBuilder &LGB,
420407 unsigned BlockIdx) const {
421408 uint64_t SectionIdx;
422409 auto Remaining = getData ();
423- if (!DirectIndexEncode)
424- SectionIdx = LGB.nextIdxForBlock (BlockIdx);
425- else if (auto E = encoding::consumeVBR8 (Remaining, SectionIdx))
426- return E;
410+ SectionIdx = LGB.nextIdxForBlock (BlockIdx);
427411
428412 auto SectionInfo = LGB.getSectionInfo (SectionIdx);
429413 if (!SectionInfo)
@@ -538,10 +522,7 @@ static Error encodeSymbol(CompileUnitBuilder &CUB, SmallVectorImpl<char> &Data,
538522 auto BlockIndex = CUB.getBlockIndex (S.getBlock ());
539523 if (!BlockIndex)
540524 return BlockIndex.takeError ();
541- if (!DirectIndexEncode)
542- CUB.encodeIndex (*BlockIndex);
543- else
544- encoding::writeVBR8 (*BlockIndex, Data);
525+ CUB.encodeIndex (*BlockIndex);
545526 }
546527 return Error::success ();
547528}
@@ -589,12 +570,7 @@ static Error decodeSymbol(LinkGraphBuilder &LGB, StringRef &Data,
589570 bool IsCallable = Bits & (1U << 5 );
590571
591572 unsigned BlockIdx;
592- if (!DirectIndexEncode) {
593- auto Idx = LGB.nextIdx ();
594- if (!Idx)
595- return Idx.takeError ();
596- BlockIdx = *Idx;
597- } else if (auto E = encoding::consumeVBR8 (Data, BlockIdx))
573+ if (Error E = LGB.nextIdx ().moveInto (BlockIdx))
598574 return E;
599575
600576 auto BlockInfo = LGB.getBlockInfo (BlockIdx);
0 commit comments