History log of /art/dex2oat/dex2oat.cc
Revision Date Author Comments
25adcfb7dc81131add3a0a681ae18bced6f7a0e0 22-Sep-2016 Mathieu Chartier <mathieuc@google.com> Make image test multi image

Required for testing multi image layout in future CLs.

Bug: 28640955

Test: clean-oat-hos, test-art-host, device booting

Change-Id: I14809f56e711b4a87e01056c327eddbbd087f4ee
338a1d206c16427cf61bd42171fa0c8b9cea8165 25-Jun-2016 Andreas Gampe <agampe@google.com> ART: Add very-large threshold to dex2oat

Add a variable threshold to dex2oat. If the total dex file size for
an app reaches this threshold, dex2oat will punt all compilation and
compile the app with verify-at-runtime. This ensures smaller compile
time and memory thrashing, while still extracting the dex files and
thus helping with dirty memory later.

Added tests.

Bug: 29557002
Bug: 29790079
Test: m test-art-host-gtest-dex2oat_test
Change-Id: I78870e4a80ccaafcbbe56839e61ced0acd2ca05e
25a9abe3cd9594a60d353c0277b4f9e49a71a40a 24-Jun-2016 Andreas Gampe <agampe@google.com> ART: Add dex2oat swap-usage parameters

Make the dex2oat swap usage decision dependent on parameters that
can be changed on the command line. Both the dex file size and dex
file count can be modified through the following to new parameters:

--swap-dex-size-threshold
--swap-dex-count-threshold

The defaults remain the same (20MB and 2).

Factor out some dex2oat setup code from oat_file_assistant_test
and use it in a new dex2oat test.

Bug: 29557002
Test: m test-art-host-gtest-dex2oat_test
Test: m test-art-host-gtest-oat_file_assistant_test
Test: m test-art-host
Change-Id: I2814a0b895d960416d20b31c4b0052f98c9cb5e6
ce55f0d4da1db20676273032b3c79624f665b35b 09-Jun-2016 Andreas Gampe <agampe@google.com> ART: Fix swap usage determination in dex2oat

The decision needs to be postponed until we have access to the
dex files.

Bug: 27878043
Change-Id: I55833c6ea827ec7a322711bd182fc723d1727f08
c9dbb1df3b5c06ba122cacaf35b17cb53c6be3c6 04-Jun-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Hold dex caches live in class table""

Bug: 29083330

This reverts commit f102faf1bcbdb2149e3e7bf27b1819f621b7894b.

Change-Id: Ibc6d260247b3113beec7d33552061512a36c9ce8
f102faf1bcbdb2149e3e7bf27b1819f621b7894b 04-Jun-2016 Brian Carlstrom <bdc@google.com> Revert "Hold dex caches live in class table"

This reverts commit d6d49e56c2b7b11f474acb80cb02bb1fe9b7861e.

Bug: 29083330
Change-Id: Ie209b27897b8079f2d13fd0837fe5f83a7e61afc
d6d49e56c2b7b11f474acb80cb02bb1fe9b7861e 02-Jun-2016 Mathieu Chartier <mathieuc@google.com> Hold dex caches live in class table

Prevents temporary dex caches being unloaded for the same dex file.
Usually this is OK, but if someone resolved a string in that dex
cache, it could leave stale pointers in BSS. Also it can use extra
memory in linear alloc if we allocate dex cache arrays multiple
times.

Bug: 29083330

(cherry picked from commit f284d448e3edd428b6ade473d0993028638b2064)

Change-Id: Ie1b0b0cf835a998e19227cbb90014011a6cd40c4
8d26c5967674d2eab21f65eeac9f1adcf88fce38 26-May-2016 Mathieu Chartier <mathieuc@google.com> Prune class path classes from profile

Fixes a theoretical case where classes not in the app, but in the in
the class path could have been included in the image. The dex caches
for these classes are not properly handled and need to be pruned.
Not including the classes in the image classes makes sure the that
class linker automatically prunes them and frees the dex cache with
the explicit garbage collection.

Bug: 28452385
Change-Id: Ia44813863b5f1c79367049838021a64cc3842fc9
8c185bf0c6f18a5349bc87a7e3751ba06d90f461 23-May-2016 Vladimir Marko <vmarko@google.com> Compile JNI stubs for verify-profile and interpret-only.

This is the intended behavior to have a good JNI transition
performance.

Bug: 28902384
Change-Id: Iedb2ca343d66cf422ef2dc0527639e81d6ba8960
cdca476bf3394ce9d97a369e84e701b427009318 28-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Write conflict tables in image""

Added test.

Bug: 27906566

This reverts commit 8e2478d23e89a7022c93ddc608dcbba7b29b91e6.

Change-Id: I0894f5f7cd11af29ed9d0345b51f527fc8a41d19
5872d7cd6ceffe67550d0b021191ec66f1a34c5d 27-Apr-2016 Jeff Hao <jeffhao@google.com> Support to pass <uses-library> option through to dex2oat.

This change takes an app's shared libraries specified by <uses-library>
and passes it through to dex2oat to be used during compilation.

Part of a multi-project change.

Includes fix from a6d46161aea07ebd1cbd6ab78b2b323f940e9c1e

Bug: 26880306

(cherry-picked from commit 26e8a2f150cd7f7195a10650ab8a5b6fa5014bc8)

Change-Id: I6bfc13693dbb835ca52fed2d03ec5346d43ec5d9
b11ffb7f33d70da0eb2caf891bbfdab9129fe5b4 08-Apr-2016 Jeff Hao <jeffhao@google.com> Combine checksum of all boot images.

Allows a change to be detected in more than just the first image.
Combines checksums of all boot images using xor. A better hash is left
as TODO.

Bug: 28054110

(cherry-picked from commit 4f351aae00f43dd4e3290976f249d3664cc47091)

Change-Id: Ia557e2460ca582082368ef93508c04ce32c3036a
4f351aae00f43dd4e3290976f249d3664cc47091 08-Apr-2016 Jeff Hao <jeffhao@google.com> Combine checksum of all boot images.

Allows a change to be detected in more than just the first image.
Combines checksums of all boot images using xor. A better hash is left
as TODO.

Bug: 28054110
Change-Id: Ifbdd6cbb0104c95e8926ba4f8a207cc72dbb7f79
1c4eb04b6cb1427f96e9587bd425ee269b8c8479 29-Mar-2016 Richard Uhler <ruhler@google.com> Don't return kPatchOatNeeded if there is no patch info.

Bug: 27693977
(cherry picked from commit d1537b569b6cd18297c5e02d13cdd588c4366c51)

Change-Id: Icd25da796fc2c2b7542a47d1d8d3bcbcace145fb
d1537b569b6cd18297c5e02d13cdd588c4366c51 29-Mar-2016 Richard Uhler <ruhler@google.com> Don't return kPatchOatNeeded if there is no patch info.

Bug: 27693977
Change-Id: Ie1f27cc45f3cb434108a375136480cb92fd95e26
7bcfcb80a31f57a84d754e00bca8698829365208 23-Mar-2016 Andreas Gampe <agampe@google.com> Revert "Revert "Use compiler filter to determine oat file status.""

This reverts commit 845e5064580bd37ad5014f7aa0d078be7265464d.

Add an option to change what OatFileManager considers up-to-date.
In our tests we're allowed to write to the dalvik-cache, so it
cannot be kSpeed.

(cherry picked from commit 29d38e77c553c6cf71fc4dafe2d22b4e3f814872)

Bug: 27689078
Change-Id: I6274188610f31dcd9d086fc080b2be93afae5a6b
29d38e77c553c6cf71fc4dafe2d22b4e3f814872 23-Mar-2016 Andreas Gampe <agampe@google.com> Revert "Revert "Use compiler filter to determine oat file status.""

This reverts commit 845e5064580bd37ad5014f7aa0d078be7265464d.

Add an option to change what OatFileManager considers up-to-date.
In our tests we're allowed to write to the dalvik-cache, so it
cannot be kSpeed.

Bug: 27689078
Change-Id: I0c578705a9921114ed1fb00d360cc7448addc93a
845e5064580bd37ad5014f7aa0d078be7265464d 23-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Use compiler filter to determine oat file status."

Bots are red. Tentative reverting as this is likely the offender.

Bug: 27689078

This reverts commit a62d2f04a6ecf804f8a78e722a6ca8ccb2dfa931.

Change-Id: I3ec6947a5a4be878ff81f26f17dc36a209734e2a
a62d2f04a6ecf804f8a78e722a6ca8ccb2dfa931 18-Mar-2016 Richard Uhler <ruhler@google.com> Use compiler filter to determine oat file status.

Record the compiler filter in the oat header. Use that to determine
when the oat file is up-to-date with respect to a target compiler
filter level.

New xxx-profile filter levels are added to specify if a profile should
be used instead of testing for the presence of a profile file.

This change should allow for different compiler-filters to be set for
different package manager use cases.

Bug: 27689078
Change-Id: Id6706d0ed91b45f307142692ea4316aa9713b023
3c94f0945ed596ceee39783fa075f013b65e80a1 21-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Remove Quick from tree.

So long, old friend.

Change-Id: I0241c798a34b92bf994fed83888da67d6e7f1891
73d8c65f7eef74549f9d7599567da7265521eecc 18-Mar-2016 Mathieu Chartier <mathieuc@google.com> Fix incorrect dex2oat check

Should have been VerifyOnlyProfile.

Bug: 27688727

(cherry picked from commit 821dad8f384f8c520f062a317b3b66c78aa12b47)

Change-Id: I451ce8264115283132bc9e34708331a5c62817bf
821dad8f384f8c520f062a317b3b66c78aa12b47 18-Mar-2016 Mathieu Chartier <mathieuc@google.com> Fix incorrect dex2oat check

Should have been VerifyOnlyProfile.

Bug: 27688727
Change-Id: Ieec38904196ce756c2b1d8057dbf6d1e8a58c81d
a807780b1d8ee01dfb03923c673621b4c81ac858 17-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add verify-profile compiler filter

Only verifies and dex2dex compiles classes in the profile. Goal
is to reduce application launch time.

~2x faster than interpret-only for Facebook.

Bug: 27688727

(cherry picked from commit a079e3aa62cceb76c1c1811e6e09bcaf75e20289)

Change-Id: Iad5aa1adee3aa6c2408820e8cbbab2d4412021b8
a079e3aa62cceb76c1c1811e6e09bcaf75e20289 17-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add verify-profile compiler filter

Only verifies and dex2dex compiles classes in the profile. Goal
is to reduce application launch time.

~2x faster than interpret-only for Facebook.

Bug: 27688727
Change-Id: Ic9979c4f7ba4930298d0983c4e3c70c63500213f
1cc7e8b024ad800320ea8d94a10ee9965904fe93 16-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add verify-art-runtime usage to dex2oat

Bug: 27688793

(cherry picked from commit c6068709a482065d6f5426640f1c9316797508e3)

Change-Id: Idcf6b8023a15c816168ce42456d2bd7b463d0951
c6068709a482065d6f5426640f1c9316797508e3 16-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add verify-art-runtime usage to dex2oat

Bug: 27688793

Change-Id: I290f59df003ba241a6b71fb628351312b431ec4c
346dc993615487e9c645a515dfcbf9a6488f36fe 13-Mar-2016 David Srbecky <dsrbecky@google.com> Remove --native-debuggable compiler option.

Check if both --debuggable and --generate-debug-info are set instead.

History: I have recently added the --native-debuggable flag to control
whether extra stack maps are generated in order to produce accurate
native line number mapping of all generated code. I didn't want to
include it into --debuggable since we compile boot.oat as debuggable
and so it would be affected.

On second thought, it would have been reasonable to generate the extra
stackmaps only if both --debuggable and --generate-debug-info are set,
instead of introducing another compiler flag. This means we do not
affect boot.oat but we still get the extra stack maps if DWARF debug
information is explicitly requested.

Change-Id: I7e5e557e4850a88b3b6f86178d2cb645fb1e1110
5d950769b607b4f76413212db640a32d796911de 07-Mar-2016 David Srbecky <dsrbecky@google.com> Symbolize native debug information for AOTed methods in boot.oat.

The oatdump symbolizer will produce all DWARF information now,
not just the symtab. This allows us to recover almost all native
debug information after the fact, even for non-debuggable oat files.

The main drawback is that non-debuggable oat files do not have
enough stackmaps to provide reasonable line stepping experience.
We might also be missing inlined methods from backtraces.

Change-Id: I73ff6f43a3a0e5a0907af353f74f04e9b0129590
09c2a6be63337ee060e2d54bd01cf18be7301d29 11-Mar-2016 David Srbecky <dsrbecky@google.com> Add trampoline symbols to native debug info.

The debugger needs them to unwind through the trampolines and to
understand what is happening in the call stack.

Change-Id: Ia554058c3796788adcd7336d620a7734eb366905
b077e15d2d11b7c81aacbcd4a46c2b1e9c9ba20d 18-Feb-2016 Calin Juravle <calin@google.com> Update GetDexOptNeeded to handle different levels of compilation

extract-only or profile-guide oat files are considered up to date from
runtime perspective as they don't necessary need (re)compilation or
relocation. However, it is useful to return a more refined code to the
caller so that they can decide whether or not that's good enough.

For example, the package manager might decide to still compile a
previous extract-only and during profile guide compilation we should
always recompile even if we have an oat file.

Note that dex files compiled via ClassLoaders will still be fully
compiled.

This change introduces:
- a new key in the oat header kCompilationType to capture what type of
compilation has been made. Note tha the key might be missing. The
distinction is needed in order to avoid recompilation of a previous
fully compiled file during profile guide compilation analysis.
- a new argument to GetDexOptNeeded which tells the runtime to cast its
opinion whether or not the oat file is up to date relative to the
desired target type of compilation.

Bug: 27189430

(cherry picked from commit d91b8a2464b99625efe03caf7d30c8372bc378ed)

Change-Id: I6ce450350f388451f7bab7d285c1846d539a4b13
5d8112029d0e085c5a0099257daa4c7e29c12310 08-Mar-2016 David Srbecky <dsrbecky@google.com> Propagate InstructionSetFeatures to ElfBuilder.

This is subset of CL171665 and it separates it into two.
It will be needed to generate .MIPS.abiflags ELF section.

Change-Id: I5557e7cb98d0fa1dc57c85cf6161e119c6d50a1a
32ce2adefb8a3d0eda59a29f5e87c1eb43eef796 04-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add more systracing everywhere

Added to:
JIT
DexFile functions
Oat file manager

Added helper ScopedTrace to prevent errors and reduce excess code.

Bug: 27502458

(cherry picked from commit dabdc0fe183d4684f3cf4d70cb09d318cff81b42)

Change-Id: Ifaeff8913d79eefc797380987d13cc00456266f8
dabdc0fe183d4684f3cf4d70cb09d318cff81b42 04-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add more systracing everywhere

Added to:
JIT
DexFile functions
Oat file manager

Added helper ScopedTrace to prevent errors and reduce excess code.

Bug: 27502458

Change-Id: Ifaeff8913d79eefc797380987d13cc00456266f8
0c6e3342dfc5e234f05c0bf783af6cc469dbb160 04-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Move back the boot image to debuggable.

Full frame deoptimization is broken with it.

Partial revert of https://android-review.googlesource.com/#/c/201383/

Change-Id: I7a402d79b0882f81987e56869551840da7d553e0
d91b8a2464b99625efe03caf7d30c8372bc378ed 18-Feb-2016 Calin Juravle <calin@google.com> Update GetDexOptNeeded to handle the different levels of compilation

extract-only or profile-guide oat files are considered up to date from
runtime perspective as they don't necessary need (re)compilation or
relocation. However, it is useful to return a more refined code to the
caller so that they can decide whether or not that's good enough.

For example, the package manager might decide to still compile a
previous extract-only and during profile guide compilation we should
always recompile even if we have an oat file.

Note that dex files compiled via ClassLoaders will still be fully
compiled.

This change introduces:
- a new key in the oat header kCompilationType to capture what type of
compilation has been made. Note tha the key might be missing. The
distinction is needed in order to avoid recompilation of a previous
fully compiled file during profile guide compilation analysis.
- a new argument to GetDexOptNeeded which tells the runtime to cast its
opinion whether or not the oat file is up to date relative to the
desired target type of compilation.

Bug: 27189430
Change-Id: Icd9794b1df6f6e21242e1dd1d5b5d064963dbbb7
c5dd319c574f67d11a71f1b60ac6c34bfe93b750 10-Dec-2015 Mathieu Chartier <mathieuc@google.com> Add and use loaded class profiling

Class profiling is a way to keep track of which classes are resolved.
From here the compiler can use this information to generate a smaller
app image.

TODO: Add tests for profile stuff.

Bug: 22858531

(cherry picked from commit 8913fc1a27df8cf3b37fd99e94d87f290591328e)

Change-Id: Ifcd09230cbdc266305bc1247e0d31e7920eb353e
8913fc1a27df8cf3b37fd99e94d87f290591328e 10-Dec-2015 Mathieu Chartier <mathieuc@google.com> Add and use loaded class profiling

Class profiling is a way to keep track of which classes are resolved.
From here the compiler can use this information to generate a smaller
app image.

TODO: Add tests for profile stuff.

Bug: 22858531

Change-Id: I91ccd686394cc2517512f66abb0e277f3d26d4da
167e638ffd46186ef4fa26d1c0b6c7e00ed51ccb 25-Feb-2016 Mathieu Chartier <mathieuc@google.com> Add lz4hc image compression format

Smaller than lz4 and decompresses at the same speed. Compression is
a bit slower.

Example saves on old FB APK:
Uncompressed: 44748800 bytes
LZ4: 12443648 bytes
LZ4HC: 11055104 bytes

Generating the image slows down by ~1s per 20MB of image due to
slower compression. Decompression is about the same speed but there
should be a slight speedup since less data needs to be read from
flash.

Added test.

Bug: 22858531

(cherry picked from commit a6e81ed4c185b7362cd5199ebe5507d00883a9b0)

Change-Id: Idd0bbe1ea45fc6ab75a42bfeb0ef250e8b3e2f1b
a6e81ed4c185b7362cd5199ebe5507d00883a9b0 25-Feb-2016 Mathieu Chartier <mathieuc@google.com> Add lz4hc image compression format

Smaller than lz4 and decompresses at the same speed. Compression is
a bit slower.

Example saves on old FB APK:
Uncompressed: 44748800 bytes
LZ4: 12443648 bytes
LZ4HC: 11055104 bytes

Generating the image slows down by ~1s per 20MB of image due to
slower compression. Decompression is about the same speed but there
should be a slight speedup since less data needs to be read from
flash.

Added test.

Bug: 22858531

Change-Id: Ib2704305b9bec5b0ba3b1e871f59f4eedff330b7
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
6ea1a0e2168c8d9b6d97c075c73a72d84080f45b 29-Jan-2016 Mingyao Yang <mingyao@google.com> AOT compile framework code as non-debuggable

When a debugger attaches, we patch method entry points in framework
code to interpreter bridge. The code will later be jitted as debuggable.

Change-Id: Id148069ccad95e2339ba214742ae3ef4f084f495
5c7e2606d1246460a8a4b227d894110e89d0a842 23-Feb-2016 Roland Levillain <rpl@google.com> Please Clang with respect to stack frame limits in dex2oat.

This change enables Clang to compile dex2oat on MIPS64
without complaining about stack frames larger than what
`-Wframe-larger-than` allows.

Bug: 27310199
Change-Id: I441a4be499959a089d3c2eae1135eb0273c1e80b
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
45724f9a0cc38dbb3071beb3eeab96499868b49c 17-Feb-2016 Vladimir Marko <vmarko@google.com> Revert "Allow method references across oat files for multi-image."

Breaks Quick tests.

This reverts commit 6065402316da2b51eed5fc34cffbd991766bd408.

Change-Id: I8a5469ba7cea5f46b85cb489b3e0ef06ed548f03
6065402316da2b51eed5fc34cffbd991766bd408 16-Feb-2016 Vladimir Marko <vmarko@google.com> Allow method references across oat files for multi-image.

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.

