History log of /art/compiler/optimizing/bounds_check_elimination.cc
Revision Date Author Comments
f479d7758dbe7e8740386fbf1d73e05b0277c5e3 16-May-2016 Anton Shamin <anton.shamin@intel.com> ART: ArrayGet hoisting restriction added.

Currently if we hoist ArrayGet from loop there is no guarantee
that insn will be executed at runtime. Because of that we could
face issues like crashes in generated code.

This patch introduces restriction for ArrayGet hoisting. We say
that ArrayGet execution is guaranteed at least one time if its bb
dominates all exit blocks.

Signed-off-by: Anton Shamin <anton.shamin@intel.com>

(cherry picked from commit f89381fed12faf96c45a83a989ae2fff82c05f3b)

BUG=29145171

Change-Id: Ia5664dedb1543d78a7b4038801b8372572f069f6
19b5021a49285627485675ef31276b8194269600 22-Apr-2016 Nicolas Geoffray <ngeoffray@google.com> Forbid HDeoptimize instructions in OSR methods.

Otherwise dominated instructions will assume something that
isn't necessarily correct if coming from the interpreter.

bug:28335959
bug:28249238
bug:28348878
bug:28080135

Contains fix from https://android-review.googlesource.com/#/c/220661/.

(cherry picked from commit 93a18c5d4160f632ecdb92af099574e9c7098c49)

Change-Id: I86c3f9340077caa0a3e3db896e0519e7d38d91a0
d59f3b1b7f5c1ab9f0731ff9dc60611e8d9a6ede 29-Mar-2016 Vladimir Marko <vmarko@google.com> Use iterators "before" the use node in HUserRecord<>.

Create a new template class IntrusiveForwardList<> that
mimicks std::forward_list<> except that all allocations
are handled externally. This is essentially the same as
boost::intrusive::slist<> but since we're not using Boost
we have to reinvent the wheel.

Use the new container to replace the HUseList and use the
iterators to "before" use nodes in HUserRecord<> to avoid
the extra pointer to the previous node which was used
exclusively for removing nodes from the list. This reduces
the size of the HUseListNode by 25%, 32B to 24B in 64-bit
compiler, 16B to 12B in 32-bit compiler. This translates
directly to overall memory savings for the 64-bit compiler
but due to rounding up of the arena allocations to 8B, we
do not get any improvement in the 32-bit compiler.

Compiling the Nexus 5 boot image with the 64-bit dex2oat
on host this CL reduces the memory used for compiling the
most hungry method, BatteryStats.dumpLocked(), by ~3.3MiB:

Before:
MEM: used: 47829200, allocated: 48769120, lost: 939920
Number of arenas allocated: 345,
Number of allocations: 815492, avg size: 58
...
UseListNode 13744640
...
After:
MEM: used: 44393040, allocated: 45361248, lost: 968208
Number of arenas allocated: 319,
Number of allocations: 815492, avg size: 54
...
UseListNode 10308480
...

Note that while we do not ship the 64-bit dex2oat to the
device, the JIT compilation for 64-bit processes is using
the 64-bit libart-compiler.

Bug: 28173563
Bug: 27856014

(cherry picked from commit 46817b876ab00d6b78905b80ed12b4344c522b6c)

Change-Id: Ifb2d7b357064b003244e92c0d601d81a05e56a7b
1ae88747200931a0feaacf3d17a926c5abf70593 14-Mar-2016 Aart Bik <ajcbik@google.com> Fixed bug in BCE, with regression test.

The fix is twofold:
(1) Ensure that bound checks are never eliminated more than once
to guard against any conceivable situation in which the same
bounds check appears multiple times in array length use list.
(2) Specially reject BoundsCheck(x,x) since that always goes OOB.

BUG=27628526

Change-Id: I399ec4254323e0cfcd0a68898f403cfab7b35135
b75878e9dd1cfae1a0387fffe7716102522b41e8 14-Mar-2016 Vladimir Marko <vmarko@google.com> Optimizing: Do not re-record standby checks for dynamic BCE.

Adding the checks to the standby vector invalidates the
vector storage used by range-based loop in the
BCEVisitor::Finish() as exposed by valgrind in image_test.

