History log of /art/compiler/optimizing/nodes.h
Revision Date Author Comments
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
a1935c4fa255b5c20f5e9b2abce6be2d0f7cb0a8 26-Jun-2015 Roland Levillain <rpl@google.com> MIPS: Initial version of optimizing compiler for MIPS64R6.

(cherry picked from commit 4dda3376b71209fae07f5c3c8ac3eb4b54207aa8)
(amended for mnc-dev)

Bug: 21555893
Change-Id: I874dc356eee6ab061a32f8f3df5f8ac3a4ab7dcf
Signed-off-by: Alexey Frunze <Alexey.Frunze@imgtec.com>
Signed-off-by: Douglas Leung <douglas.leung@imgtec.com>
18b236e5261d2b1f312e632a4d3bb2273c8bf641 24-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Recompute dominator tree after DCE.

bug:22031382

(cherry picked from commit 1f82ecc6a0c9f88d03d6d1a6d95eeb8707bd06c1)

Change-Id: I9a74edb185cb806045903dfe9695d9cc1a02e86b
1e256bf257e8d97df9b2178ae8658b731ca2d662 19-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Be careful with predecessor/successor index.

When we simplify the CFG, we must preserve things that were already
simplified. For example, the index in the predecessor list or
successor list of a block must be preserved for ensuring the
first block is a loop pre header.

bug:21867463

(cherry picked from commit 8b20f88b0a8d1b374dd5eaae289d19734c77b8f8)

Change-Id: I2581b5a50942290da96cd9ec876f6f2573e0a6c4
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
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
e8ff50df01c89e1b5264a5a900cfebdde87a9b44 07-May-2015 David Brazdil <dbrazdil@google.com> ART: Rediscover loops after deleting blocks in DCE

The way DCE currently updates loop information does not cover all
cases. This patch removes the logic, resets loop information of live
blocks to pre-SSA state and reanalyzes the affected loops.

Change-Id: I0b996a70235b95a8db0de9a23a03f71db57a21b8
(cherry picked from commit a4b8c21dae70ae34aee13628632c39a675c06022)
0a23d74dc2751440822960eab218be4cb8843647 07-May-2015 Nicolas Geoffray <ngeoffray@google.com> Add a parent environment to HEnvironment.

This code has no functionality change. It adds a placeholder
for chaining inlined frames.

Change-Id: I5ec57335af76ee406052345b947aad98a6a4423a
8c0c91a845568624815df026cfdac8c42ecccdf6 07-May-2015 Nicolas Geoffray <ngeoffray@google.com> Use a growable array instead of an environment during SSA.

Using an environment was convenient because it contains
a growable array. But there's no need for the environment
abstraction when being used as a temporary holder for values
of locals.

Change-Id: Idf2883fe4b8f97a31ee70b3627c1bdd23ebfff0e
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
38f2085e53b22762a83c464d91db59a9c0327580 28-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Update the remaining input index of phis after deleting an input.

bug:20715803
bug:20690906

(cherry picked from commit 5d7b7f81ed5455893f984752c00571ef27cc97c5)

Change-Id: Ie55739601b8d6fedc830d6e19d8a053392047d34
6db49a74e8402d3b6c66536ea7ec988144c05d24 28-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Update the remaining input index of phis after deleting an input.

bug:20715803
bug:20690906

(cherry picked from commit 5d7b7f81ed5455893f984752c00571ef27cc97c5)

Change-Id: Ie55739601b8d6fedc830d6e19d8a053392047d34
5d7b7f81ed5455893f984752c00571ef27cc97c5 28-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Update the remaining input index of phis after deleting an input.

bug:20715803
bug:20690906

Change-Id: Iaf08f0c30d629e766be2b04815dc3e38b6e7ff35
2af2307f3903a75a379029c049b86f9903fc81a5 30-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "GVN final fields even with side effects."

This reverts commit 781733632637db98d79dfffad72bf063be3259be.

Change-Id: Id7c4591f6b8190921852044b278d11627457c570
781733632637db98d79dfffad72bf063be3259be 29-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> GVN final fields even with side effects.

Two accesses of a final field can be GVN'ed even if there are
side effects between them.

Change-Id: I04495ae83c7858f4216b083ad1c29851954320ad
3a0163107e34304ff720bcc34b280aca0ea4a0fc 29-Apr-2015 David Brazdil <dbrazdil@google.com> ART: Fix loop information after dead code elimination

Compilation failed when only some blocks of a loop were removed during
dead code elimination.

Bug: 20680703
(cherry picked from commit 69a2804c3bb48cf4fd00a66080f613a4fd96c422)

Change-Id: If9988381236e4d8d8c3b508dfce1376b27c20d75
395086f0a9e0658a2d33eeade7121db55c1f5dc8 29-Apr-2015 David Brazdil <dbrazdil@google.com> ART: Fix loop information after dead code elimination

Compilation failed when only some blocks of a loop were removed during
dead code elimination.

Bug: 20680703
(cherry picked from commit 69a2804c3bb48cf4fd00a66080f613a4fd96c422)

Change-Id: If9988381236e4d8d8c3b508dfce1376b27c20d75
579026039080252878106118645ed70706f4838e 21-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Add synthesize uses at back edge.

This reduces the cost of linearizing the graph (hence removing
the notion of back edge). Since linear scan allocates/spills registers
based on next use, adding a use at a back edge ensures we do count
for loop uses.

Change-Id: Idaa882cb120edbdd08ca6bff142d326a8245bd14
69a2804c3bb48cf4fd00a66080f613a4fd96c422 29-Apr-2015 David Brazdil <dbrazdil@google.com> ART: Fix loop information after dead code elimination

Compilation failed when only some blocks of a loop were removed during
dead code elimination.

Bug: 20680703
Change-Id: If31025169ca493f0d7f7f2788576e98d05f03394
3e3d73349a2de81d14e2279f60ffbd9ab3f3ac28 28-Apr-2015 Roland Levillain <rpl@google.com> Have HInvoke instructions know their number of actual arguments.

Add an art::HInvoke::GetNumberOfArguments routine so that
art::HInvoke and its subclasses can return the number of
actual arguments of the called method. Use it in code
generators and intrinsics handlers.

Consequently, no longer remove a clinit check as last input
of a static invoke if it is still present during baseline
code generation, but ensure that static invokes have no such
check as last input in optimized compilations.

Change-Id: Iaf9e07d1057a3b15b83d9638538c02b70211e476
848f70a3d73833fc1bf3032a9ff6812e429661d9 15-Jan-2014 Jeff Hao <jeffhao@google.com> Replace String CharArray with internal uint16_t array.

Summary of high level changes:
- Adds compiler inliner support to identify string init methods
- Adds compiler support (quick & optimizing) with new invoke code path
that calls method off the thread pointer
- Adds thread entrypoints for all string init methods
- Adds map to verifier to log when receiver of string init has been
copied to other registers. used by compiler and interpreter

Change-Id: I797b992a8feb566f9ad73060011ab6f51eb7ce01
769c9e539da8ca80aa914cd12276aa5bd79148ee 27-Apr-2015 David Brazdil <dbrazdil@google.com> ART: Simplify Ifs with BooleanNot condition

If statements with negated condition can be simplified by removing the
negation and swapping the true and false branches.

Change-Id: I197afbc79fb7344d73b7b85d3611e7ca2519717f
2b1c622d5db941fe06b3ea9c1a5366358fa298c6 27-Apr-2015 David Brazdil <dbrazdil@google.com> ART: Fix removing a Phi with RemoveInstruction

Boolean simplifier might attempt to remove a Phi from the Instruction
list.

(cherry picked from commit c7508e93fa3df3a3890f6b62550cbd5e35bdd8df)

Change-Id: Ic8ad31967aa3e47c1fb1c67553d08681b6063a16
f213e05cef6d38166cfe0cce8f3b0a53225a1b39 27-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Add support for caching float and double constants.

Change-Id: Ib5205bad1006bc5e3c9cc86bc82a6b4b1ce9bef9
c7508e93fa3df3a3890f6b62550cbd5e35bdd8df 27-Apr-2015 David Brazdil <dbrazdil@google.com> ART: Fix removing a Phi with RemoveInstruction

Boolean simplifier might attempt to remove a Phi from the Instruction
list.

Change-Id: I698cc616549bd88dac96395cb2e5d09b5433d157
2967ec6c3dad1c1dc15fc827188bd5ecfa75493b 24-Apr-2015 Guillaume "Vermeille" Sanchez <guillaumesa@google.com> Add InsertInstructionAfter in HBasicBlock.

Change-Id: I56e4e6edb39d1aab747877b7e517e94f0393f296
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
067cae2c86627d2edcf01b918ee601774bc76aeb 26-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "[optimizing] Replace FP divide by power of 2"

Fails compiling docs.

This reverts commit b0bd8915cb257cdaf46ba663c450a6543bca75af.