Change-Id: I6f2e8dc8572d143c72cc2693bb0ba4fd76f889ab
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
0c4572e8c874de279463af22268d588471f40d3e 22-Jan-2016 David Srbecky <dsrbecky@google.com> Generate mini-debug-info on separate thread.

The generation and compression of mini-debug-info is a lot of work.
However, we can do it on background thread when the main thread is
busy with .rodata and .text related I/O.

Change-Id: I514f1db3cb50aa250639f3ef697faa9bc9976d12
97590ccb357eb7429063e15597e75f2692108789 04-Feb-2016 Mathieu Chartier <mathieuc@google.com> Strip image-format arg in dex2oat

Avoids printing it out to prevent spam.

Bug: 22858531

Change-Id: I9d0b35b8fa317bc39ab27946baa88812a32381e2
6af5348449ccb86203d93dfbd0e5df318917721f 30-Jan-2016 Hiroshi Yamauchi <yamauchi@google.com> Use SS/GSS collectors in dex2oat if they are the default.

With CL 198466, we stopped exercising the SS/GSS collectors in dex2oat,
which could bit-rot. We now turn on the force deterministic compilation
only if the default GC is CMS or MS and allow the SS/GSS collectors to
be exercised in dex2oat if they are the default.

Bug: 26687569
Change-Id: I049f8d0a9b4ebf3f31d0953cf71dd0e4ba6aa651
ce4b0ba4d762775a86b3529ac76cb89199c0cc1e 28-Jan-2016 David Brazdil <dbrazdil@google.com> Ignore image checksum for ExtractOnly oat files

Oat files compiled with --compiler-filter=verify-at-runtime contain
no compiled code and therefore are independent of the boot image.
This patch stores an ExtractOnly flag in the oat header and skips
the image checksum test if the flag is set, rendering the oat file
up to date even after OTAs.

Bug: 26813999

Change-Id: I25291d5b49d9e9d0018844e957a2dc88ef6bdc27
d8904a555ec801af9b99a8912fdb9e615729db7b 29-Jan-2016 Vladimir Marko <vmarko@google.com> ART: Do not reopen oat file in ImageWriter::UpdateOatFile().

Instead, pass the already opened file from Dex2Oat.

Bug: 26831001
Change-Id: I2341259499067f43ce620b590c5482d28f140e9f
eb2c741c70c3ee117ff35ad682f18b90349590b8 28-Jan-2016 Roland Levillain <rpl@google.com> Do not enforce deterministic compilation with read barriers.

Forcing determinism of the boot image compilation (on host)
does not work when read barriers are enabled, as the former
switches the GC to a non-concurrent one by passing the
option `-Xgc:nonconcurrent`.

Also make dex2oat abort when invoked with
`--force-determinism` while read barriers are enabled.

Bug: 12687968
Bug: 26687569
Change-Id: I37b388fccbe4502a90def8031a898f1a40df6a9f
ace0dc1dd5480ad458e622085e51583653853fb9 20-Jan-2016 Andreas Gampe <agampe@google.com> ART: Add option to ensure deterministic compilation

To ensure reliable stable generation of a boot image, add a flag
for forced determinism, trading compile time for a deterministic
output.

We have to run certain passes in the compiler-driver single-threaded.
It is also necessary to try to make the heap layout deterministic.
Switch to nonconcurrent GC, use the free-list implementation for LOS,
and try to allocate the main space at a known location. This is best
effort at the moment.

To allow the compiler phase to be parallelized, const-strings need
to be created beforehand.

The identity hashcode seed needs to be pinned.

Besides the Dex object we also need to null the DexFile pointer in
dex caches.

For classes, we need to remove the clinit thread ID.

Fix oatdump alignment padding accounting.

Bug: 26687569
Change-Id: Ia82120e8f715bb3691d861817b12778ac677355a
3a2bd29d274f60fdcfabebb052078edef0190164 27-Jan-2016 Andreas Gampe <agampe@google.com> ART: Make sure dex files are verified in the compiler

Follow-up to 9bdf108885a27ba05fae8501725649574d7c491b. Make sure
that dex files from the oat writer are verified with the dex file
verifier.

Bug: 26793137
Bug: 26808512
Change-Id: I1a5f51751491eead21d8f9f1b31e37c7374c72a5
47496c293b2b79c9747eeebafe444715202e7fc6 27-Jan-2016 Vladimir Marko <vmarko@google.com> ART: Allow --no-inline-from to specify multiple dex files.

This will allow tests to specify arbitrary dex files from
which we should not inline, in addition to core-oj, so that
we can test the related functionality. Additionally, should
the core-oj.jar core grow beyond a single classes.dex and
require a multi-dex .jar, this change makes sure that we
prevent inlining also from the extra classes<N>.dex files.

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

This reverts commit 8546cc9aeb05e866e1fb6a9e4130d53ea330baa8.

Change-Id: I676fdf9af27fa3b16fa8921778ff8832ab8c437d
fbc31087932a65e036a153afab3049dc5298656a 24-Jan-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Load app images""

This reverts commit 1bc977cf2f8199311a97f2ba9431a184540e3e9c.

Bug: 22858531

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

This reverts commit 5fdcc3c931b70204fd8c491afa66f57f8428490f.

Change-Id: I9c1f5aad6933a46af6717e3a90a51f76111f9c8a
1bc977cf2f8199311a97f2ba9431a184540e3e9c 23-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Load app images"

Fails when a method is duplicated (see test 097-duplicate-method)

Bug: 22858531

This reverts commit f7fd970244f143b1abb956e29794c446e4d57f46.

Change-Id: Ib30ae5be00cc568e799290be6b3c8f29cbbe4c20
f7fd970244f143b1abb956e29794c446e4d57f46 09-Nov-2015 Mathieu Chartier <mathieuc@google.com> Load app images

Support in-place patching of the app image based on boot image
location and app oat location. Only loads for art run test so far
since we do not automatically generate app images for app installs.

N5 maps launch time (~200 runs):
Before: 930ms
After: 878.18ms
After + image class table: 864.57ms

TODO:
Oatdump support.
Store class loaders as class roots in image.

Bug: 22858531

Change-Id: I9cbc645645e62ea2ed1ad8e139e91af7d88514c1
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
9bdf108885a27ba05fae8501725649574d7c491b 21-Jan-2016 Vladimir Marko <vmarko@google.com> Revert "Revert "Write dex files to oat file early.""

This reverts commit 919f5536182890d2e03f59b961acf8f7c836ff61.

Fix linker error (Mac build):
Replace inline definition of art::ZipArchive::~ZipArchive()
with an out-of-line definition in zip_archive.cc to avoid
direct reference to CloseArchive() from libart-compiler due
to inlining. Note that libart is linked against -lziparchive
but libart-compiler is not.

Change-Id: I92620ea0200282ca7ba9b7f61a592cb6468d90d8
919f5536182890d2e03f59b961acf8f7c836ff61 20-Jan-2016 Vladimir Marko <vmarko@google.com> Revert "Write dex files to oat file early."

This reverts commit 625a64aad13905d8a2454bf3cc0e874487b110d5.

Breaks the Mac build:

Undefined symbols for architecture i386:
"_CloseArchive", referenced from:
... in oat_writer.o
ld: symbol(s) not found for architecture i386

Change-Id: I21608bc51437834e1e6abde9bcbe5e7d9998197e
877fd963548a3175665bfef25b0d24bc0e5a0135 05-Jan-2016 Calin Juravle <calin@google.com> Improve profile processing

- allow file descriptors in addition to file names for profiles
- fix some minor issues (wrong comparison signs, unhandled errors)
- added gtests for profile_compilation_info, profile_assistant
and compiler_driver

Bug: 26080105
Change-Id: I136039fa1f25858399000049e48b01eafae54eb1
c903b6af634927479915eaa9516d493eea23f911 18-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Move --dump-cfg and dump-cfg-append to CompilerOptions.

It simplifies passing the option to the JIT.

Change-Id: Iee1b722362899e5809ef97be90961e3dda1e16cc
625a64aad13905d8a2454bf3cc0e874487b110d5 26-Nov-2015 Vladimir Marko <vmarko@google.com> Write dex files to oat file early.

Write dex files to oat file before we actually open and
verify them. Instead, open and verify the copies from the
oat file and use these. This way, in the most common case
of zipped dex files, we have mmapped dex files instead of
inflated dex files. That reduces the number of dirty pages
used by dex2oat.

Reading /proc/self/statm after we write the oat file for
a compilation of a certain large app on Nexus 5 AOSP build
with -j1, three attempts before and after this CL gave
before: 346061 189462 6269 26 0 140723 0
346189 189450 6269 26 0 140851 0
346061 189463 6269 26 0 140723 0
after: 346186 185808 23040 27 0 140468 0
346186 185819 23040 27 0 140468 0
346186 185822 23040 27 0 140468 0
These values are in pages (4KiB), so while the "size"
(=VmSize) is essentially unchanged, the "resident" (=VmRSS)
is over 14MiB less and the "shared" (i.e. backed by a file)
is 65.5MiB more. That is, the amount of dirty non-pageable
memory used is reduced by about 80MiB.

The oat file format has changed slightly, the class offset
table has been moved from the OatDexFile to its own section.
This actually fixes the alignment of these offsets as they
could have been unaligned previously, yet accessed as normal
with significant performance impact if the kernel has to
emulate the unaligned access (say, mips).

Change-Id: I0f4799bb1f1ca28e3533156a3494f55345c3e10a
97f3f7d29a88a14b081770af8c464859c8e77f42 13-Jan-2016 Lin Zang <lin.zang@intel.com> Disable Homogeneous space for dex2oat

Disable the Hspace compact can help reduce the virtual memory space
for dex2oat by not mmap the main_space_2.
This can avoid some mmap fail when dex2oat create heap.

Change-Id: I4573bd80b807f40337d40d95a8e098da94946692
Signed-off-by: Lin Zang <lin.zang@intel.com>
966878d987cec1940fdfa8633fc79f8112320821 14-Jan-2016 Mathieu Chartier <mathieuc@google.com> Revert "Create parent class loader for dex2oat"

Bug: 22858531

This reverts commit d37d364c27e74a7b49970a8c970482e273aa7b1a.

Change-Id: Id71a6f3bb9a29c04a5c13210633674e05d798114
436183f5156067ed97ac2cd44808fe5de9d02e56 13-Jan-2016 Jeff Hao <jeffhao@google.com> Allow multi-image dex2oat to tolerate missing dex files.

Bug: 26317072

(cherry-picked from commit 9c25dfafaf479b2f3593a6b51b85ab21fb9c45c9)

Change-Id: I786dae69b0680cf619368894842b21d39d64ab97
9c25dfafaf479b2f3593a6b51b85ab21fb9c45c9 13-Jan-2016 Jeff Hao <jeffhao@google.com> Allow multi-image dex2oat to tolerate missing dex files.

Bug: 26317072
Change-Id: I7e8337450701567ff46e12c9efe21457cbf90942
3e09eebe1ffd38b12d67c90cfe609d27453469ff 12-Jan-2016 David Srbecky <dsrbecky@google.com> Disable --generate-debug-info by default in all cases.

The option is disabled by default unless explicitly enabled.
In particular, it is no longer enabled in debug builds,
and the --debuggable option does not affect it.

I want to use this flag to control the debug data generated
by the JIT as well. Since this takes run-time memory,
I want to avoid enabling it unless explicitly requested.

Change-Id: I2e2afa2f56bb0a113e92cc2e26e00dceac1689ca
acd7a6ac4bb5b43b07362f5c83ab0259514370d6 08-Jan-2016 Jeff Hao <jeffhao@google.com> Fix general multi-image TODOs.

- Removed some unnecessary comments.

Bug: 26317072

(cherry-picked from commit 509f2ab308032534f14d8f4f374f60da8a615fa2)

Change-Id: Id542262ca1182fb77f029f2136266e470bde9473
509f2ab308032534f14d8f4f374f60da8a615fa2 08-Jan-2016 Jeff Hao <jeffhao@google.com> Fix general multi-image TODOs.

- Removed some unnecessary comments.
- Reenabled tests that are working again.

Change-Id: Id542262ca1182fb77f029f2136266e470bde9473
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
8994a04162a92759f8ec531d18ee8901145dfda0 30-Dec-2015 Andreas Gampe <agampe@google.com> Revert "Revert "ART: Fix up some multi-image cases""

This reverts commit de38b797c3e5ba3ee44c480db7093386975c51eb.

Fix up imgdiag for std::string and multi-image.

Bug: 26317072
Bug: 26320300

Change-Id: I94ce9528e9fea6fb3231a70c32db02d567143db9
de38b797c3e5ba3ee44c480db7093386975c51eb 30-Dec-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "ART: Fix up some multi-image cases"

Fails imgdiag_test on device.

Bug: 26317072
Bug: 26320300

This reverts commit 288b1e9a0dddfb91e85067fe81de55174f313c7c.

Change-Id: Iccd05827b0630281b6f959331eaa4202526df78e
288b1e9a0dddfb91e85067fe81de55174f313c7c 28-Dec-2015 Andreas Gampe <agampe@google.com> ART: Fix up some multi-image cases

Change the auto-generated multi-image names to include the path
components from the first image, as well as prefix them with the
first image's name to disambiguate. This fixes vogar-style usage.

Fix an out-of-bounds issue in dex2oat when dex files are missing.

Forbid generating or patching multi-image parts when loading images.
Instead just fail loading them.

Remember ImageSpace instances that have been added while trying to
load a multi-image set. Remove all loaded instances when the overall
loading process fails.

Refactor the dex location adaptation into ImageSpace. Reuse the code
in the Runtime path for fallback, so that all dex files can be found
correctly.

Fix an out-of-bounds access in OatFileAssistant in fallback mode.

Partially reverts d895961d07a1d320b29f2045a48bc5a1944a4d3c. Push an
actual image name, that is, something with an art extension, to
the vogar scripts.

Partially reverts c525604b313bb77a2077e1fec43dfab76cb1b9b1. Test
119-noimage-patchoat works again.

Bug: 26317072
Bug: 26320300
Change-Id: I3f05fa77f22a2b9ca54c3105ffc53646c1928604
dcdc85bbd569f0ee66c331b4219c19304a616214 04-Dec-2015 Jeff Hao <jeffhao@google.com> Dex2oat support for multiple oat file and image file outputs.

Multiple changes to dex2oat and the runtime to support a --multi-image
option. This generates a separate oat file and image file output for
each dex file input.

Change-Id: Ie1d6f0b8afa8aed5790065b8c2eb177990c60129
0cf4493166ff28518c8eafa2d0463f6e817cce75 09-Dec-2015 David Srbecky <dsrbecky@google.com> Generate more stack maps during native debugging.

Generate extra stack map at the start of each java statement.
The stack maps are later translated to DWARF which allows
LLDB to set breakpoints and view local variables.

Change-Id: If00ab875513308e4a1399d1e12e0fe8934a6f0c3
49b0f45d5a9023653ab00c355735910aa51ee0ba 10-Dec-2015 Vladimir Marko <vmarko@google.com> Refactor and clean up OatWriter and Dex2Oat.

This is in preparation for early writing of dex files
to oat file.

Change-Id: I31195f3c94eb8ff676c600c60bd35ae531f457b4
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
64fff41f639a7b85b2e172977175b3c79151634e 24-Nov-2015 Kevin Brodsky <kevin.brodsky@linaro.org> Clarify --boot-image help message

Make dex2oat print the same help as e.g. oatdump regarding
--boot-image and clarify the example, this is particularly important
as the automatic addition of the arch to the path is quite
counterintuitive.

Change-Id: I234b498d5deca99bb988a9c24ff9febc6349eb9e
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
10c13565474de2786aad7c2e79757ea250747a15 25-Nov-2015 Vladimir Marko <vmarko@google.com> Refactor oat file writing to give Dex2Oat more control.

This is the first step towards writing dex files to oat file
and mapping them from there for the actual AOT compilation.

Change-Id: Icb0d27487eaf6ba3a66c157e695f9bdc5bb9cf9a
d37d364c27e74a7b49970a8c970482e273aa7b1a 20-Nov-2015 Mathieu Chartier <mathieuc@google.com> Create parent class loader for dex2oat

This means we also put the class loader in the app image so that it
can be used for verifying the dex file order.

Bug: 22858531
Change-Id: I30761b59421c8a24cffd62b469134b25d2929e2e
073b16c8429d302d5413e8ffc488b03b8f770780 10-Nov-2015 Mathieu Chartier <mathieuc@google.com> Image space cleanup for app images

Removed Heap::GetImageSpace, added Heap::GetBootImageSpace.

Generalized some logic in the class linker for image spaces.

Bug: 22858531

Change-Id: Ib3e12bb061a247e232d3dc93b0d6b35eb3a34d25
da5b28adf5ba013f0784578a8b97577782e23d95 05-Nov-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Add basic image writer support for app images""

No changes, bug fixed in:
https://android-review.googlesource.com/#/c/180886/

Bug: 22858531

This reverts commit 4b018565e57c3349a3c1b5ec8ac9dae261c5e00b.

Change-Id: I86d9c2b55d535d803c6e1b3b8b4836bf6ff077e5
4b018565e57c3349a3c1b5ec8ac9dae261c5e00b 05-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Add basic image writer support for app images"

interpreter and jit tests fail.

Bug: 22858531

This reverts commit c033474cfbfe1e963c07fa5c38aed02e35ed6f91.

Change-Id: Ic12a3e2a1908ac0db52d21a0b44b2508c88b2585
c033474cfbfe1e963c07fa5c38aed02e35ed6f91 02-Nov-2015 Mathieu Chartier <mathieuc@google.com> Add basic image writer support for app images

Needed to handle references from app image -> boot image.

Generate app images for tests to enable some testing.

Bug: 22858531

Change-Id: I1af98b6c4dfcb3a147fb5b0dea64aa4946c7ce57
a90c772bf5c0ae1f0d88659bfeba0c93d3af7ade 29-Oct-2015 Mathieu Chartier <mathieuc@google.com> Add application image dex2oat options

Bug: 22858531
Change-Id: Ia6a2a832b20b5bb70672521cd06f679335efbd92
d1eaf0dc9abc42dbcbbd9c4b98bf930ae5f394f3 29-Oct-2015 Vladimir Marko <vmarko@google.com> Keep list of dex files for oat file in CompilerDriver.

Use this list to improve invoke-static/-direct dispatch for
intra-oat calls.

Also fix a latent ArmBaseRelativePatcher::ReserveSpaceEnd()
bug exposed by a buggy early version of this CL: when we
have unresolved patches at the end of all code, we need to
emit a final thunk. Though the OatWriter will try to patch
the unresolved call to a trampoline at the beginning of the
oat file, that trampoline may be too far and the relative
patcher doesn't know about it anyway, so it needs to assume
that a thunk is needed.

This reduces the overall size of oat files present in dalvik
cache on Nexus 9 after first boot by over 1MiB, AOSP ToT,
aosp_flounder-userdebug build.

Change-Id: I98604b70cb17377eed057c1c23971865cf344e43
abbb0f76b07417f13f712f54d5afddb72e3b9931 29-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Refactor code so that JIT can parse compiler options.

Currently only the CompilerOptions class. We should also
do it for the CompilerDriver options.

This will fix the flakiness seen on jdwp testing, as the
debuggable flag was not passed to the compiler.

Change-Id: I4218dd5928c9f4fe2d6191ab11e5598e7cf84bcf
d9786b0e5be23ea0258405165098b4216579209c 14-Oct-2015 Artem Udovichenko <artem.u@samsung.com> Implementation of fast lookup table to search class_def by descriptor

Lookup table is a hash table which built at compile time and stored
into oat file. At runtime the table is restored and used in the
method DexFile::FindClassDef(const char*) to perform fast search of
the class_def_idx by class descriptor. Advantages of the lookup table
over the HashSet (runtime/base/hash_set.h) are:
1. Lookup table is built at compile time and uses read-only memory at
runtime
2. Lookup table uses less memory then DexFile::Index (less by 80% for
/system/framework/framework.jar on Nexus5)
3. Lookup table does less string comparisons compared with HashSet
(less by 70% for zygote process on Nexus5)
The disadvantage of the lookup table is it increased boot.oat size by
0.2% on Nexus5 and application .oat file by 0.3% in average on Nexus5.

