Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Unified Diff: lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp

Issue 1122423005: Add (unsupported experimental) feature allowing byte aligned bitcode. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix nits. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp
index 9d48f4b6a1cdf0691cf1c28dd6459da5c9fb6763..3de4ff1a5b15de0d852068e6ea0b1260b29fb587 100644
--- a/lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp
+++ b/lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp
@@ -143,6 +143,7 @@ void NaClBitstreamCursor::skipRecord(unsigned AbbrevID) {
unsigned NumElts = ReadVBR(6);
for (unsigned i = 0; i != NumElts; ++i)
(void)ReadVBR64(6);
+ SkipToByteBoundaryIfAligned();
return;
}
@@ -170,6 +171,7 @@ void NaClBitstreamCursor::skipRecord(unsigned AbbrevID) {
}
}
}
+ SkipToByteBoundaryIfAligned();
}
bool NaClBitstreamCursor::readRecordAbbrevField(
@@ -230,6 +232,7 @@ unsigned NaClBitstreamCursor::readRecord(unsigned AbbrevID,
unsigned NumElts = ReadVBR(6);
for (unsigned i = 0; i != NumElts; ++i)
Vals.push_back(ReadVBR64(6));
+ SkipToByteBoundaryIfAligned();
return Code;
}
@@ -244,6 +247,7 @@ unsigned NaClBitstreamCursor::readRecord(unsigned AbbrevID,
const NaClBitCodeAbbrevOp &Op = Abbv->getOperandInfo(1);
Code = readArrayAbbreviatedField(Op);
readArrayAbbrev(Op, Value - 1, Vals);
+ SkipToByteBoundaryIfAligned();
return Code;
}
Code = Value;
@@ -254,10 +258,12 @@ unsigned NaClBitstreamCursor::readRecord(unsigned AbbrevID,
if (readRecordAbbrevField(Abbv->getOperandInfo(i), Value)) {
++i;
readArrayAbbrev(Abbv->getOperandInfo(i), Value, Vals);
+ SkipToByteBoundaryIfAligned();
return Code;
}
Vals.push_back(Value);
}
+ SkipToByteBoundaryIfAligned();
return Code;
}
@@ -323,6 +329,7 @@ void NaClBitstreamCursor::ReadAbbrevRecord(bool IsLocal,
Abbv->Add(NaClBitCodeAbbrevOp(E));
}
}
+ SkipToByteBoundaryIfAligned();
if (!Abbv->isValid())
report_fatal_error("Invalid abbreviation specified in bitcode file");
CurAbbrevs.push_back(Abbv);
@@ -347,6 +354,7 @@ void NaClBitstreamCursor::SkipAbbrevRecord() {
ReadVBR64(5);
}
}
+ SkipToByteBoundaryIfAligned();
}
bool NaClBitstreamCursor::ReadBlockInfoBlock(NaClAbbrevListener *Listener) {
« no previous file with comments | « lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp ('k') | lib/Bitcode/NaCl/TestUtils/NaClBitcodeMungeReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698