History log of /art/compiler/driver/compiler_driver.h
Revision Date Author Comments
da802f86c4361c23e827b88573583ee91f0edede 12-Apr-2018 Andreas Gampe <agampe@google.com> ART: Fix core image detection

Accept any .art name starting with "core-." Correctly detects
images with multiple dashes.

Bug: 64382372
Test: mmma art
Test: art/test/testrunner/testrunner.py -b --host
Test: Device boots
Merged-In: I6c8006411b0ec16225b137dd349d53d9bc0ac03d
Change-Id: I6c8006411b0ec16225b137dd349d53d9bc0ac03d
5abb0696dacb90ad35a571a5b660efb0c4dc3c01 19-Mar-2018 Vladimir Marko <vmarko@google.com> Fix running some run-tests with -Xjitthreshold:0

Do not JIT non-compilable methods. Honor the $noinline$
directive for JIT and fix core image recognition.

Make sure the 597-deopt-invoke-stub that actually relies on
its own -Xjitthreshold: overrides the threshold we pass,
work around already running compiled code in 570-checker-osr
(and drop obsolete "doThrow" pattern replaced by $noinline$)
and add a few necessary $noinline$ directives.

Partial cherry-pick of commit be0c7cfdbb2b73d6beb1284fdedb8e07766630e9.

Test: for t in \
461-get-reference-vreg \
536-checker-needs-access-check \
570-checker-osr \
597-deopt-invoke-stub \
655-jit-clinit \
; do \
art/test/run-test --host --jit $t \
--runtime-option -Xjitthreshold:0; \
done
Test: testrunner.py --host --jit
Bug: 62611253
Merged-In: Ia0a05c93e3fc8d913fe8556d3d7f23e7e61076c2
Change-Id: Ia0a05c93e3fc8d913fe8556d3d7f23e7e61076c2
e6564f4efe74b2bb505a5810852141404b82a4a9 19-Mar-2018 David Sehr <sehr@google.com> Move some remaining dex utilities

There were several utilities related to building/walking/testing dex
files that were not in libdexfile. This change consolidates these.

(cherry picked from commit 312f3b2fd0094c028a7d243b116947a35a745806)

Bug: 22322814
Test: make -j 50 test-art-host
Merged-In: Id76e9179d03b8ec7d67f7e0f267121f54f0ec2e0
Change-Id: Id76e9179d03b8ec7d67f7e0f267121f54f0ec2e0
8f4b056427a9d2321e3aa4f21ca8ffb18b3e5ae6 02-Mar-2018 David Sehr <sehr@google.com> Move most of runtime/base to libartbase/base

Enforce the layering that code in runtime/base should not depend on
runtime by separating it into libartbase. Some of the code in
runtime/base depends on the Runtime class, so it cannot be moved yet.
Also, some of the tests depend on CommonRuntimeTest, which itself needs
to be factored (in a subsequent CL).

Bug: 22322814
Test: make -j 50 checkbuild
make -j 50 test-art-host

Change-Id: I8b096c1e2542f829eb456b4b057c71421b77d7e2
Merged-In: c431b9dc4b23cc950eb313695258df5d89f53b22

(cherry picked from commit c431b9dc4b23cc950eb313695258df5d89f53b22)
67bf42e89592c3a1c648f927f2ce3ccb189a1161 27-Feb-2018 David Sehr <sehr@google.com> Header library to remove dependence on runtime/

Add a new header library to remove libdexfile and others' dependence on
runtime (typically runtime/base) includes in libdexfile. Also a small step
to tease dexlayout and profman away from relying on these as well.

Bug: 22322814
Test: make -j 50 checkbuild
make -j 50 test-art-host-gtest

Change-Id: I38e2fe399a75f4bc6318c77a71954c00ea73ec2b
279e3a3499d208daf467a1690b111dfb06f3e96e 25-Jan-2018 Mathieu Chartier <mathieuc@google.com> Enable code item deduping

Dedupe code items if they have the same contents, this is safe
because of the fixed quickening logic.

Removed duplicate code items in ManyMethods that caused the startup
methods section to be empty in dex2oat_test.

To avoid errors related to quickening and compilation of shared code
items, quickening is currently disabled for shared code items.

Bug: 63756964
Test: test-art-host

Change-Id: I7c62eb746785d787c5269effd396f7be4859d3a6
bff7a52e2c6c9e988c3ed1f12a2da0fa5fd37cfb 25-Jan-2018 Nicolas Geoffray <ngeoffray@google.com> Revert "Compiler changes for bitstring based type checks."

Bug: 64692057
Bug: 71853552
Bug: 26687569

This reverts commit eb0ebed72432b3c6b8c7b38f8937d7ba736f4567.

Change-Id: I7daeaa077960ba41b2ed42bc47f17501621be4be
0be8cabf16ee5fa5186bc90471911336f6c01f19 25-Jan-2018 Nicolas Geoffray <ngeoffray@google.com> Revert "ART: Use the bitstring type check for AOT app compilation."

Test failures:
http://build.chromium.org/p/client.art/builders/fugu-debug/builds/4875

01-25 02:05:28.357 23732 23732 F /data/local/tmp/system/bin/../bin/dalvikvm: quick_throw_entrypoints.cc:132] Check failed: !dest_type->IsAssignableFrom(src_type)


This reverts commit 718e8319c728e9ee2ec15b1d56ca96baa4393028.

Change-Id: I022f88cd81ae99143e5670ae29eae326ecc83cc2
718e8319c728e9ee2ec15b1d56ca96baa4393028 22-Jan-2018 Vladimir Marko <vmarko@google.com> ART: Use the bitstring type check for AOT app compilation.

For boot image target classes that have their bitstring
already assigned in the boot image.

The size of the services.odex for aosp_taimen-userdebug:
- before:
- arm64: 20988640
- after:
- arm64: 20968016 (-20KiB, -0.1%)
(There is no arm version, only arm64.)

Test: New test case in 552-checker-sharpening.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: Pixel 2 XL boots.
Test: testrunner.py --target --optimizing
Bug: 64692057
Change-Id: I9585efca8ba0df15400e7536e5e2cc76aca13e8d
f30752709e1131ae1a4c16f22cc7a0960c198e77 08-Jan-2018 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Don't embed the dex code in the oat file if dex is uncompressed.""

Bug: 63920015
Bug: 70854754

Test: oat_writer_test.cc, test.py

Revert was due to userdebug/user differences, which is fixed with:
https://googleplex-android-review.googlesource.com/#/c/platform/build/+/3434091/

This CL also fixes oatdump when the dex code is not in the .vdex file.

This reverts commit e166e67666bf4b23e4ed0a98f5e2bb3cae9cee7d.

Change-Id: Iec924be2ff8f03cf2ebe306e7a0018241f33beb0
eb0ebed72432b3c6b8c7b38f8937d7ba736f4567 10-Jan-2018 Vladimir Marko <vmarko@google.com> Compiler changes for bitstring based type checks.

We guard the use of this feature with a compile-time flag,
set to true in this CL.

Boot image size for aosp_taimen-userdebug in AOSP master:
- before:
arm boot*.oat: 63604740
arm64 boot*.oat: 74237864
- after:
arm boot*.oat: 63531172 (-72KiB, -0.1%)
arm64 boot*.oat: 74135008 (-100KiB, -0.1%)

The new TypeCheckBenchmark yields the following changes
using the little cores of taimen fixed at 1.4016GHz:
32-bit 64-bit
timeCheckCastLevel1ToLevel1 11.48->15.80 11.47->15.78
timeCheckCastLevel2ToLevel1 15.08->15.79 15.08->15.79
timeCheckCastLevel3ToLevel1 19.01->15.82 17.94->15.81
timeCheckCastLevel9ToLevel1 42.55->15.79 42.63->15.81
timeCheckCastLevel9ToLevel2 39.70->14.36 39.70->14.35
timeInstanceOfLevel1ToLevel1 13.74->17.93 13.76->17.95
timeInstanceOfLevel2ToLevel1 17.02->17.95 16.99->17.93
timeInstanceOfLevel3ToLevel1 24.03->17.95 24.45->17.95
timeInstanceOfLevel9ToLevel1 47.13->17.95 47.14->18.00
timeInstanceOfLevel9ToLevel2 44.19->16.52 44.27->16.51
This suggests that the bitstring typecheck should not be
used for exact type checks which would be equivalent to the
"Level1ToLevel1" benchmark. Whether the implementation is
a beneficial replacement for the kClassHierarchyCheck and
kAbstractClassCheck on average depends on how many levels
from the target class (or Object for a negative result) is
a typical object's class.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing --jit
Test: testrunner.py --host -t 670-bitstring-type-check
Test: Pixel 2 XL boots.
Test: testrunner.py --target --optimizing --jit
Test: testrunner.py --target -t 670-bitstring-type-check
Bug: 64692057
Bug: 71853552
Bug: 26687569
Change-Id: I538d7e036b5a8ae2cc3fe77662a5903d74854562
3913e488afb884ccee76d620d4357b6308e55010 23-Jan-2018 Andreas Gampe <agampe@google.com> ART: Refactor profile_compilation_info.h includes

Use forward declarations.

Test: m
Change-Id: Ife25be9e2eb5ba9224f082aaa935f821a3597963
3c060ad0ff25d8231d5a93ac17ec0f30150034dd 22-Jan-2018 Andreas Gampe <agampe@google.com> ART: Refactor dex2dex compilation

Refactor the code to tease out the dex2dex compilation flow. Use
templatized functions for common code.

Bug: 29089975
Test: m test-art-host
Change-Id: Ib31d491ed4676ae4cee9132ceb613a372fb06479
a79efdb69350fa66e1beabed4499ef4d0e809785 19-Jan-2018 Mathieu Chartier <mathieuc@google.com> Fix quickening logic

Fix varius bugs in the quickening logic where related to shared code
items for different methods.

Fixed the case where two methods quicken differently on the same code
item by checking that the quicken info is the same for all methods
that quicken the same code item. This is accomplished by requickening
and reverifying the contents of the quicken info.

Fixed the case where the dex to dex compiler would abort from a
DCHECK that there was no already quickened instructions.

Feature is tested by enabling deduping (aog/594315).

Test: test-art-host
Bug: 63756964

Change-Id: I52c2b89518f4e808594b450a5fcc373ab5a5863b
9e734c7ab4599d7747a05db0dc73c7b668cb6683 05-Jan-2018 David Sehr <sehr@google.com> Create dex subdirectory

Move all the DexFile related source to a common subdirectory dex/ of
runtime.

Bug: 71361973
Test: make -j 50 test-art-host
Change-Id: I59e984ed660b93e0776556308be3d653722f5223
2c64a837e62c2839521c89060b5bb0dcb237ddda 04-Jan-2018 Vladimir Marko <vmarko@google.com> Change ClassStatus to fit into 4 bits.

In preparation for extending the type check bit string from
24 to 28 bits, rewrite ClassStatus to fit into 4 bits. Also
perform a proper cleanup of the ClassStatus, i.e. change it
to an enum class, remove the "Status" word from enumerator
names, replace "Max" with "Last" in line with other
enumerations and remove aliases from mirror::Class.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: Pixel 2 XL boots.
Test: testrunner.py --target --optimizing
Bug: 64692057
Bug: 65318848
Change-Id: Iec1610ba5dac2c527b36c12819f132e1a77f2d45
7314ad133572b52335d7232361e86bd6b8cc5f50 19-Dec-2017 Andreas Gampe <agampe@google.com> Revert "Don't embed the dex code in the oat file if dex is uncompressed."

This reverts commit ae7e83817e546848ef6b2949dd9065b153e14316.

Reason for revert: Broken wrt/ preopted apps and stripping

Bug: 63920015
Bug: 70777774
Change-Id: I39580684d46fa57bd780d2d8bedd65a47d58cf5e
Test: m
(cherry picked from commit e166e67666bf4b23e4ed0a98f5e2bb3cae9cee7d)
e166e67666bf4b23e4ed0a98f5e2bb3cae9cee7d 19-Dec-2017 Andreas Gampe <agampe@google.com> Revert "Don't embed the dex code in the oat file if dex is uncompressed."

