History log of /art/compiler/optimizing/reference_type_propagation.cc
Revision Date Author Comments
f7d994622aabcc689f62253a9253e0c67d9e787e 10-Jun-2016 Nicolas Geoffray <ngeoffray@google.com> Remove too aggressive DCHECKs.

A class can move from a state greater or equal than resolved
to erroneous concurrently to the verifier or the compiler.

bug:29239283
Change-Id: I89f3fe1c1d9556c6c99b8e005b3ec02de7f01b85
e1dfa0c120c8aaa3794d9712e37231b4295d7c46 01-Jun-2016 Nicolas Geoffray <ngeoffray@google.com> Fix a bug in reference type propagation.

The upper bound of a bound type is always exact, so we should
not use it for setting the type of the bound type.

bug:28730986

(cherry picked from commit a90d489ab101891bbac7276b8748125e6b4fa0c2)

Change-Id: Ia3e9f88a274730be39e5c9b147204eec2a145de2
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
d1d7c40c8004303d1131ebb1956fd0ade54f8404 25-Apr-2016 Aart Bik <ajcbik@google.com> Test component type for errors too.
With regression test.

Rationale:
Moved erroneous check in convenience method, so we
put all the same logic in one place. When testing
for erroneous T[], check both the array type
as well at the component type T for errors
(it is possible T[] is not marked erroneous
even though T is eventually).

BUG=28358598

(cherry picked from commit f417ff44d1eb111854d7a213f106912b3dd9e3d4)

Change-Id: Ieba66aa4b55d8e7ebddf200239c7e4095dfd4678
a4336d253b88f95c49891a8084579a4599785e90 19-Apr-2016 Vladimir Marko <vmarko@google.com> Use dex cache from compilation unit in RTP.

Avoid calling the costly ClassLinker::FindDexCache() from
reference type propagation when the dex cache from the
compilation unit will do, i.e. almost always. Compiling
the Nexus 5 boot image on host under perf(1) shows that
the FindDexCache() hits drop from about 0.2% to almost
nothing, though enabling inlining for the boot image will
increase it a bit to 0.03% due to unavoidable calls from
the inliner.

Also clean up the ScopedObjectAccess usage a bit.

Bug: 28173563

Cherry-picked the "revert-revert"
(cherry picked from commit 456307a47336e3d6576ed6d8563b67573a4238d3)
and squashed two subsequent fixes
Fix RTP to hold mutator lock while using raw mirror pointers.
(cherry picked from commit 62977ff198deb673a6990202a2fb8b993217c57c)
Fix reference_type_propagation_test.
(cherry picked from commit 5eed0c5d27f091c952704f652cd77c4e3833ad88)

Change-Id: Ia944452d7ab26aed963832a9346df363743a419f
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
7de2439d357710aaf8bfe02b8cf9c196d3c77705 06-Apr-2016 Aart Bik <ajcbik@google.com> Avoid constructing types with errors.

BUG=27626735

Rationale:
Do not construct classes with a link error. Without this,
the error type thought it was Object (mirror's method
IsObjectClass() returns true if there is no superclass).

(cherry picked from commit 8b3f9b246d5bdbf67faeb2b872b75b8d72777bc0)
(also contains follow-up commit 31244b4cde9156632a08103a8bf1cbff4cbae3cc)

Change-Id: I4443779dda47c320115975c1c71b22e118bd8252
1a65388f1d86bb232c2e44fecb44cebe13105d2e 18-Mar-2016 Roland Levillain <rpl@google.com> Clean up art::HConstant predicates.

- Make the difference between arithmetic zero and zero-bit
pattern non ambiguous.
- Introduce Boolean predicates in art::HIntConstant for when
they are used as Booleans.
- Introduce aritmetic positive and negative zero predicates
for floating-point constants.

Bug: 27639313
Change-Id: Ia04ecc6f6aa7450136028c5362ed429760c883bd
18401b748a3180f52e42547ede22d1b184fe8c43 11-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Fix invariant in reference type propagation.

Also some cleanups.

Change-Id: I7f0ec7d06b4bab10dbfa230c757447d311658f93
d9994f069dfeaa32ba929ca78816b5b83e2a4134 11-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Re-enable OSR.

Fixes two bugs:
- Dealing with proxy methods, which the compiler and code cache
does not handle.
- Dealing with phi types, that may have been speculatively optimized
but do not hold once jumping to the compiled code.

Change-Id: I7dcd9976ef7b12128fff95d2b7ed3e69cc42e90a
be10e8e99a78caae01fb65769218800d465144ae 22-Jan-2016 Vladimir Marko <vmarko@google.com> Optimizing: Try pattern substitution when we cannot inline.

Change-Id: I7c01f4494bac8498accc0f087044ec509fee4c98
7d1fbf38412078090e81e9d9fa502635d8541707 26-Jan-2016 Vladimir Marko <vmarko@google.com> Optimizing: Lazy creation of Handle<>s in RTP.

This reduces the number of StackHandleScope<>s that we
allocate, especially when we're inlining many methods.
Previously, each RTP would create 4 handles in the ctor
which is actually the same as kNumReferencesPerScope.

