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

Issue 1338633005: Subzero: Add a flag to mock up bounds checking on unsafe references. (Closed)

Created:
5 years, 3 months ago by Jim Stichnoth
Modified:
5 years, 3 months ago
Reviewers:
ascull, John
CC:
native-client-reviews_googlegroups.com, bradnelson, Mircea Trofin
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Subzero: Add a flag to mock up bounds checking on unsafe references. The idea is that, before each load or store operation, we add a couple of compares/branches against the load/store address, one for the lower bound and one for the upper bound. The conditional branches would be to an error throwing routine, and would never be taken in practice. The compares might be against an immediate or a global location. So a load of [reg] will mock-expand to this: cmp reg, 0 je label cmp reg, 1 je label label: mov xxx, [reg] We also make address mode inference less aggressive, because for a load of e.g. [eax+4*ecx], we can't compare that address expression against anything in any instruction, so we would have to reconstruct the address and undo at least part of the address mode inference. The bounds-check mock is added for loads, stores, and rmw operations (with an exclusion for stores to the stack for out-arg pushes). There are probably a small handful of other cases that are missing the bounds check, but if we add the transformation inside legalize(), which is the most obvious place, we may add extra bounds checks because sometimes legalize() is called twice on the same operand. BUG= none R=ascull@google.com Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=ad2989b6e497f6237a3ae66ae3cfbcceaa99d4f5

Patch Set 1 #

Patch Set 2 : Don't be super overaggressive with mock bounds checks #

Patch Set 3 : Don't check bounds when pushing out-args for calls #

Patch Set 4 : Fix comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+77 lines, -2 lines) Patch
M src/IceClFlags.h View 2 chunks +4 lines, -0 lines 0 comments Download
M src/IceClFlags.cpp View 3 chunks +5 lines, -0 lines 0 comments Download
M src/IceTargetLowering.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/IceTargetLoweringX86Base.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/IceTargetLoweringX86BaseImpl.h View 1 2 3 5 chunks +66 lines, -2 lines 0 comments Download

Messages

Total messages: 4 (1 generated)
Jim Stichnoth
Measured across spec2k (geomean), adding the bounds check drops performance by about 15%. Just restricting ...
5 years, 3 months ago (2015-09-15 05:01:27 UTC) #2
ascull
lgtm That counteracts the register allocation improvements! To improve performance do you think it would ...
5 years, 3 months ago (2015-09-15 16:27:20 UTC) #3
Jim Stichnoth
5 years, 3 months ago (2015-09-15 17:21:47 UTC) #4
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as
ad2989b6e497f6237a3ae66ae3cfbcceaa99d4f5 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698