Bug: 27597089
Change-Id: Ib0f0e8cdfdb7211a64a26836e085cb99fb2ce8b8
591ad29eb1aa7c5ac7faadb426f5eb2b4a4ccd02 01-Mar-2016 Aart Bik <ajcbik@google.com> Standby list for dyn bce in potentially infinite loops.

Rationale:
The old code relied on "luck" to revisit basic blocks
after dynamic bce and incorporate all bounds checks
in potentially infinite loops that were "made" finite.
Now that revisiting has been removed completely, keeping
a standby list ensures all candidates are considered.

Change-Id: Ida3cf63be1307be6c2b0258d3e64b163f12be235
b6347b7a3dbf9f55cbd638c630e9d044d6d53ac6 29-Feb-2016 Aart Bik <ajcbik@google.com> Fixed bug on incorrectly revisiting same block.

Rationale:
Aart's fuzz tester found this particular bug, where
revisiting a block (after dynamic bce) would cause
static array length based bce to feed into itself
and thus incorrectly remove a needed bounds check.

bug=27376274

Change-Id: I9163f283af355d444b4cec707f194fe2b67c2572
bf3f1cf15a021ea1ff8ae860c55e8281da4619b3 23-Feb-2016 Aart Bik <ajcbik@google.com> Improved instruction + offset hunting.

Rationale:
This is generally useful for anything using this method
but in particular for deopting something like

bs[ off] = (byte)(n >>> 24);
bs[++off] = (byte)(n >>> 16);
bs[++off] = (byte)(n >>> 8);
bs[++off] = (byte)(n );

where the base + offset is hidden in the increments.
Occurs quite often in real-life code.

Change-Id: I3fa7d285a7368a179a26e590e8eee37f3b64c25d
da571cb73e9bc12636b23c58d7012cf14c228832 15-Feb-2016 Vladimir Marko <vmarko@google.com> Optimizing: Use range-based loops in BCE.

Change-Id: Ib7cbc6dcbdf61d0b115e6b872914cff3687ad6e4
1d23982327265e8139f67e37d9a86ba2758f7b4a 09-Feb-2016 Aart Bik <ajcbik@google.com> Generalized "dom-based" dynamic BCE to symbolic base + offset.

Rationale:
So far, if all others failed, BCE would use a dominator-based
dynamic deoptimization to eliminate bounds checks in e.g. a[0],
a[1], a[2], etc. This CL generalizes this to any symbolic base
with offset in e.g. a[base], a[base+1], etc. The runtime tests
(two for symbolic, one for constant) carefully account for
arithmetic wrap-around.

bug=26680114

Change-Id: I7432a200fd69791914ed776c77fa62567b5863c0
1fc3afb76dbed78d255db276381df6036db2ee98 02-Feb-2016 Aart Bik <ajcbik@google.com> Minor improvement on static BCE analysis.

Rationale:
Avoid testing initial range if nothing is known.

Change-Id: I22646a5fd6e4481245d1a2f57891d2805550489f
15bd22849ee6a1ffb3fb3630f686c2870bdf1bbc 05-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Implement irreducible loop support in optimizing.

So we don't fallback to the interpreter in the presence of
irreducible loops.

Implications:
- A loop pre-header does not necessarily dominate a loop header.
- Non-constant redundant phis will be kept in loop headers, to
satisfy our linear scan register allocation algorithm.
- while-graph optimizations, such as gvn, licm, lse, and dce
need to know when they are dealing with irreducible loops.

Change-Id: I2cea8934ce0b40162d215353497c7f77d6c9137e
55b14df87d8e14c0e3cd1aef4c60ea83e9f19f1a 12-Jan-2016 Aart Bik <ajcbik@google.com> Fixed bug with hoisting/deopting in taken-block instead of preheader.
With a fail-before pass-after regression test.

Rationale:
Hoisting and deopting should be done in the taken-block for safety
of the evaluation *unless* the code was in the original loop header,
and thus always taken.

https://code.google.com/p/android/issues/detail?id=198697

bug: 26506884