Change-Id: Ib6767993b1e89913a91275f0ef66dac786bccb6c
6de1938e562b0d06e462512dd806166e754035ea 08-Jan-2016 David Brazdil <dbrazdil@google.com> ART: Remove incorrect HFakeString optimization

Simplification of HFakeString assumes that it cannot be used until
String.<init> is called which is not true and causes different
behaviour between the compiler and the interpreter. This patch
removes the optimization together with the HFakeString instruction.

Instead, HNewInstance is generated and an empty String allocated
until it is replaced with the result of the StringFactory call. This
is consistent with the behaviour of the interpreter but is too
conservative. A follow-up CL will attempt to optimize out the initial
allocation when possible.

Bug: 26457745
Bug: 26486014

Change-Id: I7139e37ed00a880715bfc234896a930fde670c44
744a1c687fb92050828e188838b0ce5e0474f94a 28-Dec-2015 David Brazdil <dbrazdil@google.com> ART: Don't set initial RTI for BoundType if input untyped

ReferenceTypePropagation will create a BoundType with upper bound
[Object, inexact, not null] for each if-not-null branch. The logic
setting its initial RTI will, however, set it straight to Object if
the input is untyped (loop phi or its derivate). This patch changes
the logic to leave the BoundType untyped and set it during fix-point
iteration.

Bug: 26330326
Change-Id: Ic492e2179a4c51f577908e60fbcf70d728b98a6f
f555258861aea7df8af9c2241ab761227fd2f66a 27-Dec-2015 David Brazdil <dbrazdil@google.com> ART: Create BoundType for CheckCast early

ReferenceTypePropagation creates a BoundType for each CheckCast and
replaces all dominated uses of the casted object with it. This does
not include Phi uses on the boundary of the dominated scope, reducing
typing precision. This patch creates the BoundType in Builder, causing
SsaBuilder to replace uses of the object automatically.

Bug: 26081304

Change-Id: I083979155cccb348071ff58cb9060a896ed7d2ac
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
f5f64efda943000168d34bfe44ccbbadd284e55f 15-Dec-2015 Nicolas Geoffray <ngeoffray@google.com> Detect phi cycles.

Having reference and non-reference phi equivalent, only happened
for the 0/null constant. To avoid such occurences, we must
detect phi cycles.

bug:25493693

Change-Id: Ie1a8460c3abacca96c299da107fa4407e17dd792
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
42ef8ab151a3d0cbb42cb43f6841c3708d65fca3 04-Dec-2015 Andreas Gampe <agampe@google.com> ART: Stash a resolved method late in the verifier

Invoke-interface should only be called on an interface method.
We cannot move the check earlier, as there are other checks
that must be done that can fail a class hard. So postpone
a push to the dex cache.

Clean up the test a bit.

Also templatize ResolveMethod with a version always checking
the invoke type, and on a cache miss check whether type target
type is an interface when an interface invoke type was given.

Bug: 21869691
Change-Id: I94cbb23339cbbb3cb6be9995775e4dcefacce7fd
c96205e03bd4f991ad1540df38f9f692ef211b22 10-Dec-2015 Andreas Gampe <agampe@google.com> Revert "ART: Check invoke-interface earlier in verifier"

This reverts commit dae24142127c64551142a50423085aabdb0a6060.

It is important to check the name of the method being called.

Bug: 21869691
dae24142127c64551142a50423085aabdb0a6060 04-Dec-2015 Andreas Gampe <agampe@google.com> ART: Check invoke-interface earlier in verifier

Invoke-interface should only be called on an interface method.
Move the check earlier, as otherwise we'll try to resolve and
potentially inject a method into the dex cache.

Also templatize ResolveMethod with a version always checking
the invoke type, and on a cache miss check whether type target
type is an interface when an interface invoke type was given.

Bug: 21869691
Change-Id: Ica27158f675b5aa223d9229248189612f4706832
fe86070bcbe938a5c8dec02b5a7d5efb632deed1 02-Dec-2015 David Brazdil <dbrazdil@google.com> Revert "Revert "ART: Do not eagerly type LoopPhi [null, ...]""

Fixes one more place where RTP expected the parent to have valid RTI.

This reverts commit 5f3fb18e9705f7d0d594f665858bff2020409c6a.

Bug: 25899441
Change-Id: I65c55a81617ffb82c2de2470eda562600b10d479
5f3fb18e9705f7d0d594f665858bff2020409c6a 02-Dec-2015 David Brazdil <dbrazdil@google.com> Revert "ART: Do not eagerly type LoopPhi [null, ...]"

Breaks some libcore tests. Revert to unblock others while investigating.

This reverts commit 3a738bfe9784b9ea0f2fccbe75f0c72ede536641.

Change-Id: I9f103c692199b8f9b6e7af469fc424512b57544a
3a738bfe9784b9ea0f2fccbe75f0c72ede536641 30-Nov-2015 David Brazdil <dbrazdil@google.com> ART: Do not eagerly type LoopPhi [null, ...]

