History log of /art/compiler/Android.mk
Revision Date Author Comments
dee58d6bb6d567fcd0c4f39d8d690c3acaf0e432 07-Apr-2016 David Brazdil <dbrazdil@google.com> Revert "Revert "Refactor HGraphBuilder and SsaBuilder to remove HLocals""

This patch merges the instruction-building phases from HGraphBuilder
and SsaBuilder into a single HInstructionBuilder class. As a result,
it is not necessary to generate HLocal, HLoadLocal and HStoreLocal
instructions any more, as the builder produces SSA form directly.

Saves 5-15% of arena-allocated memory (see bug for more data):
GMS 20.46MB => 19.26MB (-5.86%)
Maps 24.12MB => 21.47MB (-10.98%)
YouTube 28.60MB => 26.01MB (-9.05%)

This CL fixed an issue with parsing quickened instructions.

Bug: 27894376
Bug: 27998571
Bug: 27995065

Change-Id: I20dbe1bf2d0fe296377478db98cb86cba695e694
60328910cad396589474f8513391ba733d19390b 04-Apr-2016 David Brazdil <dbrazdil@google.com> Revert "Refactor HGraphBuilder and SsaBuilder to remove HLocals"

Bug: 27995065
This reverts commit e3ff7b293be2a6791fe9d135d660c0cffe4bd73f.

Change-Id: I5363c7ce18f47fd422c15eed5423a345a57249d8
e3ff7b293be2a6791fe9d135d660c0cffe4bd73f 02-Mar-2016 David Brazdil <dbrazdil@google.com> Refactor HGraphBuilder and SsaBuilder to remove HLocals

This patch merges the instruction-building phases from HGraphBuilder
and SsaBuilder into a single HInstructionBuilder class. As a result,
it is not necessary to generate HLocal, HLoadLocal and HStoreLocal
instructions any more, as the builder produces SSA form directly.

Saves 5-15% of arena-allocated memory (see bug for more data):
GMS 20.46MB => 19.26MB (-5.86%)
Maps 24.12MB => 21.47MB (-10.98%)
YouTube 28.60MB => 26.01MB (-9.05%)

Bug: 27894376
Change-Id: Iefe28d40600c169c5d306fd2c77034ae19476d90
86ea7eeabe30c98bbe1651a51d03cb89776724e7 16-Feb-2016 David Brazdil <dbrazdil@google.com> Build dominator tree before generating HInstructions

Second CL in the series of merging HGraphBuilder and SsaBuilder. This
patch refactors the builders so that dominator tree can be built
before any HInstructions are generated. This puts the SsaBuilder
removal of HLoadLocals/HStoreLocals straight after HGraphBuilder's
HInstruction generation phase. Next CL will therefore be able to
merge them.

This patch also adds util classes for iterating bytecode and switch
tables which allowed to simplify the code.

Bug: 27894376
Change-Id: Ic425d298b2e6e7980481ed697230b1a0b7904526
cac5a7e871f1f346b317894359ad06fa7bd67fba 22-Feb-2016 Vladimir Marko <vmarko@google.com> Optimizing: Improve const-string code generation.

For strings in the boot image, use either direct pointers
or pc-relative addresses. For other strings, use PC-relative
access to the dex cache arrays for AOT and direct address of
the string's dex cache slot for JIT.

For aosp_flounder-userdebug:
- 32-bit boot.oat: -692KiB (-0.9%)
- 64-bit boot.oat: -948KiB (-1.1%)
- 32-bit dalvik cache total: -900KiB (-0.9%)
- 64-bit dalvik cache total: -3672KiB (-1.5%)
(contains more files than the 32-bit dalvik cache)
For aosp_flounder-userdebug forced to compile PIC:
- 32-bit boot.oat: -380KiB (-0.5%)
- 64-bit boot.oat: -928KiB (-1.0%)
- 32-bit dalvik cache total: -468KiB (-0.4%)
- 64-bit dalvik cache total: -1928KiB (-0.8%)
(contains more files than the 32-bit dalvik cache)

Bug: 26884697
Change-Id: Iec7266ce67e6fedc107be78fab2e742a8dab2696
6a63bac062cac16656cc1ea649829888ae583825 17-Mar-2016 Ying Wang <wangying@google.com> Allow x86+arm multilib build.

The explicit dependency of dex2oat on installed file of libart-compiler
isn't necessary: the build sets up the dependency automatically when
dex2oat links liblibart-compiler.
Also the way of the explicit dependency is incorrect if multilib is
involved: a 64-bit dex2oat may depend on 32-bit libart-compiler.

Bug: 27526885
Change-Id: I4a9d72b49f5712695ff5a32b88df5eab9df7c1e4
(cherry-pick from commit 5eec66ea27a2fa5bfa1b4f9bd203c76e2990d7a2)
3c94f0945ed596ceee39783fa075f013b65e80a1 21-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Remove Quick from tree.

So long, old friend.

Change-Id: I0241c798a34b92bf994fed83888da67d6e7f1891
5eec66ea27a2fa5bfa1b4f9bd203c76e2990d7a2 17-Mar-2016 Ying Wang <wangying@google.com> Allow x86+arm multilib build.

The explicit dependency of dex2oat on installed file of libart-compiler
isn't necessary: the build sets up the dependency automatically when
dex2oat links liblibart-compiler.
Also the way of the explicit dependency is incorrect if multilib is
involved: a 64-bit dex2oat may depend on 32-bit libart-compiler.

Bug: 27526885
Change-Id: I4a9d72b49f5712695ff5a32b88df5eab9df7c1e4
07f6818ef68046d4749963b3bd59f7e93cf43fa9 10-Mar-2016 Vladimir Marko <vmarko@google.com> ART: Do not use vixld - workaround to fix dex2oatds.

This is a quick workaround for ODR violations caused
by linking libvixl.a compiled without VIXL_DEBUG with
the libartd-compiler.a compiled with VIXL_DEBUG.

Bug: 27588884
Change-Id: Ib1af165f177f125f03cdd99777dff4c2912f6405
4a0dad67867f389e01a5a6c0fe381d210f687c0d 25-Jan-2016 Artem Udovichenko <artem.u@samsung.com> Revert "Revert "ARM/ARM64: Extend support of instruction combining.""

This reverts commit 6b5afdd144d2bb3bf994240797834b5666b2cf98.

Change-Id: Ic27a10f02e21109503edd64e6d73d1bb0c6a8ac6
944da603cde59a4277f3bbc31d860a90842a1a2a 19-Feb-2016 Vladimir Marko <vmarko@google.com> ART: Allow method references across oat files for multi-image, 2nd attempt.

These were disabled because we didn't have sufficient
information about the multi-image layout when processing
link-time patches in OatWriter. This CL refactors the
ELF file creation so that the information is available.

Also clean up ImageWriter to use oat file indexes instead
of filenames and avoid reopening the oat file to retrieve
the checksum.

Change-Id: Icc7b528deca29da1e473c8f079521a36d6c4892f
024160850fbbf28368eae951beb4c72e2ce8fce6 23-Feb-2016 Calin Juravle <calin@google.com> Revert "Revert "Add profman tool: responsible to process profiles""

This reverts commit 3da74687e42de7d33a8e75df9bd64374e650f75e.

(cherry picked from commit 2e2db786b8fbaa4dceb37603a4296b0b2aea4e9e)

Change-Id: I38086cc9de939bad33bcd13b1677e1626af61c29
2e2db786b8fbaa4dceb37603a4296b0b2aea4e9e 23-Feb-2016 Calin Juravle <calin@google.com> Revert "Revert "Add profman tool: responsible to process profiles""

This reverts commit 3da74687e42de7d33a8e75df9bd64374e650f75e.

Change-Id: Id005096bd8063c6c602744d4476d5eb7e0d34e90
3da74687e42de7d33a8e75df9bd64374e650f75e 22-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Add profman tool: responsible to process profiles"

Needs a profile_assistant_test fix.

Bug: 26719109
Bug: 26563023

This reverts commit 6caefd983a800a063b219f1d3ed71b1416cecd70.

Change-Id: Ibdeb7385737dd7846ed861e0a95f083abb9aa974
6caefd983a800a063b219f1d3ed71b1416cecd70 01-Feb-2016 Calin Juravle <calin@google.com> Add profman tool: responsible to process profiles

This pulls out profile parsing from dex2oat into a separate tool.
Some additional refactoring:
- better return codes
- dex2oat now accepts only one profile file

This is the first step towards support secondary dex files and
extracting profiles out of the code_cache directory.

Bug: 26719109
Bug: 26563023

(cherry picked from commit d81c289e58f4ced8ec7674fd377c356669f97227)

Change-Id: I34d408faa318e866e1a23d4d04c369131ee5012b
d81c289e58f4ced8ec7674fd377c356669f97227 01-Feb-2016 Calin Juravle <calin@google.com> Add profman tool: responsible to process profiles

This pulls out profile parsing from dex2oat into a separate tool.
Some additional refactoring:
- better return codes
- dex2oat now accepts only one profile file

This is the first step towards support secondary dex files and
extracting profiles out of the code_cache directory.

Bug: 26719109
Bug: 26563023
Change-Id: I364dad7e3beb22ef71c372739d5bcc490ae23270
0c5b18edd1308975804ccf29a02a130a7b6f7fa7 06-Feb-2016 Mark Mendell <mark.p.mendell@intel.com> Support CMOV for x86 Select

If possible, generate CMOV to implement HSelect. Tricky cases are a
long or FP condition (no single CC generated), FP inputs (no FP CMOV)
and when the condition is a boolean or not emitted at the use site.
In these cases, keep using the existing HSelect code.

Change-Id: I4ff1e152b8ef126fbbabeb3316e9e2b6a6b74aeb
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
c5bfa97c47d656b76f297af8abcd5f7502987399 05-Feb-2016 David Srbecky <dsrbecky@google.com> Split elf_writer_debug.cc to several files.

Refactoring only. The file has grown significantly over time,
and it is time to split it so it can be better managed.

Change-Id: Idce0231718add722292f4701df353d5baf31de5f
4fda4eb799c95be266f52aaf3461a440ea86b841 05-Feb-2016 David Srbecky <dsrbecky@google.com> Move code related to debug info generation to its own directory.

debug/dwarf/ contains helper classes which hide the details
of the DWARF file format. It acts as independent DWARF library.

debug/ contains ART-specific code which generates ELF debug
sections (which includes non-DWARF sections like .symtab).

Change-Id: Id351f604e4e64be2ca395a78324ea02e30481497
74eb1b264691c4eb399d0858015a7fc13c476ac6 14-Dec-2015 David Brazdil <dbrazdil@google.com> ART: Implement HSelect

This patch adds a new HIR instruction to Optimizing. HSelect returns
one of two inputs based on the outcome of a condition.