mathieuc changes:
Create lookup table in dex2oat to speed up compilation. Clean up code
to follow style guide and use less static functions. Added
performance measurements.

Compile ~100 APKs 5 times with filter interpret-only:
Before:
real 1m8.989s
user 0m59.318s
sys 0m7.773s

After:
real 1m1.493s
user 0m52.055s
sys 0m7.581s

App launch (AOSP N5 maps, average of 45 runs):
Before: 966.84ms
After: 923.733ms
Launch speedup is 4.7%

Memory usage compared to HashSet index on 50 various APK:
32 bit: HashSet ~625694b vs TypeLookupTable ~404268b
64 bit: HashSet ~1251390b vs TypeLookupTable ~404268b

Bug: 10921004
Bug: 20269715

Change-Id: I7246c1d9ad9fe81fe5c5907a4bf70396d8f9242a
307dac9ac366ebb454d5e68d5681189b15035854 20-Oct-2015 Vladimir Marko <vmarko@google.com> Fix destruction order in Dex2Oat.

In case of a failure (say, --image= pointing to non-existent
directory), the image_writer_ may not be destroyed in
CreateImageFile() and it will be destroyed in Dex2Oat's
destructor instead. However, ImageWriter owns a MemMap, so
it must be destroyed before MemMap::Shutdown() called from
Runtime's destructor. In release builds without leak checks,
we intentionally leak the runtime, so we don't hit the
destruction order issue. However, debug build was crashing
on the DCHECK(maps_ != nullptr) in MemMap destructor.

This change cleans up the destruction order and deliberately
leaks even more owned data in release builds without leak
checks.

Change-Id: Ib7f305bb676589d0379ecaafe6a53eeae208beaa
d57d454a11ac6f49eaa397ec14d6231e3a2727b7 14-Oct-2015 Mathieu Chartier <mathieuc@google.com> Allocate dex cache arrays in their class loader's linear alloc

Fixes memory leak for class unloading where the dex cache arrays
used to be in the runtime linear alloc which never got freed.

TODO: Some of the callers like the compiler just use the runtime
linear alloc. We could clean this up if we want to have class
unloading during compilation for some reason.

Added regression test.

Bug: 22720414

Change-Id: Ia50333a06a339efbdaedb5ad94b7a1ae841124ec
2602aa86d8e0e98f00311ea05395548b4d327f82 15-Sep-2015 Andreas Gampe <agampe@google.com> ART: Decrease dex2oat watchdog timeout

Keep the dex2oat watchdog timeout lower than the package manager
timeout, so that dex2oat kills itself before the system server
watchdog kills the system because of the long installation.

Bug: 23629410

(cherry picked from commit 540138ae55ac1909606a436d7f52e20146c56657)

Change-Id: I425b19ab305cfaa43f6bddc3a892be892acaf513
409e80901468f6c746eeae5c6e93ceedf1d8c711 01-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Don't force the boot image to using quick.

Instead, put the debuggable flag.

Also, remove obsolete ART_USE_OPTIMIZING_COMPILER environment
variable.

Change-Id: Idde00da0d063aa461faa0308134f3b420de9fe0a
9d96bd65577bb6b7499627ecba8ea027f3299091 15-Sep-2015 Andreas Gampe <agampe@google.com> ART: Decrease dex2oat watchdog timeout

Keep the dex2oat watchdog timeout lower than the package manager
timeout, so that dex2oat kills itself before the system server
watchdog kills the system because of the long installation.

Bug: 23629410

(cherry picked from commit 540138ae55ac1909606a436d7f52e20146c56657)

Change-Id: I5faa23a1715736a1c2ba3f302a6ee41130d3fbae
cc07760776c3d2fb2ebc90858b6c20c48c78d783 17-Sep-2015 Andreas Gampe <agampe@google.com> ART: Clean up less in dex2oat

In non-debug builds, clean up even less. We already did not shut
down the runtime. Also skipping the compiler driver and the
verification results removes all major points of destructor
performance.

Tested with a common large app on Nexus 9. Time between dex2oat timing
message and executable exit (log from immediately-after log echo)
[w/o swap, w/ swap].
Before: 2.409s / 48.774s
After: 0.132s / 0.188s

Bug: 24199200
Change-Id: I5d8c17f8e28796545cfbb3887c07c92905f9b48d
(cherry picked from commit 3f30e1219dd76f78bb9b6504e696a04a3dfae564)
3f30e1219dd76f78bb9b6504e696a04a3dfae564 17-Sep-2015 Andreas Gampe <agampe@google.com> ART: Clean up less in dex2oat

In non-debug builds, clean up even less. We already did not shut
down the runtime. Also skipping the compiler driver and the
verification results removes all major points of destructor
performance.

Tested with a common large app on Nexus 9. Time between dex2oat timing
message and executable exit (log from immediately-after log echo)
[w/o swap, w/ swap].
Before: 2.409s / 48.774s
After: 0.132s / 0.188s

Bug: 24199200
Change-Id: I5d8c17f8e28796545cfbb3887c07c92905f9b48d
540138ae55ac1909606a436d7f52e20146c56657 15-Sep-2015 Andreas Gampe <agampe@google.com> ART: Decrease dex2oat watchdog timeout

Keep the dex2oat watchdog timeout lower than the package manager
timeout, so that dex2oat kills itself before the system server
watchdog kills the system because of the long installation.

Bug: 23629410
Change-Id: I5faa23a1715736a1c2ba3f302a6ee41130d3fbae
c7ae55d1753c1a684dd5c39e2f0c7b11dc0a0fdd 16-Sep-2015 Andreas Gampe <agampe@google.com> ART: Make dex2oat timing a bit more granular

Add scoped timing for runtime creation and dex file opening. Allows
comparing (JIT) compile time to specific overhead inherent to all
compilations.

Bug: 24103765
Change-Id: I1f83daa7015745bffa0cec3a3357b045c8493d6a
87000a948524cba7538ccc5438f6a9ecbd4e347e 24-Aug-2015 Calin Juravle <calin@google.com> Add option to append to the cfg dump.

This makes life easier when verifying tests with unresolved classes
(which call dex2oat at rutime).

Change-Id: I7985b2b7c0f343462e03a26b8395297c810b1d95
b2872dac9979e10dd6e2ad62712f560503393b68 02-Sep-2015 Roland Levillain <rpl@google.com> Document the `--debuggable` option in dex2oat's usage.

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

This reverts commit 81a9087f0df0518c39405b7d18ba5858a6d8b77b.

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

Bug: 23602225
Bug: 22720414

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

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

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

Also deleted some unused functionality in image writer.

Bug: 22720414
Change-Id: If22cb3cad7e3baabc8158a77d7f20799faf4c341
581550137ee3a068a14224870e71aeee924a0646 19-Aug-2015 Vladimir Marko <vmarko@google.com> Revert "Revert "Optimizing: Better invoke-static/-direct dispatch.""

Fixed kCallArtMethod to use correct callee location for
kRecursive. This combination is used when compiling with
debuggable flag set.

This reverts commit b2c431e80e92eb6437788cc544cee6c88c3156df.

Change-Id: Idee0f2a794199ebdf24892c60f8a5dcf057db01c
b2c431e80e92eb6437788cc544cee6c88c3156df 19-Aug-2015 Vladimir Marko <vmarko@google.com> Revert "Optimizing: Better invoke-static/-direct dispatch."

Reverting due to failing ndebug tests.

This reverts commit 9b688a095afbae21112df5d495487ac5231b12d0.

Change-Id: Ie4f69da6609df3b7c8443412b6cf7f5c43c2c5d9
9b688a095afbae21112df5d495487ac5231b12d0 06-May-2015 Vladimir Marko <vmarko@google.com> Optimizing: Better invoke-static/-direct dispatch.

Add framework for different types of loading ArtMethod*
and code pointer retrieval. Implement invoke-static and
invoke-direct calls the same way as Quick. Document the
dispatch kinds in HInvokeStaticOrDirect's new enumerations
MethodLoadKind and CodePtrLocation.

PC-relative loads from dex cache arrays are used only for
x86-64 and arm64. The implementation for other architectures
will be done in separate CLs.

Change-Id: I468ca4d422dbd14748e1ba6b45289f0d31734d94
99e7df6cab07a17e8d5dc6bc2421f9890e34734f 17-Aug-2015 Andreas Gampe <agampe@google.com> ART: Dex2oat lint fix

Lint fix.

Change-Id: Id45bc246645715afaca58c145a70c3b319e5d673
9ec5e2217b0130b448013796255d803c7d1052c9 17-Aug-2015 Roland Levillain <rpl@google.com> Refactor art::Dex2Oat::ParseArg.

Split up art::Dex2Oat::ParseArg to allow
`clang++ -01 -Werror -Wframe-larger-than=1728` to compile
dex2oat.cc.

Change-Id: I0b45f394568765ccd849c87a7cf910507291e65d
d333389cf635e002658a77e64547631e05004447 07-Aug-2015 Roland Levillain <rpl@google.com> Tighten default inlining settings when using the space filter.

(cherry picked from commit a215b95d03cfe713018a245553b74d7eeee813df
and amended)

Bug: 21868508
Change-Id: Ic83813a966cef18e59447083926bf033aa587154
a215b95d03cfe713018a245553b74d7eeee813df 07-Aug-2015 Roland Levillain <rpl@google.com> Tighten default inlining settings when using the space filter.

Bug: 21868508
Change-Id: Ic83813a966cef18e59447083926bf033aa587154
8f96df846403703e14016590b4c0c3af870561d9 29-Jul-2015 Calin Juravle <calin@google.com> Allow for fine tuning the inliner.

Bug: 21868508

(cherry picked and squashed from commits
ec74835a7e4f2660250a2f3f9508cbbe5269e49a and
0941b9d48a9a8c6d80a1af7a0d0fc9f80fe2b9a1)

Change-Id: I1750e6bea20321d04680132281a6c2924531c5ae
ec74835a7e4f2660250a2f3f9508cbbe5269e49a 29-Jul-2015 Calin Juravle <calin@google.com> Allow for fine tuning the inliner.

Bug: 21868508

Change-Id: Ice7f1604ed65e3d4ed2a010ee431272b7d000cdb
90443477f9a0061581c420775ce3b7eeae7468bc 17-Jul-2015 Mathieu Chartier <mathieuc@google.com> Move to newer clang annotations

Also enable -Wthread-safety-negative.

Changes:
Switch to capabilities and negative capabilities.

Future work:
Use capabilities to implement uninterruptible annotations to work
with AssertNoThreadSuspension.

Bug: 20072211

Change-Id: I42fcbe0300d98a831c89d1eff3ecd5a7e99ebf33
1e13374baf7dfaf442ffbf9809c37c131d681eaf 20-May-2015 Evgenii Stepanov <eugenis@google.com> Generalize Valgrind annotations in ART to support ASan.

Also add redzones around non-fixed mem_map(s).
Also extend -Wframe-larger-than limit to enable arm64 ASan build.

Change-Id: Ie572481a25fead59fc8978d2c317a33ac418516c
ccbbda2b716bcc0dd9ad7b6c7bf9079efa3fca23 03-Jul-2015 Douglas Leung <douglas.leung@imgtec.com> Add implicit null pointer and stack overflow checks for Mips.

(cherry picked from commit 22bb5a2ebc1e2724179faf4660b2735dcb185f21)

Bug: 21555893
Change-Id: I2a995be128a5603d08753c14956dd8c8240ac63c
22bb5a2ebc1e2724179faf4660b2735dcb185f21 03-Jul-2015 Douglas Leung <douglas.leung@imgtec.com> Add implicit null pointer and stack overflow checks for Mips.

Bug: 21555893
Change-Id: I2a995be128a5603d08753c14956dd8c8240ac63c
01aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4 19-Jun-2015 Calin Juravle <calin@google.com> Allow for sig chain to be disabled.

Tools like dex2oat or patchoat don't need the sig chain or the fault
manager. This also enables building a statically link version of
dex2oat.

Change-Id: I9897728cac48acade854bb027bfde860628ebf84
49a17ec8427e2723bc8d36bb5eab52618bc3600a 30-Jun-2015 Andreas Gampe <agampe@google.com> Revert "ART: Unlink target oat file before compiling"

Change to the old code before changing CreateEmptyFile.

This reverts commit 4591ae27de90988fbcb9af0c942e633f97ab454e.

Bug: 22047255
4591ae27de90988fbcb9af0c942e633f97ab454e 27-Jun-2015 Andreas Gampe <agampe@google.com> ART: Unlink target oat file before compiling

Dex2oat must create a new file (new inode) when writing to a target
given by name, as the existing file may be in use. So unlink any
existing file first.

Bug: 22047255

(cherry picked from commit 52f0aeb8e9f16fa5c3067f6a36be701354448924)

Change-Id: Ief942c71564076e39c1e8340d5c4c55286f75896
52f0aeb8e9f16fa5c3067f6a36be701354448924 27-Jun-2015 Andreas Gampe <agampe@google.com> ART: Unlink target oat file before compiling

Dex2oat must create a new file (new inode) when writing to a target
given by name, as the existing file may be in use. So unlink any
existing file first.

Bug: 22047255
Change-Id: Ief942c71564076e39c1e8340d5c4c55286f75896
ad805685621cd6cd8a8144f7f83a69fd1fc171e5 19-May-2015 Andreas Gampe <agampe@google.com> ART: Only print stripped dex2oat command line

To curb logcat noise, strip many dex2oat parameters from the
logcat printout.

Bug: 20501758

(cherry picked from commit 046c706707ea0f16c804136e237ac7cbfdc897a1)

Change-Id: Ifc367f91f593916e0773af1ca950c798f129889f
046c706707ea0f16c804136e237ac7cbfdc897a1 19-May-2015 Andreas Gampe <agampe@google.com> ART: Only print stripped dex2oat command line

To curb logcat noise, strip many dex2oat parameters from the
logcat printout.

Bug: 20501758
Change-Id: Ifc367f91f593916e0773af1ca950c798f129889f
a26cb57f46fd3f27a930d9d688fe8670c1f24754 23-Apr-2015 David Srbecky <dsrbecky@google.com> ART stack unwinding fixes for libunwind/gdb/lldb.

dex2oat can already generate unwinding and symbol information which
allows tools to create backtrace of mixed native and Java code.

This is a cherry pick from aosp/master which fixes several issues.
Most notably:
* It enables generation of ELF-64 on 64-bit systems (in dex2oat, C
compilers already produce ELF-64). Libunwind requires ELF-64 on
64-bit systems for backtraces to work.
* It enables loading of ELF files with dlopen. This is required for
libunwind to be able to generate backtrace of current process (i.e.
the process requesting backtrace of itself).
* It adds unit test to test the above (32 vs 64 bit, in-proces vs
out-of-process, application code vs framework code).
* Some other fixes or clean-ups which should not be of much
significance but which are easier to include to make the
important CLs cherry-pick cleanly.

This is squash of the following commits from aosp/master:
7381010 ART: CFI Test
e1bbed2 ART: Blacklist CFI test for non-compiled run-tests
aab9f73 ART: Blacklist CFI test for JIT
4437219 ART: Blacklist CFI test for Heap Poisoning
a3a49fe Switch to using ELF-64 for 64-bit architectures.
297ed22 Write 64-bit address in DWARF if we are on 64-bit architecture.
24981a1 Set correct size of PT_PHDR ELF segment.
1a146bf Link .dynamic to .dynstr
67a0653 Make some parts of ELF more (pointer) aligned.
f50fa82 Enable 64-bit CFI tests.
49e1fab Use dlopen to load oat files.
5dedb80 Add more logging output for dlopen.
aa03870 Find the dlopened file using address rather than file path.
82e73dc Release dummy MemMaps corresponding to dlopen.
5c40961 Test that we can unwind framework code.
020c543 Add more log output to the CFI test.
88da3b0 ART: Fix CFI test wrt/ PIC
a70e5b9 CFI test: kill the other process in native code.
ad5fa8c Support generation of CFI in .debug_frame format.
90688ae Fix build - large frame size of ElfWriterQuick<ElfTypes>::Write.
97dabb7 Fix build breakage in dwarf_test.
388d286 Generate just single ARM mapping symbol.
f898087 Split .oat_patches to multiple sections.
491a7fe Fix build - large frame size of ElfWriterQuick<ElfTypes>::Write (again).
8363c77 Add --generate-debug-info flag and remove the other two flags.
461d72a Generate debug info for core.oat files.

Bug: 21924613
Change-Id: I3f944a08dd2ed1df4d8a807da4fee423fdd35eb7
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
e401d146407d61eeb99f8d6176b2ac13c4df1e33 22-Apr-2015 Mathieu Chartier <mathieuc@google.com> Move mirror::ArtMethod to native

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

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

Bug: 19264997
Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
8363c772581bf00ebcdc2e38391b4bfae51beb75 28-May-2015 David Srbecky <dsrbecky@google.com> Add --generate-debug-info flag and remove the other two flags.

Replace the flags --include-debug-symbols and --include-cfi
with single flag called --generate-debug-info (with alias -g).

The name "symbol" was not ideal, since depending on context it
may be interpreted as "ELF symbols", or "debugging information".

This CL also means that we have only the options to include
either all debugging information or none. This should be fine,
since we can use standard tools to strip anything we do not want.

Change-Id: I721fded56d755d7eed0ef36aa84e841a1f5747f8
41b175aba41c9365a1c53b8a1afbd17129c87c14 19-May-2015 Vladimir Marko <vmarko@google.com> ART: Clean up arm64 kNumberOfXRegisters usage.

Avoid undefined behavior for arm64 stemming from 1u << 32 in
loops with upper bound kNumberOfXRegisters.

Create iterators for enumerating bits in an integer either
from high to low or from low to high and use them for
<arch>Context::FillCalleeSaves() on all architectures.

Refactor runtime/utils.{h,cc} by moving all bit-fiddling
functions to runtime/base/bit_utils.{h,cc} (together with
the new bit iterators) and all time-related functions to
runtime/base/time_utils.{h,cc}. Improve test coverage and
fix some corner cases for the bit-fiddling functions.

Bug: 13925192

(cherry picked from commit 80afd02024d20e60b197d3adfbb43cc303cf29e0)

Change-Id: I905257a21de90b5860ebe1e39563758f721eab82
80afd02024d20e60b197d3adfbb43cc303cf29e0 19-May-2015 Vladimir Marko <vmarko@google.com> ART: Clean up arm64 kNumberOfXRegisters usage.

Avoid undefined behavior for arm64 stemming from 1u << 32 in
loops with upper bound kNumberOfXRegisters.

Create iterators for enumerating bits in an integer either
from high to low or from low to high and use them for
<arch>Context::FillCalleeSaves() on all architectures.

Refactor runtime/utils.{h,cc} by moving all bit-fiddling
functions to runtime/base/bit_utils.{h,cc} (together with
the new bit iterators) and all time-related functions to
runtime/base/time_utils.{h,cc}. Improve test coverage and
fix some corner cases for the bit-fiddling functions.

Bug: 13925192
Change-Id: I704884dab15b41ecf7a1c47d397ab1c3fc7ee0f7
99ca40cf9d390479a7243b8b3321cad7d9faa2a4 16-May-2015 Andreas Gampe <agampe@google.com> ART: Refactor UnstartedRuntime for testing

Expose the UnstartedRuntime implementation functions as private static
methods of a class. Add a gtest that can invoke these functions. Add
sample tests for String and Memory.

Bug: 21173514

(cherry picked from commit 799681b176ad25437ce2849639f54f610dcbf684)

Change-Id: Ib5bde6347fafaf7607c642542ea7d5938ff4b1df
799681b176ad25437ce2849639f54f610dcbf684 16-May-2015 Andreas Gampe <agampe@google.com> ART: Refactor UnstartedRuntime for testing

Expose the UnstartedRuntime implementation functions as private static
methods of a class. Add a gtest that can invoke these functions. Add
sample tests for String and Memory.

Bug: 21173514
Change-Id: Ib5bde6347fafaf7607c642542ea7d5938ff4b1df
094ff2c0c1f736521c634d5f606e274cb6c55345 13-May-2015 Sebastien Hertz <shertz@google.com> Fix debuggable compiler flag detection for secondary dex files