ReferenceTypePropagation would eagerly set the type of each loop phi
to the type of the first input prior to beginning the fix-point
iteration. While this does make the algorithm converge faster, it
should not be applied when the first input is a NullConstant becuase
that sets the type of the phi and all dependent instructions to Object.

Bug: 25899441
Change-Id: Iff1ed26a63fe4332eaf88d9ca171e287f10ba1a6
52503d83d057c66ea50eed491290e267b80e1fd3 11-Nov-2015 Calin Juravle <calin@google.com> Implement common super type in reference type propagation.

Currently only if both types are classes.

Change-Id: I06e98211ead56875a42bd17f099e319b107a50d4
617bd9255bbdb9890e9d80462d293b94ba41c1f2 11-Nov-2015 Calin Juravle <calin@google.com> Ignore NullConstants when computing the type for Phis.

NullConstants are always typed as Object and they widen the
type of Phis unnecessarily.

Change-Id: I2b29e67617a22120642cb23d2bc6c1ff75b4e7c2
cdfed3dc422d0e1a9a0a948863308e58c39d01ba 26-Oct-2015 Calin Juravle <calin@google.com> Revert "Revert "Run type propagation after inliner only when needed.""

This reverts commit 271743601650308c7ac5c7a3ec35025d8130a298.

Change-Id: I173e27a0a4d7d54f90ca459eb48d280d1d40ab70
c89715ccaf4c8a8ce298ce2c0c1da479de4c63e7 28-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Do not assume the dex cache is already populated.

In JIT mode, it isn't.

Change-Id: I665cab8142db64996b6ae3d7d7c1e68deba8dfb9
271743601650308c7ac5c7a3ec35025d8130a298 26-Oct-2015 Calin Juravle <calin@google.com> Revert "Run type propagation after inliner only when needed."

This reverts commit 4e5dd521063beae1706410419f19c7e224db50fe.

Change-Id: I0de261d14dd3f71abe05f9bc71744820cf23b937
4e5dd521063beae1706410419f19c7e224db50fe 19-Oct-2015 Calin Juravle <calin@google.com> Run type propagation after inliner only when needed.

Currently we run a type propagation pass unconditionally after the
inliner. This change looks at the returned value (if any) and runs a
minimal type propagation only if its type has changed.

Change-Id: I0dd72bd481219081e8a978d2632426afc980d73a
54d8f4bc810e7e0767f44cb77e5706a232b644bb 16-Oct-2015 Calin Juravle <calin@google.com> Fix in reference type propagation

We miss updating the type of objects if their nullability gets updated
first.

Bug: 25008765
(cherry picked from commit 83853392e26b2aa48328bb90c9f9c57b32c280dc)

Change-Id: I81aa759d96008251d74f941494abe74aa4b52bdc
12617599757b625bd59e6c62e022c30735073622 16-Oct-2015 Calin Juravle <calin@google.com> Fix in reference type propagation

We miss updating the type of objects if their nullability gets updated
first.

Bug: 25008765
Change-Id: Id1a753d7d5b7b0d5ed708c325bd00a36240925fb
e6e3beaf2d35d18a79f5e7b60a21e75fac9fd15d 14-Oct-2015 Calin Juravle <calin@google.com> Revert "Revert "optimizing: propagate type information of arguments""

This reverts commit 89c0d32437011bbe492fe14c766cd707046ce043.

Change-Id: I603a49794e155cc97410b8836c8ea425bfdc98eb
c05aca78fad20901ae17902a3671ccfca9071758 13-Oct-2015 Calin Juravle <calin@google.com> Revert "optimizing: propagate type information of arguments"

This reverts commit 2c1ffc3a06e9ed0411e29e7dc2558b5d657ede7a.

Change-Id: I3291070c373e661fa578f5a38becbb5a502baf94
2c1ffc3a06e9ed0411e29e7dc2558b5d657ede7a 12-Oct-2015 Calin Juravle <calin@google.com> optimizing: propagate type information of arguments

This helps inlining and type check elimination.

e.g:

void foo(ArrayList a) {
int size = a.size(); // this can be inlined now.
}

Change-Id: I3ffeaa79d9df444aa19511c83c544cb5f9d9ab20
98893e146b0ff0e1fd1d7c29252f1d1e75a163f2 02-Oct-2015 Calin Juravle <calin@google.com> Add support for unresolved classes in optimizing.

Change-Id: I0e299a81e560eb9cb0737ec46125dffc99333b54
e460d1df1f789c7c8bb97024a8efbd713ac175e9 29-Sep-2015 Calin Juravle <calin@google.com> Revert "Revert "Support unresolved fields in optimizing"

The CL also changes the calling convetion for 64bit static field set
to use kArg2 instead of kArg1. This allows optimizing to keep
the asumptions:
- arm pairs are always of form (even_reg, odd_reg)
- ecx_edx is not used as a register on x86.

This reverts commit e6f49b47b6a4dc9c7684e4483757872cfc7ff1a1.

Change-Id: I93159917565824084abc96775f31be1a4249f2f3
2aaa4b5532d30c4e65d8892b556400bb61f9dc8c 17-Sep-2015 Vladimir Marko <vmarko@google.com> Optimizing: Tag more arena allocations.