This is only initial implementation which:
- defines the new instruction,
- repurposes BooleanSimplifier to emit it,
- extends InstructionSimplifier to statically resolve it,
- updates existing code and tests accordingly.

Code generators currently emit fallback if/then/else code and will be
updated in follow-up CLs to use platform-specific conditional moves
when possible.

Change-Id: Ib61b17146487ebe6b55350c2b589f0b971dcaaee
d112827911122ba6412fd90b8d8b9a9d6db9d513 25-Jan-2016 David Srbecky <dsrbecky@google.com> Add dependency on liblzma.

It will be needed for compression of debug information.

Change-Id: I77340a3b328aae08d82018f611615af9aebc5aca
8546cc9aeb05e866e1fb6a9e4130d53ea330baa8 25-Jan-2016 David Srbecky <dsrbecky@google.com> Revert "Add option to generate compressed backtrace info."

This reverts commit 5fdcc3c931b70204fd8c491afa66f57f8428490f.

Change-Id: I9c1f5aad6933a46af6717e3a90a51f76111f9c8a
5fdcc3c931b70204fd8c491afa66f57f8428490f 19-Jan-2016 David Srbecky <dsrbecky@google.com> Add option to generate compressed backtrace info.

Add flag --generate-mini-debug-info which generates
LZMA compressed .symtab and .debug_frame, which are
sufficient to print java backtraces in libunwind.

If enabled, it increases the size of boot.oat by about 3.5%.

Change-Id: Ic3c2ef7704c05fa328720c6781ca2a9b8e3935a3
6b5afdd144d2bb3bf994240797834b5666b2cf98 22-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "ARM/ARM64: Extend support of instruction combining."

The test fails its checker parts.

This reverts commit debeb98aaa8950caf1a19df490f2ac9bf563075b.

Change-Id: I49929e15950c7814da6c411ecd2b640d12de80df
debeb98aaa8950caf1a19df490f2ac9bf563075b 11-Dec-2015 Ilmir Usmanov <i.usmanov@samsung.com> ARM/ARM64: Extend support of instruction combining.

Combine multiply instructions in the following way:
ARM64:
MUL/NEG -> MNEG
ARM32 (32-bit integers only):
MUL/ADD -> MLA
MUL/SUB -> MLS

Change-Id: If20f2d8fb060145ab6fbceeb5a8f1a3d02e0ecdb
998c21661b5074c293cae818d0ab7c44dcda3a66 21-Dec-2015 Calin Juravle <calin@google.com> Perform profile file analysis in dex2oat

Dex2oat can accept now multiple profile files to drive a profile based
compilation. --profile-file and --reference-profile-file speficy a pair
of profile files which will be evaluated for significant differences
before starting the compilation. If the difference is insignificant
(according to some internal metric) the compilation is skipped and a
message is logged.

Multiple pairs of --profile-file and --reference-profile-file can be
specified. This effectively enables multi user support since profiles
for different users will be kept separately.

--reference-profile-file can be left out, case in which the decision is
solely based on --profile-file. If both flags are present, then their
repetition should form unique pairs.

If the compilation is performed and --reference-profile-file is given
then its data is merged with the data from the corresponding --profile-
file and saved back to the file.

If no profile flags are given, dex2oat proceeds as before and compiles
the dex files unconditionally.

As part of this change
- merge ProfileCompilationInfo and OfflineProfilingInfo under the same
object. There was no use to keep them separate anymore.
- SaveProfilingInfo now merges the data with what was in
the file before instead of overwriting it.

Bug: 26080105

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

This reverts commit 68289a531484d26214e09f1eadd9833531a3bc3c.

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

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

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

This reverts commit d9510dfc32349eeb4f2145c801f7ba1d5bccfb12.

Bug: 26208284

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

Change-Id: I5f491becdf076ff51d437d490405ec4e1586c010
d9510dfc32349eeb4f2145c801f7ba1d5bccfb12 05-Nov-2015 David Brazdil <dbrazdil@google.com> ART: Refactor SsaBuilder for more precise typing info

This patch refactors the SsaBuilder to do the following:

1) All phis are constructed live and marked dead if not used or proved
to be conflicting.

2) Primitive type propagation, now not a separate pass, identifies
conflicting types and marks corresponding phis dead.

3) When compiling --debuggable, DeadPhiHandling used to revive phis
which had only environmental uses but did not attempt to resolve
conflicts. This pass was removed as obsolete and is now superseded
by primitive type propagation (identifying conflicting phis) and
SsaDeadPhiEliminiation (keeping phis live if debuggable + env use).

4) Resolving conflicts requires correct primitive type information
on all instructions. This was not the case for ArrayGet instructions
which can have ambiguous types in the bytecode. To this end,
SsaBuilder now runs reference type propagation and types ArrayGets
from the type of the input array.

5) With RTP being run inside the SsaBuilder, it is not necessary to
run it as a separate optimization pass. Optimizations can now assume
that all instructions of type kPrimNot have reference type info after
SsaBuilder (with the exception of NullConstant).

6) Graph now contains a reference type to be assigned to NullConstant.
All reference type instructions therefore have RTI, as now enforced
by the SsaChecker.

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

Change-Id: I7a3aee1ff66c82d64b4846611c547af17e91d260
ceb07b3285eaab350a8cd12f7d74be3e40a255dd 10-Dec-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Add support for LZ4 compressed image files""

Needed to call compiler_driver_->SetSupportBootImageFixup(false).

Bug: 22858531

This reverts commit 83d4d72aa0e4170209ab50c67ba22e46b71352c1.

Change-Id: Iaed6a810a0c088f1f2c57cf2f12087f3978a3de1
83d4d72aa0e4170209ab50c67ba22e46b71352c1 10-Dec-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Add support for LZ4 compressed image files"

Tentative. Looks like it breaks image_test for hammerhead:
art/compiler/linker/arm/relative_patcher_thumb2.cc:36] Check failed: target_offset & 1u == 1u (target_offset & 1u=0, 1u=1)

Bug: 22858531

This reverts commit c6f41b5b3ca3d7ac3c12ad3995ffef4e831973a0.

Change-Id: I9bc5738a8b5c8f8bc8b73309f9420fd691bc79a9
c6f41b5b3ca3d7ac3c12ad3995ffef4e831973a0 05-Dec-2015 Mathieu Chartier <mathieuc@google.com> Add support for LZ4 compressed image files

Added dex2oat option --image-format=(store|lz4). Using lz4 means
that the main image section (all data other than header and bitmap)
are stored in a compressed state.

N5 results:
Boot image size: 8067128 -> 2827605
Decompression time 18.93ms
Decompression rate: 426MB/s

Patchoat is not currently supported since it maps the source image
directly. In order to support compressed images we would need to
recompress the output image and then write it back out to a file.
Also there are not many cases where we would want to patch a
compressed image since they are going to be dirty memory when
uncompressed anyways. Might as well just patch as we are loading.

Bug: 22858531

Change-Id: I8c54ccf73408273011161a61bb891736735074d9
131980fc9aeb2b4d03480443e0fb494c76ce03a2 03-Dec-2015 Vladimir Marko <vmarko@google.com> Add ElfWriter::GetStream().

This will be used for writing the OatHeader which is
currently oddly written through the .text stream.

Also move the error delaying output stream out of the
ElfBuilder<> to its own file and move all output stream
files to compiler/linker/.

Change-Id: I00db4e33ed80ac4757ec459946c7b5ae014a3a2e
b4536b7de576b20c74c612406c5d3132998075ef 24-Nov-2015 Vladimir Marko <vmarko@google.com> Optimizing/ARM: Implement kDexCachePcRelative dispatch.

Change-Id: I0fe2da50a30a3f62bec8ea01688dd1fec84b1831
8626b741716390a0119ffeb88b5b9fcf08e13010 25-Nov-2015 Alexandre Rames <alexandre.rames@linaro.org> ARM64: Use the shifter operands.

This introduces architecture-specific instruction simplification.
On ARM64 we try to merge shifts and sign-extension operations into
arithmetic and logical instructions.

For example for the Java code

int res = a + (b << 5);

we would generate

lsl w3, w2, #5
add w0, w1, w3

and we now generate

add w0, w1, w2, lsl #5

Change-Id: Ic03bdff44a1c12e21ddff1b0513bd32a730742b7
a0e87b0a97fadd54540ec7e8331b61bebd82d378 25-Sep-2015 Alexey Frunze <Alexey.Frunze@imgtec.com> MIPS64: Support short and long branches

Change-Id: I618c960bd211048166d9fde78d4106bd3ca42b3a
0f7dca4ca0be8d2f8776794d35edf8b51b5bc997 02-Nov-2015 Vladimir Marko <vmarko@google.com> Optimizing/X86: PC-relative dex cache array addressing.

Add PC-relative dex cache array addressing for X86 and use
it for better invoke-static/-direct dispatch. Also delay
the initialization to the PC-relative base until needed.

Change-Id: Ib8634d5edce4920cd70172fd13211809cf6948d1
701566aaae098d5aab9d912e2003a18d44fb850d 27-Oct-2015 Chris Larsen <chris.larsen@imgtec.com> MIPS32: Create infrastructure to support intrinsics

Add an empty intrinisics implementation for MIPS32.

Change-Id: I3f46ade1c548e6453f094ce200e66232348ef467
35831e8bfa1c0944d4c978d99c4c5b9577945170 11-Sep-2015 Vladimir Marko <vmarko@google.com> Reduce memory used by CompiledMethods.

Use LengthPrefixedArray<>s instead of SwapVector<>s to store
CompiledMethod data and get rid of the unnecessary members
of CompiledMethod to reduce dex2oat memory usage. Refactor
the deduplication from CompilerDriver to a new class.

Use HashSet<> instead of std::set<> for the DedupeSet<> to
further decrease the memory usage and improve performance.

This reduces the dex2oat memory usage when compiling boot
image on Nexus 5 (with Optimizing, -j1) by ~6.75MiB (5%).
This also reduces the compile time by ~2.2% (~1.6% dex2oat
time; with Optimizing, without -j).

Change-Id: I974f1f5e58350de2bf487a2bca3907fa05fb80ea
e5d80f83ae53792bc1eebd4e33e4e99f7c031b0c 16-Oct-2015 Mathieu Chartier <mathieuc@google.com> Move ArenaBitVector into the runtime

Motivation is using arenas in the verifier.

Bug: 10921004
Change-Id: I3c7ed369194b2309a47b12a621e897e0f2f65fcf
dc151b2346bb8a4fdeed0c06e54c2fca21d59b5d 15-Oct-2015 Vladimir Marko <vmarko@google.com> Optimizing: Determine invoke-static/-direct dispatch early.

Determine the dispatch type of invoke-static/-direct in a
special pass right after the type inference. This allows the
inliner to pass the "needs dex cache" check and inline more.
It also allows the code generator to avoid requesting a
register location for the ArtMethod* for kDexCachePcRelative
and direct methods.