Compiles secondary dex files like the primary dex file: if it has
been compiled with the --debuggable flag, compile secondary dex files
with the --debuggable flag too.

Therefore, dex files loaded at runtime are compiled the same way as
dex files compiled at install time on the classpath (excluding the
boot image that is not compiled debuggable).

Also adds debuggable key in the oat header and bump the oat version.

Bug: 20944228

(cherry picked from commit 0de1133ba600f299b3d67938f650720d9f859eb2)

Change-Id: If6b2236e7fe547cc421f57b573043748018d3ae0
0de1133ba600f299b3d67938f650720d9f859eb2 13-May-2015 Sebastien Hertz <shertz@google.com> Fix debuggable compiler flag detection for secondary dex files

Compiles secondary dex files like the primary dex file: if it has
been compiled with the --debuggable flag, compile secondary dex files
with the --debuggable flag too.

Therefore, dex files loaded at runtime are compiled the same way as
dex files compiled at install time on the classpath (excluding the
boot image that is not compiled debuggable).

Also adds debuggable key in the oat header and bump the oat version.

Bug: 20944228
Change-Id: I59119f3468adb27ab1d6026f2cefbebbd814224c
f307f8c11bee8d9539880d4b226a8c80c6eae0d4 04-May-2015 Andreas Gampe <agampe@google.com> ART: Emit debug info when app is debuggable

Emit debug symbols and CFI when dex2oat is compiling with the
--debuggable flag.

Bug: 17011129

(cherry picked from commit 8484d23186c229e2927441f85ae819abb4996072)

Change-Id: I0afab1e46abd819eded2b823580e766619497393
8484d23186c229e2927441f85ae819abb4996072 04-May-2015 Andreas Gampe <agampe@google.com> ART: Emit debug info when app is debuggable

Emit debug symbols and CFI when dex2oat is compiling with the
--debuggable flag.

Bug: 17011129
Change-Id: I0afab1e46abd819eded2b823580e766619497393
19ad58245b5fac4bdf02045ac47472935b0717cd 29-Apr-2015 Andreas Gampe <agampe@google.com> ART: Move dex2oat watchdog output to LogLine

The fprintf isn't visible on device, as it doesn't end up in the
logcat.

Also increase the watchdog timeout to 10 minutes.

Bug: 20658562

(cherry picked from commit d687e375cf7507b5c36df63cf03c991038b1c218)

Change-Id: I1fec8dae25f9282f72e762bda934fceb948bbd5f
d687e375cf7507b5c36df63cf03c991038b1c218 29-Apr-2015 Andreas Gampe <agampe@google.com> ART: Move dex2oat watchdog output to LogLine

The fprintf isn't visible on device, as it doesn't end up in the
logcat.

Also increase the watchdog timeout to 10 minutes.

Bug: 20658562
Change-Id: I1fec8dae25f9282f72e762bda934fceb948bbd5f
f99bcd2fba4c5a485ced108d63c4a49835d66e5c 25-Apr-2015 Andreas Gampe <agampe@google.com> ART: Do not log non-swap usage

Reduce logcat noise.

Bug: 20501758
Change-Id: I5cbc28614d4be9e7fd120b7ccb97ca489e341f54
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
70bef0d8f6aa30b0da5c6ca56e1bc5729f74654b 15-Apr-2015 Andreas Gampe <agampe@google.com> ART: Add compiled-methods

Add a dex2oat option for compiled-methods, a more granular filter
than compiled-classes. Add compiler-driver support for it.

Refactor dex2oat to reuse file reading.

Add a test to oat_test.

Change-Id: I78d0d040bce7738b4bb7aabe7768b5788d2587ac
b1fceadbd42b3047a9c06a8af6239c737d67344e 21-Apr-2015 Andreas Gampe <agampe@google.com> ART: Change image_classes and compiled_classes to unordered set

These lists can be large, and the soon-to-follow compiled_methods
will be potentially even larger. Use a hash set instead of a tree
set.

Change-Id: I7d25c075540f47771354c6f49928b4fd0c76eb2e
7848da48a0a4241dedc1cc83ac4931e61575eb92 09-Apr-2015 Andreas Gampe <agampe@google.com> ART: Store classpath information into oat file

Store a "dependency list" of class-path dex-files into the key-value
store of an oat file. The list is made up of dex locations and
corresponding checksums.

Add tests for encoding, decoding and checking the list.

Bug: 19781184
Change-Id: Ie700dd37e6e086db599c95d329ac1f1d2ff0b758
8dc7324da5bd0f2afd2ab558ab04882329a61fe8 12-Apr-2015 David Srbecky <dsrbecky@google.com> Add --include-cfi compiler option.

Decouple generation of CFI from the rest of debug symbols.
This makes it possible to generate oat with CFI but without
the rest of debug symbols.

This is in line with intention of the .eh_frame section.
The section does not have the .debug_ prefix because it
is considered somewhat different to the rest of debug symbols.

Change-Id: I32816ecd4f30ac4e0dc69d69a4993e349c737f96
af58780a2ed000581bf93fa2b018bfb081e61f00 13-Apr-2015 Snowcat8436 <snowcat8436@gmail.com> Remove duplicated dex2oat usage message

Because '--huge-method-max' usage message is duplicated,
Remove duplicated dex2oat usage message.

Change-Id: I91cef8319d7292e4977eba49dfcb8cc2cd9ac1bf
7f49e672bc943c49ca8af438ae4bd61b95fe364b 12-Apr-2015 David Srbecky <dsrbecky@google.com> Remove the --gen-gdb-info compiler option.

It is never used. We generally use --include-debug-symbols instead.

Change-Id: I933495cd85ab4f7dfcf3ef3cd2d943d4b870ffeb
e3712d074a6e9b5d6dfd2db33c556f25b713dade 09-Apr-2015 Andreas Gampe <agampe@google.com> ART: Use canonical location in dex2oat

To filter class-path dex files, use the canonical location, not
the location. That will correctly resolve relative vs absolute
paths.

Bug: 20133593
Change-Id: I894656cb6bef75cdaffb188987af0a3647c74ad6
3d329d7bbc1e04e9d1a9999f7785469d2ac88fc4 23-Mar-2015 Jean-Philippe Halimi <jean-philippe.halimi@intel.com> ART: Adds a help message for parallel compilation

This patch adds a message for the "j" option of dex2oat in order to explicit
its usage.

Change-Id: I5a50e52b38f579f9956ad92a7daaf77bfa4c893f
Signed-off-by: Jean-Philippe Halimi <jean-philippe.halimi@intel.com>
4585f876eb5dfb936bd0d6cb6acd78a1f2182ba6 28-Mar-2015 Andreas Gampe <agampe@google.com> ART: Some runtime cleanup

Use an enum for the compiler-callback mode.

Refactor and remove some unnecessary includes in runtime.h.

Change-Id: If2245fa470171311b8e05b677cf6bb28f209585a
81c6f8db12b203878a7d72444ead2bc7cf5c47ad 26-Mar-2015 Andreas Gampe <agampe@google.com> ART: PathClassLoader for compiler

Use an actual PathClassLoader when compiling apps, instead of a
side structure and cutout.

This CL sets up a minimal object 'cluster' that recreates the Java
side of a regular ClassLoader such that the Class-Linker will
recognize it and use the internal native fast-path.

This CL removes the now unnecessary compile-time-classpath and
replaces it with a single 'compiling-the-boot-image' flag in the
compiler callbacks.

Note: This functionality is *only* intended for the compiler, as
the objects have not been completely initialized.

Bug: 19781184

Change-Id: I7f36af12dd7852d21281110a25c119e8c0669c1d
36540cb4d549c706cc7cd23086684f1548a91042 23-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Implement a space filter for optimizing.

Heuristic-based. Currently only for enabling fugu user build.

Change-Id: I76e652bd3f00ed84a2a8ad69c7c2c0e24d74cd68
027f0ff64c2512b9a5f1f54f3fea1bec481eb0f5 28-Feb-2015 Douglas Leung <douglas.leung@imgtec.com> ART: Add Mips32r6 backend support

Add Mips32r6 compiler support.

Don't use deprecated Mips32r2 instructions if running in Mips32r6
mode.

Change-Id: I54e689aa8c026ccb75c4af515aa2794f471c9f67
e86deeffad79c00ed2ebede04f4adc348bda790c 19-Mar-2015 Mathieu Chartier <mathieuc@google.com> Add verify-at-runtime compiler filter

Verifies at runtime only, instead of at compilation time.
AOSP HH boot time after clean-oat: ~30s instead of ~35s if enabled.
Also helps install time if enabled there.

TODO: See if there is any possible deadlocks that can result from
this.

Bug: 19762303

Change-Id: Ibfba77148da9039e8d7d7497c05486bc044eefe7
1412dfa4adcd511902e510fa0c948b168ab5840c 20-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Use optimizing for apps.""

This reverts commit 706cae36209932f258b2fe2e396f31d2dd7d585e.

Change-Id: I75cc6206ec17ade52a6db0737b62aa37ea2fa300
706cae36209932f258b2fe2e396f31d2dd7d585e 19-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Use optimizing for apps."

This reverts commit f3251d12dfa387493dbde4c4148a633802f5f7e3.

Change-Id: I32514e10ece55ee7bd7382ce2e956d57c9b621e5
e934df2f3276d1e07c5c95a0fe47fc84b4c9438e 17-Mar-2015 Richard Uhler <ruhler@google.com> Improve dex2oat --dex-file and --dex-location usage info.

Change-Id: I8cb2070149ad9fdcf01d773abb1547811999772f
f3251d12dfa387493dbde4c4148a633802f5f7e3 11-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Use optimizing for apps.

Doing it in dex2oat, to avoid messing up with our current testing.

Change-Id: I76c58f11f0d4756b894e797fc52712453e35adb1
2969bcdcd80624e4a4fef696b54c2c76b44b6853 09-Mar-2015 Andreas Gampe <agampe@google.com> ART: Refactor unstarted runtime

Refactor and clean up unstarted runtime.

Bug: 19542228
Change-Id: Ib3e4b3517e06e8242d4fed32ca59419fef553a47
6ea651f0f4c7de4580beb2e887d86802c1ae0738 24-Feb-2015 Maja Gagic <maja.gagic@imgtec.com> Initial support for quick compiler on MIPS64r6.

Change-Id: I6f43027b84e4a98ea320cddb972d9cf39bf7c4f8
a11a34c908e847711e6ccf221d61b45d0c4c963d 06-Mar-2015 Brian Carlstrom <bdc@google.com> Do not dump memory usage if driver was never created

Bug: https://code.google.com/p/android/issues/detail?id=158593
Change-Id: I8084f9ac823910aa11f854f3e764240741fbf0d5
6cf49e57ad7a61e1fffd5b1dfae9179c3ca5703d 05-Mar-2015 Andreas Gampe <agampe@google.com> ART: Add option to abort dex2oat on hard failure

Add an option that aborts dex2oat when a hard verifier failure occurs.

Bug: 19606409
Change-Id: I53195284e22fe6207274101e85745af763c06271
7b2f09eb6b5c74ffc38bd70f0aa74b8f8112e394 02-Mar-2015 Andreas Gampe <agampe@google.com> ART: Add debuggable compiler flag

Add a flag to compiler options that shows debuggability.

Change-Id: Id17ec72babe2ee88713a0d274eff86508de30666
f3c7ba6a5759873138fbf4ae24a216dc0d87a3fe 24-Feb-2015 Jeff Hao <jeffhao@google.com> Remove ART_SMALL_MODE ifdefs.

WITH_ART_SMART_MODE now sets --compiler-filter options instead.
Has a corresponding change to /build

Bug: 19460766
Change-Id: I295ebbd49caa5341834141f7c2bbf8df830131ed
1d00addb6e6a6d0386cba393774031dbd88121ba 28-Feb-2015 Andreas Gampe <agampe@google.com> ART: Allow dex2oat for apps only with image

Do not allow a runtime without image when compiling an app. This
avoids the current abort when we then try to run out of the (missing)
boot classpath.

Bug: 19100590
Change-Id: Ic269dc2fa807d003215ea134cb42fe4c4d78124e
794ad76e8d5b5b9132819d5b08a0570e27615644 23-Feb-2015 Andreas Gampe <agampe@google.com> ART: Introduce NO_RETURN, Mark DoLongJump noreturn

Add NO_RETURN macro that adds C++11 noreturn attribute. Mark
DoLongJump methods as noreturn.

Change-Id: Ifde4318e370493237050d4c1349285a0382df23f
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
aa3eff991fc34d6434465bf6bf49ef2e2fb286b7 20-Jan-2015 Andreas Gampe <agampe@google.com> ART: Curb dex2oat verbosity

Only print dedupe collisions in a debug build or on verbose logging.

Bug: 19082662

(cherry picked from commit 8d295f8f0e88fa5c6373962d545020a06033b3fc)

Change-Id: I08bd04a453d95b6dba6cf6955b5741cd97daf480
8d295f8f0e88fa5c6373962d545020a06033b3fc 20-Jan-2015 Andreas Gampe <agampe@google.com> ART: Curb dex2oat verbosity

Only print dedupe collisions in a debug build or on verbose logging.

Change-Id: I08bd04a453d95b6dba6cf6955b5741cd97daf480
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
c5a3ea7522b59c18daa4325d69703a6f7f743378 14-Jan-2015 Andreas Gampe <agampe@google.com> ART: Introduce Mips32 R6

Add an instruction-set feature for Mips R6. Currently restricted
to the interpreter.

Change-Id: Ic6d888e135bc87340229a0543dd94d0c1e863edd
fbef44de596d298dc6430f482dffc933a046dd28 23-Dec-2014 Richard Uhler <ruhler@google.com> Use unique_ptr to track ownership of dex files.

Bug: 18809837
Change-Id: Ie571eae8fc19ee9207390cff5c7e2a38071b126a
866c03125a3fcd74c9fff04da87865f5eb1767d9 13-Jan-2015 David Brazdil <dbrazdil@google.com> ART: dex2oat flag for HGraphVisualizer dump file

This patch adds a new '--dump-cfg=<file>' flag to dex2oat which
specifies the file that HGraphVisualizer will store its output into.
Until now the graph was dumped to 'art.cfg' in the current working
directory. To make Checker work with run-test, the output directory
needs to be customizable.

Change-Id: I4a940f7708b88deea5a0e51d13aed13e52199349
6e73272f093e9dc045c08baae57eebb5dcd6e044 13-Jan-2015 Andreas Gampe <agampe@google.com> Revert "ART: dex2oat flag for HGraphVisualizer dump file"

Breaks compilation of tests.

This reverts commit 54953dfdcb3bb8896d8af2d20adef84fb740ce77.

Change-Id: I868b876c3130be61f1169c5fccdffc0368bee11e
54953dfdcb3bb8896d8af2d20adef84fb740ce77 13-Jan-2015 David Brazdil <dbrazdil@google.com> ART: dex2oat flag for HGraphVisualizer dump file

This patch adds a new flag to dex2oat which allows to specify the
name of the file that HGraphVisualizer will store its output into.
Until now the graph was dumped to "art.cfg" in the current working
directory. To make Checker work with run-test, the output directory
needs to be customizable.

Change-Id: I395c518b987e594e89e5e80f202a96befa41ac20
c275259449ec57987e52d3ab1eda3272b994488f 02-Jan-2015 Richard Uhler <ruhler@google.com> Remove back-door bootclasspath option from Runtime

The 'bootclasspath' option allowed users of the Runtime to load their
own boot class path DexFiles and pass them directly to the Runtime as
an option. This obscures the fact that the Runtime must take ownership
of the boot class path DexFiles.

This change removes the use of the bootclasspath option by dex2oat and
the common runtime tests. For dex2oat, we use the existing
-Xbootclasspath option instead, and introduce a new
-Xbootclasspath-locations option to override the dex locations for the
loaded boot class path dex files. For the common runtime tests, we
simply use -Xbootclasspath.

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

Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
6fc59abce810b87b6fb07dbd1e84f9dca02fd487 11-Dec-2014 Dan Albert <danalbert@google.com> Fix alloc-dealloc-mismatch failures in dex2oat.

These errors are for calling `delete` on something allocated with
`new[]`.

Bug: 18202869
Change-Id: I8032664dd0819740e83a04cd5a0d56e2c097aacf
95b033ba10d0bd5be91ec868280b9b97ad6666be 04-Dec-2014 Brian Carlstrom <bdc@google.com> Remove dex2oat watchdog warning

The warning output is breaking vm-tests on some devices. It does not
seem to serve much of a purpose given that it does not go to logcat
and long running compiles can be identified by the time summary
printed at the end of dex2oat.

(cherry picked from commit c1bfaa22570b4f771ae1cd832201b01ec84e32c1)

Bug: 18609574
Change-Id: Iefc3c51be35ceaff0031522c4d6c2cdf5703dcb6
c1bfaa22570b4f771ae1cd832201b01ec84e32c1 04-Dec-2014 Brian Carlstrom <bdc@google.com> Remove dex2oat watchdog warning

The warning output is breaking vm-tests on some devices. It does not
seem to serve much of a purpose given that it does not go to logcat
and long running compiles can be identified by the time summary
printed at the end of dex2oat.

Bug: 18609574
Change-Id: Ic4f3d118d99e4b307cbb7c4c2b57f05a003e092e
ab972ef472001fa113d54486d7592979e33480b3 04-Dec-2014 Mathieu Chartier <mathieuc@google.com> Remove method verification results right after compiling a method

This saves memory since it allows the code arrays from methods
compiled in future methods to use the ram we just freed from the
verification results.

GmsCore.apk:
Before: dex2oat took 77.383s (threads: 2) arena alloc=6MB java alloc=30MB native alloc=77MB free=13KB
After: dex2oat took 72.180s (threads: 2) arena alloc=6MB java alloc=30MB native alloc=60MB free=13KB

Bug: 18596910
Change-Id: I5d6df380e4fe58751a2b304202083f4d30b33b7c
(cherry picked from commit 25fda92083d5b93b38cc1f6b12ac6a44d992d6a4)
25fda92083d5b93b38cc1f6b12ac6a44d992d6a4 04-Dec-2014 Mathieu Chartier <mathieuc@google.com> Remove method verification results right after compiling a method

This saves memory since it allows the code arrays from methods
compiled in future methods to use the ram we just freed from the
verification results.

GmsCore.apk:
Before: dex2oat took 77.383s (threads: 2) arena alloc=6MB java alloc=30MB native alloc=77MB free=13KB
After: dex2oat took 72.180s (threads: 2) arena alloc=6MB java alloc=30MB native alloc=60MB free=13KB

Bug: 18596910
Change-Id: I5d6df380e4fe58751a2b304202083f4d30b33b7c
a650e700ddcfef0ad86284b0f0818543a196014a 03-Dec-2014 Andreas Gampe <agampe@google.com> ART: Fix unclosed files in dex2oat

Under some error conditions files are not closed, and the close guard
will complain.

Bug: 18603475

(cherry picked from commit d97465c3742cc3c82843665f2678b881de29854b)

Change-Id: I7155e3f4f6231844edd375b9302ecf1ba8079950
d97465c3742cc3c82843665f2678b881de29854b 03-Dec-2014 Andreas Gampe <agampe@google.com> ART: Fix unclosed files in dex2oat

Under some error conditions files are not closed, and the close guard
will complain.

Bug: 18603475
Change-Id: I7155e3f4f6231844edd375b9302ecf1ba8079950
e3a650a5b332875f8c6a8aca9b54598442b40a4b 03-Dec-2014 Mathieu Chartier <mathieuc@google.com> Fix mac build

Macs don't have malloc.h, hopefully this fixes the build.

(cherry picked from commit 6cc5076a1248582cf16bd9a6a1719e0a4c1a1de2)

Change-Id: I94d10d2c3d16893625df210bdd5587eea4a1247f
6cc5076a1248582cf16bd9a6a1719e0a4c1a1de2 03-Dec-2014 Mathieu Chartier <mathieuc@google.com> Fix mac build

Macs don't have malloc.h, hopefully this fixes the build.

Change-Id: Id7600ea79197f36d3dfb5e7d589ac2f6ee325f85
49285c596bb48a52c42eac4005707e441ef916a7 03-Dec-2014 Mathieu Chartier <mathieuc@google.com> Print memory usage in dex2oat shutdown