This reverts commit ae7e83817e546848ef6b2949dd9065b153e14316.

Reason for revert: Broken wrt/ preopted apps and stripping

Bug: 63920015
Bug: 70777774
Change-Id: I39580684d46fa57bd780d2d8bedd65a47d58cf5e
Test: m
ae7e83817e546848ef6b2949dd9065b153e14316 20-Nov-2017 Nicolas Geoffray <ngeoffray@google.com> Don't embed the dex code in the oat file if dex is uncompressed.

Take uncompressed dex code as a signal that the app wants to
opt into b/63920015.

bug: 63920015
Test: dex2oat_test, 071-dexfile-clean-map

Change-Id: I878e7bb80fc895a2d9aafe81aa7666b86af1f808
666ee3d7c6039c80e75287e311895bd6a9b01e9f 11-Dec-2017 Vladimir Marko <vmarko@google.com> Do not pass DexFile to ClassLinker::Lookup/ResolveType().

The DexFile can be easily retrieved from the DexCache,
so reduce the number of arguments that need to be passed.

Also refactor the code to avoid doing the DexCache lookup
twice and avoid unnecessary read barriers in the initial
DexCache lookup (also for Lookup/ResolveField()).

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: Idea9aa42b6a5bade947e93e330b1abdb9d11b2da
e11dd50ac2b5ccbf3b02213b7361f55b1f1a90da 08-Dec-2017 Vladimir Marko <vmarko@google.com> Do not pass DexFile to ClassLinker::ResolveField*().

The DexFile can be easily retrieved from the DexCache,
so reduce the number of arguments that need to be passed.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: I0579db64c63afea789c7c9ad8db81e37c9248e97
28e012a4af2d710e5e5f824709ffd6432e4f549f 07-Dec-2017 Vladimir Marko <vmarko@google.com> Determine HLoadClass/String load kind early.

This helps save memory by avoiding the allocation of
HEnvironment and related objects for AOT references to
boot image strings and classes (kBootImage* load kinds)
and also for JIT references (kJitTableAddress).

Compiling aosp_taimen-userdebug boot image, the most memory
hungry method BatteryStats.dumpLocked() needs
- before:
Used 55105384 bytes of arena memory...
...
UseListNode 10009704
Environment 423248
EnvVRegs 20676560
...
- after:
Used 50559176 bytes of arena memory...
...
UseListNode 8568936
Environment 365680
EnvVRegs 17628704
...

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing --jit
Bug: 34053922
Change-Id: I68e73a438e6ac8e8908e6fccf53bbeea8a64a077
2d8801f7b932496d5c2606294ff8fdea60e05b30 28-Nov-2017 Nicolas Geoffray <ngeoffray@google.com> Clean some dex2oat options.

Remove dump-passes inherited from Quick days,
and move dump-timings and dump-stats to CompilerStats.

Test: test.py
Change-Id: Ie79be858a141e59dc0b2a87d8cb5a5248a5bc7af
f39208f6787928151153795a3cdae28cba964df6 20-Oct-2017 Andreas Gampe <agampe@google.com> ART: Add abort-on-soft-verifier-error

Add an option to abort compilation if any class fails compile-time
verification.

Bug: 65318848
Bug: 67358823
Test: m test-art-host-gtest-dex2oat_test
Change-Id: I5d2a7cd1d2ed048ab39d6f787ecc9eb2f41d3d77
04c6ab9266876137c9b46b69391aa2820cd56600 09-Jun-2017 Andreas Gampe <agampe@google.com> ART: Forward declarations for InvokeType

Use forward declarations in other header files.

Test: m
Change-Id: I8ef4492b6c48ff20d4d77d0516eacd362ed210bc
fc8b422c286501346b5b797420fb616aaa5e952a 17-Sep-2017 Mathieu Chartier <mathieuc@google.com> Clean up AtomicDexRefMap

Make ClassReference, TypeReference, and MethodReference extend
DexFileReference. This enables using all of these types as the key
for AtomicDexRefMap.

Test: test-art-host
Bug: 63851220
Bug: 63756964

Change-Id: Ida3c94cadb53272cb5057e5cebc5971c1ab4d366
c4204a3fb28a7e5abb8d16d830f25a6702e7896d 18-Sep-2017 Nicolas Geoffray <ngeoffray@google.com> Missed submitting this in last commit.

Comment updates from https://android-review.googlesource.com/#/c/platform/art/+/481277/

Test: test.py

Change-Id: I2b8633f2486d12c9c0dfe23a0e8e63af43e976fc
486dda03900a215650f71a9068759978aa77c699 11-Sep-2017 Nicolas Geoffray <ngeoffray@google.com> Add support for registering classpath classes status.

By doing class unloading after each dex file compilation, we are loosing
away verification done on classpath classes.

This change introduces a new table for keeping around class status of
classpath classes.

Multidex quickening compilation improved by ~5% by not re-verifying classpath
classes.

Bug: 63467744

test: test.py
test: golem successfully compiles FB
Change-Id: I629c0a7d86519bbc516f5e59f7cd92ca6ca842eb
5d3b002b9a244b5dc25fe97fedcb92851d9073f7 31-Aug-2017 Andreas Gampe <agampe@google.com> ART: Change CanAssumeVerified to GetPreviousClassState

Return any stored class state instead of a bool to allow more
recognized states in the future.

Bug: 63467744
Bug: 65318848
Test: m test-art-host
Change-Id: Id097273a41e09ee77c8d53377ad9beb09104a944
2b03a1f24600c8c9558fb13d3f8bca1ef0f8ee40 06-Jun-2017 Roland Levillain <rpl@google.com> Instrument ARM64 generated code to check the Marking Register.

Generate run-time code in the Optimizing compiler checking that
the Marking Register's value matches `self.tls32_.is.gc_marking`
in debug mode (on target; and on host with JIT, or with AOT when
compiling the core image). If a check fails, abort.

Test: m test-art-target
Test: m test-art-target with tree built with ART_USE_READ_BARRIER=false
Test: ARM64 device boot test with libartd.
Bug: 37707231
Change-Id: Ie9b322b22b3d26654a06821e1db71dbda3c43061
adc74df1e2bccda3a45e3bf1cce720fb36a53f87 09-Aug-2017 Mathieu Chartier <mathieuc@google.com> Support class unloading in dex2oat for quicken multidex

Support class unloading for the quicken compilation filter. This will
be enabled in a follow up CL.

Added a test that compares with and without unloading. The way that
it tests this is by adding an output app image. Having an app image
disables the unloading. This test also covers that app images don't
change the odex (currently).

Added a test for the assumed verified logic.

Cherry pick includes the test fix.

Bug: 63467744
Test: test-art-host
Test: test/testrunner/testrunner.py --interpreter --host -j40

(cherry-picked from commit 0b1c341d2d89a483142cd14bdeb4650ab00184f1)

Change-Id: If70e31d3a15579dc75fd40bfef186e0124568c87
9e050df94df5c6736e1e24705194f62fbc119114 09-Aug-2017 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Support class unloading in dex2oat for quicken multidex""

Bug: 63467744
Test: test-art-host

This reverts commit 6921d90a241f0307ac25120f8f976744d4a57706.

Change-Id: If70e31d3a15579dc75fd40bfef186e0124568c87
6921d90a241f0307ac25120f8f976744d4a57706 09-Aug-2017 Richard Uhler <ruhler@google.com> Revert "Support class unloading in dex2oat for quicken multidex"

This reverts commit 0b1c341d2d89a483142cd14bdeb4650ab00184f1.

New test Dex2oatDeterminism.UnloadCompile fails on bots gtest-debug-gc and friends.

Change-Id: Ib101fc4390d90f88fe017d8482775d5e975f2ccb
0b1c341d2d89a483142cd14bdeb4650ab00184f1 15-Jul-2017 Mathieu Chartier <mathieuc@google.com> Support class unloading in dex2oat for quicken multidex

Support class unloading for the quicken compilation filter. This will
be enabled in a follow up CL.

Added a test that compares with and without unloading. The way that
it tests this is by adding an output app image. Having an app image
disables the unloading. This test also covers that app images don't
change the odex (currently).

Added a test for the assumed verified logic.

Bug: 63467744
Test: test-art-host
Test: test/testrunner/testrunner.py --interpreter --host -j40
Change-Id: I1e8a862c6f089c06c58aa0c846797e4c24bd072c
921cb1d8677f4e9e20b978d42f50d4b49bd229d5 15-Jul-2017 Mathieu Chartier <mathieuc@google.com> Use class unloading in dex2oat for verify and extract

Unload the main classloader in between each dex file compilation to
reduce RAM. This frees the whole java heap and associated linear
allocs. This is only used for quickening since filters that do
compilation may require loaded classes in the compiler and oat
writer.

This reduces dex2oat peak PSS for compiling a large app from 196MB
to 135MB.

Only works for verify and extract since the current approach is
incompatible with oat writer patching. b/63911263

Added a verification override that reads the compiled class status
to avoid ever verifying classes that were quickened (since this
is not supported and causes failures).

There is still some duplicated verification for some class with
superclasses in other dex files.

Support for quicken will be added in a follow up CL.

(cherry-picked from commit 72041a0dcb5b7c133b79a1d6783a23039f2136bd)
Merged-In: Id0e4f84eb5db91d6143f752b498f4832a5b25b6e

Bug: 63467744
Bug: 64473133
Test: test-art-host
Test: test/testrunner/testrunner.py --interpreter --host -j40
Change-Id: Id0e4f84eb5db91d6143f752b498f4832a5b25b6e
72041a0dcb5b7c133b79a1d6783a23039f2136bd 15-Jul-2017 Mathieu Chartier <mathieuc@google.com> Use class unloading in dex2oat for verify and extract

Unload the main classloader in between each dex file compilation to
reduce RAM. This frees the whole java heap and associated linear
allocs. This is only used for quickening since filters that do
compilation may require loaded classes in the compiler and oat
writer.

This reduces dex2oat peak PSS for compiling a large app from 196MB
to 135MB.

Only works for verify and extract since the current approach is
incompatible with oat writer patching. b/63911263

Added a verification override that reads the compiled class status
to avoid ever verifying classes that were quickened (since this
is not supported and causes failures).

There is still some duplicated verification for some class with
superclasses in other dex files.

Support for quicken will be added in a follow up CL.

Bug: 63467744
Test: test-art-host
Test: test/testrunner/testrunner.py --interpreter --host -j40
Change-Id: Id0e4f84eb5db91d6143f752b498f4832a5b25b6e
8cf9cb386cd9286d67e879f1ee501ec00d72a4e1 19-Jul-2017 Andreas Gampe <agampe@google.com> ART: Include cleanup

Let clang-format reorder the header includes.

Derived with:

* .clang-format:
BasedOnStyle: Google
IncludeIsMainRegex: '(_test|-inl)?$'

* Steps:
find . -name '*.cc' -o -name '*.h' | xargs sed -i.bak -e 's/^#include/ #include/' ; git commit -a -m 'ART: Include cleanup'
git-clang-format -style=file HEAD^
manual inspection
git commit -a --amend

Test: mmma art
Change-Id: Ia963a8ce3ce5f96b5e78acd587e26908c7a70d02
1a088d440a3fac4e477a11af68adae9dcd3afd00 18-Jul-2017 Mathieu Chartier <mathieuc@google.com> Use AtomicDexRefMap for compiled classes

Changed compiled_classes_ to use an AtomicDexRefMap and deleted
the lock since it was no longer necessary.

This map is more compact than a SafeMap. RAM numbers for verify
filter on a large app (host arm compile):

Maximum resident set size (kbytes): 250012->243472
native alloc: 19284128B->13951600B

Bug: 6346774
Test: test-art-host
Change-Id: Iace66945b49433f353603a713593c53be6893cc5
93764b8ee58d54118904b8f4473628451e568893 17-Jul-2017 Mathieu Chartier <mathieuc@google.com> Generalize atomic_method_ref_map to support dex references