Change-Id: I1cf121292559fd2570ad67587ec3bc8e8a85a92a
4833f5a1990c76bc2be89504225fb13cca22bedf 16-Dec-2015 David Brazdil <dbrazdil@google.com> ART: Refactor SsaBuilder for more precise typing info

This reverts commit 68289a531484d26214e09f1eadd9833531a3bc3c.

Now uses Primitive::Is64BitType instead of Primitive::ComponentSize
because it was incorrectly optimized by GCC.

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

Change-Id: Ib39f3da2b92bc5be5d76f4240a77567d82c6bebe
68289a531484d26214e09f1eadd9833531a3bc3c 16-Dec-2015 Alex Light <allight@google.com> Revert "ART: Refactor SsaBuilder for more precise typing info"

This reverts commit d9510dfc32349eeb4f2145c801f7ba1d5bccfb12.

Bug: 26208284

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

Change-Id: I5f491becdf076ff51d437d490405ec4e1586c010
d9510dfc32349eeb4f2145c801f7ba1d5bccfb12 05-Nov-2015 David Brazdil <dbrazdil@google.com> 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
4b467ed97bc5886fb800209c0ee94df10163b88d 20-Nov-2015 Mingyao Yang <mingyao@google.com> Simplify and rename IsLoopInvariant() test.

Simplify IsLoopInvariant() test. Also rename it to IsDefinedOutOfTheLoop()
so there is no ambiguity for example whether a instruction after the loop counts
as a loop invariant. It's up to the caller to make the interpretation.

Change-Id: I999139032b0e4d815dd1e2276f2bd428cf558686
b738d4f477a9b6f4c4f69153f9077f1559d2bca1 03-Dec-2015 Aart Bik <ajcbik@google.com> Step-wise improvement of range analysis with outer loop induction.

Rationale: Using a step-wise approach (rather than expanding all ranges
at once) increases the opportunities for statically removing
bound checks, as demonstrated by the new checker tests.

Change-Id: Icbfd9406523a069e1fb7508546ea94f896e5a255
4a34277c55279ba57ab361f7580db846a201d9b1 30-Nov-2015 Aart Bik <ajcbik@google.com> Dynamic BCE (based on induction range analysis)

Rationale:
A rewritten dynamic BCE that uses induction variable analysis
to generate the run-time tests before a loop in order to
eliminate bounds-checks from its body. This CL removes now
obsoleted induction related code inside the BCE module.
Also, the dynamic test generation is placed more strategically,
since we missed a few cases where static analysis does better.

Most significant performance improvements (filtering noise) is about:

Linpack +20%
LU > +10%

Change-Id: I03d7631857154b6a131b132f26a2dc568af1b3a1
d59c70627cc42878cc30b46bd29ff497b4483b22 21-Nov-2015 Aart Bik <ajcbik@google.com> Revert "Dynamic BCE (based on induction range analysis)"

This reverts commit 0b5849be045c5683d4a6b6b6c306abadba5f0fcc.