Example on mako:
I/dex2oat (31071): dex2oat took 31.195s (threads: 2) arena alloc=1013KB java alloc=13MB native alloc=32MB free=1490KB

Bug: 18069309

Change-Id: I08eac00842be35d4e659bddc8513f2062be725c9

(cherry picked from commit 3029df6d212894647ba0e5c23443c40912c6ecc8)
3029df6d212894647ba0e5c23443c40912c6ecc8 03-Dec-2014 Mathieu Chartier <mathieuc@google.com> Print memory usage in dex2oat shutdown

Example on mako:
I/dex2oat (31071): dex2oat took 31.195s (threads: 2) arena alloc=1013KB java alloc=13MB native alloc=32MB free=1490KB

Bug: 18069309

Change-Id: I08eac00842be35d4e659bddc8513f2062be725c9
4586fb6fe8a5df17e5dc02b3c1ae8d284815274f 28-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Print the right default for the compiler backend.

Change-Id: I7083c640af6e2af1c333d5551ba2391ab672954d
dbfe254f5ca96f6c5b2284478597d6140c01a394 26-Nov-2014 Andreas Gampe <agampe@google.com> ART: Print initialization failures to file

Add the ability to print boot image initialization failures to a
file.

Add a tool to convert said file into a Graphviz file.

Change-Id: Iedcc337bdf05654c154aa553236f20bdd15572ee
9bb492a33c97e72d0c43a4ee968e34cc32534981 26-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Add ART_USE_OPTIMIZING_COMPILER flag.

Change-Id: I86065aec5bfe59729c6a4064a3e54d5b523ca45c
10e477df468a1f6a09236b9b49417d6538c559f0 19-Nov-2014 Andreas Gampe <agampe@google.com> ART: Split image and non-image case in dex2oat

Explicitly split out the cases (even if there is redundancy). Have
explicit flush and close operations.

Change-Id: I5ffa4c84b4f4a1f42244d4cb7af2b5cf36739c87
4303ba97313458491e038d78efa041d41cf7bb43 06-Nov-2014 Andreas Gampe <agampe@google.com> ART: Track Flush & Close in FdFile

Implement a check that aborts when a file hasn't been explicitly
flushed and closed when it is destructed.

Add WARN_UNUSED to FdFile methods.

Update dex2oat, patchoat, scoped_flock and some gtests to pass with
this.

(cherry picked from commit 9433ec60b325b708b9fa87e699ab4a6565741494)

Change-Id: I9ab03b1653e69f44cc98946dc89d764c3e045dd4
9433ec60b325b708b9fa87e699ab4a6565741494 06-Nov-2014 Andreas Gampe <agampe@google.com> ART: Track Flush & Close in FdFile

Implement a check that aborts when a file hasn't been explicitly
flushed and closed when it is destructed.

Add WARN_UNUSED to FdFile methods.

Update dex2oat, patchoat, scoped_flock and some gtests to pass with
this.

Change-Id: I9ab03b1653e69f44cc98946dc89d764c3e045dd4
85448d4b9c0720049a7ee4afa331870e87d83995 11-Nov-2014 Andreas Gampe <agampe@google.com> ART: Compiled-classes list for compiler-driver

Similar to the image-classes list, introduce a list of class names
that are to be compiled when creating a boot image. This defaults
to all classes.

Bug: 18336591

(cherry picked from commit 26318f722958ac1cba6a812026a1377f37c54941)

Change-Id: I95f69afdb500a9defb6795803d4040bbe67c5a01
d582fa4ea62083a7598dded5b82dc2198b3daac7 06-Nov-2014 Ian Rogers <irogers@google.com> Instruction set features for ARM64, MIPS and X86.

Also, refactor how feature strings are handled so they are additive or
subtractive.
Make MIPS have features for FPU 32-bit and MIPS v2. Use in the quick compiler
rather than #ifdefs that wouldn't have worked in cross-compilation.
Add SIMD features for x86/x86-64 proposed in:
https://android-review.googlesource.com/#/c/112370/

Bug: 18056890

Change-Id: Ic88ff84a714926bd277beb74a430c5c7d5ed7666
4bf3ae9930a155f238dfd471413c866912b2579e 11-Nov-2014 Andreas Gampe <agampe@google.com> ART: Compiled-classes list for compiler-driver

Similar to the image-classes list, introduce a list of class names
that are to be compiled when creating a boot image. This defaults
to all classes.

Bug: 18336591

(cherry picked from commit 26318f722958ac1cba6a812026a1377f37c54941)

Change-Id: I95f69afdb500a9defb6795803d4040bbe67c5a01
0d8db99ac5d838f81e0d3be83a5b00d5475edf86 11-Nov-2014 Nicolas Geoffray <ngeoffray@google.com> Implement invokesuper in optimizing.

- Ensure dex2oat is in PIC mode, as this will drive the decisions
made in the compiler driver, and optimizing only suppots PIC
anyway.

- Since invokesuper is sharpened into invoke-direct, also support
sharpening of invokeinterface and invokevirtual.

Change-Id: I0a1bd79a13dc1c9e67e3cb11d38f0cd4459968ae
26318f722958ac1cba6a812026a1377f37c54941 11-Nov-2014 Andreas Gampe <agampe@google.com> ART: Compiled-classes list for compiler-driver

Similar to the image-classes list, introduce a list of class names
that are to be compiled when creating a boot image. This defaults
to all classes.

Bug: 18336591
Change-Id: I95f69afdb500a9defb6795803d4040bbe67c5a01
48447025389cd67605041a28d4ded1528381bc4e 22-Oct-2014 Igor Murashkin <iam@google.com> ART: Add support for patching and loading OAT files compiled with PIC

* Images (.art) compiled with pic now have a new field added.
* isDexOptNeeded will now skip patch-ing for apps compiled PIC
* First-boot patching now only copies boot.art, boot.oat is linked

As a result, all system preopted dex files (with --compile-pic) no
longer take up any space in /data/dalvik-cache/<isa>.

(cherry-picked from AOSP master
46774767fcf7780d1455e755729198648d08742e)

Conflicts (from aosp master):
compiler/image_test.cc
compiler/image_writer.cc
compiler/image_writer.h
compiler/oat_test.cc
dex2oat/dex2oat.cc
oatdump/oatdump.cc
runtime/elf_file.cc
runtime/elf_file.h
runtime/elf_file_impl.h
runtime/oat_file.cc
runtime/oat_file.h

Bug: 18035729

(cherry picked from commit 90ca5c0301651101de0e363842e5d08ae65233f7)

Change-Id: I8d99f95cc3d1fa221fc530ebb1fcc4b3263c183d
998ee7d0f62a1ee7efaaad49e728d19c38b4c9c3 23-Oct-2014 Andreas Gampe <agampe@google.com> ART: Add pic flag to oat header store

Add the compile-time PIC flag to the oat-header key-value store.
Ignore image offset and patch delta when loading PIC oat files.

(cherry-picked from AOSP master
7ba649636c4475c3992fa15a57acd2546d69ff38)

Bug: 18035729
Signed-off-by: Igor Murashkin <iam@google.com>

(cherry picked from commit d7392faea80acb5d73a027bb384e3222bc2c2e43)

Change-Id: If5f6cf13f4c7ecb6038415e68fbb0ae9cee5ec60
300590bd7291251d9ac9aa762785a517d7f9f919 17-Oct-2014 Igor Murashkin <iam@google.com> dex2oat: Add a --compile-pic option

(cherry-picked from AOSP master
83c5612e69fa05610baf4f4d237fe0995a79cde5)

Bug: 18035729

(cherry picked from commit 643b5df2b065ccf5bb19a183573da691e9d0311f)

Change-Id: I14edee7c7cb996bc388d89b4c5274db2caf91004
a99013f678e24bcc605431cb96da80ea968ebed9 07-Nov-2014 Andreas Gampe <agampe@google.com> Revert "ART: Missing EndTiming()s in dex2oat"

Only meant for sprout and mr-1.

This reverts commit f0cb1eb5b2020c3c527aca3ff458801b90b5e06c.
88ec7f45c0e2c3f659048fbe4b1dc78730fdaea8 05-Nov-2014 Andreas Gampe <agampe@google.com> ART: Refactor dex2oat

Take the huge dex2oat main function apart. Move to ScopedLogging.

Bug: 18276913
Bug: 17444504
Change-Id: Iab3d7437d60508088cb16bf33da0c5defbf7ae03
f0cb1eb5b2020c3c527aca3ff458801b90b5e06c 06-Nov-2014 Andreas Gampe <agampe@google.com> ART: Missing EndTiming()s in dex2oat

In the failure case, make sure we do an EndTiming() to not abort
because of Start-End mismatch.

Bug: 18273355
Change-Id: I42e68dd337dfe32c3b90511a04bc8f12114b9484
277ccbd200ea43590dfc06a93ae184a765327ad0 04-Nov-2014 Andreas Gampe <agampe@google.com> ART: More warnings

Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general,
and -Wunused-but-set-parameter for GCC builds.

Change-Id: I81bbdd762213444673c65d85edae594a523836e5
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
90ca5c0301651101de0e363842e5d08ae65233f7 22-Oct-2014 Igor Murashkin <iam@google.com> ART: Add support for patching and loading OAT files compiled with PIC

* Images (.art) compiled with pic now have a new field added.
* isDexOptNeeded will now skip patch-ing for apps compiled PIC
* First-boot patching now only copies boot.art, boot.oat is linked

As a result, all system preopted dex files (with --compile-pic) no
longer take up any space in /data/dalvik-cache/<isa>.

(cherry-picked from AOSP master
46774767fcf7780d1455e755729198648d08742e)

Conflicts (from aosp master):
compiler/image_test.cc
compiler/image_writer.cc
compiler/image_writer.h
compiler/oat_test.cc
dex2oat/dex2oat.cc
oatdump/oatdump.cc
runtime/elf_file.cc
runtime/elf_file.h
runtime/elf_file_impl.h
runtime/oat_file.cc
runtime/oat_file.h

Bug: 18035729
Change-Id: Ie1acad81a0fd8b2f24e1f3f07a06e6fdb548be62
d7392faea80acb5d73a027bb384e3222bc2c2e43 23-Oct-2014 Andreas Gampe <agampe@google.com> ART: Add pic flag to oat header store

Add the compile-time PIC flag to the oat-header key-value store.
Ignore image offset and patch delta when loading PIC oat files.

(cherry-picked from AOSP master
7ba649636c4475c3992fa15a57acd2546d69ff38)

Bug: 18035729
Signed-off-by: Igor Murashkin <iam@google.com>
Change-Id: Ie1f1ef37125386a968228033d1e2bec565315510
643b5df2b065ccf5bb19a183573da691e9d0311f 17-Oct-2014 Igor Murashkin <iam@google.com> dex2oat: Add a --compile-pic option

(cherry-picked from AOSP master
83c5612e69fa05610baf4f4d237fe0995a79cde5)

Bug: 18035729
Change-Id: I80e03613e3b6ac079bcbc7e068bbaae760c364c9
70587a24fdec9a14192e57fe148aeb3374b10635 29-Oct-2014 Andreas Gampe <agampe@google.com> ART: Fix multi-image testing

Also, make an unknown compiler backend string fail dex2oat.

Change-Id: I878aef47d3c2c84b8479420e1a7ea2852993de35
46774767fcf7780d1455e755729198648d08742e 22-Oct-2014 Igor Murashkin <iam@google.com> ART: Add support for patching and loading OAT files compiled with PIC

* Images (.art) compiled with pic now have a new field added.
* isDexOptNeeded will now skip patch-ing for apps compiled PIC
* First-boot patching now only copies boot.art, boot.oat is linked

As a result, all system preopted dex files (with --compile-pic) no
longer take up any space in /data/dalvik-cache/<isa>.

Bug: 18035729
Change-Id: Ie1acad81a0fd8b2f24e1f3f07a06e6fdb548be62
7ba649636c4475c3992fa15a57acd2546d69ff38 23-Oct-2014 Andreas Gampe <agampe@google.com> ART: Add pic flag to oat header store

Add the compile-time PIC flag to the oat-header key-value store.
Ignore image offset and patch delta when loading PIC oat files.

Change-Id: Ie1f1ef37125386a968228033d1e2bec565315510
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
c7dd295a4e0cc1d15c0c96088e55a85389bade74 22-Oct-2014 Ian Rogers <irogers@google.com> Tidy up logging.

Move gVerboseMethods to CompilerOptions. Now "--verbose-methods=" option to
dex2oat rather than runtime argument "-verbose-methods:".
Move ToStr and Dumpable out of logging.h, move LogMessageData into logging.cc
except for a forward declaration.
Remove ConstDumpable as Dump methods are all const (and make this so if not
currently true).
Make LogSeverity an enum and improve compile time assertions and type checking.
Remove log_severity.h that's only used in logging.h.
With system headers gone from logging.h, go add to .cc files missing system
header includes.
Also, make operator new in ValueObject private for compile time instantiation
checking.

Change-Id: I3228f614500ccc9b14b49c72b9821c8b0db3d641
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
d7a11bc4b207fbc1455f90873d99c95c4576667c 17-Oct-2014 Nicolas Geoffray <ngeoffray@google.com> Fix dex2oat cross-compilation.

The instruction set features was not correctly set when it was not
given in the command line.

Change-Id: I649cc077e7bbc830d281ae59af43e59fd0541c1b
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
d6dee676acdd1ab0aa4e5ba6834ee7c40a6dd8ab 17-Oct-2014 Igor Murashkin <iam@google.com> dex2oat: Add a --compile-pic option

Change-Id: I80e03613e3b6ac079bcbc7e068bbaae760c364c9
c54e12a413e16f90526318f1f466a900a717fbb0 15-Oct-2014 Mathieu Chartier <mathieuc@google.com> Change MemMap::maps_ to not be global variable

Runtime.exit() was causing globals to get destructed at the same time
that another thread was using it for allocating a new mem map.

(cherry picked from commit 6e88ef6b604a7a945a466784580c42e6554c1289)

Bug: 17962201
Change-Id: I400cb7b8141d858f3c08a6fe59a02838c04c6962
6e88ef6b604a7a945a466784580c42e6554c1289 15-Oct-2014 Mathieu Chartier <mathieuc@google.com> Change MemMap::maps_ to not be global variable

Runtime.exit() was causing globals to get destructed at the same time
that another thread was using it for allocating a new mem map.

Bug: 17962201
Change-Id: I400cb7b8141d858f3c08a6fe59a02838c04c6962
7223d44a4893522e90d00bca38b119f710e55122 11-Oct-2014 Ian Rogers <irogers@google.com> Switch to C++11 style [[noreturn]].

Also remove old comment about calls to Abort getting merged. We have few
LOG(FATAL)s so merging is less of an issue. Also, recompiling with O0 and
similar will avoid the optimization and we expect that for GDB debugging.

Change-Id: I840dc6f4b8511294be0e117c634ec15b745e7be5
647b1a86f518d8db0331b3d52a96392b7a62504b 10-Oct-2014 Ian Rogers <irogers@google.com> Fix 2 new sets of clang compiler warnings.

Fix issues that are flagged by -Wfloat-equal and -Wmissing-noreturn.
In the case of -Wfloat-equal the current cases in regular code are deliberate,
so the change is to silence the warning. For gtest code the appropriate fix is
to switch from EXPECT_EQ to EXPECT_(FLOAT|DOUBLE)_EQ.
The -Wmissing-noreturn warning isn't enabled due to a missing noreturn in
gtest. This issue has been reported to gtest.

Change-Id: Id84c70c21c542716c9ee0c41492e8ff8788c4ef8
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
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
4f694baebb578b3ecc0c431f2a05c92efb9a50b3 24-Sep-2014 Brian Carlstrom <bdc@google.com> dex2oat should truncate files opened from file descriptors

Bug: 17622827

(cherry picked from commit aa93129ca54cc897fdc2c8ddd0a7136f7b5632ed)

Change-Id: I5467d488b4a57f7be35c72c16775df5bd5d69a52
aa93129ca54cc897fdc2c8ddd0a7136f7b5632ed 24-Sep-2014 Brian Carlstrom <bdc@google.com> dex2oat should truncate files opened from file descriptors

Bug: 17622827
Change-Id: Iff7df6219d517d140f77d2585d32559b440ac497
33cb94e5e5b50330fb9fbafe90d1a2a6bd026e2f 17-Sep-2014 Andreas Gampe <agampe@google.com> ART: Sync oat file to disk before patching

Bug: 15567083, 17439961, 17510489, 17478752

(cherry picked from commit 035592c51fee2995a3d90a9043f91a7a3128df2b)

Change-Id: I828dc6775044b5050c2520eb097abe6a920fd3ee
88157efc1e16707d4ae10775d4acb15121c50fe7 12-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Add the "time" compilation filter and output compilation stats.

A "time" compiler filter means the compiler optimizes for
compile time.

Change-Id: Id1a207ceb2d95f3548aae5e45d51b80695da2029
035592c51fee2995a3d90a9043f91a7a3128df2b 17-Sep-2014 Andreas Gampe <agampe@google.com> ART: Sync oat file to disk before patching

Bug: 15567083, 17439961, 17510489, 17478752
Change-Id: I828dc6775044b5050c2520eb097abe6a920fd3ee
daab38ca60c5b91787e29c87a161a2bb8c1b6f11 13-Sep-2014 Andreas Gampe <agampe@google.com> ART: Make elf loading not abort

Changes elf_file code to use less CHECKs and instead return error
values (usually nullptr). This avoids aborts.

In oat_file, when loading an oat file fails, try to unlink at. If
this succeeds, on the next run we may compile again.

Bug: 17491333

(cherry picked from commit afa6b8e93a0dc0de33c9d404945c7c5621e20b1a)

Change-Id: I50fdd2edacd86f25d4dacf2180ce2a6105eaf4af
afa6b8e93a0dc0de33c9d404945c7c5621e20b1a 13-Sep-2014 Andreas Gampe <agampe@google.com> ART: Make elf loading not abort

Changes elf_file code to use less CHECKs and instead return error
values (usually nullptr). This avoids aborts.

In oat_file, when loading an oat file fails, try to unlink at. If
this succeeds, on the next run we may compile again.

Bug: 17491333
Change-Id: I50fdd2edacd86f25d4dacf2180ce2a6105eaf4af
13b9f435d08ed269e7e5725ae829b1f61039a715 10-Sep-2014 Mathieu Chartier <mathieuc@google.com> Increase dex2oat timeouts for debug builds

Should fix the 056-const-string-jumbo test.

(cherry picked from commit 0bff4f375d8013a4a59cf70b3427fb461a17e6de)

Change-Id: I38d03fa7f981f0c067c52782e57938bbcbabef17
0bff4f375d8013a4a59cf70b3427fb461a17e6de 10-Sep-2014 Mathieu Chartier <mathieuc@google.com> Increase dex2oat timeouts for debug builds

Should fix the 056-const-string-jumbo test.

Change-Id: I04d98dfd59003b964c1feee6eee31079f9f4a476
bd25d4bff69e4775b7844d48630618b5ad8d3343 03-Jul-2014 Razvan A Lupusoru <razvan.a.lupusoru@intel.com> ART: Add capability for a pass to have options

This patch adds capability to have pass options. These are needed when a pass
has multiple flags that can be tweaked. The user is now allowed to pass those
options via command line.

Since passes are treated as singletons and they are immutable, the overridden
options provided by user are set on the compilation unit. Doing this way also
allows a selectivity system to tweak the option per compilation instead of
doing it globally (due to the single pass existing).

The following command line flags have been added:
--print-pass-options - This prints all passes that have options along with
their defaults.
--pass-options= - This is used to pass the overridden options in format of
PassName:PassOption:PassOptionSetting

Change-Id: Ib5156f5d2ff51a0c64c4ea0fa050bd2170663417
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
b0f05b9654eb005bc8c8e15f615a7f5a312f640c 17-Jul-2014 Dave Allison <dallison@google.com> Add implicit checks for x86_64 architecture.

This combines the x86 and x86_64 fault handlers into one. It also
merges in the change to the entrypoints for X86_64.

Replaces generic instruction length calculator with one that only
works with the specific instructions we use.