The supported dispatch check handles also situations that
the CompilerDriver currently doesn't allow. The cleanup of
the CompilerDriver and required changes to Quick will come
in a separate change.

Change-Id: I3f8e903a119949e95871d8ab0a995f4731a13a07
8df69d42a9e3ccd9456ff72fac8dbd1999f98755 23-Oct-2015 Mingyao Yang <mingyao@google.com> Revert "Revert "load store elimination.""

This reverts commit 8030c4100d2586fac39ed4007c61ee91d4ea4f25.

Change-Id: I79558d85484be5f5d04e4a44bea7201fece440f0
f652cecb984c104d44a0223c3c98400ef8ed8ce2 25-Aug-2015 Goran Jakovljevic <Goran.Jakovljevic@imgtec.com> MIPS: Initial version of optimizing compiler for MIPS32

Change-Id: I370388e8d5de52c7001552b513877ef5833aa621
8030c4100d2586fac39ed4007c61ee91d4ea4f25 15-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "load store elimination."

Breaks libcore tests:

libcore.java.lang.ref.FinalizeTest#testWatchdogDoesNotFailForObjectsThatAreNearTheDeadline
libcore.java.util.ResourceLeakageDetectorTest#testDetectsUnclosedCloseGuard
org.apache.harmony.tests.java.lang.ref.ReferenceTest#test_finalizeReferenceInteraction

This reverts commit 589dac7f0ce078d19aad7e35bb0195c47ddf01d2.

Change-Id: I55115765c10762d5bc152d3425e4622560d8b9f4
589dac7f0ce078d19aad7e35bb0195c47ddf01d2 24-Aug-2015 Mingyao Yang <mingyao@google.com> load store elimination.

This adds a pass to eliminate some unnecessary heap loads/stores. It
first collects heap locations and then tracks values stored to those heap
locations. Alias analysis is done based on offset, type, singleton,
pre-existence, etc.

Change-Id: I11a9d8ef20d1b2f245607eb25118e9aff9be472a
94991077ed66e3c329e8bf6f594ad6d30992b092 06-Oct-2015 Mark Mendell <mark.p.mendell@intel.com> Move x86 constant area code to its own file

Move the logic to constant_area_fixups_x86.cc to keep the graph
modifications out of the code generation file.

Change-Id: I476f1fce80cb4ad38ae872b620ae58f6e52fe664
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
8c434dcc78d497e18590461700894d1c3e96013d 26-Aug-2015 Goran Jakovljevic <Goran.Jakovljevic@imgtec.com> MIPS: Assemblers changes needed for optimizing compiler

Also add assembler tests for MIPS32.

Change-Id: I3ab1fba7f3b06eb3b5058861946d675494a30775
3039e381b79ac1ef01c420511f6629f639d40ab4 26-Aug-2015 Chris Larsen <chris.larsen@imgtec.com> MIPS64: Implement miscellaneous bit manipulation intrinsics

// java.lang.Double
- doubleToRawLongBits(double) - longBitsToDouble(long)

// java.lang.Float
- floatToRawIntBits(float) - intBitsToFloat(int)

// java.lang.Integer
- numberOfLeadingZeros(int) - reverseBytes(int)
- reverse(int)

// java.lang.Long
- numberOfLeadingZeros(long) - reverseBytes(long)
- reverse(long)

// java.lang.Short
- reverseBytes(short)

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

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

Change-Id: If5555a173fd5d55d147c63138ef51fc296fa1414
30efb4e00c2a9aa318d44486b5eacaa7178d20ef 30-Jul-2015 Aart Bik <ajcbik@google.com> Induction variable analysis (with unit tests).

Rationale:
Induction variable analysis forms the basis of a wide
variety of compiler optimizations. This implementation
finds induction variables using the elegant SSA-based
algorithm defined by [Gerlek et al.].

Change-Id: I79b8dce33ffb8b283c179699a8dff5bd196f75b2
44b9cf937836bb33139123e15ca8b586b5853268 19-Aug-2015 Alexandre Rames <alexandre.rames@linaro.org> Put in place the ARM64 instruction simplification framework.

This commit introduces and runs the empty InstructionSimplifierArm64
pass. Further commits will introduce arm64-specific transformations in
that pass.

Change-Id: I458f8a2b15470297b87fc1f7ff85bd52155d93ef
50fa993d67f8a20322c27c1a77e7efcf826531fc 11-Aug-2015 Alex Light <allight@google.com> Svelter libart-compiler

Added new environment variable ART_{TARGET,HOST}_CODEGEN_ARCHS which
may be set to 'all', 'svelte' or a space separated list of architectures.

When compiled with ART_{TARGET,HOST}_CODEGEN_ARCHS='all' (the default
value) dex2oat will be able to generate output for all supported
architectures.

When compiled with ART_TARGET_CODEGEN_ARCHS='svelte'
only the architectures of the TARGET will be included. When
ART_HOST_CODEGEN_ARCHS='svelte' all architectures the target includes
and the host architectures will be included on the host dex2oat.

If a list of architectures is given only those will be included.

Change-Id: I87f4ad0131ab1b37544d8799e947ce4733b6daec
5eb0d38dabda4d17a315c557f07f457308d28fa7 23-Jul-2015 Andreas Gampe <agampe@google.com> ART: Wire up DexToDexCompiler without extern

The extern declaration actually had the wrong signature, a parameter
was missing, and we never noticed.

Remove the function field and extern. Add a header for the compiler.
Use the header file.

Change-Id: Ia4d4dd86211da6045709a45c7bf8430471d1b62b
65e069df6f864102b062fc04de8877f8230034a8 08-Jun-2015 Calin Juravle <calin@google.com> Build statically linked version of dex2oat.

Change-Id: Icde39b770781095af7bd87ae6b907ad97a8a05da
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>
eb7b7399dbdb5e471b8ae00a567bf4f19edd3907 19-Jun-2015 Alexandre Rames <alexandre.rames@linaro.org> Opt compiler: Add disassembly to the '.cfg' output.

This is automatically added to the '.cfg' output when using the usual
`--dump-cfg` option.

Change-Id: I864bfc3a8299c042e72e451cc7730ad8271e4deb
4dda3376b71209fae07f5c3c8ac3eb4b54207aa8 02-Jun-2015 Alexey Frunze <Alexey.Frunze@imgtec.com> MIPS: Initial version of optimizing compiler for MIPS64R6.

Bug: 21555893
Change-Id: I874dc356eee6ab061a32f8f3df5f8ac3a4ab7dcf
Signed-off-by: Alexey Frunze <Alexey.Frunze@imgtec.com>
Signed-off-by: Douglas Leung <douglas.leung@imgtec.com>
12bd7210bb2f5738e33dfa3f2f1cba2e0aab4955 04-Jun-2015 Roland Levillain <rpl@google.com> If heap poisoning is on, pass the relevant flag to LOCAL_ASFLAGS.

This change ensures assembly files honoring heap poisoning
(notably used by stub_test) are compiled with
-DART_HEAP_POISONING=1 when this feature is turned on.

Bug: 21621105
Change-Id: I13fe456cd2733a09bdfd3a9808cfd70513b14698
c416d3359179b0ec6152104db8240f4d11c54bc7 23-Apr-2015 Calin Juravle <calin@google.com> Move stack map stream implementation to its own cc file.

It's big enough now to separate the implementation from the header.

It also enables faster compilation time for experiments.

Change-Id: Ica0c72994d5e461c62c32628010f46f9e5c46b57
c91df2d6339dd4adf2da582372451df19ce2ff44 23-Apr-2015 Vladimir Marko <vmarko@google.com> Revert "Revert "Quick: Rewrite type inference pass.""

Fix the type of the ArtMethod* SSA register.

Bug: 19419671
This reverts commit 1b717f63847de8762e7f7bdd6708fdfae9d24a67.

Change-Id: Ie4da3c03a0e0334a39a24718f6dc31f9255cfb53
1b717f63847de8762e7f7bdd6708fdfae9d24a67 23-Apr-2015 Andreas Gampe <agampe@google.com> Revert "Quick: Rewrite type inference pass."

Breaks arm64, as the method register is not correctly flagged
as ref and thus 32bit.

Bug: 19419671
This reverts commit e490b01c12d33f3bd5c247b55b47e507cc9c8fab.
e490b01c12d33f3bd5c247b55b47e507cc9c8fab 24-Feb-2015 Vladimir Marko <vmarko@google.com> Quick: Rewrite type inference pass.

Use method signatures, field types and types embedded in dex
insns for type inference. Perform the type inference in two
phases, first a simple pass that records all types implied
by individual insns, and then an iterative pass to propagate
those types further via phi, move, if-cc and aget/aput insns.

Bug: 19419671
Change-Id: Id38579d48a44fc5eadd13780afb6d370093056f9
3b9d57ab580a0593635a7dbe3dd2e2c76274f9fa 10-Apr-2015 David Srbecky <dsrbecky@google.com> Move DWARF related code in ElfWriter to its own file.

This is purely for organisation. The DWARF related code
is becoming more complex and I do not want to keep mixing
it with the ElfWriter. The ElfWriter probably should not
be dealing with the fine details of DWARF generation.

I intend to do much more work on DWARF in the future so
this situatuion would only get worse as the code grows.

The code could also use some refactoring and splitting.
However, I have mostly just moved it in this CL.

Change-Id: I6e3401a2b745ddf991b440ad7899ad7d4b921be6
0f88e87085b7cf6544dadff3f555773966a6853e 30-Mar-2015 Guillaume Sanchez <guillaumesa@google.com> Speedup div/rem by constants on x86 and x86_64

This is done using the algorithms in Hacker's Delight chapter 10.

Change-Id: I7bacefe10067569769ed31a1f7834f796fb41119
1109fb3cacc8bb667979780c2b4b12ce5bb64549 07-Apr-2015 David Srbecky <dsrbecky@google.com> Implement CFI for Quick.

CFI is necessary for stack unwinding in gdb, lldb, and libunwind.

Change-Id: Ic3b84c9dc91c4bae80e27cda02190f3274e95ae8
8c57831b2b07185ee1986b9af68a351e1ca584c3 07-Apr-2015 David Srbecky <dsrbecky@google.com> Remove the old CFI infrastructure.

Change-Id: I12a17a8a1c39ffccaa499c328ebac36e4d74dc4e
b163bb742a099c1808907b513ae39068b63b1692 31-Mar-2015 Vladimir Marko <vmarko@google.com> Refactor RelativePatcher out of OatWriter.

Move the relative patcher classes to compiler/linker/ and
compiler/linker/<arch>/ . Refactor them to avoid OatWriter
dependency so that they can be unit tested. Add tests for
x86 and x86-64.

Change-Id: I1b42baa9fc431378e4cce1399bec590c5b5a409f
1095793154d2ff33323ba9edaa4f83373bdb6c8e 24-Mar-2015 Goran Jakovljevic <Goran.Jakovljevic@imgtec.com> [MIPS] Refactoring code for quick compiler