Change-Id: Id33f5da42bbdfb1aff7e2281417c8a7aa492df05
Rationale: so close :-( but bullhead-userdebug (linux) build in git_mnc-dr-dev-plus-aosp reported a breakage with a type inconsistency (long vs int in probably the codegen of dynamic bce); no time to investigate and fix this fully before my trip, so rolling back for now
0b5849be045c5683d4a6b6b6c306abadba5f0fcc 19-Oct-2015 Aart Bik <ajcbik@google.com> Dynamic BCE (based on induction range analysis)

Rationale: A rewritten dynamic BCE that uses induction variable analysis
to generate the run-time tests before a loop in order to
eliminate bounds-checks from its body. This CL removes now
obsoleted induction related code inside the BCE module.
Also, the dynamic test generation is placed more strategically,
since we missed a few cases where static analysis does better.

Most significant performance improvements (after filtering noise) is about:
Linpack +20%
LU > +10%

Change-Id: I4e7b8bab0288beff6f98a14856e3536103d32742
389b3dbf5c5390056ff4dacac464219853dd3cda 28-Oct-2015 Aart Bik <ajcbik@google.com> Finalized all components of range analysis needed for dynamic bce.

Rationale: added ability to generate taken-test, prompt back need
for finite-test; cleaned up the API now that bounds
check needs are all known.

Change-Id: I3d09b249965d1a980c09381240de175ca4b2e455
ec7802a102d49ab5c17495118d4fe0bcc7287beb 01-Oct-2015 Vladimir Marko <vmarko@google.com> Add DCHECKs to ArenaVector and ScopedArenaVector.

Implement dchecked_vector<> template that DCHECK()s element
access and insert()/emplace()/erase() positions. Change the
ArenaVector<> and ScopedArenaVector<> aliases to use the new
template instead of std::vector<>. Remove DCHECK()s that
have now become unnecessary from the Optimizing compiler.

Change-Id: Ib8506bd30d223f68f52bd4476c76d9991acacadc
154746b84b407cfd166b45e039b62e6a06dc3f39 06-Oct-2015 Calin Juravle <calin@google.com> Remove dex_pc's default value from top level HInstruction

This clearly hints that the dex_pc is stored in the super class and
doesn't need to be reimplemented in subclasses.

Change-Id: Ifd4aa95190c4c89367b4dd2cc8ab0ffd263659ac
5233f93ee336b3581ccdb993ff6342c52fec34b0 29-Sep-2015 Vladimir Marko <vmarko@google.com> Optimizing: Tag even more arena allocations.

Tag previously "Misc" arena allocations with more specific
allocation types. Move some native heap allocations to the
arena in BCE.

Bug: 23736311
Change-Id: If8ef15a8b614dc3314bdfb35caa23862c9d4d25c
aab5b758a2ec7b089cd4993fc77f8f94d979e61e 23-Sep-2015 Aart Bik <ajcbik@google.com> Replaced INT_MIN/MAX with modern-day limits.

Change-Id: Ia6a0df1e8c6a543c338db0acd75437e1d19701e3
b3365e0c4cda4f8f19284d2d418db158ab78d810 21-Sep-2015 Aart Bik <ajcbik@google.com> Various improvements in range analysis.

Rationale:
Using min/max values for "unknowns" is a bit wasteful,
since it eliminates two useful values. Replaced this
with additional boolean to make cases more accurate.
Added few cases to handle examples found in real-life.

Change-Id: I211f8d9a28b1ae79abdb55fb4569716f21d8043b
fa6b93c4b69e6d7ddfa2a4ed0aff01b0608c5a3a 15-Sep-2015 Vladimir Marko <vmarko@google.com> Optimizing: Tag arena allocations in HGraph.

Replace GrowableArray with ArenaVector in HGraph and related
classes HEnvironment, HLoopInformation, HInvoke and HPhi,
and tag allocations with new arena allocation types.

Change-Id: I3d79897af405b9a1a5b98bfc372e70fe0b3bc40d
22af3bee34d0ab1a4bd186c71ccab00366882259 10-Sep-2015 Aart Bik <ajcbik@google.com> Use induction variable range analysis in BCE (statically).

Rationale: Finally! After lots of very large CLs, now a small CL
that uses the new induction variable analysis in BCE
(statically, using this dynamically with de-opt is TBD).
Despite its relative small size, be aware though,
since the CL introduces a new phase to the compiler.

Change-Id: If5555a173fd5d55d147c63138ef51fc296fa1414
6058455d486219994921b63a2d774dc9908415a2 03-Sep-2015 Vladimir Marko <vmarko@google.com> Optimizing: Tag basic block allocations with their source.

Replace GrowableArray with ArenaVector in HBasicBlock and,
to track the source of allocations, assign one new and two
Quick's arena allocation types to these vectors. Rename
kArenaAllocSuccessor to kArenaAllocSuccessors.

Bug: 23736311
Change-Id: Ib52e51698890675bde61f007fe6039338cf1a025
145acc5361deb769eed998f057bc23abaef6e116 03-Sep-2015 Vladimir Marko <vmarko@google.com> Revert "Optimizing: Tag basic block allocations with their source."

Reverting so that we can have more discussion about the STL API.

This reverts commit 91e11c0c840193c6822e66846020b6647de243d5.

Change-Id: I187fe52f2c16b6e7c5c9d49c42921eb6c7063dba
91e11c0c840193c6822e66846020b6647de243d5 02-Sep-2015 Vladimir Marko <vmarko@google.com> Optimizing: Tag basic block allocations with their source.

Replace GrowableArray with ArenaVector in HBasicBlock and,
to track the source of allocations, assign one new and two
Quick's arena allocation types to these vectors. Rename
kArenaAllocSuccessor to kArenaAllocSuccessors.

Bug: 23736311
Change-Id: I984aef6e615ae2380a532f5c6726af21015f43f5
b5171ff4859104a1e314c3091b6bd4872ad7c2b2 24-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> BCE: don't assume a bounds check always gets a HArrayLength.

Deoptimizations may change it to a HPhi.

bug:22056703

(cherry picked from commit 8df886b9214802ad689316a1dedb00a6d102555c)

Change-Id: I8afcf88e3a12dbe4d87101e6a7cefb8b81e2bb96
574cce14025e153d87ec051926d331c5a39e5f92 24-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> BCE: Narrow instead of unconditionnaly overwrite the range.

bug:21862741

(cherry picked from commit a09ff9c11f07863ac57e6120a824f0d20dfaa284)

Change-Id: Ia8e903e09a7f9c2b8ef7cf3522f73f154534b81f
a09ff9c11f07863ac57e6120a824f0d20dfaa284 24-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> BCE: Narrow instead of unconditionnaly overwrite the range.

bug:21862741
Change-Id: Ic1c2d6fa64255623f87af33a297c459cc9080d3c
8df886b9214802ad689316a1dedb00a6d102555c 24-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> BCE: don't assume a bounds check always gets a HArrayLength.

Deoptimizations may change it to a HPhi.

bug:22056703
Change-Id: I8995209438764dac496ed856782b147ba21f93e5
7d4cc8c786ff4a19234c1b034eae61ac0f3a37da 21-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Fix wrong DCHECK in bounds check elimination.

The lower range of an array length instruction can
be changed by other instructions than HBoundsCheck,
like HNewArray.

bug:21862741

(cherry picked from commit 8d82a0c2b2b12f259ccb357d3b1e699c68ad0400)

Change-Id: I1bb1a4f4c6673509dd3fb5184c32992bed876250
8d82a0c2b2b12f259ccb357d3b1e699c68ad0400 21-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Fix wrong DCHECK in bounds check elimination.

The lower range of an array length instruction can
be changed by other instructions than HBoundsCheck,
like HNewArray.

bug:21862741
Change-Id: Idbe50ac114287ea6d852fb6fe9f9e2d440d18af5
38fad4648d08d63a96f1cd3d940d84102870aeb4 11-Jun-2015 Andreas Gampe <agampe@google.com> ART: Fix BCE lint issue

Bug: 21034044

(cherry picked from commit 45d68f138a31a3ff9b45cda313f0ba27f1431f26)

Change-Id: I7f382a3124955eff5c0b96ca39ec67fb658fa3d0
31fa4b57132a2352630b599b4da7e69f77376dcb 17-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Remove bogus DCHECK in BCE.

When creating a phi for the array length when we add HDeoptimization
nodes, we might update accesses in inner loops to use that phi instead
of the array length. The BCE phase was not expecting this case.

Bug: 21034044

(cherry picked from commit 3cde6227678cf62e06bca264671d1e957456ac3d)

Change-Id: I639f4ea6f5889726142041a42736183f162c7437
bca381a12965a98e3727e93986dd0a195db500a0 20-May-2015 Mingyao Yang <mingyao@google.com> Fix premature deoptimization if the loop body isn't entered.

Add a test between initial_ and end_ to see if the loop body is entered.
If the loop body isn't entered at all, we jump to the loop header. Loop header is
still executed and is going to test the condition again and loop body won't be
entered. This makes sure no deoptimization is triggered if the loop body isn't
even entered.

Bug: 21034044

(cherry picked from commit 3584bce5b1f45e5741d3a6ca24884a36320ecb6b)

Change-Id: I2b6de1f22fbc4568ca419f76382ebd87806d9694
3cde6227678cf62e06bca264671d1e957456ac3d 17-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Remove bogus DCHECK in BCE.

When creating a phi for the array length when we add HDeoptimization
nodes, we might update accesses in inner loops to use that phi instead
of the array length. The BCE phase was not expecting this case.

Change-Id: I639f4ea6f5889726142041a42736183f162c7437
45d68f138a31a3ff9b45cda313f0ba27f1431f26 11-Jun-2015 Andreas Gampe <agampe@google.com> ART: Fix BCE lint issue

Change-Id: I7f382a3124955eff5c0b96ca39ec67fb658fa3d0
3584bce5b1f45e5741d3a6ca24884a36320ecb6b 20-May-2015 Mingyao Yang <mingyao@google.com> Fix premature deoptimization if the loop body isn't entered.

Add a test between initial_ and end_ to see if the loop body is entered.
If the loop body isn't entered at all, we jump to the loop header. Loop header is
still executed and is going to test the condition again and loop body won't be
entered. This makes sure no deoptimization is triggered if the loop body isn't
even entered.

Bug: 21034044
Change-Id: I2b6de1f22fbc4568ca419f76382ebd87806d9694
db216f4d49ea1561a74261c29f1264952232728a 05-May-2015 Nicolas Geoffray <ngeoffray@google.com> Relax the only one back-edge restriction.

The rule is in the way for better register allocation, as
it creates an artificial join point between multiple paths.

Change-Id: Ia4392890f95bcea56d143138f28ddce6c572ad58
9d750efd66ae7f4b790af3c1ff8de972bbe826d9 27-Apr-2015 Mingyao Yang <mingyao@google.com> BCE: don't add deoptimization if the loop has early exit.

Also make the way to detect loop_body_successor to be
more accurate.

Change-Id: I29680f93396383c478a8f40ad28735e4f3f07c1b
206d6fd6cae5ba8c4d5f0e230111fe77b9d5c0a5 14-Apr-2015 Mingyao Yang <mingyao@google.com> Deoptimization-based BCE for unknown loop bounds.

For loop like:
for (int i = start; i < end; i++) {
array[i] = 1;
}
We add the following to the loop pre-header:
if (start < 0) deoptimize();
if (end > array.length) deoptimize();
Then we can eliminate bounds-check of array[i] inside the loop.

We also take care of indexing with induction variable plus some offsets,
like array[i - 1]/array[i + 1] inside the loop, and adjust the condition
for deoptimization accordingly.

Change-Id: I9e24c6b5e134ff95eff5b5605ff8f95d6546616f
1152c926076a760490085c4497c3f117fa8da891 24-Apr-2015 Mark Mendell <mark.p.mendell@intel.com> [optimizing] Rename HasArrayAccesses and check it

Since the flag is only used to see if there is a HBoundsCheck, rename
HasArrayAccesses() to HasBoundsChecks().

Add a check in graph_checker to see that the flag is set if we see a
HBoundsCheck instruction.

Change-Id: I10fe92897374fb247082152dd75c3611cc40ff30
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
65b798ea10dd716c1bb3dda029f9bf255435af72 06-Apr-2015 Andreas Gampe <agampe@google.com> ART: Enable more Clang warnings

Change-Id: Ie6aba02f4223b1de02530e1515c63505f37e184c
3dcd58cd54a922b864494fb7fff4a7f7a8562db9 03-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Fix a bug when creating a HDeoptimization instruction.

We need to copy the environment, instead of just pointing
to an existing one. Otherwise, if the instruction that initially
holds the environemnt gets removed from the graph, any update
to an instruction in that environment will not be reflected in it.

bug:20058506

Change-Id: I2a62476d0851ecbc3707c0da395d8502ee437422
d43b3ac88cd46b8815890188c9c2b9a3f1564648 01-Apr-2015 Mingyao Yang <mingyao@google.com> Revert "Revert "Deoptimization-based bce.""

This reverts commit 0ba627337274ccfb8c9cb9bf23fffb1e1b9d1430.

Change-Id: I1ca10d15bbb49897a0cf541ab160431ec180a006
0ba627337274ccfb8c9cb9bf23fffb1e1b9d1430 24-Mar-2015 Andreas Gampe <agampe@google.com> Revert "Deoptimization-based bce."

This breaks compiling the core image:

Error after BCE: art::SSAChecker: Instruction 219 in block 1 does not dominate use 221 in block 1.

This reverts commit e295e6ec5beaea31be5d7d3c996cd8cfa2053129.

Change-Id: Ieeb48797d451836ed506ccb940872f1443942e4e
e295e6ec5beaea31be5d7d3c996cd8cfa2053129 07-Mar-2015 Mingyao Yang <mingyao@google.com> 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
e4335eb5bcbca6927e51c10cf0de3516d94ef599 03-Mar-2015 Mingyao Yang <mingyao@google.com> Make BCE a no-op if there is no array access.

Change-Id: I8456182808c1dbaa0c0ae1b8c2e94bb17baf5f29
94e917219bae3de865aab36e556a44d242e6cd77 03-Mar-2015 Brian Carlstrom <bdc@google.com> Fix build lint issue.

Change-Id: I53d5bdefdf79b376f99dfaa17591a0d2103921d5
4559f000b323b64e4bd179b72cfb788b30b25b23 27-Feb-2015 Mingyao Yang <mingyao@google.com> bce: handle a pattern for circular buffer

Change-Id: Ie54bdd7c044af58deea0d0addaaa8186cabf3532
57e04754d5b7fb3cc99d6b9f70da73cf4c65b416 10-Feb-2015 Mingyao Yang <mingyao@google.com> bce: add support to narrow two MonotonicValueRange's at the same time.

Change-Id: I545da4f375619ce47e01bb5aa5c8b1a4a9d1df41
8c8bad89ff367712a6f5bbf3a5836cd398391067 10-Feb-2015 Mingyao Yang <mingyao@google.com> More checker tests for BCE.

Also make sure the check on MonotonicValueRange narrow is more strict.
Plus some handling on array length division such as array.length/2.
Added checker tests for each case.

Change-Id: I9f32fc5f6ca1f3da8edec576de66b44d85a50bc6
b666f4805c8ae707ea6fd7f6c7f375e0b000dba8 18-Feb-2015 Mathieu Chartier <mathieuc@google.com> Move arenas into runtime

Moved arena pool into the runtime.

Motivation:
Allow GC to use arena allocators, recycle arena pool for linear alloc.

Bug: 19264997
Change-Id: I8ddbb6d55ee923a980b28fb656c758c5d7697c2f
0304e182adee81be32c744fd3c0d28add29974ff 31-Jan-2015 Mingyao Yang <mingyao@google.com> Improve bce so that more bounds checks can be eliminated.

For pattern like "int[] array = new int[size+1]", we record this range
for size:
[-1, array.length-1]
This can eliminate more bounds checks.

Also simplify overflow/underflow handling and make it more solid.

Enhance instruction simplifier such that if array is a result of
NewArray with a constant size, replace array.length with that constant.

Plan to move all bce gtests to checker in another change.

Change-Id: Ibe7cc7940b68fb6465dc3e0ff3ebdb0fd6487aa9
6419752e81177670756becbd9c5438323a75818d 06-Dec-2014 Mingyao Yang <mingyao@google.com> Some enhancements on BCE.

1) Better format detection when creating ValueBound.
2) Some code cleanup on returning bool for overflow_or_underflow.

Change-Id: I03e8bd0d756652da021ccb5b2a62075648d39cc2
0418b5b20587c645b6bf9d8cb65d3d6a9f074d96 05-Dec-2014 Andreas Gampe <agampe@google.com> ART: Fix linting errors

Fix bounds_check_elimination linting errors.

Change-Id: I040433ecbc84d740bff331c37df0bfcc64dc244e
f384f88d4d1e89df82f47fbc7245a8acc9c2d49c 23-Oct-2014 Mingyao Yang <mingyao@google.com> Bounds check elimination.

Change-Id: Ia0d6a4226c1f9f1ff1dd35347a38db1dc4265319