Bug: 16256184

Change-Id: I1e8ab5ad43f46060de9597615b423c89a836035c
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
cb6b0f31ede2275e79e6199ec391147585a37a2a 12-Aug-2014 Ian Rogers <irogers@google.com> Avoid use of std::string where we have const char*.

Removing the ClassHelper caused std::string creation for all calls to
Class::GetDescriptor and a significant performance regression. Make the
std::string an out argument so the caller can maintain it and its life time
while allowing GetDescriptor to return the common const char* case.

Don't generate GC maps when compilation is disabled.

Remove other uses of std::string that are occuring on critical paths.
Use the cheaper SkipClass in CompileMethod in CompilerDriver.
Specialize the utf8 as utf16 comparison code for the common shorter byte
encoding.
Force a bit of inlining, remove some UNLIKELYs (they are prone to pessimizing
code), add some LIKELYs.

x86-64 host 1-thread interpret-only of 57 apks:
Before: 29.539s
After: 23.467s

Regular compile:
Before: 1m35.347s
After: 1m20.056s

Bug: 16853450
Change-Id: Ic705ea24784bee24ab80084d06174cbf87d557ad

Conflicts:
runtime/utils.cc
1ff3c98775a4577cf053dba9a0c2d5c21c07b298 12-Aug-2014 Ian Rogers <irogers@google.com> Avoid use of std::string where we have const char*.

Removing the ClassHelper caused std::string creation for all calls to
Class::GetDescriptor and a significant performance regression. Make the
std::string an out argument so the caller can maintain it and its life time
while allowing GetDescriptor to return the common const char* case.

Don't generate GC maps when compilation is disabled.

Remove other uses of std::string that are occuring on critical paths.
Use the cheaper SkipClass in CompileMethod in CompilerDriver.
Specialize the utf8 as utf16 comparison code for the common shorter byte
encoding.
Force a bit of inlining, remove some UNLIKELYs (they are prone to pessimizing
code), add some LIKELYs.

x86-64 host 1-thread interpret-only of 57 apks:
Before: 29.539s
After: 23.467s

Regular compile:
Before: 1m35.347s
After: 1m20.056s

Bug: 16853450
Change-Id: Ic705ea24784bee24ab80084d06174cbf87d557ad
b28a16147f5b3503d9ca9e95ff56bdeb449e17d6 17-Jul-2014 Andreas Gampe <agampe@google.com> ART: Turn on dex2oat watchdog on target

Activates the watchdog on device.

Bug: 16364458

(cherry picked from commit bf40ddb83e1ea05ba4bc101149cd79f0160c8996)

Change-Id: I06deafa4436991f07bce44ecc6fd9df333f905ee
7204c04dd86ae8ce05690e38737b2abf017a0a69 11-Jun-2014 Stuart Monteith <stuart.monteith@arm.com> AArch64: Implicit StackOverflow/NPE/Suspend checks.

This implements implicit stack overflow checks and null pointer exceptions
for AArch64. Suspend checks are implemented but not switched on yet.

Bug: 16256184
Change-Id: I2eb076f2c0c9d94793d5a898fea49cf409b4eb66
Signed-off-by: Stuart Monteith <stuart.monteith@arm.com>
dfd3b47813c14c5f1607cbe7b10a28b1b2f29cbc 17-Jul-2014 Dave Allison <dallison@google.com> Add implicit checks for x86_64 architecture.

This combines the x86 and x86_64 fault handlers into one. It also
merges in the change to the entrypoints for X86_64.

Replaces generic instruction length calculator with one that only
works with the specific instructions we use.

Bug: 16256184

Change-Id: I1e8ab5ad43f46060de9597615b423c89a836035c
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
d5c78f44dc53ef9fda47a95ad3e9799be850c2b2 11-Jun-2014 Stuart Monteith <stuart.monteith@arm.com> AArch64: Implicit StackOverflow/NPE/Suspend checks.

This implements implicit stack overflow checks and null pointer exceptions
for AArch64. Suspend checks are implemented but not switched on yet.

Change-Id: I2eb076f2c0c9d94793d5a898fea49cf409b4eb66
Signed-off-by: Stuart Monteith <stuart.monteith@arm.com>
a62a588a9202f69e53fbeb3045ea8ea5ec2587f8 28-Apr-2014 Jim_Guo <jim_guo@htc.com> ART: Fix memory unmapped twice issue in ElfFile::Load(bool)

Root Cause:
The overlapped memory region will be unmapped by
(1) ~MemMap() of reservation MemMap (reserve) and
(2) ~MemMap() of "reuse" MemMap (segment).
Someone takes the memory region after (1) and it will be unmapped in (2).
So, SIGSEGV occurs when using the unmapped memory region.

Solution:
Fixes this issue by skip unmap "reuse" MemMap in destructor.
And always create reservation MemMap before "reuse" MemMap. (It also solved
the fixupELF case which does not reserve the whole needed memory region).

Bug: 16486685
Change-Id: I8f2538861d5c3fa7b9a04d2c3f516319cc060291
cf4bf386ef3f527825c70e01130b9276da4f786a 24-Jul-2014 Alex Light <allight@google.com> Tweaks to patchoat and other related things.

Removed some flags from patchoat that were poorly specified and fixed
some other issues with the relocation system.

Bug: 15358152

Change-Id: Ia6d47b1a008f02373307d833ba45f00ea408d76f
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
147eb41b53729ec8d5c188d1cac90964a51afb8a 11-Jul-2014 Dave Allison <dallison@google.com> Revert "Revert "Revert "Revert "Add implicit null and stack checks for x86""""

This reverts commit 0025a86411145eb7cd4971f9234fc21c7b4aced1.

Bug: 16256184
Change-Id: Ie0760a0c293aa3b62e2885398a8c512b7a946a73

Conflicts:
compiler/dex/quick/arm64/target_arm64.cc
compiler/image_test.cc
runtime/fault_handler.cc
bf40ddb83e1ea05ba4bc101149cd79f0160c8996 17-Jul-2014 Andreas Gampe <agampe@google.com> ART: Turn on dex2oat watchdog on target

Activates the watchdog on device.

Bug: 16364458
Change-Id: Id7c86f5a345da35b97bc7fa1a95c86e8685f8fcd
69dfe51b684dd9d510dbcb63295fe180f998efde 11-Jul-2014 Dave Allison <dallison@google.com> Revert "Revert "Revert "Revert "Add implicit null and stack checks for x86""""

This reverts commit 0025a86411145eb7cd4971f9234fc21c7b4aced1.

Bug: 16256184
Change-Id: Ie0760a0c293aa3b62e2885398a8c512b7a946a73
22d5e735f403c57525fe868304c7123f0ce66399 16-Jul-2014 Ian Rogers <irogers@google.com> Remove object_utils.h.

Break into object_lock, field_helper and method_helper.
Clean up header files following this.
Also tidy some of the Handle code in response to compiler errors when resolving
the changes in this CL.

Change-Id: I73e63015a0f02a754d0866bfaf58208aebcaa295
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
22f8e5c82d12951be38cd893426e13bee33fd69d 09-Jul-2014 Andreas Gampe <agampe@google.com> Revert "Revert "ART: Key-Value Store in Oat header""

This reverts commit 452bee5da9811f62123978e142bd67b385e9ff82.

Heap-allocate a couple of objects in dex2oat to avoid large frame
size.

Includes fixes originally in 100596 and 100605.

Change-Id: Id51a44198c973c91f0a3f87b9d992a5dc110c6f8
7fb36ded9cd5b1d254b63b3091f35c1e6471b90e 10-Jul-2014 Dave Allison <dallison@google.com> Revert "Revert "Add implicit null and stack checks for x86""

Fixes x86_64 cross compile issue. Removes command line options
and property to set implicit checks - this is hard coded now.

This reverts commit 3d14eb620716e92c21c4d2c2d11a95be53319791.

Change-Id: I5404473b5aaf1a9c68b7181f5952cb174d93a90d
0025a86411145eb7cd4971f9234fc21c7b4aced1 11-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Revert "Add implicit null and stack checks for x86"""

Broke the build.

This reverts commit 7fb36ded9cd5b1d254b63b3091f35c1e6471b90e.

Change-Id: I9df0e7446ff0913a0e1276a558b2ccf6c8f4c949
4e99b3d8955131f3fc71aa113f0fa71f0092cb6f 24-Jun-2014 Sebastien Hertz <shertz@google.com> Add missing class initialization during compilation and tests

Adds missing class initialization during compilation and tests, especially
java.lang.Class. Otherwise, we'd be able to execute code while the referring
class is not initialized or initializing.

Also adds mirror::Class::AssertInitializedOrInitializingInThread method to
check class initialization when entering the interpreter: the called method's
declaring class must either be initialized or be initializing by the current
thread (other threads must be waiting for the class initialization to complete
holding its lock). Note we only do this check in debug build.

Bump oat version to force compilation.

Bug: 15899971
Change-Id: I9a4edd3739a3ca4cf1c4929dcbb44cdf7a1ca1fe
34e826ccc80dc1cf7c4c045de6b7f8360d504ccf 29-May-2014 Dave Allison <dallison@google.com> Add implicit null and stack checks for x86

This adds compiler and runtime changes for x86
implicit checks. 32 bit only.

Both host and target are supported.
By default, on the host, the implicit checks are null pointer and
stack overflow. Suspend is implemented but not switched on.

Change-Id: I88a609e98d6bf32f283eaa4e6ec8bbf8dc1df78a
3d14eb620716e92c21c4d2c2d11a95be53319791 10-Jul-2014 Dave Allison <dallison@google.com> Revert "Add implicit null and stack checks for x86"

It breaks cross compilation with x86_64.

This reverts commit 34e826ccc80dc1cf7c4c045de6b7f8360d504ccf.

Change-Id: I34ba07821fc0a022fda33a7ae21850957bbec5e7
c87d27b25994da8670d82a8f7bad6327b693bfff 27-Jun-2014 Andreas Gampe <agampe@google.com> ART: Key-Value Store in Oat header

Allows the storage of string-string pairs in the oat header. The
first significant use of this is storing the implicit-check flags,
so that an oat file can be rejected if it doesn't agree with the
current runtime.

Bump the oat version as the header structure changes.

Change-Id: I15a1c16886e6b8fa7b881c918c19c1efa5c7c00f
53cb16b98acf3cf6f3a1e2204ad4958ecf1b5a3c 12-Jun-2014 Alex Light <allight@google.com> Add patchoat tool to Art.

Add a new executable called patchoat to art. This tool takes already
compiled images and oat files and changes their base address, acting as
a cheap form of relocation.

Add a --include-patch-information flag to dex2oat and code to add
required patch information to oat files created with the quick compiler.

Bug: 15358152

Change-Id: Ie0c580db45bb14ec180deb84930def6c3628d97d
452bee5da9811f62123978e142bd67b385e9ff82 09-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "ART: Key-Value Store in Oat header"

Broke arm64 build.

This reverts commit c87d27b25994da8670d82a8f7bad6327b693bfff.

Change-Id: I4c2ade295d2b5aa77fc3ad810e0e859629a5bf09
44c5ee7a14bde25207032ac7c2427e8629b8ff42 02-Jul-2014 Calin Juravle <calin@google.com> Relax limits for profiler based compilation options.

Change-Id: I57a7b11588f5c5b5f12217239ecf58f59ae02e2b
f9872f0b5f713af867b4e32e647a1b92f94fb01a 02-Jul-2014 Andreas Gampe <agampe@google.com> ART: Fix size error reported by ARM64 backend

Also removes a spurious LOG in dex2oat.

Change-Id: Ia264fbfb3cb8d59978f3a61e814eb6940e272ece
3470ab4011b5e18d590d5375e2f13a1e3bd69222 18-Jun-2014 Alex Light <allight@google.com> Fixed gdb support and added some ElfFile functions

Fixed gdb support so that it would continue working even when debug
symbols or other sections are included in the elf file. Also made it
actually read parts of the DWARF information so it should work even if
there are minor changes to how and where DWARF information is written
out.

Added a dwarf.h file with the dwarf constants.

Added a FindSectionByName function, a FindDynamicSymbol function, and
the ability to specify the mmap protection and flags directly if we are
mapping in the whole file.

Modified elf_writer_quick.cc to use the dwarf constants from dwarf.h.

Change-Id: I09e15c425fab252b331a2e4719863552e8b6b137
2db3e269e3051dacb3c8a4af8f03fdad9b0fd740 26-Jun-2014 Douglas Leung <douglas@mips.com> Fix quick mode bugs for Mips.

This patch enable quick mode for Mips and allows the emulator to boot.
However the emulator is still not 100% functional. It still have problems
launching some apps.

Change-Id: Id46a39a649a2fd431a9f13b06ecf34cbd1d20930
Signed-off-by: Douglas Leung <douglas@mips.com>
833a48501d560c9fa7fc78ef619888138c2d374f 22-May-2014 Andreas Gampe <agampe@google.com> ART: Native support for multidex

Native support for zip files with multiple classesX.dex.

Works by explicitly looking for those files in ascending order. As
these files have no file system representation for themselves,
introduce synthetic dex locations: the name of the originating file
plus a colon plus the name of the dex file, e.g., test.jar:classes2.dex.

Opening a zip dex file will return all dex files in this way. This
keeps the changes to dex2oat minimal.

To hide multidex/synthetic names from the Java layer, let the handle
of dalvik.system.DexFile refer to a vector of DexFile objects. When
opening a location, test possible synthetic names and add them to the
vector. Thus, the original multidex jar in the classpath will be
associated with all embedded dex files.

Change-Id: I0de107e1369cbc94416c544aca3b17525c9eac8b
f5997b4d3f889569d5a2b724d83d764bfbb8d106 20-Jun-2014 Mathieu Chartier <mathieuc@google.com> More advanced timing loggers.

The new timing loggers have lower overhead since they only push into
a vector. The new format has two types, a start timing and a stop
timing. You can thing of these as brackets associated with a
timestamp. It uses these to construct various statistics when needed,
such as: Total time, exclusive time, and nesting depth.

Changed PrettyDuration to have a default of 3 digits after the decimal
point.

Exaple of a GC dump with exclusive / total times and indenting:
I/art (23546): GC iteration timing logger [Exclusive time] [Total time]
I/art (23546): 0ms InitializePhase
I/art (23546): 0.305ms/167.746ms MarkingPhase
I/art (23546): 0ms BindBitmaps
I/art (23546): 0ms FindDefaultSpaceBitmap
I/art (23546): 0ms/1.709ms ProcessCards
I/art (23546): 0.183ms ImageModUnionClearCards
I/art (23546): 0.916ms ZygoteModUnionClearCards
I/art (23546): 0.610ms AllocSpaceClearCards
I/art (23546): 1.373ms AllocSpaceClearCards
I/art (23546): 0.305ms/6.318ms MarkRoots
I/art (23546): 2.106ms MarkRootsCheckpoint
I/art (23546): 0.153ms MarkNonThreadRoots
I/art (23546): 4.287ms MarkConcurrentRoots
I/art (23546): 43.461ms UpdateAndMarkImageModUnionTable
I/art (23546): 0ms/112.712ms RecursiveMark
I/art (23546): 112.712ms ProcessMarkStack
I/art (23546): 0.610ms/2.777ms PreCleanCards
I/art (23546): 0.305ms/0.855ms ProcessCards
I/art (23546): 0.153ms ImageModUnionClearCards
I/art (23546): 0.610ms ZygoteModUnionClearCards
I/art (23546): 0.610ms AllocSpaceClearCards
I/art (23546): 0.549ms AllocSpaceClearCards
I/art (23546): 0.549ms MarkRootsCheckpoint
I/art (23546): 0.610ms MarkNonThreadRoots
I/art (23546): 0ms MarkConcurrentRoots
I/art (23546): 0.610ms ScanGrayImageSpaceObjects
I/art (23546): 0.305ms ScanGrayZygoteSpaceObjects
I/art (23546): 0.305ms ScanGrayAllocSpaceObjects
I/art (23546): 1.129ms ScanGrayAllocSpaceObjects
I/art (23546): 0ms ProcessMarkStack
I/art (23546): 0ms/0.977ms (Paused)PausePhase
I/art (23546): 0.244ms ReMarkRoots
I/art (23546): 0.672ms (Paused)ScanGrayObjects
I/art (23546): 0ms (Paused)ProcessMarkStack
I/art (23546): 0ms/0.610ms SwapStacks
I/art (23546): 0.610ms RevokeAllThreadLocalAllocationStacks
I/art (23546): 0ms PreSweepingGcVerification
I/art (23546): 0ms/10.621ms ReclaimPhase
I/art (23546): 0.610ms/0.702ms ProcessReferences
I/art (23546): 0.214ms/0.641ms EnqueueFinalizerReferences
I/art (23546): 0.427ms ProcessMarkStack
I/art (23546): 0.488ms SweepSystemWeaks
I/art (23546): 0.824ms/9.400ms Sweep
I/art (23546): 0ms SweepMallocSpace
I/art (23546): 0.214ms SweepZygoteSpace
I/art (23546): 0.122ms SweepMallocSpace
I/art (23546): 6.226ms SweepMallocSpace
I/art (23546): 0ms SweepMallocSpace
I/art (23546): 2.144ms SweepLargeObjects
I/art (23546): 0.305ms SwapBitmaps
I/art (23546): 0ms UnBindBitmaps
I/art (23546): 0.275ms FinishPhase
I/art (23546): GC iteration timing logger: end, 178.971ms

Change-Id: Ia55b65609468f212b3cd65cda66b843da42be645
ca3aabac5748c256c42839dd16e8c80a09d99a48 23-Jun-2014 Dave Allison <dallison@google.com> Fix implicit check option handling for non-cross-compiles

This fixes an issue where the compiler was not being told to
generate implicit checks but the runtime was expecting them.

Bug: 15747876
Change-Id: I65e7475bac245c44d5094eb666d67bc1af327ab1
b03a0ec8cf841bf49d2e146e140cb3ca21eca752 24-Jun-2014 Alex Light <allight@google.com> Fixed ImageWriter timings not being written out.

During host runs of dex2oat the timings for ImageWriter would not be
written out.

Change-Id: I74ce8bae724d1e732a6a1efb1c82804473081693
9cad72d80603b3ff59be66b2cffd3f6dcbd9947f 20-Jun-2014 buzbee <buzbee@google.com> Quick compiler: enable Arm64 compilation

Change-Id: I19058defaff1c60b4b6b4d1ad82e0a42d50506a6
5655e84e8d71697d8ef3ea901a0b853af42c559e 18-Jun-2014 Andreas Gampe <agampe@google.com> ART: Implicit checks in the compiler are independent from Runtime

When cross-compiling, those flags are independent. This is an
initial CL that helps bypass fatal failures when cross-compiling,
as not all architectures support (and have turned on) implicit
checks.

The actual transport for the target architecture when it is
different from the runtime needs to be implemented in a follow-up
CL.

Bug: 15703710
Change-Id: Idc881a9a4abfd38643b862a491a5af9b8841f693
0c416fe40f675a3bff4d8cfb591d66fb69b73958 13-Jun-2014 Dmitry Petrochenko <dmitry.petrochenko@intel.com> x86_64: Enable core.oat/boot.oat compilation

This patch enabled compilation of image.

Change-Id: Idacce4a3898964d3a05762925dba236d7254a254
Signed-off-by: Dmitry Petrochenko <dmitry.petrochenko@intel.com>
33ae5583bdd69847a7316ab38a8fa8ccd63093ef 12-Jun-2014 buzbee <buzbee@google.com> Arm64 hard-float

Basic enabling of hard-float for Arm64. In future CLs we'll
consolidate the various targets - there is a lot of overlap.

Compilation remains turned off in this CL, but I expect
to enable a subset shortly. With compilation fully enabled
(including the EXPERIMENTAL opcodes with the exception of
REM and THROW), we get the following run-test results:

003-omnibus-opcode failures:
Classes.checkCast
Classes.arrayInstance
UnresTest2
Haven't gone deep, but these appear to be related to throw/catch and/or
stacktrace.

For REM, the generated code looks reasonable to me - my guess is that
we've got something wrong on the transition to the runtime. Haven't
looked deeper yet, though.

