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

Issue 1282523002: Fix processing of local variable indices in fuction blocks. (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

Fix processing of local variable indices in fuction blocks. The previous code used a vector to hold local values associated with indices in the bitcode file. The problem was that the vector would be expanded to match the index of a "variable index forward reference". If the index was very large, the program would freeze the computer trying to allocate an array large enough to contain the index. This patch fixes this by using a local unordered map instead of a vector. Hence, forward index references just add a sinle entry into the map. Note that this fix doesn't have a corresponding issue. However, the problem was made apparent from the problems noted in issues 4257 and 4261. BUG=None R=stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=c6acf08fae334eeade1577853a471e33cb05bc25

Patch Set 1 #

Patch Set 2 : Fix formatting. #

Total comments: 6

Patch Set 3 : Fix nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -22 lines) Patch
M src/PNaClTranslator.cpp View 1 2 7 chunks +33 lines, -22 lines 0 comments Download

Messages

Total messages: 6 (1 generated)
Karl
5 years, 4 months ago (2015-08-07 16:32:01 UTC) #1
Karl
5 years, 4 months ago (2015-08-07 22:33:21 UTC) #3
Jim Stichnoth
lgtm https://codereview.chromium.org/1282523002/diff/20001/src/PNaClTranslator.cpp File src/PNaClTranslator.cpp (right): https://codereview.chromium.org/1282523002/diff/20001/src/PNaClTranslator.cpp#newcode1291 src/PNaClTranslator.cpp:1291: typedef std::unordered_map<NaClBcIndexSize_t, Ice::Operand *> OperandsMap; For naming consistency, ...
5 years, 4 months ago (2015-08-08 16:14:48 UTC) #4
Karl
Committed patchset #3 (id:40001) manually as c6acf08fae334eeade1577853a471e33cb05bc25 (presubmit successful).
5 years, 4 months ago (2015-08-10 18:13:01 UTC) #5
Karl
5 years, 4 months ago (2015-08-10 18:13:09 UTC) #6
Message was sent while issue was closed.
https://codereview.chromium.org/1282523002/diff/20001/src/PNaClTranslator.cpp
File src/PNaClTranslator.cpp (right):

https://codereview.chromium.org/1282523002/diff/20001/src/PNaClTranslator.cpp...
src/PNaClTranslator.cpp:1291: typedef std::unordered_map<NaClBcIndexSize_t,
Ice::Operand *> OperandsMap;
On 2015/08/08 16:14:48, stichnot wrote:
> For naming consistency, I would use "OperandMap" or "CfgNodesMap".  (I prefer
> OperandMap/CfgNodeMap, fwiw.)

Done.

https://codereview.chromium.org/1282523002/diff/20001/src/PNaClTranslator.cpp...
src/PNaClTranslator.cpp:1445: // TODO(kschimpf) Remove error recovery once
implementation complete.
On 2015/08/08 16:14:48, stichnot wrote:
> Trying to remember the context of these TODOs...  Isn't implementation
complete
> by now?

This was back when someone wasn't sure we should keep error recovery, once we
get things working (i.e. consider it only for debugging). I think that keeping
error recovery around is good, and will fix in a separate CL>

https://codereview.chromium.org/1282523002/diff/20001/src/PNaClTranslator.cpp...
src/PNaClTranslator.cpp:1957: for (const std::pair<NaClBcIndexSize_t,
Ice::Operand *> Elmt : LocalOperands)
On 2015/08/08 16:14:48, stichnot wrote:
> I think this calls for auto:
> 
>   for (auto &Elmt : LocalOperands)
> 
> Or if not:
> 
>   for (const OperandsMap::value_type &Elmt : LocalOperands)

Good point. I didn't put the auto in because I didn't think the type was clear
enough. However, Using the second form is clear and simpler.

Powered by Google App Engine
This is Rietveld 408576698