OSDN Git Service

ART: Refactor SsaBuilder for more precise typing info
authorDavid Brazdil <dbrazdil@google.com>
Wed, 4 Nov 2015 23:30:22 +0000 (23:30 +0000)
committerDavid Brazdil <dbrazdil@google.com>
Mon, 14 Dec 2015 13:03:19 +0000 (13:03 +0000)
commitd9510dfc32349eeb4f2145c801f7ba1d5bccfb12
tree9f4e4ffb5fae25c4f14059fd1d772726e9d96170
parentceec5a3c81925cf80a18954b2e585316450c575c
ART: Refactor SsaBuilder for more precise typing info

This patch refactors the SsaBuilder to do the following:

1) All phis are constructed live and marked dead if not used or proved
to be conflicting.

2) Primitive type propagation, now not a separate pass, identifies
conflicting types and marks corresponding phis dead.

3) When compiling --debuggable, DeadPhiHandling used to revive phis
which had only environmental uses but did not attempt to resolve
conflicts. This pass was removed as obsolete and is now superseded
by primitive type propagation (identifying conflicting phis) and
SsaDeadPhiEliminiation (keeping phis live if debuggable + env use).

4) Resolving conflicts requires correct primitive type information
on all instructions. This was not the case for ArrayGet instructions
which can have ambiguous types in the bytecode. To this end,
SsaBuilder now runs reference type propagation and types ArrayGets
from the type of the input array.

5) With RTP being run inside the SsaBuilder, it is not necessary to
run it as a separate optimization pass. Optimizations can now assume
that all instructions of type kPrimNot have reference type info after
SsaBuilder (with the exception of NullConstant).

6) Graph now contains a reference type to be assigned to NullConstant.
All reference type instructions therefore have RTI, as now enforced
by the SsaChecker.

Bug: 24252151
Bug: 24252100
Bug: 22538329
Bug: 25786318

Change-Id: I7a3aee1ff66c82d64b4846611c547af17e91d260
40 files changed:
compiler/Android.mk
compiler/optimizing/bounds_check_elimination.cc
compiler/optimizing/constant_folding_test.cc
compiler/optimizing/dead_code_elimination_test.cc
compiler/optimizing/graph_checker.cc
compiler/optimizing/graph_checker_test.cc
compiler/optimizing/graph_visualizer.cc
compiler/optimizing/gvn_test.cc
compiler/optimizing/induction_var_analysis_test.cc
compiler/optimizing/induction_var_range_test.cc
compiler/optimizing/inliner.cc
compiler/optimizing/licm_test.cc
compiler/optimizing/linearize_test.cc
compiler/optimizing/live_ranges_test.cc
compiler/optimizing/liveness_test.cc
compiler/optimizing/nodes.cc
compiler/optimizing/nodes.h
compiler/optimizing/optimizing_compiler.cc
compiler/optimizing/optimizing_compiler_stats.h
compiler/optimizing/optimizing_unit_test.h
compiler/optimizing/primitive_type_propagation.cc [deleted file]
compiler/optimizing/primitive_type_propagation.h [deleted file]
compiler/optimizing/reference_type_propagation.cc
compiler/optimizing/register_allocator_test.cc
compiler/optimizing/ssa_builder.cc
compiler/optimizing/ssa_builder.h
compiler/optimizing/ssa_phi_elimination.cc
compiler/optimizing/ssa_test.cc
test/444-checker-nce/src/Main.java
test/450-checker-types/src/Main.java
test/477-checker-bound-type/src/Main.java
test/530-checker-lse/src/Main.java
test/540-checker-rtp-bug/src/Main.java
test/549-checker-types-merge/src/Main.java
test/552-checker-primitive-typeprop/expected.txt [new file with mode: 0644]
test/552-checker-primitive-typeprop/info.txt [new file with mode: 0644]
test/552-checker-primitive-typeprop/smali/ArrayGet.smali [new file with mode: 0644]
test/552-checker-primitive-typeprop/smali/SsaBuilder.smali [new file with mode: 0644]
test/552-checker-primitive-typeprop/smali/TypePropagation.smali [new file with mode: 0644]
test/552-checker-primitive-typeprop/src/Main.java [new file with mode: 0644]