Code from compiler/dex/quick/mips64 is merged with code
in mips folder.

Change-Id: I785983c21549141306484647da86a0bb4815daaa
09ed1a3125849ec6ac07cb886e3c502e1dcfada2 25-Mar-2015 Mark Mendell <mark.p.mendell@intel.com> [optimizing] Implement X86 intrinsic support

Implement the supported intrinsics for X86.

Enhance the graph visualizer to print <U> for unallocated locations, to
allow calling the graph dumper from within register allocation for
debugging purposes.

Change-Id: I3b0319eb70a9a4ea228f67065b4c52d13a1ae775
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
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
6ea651f0f4c7de4580beb2e887d86802c1ae0738 24-Feb-2015 Maja Gagic <maja.gagic@imgtec.com> Initial support for quick compiler on MIPS64r6.

Change-Id: I6f43027b84e4a98ea320cddb972d9cf39bf7c4f8
e5f13e57ff8fa36342beb33830b3ec5942a61cca 24-Feb-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Add JIT""

Added missing EntryPointToCodePointer.

This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399.

Change-Id: Ia74df0ef3a7babbdcb0466fd24da28e304e3f5af
a5ca888d715cd0c6c421313211caa1928be3e399 24-Feb-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Add JIT"

Sorry, run-test crashes on target:
0-05 12:15:51.633 I/DEBUG (27995): Abort message: 'art/runtime/mirror/art_method.cc:349] Check failed: PcIsWithinQuickCode(reinterpret_cast<uintptr_t>(code), pc) java.lang.Throwable java.lang.Throwable.fillInStackTrace() pc=71e3366b code=0x71e3362d size=ad000000'
10-05 12:15:51.633 I/DEBUG (27995): r0 00000000 r1 0000542b r2 00000006 r3 00000000
10-05 12:15:51.633 I/DEBUG (27995): r4 00000006 r5 b6f9addc r6 00000002 r7 0000010c
10-05 12:15:51.633 I/DEBUG (27995): r8 b63fe1e8 r9 be8e1418 sl b6427400 fp b63fcce0
10-05 12:15:51.633 I/DEBUG (27995): ip 0000542b sp be8e1358 lr b6e9a27b pc b6e9c280 cpsr 40070010
10-05 12:15:51.633 I/DEBUG (27995):

Bug: 17950037
This reverts commit 2535abe7d1fcdd0e6aca782b1f1932a703ed50a4.

Change-Id: I6f88849bc6f2befed0c0aaa0b7b2a08c967a83c3
2535abe7d1fcdd0e6aca782b1f1932a703ed50a4 17-Feb-2015 Mathieu Chartier <mathieuc@google.com> Add JIT

Currently disabled by default unless -Xjit is passed in.

The proposed JIT is a method JIT which works by utilizing interpreter
instrumentation to request compilation of hot methods async during
runtime.

JIT options:
-Xjit / -Xnojit
-Xjitcodecachesize:N
-Xjitthreshold:integervalue

The JIT has a shared copy of a compiler driver which is accessed
by worker threads to compile individual methods.

Added JIT code cache and data cache, currently sized at 2 MB
capacity by default. Most apps will only fill a small fraction of
this cache however.

Added support to the compiler for compiling interpreter quickened
byte codes.

Added test target ART_TEST_JIT=TRUE and --jit for run-test.

TODO:
Clean up code cache.
Delete compiled methods after they are added to code cache.
Add more optimizations related to runtime checks e.g. direct pointers
for invokes.
Add method recompilation.
Move instrumentation to DexFile to improve performance and reduce
memory usage.

Bug: 17950037

Change-Id: Ifa5b2684a2d5059ec5a5210733900aafa3c51bca
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
7a01dc2107d4255b445c32867d15d45fcebb3acd 02-Jan-2015 Vladimir Marko <vmarko@google.com> Dead code elimination based on GVN results.

Change-Id: I5b77411a8f088f0b561da14b123cf6b0501c9db5
2bcf9bf784a0021630d8fe63d7230d46d6891780 29-Jan-2015 Andreas Gampe <agampe@google.com> ART: Arm intrinsics for Optimizing compiler

Add arm32 intrinsics to the optimizing compiler.

Change-Id: If4aeedbf560862074d8ee08ca4484b666d6b9bf0
31fb26054349db03b3f1627fe975ed099ade69dd 01-Oct-2014 Dan Albert <danalbert@google.com> Add options for building/testing with coverage.

acov --clean
mm -B NATIVE_COVERAGE=true ART_COVERAGE=true test-art-host
acov --host

-B is needed because you need to be sure you rebuild *all* of ART with
coverage.

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

Change-Id: I9c8afb0a58ef45e568576015473cbfd5f011c242
f36df544d421aa60fc4cf8a5db6356b45f97953b 29-Jan-2015 Dan Albert <danalbert@google.com> Remove libcxx.mk cruft.

This is on by default now. No need to leave it in the makefiles.

Change-Id: I20eab7426da4bbbf8b70ffc5b9af7b97487d885d
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
5bdab12d8b48ca4c395d9d2c506ebff0df01b734 27-Jan-2015 Mathieu Chartier <mathieuc@google.com> Clean up pass driver

Added pass manager to hold the state which used to be in global
variables.

Static variables caused issues with Runtime.exit since they are
destroyed by the global destructors while threads are still
executing.

Bug: 17950037
Change-Id: Ie0e4546dc9e48909c8df996a5c135be682d50044
878d58cbaf6b17a9e3dcab790754527f3ebc69e5 16-Jan-2015 Andreas Gampe <agampe@google.com> ART: Arm64 optimizing compiler intrinsics

Implement most intrinsics for the optimizing compiler for Arm64.

Change-Id: Idb459be09f0524cb9aeab7a5c7fccb1c6b65a707
0e92f4fa0079dad6d1df69abd13054a9885cba98 27-Jan-2015 Andreas Gampe <agampe@google.com> ART: More Quick cleanup

Remove frontend, move code to QuickCompiler.

Fix some includes.

Change-Id: Iedd8f339ec76635e48b166e285f7fc571fc948ac
827eedbfa882496407375f22b08243a38a5bd53b 26-Jan-2015 Nicolas Geoffray <ngeoffray@google.com> Move code around and address growable_array comment.

- Move SideEffectsAnalysis to its own file.
- Move most of gvn.h to gvn.cc.
- Don't call Resize in GrowableArray constructor, but just set num_used
directly.

Change-Id: I1f1291207945d678d3c99cc0ec1ec155bcae82f6
57b34294758e9c00993913ebe43c7ee4698a5cc6 15-Jan-2015 Andreas Gampe <agampe@google.com> ART: Allow to compile interpret-only mips64 files

Include enough infrastructure to allow cross-compiling for mips64,
interpret-only. This includes the instruction-set-features, frame
size info and utils assembler.

Also add a disassembler for oatdump, and support in patchoat.

Note: the runtime cannot run mips64, yet.

Change-Id: Id106581fa76b478984741c62a8a03be0f370d992
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
e21dc3db191df04c100620965bee4617b3b24397 09-Dec-2014 Andreas Gampe <agampe@google.com> ART: Swap-space in the compiler

Introduce a swap-space and corresponding allocator to transparently
switch native allocations to memory backed by a file.

Bug: 18596910

(cherry picked from commit 62746d8d9c4400e4764f162b22bfb1a32be287a9)

Change-Id: I131448f3907115054a592af73db86d2b9257ea33
62746d8d9c4400e4764f162b22bfb1a32be287a9 09-Dec-2014 Andreas Gampe <agampe@google.com> ART: Swap-space in the compiler

Introduce a swap-space and corresponding allocator to transparently
switch native allocations to memory backed by a file.

Bug: 18596910
Change-Id: I131448f3907115054a592af73db86d2b9257ea33
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
956af0f0cb05422e38c1d22cbef309d16b8a1a12 11-Dec-2014 Elliott Hughes <enh@google.com> Remove portable.

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

Change-Id: Ia0d6a4226c1f9f1ff1dd35347a38db1dc4265319
32f5b4d2c8c9b52e9522941c159577b21752d0fa 25-Nov-2014 Serban Constantinescu <serban.constantinescu@arm.com> Vixl: Update the VIXL interface to VIXL 1.7 and enable VIXL debug.

This patch updates the interface to VIXL 1.7 and enables the debug version of
VIXL when ART is built in debug mode.

Change-Id: I443fb941bec3cffefba7038f93bb972e6b7d8db5
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
af6925b7fe5dc5a3c8d52ee3370e86e75400f873 31-Oct-2014 Vladimir Marko <vmarko@google.com> Rewrite GVN's field id and field type handling.

Create a helper unit for dex insn classification and cache
dex field type (as encoded in the insn) in the MirFieldInfo.
Use this for cleanup and a few additional DCHECKs.

Change the GVN's field id to match the field lowering info
index (MIR::meta::{i,s}field_lowering_info), except where
multiple indexes refer to the same field and we use the
lowest of the applicable indexes. Use the MirMethodInfo from
MIRGraph to retrieve field type for GVN using this index.
This slightly reduces GVN compilation time and prepares for
further compilation time improvements.

Change-Id: I1b1247cdb8e8b6897254e2180f3230f10159bed5
6c36a8bc6c514664ad91ce377df33de839342a8d 13-Nov-2014 Dehao Chen <dehao@google.com> Restrict FDO to only apply to target build.

Change-Id: I0ef4199b34c123a17eaf2c2f18bc8a1496e03cf8
f5b4c50f52d1bde054deee33a8ef6fa18a0eff33 15-Nov-2014 Igor Murashkin <iam@google.com> dex2oat: Pack likely-dirty objects together when generating the boot image

This introduces a new algorithm into image writer which "bins" objects
by how likely they are to be dirtied at runtime. Objects in the same bin
are placed contiguously in memory (i.e. into the same page). We try to
tune the bin selection based on how clean or how dirty the object will
likely be at runtime.

As-is, this saves about 150KB per-process (private-dirty pages) and 700KB in
zygote (shared-dirty).

There is still about 800KB of objects that are clean but located in
dirty pages, so with more analysis we can tune the bin selection and get
even more memory savings.

(cherry picked from commit 3f735bd4f9d09a0f9b2b01321e4c6917879dcae6)

Bug: 17611661
Change-Id: Ia1455e4c56ffd0a36ae2a723d35b7e06502980f7
847c8db052fcb3c1a945a8206547c409d3eb06fc 17-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Arm64: Use the debug version of VIXL for debug builds."

This reverts commit 195c576fbff290d4c313b67ed24ca36f2531acc4.

Change-Id: Id992a43ae346bb4c38a6c47639b02aea838d974a
195c576fbff290d4c313b67ed24ca36f2531acc4 13-Nov-2014 Serban Constantinescu <serban.constantinescu@arm.com> Arm64: Use the debug version of VIXL for debug builds.

