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

Issue 1297433002: Change tracking of basic blocks (within function) to use a vector. (Closed)

Created:
5 years, 4 months ago by Karl
Modified:
5 years, 4 months ago
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Change tracking of basic blocks (within function) to use a vector. Changing the code to "preallocate" basic blocks in a vector, rather than dynamically creating on demand. This has the advantage of not requiring basic blocks to be sorted after the bitcode is parsed. This also means that the name of the basic blocks remain constant, even during parsing, making debugging easier. The drawback is that the DECLAREBLOCKS bitcode record of a function block can define a very large number of basic blocks. To control this, we look at the function block size (within the bitstream) to determine the maximal number of basic blocks that could be defined. If the DECLAREBLOCKS record specifies a number larger than this, we generate an error and recover (if applicable). We also add an cleanup test that confirms the number of declared basic blocks correspond to the number of basic blocks defined in the function. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4261 R=stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=98ed44642caf4ce694fbc3401c0ec958137b6f31

Patch Set 1 #

Patch Set 2 : Fix nits. #

Total comments: 5

Patch Set 3 : Fix issues in CL. #

Total comments: 4

Patch Set 4 : Fix nits. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+90 lines, -82 lines) Patch
M src/PNaClTranslator.cpp View 1 2 3 8 chunks +75 lines, -74 lines 0 comments Download
A + tests_lit/parse_errs/Inputs/bad-bb-size.tbc View 1 chunk +4 lines, -8 lines 0 comments Download
A tests_lit/parse_errs/bad-bb-size.test View 1 2 1 chunk +10 lines, -0 lines 0 comments Download
A tests_lit/parse_errs/lit.local.cfg View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 7 (1 generated)
Karl
5 years, 4 months ago (2015-08-13 21:28:49 UTC) #2
Jim Stichnoth
The assumption that Cfg::getNodes returns list<> rather than a vector<> is incorrect, and so maybe ...
5 years, 4 months ago (2015-08-13 23:16:25 UTC) #3
Karl
Sorry about adding the vector BlockNodes. This was confusion on my part between the LLVM ...
5 years, 4 months ago (2015-08-14 19:18:21 UTC) #4
Jim Stichnoth
lgtm https://codereview.chromium.org/1297433002/diff/40001/src/PNaClTranslator.cpp File src/PNaClTranslator.cpp (right): https://codereview.chromium.org/1297433002/diff/40001/src/PNaClTranslator.cpp#newcode1372 src/PNaClTranslator.cpp:1372: NumBytesDefiningFunction = NumWords * 4; Maybe use some ...
5 years, 4 months ago (2015-08-14 19:48:43 UTC) #5
Karl
Committed patchset #4 (id:60001) manually as 98ed44642caf4ce694fbc3401c0ec958137b6f31 (presubmit successful).
5 years, 4 months ago (2015-08-14 20:08:47 UTC) #6
Karl
5 years, 4 months ago (2015-08-14 20:09:15 UTC) #7
Message was sent while issue was closed.
Also removed last paragraph of description, since it no longer applies.

https://codereview.chromium.org/1297433002/diff/40001/src/PNaClTranslator.cpp
File src/PNaClTranslator.cpp (right):

https://codereview.chromium.org/1297433002/diff/40001/src/PNaClTranslator.cpp...
src/PNaClTranslator.cpp:1372: NumBytesDefiningFunction = NumWords * 4;
On 2015/08/14 19:48:43, stichnot wrote:
> Maybe use some sizeof() instead of 4?

Done.

https://codereview.chromium.org/1297433002/diff/40001/src/PNaClTranslator.cpp...
src/PNaClTranslator.cpp:1390: if (Index >= Nodes.size()) {
On 2015/08/14 19:48:43, stichnot wrote:
> You could use Func->getNumNodes() instead of Nodes.size(), then maybe "return
> Func->getNodes()[Index];" below, might be slightly easier to read (and it's
the
> pattern used in setBbName() below).

Done.

Powered by Google App Engine
This is Rietveld 408576698