The bulk of the other failure also appear to be related to transitioning
to the runtime system, or handling try/catch.

run-test status:
Status with optimizations disabled, REM_FLOAT/DOUBLE and THROW disabled:
succeeded tests: 94
failed tests: 22
failed: 003-omnibus-opcodes
failed: 004-annotations
failed: 009-instanceof2
failed: 024-illegal-access
failed: 025-access-controller
failed: 031-class-attributes
failed: 044-proxy
failed: 045-reflect-array
failed: 046-reflect
failed: 058-enum-order
failed: 062-character-encodings
failed: 063-process-manager
failed: 064-field-access
failed: 068-classloader
failed: 071-dexfile
failed: 083-compiler-regressions
failed: 084-class-init
failed: 086-null-super
failed: 087-gc-after-link
failed: 100-reflect2
failed: 107-int-math2
failed: 201-built-in-exception-detail-messages

Change-Id: Ib66209285cad8998d77a14781de300af02a96b15
887235845e203fce046c17120e86d4cac4c56035 13-Jun-2014 Ian Rogers <irogers@google.com> Use command line android root in dex2oat to find image.

Change-Id: I20a025e07da3792131d7126ef0e5863b923c794b
78382fa44ee505cf16835e4d22515e7252a90864 07-Jun-2014 Alex Light <allight@google.com> Optionally add debug symbols to ELF files made by quick compiler.

Added debug symbols to ELF files created by dex2oat using
the quick compiler. Adds two flags --include-debug-symbols and
--no-include-debug-symbols for dex2oat that control the inclusion of these
debug symbols. Debug info is added by default if kIsDebugBuild is true.

Fixed bug where Intel DWARF information would not correctly deal with
deduplicated code the binary.

Changed the portable compiler code path in dex2oat.cc so that symbols
will not be stripped when run with --include-debug-symbols.

Change-Id: Ia2eb2f654dedf0e5e8606f7744e05b8d14155fb1
136aaee2993a4a5fd93eb9371584161c6d1c7445 06-Jun-2014 Dmitry Petrochenko <dmitry.petrochenko@intel.com> x86_64: Enable compilation

This patch enables compilation of all methods for x86_64
except image.

Change-Id: Ie210809f2595cc25da688a4ad0363c258bcf8233
Signed-off-by: Dmitry Petrochenko <dmitry.petrochenko@intel.com>
c1b643cc6ac45dbd0eabdcd7425c7e86006c27d6 31-May-2014 Calin Juravle <calin@google.com> Fixed and refactored profiler options handling

- extracted profiler options in a separate class
- switched from system property reading to command line arguments
- added profile based compilation options to CompilerOptions
- removed no longer used kProfile compilation filter
- optimize dex files only if the profiler is enabled
- clean up unused arguments

Bug: 12877748
Bug: 15275634
Change-Id: I37ff68e7694370950ce8db2360562e9058ecebb7
f94b781745e715463482695e22addfa95198b548 05-Jun-2014 Vladimir Marko <vmarko@google.com> Workaround for running out of address space on N7v1.

Bug: 13564922
Change-Id: I2ac466f613e465691078c41b2693f2327d07a0a8
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>
a9f1ce6fbe8a9247d0d8e20727f590b091e816da 28-May-2014 Vladimir Marko <vmarko@google.com> Fix pass driver's dump_pass_list_ and print_pass_list_.

The lists were allocated with new char[], so they should
have been held by std::unique_ptr<const char[]> rather than
std::unique_ptr<const char>. However, it's much cleaner with
std::string.

Change-Id: Ie7c604773272194345f5e6e3c4803c3a914edf99
8bceccec7eddff8cd872aa20505b4a3a6be60a16 29-Apr-2014 Jean Christophe Beyler <jean.christophe.beyler@intel.com> ART: Print and dump functionalities per pass

LOG is a great logging tool but sometimes a pass has some debugging text it
want to be able to turn on/off easily.

By going via a print_pass flag, we can actually turn it on/off easily per pass
when debugging/instrumenting.

- Added a pass printer to help debug messages for future passes.
- Added a print_pass flag in CompilationUnit to filter out messages.

At the same time, did a similar system for dumping the CFG.

- Also moved some API into public from protected.

Change-Id: Ie0e89a8fc773e8583f3e4ffd6e4bd2eebdbb2bf4
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>
0aa504b5bb19f0944d50941b20c8eeaca4165328 23-May-2014 Brian Carlstrom <bdc@google.com> Fix ExtractToMemMap to show original zip file name in ashmem

(cherry picked from commit 1fca8e91f32dc8b13d3129b7ef4a0194839736e6)

Change-Id: Id7d22600496b090ac32150c8c6424da89964b6be
1fca8e91f32dc8b13d3129b7ef4a0194839736e6 23-May-2014 Brian Carlstrom <bdc@google.com> Fix ExtractToMemMap to show original zip file name in ashmem

Change-Id: I630a870a8cc38475f12dd158bdc57e76efa17491
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>
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
6cd2845c8697074c97b01a68f241314aded9f492 17-May-2014 Andreas Gampe <agampe@google.com> ART: Turn off ARM64 compilation for now

When no compiler filter string is given to dex2oat for ARM64,
default to interpreter.

Change-Id: I2a97e07b1d9b75a04aafe4aaa4437e500bdaf202
9114f036f9a519995d40a0449142412e060701cf 14-May-2014 Brian Carlstrom <bdc@google.com> Remove ISA from boot image name.

Partially reverts b9beb2e2efb6a204a69ca660d478b45f851e8f09

Bug: 14882223
Change-Id: Ie85bcf593cb25a58090d4cbbe37392bed6a454fd
3ac05bba3eadccb33d26b41d9797f63e8378125f 14-May-2014 Brian Carlstrom <bdc@google.com> Remove ISA from boot image name.

Partially reverts b9beb2e2efb6a204a69ca660d478b45f851e8f09

Bug: 14882223

(cherry picked from commit 3da44327c8306bb354c0163a7c7779dea6eeb38a)

Change-Id: Idc9266a97d1047434c110ef140e2f2708c4aadef
3da44327c8306bb354c0163a7c7779dea6eeb38a 14-May-2014 Brian Carlstrom <bdc@google.com> Remove ISA from boot image name.

Partially reverts b9beb2e2efb6a204a69ca660d478b45f851e8f09

Bug: 14882223
Change-Id: Ie85bcf593cb25a58090d4cbbe37392bed6a454fd
5131638f826b74c4e2af62b8ac70eeef1232c99b 13-May-2014 Kenny Root <kroot@google.com> dex2oat: convert NULL to nullptr

Change-Id: I658511212f7ab265de473e198f8fe3625bbc9b46
d5185344e19d9feb7ac268369e0af6a467d1cb48 13-May-2014 Kenny Root <kroot@google.com> Changes for vogar compatibility

Make sure dex2oat can make an image with an empty list of image_classes.
Add in some checks to make sure that no bad arguments sneak into
CompilerDriver.

If we're not on the ART_TARGET, we should check for the "hostdex"
versions of the libraries to substitute in our libart version.

Change-Id: I5e8485c6089d25664492f0217b43ef64ca84c061
eb8167a4f4d27fce0530f6724ab8032610cd146b 08-May-2014 Mathieu Chartier <mathieuc@google.com> Add Handle/HandleScope and delete SirtRef.

Delete SirtRef and replaced it with Handle. Handles are value types
which wrap around StackReference*.

Renamed StackIndirectReferenceTable to HandleScope.

Added a scoped handle wrapper which wraps around an Object** and
restores it in its destructor.

Renamed Handle::get -> Get.

Bug: 8473721

Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
7624d25dad2d1ba25969ae704fccf68649103ae5 02-May-2014 Vladimir Marko <vmarko@google.com> Move quick frame info to OatQuickMethodHeader.

Rename OatMethodHeader to OatQuickMethodHeader, move frame
info from OatMethodOffsets to OatQuickMethodHeader. Retrieve
the info from other places for non-quick methods (portable
compiled bytecode or jni stub, generic jni, runtime,
abstract and proxy).

This change has a libcore/ companion CL
"Remove ArtMethod's quick fields for frame size and spills."
https://android-review.googlesource.com/94164

Bug: 11767815
Change-Id: I0e31a7875d76732e1ec479c86b9b5ca01203507f
b9beb2e2efb6a204a69ca660d478b45f851e8f09 10-May-2014 Ian Rogers <irogers@google.com> Place ISA into boot image name.

Depends upon:
https://android-review.googlesource.com/94078

Change-Id: I22c18b03b2c0db7a3f792920064e7710363b58b4
674744e635ddbdfb311fbd25b5a27356560d30c3 24-Apr-2014 Vladimir Marko <vmarko@google.com> Use atomic load/store for volatile IGET/IPUT/SGET/SPUT.

Bug: 14112919
Change-Id: I79316f438dd3adea9b2653ffc968af83671ad282
9e06c8cd4a2e1471754470e09aaab63c0795b4af 06-May-2014 Zheng Xu <zheng.xu@arm.com> AArch64: Add fake arm64 backend, and disable it by method filter.

Just create an ArmCodeGenerator for arm64, but currently no code will
be generated for arm64.

The method filter can:
1. Skip methods with unsupported prototype.
2. Skip methods with unsupported dalvik byte code.
3. Skip methods with invocation to unsupported prototype.

These are temporary codes and should be removed later. But with this
patch, it won't break anything when we merge partly implemented arm64
backend later.

Change-Id: Ib9180d7b8a978f0a5ebaf6b4893e7e3724897113
7ca278be5f6f15681350e9f05af434df4aab59ca 01-May-2014 Ian Rogers <irogers@google.com> Disable the ahead-of-time compilation for MIPS.

Bug: 14464004

Change-Id: I551c0dc4122853a1a9ab566d03bac74cc057cba5
11d9f06a96a6909905c248ed684366190140095c 23-Apr-2014 Narayan Kamath <narayan@google.com> Use instruction specific dalvik cache dirs.

- All oat & art files are now placed under /data/dalvik-cache/<isa>/.
- GetDalvikCacheOrDie now requires a mandatory subdirectory argument,
and is implicitly rooted under /data/.
- Added helper methods to convert InstructionSet enums into strings
and vice versa.

(cherry picked from commit 2974bc3d8a5d161d449dd66826d668d87bdc3cbe)

Change-Id: Ic7986938e6a7091a2af675ebafec768f7b5fb8cd
2974bc3d8a5d161d449dd66826d668d87bdc3cbe 23-Apr-2014 Narayan Kamath <narayan@google.com> Use instruction specific dalvik cache dirs.

- All oat & art files are now placed under /data/dalvik-cache/<isa>/.
- GetDalvikCacheOrDie now requires a mandatory subdirectory argument,
and is implicitly rooted under /data/.
- Added helper methods to convert InstructionSet enums into strings
and vice versa.

Change-Id: I9bff2e2ca534e0b93842a50d5b272ddf6d5745f3
9cb554a7784307d97c20991d90c76d9cf8a12e01 28-Apr-2014 Wonil Kim <wonil.kim@gmail.com> Fix typo of --oat-fd description in help

--oat-fd description in help was copied from --oat-file description.

Change-Id: Idbf36018af58db169f6d65382a7602ec950cce99
Signed-off-by: Wonil Kim <wonil.kim@gmail.com>
09881a85579cab1779ddf6ba9a91eed861a13cb2 19-Apr-2014 Brian Carlstrom <bdc@google.com> Do not require dexopt when previous profile does not exist

Also turn down some dex2oat related noise

Bug: 14184659
Change-Id: I134890f2c452d7f85ca4b736b5724f42533c2a7f
04ae1630adb4d4f10bfa7fded595052a9124de76 11-Apr-2014 Stuart Monteith <stuart.monteith@arm.com> AArch64: List arm64 as instruction set option

When arm64 was added to dex2oat, it wasn't added to the list of
instruction sets in the help text. This adds it.

Change-Id: I9ffecb67a053b24ad624effd1853ff47331d2e91
Signed-off-by: Stuart Monteith <stuart.monteith@arm.com>
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
91268c1afd6c0d4fad55b7c86d907233d4660205 04-Apr-2014 Andreas Gampe <agampe@google.com> Check the machine type of an ELF file when loading.

This ensures that we reject wrong target ELF files,
and should result in a recompile for the right
target.

Change-Id: I898dddc4f2bb9b1607a7436083d0ba7619b6007b
4a200f56b7075309316b04d550c9cc50f8314edd 01-Apr-2014 Jeff Hao <jeffhao@google.com> Add support for -Xverify:none mode.

This mode skips all verification and compilation.
Public bug: https://code.google.com/p/android/issues/detail?id=67664

Change-Id: Idd00ab8e9e46d129c02988b063c41a507e07bf5b
8afeb85d3def12b559b7565fb6d3956f81b55132 02-Apr-2014 Ian Rogers <irogers@google.com> Pass instruction-set from runtime through to spawned dex2oat.

Change-Id: I1727af7beb9f710c29124d4d6bc9175e4856f3cc
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
ffb939a0709ccb100d450e6e30d4c1ca85132163 12-Mar-2014 Ian Rogers <irogers@google.com> Set default dex2oat instruction set for x86-64 and ARM64.

Change-Id: I43062dfadb8a4f51304fd06f0105d6af81cf0331
cd8ce66a83af05d5ecb59aa6a8aad89a29e0a844 11-Mar-2014 Chao-ying Fu <chao-ying.fu@intel.com> Add dex2oat --print-pass-names and --disable-passes= options.

Add --print-pass-names to print a list of pass names.
Add --disable-passes= to disable one ore more passes
separated by comma.
Ex: Using --disable-passes=UseCount,BBOptimizations can disable UseCount
and BBOptimizations passes.

Change-Id: I0dffaf10547afdcca78a20d8e0e6b358bfb2ee8c
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
39c3bfbd03d85c63cfbe69f17ce5800ccc7d6c13 29-Jan-2014 Dave Allison <dallison@google.com> Make use of profiling information for dex2oat

If the profile file exists, the compiler driver will read it
and store the data in an internal map. Then, when we want to work
out whether to compile a method or not, the map is consulted and if
the method shows up with a high enough percentage of use we compile it.

The profile file itself is created by installd and is writeable by the
app. The file is in /data/dalvik-cache/profiles and is named by
the package name.

This also modifies the profiler itself to:

1. Only count runnable threads (not suspended threads) in the profile
2. Use system properties to allow tuning of the profile parameters
3. Merge profiles from multiple processes using file locking.

Bug: 12877748
Change-Id: Iab2f3a327a2860db2a80d5724277d6c626227f2b

Conflicts:
compiler/dex/frontend.cc
compiler/dex/mir_analysis.cc
compiler/dex/verification_results.cc
compiler/driver/compiler_driver.cc
dex2oat/dex2oat.cc
runtime/class_linker.cc
runtime/runtime.cc
runtime/runtime.h
c645f1ddb7c40bea6a38eda4b3f83f6b6dec405b 07-Mar-2014 Mathieu Chartier <mathieuc@google.com> Add more VerifyObject calls.

Added verify object calls to SirtRef, IndirectReferenceTable,
ReferenceTable.

Removed un-needed verify object in ScopedObjectAccess / DecodeJObject
since object sources are handled.

Bug: 12934910
Change-Id: I55a46a8ea61fed2a77526eda27fd2cce97a9b125
befbd5731ecca08f08780ee28a913d08ffb14656 06-Mar-2014 Ian Rogers <irogers@google.com> Fix host architecture for 64bit.

Also, hack x86 assembler for use as a x86-64 trampoline compiler's assembler.
Implement missing x86-64 quick resolution trampoline.
Add x86-64 to the quick elf writer.

Change-Id: I08216c67014a83492ada12898ab8000218ba7bb4
5e754d88c73f1f1fafbbf87d564df000d5a0a12c 05-Mar-2014 Brian Carlstrom <bdc@google.com> Revert "Revert "Avoid compiling monster methods in boot image""

This reverts commit f679fab9be8905505d26a62bea257641f0bb0168.

(cherry picked from commit 9d0bdfe63bec5a43d7668d9094a52caf77b6ed53)

Change-Id: I72af1d44483edbd2a5f2e6b678e43f740d4613fd
9d0bdfe63bec5a43d7668d9094a52caf77b6ed53 05-Mar-2014 Brian Carlstrom <bdc@google.com> Revert "Revert "Avoid compiling monster methods in boot image""

This reverts commit f679fab9be8905505d26a62bea257641f0bb0168.

Change-Id: Ib92c4b9bff52e80e2e23440054fa2b9d8a639979
449fa6e44b220e48dee20f569b46161f3a056add 05-Mar-2014 Brian Carlstrom <bdc@google.com> Revert "Avoid compiling monster methods in boot image"

This reverts commit 217e789288d5a321460ea2399e0eb7f3af6fc91b.

(cherry picked from commit f679fab9be8905505d26a62bea257641f0bb0168)

Change-Id: I058dd461d97bc5992b69941c7597a0aca25df38c
f679fab9be8905505d26a62bea257641f0bb0168 05-Mar-2014 Brian Carlstrom <bdc@google.com> Revert "Avoid compiling monster methods in boot image"

This reverts commit 217e789288d5a321460ea2399e0eb7f3af6fc91b.
217e789288d5a321460ea2399e0eb7f3af6fc91b 06-Feb-2014 buzbee <buzbee@google.com> Avoid compiling monster methods in boot image

The Quick compiler normally avoids compiling extremely large
methods (which are usually auto-generated initialization
routines) because they take too long to compile, and generally
aren't executed frequently enough to benefit from compilation.

However, we'd previously compiled even large methods in the
boot image - because it is normally cross-compiled on the host.
However, we are currently compiling it on the target in some
situations. This change moves the default for image creation
from "compile everything" to "compile most things".

Change-Id: If096e1ae5db2e3a394880e36e19607358e77d677
2ec6520d57479d393bffa05defa1479b25ca8382 04-Mar-2014 Brian Carlstrom <bdc@google.com> Support compiler filters for boot classpath

image_writer.cc
Remove assumption that all methods in the boot classpath are compiled

oat_writer.cc
Don't skip writing ArtMethod::quick_code_offset_ for methods that need resolution, leave that to ImageWriter

dex2oat.cc
Allow dex2dex compilation of image dex files by making the in memory pages writable in all cases, not just app case.

oatdump.cc
dump new OatHeader fields
use ImageSpace.GetImageFilename, not command line image filename, since location may be in dalvik-cache
remove inaccurate check about non-null GC map

quick_trampoline_entrypoints.cc
add and improve some DCHECKS that were useful while debugging

class_linker.cc
image_space.cc
fix double facepalm

parsed_options.cc
fix zygote logging to not skip values to two part options like -classpath <foo>

runtime.cc
wireup parsed compiler options to runtime

Change-Id: Iad314df0b80623c0663d61713d5098297ab9ac87
9583fbcf597eff6d0b3c5359b8e8d5f70ed82c40 28-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Remove oat file location in the image.

The oat file is now always in the same directory, and has the
same name as the image file. Only difference is the extension.

This also removes the need for host-prefix.

Change-Id: I16d1f7aeb1d58372d41921694664e9c321afc1ad
ae9fd93c39a341e2dffe15c61cc7d9e841fa92c4 11-Feb-2014 Mark Mendell <mark.p.mendell@intel.com> Tell GDB about Quick ART generated code

This is actually a lot of work. To do this, we need:
.debug_info
.debug_abbrev
.debug_frame
.debug_str

These are generated into the OAT file by OatWriter and ElfWriterQuick.

Since the Quick ART runtime doesn't use dlopen to load the OAT files,
GDB can't find this information. Use the alternate GDB JIT interface,
which can be invoked at runtime. To use this interface, an ELF image
needs to be built in memory. Read the information from the OAT file,
fixup the addresses to point to the real locations, add a symbol table
to hold the .text symbol, and then let GDB know about the information,
which will be read from the runtime address space.

This is quite primitive now, and could be cleaned up considerably. It
probably needs symbol table entries for the methods, and descriptions of
parameters and return types.

Currently only supported for X86.

This defaults to enabled for debug builds. Added dexoat --gen-gdb-info
and --no-gen-gdb-info flags to override.