This patch builds the debug version of ART against VIXL debug. In this
way VIXL will assert misuses of the assembler and disassembler.

Change-Id: Ic4654eb20e420f23b40e96a69be452dc50770c1c
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
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
99f84c410a23c0aa280976b9f75fc22eccab9fb5 30-Oct-2014 Ian Rogers <irogers@google.com> Remove bogus compiler flag from libart-compiler.

Change-Id: I2e2c555cb80c745e3d9859b88f16491ea146b38f
872dd8208f00c667af8d9e0fd07fdd0ada56d437 30-Oct-2014 Ian Rogers <irogers@google.com> Tidy and reduce ART library dependencies on the host.

Move to shared rather than static libraries. Avoids capture of all static
libraries library dependencies.

Change-Id: I2be96e92dad4ed1842d76b044745f2a2e15372eb
5319defdf502fc4569316473846b83180ec08035 23-Oct-2014 Alexandre Rames <alexandre.rames@arm.com> ART: optimizing compiler: initial support for ARM64.

The ARM64 port uses VIXL for code generation, to which it defers work
like label binding and branch resolving, register type coherency
checking, and immediate values handling.

Change-Id: I0a44508c0c991f472a63e67b3469cdd878fe1a68
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Signed-off-by: Alexandre Rames <alexandre.rames@arm.com>
75be28332b278cff9039b54bfb228ac72f539ccc 17-Oct-2014 Roland Levillain <rpl@google.com> Revert "Revert "Introduce a class to implement optimization passes.""

This reverts commit 1ddbf6d4b37979a9f11a203c12befd5ae8b65df4.

Change-Id: I110a14668d1564ee0604dc958b91394b40da89fc
677cd61ad05d993c4d3b22656675874f06d6aabc 15-Oct-2014 Ian Rogers <irogers@google.com> Make ART compile with GCC -O0 again.

Tidy up InstructionSetFeatures so that it has a type hierarchy dependent on
architecture.
Add to instruction_set_test to warn when InstructionSetFeatures don't agree
with ones from system properties, AT_HWCAP and /proc/cpuinfo.
Clean-up class linker entry point logic to not return entry points but to
test whether the passed code is the particular entrypoint. This works around
image trampolines that replicate entrypoints.
Bug: 17993736

(cherry picked from commit 6f3dbbadf4ce66982eb3d400e0a74cb73eb034f3)

Change-Id: I3e7595f437db4828072589d475a5453b7f31003e
6f3dbbadf4ce66982eb3d400e0a74cb73eb034f3 15-Oct-2014 Ian Rogers <irogers@google.com> Make ART compile with GCC -O0 again.

Tidy up InstructionSetFeatures so that it has a type hierarchy dependent on
architecture.
Add to instruction_set_test to warn when InstructionSetFeatures don't agree
with ones from system properties, AT_HWCAP and /proc/cpuinfo.
Clean-up class linker entry point logic to not return entry points but to
test whether the passed code is the particular entrypoint. This works around
image trampolines that replicate entrypoints.
Bug: 17993736

Change-Id: I5f4b49e88c3b02a79f9bee04f83395146ed7be23
26a25ef62a13f409f941aa39825a51b4d6f0f047 30-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Add a prepare for register allocation pass.

- Currently the pass just changes the uses of checks to the
actual values.
- Also optimize array access, now that inputs can be constants.
- And fix another bug in the register allocator reveiled by
this change.

Change-Id: I43be0dbde9330ee5c8f9d678de11361292d8bd98
62d1ca3182a6cbb921799825f43ad36821233fd7 04-Sep-2014 Tong Shen <endlessroad@google.com> ART: Prepare for ELF64.

Only expose necessary interface in ElfFile, and move all details into template class ElfFileImpl.

Change-Id: I9df2bbc55f32ba0ba91f4f3d5d0009e84a2ddf74
1ddbf6d4b37979a9f11a203c12befd5ae8b65df4 01-Oct-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Introduce a class to implement optimization passes."

This reverts commit bf9cd7ba2118a75f5aa9b56241c4d5fa00dedeb8.

Change-Id: I0a483446666c9c24c45925a5fc199debdefd8b3e
bf9cd7ba2118a75f5aa9b56241c4d5fa00dedeb8 30-Sep-2014 Roland Levillain <rpl@google.com> Introduce a class to implement optimization passes.

- Add art::HOptimization.
- Rename art::ConstantPropagation to art::HConstantFolding in
compiler/optimizing/constant_folding.h to avoid name
clashes with a class of the same name in
compiler/dex/post_opt_passes.h.
- Rename art::DeadCodeElimination to
art::HDeadCodeElimination for consistency reasons.
- Have art::HDeadCodeElimination and art::HConstantFolding
derive from art::HOptimization.
- Start to use these optimizations in
art:OptimizingCompiler::TryCompile.

Change-Id: Iaab350c122d87b2333b3760312b15c0592d7e010
f4da675bbc4615c5f854c81964cac9dd1153baea 01-Aug-2014 Vladimir Marko <vmarko@google.com> Implement method calls using relative BL on ARM.

Store the linker patches with each CompiledMethod instead of
keeping them in CompilerDriver. Reorganize oat file creation
to apply the patches as we're writing the method code. Add
framework for platform-specific relative call patches in the
OatWriter. Implement relative call patches for ARM.

Change-Id: Ie2effb3d92b61ac8f356140eba09dc37d62290f8
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
d31cf3d55a0847c018c4eaa2b349b8eea509de64 08-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> First optimization in new compiler: simple GVN.

Change-Id: Ibe0efa4e84fd020a53ded310a92e0b4363f91b12
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
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
53c913bb71b218714823c8c87a1f92830c336f61 13-Aug-2014 Andreas Gampe <agampe@google.com> ART: Clean up compiler

Clean up the compiler: less extern functions, dis-entangle
compilers, hide some compiler specifics, lower global includes.

Change-Id: Ibaf88d02505d86994d7845cf0075be5041cc8438
547cdfd21ee21e4ab9ca8692d6ef47c62ee7ea52 05-Aug-2014 Tong Shen <endlessroad@google.com> Emit CFI for x86 & x86_64 JNI compiler.

Now for host-side x86 & x86_64 ART, we are able to get complete stacktrace with even mixed C/C++ & Java stack frames.

Testing:
1. art/test/run-test --host --gdb [--64] --no-relocate 005
2. In gdb, run 'b art::Class_classForName' which is implementation of a Java native method, then 'r'
3. In gdb, run 'bt'. You should see stack frames down to main()

Change-Id: I2d17e9aa0f6d42d374b5362a15ea35a2fce96302
03f92f4e2ba358c701aa1c02a73372670d616e5a 04-Aug-2014 Junmo Park <junmoz.park@samsung.com> Fix art build script.

Use ART_BUILD_HOST_NDEBUG instead of ART_BUILD_NDEBUG.

Change-Id: I1fcca4c52e79bad93dcdd750989f6223df2b0df4
Signed-off-by: Junmo Park <junmoz.park@samsung.com>
1740eca19de8870a319033eacde16793ef391825 25-Jul-2014 Dehao Chen <dehao@google.com> Remove the per-project FDO support. Use the common FDO support from build/core.
LOCAL_FDO_SUPPORT indicates if the module should enable FDO builds.

Change-Id: I1eab8bf418b7ceb060eea18bdd304a06597af3d3
a59dd80f9f48cb750d329d4d4af2d99d72b484d1 03-Jul-2014 Alex Light <allight@google.com> Runtime can now be set to require relocation

Add a pair of runtime flags -Xrelocate and -Xnorelocate that can force
the runtime to require that all files that are run are relocated, to
prevent attacks based on the known art base address.

Add support for running patchoat on oat files compiled without an image.

Change run-test to have new --prebuild and --relocate flags.

Bug: 15358152

Change-Id: I91166c62dd1ab80e5cbcb7883a2cd0d56afca32d
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
7dc206a53a42a658f52d5cb0b7e79b47da370c9b 11-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Add two phi pruning phases.

Change-Id: Ic4f05e3df96970d78a6938b27cdf9b58ef3849b9
95a059793c4c194f026afc74c713cc295d75d91a 30-May-2014 Vladimir Marko <vmarko@google.com> Global Value Numbering.

Implement the Global Value Numbering for optimization
purposes. Use it for the null check and range check
elimination as the LVN used to do.

The order of evaluation of basic blocks needs improving as
we currently fail to recognize some obviously identical
values in methods with more than one loop. (There are three
disabled tests that check this. This is just a missed
optimization, not a correctness issue.)

Change-Id: I0d0ce16b2495b5a3b17ad1b2b32931cd69f5a25a
afd9acc30bdd11cdd12d8209eb994cb371c65e33 17-Jun-2014 Ian Rogers <irogers@google.com> Multilib ART host.

Build ART for the host as a multilib project with dalvikvm32 and dalvikvm64
running as 32 or 64-bit repsectfully. Note, currently multilib host builds
are not the default, you make the so by setting BUILD_HOST_64bit=1.
Extend tests to execute in both 32 and 64-bit modes. By default both 32 and
64-bit tests are run, add 32 or 64 to the end of a test name to run it in
purely that flavor.
Given the extra spam, modify oat tests to only generate console output when
the test fails.
Change the test harness so that common commands are run when a test should be
skipped, when it passes or when it fails. Use these commands to generate a
summary of passing, skipped and failing tests. Tests will be skipped if they
are known to be broken or if a test has already failed. Setting the variable
TEST_ART_KEEP_GOING=true will force working tests not to be skipped.
In this change all tests running on the optimizing compiler are marked broken
due to breakages running them in a multilib environment.
Break apart Android.common.mk into its constituent parts, along with other
pieces of reorganization.

Stylistic nit, we refer to make rule targets as targets thereby overloading
the term target. While consistent with make's terminology, its confusing with
the Android notion of target. I've switched to just calling targets rules to
avoid confusion in host tests.

Change-Id: I5190fc3de46800a949fbb06b3f4c258ca89ccde9
c5f17732d8144491c642776b6b48c85dfadf4b52 06-Jun-2014 Ian Rogers <irogers@google.com> Remove deprecated WITH_HOST_DALVIK.

Bug: 13751317
Fix the Mac build:
- disable x86 selector removal that causes OS/X 10.9 kernel panics,
- madvise don't need does zero memory on the Mac, factor into MemMap
routine,
- switch to the elf.h in elfutils to avoid Linux kernel dependencies,
- we can't rely on exclusive_owner_ being available from other pthread
libraries so maintain our own when futexes aren't available (we
can't rely on the OS/X 10.8 hack any more),
- fix symbol naming in assembly code,
- work around C library differences,
- disable backtrace in DumpNativeStack to avoid a broken libbacktrace
dependency,
- disable main thread signal handling logic,
- align the stack in stub_test,
- use $(HOST_SHLIB_SUFFIX) rather than .so in host make file variables.

