diff options
author | Karl Schimpf <kschimpf@google.com> | 2013-05-24 09:55:03 -0700 |
---|---|---|
committer | Karl Schimpf <kschimpf@google.com> | 2013-05-24 09:55:03 -0700 |
commit | 80b7ba7480724c773b96da24999d817b6b46ef29 (patch) | |
tree | 6b7dba38623ef94b89b43f7cba898c1b8017294f /lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp | |
parent | 501900058c0815d35e630d416e3d4e1373b75b9c (diff) |
Make abbreviations explicit in pnacl-freeze/thaw.
[1] Explicitly enumerate all abbreviation values, including the
maximum abbreviation for each type of block.
[2] Make "enter subblock" calculate number of bits needed by passing
in maximum abbreviation (associated with block) rather than requiring
the developer to compute this value every time a subblock is entered.
*NOTE* This code changes encoding sizes to be based on
the maximum allowed value, rather than requiring the
developer to calculate out the number of bits needed. This
change doesn't make the PNaCL bitcode files
incompatable with LLVM bitcode files, since it does
not effect the bitcode reader.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/14813032
Diffstat (limited to 'lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp')
-rw-r--r-- | lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp index 677539071b..d75c42ca9b 100644 --- a/lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp +++ b/lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp @@ -71,13 +71,14 @@ bool NaClBitstreamCursor::EnterSubBlock(unsigned BlockID, unsigned *NumWordsP) { } // Get the codesize of this block. - CurCodeSize = ReadVBR(naclbitc::CodeLenWidth); + CurCodeSize.IsFixed = true; + CurCodeSize.NumBits = ReadVBR(naclbitc::CodeLenWidth); SkipToFourByteBoundary(); unsigned NumWords = Read(naclbitc::BlockSizeWidth); if (NumWordsP) *NumWordsP = NumWords; // Validate that this block is sane. - if (CurCodeSize == 0 || AtEndOfStream()) + if (CurCodeSize.NumBits == 0 || AtEndOfStream()) return true; return false; |