Change-Id: I47d32525c83a73118e2163eb58c68bbb7a28bb38
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>
0379f82393237798616d485ad99952e73e480e12 25-Apr-2015 Roland Levillain <rpl@google.com> Fix DCHECKs about clinit checks in Optimizing's code generators.

These assertions are not true for the baseline compiler. As
a temporary workaround, remove a clinit check as last input
of a static invoke if it is still present at the stage of
code generation.

Change-Id: I5655f4a0873e2e7ee7790b6a341c18b4b7b52af1
4c0eb42259d790fddcd9978b66328dbb3ab65615 24-Apr-2015 Roland Levillain <rpl@google.com> Ensure inlined static calls perform clinit checks in Optimizing.

Calls to static methods have implicit class initialization
(clinit) checks of the method's declaring class in
Optimizing. However, when such a static call is inlined,
the implicit clinit check vanishes, possibly leading to an
incorrect behavior.

To ensure that inlining static methods does not change the
behavior of a program, add explicit class initialization
checks (art::HClinitCheck) as well as load class
instructions (art::HLoadClass) as last input of static
calls (art::HInvokeStaticOrDirect) in Optimizing' control
flow graphs, when the declaring class is reachable and not
known to be already initialized. Then when considering the
inlining of a static method call, proceed only if the method
has no implicit clinit check requirement.

The added explicit clinit checks are already removed by the
art::PrepareForRegisterAllocation visitor. This CL also
extends this visitor to turn explicit clinit checks from
static invokes into implicit ones after the inlining step,
by removing the added art::HLoadClass nodes mentioned
hereinbefore.

Change-Id: I9ba452b8bd09ae1fdd9a3797ef556e3e7e19c651
2d7352ba5311b8f57427b91b7a891e61497373c1 20-Apr-2015 David Brazdil <dbrazdil@google.com> ART: Dead block removal

Adds a new pass which finds all unreachable blocks, typically due to
simplifying an if-condition to a constant, and removes them from the
graph. The patch also slightly generalizes the graph-transforming
operations.

Change-Id: Iff7c97f1d10b52886f3cd7401689ebe1bfdbf456
af88835231c2508509eb19aa2d21b92879351962 20-Apr-2015 Guillaume "Vermeille" Sanchez <guillaumesa@google.com> Remove unnecessary null checks in CheckCast and InstanceOf

Change-Id: I6fd81cabd8673be360f369e6318df0de8b18b634
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
2cebb24bfc3247d3e9be138a3350106737455918 22-Apr-2015 Mathieu Chartier <mathieuc@google.com> Replace NULL with nullptr

Also fixed some lines that were too long, and a few other minor
details.

Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
c3d743fa2a26effcb35627d8a1338029c86e582a 22-Apr-2015 David Brazdil <dbrazdil@google.com> ART: Update last_instruction when adding Phis

HBasicBlock::InsertPhiAfter would not update the last_instruction
pointer when adding at the end of the list. This could cause problems
when iterating over phis backwards. Fortunately, we don't do that
anywhere in the existing code.

Change-Id: I4487265bf2cf3d3819623fafd7ce7c359bac190e
641547a5f18ca2ea54469cceadcfef64f132e5e0 21-Apr-2015 Calin Juravle <calin@google.com> [optimizing] Fix a bug in moving the null check to the user.

When taking the decision to move a null check to the user we did not
verify if the next instruction checks the same object.

Change-Id: I2f4533a4bb18aa4b0b6d5e419f37dcccd60354d2
1ba1981ee9d28f87f594b157566d09e973fa5bce 21-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Linear scan: Use FirstUse instead of FirstRegisterUse.

This is in preparation for introducing synthesized used at back edges.

Change-Id: Ie28d6725d2dde982cf2137f2110daabcbab9f789
b0bd8915cb257cdaf46ba663c450a6543bca75af 16-Apr-2015 Mark Mendell <mark.p.mendell@intel.com> [optimizing] Replace FP divide by power of 2

Replace a floating point division by a power of two by a multiplication
of the reciprocal. This is guarenteed to have the exact same result as
it is exactly representable.

Add routines to allow generation of float and double constants after the
SSA Builder. I was unsure if float and double caches should be
implemented. Under the assumption that there is probably not a lot of
repetition of FP values. Please let me know.

Change-Id: I3a6c3847b49b4e747a7e7e8843ca32bb174b1584
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
27df758e2e7baebb6e3f393f9732fd0d064420c8 17-Apr-2015 Calin Juravle <calin@google.com> [optimizing] Add memory barriers in constructors when needed

If a class has final fields we must add a memory barrier before
returning from constructor. This makes sure the fields are visible to
other threads.

Bug: 19851497
Change-Id: If8c485092fc512efb9636cd568cb0543fb27688e
ad4450e5c3ffaa9566216cc6fafbf5c11186c467 17-Apr-2015 Zheng Xu <zheng.xu@arm.com> Opt compiler: Implement parallel move resolver without using swap.

The algorithm of ParallelMoveResolverNoSwap() is almost the same with
ParallelMoveResolverWithSwap(), except the way we resolve the circular
dependency. NoSwap() uses additional scratch register to resolve the
circular dependency. For example, (0->1) (1->2) (2->0) will be performed
as (2->scratch) (1->2) (0->1) (scratch->0).

On architectures without swap register support, NoSwap() can reduce the
number of moves from 3x(N-1) to (N+1) when there is circular dependency
with N moves.

And also, NoSwap() algorithm does not depend on architecture register
layout information, which means it can support register pairs on arm32
and X/W, D/S registers on arm64 without additional modification.

Change-Id: Idf56bd5469bb78c0e339e43ab16387428a082318
a4f8831d6533e4fe5aed18433099e1130d95a877 16-Apr-2015 Calin Juravle <calin@google.com> Remove duplicates phis created during SSA transformation

When creating equivalent phis we copy the inputs of the original phi
which may be improperly typed. This will be fixed during the type
propagation but as a result we may have two equivalent phis with the
same type for the same dex register. This is correct but generates more
code and prevent some optimizations.

This CL adds another step in the SSA builder to remove the extra Phi
nodes created due to equality operators.

The graph checker verifies that for a given dex register not two phis
have the same type.

Also, replace zero int constant with null constant when we compare a
reference against null.

Change-Id: Id37cc11a016ea767c7e351575e003d822a9d2e60
f776b92a0d52bb522043812dacb9c21ac11858e2 15-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Remove dead blocks for the blocks_ array.

This prevents crashing because of structurally incorrect
blocks. Also we now don't need to remove its instructions.

Test case courtesy of Serguei I Katkov.

Change-Id: Ia3ef9580549fc3546e8cd5f346079b1f0ceb2a61
0d9f17de8f21a10702de1510b73e89d07b3b9bbf 15-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Move the linear order to the HGraph.

Bug found by Zheng Xu: SsaLivenessAnalysis being a stack allocated
object, we should not refer to it in later phases of the compiler.
Specifically, the code generator was using the linear order, which
was stored in the liveness analysis object.

Change-Id: I574641f522b7b86fc43f3914166108efc72edb3b
9021825d1e73998b99c81e89c73796f6f2845471 15-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Type MoveOperands.

The ParallelMoveResolver implementation needs to know if a move
is for 64bits or not, to handle swaps correctly.

Bug found, and test case courtesy of Serguei I. Katkov.

Change-Id: I9a0917a1cfed398c07e57ad6251aea8c9b0b8506
66d126ea06ce3f507d86ca5f0d1f752170ac9be1 03-Apr-2015 David Brazdil <dbrazdil@google.com> ART: Implement HBooleanNot instruction

Optimizations simplifying operations on boolean values (boolean
simplifier, instruction simplifier) can benefit from having a special
HInstruction for negating booleans in order to perform more transforms
and produce faster machine code.

This patch implements HBooleanNot as 'x xor 1', assuming that booleans
are 1-bit integers and allowing for a single-instruction negation on
all supported platforms.

Change-Id: I33a2649c1821255b18a86ca68ed16416063c739f
188d4316a880ae24aed315aa52dc503c4fcb1ec7 09-Apr-2015 Alexandre Rames <alexandre.rames@arm.com> Opt compiler: Instruction simplification for HAdd, HNeg, HNot, HSub.

Under assumptions for the 'cost' of each IR (eg. neither HAdd nor HSub
are faster than the other), transformations are only applied if they
(locally) cannot degrade the quality of the graph. The code could be
extended to look at uses of the IRs and detect more opportunities for
optimisations. The optimisations in this patch do not look at other
uses for their inputs.

Change-Id: Ib60dab007af30f43421ef5bb55db2ec32fb8fc0c
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
0c365e674545159fd77b998081207f0685a605e5 01-Apr-2015 Mingyao Yang <mingyao@google.com> CanThrow() of HNewArray should return true.

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

This reverts commit 0ba627337274ccfb8c9cb9bf23fffb1e1b9d1430.

Change-Id: I1ca10d15bbb49897a0cf541ab160431ec180a006
a0466e1773ec1db32c4b3d04b0416ffef5005b39 27-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> GVN HClinitCheck nodes.