Not all host tests are passing on the Mac with this change. dex2oat
works as does running HelloWorld.
Change-Id: I5a232aedfb2028524d49daa6397a8e60f3ee40d3
8dea81ca9c0201ceaa88086b927a5838a06a3e69 06-Jun-2014 Vladimir Marko <vmarko@google.com> Rewrite use/def masks to support 128 bits.

Reduce LIR memory usage by holding masks by pointers in the
LIR rather than directly and using pre-defined const masks
for the common cases, allocating very few on the arena.

Change-Id: I0f6d27ef6867acd157184c8c74f9612cebfe6c16
9cf35523764d829ae0470dae2d5dd99be469c841 09-Jun-2014 Nicolas Geoffray <ngeoffray@google.com> Add x86_64 support to the optimizing compiler.

Change-Id: I4462d9ae15be56c4a3dc1bd4d1c0c6548c1b94be
184d640d2a3ac86d871dab58386a50cc9bb973f9 09-Jun-2014 Nicolas Geoffray <ngeoffray@google.com> Add a type propagation phase after building SSA.

This ensures all phis have a type.

Change-Id: I7e4f9a16d1efb5f64c493c1351749b352c870cbd
65fcc2cf3c5cd97b84330c094908f3a6a7a8d4e7 28-Apr-2014 Dave Allison <dallison@google.com> Thumb2 assembler for JNI compiler and optimizing compiler

This provides a programmatic assembler for the thumb2 instruction set for
ARM. The interface is the same as the ARM assembler and the ARM assembler has
been moved into Arm32Assembler. The assembler handles most 16 and 32 bit instructions
and also allows relocations due to branch expansion. It will also rewrite cbz/cbnz
instructions if they go out of range.

It also changes the JNI compiler to use the thumb2 assembler as opposed
to forcing it to use ARM32. The trampoline compiler still uses ARM due to the
way it returns the address of its generated code. A trampoline in thumb2 is the
same size as that in ARM anyway (8 bytes).

Provides gtest for testing the thumb2 instruction output. This gtest only runs
on the host as it uses arm-eabi-objdump to disassemble the generated code. On the
target the output is not checked but the assembler will still be run to perform
all its checks.

Change-Id: Icd9742b6f13541bec5b23097896727392e3a6fb6
5ca4eaace8ba513f97309bbdc2e156de4b1d648a 29-May-2014 Andreas Gampe <agampe@google.com> ART: Make LOCAL_CLANG architecture dependent for the target

Be selective for which target we compile with Clang. Currently we
only want to compile with Clang for ARM64, which means we need to
be careful about ARM, which is the second architecture for that.

Bug: 15014252

(cherry picked from commit 9689e3768621130b2536564f4e00fcb6b3d25df4)

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

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
2469e60e6ff08c2a0b4cd1e209246c5d91027679 07-May-2014 Jean Christophe Beyler <jean.christophe.beyler@intel.com> ART: Setting up cleanup

- Moved code around to actually have the clean-up code in a PassDriver format.
This allows us to better control what is being called after an optimization
It also allows the use of a centralized pass system for both optimizations
and cleanup.

Change-Id: I9d21e9bb9ee663739722f440d82adf04f73e380c
Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
Signed-off-by: Yixin Shou <yixin.shou@intel.com>
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
Signed-off-by: Udayan Banerji <udayan.banerji@intel.com>
9689e3768621130b2536564f4e00fcb6b3d25df4 29-May-2014 Andreas Gampe <agampe@google.com> ART: Make LOCAL_CLANG architecture dependent for the target

Be selective for which target we compile with Clang. Currently we
only want to compile with Clang for ARM64, which means we need to
be careful about ARM, which is the second architecture for that.

Bug: 15014252
Change-Id: I239591f65eab537deac39a25bd20530dce5c4786
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
a5b8fde2d2bc3167078694fad417fddfe442a6fd 23-May-2014 Vladimir Marko <vmarko@google.com> Rewrite BitVector index iterator.

The BitVector::Iterator was not iterating over the bits but
rather over indexes of the set bits. Therefore, we rename it
to IndexIterator and provide a BitVector::Indexes() to get
a container-style interface with begin() and end() for range
based for loops.

Also, simplify InsertPhiNodes where the tmp_blocks isn't
needed since the phi_nodes and input_blocks cannot lose any
blocks in subsequent iterations, so we can do the Union()
directly in those bit vectors and we need to repeat the loop
only if we have new input_blocks, rather than on phi_nodes
change. And move the temporary bit vectors to scoped arena.

Change-Id: I6cb87a2f60724eeef67c6aaa34b36ed5acde6d43
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
4f59668b3d51f63601ebe59dbd2b7e8a7c5bd093 01-May-2014 James C Scott <james.c.scott@intel.com> ART: Pass driver generalization

- Generalizing Pass Driver.
- Migrating ME Pass Driver to use the new generalized Pass Driver.

There will be some more changes after in the compiler code to generalize
it a bit more by separating what is being done by the optimizing passes
and post-pass cleanups.

Change-Id: I140a70e88483d7c3991b7d336bd593b2613ae194
Signed-off-by: James C Scott <james.c.scott@intel.com>
2a0e954ecf7c60e6ec62d64b9382cc4ee447e224 21-May-2014 Dan Albert <danalbert@google.com> Move art host to libc++

Change-Id: Ia51a4fdfdbae7377130a43c401c2d8d241671d1e
700a402244a1a423da4f3ba8032459f4b65fa18f 20-May-2014 Ian Rogers <irogers@google.com> Now we have a proper C++ library, use std::unique_ptr.

Also remove the Android.libcxx.mk and other bits of stlport compatibility
mechanics.

Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
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
e45fb9e7976c8462b94a58ad60b006b0eacec49f 06-May-2014 Matteo Franchin <matteo.franchin@arm.com> AArch64: Change arm64 backend to produce A64 code.

The arm backend clone is changed to produce A64 code. At the moment
this backend can only compile simple methods (both leaf and non-leaf).

Most of the work on the assembler (assembler_arm64.cc) has been done.
Some work on the LIR generation layer (functions such as OpRegRegImm
& friends) is still necessary. The register allocator still needs to
be adapted to the A64 instruction set (it is mostly unchanged from
the arm backend). Offsets for helpers in gen_invoke.cc still need to
be changed to work on 64-bit.

Change-Id: I388f99eeb832857981c7d9d5cb5b71af64a4b921
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
bd5ea6a2f7c61c4cd7b66fead1bedd96e938369d 17-Apr-2014 Ian Rogers <irogers@google.com> Preparation for transition to libc++.

Move the dependency on libc++ to its own makefile so that we can switch in a
single place between libc++ and stlport.

Change-Id: Ie61e7d054dcd049e36d5e7298c27d8a4abe6edf7
d6ed642458c8820e1beca72f3d7b5f0be4a4b64b 10-Apr-2014 Dave Allison <dallison@google.com> Revert "Revert "Revert "Use trampolines for calls to helpers"""

This reverts commit f9487c039efb4112616d438593a2ab02792e0304.

Change-Id: Id48a4aae4ecce73db468587967968a3f7618b700
f9487c039efb4112616d438593a2ab02792e0304 09-Apr-2014 Dave Allison <dallison@google.com> Revert "Revert "Use trampolines for calls to helpers""

This reverts commit 081f73e888b3c246cf7635db37b7f1105cf1a2ff.

Change-Id: Ibd777f8ce73cf8ed6c4cb81d50bf6437ac28cb61

Conflicts:
compiler/dex/quick/mir_to_lir.h
081f73e888b3c246cf7635db37b7f1105cf1a2ff 07-Apr-2014 Dave Allison <dallison@google.com> Revert "Use trampolines for calls to helpers"

This reverts commit 754ddad084ccb610d0cf486f6131bdc69bae5bc6.

Change-Id: Icd979adee1d8d781b40a5e75daf3719444cb72e8
754ddad084ccb610d0cf486f6131bdc69bae5bc6 19-Feb-2014 Dave Allison <dallison@google.com> Use trampolines for calls to helpers

This is an ARM specific optimization to the compiler
that uses trampoline islands to make calls to runtime
helper functions. The intention is to reduce the size
of the generated code (by 2 bytes per call) without
affecting performance.

By default this is on when generating an OAT file. It is
off when compiling to memory.

To switch this off in dex2oat, use the command line option:
--no-helper-trampolines

Enhances disassembler to print the trampoline entry on the
BL instruction like this:

0xb6a850c0: f7ffff9e bl -196 (0xb6a85000) ; pTestSuspend

Bug: 12607709
Change-Id: I9202bdb7cf21252ad807bd48701f1f6ce8e3d0fe
fca82208f7128fcda09b6a4743199308332558a2 21-Mar-2014 Dmitry Petrochenko <dmitry.petrochenko@intel.com> x86_64: JNI compiler

Passed all tests from jni_compiler_test and art/test on host with jni_copiler.
Incoming argument spill is enabled, entry_spills refactored. Now each entry spill
contains data type size (4 or 8) and offset which should be used for spill.
Assembler REX support implemented in opcodes used in JNI compiler.
Please note, JNI compiler is not enabled by default yet (see compiler_driver.cc:1875).

Change-Id: I5fd19cca72122b197aec07c3708b1e80c324be44
Signed-off-by: Dmitry Petrochenko <dmitry.petrochenko@intel.com>
b95a5345ae4217b70ca36f0cced92f68dda7caf5 12-Mar-2014 Stuart Monteith <stuart.monteith@arm.com> AArch64: Add arm64 runtime support.

Adds support for arm64 to ART. Assembler stubs are sufficient for
down calls into interpreter. JNI compiler and generics are not finished.

Basic Generic JNI functionality.

Change-Id: I4a07c79d1e037b9f5746673480e32cf456867b82
b34f69ab43aaf7a6e6045c95f398baf566ef5023 07-Mar-2014 Nicolas Geoffray <ngeoffray@google.com> Add command line support for enabling the optimizing compiler.

Also run tests with the optimizing compiler enabled when
the file art/USE_OPTIMIZING_COMPILER is present.

Change-Id: Ibc33eed62a43547bc3b9fe786d014c0d81b5add8
e3e0260c23d8999b9433715ac7ee5296ee2fd633 12-Mar-2014 Vladimir Marko <vmarko@google.com> Move inline method detection to runtime.

The debugger needs this for selective deoptimization.

Change-Id: I8100000449b56e619288fb05d41ea6f02b53b334
f096aad9203d7c50b2f9cbe1c1215a50c265a059 23-Jan-2014 Vladimir Marko <vmarko@google.com> Cache method lowering info in mir graph.

This should enable easy inlining checks. It should also
improve compilation time of methods that call the same
methods over and over - it is exactly such methods that
tend to exceed our 100ms time limit.