Replace GrowableArray with ArenaVector and tag arena
allocations with new allocation types.

As part of this, make the register allocator a bit more
efficient, doing bulk insert/erase. Some loops are now
O(n) instead of O(n^2).

Change-Id: Ifac0871ffb34b121cc0447801a2d07eefd308c14
e6f49b47b6a4dc9c7684e4483757872cfc7ff1a1 17-Sep-2015 Calin Juravle <calin@google.com> Revert "Support unresolved fields in optimizing"
breaks debuggable tests.

This reverts commit 23a8e35481face09183a24b9d11e505597c75ebb.

Change-Id: I8e60b5c8f48525975f25d19e5e8066c1c94bd2e5
23a8e35481face09183a24b9d11e505597c75ebb 08-Sep-2015 Calin Juravle <calin@google.com> Support unresolved fields in optimizing

Change-Id: I9941fa5fcb6ef0a7a253c7a0b479a44a0210aad4
baf89b8f2591df93686df545bc6ccc6eb3b128cc 15-Sep-2015 David Brazdil <dbrazdil@google.com> ART: Fix bug in reference type propagation

Reference type propagation assumed that type is exact if the class is
final. This does not hold for arrays which are always final and the
component type needs to be considered.

Bug: 24084144
Change-Id: Ib72e12a018437c404e82f7ad414554c66a4c6f8c
736b560f2d2c89b63dc895888c671b5519afa4c8 02-Sep-2015 Mathieu Chartier <mathieuc@google.com> Reduce how often we call FindDexCache

Before host boot.oat -j4 optimizing compile:
real 1m17.792s
user 3m26.140s
sys 0m8.340s

After:
real 1m12.324s
user 3m22.718s
sys 0m8.320s

Change-Id: If18e9e79e06cdf1676692e5efacb682bf93889c3
05792b98980741111b4d0a24d68cff2a8e070a3a 03-Aug-2015 Vladimir Marko <vmarko@google.com> ART: Move DexCache arrays to native.

This CL has a companion CL in libcore/
https://android-review.googlesource.com/162985

Change-Id: Icbc9e20ad1b565e603195b12714762bb446515fa
673ed3d8aedc5462a47ded827c99f35d46525457 28-Aug-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Change dex caches to be weak roots""

This reverts commit 81a9087f0df0518c39405b7d18ba5858a6d8b77b.

Boot.oat creation time goes from 4.7s to 4.9s on host due to extra
locking. Will try to improve this in another CL.

Bug: 23602225
Bug: 22720414

Change-Id: I7e25b75cfb63faa196c7b0f60e46cce50bf12021
9393c69c2c6b63b6c8ec36327273ca40d3e45e6c 28-Aug-2015 Andreas Gampe <agampe@google.com> ART: Add mising ScopedObjectAccess in ref type propagation

Adding handles requires the mutator lock. Annotalysis doesn't help,
as constructors aren't checked.

Bug: 23468617
Change-Id: I79510d105580dacdec965a5b1693c390fdff275a
81a9087f0df0518c39405b7d18ba5858a6d8b77b 28-Aug-2015 Brian Carlstrom <bdc@google.com> Revert "Change dex caches to be weak roots"

This reverts commit 3ae6b1d42523bb2a0ddb5edff1aaf05b592f28f4.
3ae6b1d42523bb2a0ddb5edff1aaf05b592f28f4 14-Aug-2015 Mathieu Chartier <mathieuc@google.com> Change dex caches to be weak roots

Changed dex caches to be weak roots. This is necessary for class
unloading since the resolved types arrays would keep classes live
when they should be unloaded. Currently the dex caches still don't
get freed due to the class loader roots.

Also deleted some unused functionality in image writer.

Bug: 22720414
Change-Id: If22cb3cad7e3baabc8158a77d7f20799faf4c341
b4edcf357c823f32ddc8f529f111710c7d7c90b1 20-Aug-2015 David Brazdil <dbrazdil@google.com> Fix indentation in reference type propagation

Change-Id: I5860c4fef55326ac2b510e3e34c4541b691794e0
e418dda75998e0186f7580c2c54705767c3c8f1f 12-Aug-2015 Nicolas Geoffray <ngeoffray@google.com> Be more flexible on the code unit size when inlining.

This change increases the maximum code unit size, and fold
parameters in the inlinee in the hope to reduce the overall
size of the graph. We then make sure we don't inline methods
that have more than N HInstructions.

Also, remove the kAccDontInline flag on ArtMethod. The compiler
does not need it anymore.

Change-Id: I4cd3da40e551f30ba83b8b274728b87e67f6812e
bbd733e4ef277eff19bf9a6601032da081e9b68f 18-Aug-2015 David Brazdil <dbrazdil@google.com> ART: Enable basic optimizations for try/catch

Generating code for try/catch methods requires having run at least the
instruction simplifier to remove redundant suspend checks. This patch
enables the first group of optimizations when try/catch is present.

Enabled optimizations:
1) IntrinsicsRecognizer
Does not modify the graph, only sets HInvoke::intrinsic_.