Generalize atomic method ref map to support dex references instead
of only method references.

The goal is to use this in a future CL to replace compiled_classes_.

Test: test-art-host

Change-Id: Ic6d1e619584f790eea68f5160fa0fcd664524cd7
f79aa7fc107c661e5a6d6ffd2a33221864fa1fa3 04-Jul-2017 Vladimir Marko <vmarko@google.com> Small refactoring of field/method access checks.

And some cleanup to reduce the size of the upcoming
method resolution rewrite CL.

Test: m test-art-host
Test: testrunner.py --host
Test: testrunner.py --host --interp-ac
Bug: 62855082
Change-Id: I5bbf0a92d75fe9de6982b80280cd5877fcc37700
4913cf39dc3a15211e3a13bdc685541babc93d6d 04-Jul-2017 Vladimir Marko <vmarko@google.com> Remove obsolete helpers from CompilerDriver.

Test: Rely on TreeHugger.
Change-Id: Id177ed422353a8606c3e57d34e1519e6b17e5c48
1cfea7af6f38cd06393fed3e466701869ce8b2c3 24-May-2017 Nicolas Geoffray <ngeoffray@google.com> Code cleanup around vdex.

1) Handle the vdex in dex2oat instead of compiler_driver
2) CHECK instead of DCHECK that we don't dexlayout with vdex.

Test: test.py
Change-Id: Idf7be59bb25708181e391d17128480659ac697e5
f0446e9c785027b89a63f625b38f07c919bc6748 16-May-2017 Andreas Gampe <agampe@google.com> ART: Misc header cleanups

Move/remove arena allocator includes.

Test: mma art
Change-Id: If998569d96c791fc3d4aa93ca95672a4d4b5782c
d482e73fe26cb9161511a80e3db39e08b9808ab6 25-Apr-2017 Andreas Gampe <agampe@google.com> ART: More header cleanup - runtime.h

Remove unnecessary runtime.h includes. Refactor other headers
(move to forward declarations) to make this possible.

Test: mmma art
Change-Id: I297f0ad444ba92169edd16d8c7cbe95bb6dbb800
bb84610d2de3c12b0e0cdc724df29479b9501461 12-May-2017 Andreas Gampe <agampe@google.com> ART: Remove CompiledClass

Replace by direct storage of the class status, and modify accessor
to return boolean value of whether the item exits. Reduces RAM
requirements and allocations for dex2oat.

Test: m test-art-host
Change-Id: I6a80ac3d644c7fd0da167996ab991b6d2796a458
d01745ef88bfd25df574a885d90a1a7785db5f5b 06-Apr-2017 Igor Murashkin <iam@google.com> optimizing: constructor fence redundancy elimination - remove dmb after LSE

Part one of a few upcoming CLs to optimize constructor fences.

This improves load-store-elimination; all singleton objects that are not
returned will have their associated constructor fence removed.

If the allocation is removed, so is the fence. Even if allocation is not
removed, fences can sometimes be removed.

This change is enabled by tracking the "this" object associated with the
constructor fence as an input. Fence inputs are considered weak; they do not keep
the "this" object alive; if the instructions for "this" are all deleted,
the fence can also be deleted.

Bug: 36656456
Test: art/test.py --host && art/test.py --target
Change-Id: I05659ab07e20d6e2ecd4be051b722726776f4ab1
051071718085ce807a2e7c55278a8d723e238e86 16-Mar-2017 Mathieu Chartier <mathieuc@google.com> Delete SrcMap

No longer used. SrcMapElem is still used by elf_debug_line_writer.h.

Address previous comments from aog/351387.

Test: make

Change-Id: Ib1525168b14889abbdc78ba20c64f3223b140a51
8d6768d47b66a688d35399d524ad5a5450e9d9d4 14-Mar-2017 Vladimir Marko <vmarko@google.com> Revert^6 "Hash-based dex cache type array."

Fixed ImageWriter to write class table also if it contains
only boot class loader classes. Added a regression test and
added extra checks for debug-build to verify that dex cache
types from app image are also in the class table. Removed
some unnecessary debug output.

Test: 158-app-image-class-table
Bug: 34839984
Bug: 30627598
Bug: 34659969

This reverts commit 0b66d6174bf1f6023f9d36dda8538490b79c2e9f.

Change-Id: I6a747904940c6ebc297f4946feef99dc0adf930c
0b66d6174bf1f6023f9d36dda8538490b79c2e9f 13-Mar-2017 Vladimir Marko <vmarko@google.com> Revert^5 "Hash-based dex cache type array."

For app images, ImageWriter does not add boot image
classes to the app image class table even though it
keeps them in the dex caches. The reason for that is
unknown, the code looks OK.

Bug: 34839984
Bug: 30627598
Bug: 34659969

Also reverts "Improve debugging output for a crash."

This reverts commits
bfb80d25eaeb7a604d5dd25a370e3869e96a33ab,
8dd56fcb3196f466ecaffd445397cb11ef85f89f.

Test: testrunner.py --host
Change-Id: Ic8db128207c07588c7f11563208ae1e85c8b0e84
13439f0c4769a0768cf1bbaa7b3f2f9ee5a317c5 21-Feb-2017 Calin Juravle <calin@google.com> Use offline inline caches during AOT compilation

Also:
- extend the testing script to understand profile when --profile is
passed
- filter inline cache types which are not loaded by the caller class
loader

Test: m test-art-host-run-test-638-checker-inline-caches
Bug: 32434870
Change-Id: Ifcc27b3cebc79b84617412aaae64a73324151b55
bfb80d25eaeb7a604d5dd25a370e3869e96a33ab 14-Feb-2017 Vladimir Marko <vmarko@google.com> Revert^4 "Hash-based dex cache type array."

Added extra output to the abort message to collect more data
when we hit the crash. Added extra check when loading an app
image to verify that the class table isn't already broken.

Test: testrunner.py --host
Bug: 34839984
Bug: 30627598
Bug: 34659969

This reverts commit 5812e20ff7cbc8efa0b8d7486ada2f58840a6ad5.

Change-Id: I9bb442a184c236dcb75b3e42a095f39cd6bee59d
5812e20ff7cbc8efa0b8d7486ada2f58840a6ad5 14-Feb-2017 Mathieu Chartier <mathieuc@google.com> Revert^3 "Hash-based dex cache type array."

Assert failing for "earchbox:search":
F zygote64: class_linker.cc:4612] Check failed: handle_scope_iface.Get() != nullptr

Test: m test-art-host
Bug: 34839984
Bug: 30627598
Bug: 34659969

This reverts commit 85c0f2ac03417f5125bc2ff1dab8109859c67d5c.

Change-Id: I39846c20295af5875b0f945be7035c73ded23135
85c0f2ac03417f5125bc2ff1dab8109859c67d5c 02-Feb-2017 Vladimir Marko <vmarko@google.com> Revert^2 "Hash-based dex cache type array."

The reason for the revert was fixed by
https://android-review.googlesource.com/332666 .
We now enable clearing dex cache types in test 155 from that
CL. Also avoid an unnecessary store in LookupResolvedTypes()
and prevent verifier from messing up the dex cache types.

Test: m test-art-host
Bug: 34839984
Bug: 30627598
Bug: 34659969

This reverts commit d16363a93053de0f32252c7897d839a46aff14ae.

Change-Id: Ie8603cfa772e78e648d005b0b6eae59062ae729d
83c8e27a292e6e002fb3b3def75cf6d8653378e8 31-Jan-2017 Nicolas Geoffray <ngeoffray@google.com> Code refactoring around sharpening HLoadClass.

Even if the class is not accessible through the dex cache, we
can access it by other means (eg boot class, jit table). So rewrite
static field access instruction builder to not bail out if a class
cannot be accessed through the dex cache.

bug:34966607

test: test-art-host test-art-target
Change-Id: I88e4e09951a002b480eb8f271726b56f981291bd
d16363a93053de0f32252c7897d839a46aff14ae 01-Feb-2017 Vladimir Marko <vmarko@google.com> Revert "Hash-based dex cache type array."

Reverting to work around some programs crashing with
Check failed: handle_scope_iface.Get() != nullptr.
though the reason for the failure not yet understood.

Test: m test-art-host
Bug: 34839984
Bug: 30627598
Bug: 34659969
Bug: 30419309

This reverts commit ec7862283dd49f5a58d0ac45960ce27c2f7671b8.

Change-Id: Ifded663633082f1e59e5b6ff2e026dc559bd6b82
ec7862283dd49f5a58d0ac45960ce27c2f7671b8 20-Dec-2016 Vladimir Marko <vmarko@google.com> Hash-based dex cache type array.

Test: m test-art-host (Interpreter, Optimizing, JIT)
Test: m test-art-target on Nexus 6P (Interpreter, Optimizing, JIT)
Test: Nexus 6P boots
Test: m valgrind-test-art-host
Bug: 30627598
Bug: 34659969
Bug: 30419309
Change-Id: Ic00eda89e58088a3573fc9ec0ad04c0e69e161d1
33083d626dbf2c8b06badfd73f50e98114483059 19-Jan-2017 Calin Juravle <calin@google.com> Rename offline_profiling_info to profile_compilation_info

This solves a long standing TODO to align the names of the files and the
class.

Bug: 32434870
Test: test-art-host

Change-Id: I2707da8fef8736a7223189d894fc00ff11bfab12
7498105ec7497bae2ba9f1a697da9efa0c979654 16-Jan-2017 Nicolas Geoffray <ngeoffray@google.com> Handle verify-profile and bootclasspath classes in vdex.

Two problems:
1) An apk might define a class twice, or define a class that
is already in the bootclasspath, or define a class that
in the future happens to be in the bootclasspath.
2) verify-profile does not make classes that were not verified
as verify-at-runtime for vdex.

Fixes:
1) Check that the resolved class is part of the dex file that
we are currently looking into. If not, don't update its
verification status.
2) Make unverified classes as such when they are not in the profile.

bug:34108532
Test: 634-vdex-duplicate
Change-Id: I77c5e417c16c91af257b88b6456d07c0e4c2ca93
c1a42cf3873be202c8c0ca3c4e67500b470ab075 18-Dec-2016 Nicolas Geoffray <ngeoffray@google.com> Remove soon to be obsolete call kinds for direct calls.

And remove CompilerDriver::GetCodeAndMethodForDirectCall in
preparation of removing non-PIC prebuild and non-PIC on-device
boot image compilation.

Test: test-art-host test-art-target
bug:33192586
Change-Id: Ic48e3e8b9d7605dd0e66f31d458a182198ba9578
ade72d6e03e2ca49a8d2691f35fe6e37d88a196d 15-Dec-2016 Nicolas Geoffray <ngeoffray@google.com> Do not resolve types with vdex.

We don't need to, and it's time expensive.

test: test-art-host, 2x faster vdex compilation time.
bug: 30937355

Change-Id: Ic04ebfee9172ed676fbb38e6901615ed3473352a
acab8d485bd9c007b991f482ed01264d527b63d6 23-Nov-2016 Mathieu Chartier <mathieuc@google.com> Move compiled methods to use AtomicMethodRefMap

Use AtomicMethodRefMap to avoid locking and map costs.

Native RAM usage for interpret-only compile FB:
71270192B -> 64117168B

Perf:
CompilerDriver::GetCompiledMethod: 0.88% -> 0.04%
Mutex::ExclusiveLock: 1.55% -> 1.05%

Bug: 32641252

Test: test-art-host-run-test

Change-Id: I146e7bf2f3328b4fa84f2cc19d591f4da82dccfc
b0bbe8e5c28c061bf4ef4086d3bbb2c5c5266979 19-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Use input-vdex-fd, or input-vdex in dex2oat.

input-vdex-fd is used by installd
input-vdex is used by run-tests, and (will be used by) go/lem

This change copies the contents of the passed vdex to the new one,
unquicken the new vdex, and run the fast verification on the new
vdex.

bug:30937355
Test: device boots, apps get updated faster with vdex
Test: set TEST_VDEX to true in run-test-jar, run all tests
Test: 628-vdex