Change-Id: If01cd18e039071a74a1444570283c153429c9cd4
719d1a33f6569864f529e5a3fff59e7bca97aad0 06-Mar-2014 Ian Rogers <irogers@google.com> Enable annotalysis on clang ART builds.

Fix clang build errors aswell as restructure locking/mutex code for correct
thread safety analysis support.
Reorder make dependencies so that host builds build first as they should
provide better compilation errors than target.
Remove host's use of -fno-omit-frame-pointer as it has no value with correct
use of CFI, which we should have.

Change-Id: I72cea8da9a3757b1a0b3acb4081feccb7c6cef90
83cc7ae96d4176533dd0391a1591d321b0a87f4f 12-Feb-2014 Vladimir Marko <vmarko@google.com> Create a scoped arena allocator and use that for LVN.

This saves more than 0.5s of boot.oat compilation time
on Nexus 5.

TODO: Move other stuff to the scoped allocator. This CL
alone increases the peak memory allocation. By reusing
the memory for other parts of the compilation we should
reduce this overhead.

Change-Id: Ifbc00aab4f3afd0000da818dfe68b96713824a08
ed8dd492e43cbaaa435c4892447072c84dbaf2dc 11-Feb-2014 Serban Constantinescu <serban.constantinescu@arm.com> AArch64: Add ARM64 Assembler

This patch adds the ARM64 Assembler and ManagedRegister backend.
The implementation of the Arm64Assembler class is based on VIXL (a
programmatic A64 Assembler - see external/vixl ).

Change-Id: I842fd574637a953c19631eedf26f6c70d9ed7f9e
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
d4dd255db1d110ceb5551f6d95ff31fb57420994 28-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Add codegen support to the optimizing compiler.

Change-Id: I9aae76908ff1d6e64fb71a6718fc1426b67a5c28
f2b39562f384aa94dfff7e2d226c497f76800004 03-Mar-2014 Nicolas Geoffray <ngeoffray@google.com> Fix portable build.

Change-Id: I84f223c6629eaf567ef33cd616dbaf04af7ed0b3
be0e546730e532ef0987cd4bde2c6f5a1b14dd2a 26-Feb-2014 Vladimir Marko <vmarko@google.com> Cache field lowering info in mir_graph.

Change-Id: I9f9d76e3ae6c31e88bdf3f59820d31a625da020f
b48b9eb6d181a1f52e2e605cf26a21505f1d46ed 01-Mar-2014 Ian Rogers <irogers@google.com> Fix clang to compile and run host tests.

Don't use the computed goto interpreter with clang 3.4 as it causes compilation
to hang.
Avoid inclusion of LLVM_(HOST|DEVICE)_BUILD_MK except for with portable as it
sets clang incompatible cflags.
Most fixes are self-evident, for the quick dex file method inliner the enums
were being used with ostreams, so fix the enums and operator out python script
to allow this.
Note this change effects portable but this is untestable as portable was broken
by ELF file and mc linker changes.

Change-Id: Ia54348f6b1bd3f76d3b71c6e8c5f97626386b903
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
9c86a0279aaf953377aa9e2277592e68bf814989 21-Feb-2014 Ian Rogers <irogers@google.com> Revert "Annotate used fields."

This reverts commit 7f6cf56942c8469958b273ea968db253051c5b05.

Change-Id: Ic389a194c3404ecb5bb563a405bf4a0d6336ea0d
7f6cf56942c8469958b273ea968db253051c5b05 29-Jan-2014 Vladimir Marko <vmarko@google.com> Annotate used fields.

Annotate all fields used by a method early during the
compilation, check acces rights and record field offset,
volatility, etc. Use these annotations when generating code
for IGET/IPUT/SGET/SPUT instructions.

Change-Id: I4bbf5cca4fecf53c9bf9c93ac1793e2f40c16b5f
f3e2cc4a38389aa75eb8ee3973a535254bf1c8d2 18-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Code cleanup to avoid LLVM dependency when building with quick only.

Change-Id: I0985c227d775c72fd23975d4c9bf673ba32615c2
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
dc781a13ddb4dabf646bb45d0c53b65cab948e5b 05-Feb-2014 Colin Cross <ccross@android.com> art: convert makefiles to support multilib build

Convert makefiles to allow for building two architectures at the
same time. More changes may be necessary to get the tests to
build.

Change-Id: I02ba11706b7e5b5592d76e43c167bcbf0e665b93
f5df8974173124faddb8e2b6a331959afdb94fdf 14-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Rewrite the compiler interface for CompilerDriver.

Change-Id: I15fa9afe7ffb7283ebda8d788a1e02793e3f75a6
c7f832061fea59fd6abd125f26c8ca1faec695a5 24-Jan-2014 Vladimir Marko <vmarko@google.com> Refactor verification results.

Rename VerificationMethodsData to VerificationResults.
Create new class VerifiedMethod to hold all the data for
a given method.

Change-Id: Ife1ac67cede20f3a2f9c7f5345f08a851cf1ed20
4e3b284b2babf813c26ad9afb129f57e3d88f67d 18-Jan-2014 Brian Carlstrom <bdc@google.com> Update ElfWriterMclinker for klp

(cherry picked from commit a6263af9aea65c65744bdd845fed68c4814e9514)

Change-Id: I3eb9fee8afb1ef12aae4c87770882afee637971d
4e97c539408f47145526f0062c1c06df99146a73 07-Jan-2014 Jean Christophe Beyler <jean.christophe.beyler@intel.com> Added pass framework

The patch adds a Middle-End pass system and normalizes the current
passes into the pass framework.

Passes have:
- A start, work, and end functions.
- A gate to determine to apply the pass.
- Can provide a CFG dump folder.

mir_dataflow.cc, mir_graph.cc, mir_optimization.cc, ssa_transformation.cc:
- Changed due to moving code into bb_optimizations.cc.
- Moved certain functions from private to public due to needed from the passes.

pass.cc, pass.h:
- Pass base class

pass_driver.cc, pass_driver.h:
- The pass driver implementation.

frontend.cc:
- Replace the function calls to the passes with the pass driver.

Change-Id: I88cd82efbf6499df9e6c7f135d7e294dd724a079
Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
2b5eaa2b49f7489bafdadc4b4463ae27e4261817 13-Dec-2013 Vladimir Marko <vmarko@google.com> Move compiler code out of method verifier.

We want to detect small methods for inlining at the end of
the method verification. Instead of adding more compiler
code to the runtime, we create a callback from the runtime
into the compiler, so that we can keep the code there.
Additionally, we move the compiler-related code that was
already in the method verifier to the compiler since it
doesn't really belong to the runtime in the first place.

Change-Id: I708ca13227c809e07917ff3879a89722017e83a9
867a2b35e67ddcbec089964e8f3cd9a827186e48 10-Dec-2013 Vladimir Marko <vmarko@google.com> Get rid of platform-specific method inliners.

The DexFileToMethodInlinerMap dependency on CompilerDriver
and its instruction set makes it impossible to implement
verification-time checking for methods we want to inline.
Therefore, we get rid of the platform-specific method
inliners and rely on the backend's existing ability to
recognize when it can actually emit an intrinsic function.

Change-Id: I57947db93f13a26c1c794cb3584130321106306f
5c96e6b4dc354a7439b211b93462fbe8edea5e57 14-Nov-2013 Vladimir Marko <vmarko@google.com> Rewrite intrinsics detection.

Intrinsic methods should be treated as a special case of
inline methods. They should be detected early and used to
guide other optimizations. This CL rewrites the intrinsics
detection so that it can be moved to any compilation phase.

Change-Id: I4424a6a869bd98b9c478953c9e3bcaf1c6de2b33
ba150c37d582eeeb8c11ba5245edc281cf31793c 28-Aug-2013 Brian Carlstrom <bdc@google.com> Omit OatMethodOffsets for classes without compiled code

Change-Id: If0d290f4aebc778ff12d8fed017c270ad2ac3220
413e89f277ec6ba1bdf2040f5b5611f29a27a447 22-Oct-2013 Brian Carlstrom <bdc@google.com> Refactor ArenaBitVector to create more general BitVector

Change-Id: Ib26f2884de9ce7d620048bdf5ed6dec639622e41
d9c4fc94fa618617f94e1de9af5f034549100753 02-Oct-2013 Ian Rogers <irogers@google.com> Inflate contended lock word by suspending owner.

Bug 6961405.
Don't inflate monitors for Notify and NotifyAll.
Tidy lock word, handle recursive lock case alongside unlocked case and move
assembly out of line (except for ARM quick). Also handle null in out-of-line
assembly as the test is quick and the enter/exit code is already a safepoint.
To gain ownership of a monitor on behalf of another thread, monitor contenders
must not hold the monitor_lock_, so they wait on a condition variable.
Reduce size of per mutex contention log.
Be consistent in calling thin lock thread ids just thread ids.
Fix potential thread death races caused by the use of FindThreadByThreadId,
make it invariant that returned threads are either self or suspended now.

Code size reduction on ARM boot.oat 0.2%.
Old nexus 7 speedup 0.25%, new nexus 7 speedup 1.4%, nexus 10 speedup 2.24%,
nexus 4 speedup 2.09% on DeltaBlue.

Change-Id: Id52558b914f160d9c8578fdd7fc8199a9598576a
193bad9b9cfd10642043fa2ebbfc68bd5f9ede4b 30-Aug-2013 Mathieu Chartier <mathieuc@google.com> Multi threaded hashed deduplication during compilation.

Moved deduplication to be in the compiler driver instead of oat
writer. This enables deduplication to be performed on multiple
threads. Also added a hash function to avoid excessive comparison
of byte arrays.

Improvements:
Before (alloats host):
real 1m6.967s
user 4m22.940s
sys 1m22.610s

Thinkfree.apk (target mako):
0m23.74s real 0m50.95s user 0m9.50s system
0m24.62s real 0m50.61s user 0m10.07s system
0m24.22s real 0m51.44s user 0m10.09s system
0m23.70s real 0m51.05s user 0m9.97s system
0m23.50s real 0m50.74s user 0m10.63s system

After (alloats host):
real 1m5.705s
user 4m44.030s
sys 1m29.990s

Thinkfree.apk (target mako):
0m23.32s real 0m51.38s user 0m10.00s system
0m23.49s real 0m51.20s user 0m9.80s system
0m23.18s real 0m50.80s user 0m9.77s system
0m23.52s real 0m51.22s user 0m10.02s system
0m23.50s real 0m51.55s user 0m9.46s system

Bug: 10552630

Change-Id: Ia6d06a747b86b0bfc4473b3cd68f8ce1a1c7eb22
c6dfdacea2fd9e268f70328805b0366cdd6b7b9e 27-Aug-2013 Brian Carlstrom <bdc@google.com> Add buffering to ELF file generation