2) ConstantFolding
Does not deal with throwing instructions.

3) InstructionSimplifier
May remove a throwing instruction (e.g. LoadClass in VisitCheckCast),
or may turn a throwing instruction into a non-throwing one (ArraySet).
Their corresponding catch phi inputs are not removed but correctness
is preserved.

4) ReferenceTypePropagation
Does not modify the graph, only sets type properties. Typing of
LoadException from catch handler information was added.

5) DeadCodeElimination
Removing individual instructions is fine (same as 3). Removal of dead
blocks was disabled for try/catch.

Change-Id: I2722c3229eb8aaf326391e07f522dbf5186774b8
efa8468c78fdd808043dfb664b56541f3f2dd0e8 13-Aug-2015 Nicolas Geoffray <ngeoffray@google.com> Small optimization improvements.

- Tune CanBeNull for HBoundType.
- Remove LoadClass when we know the class is loaded.
- Tune CanBeNull for StringInit.

Change-Id: I564ed33a506d65e991a514342bdfd1610bed0cf5
51d135f71a8aeb6409dc8ca91585c77f3d66dfc3 29-Jul-2015 Calin Juravle <calin@google.com> Take into account that we might end up with unresolved classes.

bug:22821472
Change-Id: I615ab0b41c8cadae9f327e07dcff71755f7146c2
2e76830f0b3f23825677436c0633714402715099 28-Jul-2015 Calin Juravle <calin@google.com> Revert "Revert "Revert "Revert "Use the object class as top in reference type propagation""""

This reverts commit b734808d0c93af98ec4e3539fdb0a8c0787263b0.

Change-Id: Ifd925f166761bcb9be2268ff0fc9fa3a72f00c6f
a5ae3c3f468ffe3a317b498d7fde1f8e9325346a 28-Jul-2015 Calin Juravle <calin@google.com> Revert "Revert "Revert "Revert "Fixes and improvements in ReferenceTypePropagation""""

This reverts commit e344a8070d4549d513413c06767abf8a2c5e9709.

Change-Id: I400fab0e02ce3c11376cc1f3ae9c7cf2c82ffcc1
e344a8070d4549d513413c06767abf8a2c5e9709 28-Jul-2015 Calin Juravle <calin@google.com> Revert "Revert "Revert "Fixes and improvements in ReferenceTypePropagation"""

This reverts commit 00e3b38be4b280d6d7a7e843cd336ffbd2ba4365.

Change-Id: I4dbadb2d7312a410f1c56283f063dd82156cf702
b734808d0c93af98ec4e3539fdb0a8c0787263b0 28-Jul-2015 Calin Juravle <calin@google.com> Revert "Revert "Revert "Use the object class as top in reference type propagation"""

This reverts commit 80caa1478cf3df4eac1214d8a63a4da6f4fe622b.

Change-Id: I63b51ca418b19b2bfb5ede3f8444f8fbeb8a339d
80caa1478cf3df4eac1214d8a63a4da6f4fe622b 16-Jul-2015 Calin Juravle <calin@google.com> Revert "Revert "Use the object class as top in reference type propagation""

This reverts commit 7733bd644ac71f86d4b30a319624b23343882e53.

Change-Id: I7d393a808c01c084c18d632a54e0554b4b455f2c
00e3b38be4b280d6d7a7e843cd336ffbd2ba4365 15-Jul-2015 Calin Juravle <calin@google.com> Revert "Revert "Fixes and improvements in ReferenceTypePropagation""

This reverts commit 9b0096ba77e7e61bc2dcbbf954831dcae54a6c27.

Change-Id: I824f16e800ca32e646577d5e1e0d593887ccead1
7733bd644ac71f86d4b30a319624b23343882e53 22-Jul-2015 Calin Juravle <calin@google.com> Revert "Use the object class as top in reference type propagation"

This reverts commit 3fabec7a25d151b26ba7de13615bbead0dd615a6.

Change-Id: Id8614f6b6e3e0e4c9caeb9f771e4c145d9fec64f
9b0096ba77e7e61bc2dcbbf954831dcae54a6c27 22-Jul-2015 Calin Juravle <calin@google.com> Revert "Fixes and improvements in ReferenceTypePropagation"

This reverts commit b0d5fc0ac139da4aaa1440263416b9bde05630b0.

Change-Id: Iea8adfc0bd4cb7ee2b292278b8bac80a259acbd1
3fabec7a25d151b26ba7de13615bbead0dd615a6 16-Jul-2015 Calin Juravle <calin@google.com> Use the object class as top in reference type propagation

This properly types all instructions, making it safe to query the type
at any time.

This also moves a few functions from class.h to class-inl.h to please
gcc linker when compiling for target.

Change-Id: I6b7ce965c10834c994b95529ab65a548515b4406
b0d5fc0ac139da4aaa1440263416b9bde05630b0 15-Jul-2015 Calin Juravle <calin@google.com> Fixes and improvements in ReferenceTypePropagation

