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

Issue 8393017: Bitcode streaming (Closed)

Created:
9 years, 2 months ago by (google.com) Derek Schuff
Modified:
8 years, 9 months ago
CC:
native-client-reviews_googlegroups.com, pnacl-team_google.com
Visibility:
Public.

Description

This patch enables bitcode streaming, behind a flag (-streaming-bitcode). It is intended to work even if the size of the bitcode is not known in advance, but to work even better if it is known (a future CL will wrap pnacl bitcode in a header with size info). * Introduce BitstreamBytes container to hold bitcode in the bitcode reader, instead of a fixed-size memory buffer * Introduce getStreamedBitcodeModule plumbing, using a callback to fetch more bytes from the stream. * add BitcodeFileStream to implement the callback for files * Modify ParseModule to not read/skip the entire bitcode before materialization

Patch Set 1 #

Total comments: 4

Patch Set 2 : Tweak interfaces #

Patch Set 3 : rebase #

Patch Set 4 : rebase against upstream LLVM #

Total comments: 66

Patch Set 5 : Address comments, incorporate parsing changes from CL 8437024 (still has TODOs) #

Patch Set 6 : typo #

Patch Set 7 : namespace #

Patch Set 8 : rename BitstreamVector and change operator[] to getByte/getWord methods #

Patch Set 9 : missed a few #

Patch Set 10 : factor cleanups into function #

Patch Set 11 : bug #

Patch Set 12 : Move files to Support, a few extra cleanups #

Patch Set 13 : Rebase against LLVM r144247 #

Patch Set 14 : Rebase to 145254 #

Patch Set 15 : more comments, rebase to 145582 #

Patch Set 16 : put destructors back, fix trailing whitespace #

Unified diffs Side-by-side diffs Delta from patch set Stats (+590 lines, -129 lines) Patch
M include/llvm/Bitcode/BitstreamReader.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 15 chunks +226 lines, -36 lines 0 comments Download
M include/llvm/Bitcode/ReaderWriter.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +19 lines, -7 lines 0 comments Download
A include/llvm/Support/BitcodeStream.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +39 lines, -0 lines 0 comments Download
M lib/Bitcode/Reader/BitcodeReader.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +22 lines, -7 lines 0 comments Download
M lib/Bitcode/Reader/BitcodeReader.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 12 chunks +136 lines, -65 lines 0 comments Download
M lib/Bitcode/Writer/BitcodeWriter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +5 lines, -5 lines 0 comments Download
A lib/Support/BitcodeStream.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +97 lines, -0 lines 0 comments Download
M tools/llc/llc.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 chunks +43 lines, -6 lines 0 comments Download
M tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +3 lines, -3 lines 0 comments Download

Messages