Change-Id: I4d18b2370f6dfaa00c8cc1925f10717be3bd1a62
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
3d504075f7c1204d581923460754bf6d3714b13f 01-Mar-2014 Ian Rogers <irogers@google.com> Make out arguments non-reference types.

Also, tidy some portable related code.

Change-Id: I67c8aa52eef8b556ca117ecda1b1e75465ba06a5
ae7083dac2db59dcdef869e35ac44a039d888ee9 25-Feb-2014 Brian Carlstrom <bdc@google.com> Add additional const

Change-Id: Ibf60cd4cfbb445189efe2439899f2a7084f1ea63
6449c62e40ef3a9bb75f664f922555affb532ee4 11-Feb-2014 Brian Carlstrom <bdc@google.com> Create CompilerOptions

Package up most compiler related options in CompilerOptions. Details include:
- Includes compiler filter, method thresholds, SEA IR mode.
- Excludes those needed during Runtime::Init such as CompilerCallbacks and VerificationResults.
- Pass CompilerOptions to CompilerDriver.
- Remove CompilerOptions from Runtime.
- Add ability to pass options for app and image dex2oat to runtime via
-Xcompiler-option and -Ximage-compiler-option respectively.

Other
- Replace 2x CompilerCallbacks implementations with one.
- Factor out execv code for use by both image and oat generation.
- More OatFile error_msg reporting.
- DCHECK for SuspendAll found trying to run valgrind.

Change-Id: Iecb57da907be0c856d00c3cd634b5042a229e620
4e30541a92381fb280cd0be9a1763b713ee4d64c 19-Feb-2014 Mathieu Chartier <mathieuc@google.com> Fix and optimize verify object.

VerifyObject no longer resides in heap. You can now enable
VerifyObject for non-debug builds. VerifyStack is still slow, so it
is now guarded by its own flag.

Fixed the image writer to not use verification at places where
verification fails due to invalid reads.

Fixed RosAlloc to use SizeOf which doesn't call verify object.

Added a flag paremeter to some of the mirror getters / setters to
be able to selectively disable VerifyObject on certain calls.

Optimized the GC to not verify each object multiple times during
object scanning if verify object is enabled.

Added 3 verification options: verify reads, verify this, and verify
writes so that you can select how much verification you want for
mirror getters and setters.

Removed some useless DCHECKs which would slow debug builds without
providing any benefits.

TODO: RosAlloc verification doesn't currently work with verify
objects.

Bug: 12934910
Bug: 12879358

Change-Id: Ic61033104dfc334543f89b0fc0ad8cd4f4015d69
5180cc1cddc5112ea544bf9d8323f1d27db56f75 21-Feb-2014 Ian Rogers <irogers@google.com> Fix a printf flag that breaks 64bit host builds.

Change-Id: I2dacf3adccde6a397530e91a541d39bcf92627d2
f79fccbf8b5e59a0f48bec754cb7a53877b3c90f 20-Feb-2014 Brian Carlstrom <bdc@google.com> Add debug code for saving dex file inputs

Also improve some other logging.

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

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

Change-Id: I15fa9afe7ffb7283ebda8d788a1e02793e3f75a6
ea3fa0b4ba13d7bd7f7c1cd85202ccbe141a35ae 10-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Re-apply: Implement cumulative timings for CompilerDriver.

The bug was due to how the test infrastructure works:
a compiler driver surives the stack where it is allocated.

Change-Id: I345fe0e4afb2bd15937233db8afb350f09429558
2bc47809febcf36369dd40877b8226318642b428 10-Feb-2014 Vladimir Marko <vmarko@google.com> Revert "Revert "Check FastInstance() early for special getters and setters.""

This reverts commit 632e458dc267fadfb8120be3ab02701e09e64875.

Change-Id: I5098c41ee84fbbb39397133a7ecfd367fecebe42
632e458dc267fadfb8120be3ab02701e09e64875 08-Feb-2014 Ian Rogers <irogers@google.com> Revert "Check FastInstance() early for special getters and setters."

This reverts commit 5dc5727261e87ba8a418e2d0e970c75f67e4ab79.

Change-Id: I3299c8ca5c3ce3f2de994bab61ea16a734f1de33
5dc5727261e87ba8a418e2d0e970c75f67e4ab79 05-Feb-2014 Vladimir Marko <vmarko@google.com> Check FastInstance() early for special getters and setters.

Perform the FastInstance() check for getters and setters
when they are detected by the inliner. This will help avoid
the FastInstance() check for inlining.

We also record the field offset and whether the field is
volatile and whether the method is static for use when
inlining or generating the special accessors.

Change-Id: I3f832fc9ae263883b8a984be89a3b7793398b55a
ef7d42fca18c16fbaf103822ad16f23246e2905d 06-Jan-2014 Ian Rogers <irogers@google.com> Object model changes to support 64bit.

Modify mirror objects so that references between them use an ObjectReference
value type rather than an Object* so that functionality to compress larger
references can be captured in the ObjectRefererence implementation.
ObjectReferences are 32bit and all other aspects of object layout remain as
they are currently.

Expand fields in objects holding pointers so they can hold 64bit pointers. Its
expected the size of these will come down by improving where we hold compiler
meta-data.
Stub out x86_64 architecture specific runtime implementation.
Modify OutputStream so that reads and writes are of unsigned quantities.
Make the use of portable or quick code more explicit.
Templatize AtomicInteger to support more than just int32_t as a type.
Add missing, and fix issues relating to, missing annotalysis information on the
mutator lock.
Refactor and share implementations for array copy between System and uses
elsewhere in the runtime.
Fix numerous 64bit build issues.

Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
65c23bbb25f069b3b49761468b848c4e5d1aa879 02-Feb-2014 Brian Carlstrom <bdc@google.com> Restore end of dex2oat logging

Change-Id: I808cc60e8bb84609f42c0262b10fa0f1b4962763
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
650be76eb3c38ff905ec1d9675d73e5cb9a82dac 20-Jan-2014 Brian Carlstrom <bdc@google.com> Revert "Implement cumulative timings for CompilerDriver."

This reverts commit df013175d1aa04641e5c6175f8c786e547d31654.
df013175d1aa04641e5c6175f8c786e547d31654 13-Jan-2014 Nicolas Geoffray <ngeoffray@google.com> Implement cumulative timings for CompilerDriver.

Change-Id: I3b04de7f2717273f356b8120f68d69e2379bab2f
740a11d0bfeaef36d910669844d01f3957dbe696 14-Jan-2014 Ian Rogers <irogers@google.com> Add systrace regions for file opening during setup.

When the non-parallel dex2oat setup is slow this will help to explain the major
culprit.

Change-Id: I20143a8c7fafb3f7b834902d95dd85dbfe358746
5816ed48bc339c983b40dc493e96b97821ce7966 27-Nov-2013 Vladimir Marko <vmarko@google.com> Detect special methods at the end of verification.

This moves special method handling to method inliner
and prepares for eventual inlining of these methods.

Change-Id: I51c51b940fb7bc714e33135cd61be69467861352
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
92572be7f754c213e615a62955cc5f65ca8c0c0e 28-Nov-2013 Narayan Kamath <narayan@google.com> Use libziparchive for art zip processing.

This is part of the effort to move all VM & framework
zip parsing to a common implementation. This also has
the side effect of fixing various TODOs related to
crc32 checking.

bug: 10193060

Change-Id: I407f9ad5a94fc91d96ff43556adde00a00df1f14
ca368cb576cf6a436a32c357fca51fbb3082d7a9 16-Nov-2013 Ian Rogers <irogers@google.com> Break apart oat writing times.

Change-Id: I11045e29dc58ed1efbd19070ec1dcafc1044c95a
5fe9af720048673e62ee29597a30bb9e54c903c5 14-Nov-2013 Ian Rogers <irogers@google.com> Fix memory leaks relating to timing logger.

Bug: 11670287.
We use pointers to uninitialized values for control-flow in the timing logger
code, add TODO comments to clean this up later.
Remove base namespace and other bits of tidying.

Change-Id: I1e6600a1e92f974c8f58f3a405a4e4abb4d9f80f
08377a7ff48c7a7eadcfbc998297567381a2c366 12-Nov-2013 Brian Carlstrom <bdc@google.com> Fix CTS failures caused by ignoring malformed dex files in dex2oat

Bug: 11621003
Bug: 11599365

(cherry-picked from commit d5aba599561d8d14bb8c19fd633bfcd05af3c264)

Change-Id: Ie204d634f6951f6856ed92e2191f07262b28bc05
d492f91ffd9c725992c39c1a746f91e058563902 12-Nov-2013 Brian Carlstrom <bdc@google.com> Revert "Ignore missing files in dex2oat"

This reverts commit eb4d2ae2efdd186a01f3c91a3f6d44cc07e116ef.
d5aba599561d8d14bb8c19fd633bfcd05af3c264 12-Nov-2013 Brian Carlstrom <bdc@google.com> Fix CTS failures caused by ignoring malformed dex files in dex2oat

Bug: 11621003
Bug: 11599365
Change-Id: If1f62dff59346edcd60e4c4b5df58137609f7f19
3cf59d567072562e120b9524f47ad2bd373f8333 11-Nov-2013 Brian Carlstrom <bdc@google.com> Revert "resolved conflicts for merge of ad93c622 to master"

This reverts commit 4f6a77d529ae295630e22d4636c2acc2ba2fbb6d, reversing
changes made to bcdbbfebc8f32566d4cb3f66405e89cdb7351992.
eb4d2ae2efdd186a01f3c91a3f6d44cc07e116ef 09-Nov-2013 Brian Carlstrom <bdc@google.com> Ignore missing files in dex2oat

Bug: 11599365
Change-Id: I43f7437d2574c3776f921472f38b5a03a87c2822
1bd2ceb3a8c68ae6ea1f9627b588a7bc7a74487f 06-Nov-2013 Brian Carlstrom <bdc@google.com> Make missing DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES an error

Change-Id: I3ca23e4db80c8ab8a86da6408cf38daccd4cfaf1
7020278bce98a0735dc6abcbd33bdf1ed2634f1d 23-Oct-2013 Dave Allison <dallison@google.com> Support hardware divide instruction

Bug: 11299025

Uses sdiv for division and a combo of sdiv, mul and sub for modulus.
Only does this on processors that are capable of the sdiv instruction, as determined
by the build system.

Also provides a command line arg --instruction-set-features= to allow cross compilation.
Makefile adds the --instruction-set-features= arg to build-time dex2oat runs and defaults
it to something obtained from the target architecture.

Provides a GetInstructionSetFeatures() function on CompilerDriver that can be
queried for various features. The only feature supported right now is hasDivideInstruction().

Also adds a few more instructions to the ARM disassembler

b/11535253 is an addition to this CL to be done later.

Change-Id: Ia8aaf801fd94bc71e476902749cf20f74eba9f68
635733da0f67df1c979cc9764409d2a9dcbb20aa 31-Oct-2013 Brian Carlstrom <bdc@google.com> Fix --compiler-backend usage example

Change-Id: I2ebefe57e94d6a8103c71e86f7c6a302b7107fc4
88474b416eb257078e590bf9bc7957cee604a186 24-Oct-2013 Jeff Hao <jeffhao@google.com> Implement Interface Method Tables (IMT).

Change-Id: Idf7fe85e1293453a8ad862ff2380dcd5db4e3a39
8d31bbd3d6536de12bc20e3d29cfe03fe848f9da 13-Oct-2013 Ian Rogers <irogers@google.com> Throw IOException at source of failing to open a dex file.

Before is:
java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
Suppressed: java.lang.ClassNotFoundException: GCBench
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 1 more
Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found
... 5 more
And after is:
java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
Suppressed: java.io.IOException: Zip archive '/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar' doesn't contain classes.dex
at dalvik.system.DexFile.openDexFile(Native Method)
at dalvik.system.DexFile.<init>(DexFile.java:80)
at dalvik.system.DexFile.<init>(DexFile.java:59)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:268)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:235)
at dalvik.system.DexPathList.<init>(DexPathList.java:113)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:38)
at java.lang.ClassLoader.createSystemClassLoader(ClassLoader.java:128)
at java.lang.ClassLoader.access$000(ClassLoader.java:65)
at java.lang.ClassLoader$SystemClassLoader.<clinit>(ClassLoader.java:81)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:137)
Suppressed: java.lang.ClassNotFoundException: GCBench
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 1 more
Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found
... 5 more

Also, move dex file verifier messages out of logs.
In the process the ClassLinker::dex_lock_ needed tidying to cover a smaller
scope. Bug 11301553.

Change-Id: I80058652e11e7ea63457cc01a0cb48afe1c15543
e732ef1c0192acd71925bd0ff1ab09640d45531d 10-Oct-2013 Ian Rogers <irogers@google.com> Make compiler stat dumping easier to use.

Previous needed -verbose:compiler + a debug build. Now specify --dump-stats to
dex2oat.

Change-Id: Ifde379e7cd06bbb0fe20149ce89c3b3789221eac
51db7beb7faaea43d697321520732d1d71288f50 06-Sep-2013 Ian Rogers <irogers@google.com> Use exit to avoid destructors in dex2oat.

(cherry picked from commit 2672a9f93caa66add6ca48a8e38ba1661ef43959)

Bug: 10645725
Change-Id: I55c2a7b7f3bd105f1a6a8bf84db2204c6f87e642
2672a9f93caa66add6ca48a8e38ba1661ef43959 06-Sep-2013 Ian Rogers <irogers@google.com> Use exit to avoid destructors in dex2oat.

Change-Id: I5f8b396dfa614af2935053c219b09b406a632618
d76e08323893c60df77eccca6e882279e7246d8c 30-Aug-2013 Brian Carlstrom <bdc@google.com> Make files writable on the installd path as well

Bug: 9618388
Change-Id: Iabfdfe2bbc44de1fec733269c08a243af75c7dcd
e0948e13d5a4552e6a2728087573c07961e4a4f9 29-Aug-2013 Brian Carlstrom <bdc@google.com> Make DexFiles opened from files readonly by default, but writable during dex2oat

Bug: 9618388
Change-Id: I83f2e16ee8446a79a94a84971146d807bb0c9ee0
f30f6daf33a9671ff756befb673482d7f3717a18 29-Aug-2013 Ian Rogers <irogers@google.com> Set small ART override for image as an option.

Build fix for small art, avoids changing the compiler filter post runtime
initialization.

Change-Id: I359b5231adaa0331321dc6239305cf748d174a17
3f3d22c8fc89d754172858d1770f16916b407d8b 28-Aug-2013 Ian Rogers <irogers@google.com> Reduce the scope of a ScopedObjectAccess in dex2oat.

Allow concurrent GCs during image writing, etc.

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

Bug: 10496017
Change-Id: I3cbad249e0fb33f726bd0a504b3b6bd9b4f759c8
fe9ca4028f379688ecba6132ac3738171176b3e4 21-Aug-2013 buzbee <buzbee@google.com> Compiler filter update

Tweak of the compiler filter to give better results for applications
which are not dominated by tight arithmetic loops. Deleted
the "DeferCompilation" setting - it didn't differ enough from the
"Space" setting. Added "Everything" setting to support forced
compilation (for images and testing). Previously used "Speed"
for that purpose, but in the speed setting there are some things we
don't want to compile.

Change-Id: Ia53b14f2044fc9738c1a4c1318f8204f2c25abe3
46398608eaa47afe5a4cfb91e3f43211bf937d68 20-Aug-2013 Ian Rogers <irogers@google.com> dex2oat flag to always dump timing data.

Change-Id: I67fd10aff5cc5822ad119cd8b5a26c23e7a85cac
e6bb3b2ce5a69c31c2adfc7eb2705633b7f966eb 20-Aug-2013 Ian Rogers <irogers@google.com> Reduce AOT initialization.

When compiling apps there is no need to resolve all types in the dex file, just
those declared in the dex file. There's also no need to initialize static
fields if we can only leave the class in a verified state.

Increase use of CompilerDriver::IsImage.
Move timing of dex2oat setup to before Runtime::Create.

On run-test 056 the performance improvement is an order of magnitude, for
ThinkFree dex2oat time is dominated by compilation and this change has no
effect.

Bug 10316099.

Change-Id: Ibdd7caa43284e7448e6a56d810967100ae4a7898
414af10d719603fb4d8d972f5a022c17957b44e1 13-Aug-2013 Brian Carlstrom <bdc@google.com> Add flock(2)ing on dex-cache files to prevent races

Bug: 9071417
Change-Id: I1ee9ff281867f90fba7a8ed8bbf06b33ac29d511
7571e8b761ebc2c923525e12ea9fcf07e62cb33e 13-Aug-2013 Brian Carlstrom <bdc@google.com> Add flock(2)ing on dex-cache files to prevent races

Bug: 9071417
Change-Id: I1ee9ff281867f90fba7a8ed8bbf06b33ac29d511
0f40ac31134d9ae0f059d4c448165599dc8459c1 14-Aug-2013 Ian Rogers <irogers@google.com> Fix races in small mode compiler filters setup

Fixes host tests in small art mode.

Change-Id: I2579f872583f425607f91c1e58df68b05b5098bb
75a43f10f55e2aa550de51e969cc1e60d583b632 14-Aug-2013 Anwar Ghuloum <anwarg@google.com> Clean up logcat spam from compiler and verifier

Moved to VLOG(...), adding verifer tag for VLOG.

Change-Id: Ia9ac8aeaf5aa1f4881e384003e82a66e560c5692
ea46f950e7a51585db293cd7f047de190a482414 30-Jul-2013 Brian Carlstrom <bdc@google.com> Refactor java.lang.reflect implementation

Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1.

Move to ArtMethod/Field instead of AbstractMethod/Field and have
java.lang.reflect APIs delegate to ArtMethod/ArtField.

Bug: 10014286.

Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
155ecba1c9b56ce1b468135e6a591a3fe9258c52 13-Aug-2013 buzbee <buzbee@google.com> Fix SMALL_ART

On all art builds, the images classes must be compiled. When doing
a small art build, it is necessary to override the default compiler
filter to force compilation. A merge mistake broke this logic
for dalvik-dev.

Change-Id: I88186bd89d0ccb4316ee0910e9324ddc3e6a1f75
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
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
7934ac288acfb2552bb0b06ec1f61e5820d924a4 26-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint whitespace/comments issues

Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
6f28d91aab952e3244fbb4e707fa38f85538f374 25-Jul-2013 Anwar Ghuloum <anwarg@google.com> Add systrace support to NewTimingLogger, migrate compiler timing logging to NewTimingLogger

Rpleaced old TimingLogger by NewTimingLogger, renamed NewTimingLogger to TimingLogger, added systrace support to TimingLogger.
Tests passing, phone booting, systrace working.

Change-Id: I2aeffb8bcb7f0fd979d8a2a3a8bcfbaa02413679
c50d8e11a098cc5c6239aa86b47d4fcf8cbb4899 24-Jul-2013 Brian Carlstrom <bdc@google.com> Remove OatWriter buffering to memory for ElfWriterQuick

This allows the oat contents to be directly written to the file.

Change-Id: Ibc7ddf57477b152f07784b52f7334be73fd22833
7fcba11846d3320911aefdba6a20c1192e36fc2e 22-Jul-2013 Brian Carlstrom <bdc@google.com> Restore conditional oat file copying used by build system.

Change-Id: I40343e59902e894f7343e9d8bbf30f7b5602d786
4560248d4c85cade7f4fc7b30c3fb41b95a04a7f 22-Jul-2013 Brian Carlstrom <bdc@google.com> Move TimingLogger creation to dex2oat

Change-Id: I4fdb6afd4ce2ac0d91c6c968893606d593b6ea18
0177fe200efc1bf4d433955ee7920c683fdf5901 21-Jul-2013 Brian Carlstrom <bdc@google.com> Remove CompilerDriver::IsDebuggingSupported

Change-Id: Ib67e3ef67462fe5dae81148f7fe8cc76b3887f11
0cd7ec2dcd8d7ba30bf3ca420b40dac52849876c 18-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint whitespace/blank_line issues

Change-Id: Ice937e95e23dd622c17054551d4ae4cebd0ef8a2
93ba893c20532990a430741e0a97212900094e8c 18-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint runtime/explicit issues

Change-Id: I352ba0b427f1ff9b22887693952b180eae0839ba
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