- Bound object types after a CheckCast. This increases the precision of
(inlining) generic operations.
- Make sure that the BoundType is exact when the class is final.
- Make sure that we don't duplicate BoundTypes when we run the analysis
more than once.

Change-Id: Ic22b610766fae101f942c0d753ddcac32ac1844a
beba9302bec33d72beb582970bf23d056f62641f 08-Jul-2015 Calin Juravle <calin@google.com> Revert "Use the object class as top in reference type propagation"

failing on the build bot on some targets but not locally. needs more investigation.

This reverts commit 20e6071362b84a9782b633a893c29ebde458205e.

Change-Id: I6965483f569fb862f9bdb66d459b747ded54de71
20e6071362b84a9782b633a893c29ebde458205e 01-Jul-2015 Calin Juravle <calin@google.com> Use the object class as top in reference type propagation

This properly types all instructions, making it safe to query the type
at any time.

Change-Id: I3ee2f0f79253cdf45b10ddab37ecb473345ca53a
7d5ea03b2a7d886325b3ad97942038c2336aa855 02-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Do not create a HBoundType when the instruction is non-null.

We don't need to refine the type after a null check, if the
instruction is known non null or null. As a side effect, this
avoids replacing HLoadClass instructions with HBoundType instructions.

bug:22116987

(cherry picked from commit 3abd437507f8ba30a238a52c273c9944dcb9d5a1)

Change-Id: I5e56de293554534195ade9770b7d1e4b078d685b
3abd437507f8ba30a238a52c273c9944dcb9d5a1 02-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Do not create a HBoundType when the instruction is non-null.

We don't need to refine the type after a null check, if the
instruction is known non null or null. As a side effect, this
avoids replacing HLoadClass instructions with HBoundType instructions.

bug:22116987

Change-Id: I565ae95db5a64faec30e026674636e398e0bf445
b7a4790e5a2884e62f6dc85aca1455b145e2a7db 29-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Do not update the type of something we already know.""

This reverts commit 63107a804ce17db9789051e1fe310d99d1dae1cb.

bug:22116987

(cherry picked from commit f9a199571417b5a5a62d94d05a064077e14dd2c4)

Change-Id: Ia516f2cbce6d22df37f3a0854abdd0b54d3ea72d
f9a199571417b5a5a62d94d05a064077e14dd2c4 29-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Do not update the type of something we already know.""

This reverts commit 63107a804ce17db9789051e1fe310d99d1dae1cb.

bug:22116987
Change-Id: I49a376a5bd2073a69babe122ec0d26e5d2f82461
63107a804ce17db9789051e1fe310d99d1dae1cb 29-Jun-2015 Calin Juravle <calin@google.com> Revert "Do not update the type of something we already know."

This reverts commit 30eb58c548bee08468f68eb140a74a51dd7d9b43.

Change-Id: Icd959e868160fc3ee7031dd2927554ac5b21d40f
30eb58c548bee08468f68eb140a74a51dd7d9b43 29-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Do not update the type of something we already know.

This is both an optimization to avoid unneeded nodes,
and correctness to avoid replacing the second input
of `HInstanceOf` and `HCheckCast` to something that is
not `HLoadClass`.

bug:22116987

Change-Id: I4907197a9002883d7cae8265a9642512b6201396
183617ac004d57dfd82b4d047b10c89e3ed072c1 18-Jun-2015 Calin Juravle <calin@google.com> Fix in ReferenceTypePropagation

Take into account that we might not be able to resolve the method when
we visit the invoke, or the field when we visit a field-access.

Bug: 21914925
Change-Id: Ie4bcfeddaa78780d8cfe28e77d1135ee219a15ad
72a5eb5d6784b318750c36e0da25c7338557ce44 02-Jun-2015 Guillaume "Vermeille" Sanchez <guillaumesa@google.com> Bring ReferenceTypePropagation to ArrayGet

Change-Id: I602b494c4e18bd78313ce9711ff363c31570a57c
ae09d2d244cf2f506822b3e14731b81c3b278f9d 29-May-2015 Guillaume "Vermeille" Sanchez <guillaumesa@google.com> Bring ReferenceTypePropagation to HInvoke return types

Change-Id: Id0683f67e32874713a30c072c71dc537b1271926
6c0c4f230f417ed484bae5c01b79551af7659389 12-Jun-2015 Calin Juravle <calin@google.com> Revert "Revert "Revert "Bring ReferenceTypePropagation to HInvoke return types"""

This reverts commit a981f9d5cac9a479d3b5d16508d71cfe17d95117.

Change-Id: I69faf16d5ef0ecc234fb52e071b682e728a8bf97
a981f9d5cac9a479d3b5d16508d71cfe17d95117 12-Jun-2015 Calin Juravle <calin@google.com> Revert "Revert "Bring ReferenceTypePropagation to HInvoke return types""

This reverts commit 958857d0f9686770a3b1117166d5fa700b39704a.

Change-Id: I196ff2a4453489f0105efc54eee73a2a9321ac4e
958857d0f9686770a3b1117166d5fa700b39704a 12-Jun-2015 Calin Juravle <calin@google.com> Revert "Bring ReferenceTypePropagation to HInvoke return types"