Change-Id: I5c79caadd57d10214a44149fda53e9e185ac7eca
8d5b8b295930aaa43255c4f0b74ece3ee8b43a47 24-Mar-2015 David Brazdil <dbrazdil@google.com> 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
790412959a6413a585f45fc5f77fe7106311a00c 26-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Use the original invoke type when inlining.

When resolving a method through the compiler driver, the code makes
sure the call in the DEX bytecode matches the kind of method found,
to check for IncompatibleClassChangeError. Because when we sharpen
an invoke virtual, we transform the invoke kind to direct, we must not
use the new kind, but the one in DEX.

Change-Id: Iaf77b27b529c659ea48ffb19f46427552c9e3654
9437b78780f9e6ffa5797ebe82de8e8d7f3a5ed6 25-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Inline across dex files.""

This reverts commit 6a816cf624ba56bf2872916d7b65b18fd9a411ef.

Change-Id: I36cb524108786dd7996f2aea0443675be1f1b859
b2bd1c5f9171f35fa5b71ada42d1a9e11189428d 25-Mar-2015 David Brazdil <dbrazdil@google.com> ART: Formatting and comments in BooleanSimplifier

Change-Id: I9a5aa3f2aa8b0a29d7b0f1e5e247397cf8e9e379
10f56cb6b4e39ed0032e9a23b179b557463e65ad 24-Mar-2015 David Brazdil <dbrazdil@google.com> ART: Fix crash in gtests

SsaLivenessAnalysis was crashing after change of iteration order in
142377 because gtests do not always build reverse post order.

Change-Id: If5ad5b7c52040b119c4415f0b942988049fa3c16
46e2a3915aa68c77426b71e95b9f3658250646b7 16-Mar-2015 David Brazdil <dbrazdil@google.com> ART: Boolean simplifier

The optimization recognizes the negation pattern generated by 'javac'
and replaces it with a single condition. To this end, boolean values
are now consistently assumed to be represented by an integer.

This is a first optimization which deletes blocks from the HGraph and
does so by replacing the corresponding entries with null. Hence,
existing code can continue indexing the list of blocks with the block
ID, but must check for null when iterating over the list.

Change-Id: I7779da69cfa925c6521938ad0bcc11bc52335583
6a816cf624ba56bf2872916d7b65b18fd9a411ef 24-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Inline across dex files."

bug: 19904089
bug: 19903495

This reverts commit 7e4c3508e4f5512650b63c41f7872a749e99aee9.

Change-Id: I15df746b5f1882cce78eedde6c05c0d3b69bfa4a
da4d79bc9a4aeb9da7c6259ce4c9c1c3bf545eb8 24-Mar-2015 Roland Levillain <rpl@google.com> Unify ART's various implementations of bit_cast.

ART had several implementations of art::bit_cast:

1. one in runtime/base/casts.h, declared as:

template <class Dest, class Source>
inline Dest bit_cast(const Source& source);

2. another one in runtime/utils.h, declared as:

template<typename U, typename V>
static inline V bit_cast(U in);

3. and a third local version, in runtime/memory_region.h,
similar to the previous one:

template<typename Source, typename Destination>
static Destination MemoryRegion::local_bit_cast(Source in);

This CL removes versions 2. and 3. and changes their callers
to use 1. instead. That version was chosen over the others
as:
- it was the oldest one in the code base; and
- its syntax was closer to the standard C++ cast operators,
as it supports the following use:

bit_cast<Destination>(source)

since `Source' can be deduced from `source'.

Change-Id: I7334fd5d55bf0b8a0c52cb33cfbae6894ff83633
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
7e4c3508e4f5512650b63c41f7872a749e99aee9 18-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Inline across dex files.

Change-Id: I5c2c44f5130b50f0bad21a6877a3935dc60b4a85
915b9d0c13bb5091875d868fbfa551d7b65d7477 11-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Tweak liveness when instructions are used in environments.

Instructions remain live when debuggable, but only instructions
with object types remain live when non-debuggable.

Enable StackVisitor::GetThisObject for optimizing.

Change-Id: Id87b2cbf33a02450059acc9993995782e5f28987
d335083828e2838bd360303be768e600275cedf5 12-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Run the natural loop recognizer before building SSA.

SSA building checks the consistency of the graph when dealing
with dead phis.

Fixes continuous AOSP builds with optimizing.

Change-Id: Ia9a0f0adc24a8e144e54444e090ad828b9b40040
b2fd7bca70b580921eebf7c45769c39d2dfd8a5a 11-Mar-2015 Alexandre Rames <alexandre.rames@arm.com> Opt compiler: Basic simplification for arithmetic operations.

The optimisations in this patch do not look further than the
inputs of each operation.

Change-Id: Iddd0ab6b360b9e7bb042db22086d51a31be85530
234d69d075d1608f80adb647f7935077b62b6376 09-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "[optimizing] Enable x86 long support.""

This reverts commit 154552e666347d41d95d7619c6ee56249ff4feca.

Change-Id: Idc726551c249a888b7ff5fde8508ae50e81b2e13
e0fe7ae36180863e45cbb9d1e6e9c30b1b1a949c 09-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Make the SSA builder honor the debuggable flag.

This requires to properly type phis that are only
used by environments, and discard phis with incomptable types.
The code generators do not handle these conflicting types. In
the process, ensure a phi has a type that does not depend
on the order of the inputs (for example (char, short) -> short),
and set int for int-like types. We can refine this later.

Change-Id: I60ab601d6d00b1cbf18623ee4ff1795aa28f84a1
154552e666347d41d95d7619c6ee56249ff4feca 06-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "[optimizing] Enable x86 long support."

Few libcore failures.

This reverts commit b4ba354cf8d22b261205494875cc014f18587b50.

Change-Id: I4a28d853e730dff9b69aec9555505803cf2fcd63
2ed20afc6a1032e9e0cf919cb8d1b2b41e147182 06-Mar-2015 Alexandre Rames <alexandre.rames@arm.com> Opt compiler: Clean the use of `virtual` and `OVERRIDE`.

Change-Id: I806ec522b979334cee8f344fc95e8660c019160a
b4ba354cf8d22b261205494875cc014f18587b50 05-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> [optimizing] Enable x86 long support.

Change-Id: I9006972a65a1f191c45691104a960366747f9d16
e4335eb5bcbca6927e51c10cf0de3516d94ef599 03-Mar-2015 Mingyao Yang <mingyao@google.com> Make BCE a no-op if there is no array access.

Change-Id: I8456182808c1dbaa0c0ae1b8c2e94bb17baf5f29
dc5ac731f6369b53b42f1cee3404f3b3384cec34 25-Feb-2015 Mingyao Yang <mingyao@google.com> Opt compiler: enhance gvn for commutative ops.

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

Change-Id: I3725b6c6a6cf44440c34a1bfb67e623531e665d6
1abb4191a2e56d8dbf518efcaeefb266c1acdf2b 17-Feb-2015 David Brazdil <dbrazdil@google.com> Optimizing: Speed up HInstruction use removal

Similarly to a previous commit on HEnvironment use removal, this patch
adds links from instructions to their respective inputs' use lists for
contant-time removal at the cost of doubling the size of input lists
(from one pointer per entry to two). Manual testing shows that this
significantly reduces the time required to transform HGraph to SSA
form for some huge methods.

Change-Id: I8dc3e4b0c48a50ac1481eb55c31093b99f4dc29f
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
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
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
f7a0c4e421b5edaad5b7a15bfff687da28d0b287 10-Feb-2015 Nicolas Geoffray <ngeoffray@google.com> Improve ParallelMoveResolver to work with pairs.

Change-Id: Ie2a540ffdb78f7f15d69c16a08ca2d3e794f65b9
c0572a451944f78397619dec34a38c36c11e9d2a 06-Feb-2015 Nicolas Geoffray <ngeoffray@google.com> Optimize leaf methods.

Avoid suspend checks and stack changes when not needed.

Change-Id: I0fdb31e8c631e99091b818874a558c9aa04b1628
276d9daaedfbff716339f94d55e6eff98b7434c6 02-Feb-2015 Nicolas Geoffray <ngeoffray@google.com> Inline methods with multiple blocks.

Change-Id: I3431af60e97fae230e0b6e98bcf0acc0ee9abf8c
cb1b00aedd94785e7599f18065a0b97b314e64f6 28-Jan-2015 Nicolas Geoffray <ngeoffray@google.com> Use the non access check entrypoint when possible.

Change-Id: I0b53d63141395e26816d5d2ce3fa6a297bb39b54
82091dad38f3e5bfaf3b6984c9ab73069fb68310 26-Jan-2015 Nicolas Geoffray <ngeoffray@google.com> Implement LICM in optimizing compiler.

Change-Id: I9c8afb0a58ef45e568576015473cbfd5f011c242
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
1cf95287364948689f6a1a320567acd7728e94a3 12-Dec-2014 Nicolas Geoffray <ngeoffray@google.com> Small optimization for recursive calls: avoid dex cache.