Change-Id: Idfbac4de411cebcf8ea7a6af7a417d7c7908dd72
a5b09a67034e57a6e10231dd4bd92f4cb50b824c 18-Nov-2016 Andreas Gampe <agampe@google.com> ART: Add dex::TypeIndex

Add abstraction for uint16_t type index.

Test: m test-art-host
Change-Id: I47708741c7c579cbbe59ab723c1e31c5fe71f83a
01b70e8bca5e824ee3958ffbdd7727334e81eb0a 17-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Add dequickening support.

Both vdex and BCI require full dequickening support. This
change implements dequickening by using the existing encoded
quickening, and adds the checkcast quickening to that encoding.

bug: 30937355
bug: 32369913
Test: dex_to_dex_decompiler_test.cc test-art-host

Change-Id: Ie95f46946d59b28157d6e47dcf4a859be032d1c3
6bb7f1b60f4b6b2214457d19d66d2b7b50685feb 03-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Integrate VerifierDeps in compiler driver.

If a VerifierDeps is given, try fast verify. Otherwise create
a new VerifierDeps and do the full verification.

test: test-art-host, verifier_deps_test
bug: 30937355
Change-Id: Ifb030d7b5232c95872164f601057a56ab96038e1
0802518a6a5af8182131eb3fe66bf58dd77f9fe2 25-Oct-2016 Nicolas Geoffray <ngeoffray@google.com> Save the non-verified classes in the VerifierDeps.

We will need that information when taking an OTA to make sure
the same set of classes needs to be verified at runtime.

Currently, the vdex file will contain a list of unverified
classes. We could alternatively encode a bit vector of the size
of the type_id array, but the few experiments I did show that
the bit vector is actually larger. We can refine this later.

bug: 30937355
test: m test-art-host
test: verifier_deps_test.cc

Change-Id: I2670e4fd2e54ee7a148246baa705fda3a56617ff
571d2340d889dee2a7a809c3c56293fe06d2b52d 12-Oct-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Remove dead code from compiler driver.""

This reverts commit 38f250fd3cb36fac27bad7cac8eefacdf8a6e41e.

Change-Id: I491891c9108a0646145553241aa04a9cbba7d29b
38f250fd3cb36fac27bad7cac8eefacdf8a6e41e 04-Oct-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Remove dead code from compiler driver."

This reverts commit 44b3da25191052acc18528d8ade9cf3038505180.

Change-Id: I0cf049ed967bcaf8dfd89fc88288d992c63a4939
aad75c6d5bfab2dc8e30fc99fafe8cd2dc8b74d8 03-Oct-2016 Vladimir Marko <vmarko@google.com> Revert "Revert "Store resolved Strings for AOT code in .bss.""

Fixed oat_test to keep dex files alive. Fixed mips build.
Rewritten the .bss GC root visiting and added write barrier
to the artResolveStringFromCode().

Test: build aosp_mips-eng
Test: m ART_DEFAULT_GC_TYPE=SS test-art-target-host-gtest-oat_test
Test: Run ART test suite on host and Nexus 9.
Bug: 20323084
Bug: 30627598

This reverts commit 5f926055cb88089d8ca27243f35a9dfd89d981f0.

Change-Id: I07fa2278d82b8eb64964c9a4b66cb93726ccda6b
44b3da25191052acc18528d8ade9cf3038505180 03-Oct-2016 Nicolas Geoffray <ngeoffray@google.com> Remove dead code from compiler driver.

test: m test-art-host
Change-Id: Ie4b6a4c371fff6c9c213d8d6604eb09a5e71d595
5f926055cb88089d8ca27243f35a9dfd89d981f0 30-Sep-2016 Vladimir Marko <vmarko@google.com> Revert "Store resolved Strings for AOT code in .bss."

There are some issues with oat_test64 on host and aosp_mips-eng.

Also reverts "compiler_driver: Fix build."

Bug: 20323084
Bug: 30627598

This reverts commit 63dccbbefef3014c99c22748d18befcc7bcb3b41.
This reverts commit 04a44135ace10123f059373691594ae0f270a8a4.

Change-Id: I568ba3e58cf103987fdd63c8a21521010a9f27c4
762869dee6e0eadab5be1c606792d6693bbabf4e 15-Jul-2016 Nicolas Geoffray <ngeoffray@google.com> Simplify our intrinsic recognizer.

- Use the modifiers for storing the intrinsic kind.
- Delete dex_file_method_inliner and its associated map.

This work was also motivated by the fact that the inline
method analyzer leaks intrinsic tables, and even worse, might re-use
a table from one dex file to another unrelated dex file in the presence
of class unloading and the unlikely event of the dex files getting
the same address.

test: m test-art-host m test-art-target

Change-Id: Ia653d2c72df13889dc85dd8c84997582c034ea4b
63dccbbefef3014c99c22748d18befcc7bcb3b41 21-Sep-2016 Vladimir Marko <vmarko@google.com> Store resolved Strings for AOT code in .bss.

And do some related refactorings.

Bug: 20323084
Bug: 30627598
Test: Run ART test suite including gcstress on host and Nexus 9.
Test: Run ART test suite including gcstress with baker CC on host and Nexus 9.
Test: Build aosp_mips64-eng.
Change-Id: I1b12c1570fee8e5da490b47f231050142afcbd1e
da079bba8403733cac9bb7415b038ffd77e62403 26-Sep-2016 Nicolas Geoffray <ngeoffray@google.com> Cleanup String.<init> handling.

Move everything to one place (currently well_known_classes.cc, but
no strong preference) and define a macro to easily handle the list
of affected methods.

test: m test-art-host
test: m test-art-target
Change-Id: Ib8372d130d5458516a1f1ae31014afc76037fc34
5e4e11e171f90d9a3ea178fc8e72aac909de55d5 22-Sep-2016 Nicolas Geoffray <ngeoffray@google.com> Clean-up sharpening and compiler driver.

Remove dependency on compiler driver for sharpening
and dex2dex (the methods called on the compiler driver were
doing unnecessary work), and remove the now unused methods
in compiler driver.

Also remove test that is now invalid, as sharpening always
succeeds.

test: m test-art-host m test-art-target
Change-Id: I54e91c6839bd5b0b86182f2f43ba5d2c112ef908
d9c90373d640a5e08072cf469c372e24a8c0fc35 14-Sep-2016 David Brazdil <dbrazdil@google.com> Move ArrayRef to runtime/base

Will be used in upcoming CLs regarding VDEX and VerifierDeps.

Test: m test-art-host
Change-Id: I68e611a4a52246c2bdf45eab7c61f3212908afd4
bdf7f1c3ab65ccb70f62db5ab31dba060632d458 31-Aug-2016 Andreas Gampe <agampe@google.com> ART: SHARED_REQUIRES to REQUIRES_SHARED

This coincides with the actual attribute name and upstream usage.
Preparation for deferring to libbase.

Test: m
Test: m test-art-host
Change-Id: Ia8986b5dfd926ba772bf00b0a35eaf83596d8518
b089eccf503646e6ed2d5bb20d973d9131166655 01-Jun-2016 Vladimir Marko <vmarko@google.com> Delay dex-to-dex compilation until Optimizing is done.

This fixes a race between inlining in the Optimizing
backend and dex-to-dex quickening where the Optimizing can
read the non-quickened opcode and then the quickened field
index or vtable index and look up the wrong field or method.
Even if we such tearing of the dex instruction does not
happen, the possible reordering of dex-to-dex and Optimizing
compilation makes the final oat file non-deterministic.

Also, remove VerificationResults::RemoveVerifiedMethod() as
we have only the Optimizing backend now and as such it was
dead code and would have interfered with this change.

Bug: 29043547
Bug: 29089975

(cherry picked from commit 492a7fa6df3b197a24099a50f5abf624164f3842)

Change-Id: I1337b772dc69318393845a790e5f6d38aa3de60f
492a7fa6df3b197a24099a50f5abf624164f3842 01-Jun-2016 Vladimir Marko <vmarko@google.com> Delay dex-to-dex compilation until Optimizing is done.

This fixes a race between inlining in the Optimizing
backend and dex-to-dex quickening where the Optimizing can
read the non-quickened opcode and then the quickened field
index or vtable index and look up the wrong field or method.
Even if we such tearing of the dex instruction does not
happen, the possible reordering of dex-to-dex and Optimizing
compilation makes the final oat file non-deterministic.

Also, remove VerificationResults::RemoveVerifiedMethod() as
we have only the Optimizing backend now and as such it was
dead code and would have interfered with this change.

Bug: 29043547
Bug: 29089975
Change-Id: I8389927d35dcacaf2f99c2153f055857036c8129
d361afbf6677b5af99fe2a44e92ef9d6e3ad7c17 28-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Write conflict tables in image""

Added test.

Bug: 27906566

This reverts commit 8e2478d23e89a7022c93ddc608dcbba7b29b91e6.

(cherry picked from commit cdca476bf3394ce9d97a369e84e701b427009318)

Change-Id: Iedb4ca9a28ae178fa7c2d486803fa27b402a85ed
91288d8f03b9aab28b61a4a76e552ad7e0c15c8b 28-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Write conflict tables in image""

Added test.

Bug: 27906566

This reverts commit 8e2478d23e89a7022c93ddc608dcbba7b29b91e6.

(cherry picked from commit cdca476bf3394ce9d97a369e84e701b427009318)

Change-Id: Ia94fc7acc7ae3879921c4e8d0a02b156037ac286
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
116e6e2f36e82156d54f2505909be0a6b2b7247d 13-Apr-2016 Vladimir Marko <vmarko@google.com> Use dex cache from compilation unit in HInstructionBuilder.

Avoid calling costly ClassLinker::FindDexCache() from
HInstructionBuilder, the dex cache is already available in
the compilation unit. Compiling Nexus 5 boot image on host
under perf(1) shows that the time spent in FindDexCache()
is reduced from about 2% to well under 0.2%, 90% of the
remaining hits coming from ReferenceTypePropagation which
doesn't have access to the compilation unit.

Bug: 28173563

(cherry picked from commit 3cd50df11b3076b801954018236c366fd9b97948)

Change-Id: Ife0dba2dd8f49bd52f86ddadf06ee787bad03d66
d1ee80948144526b985afb44a0574248cf7da58a 13-Apr-2016 Vladimir Marko <vmarko@google.com> Move Assemblers to the Arena.

And clean up some APIs to return std::unique_ptr<> instead
of raw pointers that don't communicate ownership.

(cherry picked from commit 93205e395f777c1dd81d3f164cf9a4aec4bde45f)

Bug: 27505766
Change-Id: I3017302307a0253d661240750298802fb0d9585e
3cd50df11b3076b801954018236c366fd9b97948 13-Apr-2016 Vladimir Marko <vmarko@google.com> Use dex cache from compilation unit in HInstructionBuilder.

Avoid calling costly ClassLinker::FindDexCache() from
HInstructionBuilder, the dex cache is already available in
the compilation unit. Compiling Nexus 5 boot image on host
under perf(1) shows that the time spent in FindDexCache()
is reduced from about 2% to well under 0.2%, 90% of the
remaining hits coming from ReferenceTypePropagation which
doesn't have access to the compilation unit.

Change-Id: Id9df61c79db9a67e3f12c857f32a4ca80e5420c3
93205e395f777c1dd81d3f164cf9a4aec4bde45f 13-Apr-2016 Vladimir Marko <vmarko@google.com> Move Assemblers to the Arena.

And clean up some APIs to return std::unique_ptr<> instead
of raw pointers that don't communicate ownership.

Change-Id: I3017302307a0253d661240750298802fb0d9585e
b7248b9f1a6d62a30f0cefc12de63c216b5d46e2 07-Apr-2016 Mathieu Chartier <mathieuc@google.com> Store precice set of which constructors require barriers

Fixes bugs where things in the boot image might not have been
calculated even though resolved_clases was true. This only occured
for app and test compiles though.

Fixes test 476-checker-ctor-memory-barrier which was failing due to
inlining something in the boot class path and getting a unexpected
barrier since the barrier defaults to enabled.

