OSDN Git Service

Deoptimization-based bce.
authorMingyao Yang <mingyao@google.com>
Sat, 7 Mar 2015 14:37:59 +0000 (06:37 -0800)
committerMingyao Yang <mingyao@google.com>
Mon, 23 Mar 2015 23:39:37 +0000 (16:39 -0700)
commite295e6ec5beaea31be5d7d3c996cd8cfa2053129
tree4d8a657d23d511743ce35bee596544d7f652efdb
parentd24ba2c44c76a2b2dd13aafe8f7981c15be31a98
Deoptimization-based bce.

A mechanism is introduced that a runtime method can be called
from code compiled with optimizing compiler to deoptimize into
interpreter. This can be used to establish invariants in the managed code
If the invariant does not hold at runtime, we will deoptimize and continue
execution in the interpreter. This allows to optimize the managed code as
if the invariant was proven during compile time. However, the exception
will be thrown according to the semantics demanded by the spec.

The invariant and optimization included in this patch are based on the
length of an array. Given a set of array accesses with constant indices
{c1, ..., cn}, we can optimize away all bounds checks iff all 0 <= min(ci) and
max(ci) < array-length. The first can be proven statically. The second can be
established with a deoptimization-based invariant. This replaces n bounds
checks with one invariant check (plus slow-path code).

Change-Id: I8c6e34b56c85d25b91074832d13dba1db0a81569
28 files changed:
compiler/oat_test.cc
compiler/optimizing/bounds_check_elimination.cc
compiler/optimizing/bounds_check_elimination_test.cc
compiler/optimizing/code_generator_arm.cc
compiler/optimizing/code_generator_arm.h
compiler/optimizing/code_generator_arm64.cc
compiler/optimizing/code_generator_arm64.h
compiler/optimizing/code_generator_x86.cc
compiler/optimizing/code_generator_x86.h
compiler/optimizing/code_generator_x86_64.cc
compiler/optimizing/code_generator_x86_64.h
compiler/optimizing/nodes.cc
compiler/optimizing/nodes.h
compiler/optimizing/prepare_for_register_allocation.cc
runtime/arch/arm/entrypoints_init_arm.cc
runtime/arch/arm64/entrypoints_init_arm64.cc
runtime/arch/x86/entrypoints_init_x86.cc
runtime/arch/x86/quick_entrypoints_x86.S
runtime/arch/x86_64/entrypoints_init_x86_64.cc
runtime/arch/x86_64/quick_entrypoints_x86_64.S
runtime/asm_support.h
runtime/entrypoints/quick/quick_entrypoints_list.h
runtime/entrypoints/runtime_asm_entrypoints.h
runtime/entrypoints_order_test.cc
runtime/interpreter/interpreter.cc
runtime/thread.cc
test/449-checker-bce/expected.txt
test/449-checker-bce/src/Main.java