OSDN Git Service

ART: Fix wide stores in Optimizing
authorDavid Brazdil <dbrazdil@google.com>
Thu, 19 Nov 2015 10:29:39 +0000 (10:29 +0000)
committerDavid Brazdil <dbrazdil@google.com>
Mon, 23 Nov 2015 13:49:46 +0000 (13:49 +0000)
commit809d70f5b268227dbd59432dc038c74d8351be29
tree6482a9ce5a34c04fc14d5b5db77d5daec1ec5aad
parentdde8b8694954c0268eb12a7ccbddf07d9de262fd
ART: Fix wide stores in Optimizing

SsaBuilder::VisitStoreLocal did not take into account the following:
 (a) when storing a wide value, the high vreg must be invalidated,
 (b) when storing into the high vreg of a wide value, the low vreg
     must be invalidated.

Both situations cause overestimation of liveness but only (b) has
implications on correctness. CodeGenerator::EmitEnvironment will skip
the high vreg, causing deoptimizing and try/catch to load a wrong
value for that vreg.

In order to fix this bug, several changes had to be made to the
SsaBuilder:
 (1) phis need to be initialized with a type which matches its
     inputs' size,
 (2) eagerly created loop header phis may end up being undefined
     because of their corresponding vregs being invalidated inside
     the loop; these are marked dead during input setting,
 (3) the entire SSA-building algorithm should never revive an
     undefined loop header phi.

Bug: 25677992
Bug: https://code.google.com/p/android/issues/detail?id=194022

Change-Id: Id8a852e38c3f5ff1c2e608b1aafd6d5ac8311e32
compiler/optimizing/nodes.h
compiler/optimizing/primitive_type_propagation.cc
compiler/optimizing/ssa_builder.cc
compiler/optimizing/ssa_builder.h
compiler/optimizing/ssa_phi_elimination.cc
test/550-checker-regression-wide-store/expected.txt [new file with mode: 0644]
test/550-checker-regression-wide-store/info.txt [new file with mode: 0644]
test/550-checker-regression-wide-store/smali/TestCase.smali [new file with mode: 0644]
test/550-checker-regression-wide-store/src/Main.java [new file with mode: 0644]