We exceed stack frame size with Clang in art::OptimizingCompiler::CompileOptimized


This reverts commit ddedddcedaae78fc6aa29940fdb1fbe40bb05774.

Change-Id: I6f992dda228acb9cae2087d1e6c78f2afdf30050
ddedddcedaae78fc6aa29940fdb1fbe40bb05774 29-May-2015 Guillaume "Vermeille" Sanchez <guillaumesa@google.com> Bring ReferenceTypePropagation to HInvoke return types

Change-Id: I9a7e974787cb8ba75b86bd07e8a37c5fe99911c3
222862ceaeed48528020412ef4f7b1cdaecf8789 09-Jun-2015 Guillaume Sanchez <guillaumesa@google.com> Add optimizations for instanceof/checkcast.

The optimizations try to statically determine the outcome of the
type tests, replacing/removing the instructions when possible.

This required to fix the is_exact flag for ReferenceTypePropagation.

Change-Id: I6cea29b6c351d118b62060e8420333085e9383fb
6e4758615308bb525b6350c30468e33a2e1f2274 08-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Support for inlining virtual and interface calls."

Fails for some apps.

bug: 21674542

This reverts commit 1d5006c34d75758752bf3499892e3d5beb11d5dc.

Change-Id: Ia74b5e54d59f8ffe9992591324a12f71efb67af4
1d5006c34d75758752bf3499892e3d5beb11d5dc 03-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Support for inlining virtual and interface calls.

Also had to change the pass order to get reference type propagation
before the inliner.

Change-Id: I4bf3bbb2d17c7d9cab632cfdd96adad8368bdfea
3d21bdf8894e780d349c481e5c9e29fe1556051c 22-Apr-2015 Mathieu Chartier <mathieuc@google.com> Move mirror::ArtMethod to native

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS.
Some of the savings are from removal of virtual methods and direct
methods object arrays.

Bug: 19264997

(cherry picked from commit e401d146407d61eeb99f8d6176b2ac13c4df1e33)

Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d

Fix some ArtMethod related bugs

Added root visiting for runtime methods, not currently required
since the GcRoots in these methods are null.

Added missing GetInterfaceMethodIfProxy in GetMethodLine, fixes
--trace run-tests 005, 044.

Fixed optimizing compiler bug where we used a normal stack location
instead of double on ARM64, this fixes the debuggable tests.

TODO: Fix JDWP tests.

Bug: 19264997

Change-Id: I7c55f69c61d1b45351fd0dc7185ffe5efad82bd3

ART: Fix casts for 64-bit pointers on 32-bit compiler.

Bug: 19264997
Change-Id: Ief45cdd4bae5a43fc8bfdfa7cf744e2c57529457

Fix JDWP tests after ArtMethod change

Fixes Throwable::GetStackDepth for exception event detection after
internal stack trace representation change.

Adds missing ArtMethod::GetInterfaceMethodIfProxy call in case of
proxy method.

Bug: 19264997
Change-Id: I363e293796848c3ec491c963813f62d868da44d2

Fix accidental IMT and root marking regression

Was always using the conflict trampoline. Also included fix for
regression in GC time caused by extra roots. Most of the regression
was IMT.

Fixed bug in DumpGcPerformanceInfo where we would get SIGABRT due to
detached thread.

EvaluateAndApplyChanges:
From ~2500 -> ~1980
GC time: 8.2s -> 7.2s due to 1s less of MarkConcurrentRoots

Bug: 19264997
Change-Id: I4333e80a8268c2ed1284f87f25b9f113d4f2c7e0

Fix bogus image test assert

Previously we were comparing the size of the non moving space to
size of the image file.

Now we properly compare the size of the image space against the size
of the image file.

Bug: 19264997
Change-Id: I7359f1f73ae3df60c5147245935a24431c04808a

[MIPS64] Fix art_quick_invoke_stub argument offsets.

ArtMethod reference's size got bigger, so we need to move other args
and leave enough space for ArtMethod* and 'this' pointer.

This fixes mips64 boot.

Bug: 19264997
Change-Id: I47198d5f39a4caab30b3b77479d5eedaad5006ab
012a072d06474404ff488d181eb3d4a504c5cbe7 02-Jun-2015 Calin Juravle <calin@google.com> Revert "Revert "Revert "Bring ReferenceTypePropagation to HInvoke return types"""

This reverts commit 82cc909ff81cc25f7fe97ddac3a1a1f6dc9f5792.

Change-Id: If29dbe0dfd65998047c7ac4ef06c4789355b6bda
82cc909ff81cc25f7fe97ddac3a1a1f6dc9f5792 02-Jun-2015 Calin Juravle <calin@google.com> Revert "Revert "Bring ReferenceTypePropagation to HInvoke return types""

This reverts commit 8ccf8a0ce31083faa0d9c502f1f0f12a825f6c5d.

Change-Id: I729c147989e0e98d0739d7596b5bb41a72971624
8ccf8a0ce31083faa0d9c502f1f0f12a825f6c5d 02-Jun-2015 Calin Juravle <calin@google.com> Revert "Bring ReferenceTypePropagation to HInvoke return types"