No measurable increase in RAM usage.

(cherry picked from commit c4ae916def97b9e1ef6df35c8fabb3921a0e380c)

Bug: 28005874

Change-Id: I4a417819aa129c95f4a83c38df1a66eb77824ea9
c4ae916def97b9e1ef6df35c8fabb3921a0e380c 07-Apr-2016 Mathieu Chartier <mathieuc@google.com> Store precice set of which constructors require barriers

Fixes bugs where things in the boot image might not have been
calculated even though resolved_clases was true. This only occured
for app and test compiles though.

Fixes test 476-checker-ctor-memory-barrier which was failing due to
inlining something in the boot class path and getting a unexpected
barrier since the barrier defaults to enabled.

No measurable increase in RAM usage.

Bug: 28005874

Change-Id: I4a417819aa129c95f4a83c38df1a66eb77824ea9
b5d386118334fa5181c31b83b3fee6332537f4b7 07-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Check if we require barrier if we did not resolve classes""

This reverts commit a7ab4997f7263439561093ffbc7dea29181a47c5.
371bd83f21f8db3b8e4cc8a660ead6a0650e92f6 07-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Change RequiresConstructorBarrier default to yes""

This reverts commit 0436ee6bd33a0b905cd2a7e333f7935da1bd5d86.
0436ee6bd33a0b905cd2a7e333f7935da1bd5d86 07-Apr-2016 Roland Levillain <rpl@google.com> Revert "Change RequiresConstructorBarrier default to yes"

CL https://android-review.googlesource.com/#/c/213119/ is
breaking run-test 476-checker-ctor-memory-barrier on ARM
and ARM64.

Bug: 28005874

This reverts commit f2f0f4b0b9185fe0b6d1fb22744a871c96296db2.

Change-Id: Ic6e97ab07358406c07c654ac9de700f0186f15f8
a7ab4997f7263439561093ffbc7dea29181a47c5 07-Apr-2016 Roland Levillain <rpl@google.com> Revert "Check if we require barrier if we did not resolve classes"

CL https://android-review.googlesource.com/#/c/213119/ is
breaking run-test 476-checker-ctor-memory-barrier on ARM
and ARM64, and reverting it requires reverting this CL
(https://android-review.googlesource.com/#/c/213109/)
first.

Bug: 28005874

This reverts commit 20fd7cdd25364b16d878df037c6ae0fbd5f2a9ac.

Change-Id: Iaf174b2df3dd4dd469c79ca3f2c68ef87748d124
20fd7cdd25364b16d878df037c6ae0fbd5f2a9ac 06-Apr-2016 Mathieu Chartier <mathieuc@google.com> Check if we require barrier if we did not resolve classes

Check fields instead of just always inserting the return void
barrier.

Bug: 28005874

(cherry picked from commit 03c7df9648028228d75dddfc25cbc81ab8096167)

Change-Id: I1207fecc9a4425d024a7e5e1a850c9e2a6e17c31
03c7df9648028228d75dddfc25cbc81ab8096167 06-Apr-2016 Mathieu Chartier <mathieuc@google.com> Check if we require barrier if we did not resolve classes

Check fields instead of just always inserting the return void
barrier.

Bug: 28005874
Change-Id: I62cc1c3979304642109961fcf2607a7df065a162
f2f0f4b0b9185fe0b6d1fb22744a871c96296db2 06-Apr-2016 Mathieu Chartier <mathieuc@google.com> Change RequiresConstructorBarrier default to yes

Previously it defaulted to false, this caused incorrect dex2dex if
the resolution pass was not run.

TODO: Re-enable the no barrier for no resolution case to improve
interpreter performance slightly.

Bug: 28005874

(cherry picked from commit e5d8020b03956db6d533852b3ae940e0eb0fafc4)

Change-Id: Ibde6e18b8543f7bc9e17db6941a710756cd8b617
e5d8020b03956db6d533852b3ae940e0eb0fafc4 06-Apr-2016 Mathieu Chartier <mathieuc@google.com> Change RequiresConstructorBarrier default to yes

Previously it defaulted to false, this caused incorrect dex2dex if
the resolution pass was not run.

TODO: Re-enable the no barrier for no resolution case to improve
interpreter performance slightly.

Bug: 28005874
Change-Id: I6b2e5078e5a0d76317e5486cd5e4f04d995e7b56
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
6915898b28cea6c9836ca1be6814d87e89cc6d76 16-Mar-2016 Calin Juravle <calin@google.com> Improve compiler stats

- report the max size of arena alloc
- report how many virtual or interface invokes were inlined

Change-Id: I82f154a8e25b5e3890181a1aa11346cdc3f93e37
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
5b82d339955d1a0dc23eeb8d2d5659459ff987ba 18-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> The JIT does not need VerifedMethod nor CompilerCallbacks.

bug:27173201

Change-Id: I971659f9ff6a8b780c94a7bed84de90fa9fc3456
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
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
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
0b8cdfaef922cac9da13e6a8ac4e428031c02b50 14-Jan-2016 Vladimir Marko <vmarko@google.com> ART: Fix CompilerDriver::AreInSameOatFile().

Bug: 26317072
Change-Id: I4279ef6559a43b5d59188616712a867f864b5d79
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
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
226501b317e148aa8a8983355e85acb59c1eee83 11-Dec-2015 Calin Juravle <calin@google.com> Revert "Revert "Enable profiled guided compilation in dex2oat""

This reverts commit 2306ae0d412cc53cbf64877e4a8c37292dd907d8.

Change-Id: I50640009c2fac88ea703812b76549a0e8a6d7584
2306ae0d412cc53cbf64877e4a8c37292dd907d8 11-Dec-2015 Calin Juravle <calin@google.com> Revert "Enable profiled guided compilation in dex2oat"

The test still have some flakiness in it which didn't reproduce locally.

This reverts commit 500c9be1f261a8a95ae7a25f4f8084f43207f313.

Change-Id: I132aff62bf03c2f926aafde6869707573bae9b36
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
500c9be1f261a8a95ae7a25f4f8084f43207f313 25-Nov-2015 Calin Juravle <calin@google.com> Enable profiled guided compilation in dex2oat

- add parsing of the profile info saved during JIT.
- don't compile methods which are not part of the profile info.
- delete old profile hooks.
- add test for reading/writing profile. The test is disable in:
* interpreter modes: the test needs JIT.
* no-dex2oat/no-prebuild: we only save profiling info for the primary
oat file. In these modes we don't create oat files and thus nothing
is saved.

Bug:26080105

Change-Id: Ifdc63dc9d4b537fc79e54c3edc3ae3a462bc30fb
9fdb129b90c9a985f606f9d95627b4852171dc11 02-Dec-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Enable profiled guided compilation in dex2oat"

Test has flakes:

+art F 30865 30865 art/runtime/java_vm_ext.cc:466] JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal start byte 0x80
+art F 30865 30865 art/runtime/java_vm_ext.cc:466] string: '��gy�'
+art F 30865 30865 art/runtime/java_vm_ext.cc:466] input: '<0x80> 0xd8 0x67 0x79 0x8e 0x7f'
+art F 30865 30865 art/runtime/java_vm_ext.cc:466] in call to NewStringUTF
+art F 30865 30865 art/runtime/java_vm_ext.cc:466] from java.lang.String Main.getProfileInfoDump(java.lang.String, java.lang.Class, java.lang.Class)

This reverts commit 27e17fd81cc30e16e86c9c15498cae7f920c9dfe.

Change-Id: Id224b5970c3620c4c71fc0d39ed4a2e4755e5f29
27e17fd81cc30e16e86c9c15498cae7f920c9dfe 25-Nov-2015 Calin Juravle <calin@google.com> Enable profiled guided compilation in dex2oat

- add parsing of the profile info saved during JIT
- don't compile methods which are not part of the profile info.
- delete old profile hooks

Change-Id: I45a13c3aeb36265d335e57cd160b9ea0fab3cbb5
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
d9dc6f45c3f5fb0e5d279e6c038692258b27192b 24-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> A few more optimizations on avoiding HClinit.

Change-Id: I622a98b620e9d261cb654e2f5ab578bd8b3484b1
fb8464ae5f5194dc16278e528cfcbff71498c767 02-Nov-2015 Mingyao Yang <mingyao@google.com> Revert "Revert "Enable store elimination for singleton objects.""

This reverts commit 55d02cf056f993aeafebd54e7b7c68c7a48507c9, and
makes the following change:
Currently we leverage loop side effects to decide whether heap values are
killed by the loop. Stores need to be kept if heap values may be killed
by loops and the corresponding loads cannot be eliminated. Similar thing
need to be done for each predecessor when we merge predecessor heap values.
To do that, the HInstanceFieldSet instruction itself is put in the heap
value array instead of the value of the store instruction. The store
instruction may be added to possibly_removed_stores_ first, but can later
be removed from possibly_removed_stores_ when it's found out that the store
needs to be kept due to merging/loop side effects.

Change-Id: I4f7bb1960f7b47240873e00ff1adac46fc102a02
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
d28b969c273ab777ca9b147b87fcef671b4f695f 04-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Code cleanup to avoid CompilerDriver abstractions in JIT.

Avoids allocating a CompiledMethod.

Change-Id: I35b4aa0d7c74daba68e827a01e71c300fce3b3bf
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
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
55d02cf056f993aeafebd54e7b7c68c7a48507c9 29-Oct-2015 Andreas Gampe <agampe@google.com> Revert "Enable store elimination for singleton objects."

This reverts commit 7f43a3d48fc29045875d50e10bbc5d6ffc25d61e.

Fails booting.

Bug: 25357772
Change-Id: Ied19536f3ce8d81e76885cb6baed4853e2ed6714
7f43a3d48fc29045875d50e10bbc5d6ffc25d61e 28-Oct-2015 Mingyao Yang <mingyao@google.com> Enable store elimination for singleton objects.

Enable store elimination for singleton objects. However for finalizable object,
don't eliminate stores. Also added a testcase.

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

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

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

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

Change-Id: I974f1f5e58350de2bf487a2bca3907fa05fb80ea
3cfa4d05afa76e19ca99ec964b535a15c73683f0 07-Oct-2015 Andreas Gampe <agampe@google.com> ART: Remove interpreter entrypoints

These are no longer used as entrypoints. Make them proper runtime
functions local to the interpreter.

Bump oat version.

Change-Id: Icdd92e20eafc5668b68eeebf55cf624560f462b3
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
736b560f2d2c89b63dc895888c671b5519afa4c8 02-Sep-2015 Mathieu Chartier <mathieuc@google.com> Reduce how often we call FindDexCache

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

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

Change-Id: If18e9e79e06cdf1676692e5efacb682bf93889c3
3887c468d731420e929e6ad3acf190d5431e94fc 12-Aug-2015 Roland Levillain <rpl@google.com> Remove unnecessary `explicit` qualifiers on constructors.

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

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

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

Change-Id: Ia4d4dd86211da6045709a45c7bf8430471d1b62b
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
c04c800e7bda94abfadc8c2d30f58c50b261b612 14-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Revert "Revert "Make dex2dex return a CompiledMethod after quickening.""""

This reverts commit ed6195a514e3253576af27ea9ba13038509d29ac.

Change-Id: Icb58854301e8982147cdebe3edf2e0d9e0a63a56
ed6195a514e3253576af27ea9ba13038509d29ac 13-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Revert "Make dex2dex return a CompiledMethod after quickening."""

Breaks again in some configurations I don't fully understand yet.

This reverts commit f075879649686e59b7a9065c5a061dbfdcdfbecc.

Change-Id: I0ac5533825e40b06462ee69b2740e4a96fb5c582
f075879649686e59b7a9065c5a061dbfdcdfbecc 13-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Make dex2dex return a CompiledMethod after quickening.""

This reverts commit 327c5ed30a1f016ef3e1bb26ea7b4abd34eb63b9.