Bug: 10496017
Change-Id: I3cbad249e0fb33f726bd0a504b3b6bd9b4f759c8
0e480cad5d2cf0904b98b7b56e90280e9b97ba30 16-Aug-2013 Ian Rogers <irogers@google.com> Move output_stream files out of runtime.

Also move image_test and oat_test that are more writing tests.

Change-Id: I6af1400d8e745bbf87f626ca87dae3e2d85b40f1
90af14d2743614e3e1453984b14258a6f145501d 16-Aug-2013 Dragos Sbirlea <dragoss@google.com> Get SEA fibonacci running in interpreter mode.

Android.mk: Added new file to build.
compile_driver.cc: Moved SE_IR usage test in the block
protected by bool compile, which is enabled by
adding a sepatate test in IsCnadidateForCompilation.
class_linker.cc: Added check in NeedsInterpreter to enable SEA_IR.
art_method-inl.h: DIsabled check in SEA_IR mode.
method_verifier.cc: Added check for SEA_IR mode.
method_verifier.h: Chenged IsCandidateForCompilation signature to
allow testing the function name (for SEA_IR selective
compilation).
dot_gen.h: Updated ART file API usage to altest version.
sea_ir/frontend.cc: Passing function symbol name to CompileMethod.
instruction_Nodes.h: Added accessor for method index for
InvokeStatic IR node.
sea.cc: Added additional IR SignatureNode for function calls (extra
Method parameter). Fixed UnnamedConstant constant value.
sea.h: Passing function_name to GenerateLLVM.
type_inference_visitor.cc: Aded type for first (placeholder) method
parameter.

Change-Id: I295858ea0761a3dffb36f35748d8b93d4919d6a9
468532ea115657709bc32ee498e701a4c71762d4 05-Aug-2013 Ian Rogers <irogers@google.com> Entry point clean up.

Create set of entry points needed for image methods to avoid fix-up at load time:
- interpreter - bridge to interpreter, bridge to compiled code
- jni - dlsym lookup
- quick - resolution and bridge to interpreter
- portable - resolution and bridge to interpreter

Fix JNI work around to use JNI work around argument rewriting code that'd been
accidentally disabled.
Remove abstact method error stub, use interpreter bridge instead.
Consolidate trampoline (previously stub) generation in generic helper.
Simplify trampolines to jump directly into assembly code, keeps stack crawlable.
Dex: replace use of int with ThreadOffset for values that are thread offsets.
Tidy entry point routines between interpreter, jni, quick and portable.

Change-Id: I52a7c2bbb1b7e0ff8a3c3100b774212309d0828e
(cherry picked from commit 848871b4d8481229c32e0d048a9856e5a9a17ef9)
ee17e0aa4d24deb11c1766bfcc6a864519df1c1e 31-Jul-2013 buzbee <buzbee@google.com> Compilation filter

This CL introduces a static compilation filter mechanism intended
to allow us to reduce compilation time and space requirements until
we have a profiling mechanism in place.

It supports 5 modes of filtering:

o interpret-only (compile nothing)
o deferred-compilation (compile only those methods believe to be
compute-intensive)
o space (optimized for space)
o balanced (best return on space investment)
o speed (compile everything)

A future CL will allow the default filtering mode to be set
via system property. For now, you can pass it in via command
line as follows:

dalvikvm -compiler-filter:[interpret-only|defer-compilation|
space|balanced|speed]

or dex2oat --runtime-arg -compiler-filter:[one of the above modes]

Creating a file named art/SMALL_ART will force the filter
default to interpret-only. Later on we'll move this capability
to a persistent system property.

or modify kDefaultCompilerFilter in runtime.h

It also changes the compiler driver to allow the compilers to
decline to compile a method by return NULL.

Change-Id: Ic73411818f8bb845a4a19a05b0395c50902c534f
(cherry picked from commit a024a0686c3b0fea13f362bff70d65981e5febc5)
a024a0686c3b0fea13f362bff70d65981e5febc5 31-Jul-2013 buzbee <buzbee@google.com> Compilation filter

This CL introduces a static compilation filter mechanism intended
to allow us to reduce compilation time and space requirements until
we have a profiling mechanism in place.

It supports 5 modes of filtering:

o interpret-only (compile nothing)
o deferred-compilation (compile only those methods believe to be
compute-intensive)
o space (optimized for space)
o balanced (best return on space investment)
o speed (compile everything)

A future CL will allow the default filtering mode to be set
via system property. For now, you can pass it in via command
line as follows:

dalvikvm -compiler-filter:[interpret-only|defer-compilation|
space|balanced|speed]

or dex2oat --runtime-arg -compiler-filter:[one of the above modes]

Creating a file named art/SMALL_ART will force the filter
default to interpret-only. Later on we'll move this capability
to a persistent system property.

or modify kDefaultCompilerFilter in runtime.h

It also changes the compiler driver to allow the compilers to
decline to compile a method by return NULL.

Change-Id: Ic73411818f8bb845a4a19a05b0395c50902c534f
848871b4d8481229c32e0d048a9856e5a9a17ef9 05-Aug-2013 Ian Rogers <irogers@google.com> Entry point clean up.

Create set of entry points needed for image methods to avoid fix-up at load time:
- interpreter - bridge to interpreter, bridge to compiled code
- jni - dlsym lookup
- quick - resolution and bridge to interpreter
- portable - resolution and bridge to interpreter

Fix JNI work around to use JNI work around argument rewriting code that'd been
accidentally disabled.
Remove abstact method error stub, use interpreter bridge instead.
Consolidate trampoline (previously stub) generation in generic helper.
Simplify trampolines to jump directly into assembly code, keeps stack crawlable.
Dex: replace use of int with ThreadOffset for values that are thread offsets.
Tidy entry point routines between interpreter, jni, quick and portable.

Change-Id: I52a7c2bbb1b7e0ff8a3c3100b774212309d0828e
bfaf44fa3366955a2bacb2c38c79b53df2434582 07-Aug-2013 Dragos Sbirlea <dragoss@google.com> Refactored SEA IR folder structure to be more logical.

Change-Id: I302c79af92c07cceb38dff36efe416bfa4869a91
6447919b5ee8d34c4767f908c7cd7223c224544c 02-Aug-2013 Dragos Sbirlea <dragoss@google.com> Generation of dot files through visitor.Added type info to .dot.

visitor.h: Fixed formatting.
type_inference.cc: Changed GetSSAConsumers() to return pointer.
sea_node.h, sea.cc: Removed ToDot classes functions.
instruction_nodes.h: Added acessor for SSA producers.
Marked GetUses() as const.
sea.h: Marked fields as const.
frontend.cc: Changed .dot generation code.
code_gen.h: Fixed include to have full path.

Change-Id: Ia84371c171c4537d9cf2f56644baa075f1706df1
b40eddfc96b9ac235dea562e55ce2ad7b1cfb7c9 31-Jul-2013 Dragos Sbirlea <dragoss@google.com> Added SEA IR type infrastructure (and a bit of cleanup).

compiler/Android.mk: Added new files to compile.
instruction_nodes.h,
code_gen.cc: Renamed GetSSAUses to GetSSAProducers to avoid confusion
(uses of what?).
sea.cc: Added invoke of type inference framework.
sea.h: Expose dex_file through GetDexFile().
Added GetPositionInSIgnature() for SignatureNodes.
sea.cc: Cleanup of debug output.
visitor.h: Removed dependence on LLVM (now only in code_gen.*).
Corrected minor typo in comment.
frontend.cc: Renamed access_flags for clarity.

Change-Id: I211d2e9ff1e0c4f910de73a52a5ac2c50e4ca7df
834b394ee759ed31c5371d8093d7cd8cd90014a8 31-Jul-2013 Brian Carlstrom <bdc@google.com> Merge remote-tracking branch 'goog/dalvik-dev' into merge-art-to-dalvik-dev

Change-Id: I323e9e8c29c3e39d50d9aba93121b26266c52a46
025218c7e4330a4942b14f9a8f1f68bd3390261c 31-Jul-2013 Elliott Hughes <enh@google.com> Clean up stlport usage.

Change-Id: I133cd88f1da37f6f801a9e07a78ae23b671cf4f1
b07b8b7a1815fc22c0e7b3f0899406cc7eeebaca 29-Jul-2013 Ian Rogers <irogers@google.com> Move vector output stream to compiler.

Change-Id: Ia4c5edabb6be31a7d953c932b490ed2d89f941c1
166db04e259ca51838c311891598664deeed85ad 26-Jul-2013 Ian Rogers <irogers@google.com> Move assembler out of runtime into compiler/utils.

Other directory layout bits of clean up. There is still work to separate quick
and portable in some files (e.g. argument visitor, proxy..).

Change-Id: If8fecffda8ba5c4c47a035f0c622c538c6b58351
19e776ceb178397661b0323a9a982f6db249a56d 23-Jul-2013 Brian Carlstrom <bdc@google.com> Enable darwin target build for art.

Change-Id: I8fc04258360d663d2fcd07c307fdfdd2981cdd19
0e260a32601fb1178e11837c460807071d489f82 21-Jun-2013 Dragos Sbirlea <dragoss@google.com> Added code generation framework.

visitors.h: Contains only IR visitor declarations for now.
code_gen.h: Code generation vistor declaration (needs llvm).
code_gen.cc:Code generation visitor implementation (needs llvm).
instruction_nodes.h: Classes for each type of instruction; this
enables the visitor to visit each instruction differently and
corresponds to the sea of nodes paper.
sea_node.h : Moved base Sea IR Node to this separate header.
Replaced NO_REGISTER with enum (including RETURN_REGISTER)
sea.cc: Addded code generation call.
Set parent region for SignatureNodes.
Propagate method and class ids in IR generation routine.
Create InstructionNode subclasses.
*.mk: Updated to support the new files. Fixed some pre-existing formatting.
instruction_tools.h: Fixed double-define of NO_REGISTER to
refer to the new enum.
dex_instruction.cc: Added support for one more instruction in
HasRegXX and VRegXX functions.

Change-Id: I7c78f603e41df7bf9da5b77951b8485dd1b49200
e68fb3c532f7a99c50b34321577dfc8a1bc3e6b1 13-Jul-2013 Stephen Hines <srhines@google.com> Mark libbcinfo as a SHARED_LIBRARY dependency.

ART's compiler depends on libbcc, which transitively depends on libbcinfo.
Without the direct specification, it is possible to end up with a build that
fails to link.

Change-Id: I8a7237e2d5ed8118e4f4d78031ac528d0905c070
7940e44f4517de5e2634a7e07d58d0fb26160513 12-Jul-2013 Brian Carlstrom <bdc@google.com> Create separate Android.mk for main build targets

The runtime, compiler, dex2oat, and oatdump now are in seperate trees
to prevent dependency creep. They can now be individually built
without rebuilding the rest of the art projects. dalvikvm and jdwpspy
were already this way. Builds in the art directory should behave as
before, building everything including tests.

Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81