OSDN Git Service

ART: Force constants into the entry block
authorDavid Brazdil <dbrazdil@google.com>
Tue, 24 Mar 2015 10:51:52 +0000 (10:51 +0000)
committerDavid Brazdil <dbrazdil@google.com>
Thu, 26 Mar 2015 14:10:03 +0000 (14:10 +0000)
commit8d5b8b295930aaa43255c4f0b74ece3ee8b43a47
treec26fc49bbc74615e7f0b9657aaf3757a8282d7a9
parentc8924c6ea9e83ba3832dd5551df38ab06f4aaca9
ART: Force constants into the entry block

Optimizations such as GVN and BCE make the assumption that all
constants are located in the entry block of the CFG, but not all
passes adhere to this rule.

This patch makes constructors of constants private and only accessible
to friend classes - HGraph for int/long constants and SsaBuilder for
float/double - which ensure that they are placed correctly and not
duplicated.

Note that the ArenaAllocatorAdapter was modified to not increment
the ArenaAllocator's internal reference counter in order to allow
for use of ArenaSafeMap inside an arena-allocated objects. Because
their destructor is not called, the counter does not get decremented.

Change-Id: I36a4fa29ae34fb905cdefd482ccbf386cff14166
17 files changed:
compiler/optimizing/boolean_simplifier.cc
compiler/optimizing/bounds_check_elimination_test.cc
compiler/optimizing/builder.cc
compiler/optimizing/builder.h
compiler/optimizing/codegen_test.cc
compiler/optimizing/constant_folding.cc
compiler/optimizing/constant_folding_test.cc
compiler/optimizing/graph_checker.cc
compiler/optimizing/graph_checker.h
compiler/optimizing/graph_test.cc
compiler/optimizing/instruction_simplifier.cc
compiler/optimizing/nodes.cc
compiler/optimizing/nodes.h
compiler/optimizing/register_allocator_test.cc
compiler/optimizing/ssa_builder.cc
compiler/optimizing/ssa_builder.h
runtime/base/arena_containers.h