Change-Id: I0dc5d92e5d1ef98830fbd3c40ec59a93f9e0422d
327c5ed30a1f016ef3e1bb26ea7b4abd34eb63b9 13-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Make dex2dex return a CompiledMethod after quickening."

Build failures on arm/arm64.

This reverts commit 6920703c8eae0d90528ea09945e742582b6f8198.

Change-Id: I0dd5426610150937dac6e4d9dd9aa759bdf7fca4
6920703c8eae0d90528ea09945e742582b6f8198 09-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Make dex2dex return a CompiledMethod after quickening.

This is the starting piece of pushing more verification and
dex2dex data into an .oat file, to lower the dependency on verification
results at runtime.

Change-Id: I8e1b49a0207714bc5b84d1f606806718c5c7fb69
bbcc01a5a38d28c221c05788e56473a287f57589 30-Jun-2015 Roland Levillain <rpl@google.com> Make compiler-related gtests honor ART_USE_OPTIMIZING_COMPILER.

Previously, gtests using the art::CommonCompilerTest
class were using Quick as compiler. Now, setting the
environment variable ART_USE_OPTIMIZING_COMPILER to `true`
before building and running these tests will use Optimizing
instead.

Change-Id: I724a3215d2eb1841089745fbabb5cb58b0422ef3
a8b41003a717ecf399b890c18e9b0df49f55472f 15-Jun-2015 Vladimir Marko <vmarko@google.com> ART: Fix reporting initialized classes by CompilerDriver.

Fix a bug where the CompilerDriver was erroneously reporting
classes as initialized during AOT compilation when they were
not guaranteed to be initialized at runtime.

This fix prevents the Quick compiler from inlining calls to
static methods in classes that are not guaranteed to be
initialized, so that the runtime performs the initialization
required for correctness.

Bug: 21847756

(cherry picked from commit 07785bb98dc8bbe192970e0f4c2cafd338a8dc68)

Change-Id: I60c7361cb6e8f51be20a3cbfcae19f3240bdfbed
07785bb98dc8bbe192970e0f4c2cafd338a8dc68 15-Jun-2015 Vladimir Marko <vmarko@google.com> ART: Fix reporting initialized classes by CompilerDriver.

Fix a bug where the CompilerDriver was erroneously reporting
classes as initialized during AOT compilation when they were
not guaranteed to be initialized at runtime.

This fix prevents the Quick compiler from inlining calls to
static methods in classes that are not guaranteed to be
initialized, so that the runtime performs the initialization
required for correctness.

Bug: 21847756
Change-Id: I6fee5ef9c05c2e5190ab8a9fe61365d5119011c5
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
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
848f70a3d73833fc1bf3032a9ff6812e429661d9 15-Jan-2014 Jeff Hao <jeffhao@google.com> Replace String CharArray with internal uint16_t array.

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

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

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

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

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

Change-Id: I9ba452b8bd09ae1fdd9a3797ef556e3e7e19c651
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
2be39e05ea8c4475278fe6a6573c3c8f04e075d4 21-Apr-2015 Calin Juravle <calin@google.com> Use --dump-stats to dump optimizing compiler stats.

VLOG(compiler) produces too much output and it takes a long time if you
only need to see how an analysis performs.

Change-Id: Ic17c2b2b5fec431d356cecd37289fb96985d4d7f
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
27df758e2e7baebb6e3f393f9732fd0d064420c8 17-Apr-2015 Calin Juravle <calin@google.com> [optimizing] Add memory barriers in constructors when needed

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

Bug: 19851497
Change-Id: If8c485092fc512efb9636cd568cb0543fb27688e
f1c6d9e87cbfd27702103ccc7c7f08ce784dc872 13-Apr-2015 Calin Juravle <calin@google.com> Fallback to quick in case of soft verification errors

Add a regression test: using uninitialized values triggers a soft
verification error and optimizing should not crash.

Thanks to Stephen Kyle (stephenckyle@googlemail.com) for the bug report.

Bug: 19988704
Change-Id: I67174538eed853baff735694b3ae8eb34afe2a39
031af41d1debbdbd8964d7c504a789068dfe6029 13-Apr-2015 Calin Juravle <calin@google.com> Revert "Fallback to quick in case of soft verification errors"

This reverts commit c751d37e692d89b360f3c09421401f581b5c6d06.

Change-Id: I2183df8e856410989bc019f6a1f58af37d5d7eab
c785344b87221f5e4e6473e5b762e4e61fe65dcf 27-Mar-2015 Mathieu Chartier <mathieuc@google.com> Move ArtField to native

Add linear alloc. Moved ArtField to be native object. Changed image
writer to put ArtFields after the mirror section.

Savings:
2MB on low ram devices
4MB on normal devices

Total PSS measurements before (normal N5, 95s after shell start):
Image size: 7729152 bytes
23112 kB: .NonMoving
23212 kB: .NonMoving
22868 kB: .NonMoving
23072 kB: .NonMoving
22836 kB: .NonMoving
19618 kB: .Zygote
19850 kB: .Zygote
19623 kB: .Zygote
19924 kB: .Zygote
19612 kB: .Zygote
Avg: 42745.4 kB

After:
Image size: 7462912 bytes
17440 kB: .NonMoving
16776 kB: .NonMoving
16804 kB: .NonMoving
17812 kB: .NonMoving
16820 kB: .NonMoving
18788 kB: .Zygote
18856 kB: .Zygote
19064 kB: .Zygote
18841 kB: .Zygote
18629 kB: .Zygote
3499 kB: .LinearAlloc
3408 kB: .LinearAlloc
3424 kB: .LinearAlloc
3600 kB: .LinearAlloc
3436 kB: .LinearAlloc
Avg: 39439.4 kB

No reflection performance changes.

Bug: 19264997
Bug: 17643507

Change-Id: I10c73a37913332080aeb978c7c94713bdfe4fe1c
c751d37e692d89b360f3c09421401f581b5c6d06 01-Apr-2015 Calin Juravle <calin@google.com> Fallback to quick in case of soft verification errors

Add a regression test: using uninitialized values triggers a soft
verification error and optimizing should not crash.

Thanks to Stephen Kyle (stephenckyle@googlemail.com) for the bug report.

Bug: 19988704

Change-Id: I2493f737efd3fad72f6b41fb60eff1d3731613fb
c7399c82c27f85a2df2653e1eb8c0b60f2cfd934 08-Apr-2015 Andreas Gampe <agampe@google.com> ART: Remove LLVM cruft

Change-Id: I133ebed6101bf12a0642ed71e13f332c0c4f14e7
48699fb0b0662d9a4fa593d0bd2a7d5ace83e34e 06-Apr-2015 Jeff Hao <jeffhao@google.com> Prevent verified method from being deleted by compiler driver.

The results of it will be needed by future optimizing compiler changes.

Change-Id: Ifbdf47e7564906b74193f80a4ba0459eed87c0f7
20f85597828194c12be10d3a927999def066555e 19-Mar-2015 Vladimir Marko <vmarko@google.com> Fixed layout for dex caches in boot image.

Define a fixed layout for dex cache arrays (type, method,
string and field arrays) for dex caches in the boot image.
This gives those arrays fixed offsets from the boot image
code and allows PC-relative addressing of their elements.

Use the PC-relative load on arm64 for relevant instructions,
i.e. invoke-static, invoke-direct, const-string,
const-class, check-cast and instance-of. This reduces the
arm64 boot.oat on Nexus 9 by 1.1MiB.

This CL provides the infrastructure and shows on the arm64
the gains that we can achieve by having fixed dex cache
arrays' layout. To fully use this for the boot images, we
need to implement the PC-relative addressing for other
architectures. To achieve similar gains for apps, we need
to move the dex cache arrays to a .bss section of the oat
file. These changes will be implemented in subsequent CLs.

(Also remove some compiler_driver.h dependencies to reduce
incremental build times.)

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

This reverts commit 6a816cf624ba56bf2872916d7b65b18fd9a411ef.

Change-Id: I36cb524108786dd7996f2aea0443675be1f1b859
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
9b34b244ecddd8a35c922ed87bc3df0ca4db0282 09-Mar-2015 Mathieu Chartier <mathieuc@google.com> Trim arenas for JIT

Moved arena pool into the runtime. Added arena trimming to arena
pool. When called, this madvises the used memory.

Changed the JIT compiler to trim arenas after compilation. Changed
the arena mmap name to dalvik-LinearAlloc.

Native PSS before:
80353 kB: Native
80775 kB: Native
78116 kB: Native
After:
73357 kB: Native
70181 kB: Native
70306 kB: Native

Bug: 17950037
Bug: 17643507
Bug: 19264997

Change-Id: I63e7a898fd6e909c2c677fa57b5917a7b1398930
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
e5f13e57ff8fa36342beb33830b3ec5942a61cca 24-Feb-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Add JIT""

Added missing EntryPointToCodePointer.

This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399.

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

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

Bug: 17950037
This reverts commit 2535abe7d1fcdd0e6aca782b1f1932a703ed50a4.

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

Currently disabled by default unless -Xjit is passed in.

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

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

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

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

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

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

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

Bug: 17950037

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

Moved arena pool into the runtime.

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

Bug: 19264997
Change-Id: I8ddbb6d55ee923a980b28fb656c758c5d7697c2f
0b9203e7996ee1856f620f95d95d8a273c43a3df 23-Jan-2015 Andreas Gampe <agampe@google.com> ART: Some Quick cleanup

Make several fields const in CompilationUnit. May benefit some Mir2Lir
code that repeats tests, and in general immutability is good.

Remove compiler_internals.h and refactor some other headers to reduce
overly broad imports (and thus forced recompiles on changes).

Change-Id: I898405907c68923581373b5981d8a85d2e5d185a
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
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
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
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
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
807140048f82a2b87ee5bcf337f23b6a3d1d5269 21-Nov-2014 Mathieu Chartier <mathieuc@google.com> Add fast string sharpening

String sharpening changes const strings to PC relative loads instead
of always going through the dex cache. This saves code size and
probably improves performance slightly.

Before: 49602992 system@framework@boot.oat
After: 49385904 system@framework@boot.oat

Pre-cursor to removing dex_cache_strings_ field from ArtMethod.

Bug: 17643507

Change-Id: I1787f48774631eee0accafeea257aa8d0e91e8d6
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
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
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
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
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
19a19cffd197a28ae4c9c3e59eff6352fd392241 22-Oct-2014 Nicolas Geoffray <ngeoffray@google.com> Add support for static fields in optimizing compiler.

Change-Id: Id2f010589e2bd6faf42c05bb33abf6816ebe9fa9
66c6d7bdfdd535e6ecf4461bba3804f1a7794fcd 16-Oct-2014 Vladimir Marko <vmarko@google.com> Rewrite class initialization check elimination.

Split the notion of type being in dex cache away from the
class being initialized. Include static invokes in the class
initialization elimination pass.

Change-Id: Ie3760d8fd55b987f9507f32ef51456a57d79e3fb
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
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
d4c4d953035d4418126d36517e402f411d6a87f3 17-Oct-2014 Ian Rogers <irogers@google.com> Some code clean-up.

Change-Id: I4b745fd5298cd61c793e3b57514b48347bd66c0e
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
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
e982f0b8e809cece6f460fa2d8df25873aa69de4 13-Aug-2014 Nicolas Geoffray <ngeoffray@google.com> Implement invoke virtual in optimizing compiler.

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

Change-Id: I87e275cb0ae0258fc3bb32b612140000b1d2adf8
2ed8deff799448e094fa7a7cb9cf3b718820f4c6 28-Aug-2014 Andreas Gampe <agampe@google.com> ART: Allow quickening in the boot image

Update the class linker to accept class status from the boot image
in compiler mode. Update compiler driver to allow quickening for
boot image classes. Update method verifier to accept quickened
instructions in compiler mode when we just want to dump. Update
oatdump to the new verifier API.

Bug: 17316928

(cherry picked from commit 35439baf287b291b67ee406308e17fc6194facbf)

Change-Id: I9ef1bfd78b0d93625b89b3d662131d7d6e5f2903
35439baf287b291b67ee406308e17fc6194facbf 28-Aug-2014 Andreas Gampe <agampe@google.com> ART: Allow quickening in the boot image