This reverts commit 77e48c64e7c1c0084217b8df1b47ac6367e61cc7.

Change-Id: Ic6967b2ea7588862ac190e1c0555af615027b5b6
77e48c64e7c1c0084217b8df1b47ac6367e61cc7 29-May-2015 Guillaume "Vermeille" Sanchez <guillaumesa@google.com> Bring ReferenceTypePropagation to HInvoke return types

Change-Id: Ie8f6b0ea5bd841c9555f3b1b6d4b7dce92a117f1
e401d146407d61eeb99f8d6176b2ac13c4df1e33 22-Apr-2015 Mathieu Chartier <mathieuc@google.com> Move mirror::ArtMethod to native

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS.
Some of the savings are from removal of virtual methods and direct
methods object arrays.

Bug: 19264997
Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
104fd8a3f30ddcf07831250571aa2a233cd5c04d 20-May-2015 Guillaume "Vermeille" Sanchez <guillaumesa@google.com> Bring Reference Type Propagation to Instance/StaticInstanceField

For this, we need the field index in FieldInfo, hence the add of the field.

Change-Id: Id219bd826d8496acf3981307a8c42e2eb6ddb712
81d804a51d4fc415e1544a5a09505db049f4eda6 20-May-2015 Guillaume "Vermeille" Sanchez <guillaumesa@google.com> Bring Reference Type Propagation to NewArray

Change-Id: Ieff4f38854e06b0ed4b5689ced94a4289053d80d
d5111bf05fc0a9974280a80eeb43db6d5227a81e 22-May-2015 Nicolas Geoffray <ngeoffray@google.com> Do not use dex_compilation_unit after inlining.

It's incompatible with inlining, as inlined invokes/load class/new
can be from another dex file.

Change-Id: I8897b6a012942bc8e136f2bea70252d3fb3a7fa5
edad8add1f1216850cb3f179ba6f57b0d885b016 23-Apr-2015 Calin Juravle <calin@google.com> Remove ActAsNullConstant

We now properly type null constants during ssa builder so this is not
needed anymore.

Bug: 20322006
Change-Id: Ic060a52d4fa2d4f00755dd6427f822d368392d7b
b3306642f42d47ddb4d021a2f48ce9b1bd235857 20-Apr-2015 Calin Juravle <calin@google.com> [optimzing] Fix codegen bug and improve type propagation

- don't bound the type if there are no relevant uses
- insert the bound type in the bounded block (this allows for condition
materialization without changing the logic there).
- add more comments
- add tests for BoundType generation
- fix GenerateTestAndBranch

Change-Id: I5c1fdda104da4a46775d207270220d410234a472
0d13fee6f4330cc9cb100c43135490a34c11d7a5 17-Apr-2015 David Brazdil <dbrazdil@google.com> ART: Simplify more bool operations

Now that we have the HBooleanNot instruction, the instruction
simplifier can optimize out more conditions comparing a boolean
against a constant, as well as sequences of Boolean negations.

Change-Id: I7f634f6428a3984dd97b27b3d6362491346f1ff6
61d544bfb812d79f5c9ddad171198836cea719db 23-Feb-2015 Calin Juravle <calin@google.com> [optimizing] Add if-context sensitivity for null popagation.

Change-Id: I3725b6c6a6cf44440c34a1bfb67e623531e665d6
b1498f67b444c897fa8f1530777ef118e05aa631 16-Feb-2015 Calin Juravle <calin@google.com> Improve type propagation with if-contexts

This works by adding a new instruction (HBoundType) after each `if (a
instanceof ClassA) {}` to bound the type that `a` can take in the True-
dominated blocks.

Change-Id: Iae6a150b353486d4509b0d9b092164675732b90c
acf735c13998ad2a175f5a17e7bfce220073279d 12-Feb-2015 Calin Juravle <calin@google.com> Reference type propagation

- propagate reference types between instructions
- remove checked casts when possible
- add StackHandleScopeCollection to manage an arbitrary number of stack
handles (see comments)

Change-Id: I31200067c5e7375a5ea8e2f873c4374ebdb5ee60
d6138ef1ea13d07ae555542f8898b30d89e9ac9a 18-Feb-2015 Nicolas Geoffray <ngeoffray@google.com> Ensure the graph is correctly typed.

We used to be forgiving because of HIntConstant(0) also being
used for null. We now create a special HNullConstant for such uses.

Also, we need to run the dead phi elimination twice during ssa
building to ensure the correctness.

Change-Id: If479efa3680d3358800aebb1cca692fa2d94f6e5
10e244f9e7f6d96a95c910a2bedef5bd3810c637 26-Jan-2015 Calin Juravle <calin@google.com> optimizing: NullCheck elimination

How it works:
- run a type analysis to propagate null information on instructions
- during the last instruction simplifier remove null checks for which
the input is known to be not null

The current type analysis is actually a nullability analysis but it will
be reused in follow up CLs to propagate type information: so it keeps
the more convenient name.

Change-Id: I54bb1d32ab24604b4d677d1ecdaf8d60a5ff5ce9