Total messages: 19 (0 generated)
(google.com) Derek Schuff
9 years, 2 months ago (2011-10-25 21:00:53 UTC) #1
robertm
One observation on a very high level: why does the reader have to be aware ...
9 years, 2 months ago (2011-10-25 21:19:44 UTC) #2
jasonwkim
1 nit and 1 qustion http://codereview.chromium.org/8393017/diff/1/include/llvm/Support/IRReader.h File include/llvm/Support/IRReader.h (right): http://codereview.chromium.org/8393017/diff/1/include/llvm/Support/IRReader.h#newcode73 include/llvm/Support/IRReader.h:73: // like lazy file ...
9 years, 2 months ago (2011-10-25 21:34:11 UTC) #3
(google.com) Derek Schuff
http://codereview.chromium.org/8393017/diff/1/include/llvm/Support/IRReader.h File include/llvm/Support/IRReader.h (right): http://codereview.chromium.org/8393017/diff/1/include/llvm/Support/IRReader.h#newcode73 include/llvm/Support/IRReader.h:73: // like lazy file module but does not read ...
9 years, 2 months ago (2011-10-25 22:23:22 UTC) #4
(google.com) Derek Schuff
On 2011/10/25 21:19:44, robertm wrote: > One observation on a very high level: > > ...
9 years, 2 months ago (2011-10-25 22:30:12 UTC) #5
pdox
This looks like a huge # of localmods? Can you use the: // @LOCALMOD and ...
9 years, 2 months ago (2011-10-25 22:38:12 UTC) #6
(google.com) Derek Schuff
My goal is to try to send this upstream. So once I get some feedback ...
9 years, 2 months ago (2011-10-25 22:44:21 UTC) #7
robertm
On 2011/10/25 22:30:12, Derek Schuff wrote: > On 2011/10/25 21:19:44, robertm wrote: > > One ...
9 years, 2 months ago (2011-10-25 22:54:33 UTC) #8
pdox
Derek, Upstreaming is hard, especially something of this magnitude. I'm worried that if you do ...
9 years, 2 months ago (2011-10-25 22:55:48 UTC) #9
(google.com) Derek Schuff
per our conversation, I will keep it in my local git while I attempt to ...
9 years, 2 months ago (2011-10-25 23:32:06 UTC) #10
nlewycky
I'm very concerned that BitcodeStreamer is fully virtual. Most of the time virtual functions aren't ...
9 years, 1 month ago (2011-11-05 00:45:06 UTC) #11
robertm
On Fri, Nov 4, 2011 at 8:45 PM, <nlewycky@google.com> wrote: > I'm very concerned that ...
9 years, 1 month ago (2011-11-07 15:16:45 UTC) #12
(google.com) Derek Schuff
Technically GetBytes can be called in a loop, but it's called to on chunks at ...
9 years, 1 month ago (2011-11-07 17:11:50 UTC) #13
(google.com) Derek Schuff
http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/BitcodeStream.h File include/llvm/Bitcode/BitcodeStream.h (right): http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/BitcodeStream.h#newcode1 include/llvm/Bitcode/BitcodeStream.h:1: //===---- llvm/Bitcode/BitcodeStream.h - ----*- C++ -*-===// OK. I'm a ...
9 years, 1 month ago (2011-11-07 17:32:09 UTC) #14
(google.com) Derek Schuff
started addressing comments (the stuff marked as "done" hasn't been uploaded yet), but I wanted ...
9 years, 1 month ago (2011-11-07 17:59:35 UTC) #15
(google.com) Derek Schuff
oh, one other thing I wanted to add to this. with the change below, we'd ...
9 years, 1 month ago (2011-11-07 18:46:27 UTC) #16
jvoung - send to chromium...
http://codereview.chromium.org/8393017/diff/10001/tools/llc/llc.cpp File tools/llc/llc.cpp (right): http://codereview.chromium.org/8393017/diff/10001/tools/llc/llc.cpp#newcode365 tools/llc/llc.cpp:365: PassManagerBase *PM; Is there a scoped-pointer class that you ...
9 years, 1 month ago (2011-11-07 19:01:55 UTC) #17
(google.com) Derek Schuff
Addressed most of the comments; A couple of clarification questions in there. Also went ahead ...
9 years, 1 month ago (2011-11-07 22:33:50 UTC) #18
(google.com) Derek Schuff
9 years, 1 month ago (2011-11-08 00:53:23 UTC) #19
OK, I think I have all of the original comments. probably a good time to take
another look and/or continue the discussion points already started.

I still have a couple TODOs in there.

http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/Bitstr...
File include/llvm/Bitcode/BitstreamReader.h (right):

http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/Bitstr...
include/llvm/Bitcode/BitstreamReader.h:35: // Is Pos the ending file position
(one byte past the last valid byte).
On 2011/11/05 00:45:06, nlewycky wrote:
> "Is Pos the ending file position (one byte past the last valid byte)."
> 
> Huh? Did you mean "Determine whether Pos is the ending file position"?

Done.

http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/Bitstr...
include/llvm/Bitcode/BitstreamReader.h:41: virtual size_t getEndPos()  = 0;
On 2011/11/05 00:45:06, nlewycky wrote:
> Extra space in "()  = 0".

Done.

http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/Bitstr...
include/llvm/Bitcode/BitstreamReader.h:90: virtual unsigned char operator
[](size_t Pos) {
This container isn't supposed to be mutable. also, any of these functions can
require the streaming version to fetch more bytes.
On 2011/11/05 00:45:06, nlewycky wrote:
> This is confusing. Should it instead be returning a reference? Or should the
> method be const?

Done.

http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/Bitstr...
include/llvm/Bitcode/BitstreamReader.h:92: && "indexing outside of buffer");
On 2011/11/05 00:45:06, nlewycky wrote:
> Bad indent. (Can the && go on the previous line? Would it fit? Same as in
> addressOf).

Done.

http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/Bitstr...
include/llvm/Bitcode/BitstreamReader.h:106: LazyBitstreamVector(BitcodeStreamer*
streamer) : Bytes(kChunkSize),
On 2011/11/05 00:45:06, nlewycky wrote:
> Please most the constructor list to starting on the following line.

Done.

http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/Bitstr...
include/llvm/Bitcode/BitstreamReader.h:229: BitstreamReader(BitstreamVector*
bsv) {
On 2011/11/05 00:45:06, nlewycky wrote:
> * on the right

Done.

http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/Bitstr...
include/llvm/Bitcode/BitstreamReader.h:238: BitstreamVector& getBSV() { return
*BSV; }
On 2011/11/05 00:45:06, nlewycky wrote:
> & on the right.

Done.

http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/Bitstr...
include/llvm/Bitcode/BitstreamReader.h:450: CurWord =
(BitStream->getBSV()[NextChar+0] <<  0) |
On 2011/11/05 00:45:06, nlewycky wrote:
> Extra space in "<<  0"

Done.

http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/Bitstr...
include/llvm/Bitcode/BitstreamReader.h:579: if (CurCodeSize == 0 ||
AtEndOfStream() || 0)
On 2011/11/05 00:45:06, nlewycky wrote:
> || 0?

Done.

http://codereview.chromium.org/8393017/diff/10001/include/llvm/Bitcode/Bitstr...
include/llvm/Bitcode/BitstreamReader.h:580: //       
!BitStream->getBSV().canSkipToPos(NextChar+NumWords*4))
On 2011/11/05 00:45:06, nlewycky wrote:
> Delete commented out code.

Done.

Powered by Google App Engine
This is Rietveld 408576698