Update the class linker to accept class status from the boot image
in compiler mode. Update compiler driver to allow quickening for
boot image classes. Update method verifier to accept quickened
instructions in compiler mode when we just want to dump. Update
oatdump to the new verifier API.

Bug: 17316928
Change-Id: I9ef1bfd78b0d93625b89b3d662131d7d6e5f2903
33ac819bd13c6e9d42b36ae8393c37cfb1bb4cde 19-Aug-2014 Yevgeny Rouban <yevgeny.y.rouban@intel.com> ART fix oat debug source map operations

Several places need to be fixed in OAT debug source map generation
(see comments in https://android-review.googlesource.com/#/c/102610/19/compiler/compiled_method.h):
1. Source Maps are deduplicated in Compiler Driver by implicit conversion
SrcMapElems to bytes. This implies incorrect operator==.
2. SrcMapElem operator < is peculiar, and cannot be applied to
SrcMapElems with negative to_ fields
3. SrcMap.Arrange method is not elegant

The fix is to introduce explicit conversion from SrcMapElem to one
signed 64-bit value, which is used as a base of two new operators < and ==.
They are correct and intuitive. DedupeHashFunc is changed to
explicitly convert array elements to byte, so the explicit type conversion
from SrcMapElem to byte is used.

Minor fix: In Line Table Programs the file index set command is generated
only if the index gets new value.

Change-Id: I5e2c03404a437254fc2db3485b22bfc1799b39b7
Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com>
53c913bb71b218714823c8c87a1f92830c336f61 13-Aug-2014 Andreas Gampe <agampe@google.com> ART: Clean up compiler

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

Change-Id: Ibaf88d02505d86994d7845cf0075be5041cc8438
e3ea83811d47152c00abea24a9b420651a33b496 08-Aug-2014 Yevgeny Rouban <yevgeny.y.rouban@intel.com> ART source line debug info in OAT files

OAT files have source line information enough for ART runtime needs like
jump to/from interpreter and thread suspension. But this information
is not enough for finer grained source level debugging and low-level
profiling (VTune or perf).

This patch adds to OAT files two additional sections:
.debug_line - DWARF formatted Elf32 section with detailed source line
information (mapping from native PC to Java source lines).

In addition to the debugging symbols added using the dex2oat option
--include-debug-symbols, the source line information is added to
the section .debug_line.

The source line info can be read by many Elf reading tools like objdump,
readelf, dwarfdump, gdb, perf, VTune, ...

gdb can use this debug line information in x86. In 64-bit mode
the information can be used if the oat file is mapped in the lower
address space (address has higher 32 bits zeroed). Relocation works.

Testing:
1. art/test/run-test --host --gdb [--64] 001-HelloWorld
2. in gdb: break Main.java:19
3. in gdb: break Runtime.java:111
4. in gdb: run - stops at void java.lang.Runtime.<init>()
5. in gdb: backtrace - shows call stack down to main()
6. in gdb: continue - stops at void Main.main() (only in 32-bit mode)
7. in gdb: backtrace - shows call stack down to main()
8. objdump -W <oat-file> - addresses are from VMA range of .text
section reported by objdump -h <file>
9. dwarfdump -ka <oat-file> - no errors expected

Size of aosp-x86-eng boot.oat increased by 11% from 80.5Mb to 89.2Mb
with two sections added .debug_line (7.2Mb) and .rel.debug (1.5Mb).

Change-Id: Ib8828832686e49782a63d5529008ff4814ed9cda
Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@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
0171987facdea1f4e22d0b5880dcde38a816adb1 29-Jul-2014 Andreas Gampe <agampe@google.com> ART: Skip compiling redefined classes in apps

If for an app a class is defined in more than one dex file, skip
all classes after the first.

Bug: 16057120

(cherry picked from commit de7b43626c49567cefb258669aac70a289b74b85)

Change-Id: I461942f762354b696c305dcae3a0d1c7de40f9df
79273802f2b788bcd3eb76edf4df1bcaa57f886f 06-Aug-2014 Andreas Gampe <agampe@google.com> ART: Rework CFA frame initialization and writing code

Move eh_frame initialization code and CFI writing code to
elf_writer_quick to remove hard-wired dependencies on specific
Quick-compiler backends.

Change-Id: I27ee8ce7245da33a20c90e0086b8d4fd0a2baf4d
e7f82e2515f47f3c3292281312d7031a34a58ffc 06-Aug-2014 Fred Shih <ffred@google.com> Added support for patching classes from different dex files.

Added support for class patching from different dex files and moved
ScopedObjectAccess from the quick compiler to driver. Slight refactoring
for clarity.

Bug: 16656190
Change-Id: I107fcbce75db42ca61321ea1c5d5f236680a1b3d
de7b43626c49567cefb258669aac70a289b74b85 29-Jul-2014 Andreas Gampe <agampe@google.com> ART: Skip compiling redefined classes in apps

If for an app a class is defined in more than one dex file, skip
all classes after the first.

Bug: 16057120
Change-Id: Ifd71e6f462fd691ee23724a001190e9175988069
98d1cc8033251c93786e2fa8c59a2e555a9493be 16-May-2014 Mingyao Yang <mingyao@google.com> Improve performance of invokevirtual/invokeinterface with embedded imt/vtable

Add an embedded version of imt/vtable into class object. Both tables start at
fixed offset within class object so method/entry point can be loaded directly
from class object for invokeinterface/invokevirtual.

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

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

Change-Id: Idc4a30dd95dd18015137300d36bec55fc024cf62
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
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
bb0b53f58f11c628f077603b56077dfed1a18f11 23-May-2014 Calin Juravle <calin@google.com> Clean up the sampling profiler

- rename variables/fields names to match the code style (use
_underscore_names_)
- extract common property parsing in utils.cc
- fail to load profile file if any line is malformed
- added ProfileFile to manage the profile data generate in the previous
runs (replaces ProfileHelper and nests ProfileData)

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

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
0cd81352a7c06e381951cea1b104fd73516f4341 23-May-2014 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Fix an outstanding compaction bug in interpreter.""

Fixed the generic trampoline to not use ToJObject when unnecessary.

Bug: 15167269

This reverts commit 3bdb873122964da7937eb070cbcf2ef638a8e459.

Change-Id: I0525d0e0f3afb753c770e1572070a0fa22b02271
3bdb873122964da7937eb070cbcf2ef638a8e459 23-May-2014 Mathieu Chartier <mathieuc@google.com> Revert "Fix an outstanding compaction bug in interpreter."

This reverts commit e09ae0920be57760fb390b6944bce420fa0b5582.

Change-Id: I48036306130d5ccfec683d0dc3e9a642a02ee9c1
e09ae0920be57760fb390b6944bce420fa0b5582 15-May-2014 Mathieu Chartier <mathieuc@google.com> Fix an outstanding compaction bug in interpreter.

Fixed a bug in DoFieldPut where the FieldHelper GetType could cause
thread suspension which would result in a stale obj.

Added more handles in the class linker to facilitate moving fiels
and methods in the future.

Removed un-necessarly passing handle references since these are value
types and don't need to be passed by reference.

Added a special NullHandle type which allows null handles without a
handle scope.

Change-Id: I1b51723920a2e4f4f8b2907066f578a3e879fd5b
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
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
8668c3cbdcf9471bd97e0da68a240051f2973074 25-Apr-2014 Mathieu Chartier <mathieuc@google.com> Add finalizer references from the entrypoints.

We now have an invariant where we never allocate finalizable
objects with the Initialized or Resolved entrypoints. This speeds up
allocation by only doing the check in the slow path.

Before:
MemAllocTest: 3625, 3707, 3641
EvaluateAndApplyChanges: 3448, 3421, 3413

After:
MemAllocTest: 3164, 3109, 3135
EvaluateAndApplyChanges: 3272, 3299, 3353

Bug: 14078487

Change-Id: I2b0534af3e7c75ea5e5257cf3647744f7abfb74e
af13ad9fd18b6f75fe82e7995224c55654594f93 11-Apr-2014 Andreas Gampe <agampe@google.com> Centralize instruction-set pointer-size, alignment, 64b-width code
in instruction_set.h/cc

This allows to clean up some places that currently make explicit
comparisons.

Change-Id: I0dcc924c52fa53306f706aceea93a2d4a655c5df
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
9dae5b4b952824da45e9fd9c12cfcde9858f0974 07-Apr-2014 Calin Juravle <calin@google.com> Tweaked profile significant_difference.

- renamed to 'change_thr'
- now it represents how much the top K leading samples need to change
(in percents) in order to trigger compilation.
- extracted ProfileData & file parsing in profiler.h

Bug: 12877748
Change-Id: I10f66120dd5e68b8a690bfa0e9914c07f63c50d5
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
f6a4cee66a173ee7ef48af5503d9899aa93b3aeb 02-Apr-2014 Calin Juravle <calin@google.com> Profile: repurposed kTresholdPercent

Previously kTresholdPercent was the percentage of samples of the total
that a method must comprise before compiling.

I changed it to mean the threshold for a running total...i.e. compile
all the methods that comprise K% of the samples cumulatively.

(in the process fixed ProfileData#percent doc and changed its name)

Bug: 12877748
Change-Id: Ib0e18e525a16c11b189afc3d840c09183ac629de
dd7624d2b9e599d57762d12031b10b89defc9807 15-Mar-2014 Ian Rogers <irogers@google.com> Allow mixing of thread offsets between 32 and 64bit architectures.

Begin a more full implementation x86-64 REX prefixes.
Doesn't implement 64bit thread offset support for the JNI compiler.

Change-Id: If9af2f08a1833c21ddb4b4077f9b03add1a05147
9820b7c1dc70e75ad405b9e6e63578fa9fe94e94 02-Jan-2014 Vladimir Marko <vmarko@google.com> Early inlining of simple methods.

Inlining "special" methods: empty methods, methods returning
constants or their arguments, simple getters and setters.

Bug: 8164439
Change-Id: I8c7fa9c14351fbb2470000b378a22974daaef236
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
49161cef10a308aedada18e9aa742498d6e6c8c7 12-Mar-2014 Jeff Hao <jeffhao@google.com> Allow patching between dex files in the boot classpath.

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

The debugger needs this for selective deoptimization.

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

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

Change-Id: If01cd18e039071a74a1444570283c153429c9cd4
a03de6dbabbe857deae5b0f1e388fbd3a2420dc2 09-Mar-2014 Ian Rogers <irogers@google.com> Revert "Revert "Make clang the default compiler on host.""

This reverts commit d54f3a6219bca6ae018f4395fa0f1254bd4459be.

Change-Id: Id96bb52a0d599f8848010d1589bdf0f70fc7124b
d54f3a6219bca6ae018f4395fa0f1254bd4459be 08-Mar-2014 Ian Rogers <irogers@google.com> Revert "Make clang the default compiler on host."

This reverts commit 87f8b4cf0c1d6aab3eb5d1e99cc4e7cf175ef772.

Change-Id: I91a513042f0f9cf66288a296ad4a3b5da7830c7b
87f8b4cf0c1d6aab3eb5d1e99cc4e7cf175ef772 07-Mar-2014 Ian Rogers <irogers@google.com> Make clang the default compiler on host.

Motivation, GCC's compiler warnings are inferior to clang's. -Wthread-safety is
not supported by GCC starting with version 4.7. As this change only effects the
host, performance issues are an impact on host building and testing alone.
Fix clang gtest building on host with BUILD_HOST_64bit.
Fix clang build regressions caused by unused fields.
Fix x86-64 regression caused by requirement to fire-up quick compiler even in an
interpret-only environment. Long-term this code doesn't belong in the quick
compiler.

Change-Id: Ifc2b10177f40d0724cbbf8dab9653ac03cdd1cee
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
2da882315a61072664f7ce3c212307342e907207 27-Feb-2014 Andreas Gampe <agampe@google.com> Initial changes towards Generic JNI option

Some initial changes that lead to an UNIMPLEMENTED. Works
by not compiling for JNI right now and tracking native methods
which have neither quick nor portable code. Uses new trampoline.

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

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

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

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

This reverts commit 7f6cf56942c8469958b273ea968db253051c5b05.

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

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

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

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

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

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

g++ warnings turned into errors.

This reverts commit 68a5fefa90f03fdf5a238ac85c9439c6b03eae96.

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

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

Change-Id: Id5ef1b317ab997010d4e3888e456c26bef1ab9c0
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
55d0eac918321e0525f6e6491f36a80977e0d416 06-Feb-2014 Mark Mendell <mark.p.mendell@intel.com> Support Direct Method/Type access for X86

Thumb generates code to optimize calls to methods within core.oat.
Implement this for X86 as well, but take advantage of mov with 32 bit
immediate and call relative with 32 bit immediate.

Fix some incorrect return locations for long inlines.

Change-Id: I1907bdfc7574f3d0aa76c7fad13dc537acdf1ed3
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
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
2730db03beee4d6687ddfb5000c33c0370fbc6eb 27-Jan-2014 Vladimir Marko <vmarko@google.com> Add VerfiedMethod to DexCompilationUnit.

Avoid some mutex locking and map lookups.

Change-Id: I8e0486af77e38dcd065569572a6b985eb57f4f63
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
be1ca55db3362f5b100c4c65da5342fd299520bb 15-Jan-2014 Hiroshi Yamauchi <yamauchi@google.com> Use direct class pointers at allocation sites in the compiled code.

- Rather than looking up a class from its type ID (and checking if
it's resolved/initialized, resolving/initializing if not), use
direct class pointers, if possible (boot-code-to-boot-class pointers
and app-code-to-boot-class pointers.)
- This results in a 1-2% speedup in Ritz MemAllocTest on Nexus 4.
- Embedding the object size (along with class pointers) caused a 1-2%
slowdown in MemAllocTest and isn't implemented in this change.
- TODO: do the same for array allocations.
- TODO: when/if an application gets its own image, implement
app-code-to-app-class pointers.
- Fix a -XX:gc bug.
cf. https://android-review.googlesource.com/79460/
- Add /tmp/android-data/dalvik-cache to the list of locations to
remove oat files in clean-oat-host.
cf. https://android-review.googlesource.com/79550
- Add back a dropped UNLIKELY in FindMethodFromCode().
cf. https://android-review.googlesource.com/74205

Bug: 9986565
Change-Id: I590b96bd21f7a7472f88e36752e675547559a5b1
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
5ddb4104ac605d66693b55b79f26f8b8a5505e63 07-Jan-2014 Ian Rogers <irogers@google.com> Remove intialized static storage from dex cache.

The initialized static storage array is used by compiled code to determine if
for a sget/sput class initialization is necessary. The compiled code typically
doesn't require this test as the class is pre-initialized or the class being
accessed is the same as the current method.

Change-Id: Icbc45e692b3d0ac61e559e69edb6c9b29439e571
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
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
590fee9e8972f872301c2d16a575d579ee564bee 13-Sep-2013 Mathieu Chartier <mathieuc@google.com> Compacting collector.

The compacting collector is currently similar to semispace. It works by
copying objects back and forth between two bump pointer spaces. There
are types of objects which are "non-movable" due to current runtime
limitations. These are Classes, Methods, and Fields.

Bump pointer spaces are a new type of continuous alloc space which have
no lock in the allocation code path. When you allocate from these it uses
atomic operations to increase an index. Traversing the objects in the bump
pointer space relies on Object::SizeOf matching the allocated size exactly.

Runtime changes:
JNI::GetArrayElements returns copies objects if you attempt to get the
backing data of a movable array. For GetArrayElementsCritical, we return
direct backing storage for any types of arrays, but temporarily disable
the GC until the critical region is completed.

Added a new runtime call called VisitObjects, this is used in place of
the old pattern which was flushing the allocation stack and walking
the bitmaps.

Changed image writer to be compaction safe and use object monitor word
for forwarding addresses.

Added a bunch of added SIRTs to ClassLinker, MethodLinker, etc..

TODO: Enable switching allocators, compacting on background, etc..

Bug: 8981901

Change-Id: I3c886fd322a6eef2b99388d19a765042ec26ab99
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
dfb325e0ddd746cd8f7c2e3723b3a573eb7cc111 30-Oct-2013 Ian Rogers <irogers@google.com> Don't use UTF16 length as length for MUTF8.

Bug 11367555.

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

Change-Id: Idf7fe85e1293453a8ad862ff2380dcd5db4e3a39
83883d7fddf30fdb8b6903560fa1337ab991e74c 22-Oct-2013 Ian Rogers <irogers@google.com> Populate dex cache for sharpened calls.

We ensured the resolved method was in the dex cache, but for a sharpened call
this is abstract. Ensure that the concrete method is also resolved.
Limit the use of direct dex cache based dispatch to cases where we know how to
patch the dex cache.

Bug 11389002

Change-Id: I08252686a53b5948650632837c74bcd5cbf8a862
fc0e94bed3f88ed7e50854fd8dfaf5dcb345250f 24-Sep-2013 Ian Rogers <irogers@google.com> StringPiece clean up.

Profile guided clean up.
Try to avoid creating StringPieces with the contents of a dex file where
the length is known.
Try to avoid RegTypeCache::FromDescriptor when there's a class available.
Make ConstantType::ConstantValue inlinable.
Saving of about 50ms from a 2 threaded ThinkFree compile on host.

Change-Id: I47a12c3c76f46e2c9805be1c3a3e3870fe1f5d85
ee39a10e45a6a0880e8b829525c40d6055818560 19-Sep-2013 Ian Rogers <irogers@google.com> Use class def index from java.lang.Class.

Bug: 10244719
This removes the computation of the dex file index, when necessary this is
computed by searching the dex file. Its only necessary in
dalvik.system.DexFile.defineClassNative and DexFile::FindInClassPath, the
latter not showing up significantly in profiling with this change.

(cherry-picked from 8b2c0b9abc3f520495f4387ea040132ba85cae69)
Change-Id: I20c73a3b17d86286428ab0fd21bc13f51f36c85c
8b2c0b9abc3f520495f4387ea040132ba85cae69 19-Sep-2013 Ian Rogers <irogers@google.com> Use class def index from java.lang.Class.

Bug: 10244719
Depends on:
https://googleplex-android-review.git.corp.google.com/362363
This removes the computation of the dex file index, when necessary this is
computed by searching the dex file. Its only necessary in
dalvik.system.DexFile.defineClassNative and DexFile::FindInClassPath, the
latter not showing up significantly in profiling with this change.

Change-Id: I20c73a3b17d86286428ab0fd21bc13f51f36c85c
9b297bfc588c7d38efd12a6f38cd2710fc513ee3 06-Sep-2013 Ian Rogers <irogers@google.com> Refactor CompilerDriver::Compute..FieldInfo

Don't use non-const reference arguments.
Move ins before outs.

Change-Id: I7b251156388d8f07513b3da62ebfd29e5fd9ff76
65ec92cf13c9d11c83711443a02e4249163d47f1 06-Sep-2013 Ian Rogers <irogers@google.com> Refactor CompilerDriver::ComputeInvokeInfo

Don't use non-const reference arguments.
Move ins before outs.

Change-Id: I4a7b8099abe91ea60f93a56077f4989303fa4876
936bf024b26f84f9332d195a581912e95d9cbe4b 06-Sep-2013 Ian Rogers <irogers@google.com> Tweak dedupe hash function.

Change-Id: I6c3450e53a3654969aa7627cea1474835bfc52d7
1e54d68ce8e77dfe63340275d11a072c5184c89a 06-Sep-2013 Sebastien Hertz <shertz@google.com> Disable devirtualization detection in DEX-to-DEX compiler.

This CL allows the DEX-to-DEX compiler to disable devirtualization detection.
This allows to quicken invoke-virtual/range instructions that used to be
eligible for devirtualization.

Bug: 10632943
Change-Id: I6c9f4d3249cf42b47f004be5825b3186fa83501e
d133b97b1ccae88f6ee7040e288fd7a239ee4492 05-Sep-2013 Ian Rogers <irogers@google.com> Shard dedupe set locks.

We're seeing contention during compilation on the dedupe locks, sharding 4 ways
on an occam brings down contention by > 5x.
Improve dedupe hash function to have a FNV hash function at its heart.
Improve naming of dedupe locks.
Tidy portable JNI compiler paramters to be pointers, given that's their primary
use.

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

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

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

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

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

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

Bug: 10552630

Change-Id: Ia6d06a747b86b0bfc4473b3cd68f8ce1a1c7eb22
f6c4b3ba3825de1dbb3e747a68b809c6cc8eb4db 25-Aug-2013 Mathieu Chartier <mathieuc@google.com> New arena memory allocator.

Before we were creating arenas for each method. The issue with doing this
is that we needed to memset each memory allocation. This can be improved
if you start out with arenas that contain all zeroed memory and recycle
them for each method. When you give memory back to the arena pool you do
a single memset to zero out all of the memory that you used.

Always inlined the fast path of the allocation code.

Removed the "zero" parameter since the new arena allocator always returns
zeroed memory.

Host dex2oat time on target oat apks (2 samples each).
Before:
real 1m11.958s
user 4m34.020s
sys 1m28.570s

After:
real 1m9.690s
user 4m17.670s
sys 1m23.960s

Target device dex2oat samples (Mako, Thinkfree.apk):
Without new arena allocator:
0m26.47s real 0m54.60s user 0m25.85s system
0m25.91s real 0m54.39s user 0m26.69s system
0m26.61s real 0m53.77s user 0m27.35s system
0m26.33s real 0m54.90s user 0m25.30s system
0m26.34s real 0m53.94s user 0m27.23s system

With new arena allocator:
0m25.02s real 0m54.46s user 0m19.94s system
0m25.17s real 0m55.06s user 0m20.72s system
0m24.85s real 0m55.14s user 0m19.30s system
0m24.59s real 0m54.02s user 0m20.07s system
0m25.06s real 0m55.00s user 0m20.42s system

Correctness of Thinkfree.apk.oat verified by diffing both of the oat files.

Change-Id: I5ff7b85ffe86c57d3434294ca7a621a695bf57a9
8f3c9ae38df2460940a26dff889a84430b6c38d3 21-Aug-2013 Ian Rogers <irogers@google.com> Don't allow class status to go backward except for error.

Allow greater parallelism of initialization.
Bug 10393546.

Change-Id: Ic194ed490bb0a986250c09fcf335eb1be9714657
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
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
468532ea115657709bc32ee498e701a4c71762d4 05-Aug-2013 Ian Rogers <irogers@google.com> Entry point clean up.

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

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

Change-Id: I52a7c2bbb1b7e0ff8a3c3100b774212309d0828e
(cherry picked from commit 848871b4d8481229c32e0d048a9856e5a9a17ef9)
848871b4d8481229c32e0d048a9856e5a9a17ef9 05-Aug-2013 Ian Rogers <irogers@google.com> Entry point clean up.

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

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

Change-Id: I52a7c2bbb1b7e0ff8a3c3100b774212309d0828e
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
75021222d9c03a80fa5c136db0d5fb8d82d04031 16-Jul-2013 Sebastien Hertz <shertz@google.com> Adds a DEX-to-DEX compilation level.

This CL adds a DEX-to-DEX compilation level which allows the DEX-to-DEX
compiler to ensure correctness on classes with soft-failed verification.

Bug: 9307738
Change-Id: If051336bf81370bca55872c8c75ccd573d8ca391
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
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
fc0e3219edc9a5bf81b166e82fd5db2796eb6a0d 17-Jul-2013 Brian Carlstrom <bdc@google.com> Fix multiple inclusion guards to match new pathnames

Change-Id: Id7735be1d75bc315733b1773fba45c1deb8ace43
56d947fbc9bc2992e2f93112fafb73e50d2aaa7a 15-Jul-2013 Brian Carlstrom <bdc@google.com> Add verification of boot.oat generated on device

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