Change-Id: I044757a2f06e535cdc1480c4fc8182b89635baf6
ea55b934cff1280318f5514039549799227cfa3d 27-Jan-2015 David Brazdil <dbrazdil@google.com> ART: Further refactor use lists

Change-Id: I9e3219575a508ca5141d851bfcaf848302480c32
ed59619b370ef23ffbb25d1d01f615e60a9262b6 23-Jan-2015 David Brazdil <dbrazdil@google.com> Optimizing: Speed up HEnvironment use removal

Removal of use records from HEnvironment vregs involved iterating over
potentially large linked lists which made compilation of huge methods
very slow. This patch turns use lists into doubly-linked lists, stores
pointers to the relevant nodes inside HEnvironment and subsequently
turns the removals into constant-time operations.

Change-Id: I0e1d4d782fd624e7b8075af75d4adf0a0634a1ee
6c2dff8ff8e1440fa4d9e1b2ba2a44d036882801 21-Jan-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Fully support pairs in the register allocator.""

This reverts commit c399fdc442db82dfda66e6c25518872ab0f1d24f.

Change-Id: I19f8215c4b98f2f0827e04bf7806c3ca439794e5
77520bca97ec44e3758510cebd0f20e3bb4584ea 12-Jan-2015 Calin Juravle <calin@google.com> Record implicit null checks at the actual invoke time.

ImplicitNullChecks are recorded only for instructions directly (see NB
below) preceeded by NullChecks in the graph. This way we avoid recording
redundant safepoints and minimize the code size increase.

NB: ParallalelMoves might be inserted by the register allocator between
the NullChecks and their uses. These modify the environment and the
correct action would be to reverse their modification. This will be
addressed in a follow-up CL.

Change-Id: Ie50006e5a4bd22932dcf11348f5a655d253cd898
c399fdc442db82dfda66e6c25518872ab0f1d24f 21-Jan-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Fully support pairs in the register allocator."

Libcore tests fail.

This reverts commit 41aedbb684ccef76ff8373f39aba606ce4cb3194.

Change-Id: I2572f120d4bbaeb7a4d4cbfd47ab00c9ea39ac6c
41aedbb684ccef76ff8373f39aba606ce4cb3194 14-Jan-2015 Nicolas Geoffray <ngeoffray@google.com> Fully support pairs in the register allocator.

Enabled on ARM for longs and doubles.

Change-Id: Id8792d08bd7ca9fb049c5db8a40ae694bafc2d8b
42d1f5f006c8bdbcbf855c53036cd50f9c69753e 16-Jan-2015 Nicolas Geoffray <ngeoffray@google.com> Do not use register pair in a parallel move.

The ParallelMoveResolver does not work with pairs. Instead,
decompose the pair into two individual moves.

Change-Id: Ie9d3f0b078cef8dc20640c98b20bb20cc4971a7f
dd8f887e81b894bc8075d8bacdb223747b6a8018 15-Jan-2015 Nicolas Geoffray <ngeoffray@google.com> Fix a bug in the register allocator.

When allocating a register blocked by existing intervals,
we need to split inactive intervals at the end of their
lifetime hole, and not at the next intersection. Otherwise,
the allocation for following intervals will not see
that a register is being used by the split interval.

Change-Id: I40cc79dde541c07392a7cf4c6f0b291dd1ce1819
71fb52fee246b7d511f520febbd73dc7a9bbca79 30-Dec-2014 Andreas Gampe <agampe@google.com> ART: Optimizing compiler intrinsics

Add intrinsics infrastructure to the optimizing compiler.

Add almost all intrinsics supported by Quick to the x86-64 backend.
Further intrinsics require more assembler support.

Change-Id: I48de9b44c82886bb298d16e74e12a9506b8e8807
840e5461a85f8908f51e7f6cd562a9129ff0e7ce 07-Jan-2015 Nicolas Geoffray <ngeoffray@google.com> Implement double and float support for arm in register allocator.

The basic approach is:
- An instruction that needs two registers gets two intervals.
- When allocating the low part, we also allocate the high part.
- When splitting a low (or high) interval, we also split the high
(or low) equivalent.
- Allocation follows the (S/D register) requirement that low
registers are always even and the high equivalent is low + 1.

Change-Id: I06a5148e05a2ffc7e7555d08e871ed007b4c2797
10c9cbe05ab860cb7d5ce82c411698a10f811aa6 19-Dec-2014 Calin Juravle <calin@google.com> Fixed CanBeMoved for field access

Change-Id: I36a1f4a468f3701e0608d71f64d64049c54aec18
52c489645b6e9ae33623f1ec24143cde5444906e 16-Dec-2014 Calin Juravle <calin@google.com> [optimizing compiler] Add support for volatile

- for backends: arm, x86, x86_64
- added necessary instructions to assemblies
- clean up code gen for field set/get
- fixed InstructionDataEquals for some instructions
- fixed comments in compiler_enums

* 003-opcode test verifies basic volatile functionality

Change-Id: I144393efa312dfb2c332cb84056b00edffee338a
4e44c829e282b3979a73bfcba92510e64fbec209 17-Dec-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Small optimization for recursive calls: avoid dex cache."

Fails on target.

This reverts commit 390f59f9bec64fd81b05e796dfaeb03ab6d4cc81.

Change-Id: Ic3865b8897068ba20df0fbc2bcf561faf6c290c1
390f59f9bec64fd81b05e796dfaeb03ab6d4cc81 12-Dec-2014 Nicolas Geoffray <ngeoffray@google.com> Small optimization for recursive calls: avoid dex cache.

Change-Id: Ic4054b6c38f0a2a530ba6ef747647f86cee0b1b8
53d9da8507a1b68f036ce8669ad3f2ae9fc3d225 04-Dec-2014 Jean Christophe Beyler <jean.christophe.beyler@intel.com> ART: Create a RemoveBlock method

The RemoveDeadBlocks should be separated into a utility function to remove
a single block so that it can be used as a future utility method.

Change-Id: I4c67113fff24e92a66a81bc0e8edf9fbdda08cdf
Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
e53798a7e3267305f696bf658e418c92e63e0834 01-Dec-2014 Nicolas Geoffray <ngeoffray@google.com> Inlining support in optimizing.

Currently only inlines simple things that don't require an
environment, such as:
- Returning a constant.
- Returning a parameter.
- Returning an arithmetic operation.

Change-Id: Ie844950cb44f69e104774a3cf7a8dea66bc85661
624279f3c70f9904cbaf428078981b05d3b324c0 04-Dec-2014 Roland Levillain <rpl@google.com> Add support for float-to-long in the optimizing compiler.

- Add support for the float-to-long Dex instruction in the
optimizing compiler.
- Add a Dex PC field to art::HTypeConversion to allow the
x86 and ARM code generators to produce runtime calls.
- Instruct art::CodeGenerator::RecordPcInfo not to record
PC information for HTypeConversion instructions.
- Add S0 to the list of ARM FPU parameter registers.
- Have art::x86_64::X86_64Assembler::cvttss2si work with
64-bit operands.
- Generate x86, x86-64 and ARM (but not ARM64) code for
float to long HTypeConversion nodes.
- Add related tests to test/422-type-conversion.

Change-Id: I954214f0d537187883f83f7a83a1bb2dd8a21fd4
fc600dccd7797a9a10cdd457034ea8e148ccd631 02-Dec-2014 Roland Levillain <rpl@google.com> Fix a compiler bug related to a catch-less try-finally statement.

Ensure a dead basic block produced in this case is properly
removed.

Change-Id: I7c88e26aaa6c6378892f7c7c299494fa42312db2
92a6ed2014278c78b60d7ef00751f15e6727aae0 02-Dec-2014 Calin Juravle <calin@google.com> Fix new-instance node.

new-instance may throw when called on:
- interfaces
- abstract/innaccessible/unknown classes

Change-Id: Id55dbb95b906a58c946b14adad934ee0e3498c0a
f537012ceb6cba8a78b36a5065beb9588451a250 02-Dec-2014 Nicolas Geoffray <ngeoffray@google.com> Treat SSA transformation special, as we may have to bailout.

We forgot to bailout when we found a non-natural loop (on which
our optimizations don't work).

Change-Id: I11976b5af4c98f4f29267a74c74d34b5ad81e20c
ddb7df25af45d7cd19ed1138e537973735cc78a5 25-Nov-2014 Calin Juravle <calin@google.com> [optimizing compiler] Add CMP{L,G}_{FLOAT,DOUBLE}

Adds:
- float comparison for arm, x86, x86_64 backends.
- ucomis{s,d} assembly to x86 and x86_64.
- vmstat assebmly for thumb2
- new assembly tests

Change-Id: Ie3e19d0c08b3b875cd0a4be4ee4e9c8a4a076290
91debbc3da3e3376416e4394155d9f9e355255cb 26-Nov-2014 Calin Juravle <calin@google.com> Revert "[optimizing compiler] Add CMP{L,G}_{FLOAT,DOUBLE}"

Fails on arm due to missing vmrs op after vcmp. I revert this instead of pushing the fix because I don't understand yet why it compiles with run-test but not with dex2oat.

This reverts commit fd861249f31ab360c12dd1ffb131d50f02b0bfc6.

Change-Id: Idc2d30f6a0f39ddd3596aa18a532ae90f8aaf62f
fd861249f31ab360c12dd1ffb131d50f02b0bfc6 25-Nov-2014 Calin Juravle <calin@google.com> [optimizing compiler] Add CMP{L,G}_{FLOAT,DOUBLE}

- adds float comparison for arm, x86, x86_64 backends.
- adds ucomis{s,d} assembly to x86 and x86_64.

Change-Id: I232d2b6e9ecf373beb5cc63698dd97a658ff9c83
799f506b8d48bcceef5e6cf50f3f5eb6bcea05e1 26-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "[optimizing compiler] Add CMP{L,G}_{FLOAT,DOUBLE}"

Fails on x86_64 and target.

This reverts commit cea28ec4b9e94ec942899acf1dbf20f8999b36b4.

Change-Id: I30c1d188c7ecfe765f137a307022ede84f15482c
cea28ec4b9e94ec942899acf1dbf20f8999b36b4 25-Nov-2014 Calin Juravle <calin@google.com> [optimizing compiler] Add CMP{L,G}_{FLOAT,DOUBLE}

- adds float comparison for arm, x86, x86_64 backends.
- adds ucomis{s,d} assembly to x86 and x86_64.

Change-Id: Ie91e04bfb402025073054f3803a3a569e4705caa
a8eed3acbc39c71ec22dc2943e71eaa07c6507dd 24-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Fix the computation of linear ordering.""

PS2 fixes the obvious typos/wrong refactoring.

This reverts commit e50fa5887b1342b845826197d81950e26753fc9c.

Change-Id: I22f81d63a12cf01aafd61535abc2399d936d49c2
e50fa5887b1342b845826197d81950e26753fc9c 24-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Fix the computation of linear ordering."

Build is broken.

This reverts commit 3054a90063d379ab8c9e5a42a7daf0d644b48b07.

Change-Id: I259bc2bd6a58e30391b8176f3db5fdb5c07e4d6d
9aec02fc5df5518c16f1e5a9b6cb198a192db973 19-Nov-2014 Calin Juravle <calin@google.com> [optimizing compiler] Add shifts

Added SHL, SHR, USHR for arm, x86, x86_64.

Change-Id: I971f594e270179457e6958acf1401ff7630df07e
3054a90063d379ab8c9e5a42a7daf0d644b48b07 21-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Fix the computation of linear ordering.

The register allocator makes assumptions on the order, and
we ended up not computing the right one. The algorithm worked
fine when the loop header is the block branching to the exit,
but in the presence of breaks or do/while, it was incorrect.

Change-Id: Iad0a89872cd3f7b7a8b2bdf560f0d03493f93ba5
bacfec30ee9f2f6fdfd190f11b105b609938efca 14-Nov-2014 Calin Juravle <calin@google.com> [optimizing compiler] Add REM_INT, REM_LONG

- for arm, x86, x86_64
- minor cleanup/fix in div tests

Change-Id: I240874010206a5a9b3aaffbc81a885b94c248f93
af07bc121121d7bd7e8329c55dfe24782207b561 12-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Minor object store optimizations.

- Avoid emitting write barrier when the value is null.
- Do not do a typecheck on an arraystore when storing something that
was loaded from the same array.

Change-Id: I902492928692e4553b5af0fc99cce3c2186c442a
d6fb6cfb6f2d0d9595f55e8cc18d2753be5d9a13 11-Nov-2014 Calin Juravle <calin@google.com> [optimizing compiler] Add DIV_LONG

- for backends: arm, x86, x86_64
- added cqo, idivq, testq assembly for x64_64
- small cleanups

Change-Id: I762ef37880749038ed25d6014370be9a61795200
f97f9fbfdf7f2e23c662f21081fadee6af37809d 11-Nov-2014 Calin Juravle <calin@google.com> [optimizing compiler] add HTemporary support for long and doubles

Change-Id: I5247ecd71d0193050484b7632c804c9bfd20f924
9574c4b5f5ef039d694ac12c97e25ca02eca83c0 12-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Implement and/or/xor in optimizing.

Change-Id: I7cf6da1fd334a7177a5580931b8f174dd40b7cec
b7baf5c58d0e864f8c3f889357c51288aed42e61 11-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Implement monitorenter/monitorexit.

Pretty simple as they just invoke the runtime.

Change-Id: I5fcb2c783deac27e55e28d8b3da3e68ea4b77363
57a88d4ac205874dc85d22f9f6a9ca3c4c373eeb 10-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Implement checkcast for optimizing.

- Ended up not using HTypeCheck because of how
instanceof and checkcast end up having different logic
for code generation.

- Fix a x86_64 assembler bug triggered by now enabling
more methods to be compiled. Difficult to test today
without b/18117217.

Change-Id: I3022e7ae03befb1d10bea9637ad21fadc430abe0
421e9f9088b51e9680a3dfcae6965fc1854d3ee4 11-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Remove HTemporary when building the SSA graph.

- They are useless afterwards. If we keep them around, they can
crash the dump of the graph, where they always assume a previous
instruction.

- In the call to HTemporary::GetType, check that the previous
instruction exists.

Change-Id: Ie7bf44d05cb61e3654a69725c1980925580dd3a6
52839d17c06175e19ca4a093fb878450d1c4310d 07-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Support invoke-interface in optimizing.

Change-Id: Ic18d7c3d2810557231caf0571956e0c431f5d384
6f5c41f9e409bc4da53b5d7c385202255e391e72 06-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Implement instanceof in optimizing.

- Only fast-path for now: null or same class.
- Use pQuickInstanceofNonTrivial for slow path.

Change-Id: Ic5196b94bef792f081f3cb4d15157058e1381e6b
f43083d560565aea46c602adb86423daeefe589d 07-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Do not update Out after it has a valid location.

Slow paths use LocationSummary to know where to move
things around, and they are executed at the end of the
code generation.

This fix is needed for https://android-review.googlesource.com/#/c/113345/.

Change-Id: Id336c6409479b1de6dc839b736a7234d08a7774a
de58ab2c03ff8112b07ab827c8fa38f670dfc656 05-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Implement try/catch/throw in optimizing.

- We currently don't run optimizations in the presence of a try/catch.
- We therefore implement Quick's mapping table.
- Also fix a missing null check on array-length.

Change-Id: I6917dfcb868e75c1cf6eff32b7cbb60b6cfbd68f
cd2de0c1c7f1051a2f7bdb0e827dd6057f3bafcd 06-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Fix failures after div support.

- We need to special case divide by -1 because of x86.
- Disable div test on arm64, which does not support div yet.

Change-Id: I07e137cb555a958b02a6c4070f296503b7e30bae
d0d4852847432368b090c184d6639e573538dccf 04-Nov-2014 Calin Juravle <calin@google.com> [optimizing compiler] Add div-int and exception handling.

- for backends: arm, x86, x86_64
- fixed a register allocator bug: the request for a fixed register for
the first input was ignored if the output was kSameAsFirstInput
- added divide by zero exception
- more tests
- shuffle around some code in the builder to reduce the number of lines
of code for a single function.

Change-Id: Id3a515e02bfbc66cd9d16cb9746f7551bdab3d42
ed9b1958371952f5cdcc040bec8997da462edba7 06-Nov-2014 Roland Levillain <rpl@google.com> Fix ART build issues.

- Use ATTRIBUTE_UNUSED to avoid a warning about an unused
argument in compiler/optimizing/nodes.h instead of
simply commenting it out.
- Disable run test 002-sleep on ARM64.

Change-Id: I96911904289b73611e0fc168e7b597a9a2df8141
dff1f2812ecdaea89978c5351f0c70cdabbc0821 05-Nov-2014 Roland Levillain <rpl@google.com> Support int-to-long conversions in the optimizing compiler.

- Add support for the int-to-float Dex instruction in the
optimizing compiler.
- Add a HTypeConversion node type for control-flow graphs.
- Generate x86, x86-64 and ARM (but not ARM64) code for
int-to-float HTypeConversion nodes.
- Add a 64-bit "Move doubleword to quadword with
sign-extension" (MOVSXD) instruction to the x86-64
assembler.
- Add related tests to test/422-type-conversion.

Change-Id: Ieb8ec5380f9c411857119c79aa8d0728fd10f780
424f676379f2f872acd1478672022f19f3240fc1 03-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Implement CONST_CLASS in optimizing compiler.

Change-Id: Ia8c8dfbef87cb2f7893bfb6e178466154eec9efd
6a3c1fcb4ba42ad4d5d142c17a3712a6ddd3866f 31-Oct-2014 Ian Rogers <irogers@google.com> Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.

Fix associated errors about unused paramenters and implict sign conversions.
For sign conversion this was largely in the area of enums, so add ostream
operators for the effected enums and fix tools/generate-operator-out.py.
Tidy arena allocation code and arena allocated data types, rather than fixing
new and delete operators.
Remove dead code.

Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
b5f62b3dc5ac2731ba8ad53cdf3d9bdb14fbf86b 30-Oct-2014 Nicolas Geoffray <ngeoffray@google.com> Support for CONST_STRING in optimizing compiler.

Change-Id: Iab8517bdadd1d15ffbe570010f093660be7c51aa
19a19cffd197a28ae4c9c3e59eff6352fd392241 22-Oct-2014 Nicolas Geoffray <ngeoffray@google.com> Add support for static fields in optimizing compiler.

Change-Id: Id2f010589e2bd6faf42c05bb33abf6816ebe9fa9
7c4954d429626a6ceafbf05be41bf5f840894e44 28-Oct-2014 Calin Juravle <calin@google.com> [optimizing compiler] Add division for floats and doubles

backends: x86, x86_64, arm.

Also:
- ordered instructions based on their name.
- add missing kNoOutputOverlap to add/sub/mul.

Change-Id: Ie47cde3b15ac74e7a1660c67a2eed1d7871f0ad0
1cc5f251df558b0e22cea5000626365eb644c727 22-Oct-2014 Roland Levillain <rpl@google.com> Implement int bit-wise not operation in the optimizing compiler.

- Add support for the not-int (integer one's complement
negate) instruction in the optimizing compiler.
- Extend the HNot control-flow graph node type and make it
inherit from HUnaryOperation.
- Generate ARM, x86 and x86-64 code for integer HNeg nodes.
- Exercise these additions in the codegen_test gtest, as there
is not direct way to assess the support of not-int from a
Java source. Indeed, compiling a Java expression such as
`~a' using javac and then dx generates an xor-int/lit8 Dex
instruction instead of the expected not-int Dex instruction.
This is probably because the Java bytecode has an `ixor'
instruction, but there's not instruction directly
corresponding to a bit-wise not operation.

Change-Id: I223aed75c4dac5785e04d99da0d22e8d699aee2b
cf7f19135f0e273f7b0136315633c2abfc715343 23-Oct-2014 Ian Rogers <irogers@google.com> C++11 related clean-up of DISALLOW_..

Move DISALLOW_COPY_AND_ASSIGN to delete functions. By no having declarations
with no definitions this prompts better warning messages so deal with these
by correcting the code.
Add a DISALLOW_ALLOCATION and use for ValueObject and mirror::Object.
Make X86 assembly operand types ValueObjects to fix compilation errors.
Tidy the use of iostream and ostream.
Avoid making cutils a dependency via mutex-inl.h for tests that link against
libart. Push tracing dependencies into appropriate files and mutex.cc.
x86 32-bit host symbols size is increased for libarttest, avoid copying this
in run-test 115 by using symlinks and remove this test's higher than normal
ulimit.
Fix the RunningOnValgrind test in RosAllocSpace to not use GetHeap as it
returns NULL when the heap is under construction by Runtime.

Change-Id: Ia246f7ac0c11f73072b30d70566a196e9b78472b
a3d05a40de076aabf12ea284c67c99ff28b43dbf 20-Oct-2014 Nicolas Geoffray <ngeoffray@google.com> Implement array creation related DEX instructions.

Implement new-array, filled-new-array, and fill-array-data.

Change-Id: I405560d66777a57d881e384265322617ac5d3ce3
102cbed1e52b7c5f09458b44903fe97bb3e14d5f 15-Oct-2014 Nicolas Geoffray <ngeoffray@google.com> Implement register allocator for floating point registers.

Also:
- Fix misuses of emitting the rex prefix in the x86_64 assembler.
- Fix movaps code generation in the x86_64 assembler.

Change-Id: Ib6dcf6e7c4a9c43368cfc46b02ba50f69ae69cbe
9240d6a2baa9ed1e18ee08744b461fe49a1ee269 20-Oct-2014 Roland Levillain <rpl@google.com> Constant folding on unary operations in the optimizing compiler.

Change-Id: I4b77afa2a89f5ad2eedd4d6c0c6c382585419349
88cb1755e1d6acaed0f66ce65d7a2a4465053342 20-Oct-2014 Roland Levillain <rpl@google.com> Implement int negate instruction in the optimizing compiler.

- Add support for the neg-int (integer two's complement
negate) instruction in the optimizing compiler.
- Add a HNeg node type for control-flow graphs and an
intermediate HUnaryOperation base class.
- Generate ARM, x86 and x86-64 code for integer HNeg nodes.

Change-Id: I72fd3e1e5311a75c38a8cb665a9211a20325a42e
6c82d40eb142771086f5531998de2273ba5cc08c 13-Oct-2014 Roland Levillain <rpl@google.com> Have HInstruction::StrictlyDominates compute strict dominance.

Change-Id: I3a4fa133268615fb4ce54a0bcb43e0c2458cc865
34bacdf7eb46c0ffbf24ba7aa14a904bc9176fb2 07-Oct-2014 Calin Juravle <calin@google.com> Add multiplication for integral types

This also fixes an issue where we could allocate a pair register even if
one of its parts was already blocked.

Change-Id: I4869175933409add2a56f1ccfb369c3d3dd3cb01
633021e6ff6b9a57a374a994e74cfd69275ce100 01-Oct-2014 Roland Levillain <rpl@google.com> Implement default traversals in CFG & SSA graph checkers.

- Check CFG graphs using an insertion order traversal.
- Check SSA form graphs using a reverse post-order traversal.

Change-Id: Ib9062599bdbf3c17b9f213b743274b2d71a9fa90
e161a2a60c0325793f04be42a0f05228955ecfdd 03-Oct-2014 Roland Levillain <rpl@google.com> Do not remove NullChecks & BoundsChecks in HDeadCodeElimination.

Removing a NullCheck or a BoundsCheck instruction may change
the behavior of a program.

Change-Id: Ib2c9beff0cc98c382210e7cc88b1fa9af3c61887
0279ebb3efd653e6bb255470c99d26949c7bcd95 09-Oct-2014 Ian Rogers <irogers@google.com> Tidy ELF builder.

Don't do "if (ptr)". Use const. Use DISALLOW_COPY_AND_ASSIGN. Avoid public
member variables.
Move ValueObject to base and use in ELF builder.
Tidy VectorOutputStream to not use non-const reference arguments.

Change-Id: I2c727c3fc61769c3726de7cfb68b2d6eb4477e53
360231a056e796c36ffe62348507e904dc9efb9b 08-Oct-2014 Nicolas Geoffray <ngeoffray@google.com> Fix code generation of materialized conditions.

Move the logic for knowing if a condition needs to be materialized
in an optimization pass (so that the information does not change
as a side effect of another optimization).

Also clean-up arm and x86_64 codegen:
- arm: ldr and str are for power-users when a constant is
in play. We should use LoadFromOffset and StoreToOffset.
- x86_64: fix misuses of movq instead of movl.

Change-Id: I01a03b91803624be2281a344a13ad5efbf4f3ef3
93445689c714e53cabf347da4321ecf3023e926c 06-Oct-2014 Roland Levillain <rpl@google.com> Fix and improve static evaluation of constant expressions.

- Fix the definition of art::HSub::Evaluate.
- Qualify Evaluate methods as OVERRIDE.
- Evaluate comparisons in a deterministic way: if a
comparison is true, always return 1 (instead of letting
the compiler return any non-null value).
- Better exercise static evaluation of constant expressions
in compiler/optimizing/constant_propagation_test.cc.

Change-Id: I13d0862e5f4eba1275016fb8c3c17e9aff54408b
740475d5f45b8caa2c3c6fc51e657ecf4f3547e5 29-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Fix a bug in the insertion of parallel move.

To make sure we do not connect interval siblings in the
same parallel move, I added a new field in MoveOperands
that tells for which instruction this move is for.
A parallel move should not contains moves for the same instructions.

The checks revealed a bug when connecting siblings, where
we would choose the wrong parallel move.

Change-Id: I70f27ec120886745c187071453c78da4c47c1dd2
9ebc72c99e6b703bda611d7c918c9cf3dfb43e55 25-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Make suspend checks note have side effects.

Also adjust gtests.

Change-Id: I5e1a3e53115812b45ec7f4b6f50ba468fa7ac6b1
5799fc0754da7ff2b50b472e05c65cd4ba32dda2 25-Sep-2014 Roland Levillain <rpl@google.com> Optimizing compiler: remove unnecessary `explicit' keywords.

Change-Id: I5927fd92d53308c81e14edbd6e7d1c943bfa085b
3c04974a90b0e03f4b509010bff49f0b2a3da57f 24-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Optimize suspend checks in optimizing compiler.

- Remove the ones added during graph build (they were added
for the baseline code generator).
- Emit them at loop back edges after phi moves, so that the test
can directly jump to the loop header.
- Fix x86 and x86_64 suspend check by using cmpw instead of cmpl.

Change-Id: I6fad5795a55705d86c9e1cb85bf5d63dadfafa2a
6b46923ff0197c95f1e7ea0bc730961df6725cc9 25-Sep-2014 Roland Levillain <rpl@google.com> Optimizing compiler: check inputs & uses definitions in CFG.

Ensure each input and each use of an instruction is defined
in a block of the control-flow graph.

Change-Id: If4a83b02825230329b0b4fd84255dcb7c3219684
18efde5017369e005f1e8bcd3bbfb04e85053640 22-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Fix code generation with materialized conditions.

Change-Id: I8630af3c13fc1950d3fa718d7488407b00898796
6b879ddc0959df1cec871f0d41f11cce35a11716 22-Sep-2014 Roland Levillain <rpl@google.com> Add loop- and phi-related checks in the optimizing compiler.

- Ensure the pre-header block is first in the list of
predecessors of a loop header.
- Ensure the loop header has only two predecessors and that
only the second one is the back edge.
- Ensure there is only one back edge per loop.
- Ensure the first input of a phi is not itself.
- Ensure the number of phi inputs is the same as the number
of its predecessors.
- Ensure phi input at index I either comes from the Ith
predecessor or from a block that dominates this
predecessor.

Change-Id: I4db5c68cfbc9b74d2d03125753d0143ece625378
724c96326dea6ec33287a0076279c136abb0208a 22-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Also remove environment links to removed instructions.

Change-Id: I505163fb8683269c7d3fe21b34df92337d244552
d31cf3d55a0847c018c4eaa2b349b8eea509de64 08-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> First optimization in new compiler: simple GVN.

Change-Id: Ibe0efa4e84fd020a53ded310a92e0b4363f91b12
c83d441a722f0afb510c9cd0e69e09d65652143c 18-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Fix a lint error and update a test after the phi fix.

Change-Id: I6e9ab2a8300c2493a8d3e93ab4ced3d7c9552fc5
556c3d193134f6461f3e1fe17c032b087c5931a0 18-Sep-2014 Roland Levillain <rpl@google.com> Initiate a constant propagation pass in the optimizing compiler.

- Perform constant folding on int and long additions and subtractions in
the optimizing compiler.
- Apply constant folding to conditions and comparisons.

Change-Id: Ic88783a3c975fda777c74c531e257fa777be42eb
b09aacb495dce2cb3e8469f056fdc2636ae393e6 17-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Small fixes to get the boot image compiled in debug mode.

Change-Id: Id697737a1bcfb87f407d707e2ddd4f50a77caf26
72bceff11a98cc1ecdb64a6fae16c521f99ec6a7 15-Sep-2014 Roland Levillain <rpl@google.com> Initiate a dead code elimination pass in the optimizing compiler.

Change-Id: Ie9db5d8e2c2c30e34145a0f7d2386b8ec58cfc4e
ccc07a9579c554443cd03a306ca9b4f943fd2a93 16-Sep-2014 Roland Levillain <rpl@google.com> Add CFG and SSA form checkers in the optimizing compiler.

Checks performed on control-flow graphs:
- Ensure that the predecessors and successors of a basic block are
consistent within a control-flow graph.
- Ensure basic blocks end with a branch instruction.
- Detect phi functions listed in non-phi instruction lists and vice
versa.
- Ensure a block's instructions (and phi functions) are associated
with this very block.

Checks performed on SSA form graphs:
- Ensure an instruction dominates all its uses.
- Ensure there are no critical edges.

Change-Id: I1c12b4a61ecf608682152c897980ababa7eca847
604c6e4764edb2fd244e9f47626868cda5644a7a 17-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Ensure the first predecessor of a loop is the pre header.

Note that the check in ssa_phi_elimination.cc was very defensive:
it does not affect the outcome of the algorithm whether the
loop phi takes itself as the first input.

It makes things consistent to always have the pre header as first
input.

Change-Id: Ic86248c1f38af67f7432782f6deefae1f4bf1ab6
e982f0b8e809cece6f460fa2d8df25873aa69de4 13-Aug-2014 Nicolas Geoffray <ngeoffray@google.com> Implement invoke virtual in optimizing compiler.

Also refactor 004 tests to make them work with both Quick and
Optimizing.

Change-Id: I87e275cb0ae0258fc3bb32b612140000b1d2adf8
fbc695f9b8e2084697e19c1355ab925f99f0d235 15-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Implement suspend checks in new compiler.""

This reverts commit 7e3652c45c30c1f2f840e6088e24e2db716eaea7.

Change-Id: Ib489440c34e41cba9e9e297054f9274f6e81a2d8
7e3652c45c30c1f2f840e6088e24e2db716eaea7 15-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Implement suspend checks in new compiler."

This reverts commit 6fbce029fba3ed5da6c36017754ed408e6bcb632.

Change-Id: Ia915c27873b021e658a10212e559095dfc91284e
6fbce029fba3ed5da6c36017754ed408e6bcb632 10-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Implement suspend checks in new compiler.

For simplicity, they are currently placed on all (dex-level)
back edges, and at method entry.

Change-Id: I6e833e244d559dd788c69727e22fe40aff5b3435
065bf77b43c39da315b974ea08a5ed25e9049681 03-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Add (simple) side effects flags and equality methods on nodes.

This is in preparation of doing GVN and LICM.

Change-Id: I43050ff846755f9387a62b893d548ecdb54e7e95
3946844c34ad965515f677084b07d663d70ad1b8 02-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Runtime support for the new stack maps for the opt compiler.

Now most of the methods supported by the compiler can be optimized,
instead of using the baseline.

Change-Id: I80ab36a34913fa4e7dd576c7bf55af63594dc1fa
3ac17fcce8773388512ce72cb491b202872ca1c1 07-Aug-2014 Nicolas Geoffray <ngeoffray@google.com> Fix SsaDeadPhiElimination in the presence of dependent phis.

This fixes the problem of having a dead loop phi taking as back-edge
input a phi that also has this loop phi as input. Walking backwards
does not solve the problem because the loop phi will be visited last.

Most of the time, dex removes dead locals like this.

Change-Id: I797198cf9c15f8faa6585cca157810e23aaa4940
3c7bb98698f77af10372cf31824d3bb115d9bf0f 23-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Implement array get and array put in optimizing.

Also fix a couple of assembler/disassembler issues.

Change-Id: I705c8572988c1a9c4df3172b304678529636d5f6
96f89a290eb67d7bf4b1636798fa28df14309cc7 11-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Add assembly operations with constants in optimizing compiler.

Change-Id: I5bcc35ab50d4457186effef5592a75d7f4e5b65f
e63db27db913f1a88e2095a1ee8239b2bb9124e8 16-Jul-2014 Ian Rogers <irogers@google.com> Break apart header files.

Create libart-gtest for common runtime and compiler gtest routines.
Rename CompilerCallbacksImpl that is quick compiler specific.
Rename trace clock source constants to not use the overloaded profiler term.

Change-Id: I4aac4bdc7e7850c68335f81e59a390133b54e933
ab032bc1ff57831106fdac6a91a136293609401f 15-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Fix a braino in the stack layout.

Also do some refactoring to have this code be just in CodeGenerator.

Change-Id: I88de109889138af8d60027973c12a64bee813cb7
e50383288a75244255d3ecedcc79ffe9caf774cb 04-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Support fields in optimizing compiler.

- Required support for temporaries, to be only used by baseline compiler.
- Also fixed a few invalid assumptions around locations and instructions
that don't need materialization. These instructions should not have an Out.

Change-Id: Idc4a30dd95dd18015137300d36bec55fc024cf62
7dc206a53a42a658f52d5cb0b7e79b47da370c9b 11-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Add two phi pruning phases.

Change-Id: Ic4f05e3df96970d78a6938b27cdf9b58ef3849b9
412f10cfed002ab617c78f2621d68446ca4dd8bd 19-Jun-2014 Nicolas Geoffray <ngeoffray@google.com> Support longs in the register allocator for x86_64.

Change-Id: I7fb6dfb761bc5cf9e5705682032855a0a70ca867
20dfc797dc631bf8d655dcf123f46f13332d3074 17-Jun-2014 Dave Allison <dallison@google.com> Add some more instruction support to optimizing compiler.

This adds a few more DEX instructions to the optimizing compiler's
builder (constants, moves, if_xx, etc).

Also:
* Changes the codegen for IF_XX instructions to use a condition
rather than comparing a value against 0.
* Fixes some instructions in the ARM disassembler.
* Fixes PushList and PopList in the thumb2 assembler.
* Switches the assembler for the optimizing compiler to thumb2
rather than ARM.

Change-Id: Iaafcd02243ccc5b03a054ef7a15285b84c06740f
86dbb9a12119273039ce272b41c809fa548b37b6 04-Jun-2014 Nicolas Geoffray <ngeoffray@google.com> Final CL to enable register allocation on x86.

This CL implements:
1) Resolution after allocation: connecting the locations
allocated to an interval within a block and between blocks.
2) Handling of fixed registers: some instructions require
inputs/output to be at a specific location, and the allocator
needs to deal with them in a special way.
3) ParallelMoveResolver::EmitNativeCode for x86.

Change-Id: I0da6bd7eb66877987148b87c3be6a983b4e3f858
ec7e4727e99aa1416398ac5a684f5024817a25c7 06-Jun-2014 Nicolas Geoffray <ngeoffray@google.com> Fix some bugs in graph construction/simplification methods.

Also fix a brano during SSA construction. The code should
not have been commented out. Added a test to cover what the code
intends.

Change-Id: Ia00ae79dcf75eb0d412f07649d73e7f94dbfb6f0
ffddfdf6fec0b9d98a692e27242eecb15af5ead2 03-Jun-2014 Tim Murray <timmurray@google.com> DO NOT MERGE

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
a7062e05e6048c7f817d784a5b94e3122e25b1ec 22-May-2014 Nicolas Geoffray <ngeoffray@google.com> Add a linear scan register allocator to the optimizing compiler.

This is a "by-the-book" implementation. It currently only deals
with allocating registers, with no hint optimizations.

The changes remaining to make it functional are:
- Allocate spill slots.
- Resolution and placements of Move instructions.
- Connect it to the code generator.

Change-Id: Ie0b2f6ba1b98da85425be721ce4afecd6b4012a4
4e3d23aa1523718ea1fdf3a32516d2f9d81e84fe 22-May-2014 Nicolas Geoffray <ngeoffray@google.com> Import Dart's parallel move resolver.

And write a few tests while at it.

A parallel move resolver will be needed for performing multiple moves
that are conceptually parallel, for example moves at a block
exit that branches to a block with phi nodes.

Change-Id: Ib95b247b4fc3f2c2fcab3b8c8d032abbd6104cd7
ddb311fdeca82ca628fed694c4702f463b5c4927 16-May-2014 Nicolas Geoffray <ngeoffray@google.com> Build live ranges in preparation for register allocation.

Change-Id: I7ae24afaa4e49276136bf34f4ba7d62db7f28c01
0d3f578909d0d1ea072ca68d78301b6fb7a44451 14-May-2014 Nicolas Geoffray <ngeoffray@google.com> Linearize the graph before creating live ranges.

Change-Id: I02eb5671e3304ab062286131745c1366448aff58
f635e63318447ca04731b265a86a573c9ed1737c 14-May-2014 Nicolas Geoffray <ngeoffray@google.com> Add a compilation tracing mechanism to the new compiler.

Code mostly imported from: https://android-review.googlesource.com/#/c/81653/.

Change-Id: I150fe942be0fb270e03fabb19032180f7a065d13
622d9c31febd950255b36a48b47e1f630197c5fe 12-May-2014 Nicolas Geoffray <ngeoffray@google.com> Add loop recognition and CFG simplifications in new compiler.

We do three simplifications:
- Split critical edges, for code generation from SSA (new).
- Ensure one back edge per loop, to simplify loop recognition (new).
- Ensure only one pre header for a loop, to simplify SSA creation (existing).

Change-Id: I9bfccd4b236a00486a261078627b091c8a68be33
804d09372cc3d80d537da1489da4a45e0e19aa5d 02-May-2014 Nicolas Geoffray <ngeoffray@google.com> Build live-in, live-out and kill sets for each block.

This information will be used when computing live ranges of
instructions.

Change-Id: I345ee833c1ccb4a8e725c7976453f6d58d350d74
c32e770f21540e4e9eda6dc7f770e745d33f1b9f 24-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Add a Transform to SSA phase to the optimizing compiler.

Change-Id: Ia9700756a0396d797a00b529896487d52c989329
db928fcc975b431d8a78700c11bd7da21090384a 16-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Simplify HInvokeStatic code generation.

HPushArgument is not needed for now (but might be when we start
optimizing). Also, calling convention for 64bits backend will
require to know more about the argument than the argument's
index. Therefore currently let HInvokeStatic setup the arguments,
which is possible because arguments of a calls are virtual registers
and not instructions.

Change-Id: I8753ed6083aa083c5180ab53b436dc8de4f1fe31
01bc96d007b67fdb7fe349232a83e4b354ce3d08 11-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Long support in optimizing compiler.

- Add stack locations to the Location class.
- Change logic of parameter passing/setup by setting the
location of such instructions the ones for the calling
convention.

Change-Id: I4730ad58732813dcb9c238f44f55dfc0baa18799
b55f835d66a61e5da6fc1895ba5a0482868c9552 07-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Test control flow instruction with optimizing compiler.

Add support for basic instructions to implement these tests.

Change-Id: I3870bf9301599043b3511522bb49dc6364c9b4c0
f583e5976e1de9aa206fb8de4f91000180685066 07-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Add support for taking parameters in optimizing compiler.

- Fix stack layout to mimic Quick's.
- Implement some sub operations.

Change-Id: I8cf75a4d29b662381a64f02c0bc61d859482fc4e
2e7038ac5848468740d6a419434d3dde8c585a53 03-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Add support for new-instance and invoke-direct.

Change-Id: I2daed646904f7711972a7da15d88be7573426932
4a34a428c6a2588e0857ef6baf88f1b73ce65958 03-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Support passing arguments to invoke-static* instructions.

- Stop using the frame pointer for accessing locals.
- Stop emulating a stack when doing code generation. Instead,
rely on dex register model, where instructions only reference
registers.

Change-Id: Id51bd7d33ac430cb87a53c9f4b0c864eeb1006f9
d8ee737fdbf380c5bb90c9270c8d1087ac23e76c 28-Mar-2014 Nicolas Geoffray <ngeoffray@google.com> Add support for adding two integers in optimizing compiler.

Change-Id: I5524e193cd07f2692a57c6b4f8069904471b2928
8ccc3f5d06fd217cdaabd37e743adab2031d3720 19-Mar-2014 Nicolas Geoffray <ngeoffray@google.com> Add support for invoke-static in optimizing compiler.

Support is limited to calls without parameters and returning
void. For simplicity, we currently follow the Quick ABI.

Change-Id: I54805161141b7eac5959f1cae0dc138dd0b2e8a5
787c3076635cf117eb646c5a89a9014b2072fb44 17-Mar-2014 Nicolas Geoffray <ngeoffray@google.com> Plug new optimizing compiler in compilation pipeline.

Also rename accessors to ART's conventions.

Change-Id: I344807055b98aa4b27215704ec362191464acecc
bab4ed7057799a4fadc6283108ab56f389d117d4 11-Mar-2014 Nicolas Geoffray <ngeoffray@google.com> More code generation for the optimizing compiler.

- Add HReturn instruction
- Generate code for locals/if/return
- Setup infrastructure for register allocation. Currently
emulate a stack.

Change-Id: Ib28c2dba80f6c526177ed9a7b09c0689ac8122fb
3ff386aafefd5282bb76c8a50506a70a4321e698 04-Mar-2014 Nicolas Geoffray <ngeoffray@google.com> Add register support to the optimizing compiler.

Also make if take an input and build the use list for instructions.

Change-Id: I1938cee7dce5bd4c66b259fa2b431d2c79b3cf82
d4dd255db1d110ceb5551f6d95ff31fb57420994 28-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Add codegen support to the optimizing compiler.

Change-Id: I9aae76908ff1d6e64fb71a6718fc1426b67a5c28
0e33643519b68a343a7466dcaba12b8567777cc3 26-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Move arena_bit_vector.h/cc to compiler/utils.

Also move MIR's BasicBlock related code from arena_bit_vector.h to
bit_vector_block_iterator.cc.

Change-Id: I85c224b387d31cf57a1ef1f1a36eaadf22f1c85d
be9a92aa804c0d210f80966b74ef8ed3987f335a 25-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Add conditional branches, and build dominator tree.

Change-Id: I4b151a07b72692961235a1419b54b6b45cf54e63
818f2107e6d2d9e80faac8ae8c92faffa83cbd11 18-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Re-apply: Initial check-in of an optimizing compiler.

The classes and the names are very much inspired by V8/Dart.
It currently only supports the RETURN_VOID dex instruction,
and there is a pretty printer to check if the building of the
graph is correct.

Change-Id: I28e125dfee86ae6ec9b3fec6aa1859523b92a893
1af0c0b88a956813eb0ad282664cedc391e2938f 19-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Initial check-in of an optimizing compiler."

g++ warnings turned into errors.

This reverts commit 68a5fefa90f03fdf5a238ac85c9439c6b03eae96.

Change-Id: I09bb95d9cc13764ca8a266c41af04801a34b9fd0
68a5fefa90f03fdf5a238ac85c9439c6b03eae96 18-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Initial check-in of an optimizing compiler.

The classes and the names are very much inspired by V8/Dart.
It currently only supports the RETURN_VOID dex instruction,
and there is a pretty printer to check if the building of the
graph is correct.

Change-Id: Id5ef1b317ab997010d4e3888e456c26bef1ab9c0