History log of /art/runtime/class_linker.h
Revision Date Author Comments
d527438aea93e17572e7da9c6e90b4ae3686cac1 04-May-2018 David Brazdil <dbrazdil@google.com> Refactor ClassLinker & ImageWriter to use a common resolution routine

ImageWriter prepopulates DexCaches of an app image, but does resolution
directly on mirror::Class rather than going through the class linker
where hidden API checks happen. This patch removes the duplicate code.

Similarly, ClassLinker contains multiple methods for resolving methods
and fields. Consolidate these into three common routines:
- FindResolvedMethod
- FindResolvedField
- FindResolvedFieldJLS

The CL also passes the correct class loader to
ImageWriter::PruneAndPreloadDexCache because it would trip a DCHECK
in class linker.

Bug: 78548674
Test: art/test.py
Merged-In: I12e383290945d2f44b209c32e8a7617533d86063
Change-Id: I12e383290945d2f44b209c32e8a7617533d86063
(cherry picked from commit 1ab0fa89aed1100a3e6b631cb188db1d759b1efc)
54a99cfcf3d3463404fdf4152523dcc69b8648d7 05-Apr-2018 David Brazdil <dbrazdil@google.com> Fix verifier/linker IncompatibleClassChangeError with hidden API

The verifier and class linker will attempt to find a method with
the wrong type if it could not be found with the original type,
i.e an interface method on a regular class and vice versa.

This logic did not previously take hidden API restrictions into
account and would result in bogus error messages to the user or
debug crashes.

Bug: 64382372
Bug: 77464273
Test: art/test.py -r -t 674-hiddenapi
Change-Id: If8327a70dd73b90249da3d9e505f0c6f89838f8e
743aac3fbad3bbafeb5ad98e157726f740feb725 23-Mar-2018 Mathieu Chartier <mathieuc@google.com> Disable encoded static initialization

Encoded static initialization currently requires fixing up intered
strings. This fix up process causes app startup to be ~10ms longer.
Disable the initialization and fixup process until there is a faster
way to fix up the interned strings.

Bug: 70734839
Test: test-art-host

(cherry picked from commit 0933cc54c52054ab384d9a426448cd2004aa8968)

Merged-In: I847d0bd9a362243241c93b115081a67faab7bfc1
Change-Id: I11ffbba8538656b84fd5df5ab970633d90d86530
ab2ce84d4995f05c38c5ebfefc6683b244a36260 01-Feb-2018 Alexey Grebenkin <a.grebenkin@samsung.com> Fix dangling SingleImplementations left after class unloading

Test: make test-art-host, manual using sample code

bug: 73143991

(cherry picked from commit be4c2bd892bd167a50b4dfa7133e70a809197698)

Change-Id: I5f4d726334a9ea306d93b967966c58111fd34fd1
999646d7f3b2ced25a995c020d19a55caf3c18d5 16-Feb-2018 David Sehr <sehr@google.com> Dex header cleanup and windows simplification

Remove a few unnecessary inclusions, move one missed header to
libdexfile. Also use android-base utilities for file loading in
dexdump2 and dexlist. (The utilities seem to work on Windows, where
mmap did not.)

Bug: 22322814
Test: make -j 50 test-art-host-gtest
Change-Id: I6e6de1895921f664a2280451b01e367649436200
ea179f477465789605e0c8f57a3ec660c3d852e8 08-Feb-2018 Nicolas Geoffray <ngeoffray@google.com> Refactor method resolution in class linker.

Rewrite all runtime callers of DexCache::SetResolvedMethod
to call a shared method that will do the dex cache update.

bug: 64759619
Test: test-art-host
Test: device boots, runs

Change-Id: Icc1aca121030e2864de09667bdbc793b502e3802
da1cdd0b1f89ef76def1c5fa8d2bea83c1a6cf48 31-Jan-2018 Orion Hodson <oth@google.com> ART: Fix call site resolution

Parameter type resolution should use the target method's DEX file.

Bug: 70166093
Test: art/test/run-test --host 714
Change-Id: Ic4961a905144ee85b36d02476506c4078c6cdf7a
bf50ed639afbec73fc0d38d67026a6fe801c04eb 16-Jan-2018 Alex Light <allight@google.com> Revert^3 "Ensure that methods requiring interpreter entrypoint always have it."

This reverts commit 4b3dec38319a8d4af51e401ca13987cf0c2dd98d.

Reason for revert: Failing on debuggable-gcstress

Bug: 62821960
Change-Id: Id143ffa2d9c379566328a03f3cbce1713ae31e51
Test: None
(cherry picked from commit fc49fecbc59330cccf2c17dd2b011153c0f6bda1)
fc49fecbc59330cccf2c17dd2b011153c0f6bda1 16-Jan-2018 Alex Light <allight@google.com> Revert^3 "Ensure that methods requiring interpreter entrypoint always have it."

This reverts commit 4b3dec38319a8d4af51e401ca13987cf0c2dd98d.

Reason for revert: Failing on debuggable-gcstress

Bug: 62821960
Change-Id: Id143ffa2d9c379566328a03f3cbce1713ae31e51
Test: None
4b3dec38319a8d4af51e401ca13987cf0c2dd98d 14-Jan-2018 Alex Light <allight@google.com> Revert^2 "Ensure that methods requiring interpreter entrypoint always have it."

The code in test 067-preemptive-unpark is able to cause a method to
have a null entrypoint. This is a valid (though rare) state. The check
we had did not account for it and failed. Made the DCHECK explicitly
allow for null entrypoints.

This makes the check consistent with the code around lines 363 and 398
lower in the function.

This reverts commit c971f6e06a43e70a2d86cb4b3ad0e13a9ae9a06c.

Reason for revert: fixed issue causing test 067 and others to fail.

Test: ./test.py --host -j50
Test: ./test/testrunner/testrunner.py -j50 -t 067-preemptive-unpark

Bug: 62821960

Change-Id: I537e05fd52fa4c8859d4102ac9475cacd75d7437
c971f6e06a43e70a2d86cb4b3ad0e13a9ae9a06c 14-Jan-2018 Mathieu Chartier <mathieuc@google.com> Revert "Ensure that methods requiring interpreter entrypoint always have it."

This reverts commit 94730ef9ca432b5ede81e928cffc4006911aa650.

Debug tests failing.
Ran: test/run-test --always-clean --prebuild --compact-dex-level none --optimizing --no-relocate --runtime-option -Xcheck:jni --64 --build-with-javac-dx 067-preemptive-unpark

Bug: 62821960

Change-Id: Ia4fb7b7b3a60879662dea50ce32b1cfb5e0a3eff
94730ef9ca432b5ede81e928cffc4006911aa650 11-Jan-2018 Alex Light <allight@google.com> Ensure that methods requiring interpreter entrypoint always have it.

There were some situations where a method that requires an interpreter
entrypoint could end up having an oat-entrypoint. This could cause issues
with debugging and single stepping inside of the code.

Test: ./test.py --host -j50
Bug: 62821960
Change-Id: I5da04dfe18898ea8dc2b92d12a9782ef5f028e54
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
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
890111968fbd3f5ae528d97e42984c12a3dd27bd 11-Dec-2017 Vladimir Marko <vmarko@google.com> Do not pass DexFile to ClassLinker::Lookup/ResolveMethod().

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: I2e47280e7cb8b84595130c4abfb5ece18d7f5c75
a64b52deb0c792b8a0d47546edb8a2f8a7816c33 08-Dec-2017 Vladimir Marko <vmarko@google.com> Do not pass DexFile to ClassLinker::Lookup/ResolveString().

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: I8c4cec43b31b27de7e4e94374fdd69c6d6ca6c13
af94020190a2153834e30fc962e28c3b63d7ffc2 08-Dec-2017 Vladimir Marko <vmarko@google.com> Do not pass DexFile to ClassLinker::ResolveMethodType().

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: I00634b89013b7348460aa73561fa14be7c8cdb7e
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
2ffb703bf431d74326c88266b4ddaf225eb3c6ad 08-Nov-2017 Igor Murashkin <iam@google.com> cpplint: Cleanup errors

Cleanup errors from upstream cpplint in preparation
for moving art's cpplint fork to upstream tip-of-tree cpplint.

Test: cd art && mm
Bug: 68951293
Change-Id: I15faed4594cbcb8399850f8bdee39d42c0c5b956
005ac512de3d734624a5db39bb14b71763ba730d 24-Oct-2017 Orion Hodson <oth@google.com> ART: Add mirror classes for VarHandles

Adds mirror classes for VarHandle, FieldVarHandle,
ArrayElementVarHandle, ByteArrayViewVarHandle and
ByteBufferViewVarHandle.

Bug: 65872996
Test: art/test.py --host -g -j32
Change-Id: I34e4b53c21cd969b54003dcfa3527acb963bfec7
e7732be2390f00b1f98b8c0066a37892ee1126f6 11-Oct-2017 Orion Hodson <oth@google.com> ART: Implement missing mterp handlers

Adds mterp handlers for const-method-{handle,type}, invoke-custom, and
invoke-polymorphic.

Minor refactoring starting from interpreter_common.{h,cc} for consistency.

Test: m test-art-host
Bug: 65872996
Change-Id: I95cda758d1ce2fb52e3b1c6211e5d1763cee7bd6
2e59994c3c586d8b753e4b14a94c81bce3dba1a9 22-Sep-2017 Orion Hodson <oth@google.com> ART: support for const-method-{handle,type}

Adds support for const-method-handle and const-method-type bytecodes.

Bug: 66562269
Test: art/test/run-test --host 979
Test: art/test/dexdump/run-all-tests
Change-Id: I812eaf0f2439d6126b4287483fe2348366cacf90
7452797678c4345d4a9e65b03e00af703c2c5fe0 29-Nov-2016 Vladimir Marko <vmarko@google.com> Refactor linker files from compiler/ to dex2oat/.

This shifts some code from the libart-compiler.so to dex2oat
and reduces memory needed for JIT. We also avoid loading the
libart-dexlayout.so for JIT but the memory savings are
minimal (one shared clean page, two shared dirty pages and
some per-app kernel mmap data) as the code has never been
needed in memory by JIT.

aosp_angler-userdebug file sizes (stripped):
lib64/libart-compiler.so: 2989112 -> 2671888 (-310KiB)
lib/libart-compiler.so: 2160816 -> 1939276 (-216KiB)
bin/dex2oat: 141868 -> 368808 (+222KiB)
LOAD/executable elf mapping sizes:
lib64/libart-compiler.so: 2866308 -> 2555500 (-304KiB)
lib/libart-compiler.so: 2050960 -> 1834836 (-211KiB)
bin/dex2oat: 129316 -> 345916 (+212KiB)

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: cd art/; mma; cd -
Change-Id: If62f02847a6cbb208eaf7e1f3e91af4663fa4a5f
a70def25b8903ef2afb83022f50e5b86bd997fb6 25-Aug-2017 David Sehr <sehr@google.com> Show ArtMethods in imgdiag

Since ArtMethods were moved out of mirror:: classes imgdiag does not
show information about them. Diff ArtMethods to facilitate finding
dirty memory there.

Bug: 38173645
Test: imgdiag --boot-image=/system/framework/boot.art --image-diff-pid=`pid system_server`
Change-Id: Icd86a9ef14d5177a297026c22c81c080f5c85fc1
(cherry picked from commit a49e053faa4a254df1f21e055cb73555de241cfc)
a49e053faa4a254df1f21e055cb73555de241cfc 25-Aug-2017 David Sehr <sehr@google.com> Show ArtMethods in imgdiag

Since ArtMethods were moved out of mirror:: classes imgdiag does not
show information about them. Diff ArtMethods to facilitate finding
dirty memory there.

Bug: 38173645
Test: imgdiag --boot-image=/system/framework/boot.art --image-diff-pid=`pid system_server`
Change-Id: Icd86a9ef14d5177a297026c22c81c080f5c85fc1
94ec2db21332ee1dcdbbf254b99a9a999a304fe0 06-Sep-2017 Vladimir Marko <vmarko@google.com> Use mmapped boot image class table for PIC app HLoadClass.

Implement new HLoadClass load kind for boot image classes
referenced by PIC-compiled apps (i.e. prebuilts) that uses
PC-relative load from a boot image ClassTable mmapped into
the apps .bss. This reduces the size of the PIC prebuilts
that reference boot image classes compared to the kBssEntry
as we can completely avoid the slow path and stack map
unless we need to do the class initialization check.

Prebuilt services.odex for aosp_angler-userdebug (arm64):
- before: 20312800
- after: 19775352 (-525KiB)

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: testrunner.py --host --pictest
Test: testrunner.py --target on Nexus 6P.
Test: testrunner.py --target --pictest on Nexus 6P.
Test: Nexus 6P boots.
Bug: 31951624
Change-Id: I13adb19a1fa7d095a72a41f09daa6101876e77a8
6cfbdbc359ec5414d3e49f70d28f8c0e65b98d63 25-Jul-2017 Vladimir Marko <vmarko@google.com> Use mmapped boot image intern table for PIC app HLoadString.

Implement new HLoadString load kind for boot image strings
referenced by PIC-compiled apps (i.e. prebuilts) that uses
PC-relative load from a boot image InternTable mmapped into
the apps .bss. This reduces the size of the PIC prebuilts
that reference boot image strings compared to the kBssEntry
as we can completely avoid the slow path and stack map.

We separate the InternedStrings and ClassTable sections of
the boot image (.art) file from the rest, aligning the
start of the InternedStrings section to a page boundary.
This may actually increase the size of the boot image file
by a page but it also allows mprotecting() these tables as
read-only. The ClassTable section is included in
anticipation of a similar load kind for HLoadClass.

Prebuilt services.odex for aosp_angler-userdebug (arm64):
- before: 20862776
- after: 20308512 (-541KiB)
Note that 92KiB savings could have been achieved by simply
avoiding the read barrier, similar to the HLoadClass flag
IsInBootImage(). Such flag is now unnecessary.

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: testrunner.py --host --pictest
Test: testrunner.py --target on Nexus 6P.
Test: testrunner.py --target --pictest on Nexus 6P.
Test: Nexus 6P boots.
Bug: 31951624
Change-Id: I5f2bf1fc0bb36a8483244317cfdfa69e192ef6c5
d1ee20fed62cd8db8fd496c4e5760dc554136020 17-Aug-2017 Vladimir Marko <vmarko@google.com> Revert^4 "ART: Use proxy ArtMethod's data_ to store the interface method."

Fix a DCHECK() failure while visiting references for non-CC
moving GC by avoiding the DCHECK(); reference equality may
give false negatives at that stage as we may compare the new
reference against an old one for the same object.

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: testrunner.py --host --jit
Test: testrunner.py --host --gcstress
Test: ART_DEFAULT_GC_TYPE=SS ART_USE_READ_BARRIER=false \
testrunner.py --host --gcstress -t 048-reflect-v8

This reverts commit 76ccd09c3d98317dfbd179c6f5c231dcfc5d6996.

Change-Id: I13cc339d5b31fceedf39ea9a77f27369ba72279f
76ccd09c3d98317dfbd179c6f5c231dcfc5d6996 15-Aug-2017 Nicolas Geoffray <ngeoffray@google.com> Revert^3 "ART: Use proxy ArtMethod's data_ to store the interface method.""

Still failling:

+dalvikvm64 F 08-15 18:54:16 218912 218912 art_method-inl.h:395] Check failed: !GetDeclaringClass()->IsResolved() || interface_method->GetDeclaringClass()->IsAssignableFrom(GetDeclaringClass())


This reverts commit c42fab35f18539957debb8703195eeb76c9718f7.

Change-Id: I91b51f8c1e7f6e0ae876b751d8e9cd3b8acb62f6
c42fab35f18539957debb8703195eeb76c9718f7 15-Aug-2017 Vladimir Marko <vmarko@google.com> Revert^2 "ART: Use proxy ArtMethod's data_ to store the interface method."

Fix a DCHECK() to ignore unresolved proxy classes.

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: testrunner.py --host --jit
Test: testrunner.py --host --gcstress

This reverts commit 7ef52f75dd6e981e1e8c7567f593c197e8a94dcc.

Change-Id: Idccdb04958a8bdb1c58b529dfb92885993ac62ea
7ef52f75dd6e981e1e8c7567f593c197e8a94dcc 14-Aug-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "ART: Use proxy ArtMethod's data_ to store the interface method."

Broke a few tests with:
+dalvikvm64 F 08-14 18:36:32 136697 136697 art_method-inl.h:392] Check failed: interface_method->GetDeclaringClass()->IsAssignableFrom(GetDeclaringClass())


This reverts commit 0888cf1821d6622fd623db31000be19b9365f81c.

Change-Id: Idc93b6686392f9dfeca3bc11bd22104948fd9fd3
0888cf1821d6622fd623db31000be19b9365f81c 28-Jul-2017 Vladimir Marko <vmarko@google.com> ART: Use proxy ArtMethod's data_ to store the interface method.

This immensely simplifies the interface method retrieval
and removes one dependency on dex_cache_resolved_methods_.
We may later consider removing that member if we deem the
memory savings worth the performance impact.

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: testrunner.py --host --jit
Change-Id: Id76349c69e4c4dea4e3b297bd504db8f98f1b7cc
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
abadf024efdc632f663d7fb503cd277b3f65fca2 03-Aug-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "Support clinit for app image during compilation"

Breaks on bots.

This reverts commit 50ce4414a6154ee2d9eeaa27237d80b685e5acf1.

Change-Id: I39d856dc76b55788b6775ff2269eb8570742c6ff
50ce4414a6154ee2d9eeaa27237d80b685e5acf1 21-Jul-2017 Chang Xing <chxing@google.com> Support clinit for app image during compilation

Enabled compiler driver to start initialization process for classes with
static class initializers if debuggable flag is not setted because this
might change the behaviour of interpreter (although invisible to user),
e.g. the memory heap at startup will contains initialization results.

Updated two testcases to reflect the change of heap memory before
classes are initialized.

Enabled testcase 660-clinit to test whether class initializers are
executed.

This CL have to be submitted after /c/432328, /c/432154, /c/433242 and
/c/433342 because without that four this will break the build. Besides,
the other four CL will be tested in this CL.

Test: make test-art-host -j64
Change-Id: Ia25b9e18bdcd0fa3619be0058d459651f3b9a492
ec9ce6b788dc3b54905af45277fca03e8e428f24 06-Jul-2017 Vladimir Marko <vmarko@google.com> Hash-based DexCache methods array.

Total boot*.art size for aosp_angler-userdebug:
- arm64:
- before: 11603968
- after: 10129408 (-1.4MiB, -12.7%)
- arm:
- before: 8626176
- after: 7888896 (-0.7MiB, -8.5%)

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: Nexus 6P boots.
Test: testrunner.py --target
Test: Build aosp_mips64-eng
Bug: 30627598

(cherry picked from commit 07bfbace6f835e6c748fd68ec7624992478b16c1)

Change-Id: I8e2b235038ffbe32112cc59c45a7cee5a08838c3
e5071cc58a3cdea4a88257be3c8fd4d012a64c74 12-Jun-2017 Vladimir Marko <vmarko@google.com> ART: Change method lookup to be more consistent to JLS and the RI.

The method lookup for different invoke types was previously
widely different and didn't work well with the dex cache
method array where we have only a single slot for each
MethodId. The new behavior is to perform the same lookup for
all cases, distinguishing only between interface and
non-interface referencing class, and to further align the
behavior with the JLS and the RI. Where the JLS conflicts
with the RI, we follow the JLS semantics.

The new lookup for class methods first searches the methods
declared in the superclass chain (ignoring "copied" methods)
and only then looks in the "copied" methods. If the search
in the superclass chain finds a method that has not been
inherited (i.e. either a private method or a package-access
method where one of the classes in the chain does not belong
to the same package, see JLS 8.4.8), we still search the
"copied" methods as there may actually be a method inherited
from an interface. This follows the JLS semantics where
inherited methods are included in the search (JLS 15.12.2.1)
but conflicts with the RI where the private or
package-access method takes precedence over methods
inherited from interfaces.

Note that this search can find an accessible method that is
not inherited by the qualifying type, either for a package
access method when the referrer is in the same package but
the qualifying type is in another package, or for a private
method where the referrer is in the same class but the
qualifying type is actually a subclass. For the moment we
allow such calls and we shall consider whether to throw
an IncompatibleClassChangeError in this situation in future
to comply with JLS 15.12.4.3.

The new lookup for interface methods searches the interface
class, then all the superinterfaces and then the
java.lang.Object class, see implicitly declared methods in
interfaces, JLS 9.2. The search for the maximally-specific
non-abstract superinterface method is not yet implemented,
but the difference should be difficult to observe as the
usual subsequent call to FindVirtualMethodForInterface()
should yield the same result for any matching method.

The new test 162-method-idx-clash exposes several cases
where we previously completely messed up due to the effects
of the DexCache, or where we were out of line with the RI.
It also tests a case where the JLS and the RI disagree and
we follow the JLS.

Test: art/test/run-test --host --jvm 162-method-resolution
Test: m test-art-host-gtest
Test: testrunner.py --host
Test: testrunner.py --host --interp-ac
Test: Nexus 6P boots.
Test: testrunner.py --target
Bug: 62855082
Bug: 30627598

(cherry picked from commit ba118827465d12177f3996e50133960087b1c916)

Change-Id: Ic73e4adf02b5cd66b5a22a3b619dc781357db14c
55e6b552af6aa34439cb0699db5ddf08c437719b 25-Jul-2017 Andreas Gampe <agampe@google.com> ART: Move CHA to ClassLinker

Move the ClassHierarchyAnalysis singleton to ClassLinker. Hierarchy
analysis is a link-time effort and belongs to class-loading instead
of the global Runtime object.

Also clean up to use a unique_ptr, and add null checks to allow
bypassing the analysis.

(cherry-picked from commit c1ac9ee48ddf483ec770b424d63de4982262ea33)

Bug: 34193647
Bug: 63467744
Test: m test-art-host
Change-Id: I14ef536e37eb19c0dede372ffd68a826c482cf71
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
c88e2ae198ad52d91109d04a18dbffd3b46c051a 21-Jul-2017 Chang Xing <chxing@google.com> Add AotClassLinker

Add AotClassLinker, this will enable the compiler driver to intercept
class verification to avoid reverifying classes for ag/2614411. This
is required since we can't reverify classes that have quickened
bytecodes.

Test: make test-art-host -j64

Bug: 63467744

Merged-In: If53d3ee3231c337a9ea917f5b885c173917765de

Change-Id: I3fb0264e99c7b327e2eb1bfbd714d2c1bacc1299
fbfc3945c1877cfb97ebd217ccceb98abc4bc441 27-Jul-2017 Vladimir Marko <vmarko@google.com> Remove ClassLinker::SetEntryPointsToCompiledCode().

This function was used only for tests and it was essentially
just calling ArtMethod::SetEntryPointFromQuickCompiledCode()
in a very obscure way and required the memory before the
code pointer to contain a non-zero code size.

This is a follow-up to
https://android-review.googlesource.com/445648
that removed a problematic use of the function, calling it
with a pointer to an entrypoint instead of a pointer to
compiled managed code, i.e. without the pre-header that
should contain the non-zero code size.

Test: m test-art-host-gtest
Change-Id: I483450832443ea0589eb41c74491384bcd5d6ab8
605fe24d07062a038c8332a4d98f47052e9cee6a 21-Jul-2017 Chang Xing <chxing@google.com> Implemented Nested Transaction

Transaction can be created recursively and every transaction knows which
class it is created for.

The goal of implementing nested transaction is to let every class
initialization (especially execution of class initializer) associates
with one transaction which provides the ability to track whether field
accesses are valid. To achieve this goal, we implemented a subclass for
ClassLinker called AotClassLinker, which will be instantiated instead of
ClassLinker under AOT compiler.

All invocations of InitializeClass happens at AOT compiler will be
wrapped with creating and destorying transactions.

Transactions will be paused when rollbacking, otherwise the memory will
not be rollbacked properly.

The use the transaction is changed and all usage are updated,
corresponding with native tests mentioning transaction, including
transaction_test and unstarted_runtime_test.

The validation rules will be implemented and explained in another CL.

Test: make test-art-host -j64

Change-Id: If53d3ee3231c337a9ea917f5b885c173917765de
be7af227c41c524fd38fc695c78f575d14db0e91 25-Jul-2017 Andreas Gampe <agampe@google.com> ART: Move app image verification to its own method

Move the app image verification to its own method to allow easier
extension without bloating app image loading code. Refactor the
visitors into local scope.

Bug: 34193647
Test: m test-art-host
Change-Id: Id1f471a5020f4f70017eaac4ac20e4c40607e349
c1ac9ee48ddf483ec770b424d63de4982262ea33 25-Jul-2017 Andreas Gampe <agampe@google.com> ART: Move CHA to ClassLinker

Move the ClassHierarchyAnalysis singleton to ClassLinker. Hierarchy
analysis is a link-time effort and belongs to class-loading instead
of the global Runtime object.

Also clean up to use a unique_ptr, and add null checks to allow
bypassing the analysis.

Bug: 34193647
Test: m test-art-host
Change-Id: I14ef536e37eb19c0dede372ffd68a826c482cf71
0c101a0a70438fea02c710a40cc06f083caf7d68 22-Jul-2017 Mathieu Chartier <mathieuc@google.com> Move logic to get profile class descriptors to profile info

Move and simplify logic used to get a descriptor set for app image
creation. Code is covered by TestLayoutAppImage in dex2oat_test.

Motivation:
If we are class unloading in dex2oat, we won't have all the dex files
registered at once.

Bug: 63467744
Test: test-art-host

(cherry picked from commit 4f342b01a9d6661261a233d2221ae4a3c4e6ac4b)

Change-Id: I8bcd268d9fc880d8218b2976f7e35432ae8a18e7
4f342b01a9d6661261a233d2221ae4a3c4e6ac4b 22-Jul-2017 Mathieu Chartier <mathieuc@google.com> Move logic to get profile class descriptors to profile info

Move and simplify logic used to get a descriptor set for app image
creation. Code is covered by TestLayoutAppImage in dex2oat_test.

Motivation:
If we are class unloading in dex2oat, we won't have all the dex files
registered at once.

Bug: 63467744
Test: test-art-host
Change-Id: I1e3616ee0a731061c347677713dba07e603eaa08
07bfbace6f835e6c748fd68ec7624992478b16c1 06-Jul-2017 Vladimir Marko <vmarko@google.com> Hash-based DexCache methods array.

Total boot*.art size for aosp_angler-userdebug:
- arm64:
- before: 11603968
- after: 10129408 (-1.4MiB, -12.7%)
- arm:
- before: 8626176
- after: 7888896 (-0.7MiB, -8.5%)

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: Nexus 6P boots.
Test: testrunner.py --target
Test: Build aosp_mips64-eng
Bug: 30627598
Change-Id: I7f858605de5f074cbd7f0d9c4c072fbd44aee28f
ba118827465d12177f3996e50133960087b1c916 12-Jun-2017 Vladimir Marko <vmarko@google.com> ART: Change method lookup to be more consistent to JLS and the RI.

The method lookup for different invoke types was previously
widely different and didn't work well with the dex cache
method array where we have only a single slot for each
MethodId. The new behavior is to perform the same lookup for
all cases, distinguishing only between interface and
non-interface referencing class, and to further align the
behavior with the JLS and the RI. Where the JLS conflicts
with the RI, we follow the JLS semantics.

The new lookup for class methods first searches the methods
declared in the superclass chain (ignoring "copied" methods)
and only then looks in the "copied" methods. If the search
in the superclass chain finds a method that has not been
inherited (i.e. either a private method or a package-access
method where one of the classes in the chain does not belong
to the same package, see JLS 8.4.8), we still search the
"copied" methods as there may actually be a method inherited
from an interface. This follows the JLS semantics where
inherited methods are included in the search (JLS 15.12.2.1)
but conflicts with the RI where the private or
package-access method takes precedence over methods
inherited from interfaces.

Note that this search can find an accessible method that is
not inherited by the qualifying type, either for a package
access method when the referrer is in the same package but
the qualifying type is in another package, or for a private
method where the referrer is in the same class but the
qualifying type is actually a subclass. For the moment we
allow such calls and we shall consider whether to throw
an IncompatibleClassChangeError in this situation in future
to comply with JLS 15.12.4.3.

The new lookup for interface methods searches the interface
class, then all the superinterfaces and then the
java.lang.Object class, see implicitly declared methods in
interfaces, JLS 9.2. The search for the maximally-specific
non-abstract superinterface method is not yet implemented,
but the difference should be difficult to observe as the
usual subsequent call to FindVirtualMethodForInterface()
should yield the same result for any matching method.

The new test 162-method-idx-clash exposes several cases
where we previously completely messed up due to the effects
of the DexCache, or where we were out of line with the RI.
It also tests a case where the JLS and the RI disagree and
we follow the JLS.

Test: art/test/run-test --host --jvm 162-method-resolution
Test: m test-art-host-gtest
Test: testrunner.py --host
Test: testrunner.py --host --interp-ac
Test: Nexus 6P boots.
Test: testrunner.py --target
Bug: 62855082
Bug: 30627598
Change-Id: If450c8cff2751369011d649c25d28a482a2c61a3
0cb172874481f736c6b7c491dd621166cc25561b 12-Jul-2017 Jeff Hao <jeffhao@google.com> Do superclass validation at compile time and log with new class status.

Tries to perform superclass validation for classes that are resolved,
but not initialized at runtime. If successful, saves the result in the
oat file with a new class status. At runtime, the superclass validation
can be skipped during class initialization, saving some time and
reducing string accesses.

Results show savings of 50kB PSS in maps on startup, with slight
decrease in startup time.

Maps (average of 100 runs)
Before: dex 9941.3 odex 15159.8 total 25101.1 launch 908
After: dex 9897.4 odex 15155.7 total 25053.1 launch 906.6

Bug: 63456114
Test: mm test-art-host
Change-Id: If67a4a49d61781b6d561c26118d7e0c6b9cc0d6f
f8db2c3945e746fcbf307832ac2f7826d5ec178a 07-Jul-2017 Orion Hodson <oth@google.com> ART: Add support for constructor method handles

Add well known methods for MethodHandles.lookup() and
MethodHandles.Lookup.findConstructor(). These are used to call the
Java code that create a constructor transform.

Separate method handle resolution paths for fields and methods in the
class linker.

Update test 952-invoke-custom-kinds to include a constructor method
handle. The test classes now match dx/tests/135-invoke-custom.

Bug: 62774190
Test: Update 952-invoke-custom-kinds
Change-Id: I9a007254a856422c24397c4df3ef3dfbf6bdd840
06bed3009b94b392ce6be43d72f4b10803565c72 13-Jul-2017 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Record post startup methods in profile""

Test: test/run-test 595-profile-saving

This reverts commit a867f7ab437dd6c1458088964986d0fe7275625c.

Change-Id: I2826bdddda446925856991de4b0b786c8c05831e
a867f7ab437dd6c1458088964986d0fe7275625c 13-Jul-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "Record post startup methods in profile"

Breaks target tests.

This reverts commit 5594f11fa8a8a1efc24d1b258592f68cf462eec8.

Change-Id: I5ff4aab14bb241e287f042a9a90458e61306985e
5594f11fa8a8a1efc24d1b258592f68cf462eec8 08-Jun-2017 Mathieu Chartier <mathieuc@google.com> Record post startup methods in profile

Record post startup methods in the profile by visiting the methods
for all the loaded classes. This data will be used for layout
optimizations and generating the boot image profile.

The maps profile size doesn't seem to get larger after doing a basic
post launch use case. The change in profile size is hard to reliably
measure.

Verified by dumping a profile with profman and confirming that
there are post startup methods in the profile.

Added test to 595-profile-saving.

Did a test for maps to see how long we hold the class table lock. The
results are 4ms in the longest case. This should be short enough to
not cause jank if run every 20s or so.

Test: test-art-host
Bug: 36457259
Change-Id: I82e36957fcdc8d9e072c0193478bd1ef0ce09a67
7865ac7e233b8a8dcfd6ca8466d30b39a8089c3e 28-Jun-2017 Calin Juravle <calin@google.com> Add DelegateLastClassLoader to the list of WellKnownClassLoaders

Generalize CreatePathClassLoader from the class linker to be able to
create a well known class loader with a given parent.

For now, it only supports PathClassLoader and DelegateLastClassLoader.

Test: m test-art-host
Bug: 38138251
Change-Id: Iced0de7c21010c6d61dbf29a631e670011833a7d
415dc3d63fc05f89b77c2f6249a5a89dade4df27 28-Jun-2017 Calin Juravle <calin@google.com> Refactor FindClass code in class linker

Extract the code searching the current class loader classpath in a new
method (FindClassInClassLoaderClassPath). This will make things easier
when adding support for DelegateLastClassLoader.

Test: m test-art-host
Bug: 38138251
Change-Id: I742cd614f12e8a7b6ccd0a23a99d1f6653afaf73
2ff3b97500b717f69415ae474d5cfb1613cd15ee 06-Jun-2017 Andreas Gampe <agampe@google.com> ART: More header cleanups

Clean up some more includes. Move some -inls from object-inl to
object-refvisitor-inl. Fix up transitives.

Test: m test-art-host
Change-Id: I0e3e268d95a1c71b0a80fc963d13d191a97b2283
07f0621463e7b480c86ddba3e72d3fb9f0ae820f 01-Jun-2017 Alex Light <allight@google.com> Fix redefinition related use-after-free bug

A redefinition that failed with JVMTI_ERROR_FAILS_VERIFICATION could
cause a use-after-free of java DexCache objects if a art::DexFile* that
aliases the one created for the failed redefinition is created.

Bug: 62237378
Test: ./test.py --host -j40

Change-Id: Ia080dfa6c702b2e3a735c4c3cd80ca3974386934
2af99028f508071d5cd056e4ea42e988e0b83e79 25-Apr-2017 Andreas Gampe <agampe@google.com> ART: More header cleanup - class_linker.h

Hide the ClassTable. Users of ClassLinker don't care about it.

Test: mmma art
Change-Id: I282b25a3d1844cc6c7f716159fc58fca9b65135e
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
76c1965179bdf34ed9d0dded046c7ad6f277de3f 24-Apr-2017 Andreas Gampe <agampe@google.com> ART: More header cleanup - method_verifier.h

Move enumerations to own header. Move the compiler interface (of what
the compiler can tolerate) into its own header. Replace or remove
method_verifier.h where possible.

Test: mmma art
Change-Id: I075fcb10b02b6c1c760daad31cb18eaa42067b6d
(cherry picked from commit 6d7abbd2324f544c6b6da42bb6b9b531df0ce3cd)
6d7abbd2324f544c6b6da42bb6b9b531df0ce3cd 24-Apr-2017 Andreas Gampe <agampe@google.com> ART: More header cleanup - method_verifier.h

Move enumerations to own header. Move the compiler interface (of what
the compiler can tolerate) into its own header. Replace or remove
method_verifier.h where possible.

Test: mmma art
Change-Id: I075fcb10b02b6c1c760daad31cb18eaa42067b6d
c6ea7d00ad069a2736f603daa3d8eaa9a1f8ea11 02-Feb-2017 Andreas Gampe <agampe@google.com> ART: Clean up art_method.h

Clean up the header. Fix up other headers including the -inl file,
in an effort to prune the include graph. Fix broken transitive
includes by making includes explicit. Introduce new -inl files
for method handles and reference visiting.

Test: source build/envsetup.sh && lunch aosp_angler-userdebug && mmma art
Test: source build/envsetup.sh && lunch aosp_mips64-userdebug && mmma art
Change-Id: I8f60f1160c2a702fdf3598149dae38f6fa6bc851
dbbbd8d8088cf590e4245368deb15fcdafc63b2f 04-Apr-2017 Alex Light <allight@google.com> Ensure invoking obsolete methods throws errors.

This sets the entrypoint for obsolete methods to a special stub that
will ensure that calling them results in an Error being thrown.
Previously we were allowing obsolete methods to be run if they could
reach the appropriate places in the runtime.

Getting into the state where this is possible is extremely difficult
since one can only get an jmethodID to an obsolete method by snatching
it off the stack (or by inspecting internal runtime data). From there
normally invoking it will do lookup on the receiver which will get you
the original version.

Bug: 36867251
Bug: 31455788

Test: ./test.py --host -j40
Test: (with aosp_marlin-userdebug device) ./test.py --target -j4

Change-Id: I2ca0503966a4e3de18dd89cb7ff224eba1459b49
(cherry picked from commit db01a091aefbd78b56777f4c2e8c5e3f2d8c2712)
db01a091aefbd78b56777f4c2e8c5e3f2d8c2712 04-Apr-2017 Alex Light <allight@google.com> Ensure invoking obsolete methods throws errors.

This sets the entrypoint for obsolete methods to a special stub that
will ensure that calling them results in an Error being thrown.
Previously we were allowing obsolete methods to be run if they could
reach the appropriate places in the runtime.

Getting into the state where this is possible is extremely difficult
since one can only get an jmethodID to an obsolete method by snatching
it off the stack (or by inspecting internal runtime data). From there
normally invoking it will do lookup on the receiver which will get you
the original version.

Bug: 36867251
Bug: 31455788

Test: ./test.py --host -j40
Test: (with aosp_marlin-userdebug device) ./test.py --target -j4

Change-Id: I2ca0503966a4e3de18dd89cb7ff224eba1459b49
f25cc730ff70f085daf527f69a02fdee69aee16b 16-Mar-2017 Vladimir Marko <vmarko@google.com> Deterministic DexCache in heap images.

Preload each slot in dex cache arrays with the candidate
entry with the lowest index.

Also fix a discrepancy where we used to keep an ArtField*
in the DexCache if we kept the declaring class rather than
based on the class referenced in the corresponding FieldId.
This can result in accessing a field through a FieldId with
an unresolved class as demonstrated by the regression test.

Test: 159-app-image-fields
Test: testrunner.py --host
Bug: 30627598
Change-Id: I34735047cb064ff462cd9859e86a61ddf8615ecd
f44d36c8423f81cbb5e9f55d8813e26ffa1a7f3b 14-Mar-2017 Vladimir Marko <vmarko@google.com> Revert^2 "Hash-based DexCache field array."

Test: testrunner.py --host --interpreter
Bug: 30627598

This reverts commit 6374c58f2ea403b3a05fb27376110fe4d0fc8e3f.

Change-Id: I275508e288a85d3aa08f7405a1a4f362af43b775
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
6374c58f2ea403b3a05fb27376110fe4d0fc8e3f 13-Mar-2017 Vladimir Marko <vmarko@google.com> Revert "Hash-based DexCache field array."

Reverting to allow rebasing the revert
https://android-review.googlesource.com/351689
without too many conflicts.

Bug: 30627598

This reverts commit 1aea3510b8dd0c512cec61c91c5ef1f1e5d53d64.

Change-Id: I4af65e9f41c8bad8106c028947eca7c5a9534c53
1aea3510b8dd0c512cec61c91c5ef1f1e5d53d64 08-Dec-2016 Vladimir Marko <vmarko@google.com> Hash-based DexCache field array.

Test: m test-art-host, both AOT and interpreter
Test: m test-art-target, both AOT and interpreter
Test: m valgrind-test-art-host
Bug: 30627598
Change-Id: If992f091aadd862d17b09928d21659573dd285a0
046854b83e54eef0919d27b41d34061c2274a4dd 02-Mar-2017 Mathieu Chartier <mathieuc@google.com> Fix dex location filtering in dex2oat

Previously we were filtering dex location against profile keys,
this meant qualified ones like /system/.../app.apk would not match
the profile key app.apk in the profile. This CL fixes changes the
behavior to filter based on the profile key of the dex file location.

Fixed OatWriter checksum for raw data case (also found by regression
test).

Added missing FlushCloseOutputFiles to CompileImage causing DCHECK
failures for File destructor.

All the fixes are regression tested by dex2oat_test.

Test: test-art-host-gtest-dex2oat_test

Bug: 34929159
Bug: 35761072

Change-Id: I1bdc949bd644bfab1c8fea0b737a132b487a653b
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
c069a30d42aefd902c20e8bc09dfad1683f07ded 18-Jan-2017 Orion Hodson <oth@google.com> ART: invoke-custom support

Adds invoke-custom instruction to the interpreter.

Bug: 33191717,30550796
Test: art/test/run-test --host 952
Change-Id: I3b754128649a8b3a00ade79ba2518d0e377f3a1e
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
cd556b003adbb53739d4b3f43135e6a0ae69509a 03-Feb-2017 Vladimir Marko <vmarko@google.com> Fix dex cache resolved types and class table mismatch.

Record class table in ClassLinker::DexCacheData and use
it in DexCache.setResolvedType() to store the type also
in the initiating loader's class table if the dex file
has been registered.

Also throw InternalError when trying to register the
same DexFile with multiple class loaders. (Different
DexFile instances referencing the same file are OK.)

Test: 155-java-set-resolved-type
Test: m test-art-host
Bug: 30627598
Bug: 34193123
Bug: 34839984
Change-Id: Ia48acb300337c45880ea1459d2d32789546d67f4
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
4b0cedf04e8d136256f3afd35730da3d22bbee43 24-Jan-2017 Alex Light <allight@google.com> Fix typo in argument name.

Test: mma -j40 test-art-host
Change-Id: Ifff0e7b7ae64ce322562244a705fbe4e8f879689
b0f1192bfac159008e1f2367751083740ba05698 23-Jan-2017 Alex Light <allight@google.com> Add ClassPreDefine hook.

This hook is called prior to defining a class for the first time. It
allows callbacks to modify the dex-file used to load the class if they
wish. The event handler is responsible for ensuring that the returned
dex-file is set-up correctly.

Bug: 31684920
Test: mma -j40 test-art-host
Change-Id: Iaed79c1597913148ead795e033a0a10a4ebe6b2b
0f01b583c3952d0219696480654a0db8fac4b661 19-Jan-2017 Andreas Gampe <agampe@google.com> ART: Add ClassLoadCallback

Add callback for class-load and class-prepare events. Move Dbg
over. Add tests.

Bug: 31684920
Test: m test-art-host-gtest-runtime_callbacks_test
Test: art/tools/run-jdwp-tests.sh --mode=host
Change-Id: I871f6b3c54448fd6ece8d9a7571b2042be50d525
ce7732bcb504fc91ed201d8e2128e30d51ee9bdb 18-Jan-2017 Andreas Gampe <agampe@google.com> ART: Add Search API

Add initial support for AddToBootstrapClassLoaderSearch and
AddToSystemClassLoaderSearch. The current implementation does
not support the OnLoad phase.

Add tests.

Bug: 34359699
Test: m test-art-host-run-test-929-search
Change-Id: I42955ff381cd3828bfd772bee2f9b0745195ee51
942fd3130254d8276cbfe8e6201825e9c49e9b2c 16-Jan-2017 Vladimir Marko <vmarko@google.com> Reduce using ArtMethod's dex_cache_resolved_types_.

Avoid using the ArtMethod's dex cache type array shortcut
in runtime, preparing for its removal. We do not completely
remove the shortcut yet because it is still used by array
allocation entrypoints.

Fix ArgArray::BuildArgArrayFromObjectArray in reflection.cc
to not ask for the parameter type to be resolved. It should
have been previously resolved when retrieving the Method.

Also partially revert
https://android-review.googlesource.com/310717
because it relied on the removed AIOOBE check in the removed
ArtMethod::GetDexCacheResolvedType(). The removed check was
simply defensive but it could not be triggered without some
memory corruption.

Test: m test-art-host
Bug: 30627598
Change-Id: Ic45a5ff8c66b79429e440cbc08d67bf22a083682
70f16393e7859f489e8403d2cc287db6a442455a 16-Jan-2017 Andreas Gampe <agampe@google.com> ART: Add GetClassLoaderClasses

Add support for GetClassLoaderClasses, extracting all classes a
given classloader initiated. Add test.

Bug: 31684578
Test: m test-art-host-run-test-912-classes
Change-Id: I0aba27fb1674baf1263c0a19dc2dcce7af013760
1998cd02603197f2acdc0734397a6d48b2f59b80 13-Jan-2017 Vladimir Marko <vmarko@google.com> Implement HLoadClass/kBssEntry for boot image.

Test: m test-art-host
Test: m test-art-host with CC
Test: m test-art-target on Nexus 9
Test: Nexus 9 boots.
Test: Build aosp_mips64-eng
Bug: 30627598
Change-Id: I168f24dedd5fb54a1e4215ecafb947ffb0dc3280
921094ad3af4484537e19d62235f22792b7ce595 12-Jan-2017 Vladimir Marko <vmarko@google.com> Revert "Revert "Refactor ClassLinker::LinkInterfaceMethods().""

Drop the fix for using the correct linear allocator.
That fix breaks some debug checks that need non-trivial
changes and extra testing, so leave that for another CL.

This reverts commit dce413d333c88c86f28b9d0fe3a8052942ed9080.

Test: m test-art-host
Change-Id: I69935236a843a08d79b77c5fce74b4cc55f8ea99
dce413d333c88c86f28b9d0fe3a8052942ed9080 12-Jan-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "Refactor ClassLinker::LinkInterfaceMethods()."

Fails libcore tests.

This reverts commit afbd71ffbcc7b37067d3a4703648e62fc0e55e6f.

Change-Id: I611620f915025a0c077a78a480b2b730b3be3de8
afbd71ffbcc7b37067d3a4703648e62fc0e55e6f 19-Dec-2016 Vladimir Marko <vmarko@google.com> Refactor ClassLinker::LinkInterfaceMethods().

Add a helper class and split LinkInterfaceMethods() into
several functions to improve readability. Even with this
change, it is still almost 250 lines long.

Fix the method array reallocation to use the appropriate
linear allocator for the class's defining loader. Given that
this is a native reallocation, failure to reallocate would
result in an abort, so CHECK() that we get a non-null array
instead of expecting a null and asserting a pending OOME.

Test: m test-art-host
Change-Id: I8ff8257e4271ae8c975ea4b33fd8af36e1a1f77e
dba61481035b7944173181ec9ee02aea41dd0e29 21-Dec-2016 Alex Light <allight@google.com> Revert "Revert "Revert "Revert "Basic obsolete methods support""""

A GetDeclaringClass()->GetDexCache() got inserted during the
merge/review process meaning that we would try to access incorrect
dex-cache in obsolete methods in some situations.

Also when using tracing we would loop forever (or at least until an
OOM error) in test 916 due to tracing forcing InterpretOnly mode
meaning methods would never be jitted.

Bug: 32369913
Bug: 33630159

Test: ART_TEST_TRACE=true \
ART_TEST_JIT=true \
ART_TEST_INTERPRETER=true mma -j40 test-art-host

This reverts commit f6abcda293b115a9d7d8a26376ea2dcf2d1dc510.

Change-Id: I0773bfcba52e3cd51a83be815c6a50c189558f48
c5798bf82fc0ccd0bb90e0813d8e63df4d0576cc 09-Dec-2016 Vladimir Marko <vmarko@google.com> Revert^8 "Make sure that const-class linkage is preserved."

Replaced two ReaderMutexLocks with WriterMutexLocks.
Removed some unnecessary debugging output.

Test: m test-art-host
Bug: 30627598
Original-Change-Id: Ie9b721464b4e9a5dcce8df8095548e983bba1fe8

This reverts commit 2c8c6b63da6ecb2ac701cc30f9b4fa4a8eea5cc8.

Change-Id: I3a1aeecf64e4b202cef61cceb248d48106a2f4a6
cc1b5357f83f0b787d51fbfde3fe870c8a2fa050 02-Dec-2016 Andreas Gampe <agampe@google.com> ART: Clean up ClassLinker

Try to clean up and simplify ClassLinker.

Move dex_lock to Locks. Remove dead code. Move single-use
code to user. Hide implementation details from header.

Test: m test-art-host
Change-Id: I58150fa9c2a9524f8304370270c2197d655cb3a8
2c8c6b63da6ecb2ac701cc30f9b4fa4a8eea5cc8 01-Dec-2016 Vladimir Marko <vmarko@google.com> Revert "Make sure that const-class linkage is preserved, try again."

Reverting due to test failures as expected.

Bug: 30627598
Bug: 33231647

This reverts commit cb5ab35980a86b05586c402924d2e7ca9df25758.
Squashed revert "Additional debug logging for bug 33231647."
This reverts commit 00a441033db28d243fc33692d30eb2755fa81728.

Change-Id: I0c0ee1f70d47540fec99f8a797ce13571c16147c
cb5ab35980a86b05586c402924d2e7ca9df25758 30-Nov-2016 Vladimir Marko <vmarko@google.com> Make sure that const-class linkage is preserved, try again.

This CL causes occasional test failures on the build servers
which we were not able to reproduce locally. So we add some
some additional debug output to help pinpoint the cause.

Bug: 30627598
Bug: 33231647
Test: m test-art-host

This reverts commit 171cf811a1cdf8b1cbc5151505d8630741ce4cf3.

Change-Id: Id56a3f0e86e8212fd547e09c61794401bff47fb0
171cf811a1cdf8b1cbc5151505d8630741ce4cf3 29-Nov-2016 Vladimir Marko <vmarko@google.com> Revert "Revert "Revert "Revert "Revert "Make sure that const-class linkage is preserved."""""

Bug: 30627598

This reverts commit e47172b75b8b04a450d235cf72bdc4e223a29cb5.

Change-Id: I038029c71195a80f041982e82ae556d3157db7b8
8a0128a5ca0784f6d2b4ca27907e8967a74bc4c5 28-Nov-2016 Andreas Gampe <agampe@google.com> ART: Add dex::StringIndex

Add abstraction for uint32_t string index.

Test: m test-art-host
Change-Id: I917c2881702fe3df112c713f06980f2278ced7ed
e47172b75b8b04a450d235cf72bdc4e223a29cb5 25-Nov-2016 Vladimir Marko <vmarko@google.com> Revert "Revert "Revert "Revert "Make sure that const-class linkage is preserved.""""

Avoid class loading triggered by verification in the
626-const-class-linking test. Expect spurious wakeups.

Add extra debugging output for a very strange failure
image_writer.cc:1144] Check failed:
!IsBootClassLoaderClass(as_klass)
java.lang.Class<java.lang.NoSuchMethodError>
That class is supposed to be in the boot image (core.art for
tests), so the failing check should not be reached at all.

Test: m test-art-host
Test: m ART_TEST_OPTIMIZING=true \
ART_TEST_JIT=true \
ART_TEST_INTERPRETER=true \
ART_TEST_INTERPRETER_ACCESS_CHECKS=true \
test-art-host-run-test-626-const-class-linking
Bug: 30627598

This reverts commit 09ded9201fbeec605b12741ae255663c14bda225.

Change-Id: I65a68cb53f0707b8abb3555ac3dc44c82907aef5
09ded9201fbeec605b12741ae255663c14bda225 24-Nov-2016 Vladimir Marko <vmarko@google.com> Revert "Revert "Revert "Make sure that const-class linkage is preserved."""

626-const-class-linking is failing (spurious wakeups?)
970-iface-super-resolution-gen is failing:
dex2oatd F 11-24 10:57:16 6410 6410 image_writer.cc:1144]
Check failed: !IsBootClassLoaderClass(as_klass)
java.lang.Class<java.lang.NoSuchMethodError>

Bug: 30627598

This reverts commit 25dcbad4462ea7279ee2bbe0884abc25bdfac77a.

Change-Id: Ie010169bdde45e6ccf2e04a521da4682bd817114
25dcbad4462ea7279ee2bbe0884abc25bdfac77a 23-Nov-2016 Vladimir Marko <vmarko@google.com> Revert "Revert "Make sure that const-class linkage is preserved.""

Fix jdwp getting multiple instances of the same class.
Fix counting "zygote"/"non-zygote" classes in class table.
Fix FindClass() to EnsureResolved() classes added by
a racing thread to the class table.

Test: m test-art-host
Test: art/tools/run-jdwp-tests.sh --mode=host --variant=X64 --debug
Bug: 30627598

This reverts commit ecffc67068a28d55d131553bf915fdb9fafbbc03.

Change-Id: I15807949da4f163c2693fac2fbfc274f17685f8a
ecffc67068a28d55d131553bf915fdb9fafbbc03 22-Nov-2016 Vladimir Marko <vmarko@google.com> Revert "Make sure that const-class linkage is preserved."

Bug: 30627598

This reverts commit 19886dbeced9430579a27979beb92b09c95197b4.
Squashed reverts of subsequent partial fixes.
This reverts commit bad475a63b7c938b7ff7903ea1dae27369c3f629.
This reverts commit 0ba0c7d9b0328af39a385014652eb9af4e42d8b5.
This reverts commit ddb8afec79492750f16f98e5bd07d44f3dc485d4.

Change-Id: Id94af5ae56a0335f9641a79c885cc75bba971713
19886dbeced9430579a27979beb92b09c95197b4 11-Nov-2016 Vladimir Marko <vmarko@google.com> Make sure that const-class linkage is preserved.

After calling loadClass() on the initiating loader, insert
the Class to the ClassTable. Check that the returned class
has the correct name and that the ClassTable does not yet
contain a different Class for the same name. If either check
fails, follow the RI behavior for parallel capable class
loaders, i.e. throw NoClassDefFoundError for name mismatch
(with more descriptive message than RI) or return the Class
already present in the ClassTable. This ensures that the
const-class instruction for a given name always gives the
same result as the first time it succeeded for the same
initiating loader, even for non-well-behaved loader.

Inserting the Class to the ClassTable is also a necessary
step for changing to hash-based dex cache type array when
the DexCache will not necessarily keep the Class and
therefore the defining loader alive while the initiating
loader stays alive, so the ClassTable entry is necessary
to keep the dependecy.

Add tests that a const-class instruction always returns the
same Class<?> as it returned the first time, i.e. when it
was "linked", even for class loaders that are not
well-behaved, even if the dex cache type array is cleared.
Also test the edge cases, i.e. NoClassDefFoundError and
returning old entry from ClassTable when already inserted
by another thread.

Bug: 30627598
Test: 626-const-class-linking
Test: m test-art-host
Change-Id: Ie9b721464b4e9a5dcce8df8095548e983bba1fe8
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
d98b4ed7a73af40f5292337495333616d9974da0 05-Nov-2016 Andreas Gampe <agampe@google.com> ART: Make excludes explicit

Fix some missing lock excludes.

Test: m
Change-Id: If74708c5d16469490e3374b7d5ffc23dd2ea5ec1
d62515891b15e73bc8eebb55cc09cb4dec4fcf21 31-Oct-2016 Alex Light <allight@google.com> Add ClassExt mirror.

We add the ClassExt type to hold values in Class that are not always
needed without making the Class type larger. For the initial change we
move the verifyError field into this type. It is expected to grow as
time goes on.

Test: mma test-art-host

Change-Id: I1d97df2e1267203841ad47b2effcb66dd76ac12a
7d8d8ff0727a7aa9d11c738f13a7e06d3c4c3d68 02-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "ART: Generalize FindClassInPathClassLoader""

Bug: 32510706

Change is not responsible for the flakiness after all.

This reverts commit af3572bc21cf66f970090c852b976095bb028083.

Change-Id: I399049c217deeac6a5c3f9d678a46bdb84386e3f
af3572bc21cf66f970090c852b976095bb028083 02-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "ART: Generalize FindClassInPathClassLoader"

Bug: 32510706

This reverts commit fd1ae75a03b0b17fdbbb0097e856f494edf12312.

Change-Id: Ie247477eea44a6a241d90864bf5dca29897ff4b8
fd1ae75a03b0b17fdbbb0097e856f494edf12312 29-Oct-2016 Andreas Gampe <agampe@google.com> ART: Generalize FindClassInPathClassLoader

Also accept DexClassLoader. Do a fast check for subclasses of
BaseDexClassLoader that are in the boot classpath.

Bug: 32510706
Test: m test-art-host
Change-Id: I7d79aa90e0241e7717c5d146d1123f41746e4ffa
000e1885701c8fdad07a784e3771881fa9be1d8a 24-Oct-2016 Narayan Kamath <narayan@google.com> method_handles: Complete support for emulated stack frames.

Most of this change is a refactor that templatizes the code
that performs argument conversions. This allows us to copy arguments
between two shadow frames, or an emulated stack frame and a shadow
frame.

Test: make test-art-host
Bug: 30550796

Change-Id: I23e65735a2dbd28f3c7b7d1ccf9762e77e0cf1f1
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
34ee6842a283afe107f0c1df941393f955323b52 03-Dec-2014 Andreas Gampe <agampe@google.com> ART: Refactor class-linker methods

Hide the LookupClass with hash version. Clients should not have to
know about that performance detail.

Hide FindClassInPathClassLoader. This is an implementation detail.

Test: m test-art-host
Change-Id: I2378c6fed8d7d1fb1ead8e042b4cf07228adf25c
28357fab628bd9b91749988b554977398caf9963 19-Oct-2016 Mathieu Chartier <mathieuc@google.com> Move most of class linker to ObjPtr

Return values are still mirror pointer. Fix some failing asserts in
compiler driver and tests.

Bug: 31113334

Test: test-art-host

Change-Id: I4450bf9dfb2541749496b8388616e8aae8488919
bc5a795c0d486c84913d987cad5846ded840cea6 18-Oct-2016 Mathieu Chartier <mathieuc@google.com> Move art/native to ObjPtr

Bug: 31113334

Test: test-art-host

Change-Id: I67eb89cf042c762c6dcd5eb8b008b9a28e9b3319
1a1de67c4923436eb7de7da334c6d77703375dbd 13-Oct-2016 Vladimir Marko <vmarko@google.com> Do not write empty class table and intern table to image.

And remove dead ClassLinker and InternTable code that would
be erroneously triggered by not writing the tables.

Test: m test-art-host
Change-Id: I2520daa8d1231e16112d44e364a72d782fa32527
6c60d8420e51fda65ad247ae04b5a823c88c26b6 15-Sep-2016 Mathieu Chartier <mathieuc@google.com> Initialize dex cache while holding dex_lock

Fixes multiple threads calling RegisterDexFile occasionally getting
DCHECK failures due to the arrays not being null since the BSS ones
is per dex file.

Bug: 31369621

Test: test-art-host, no DCHECK failure during debug booting

Change-Id: I7b6e4cd03460dd1213eb4e044bdcf5f6103fd5f9
97d7e1cd7f733cb33a0e238bec6d7ed525638cd1 04-Oct-2016 Vladimir Marko <vmarko@google.com> Remove #include "oat_file.h" from class_linker.h .

Refactor the OatClass and OatMethod related functions from
ClassLinker to OatFile and ArtMethod, respectively. Refactor
the remaining ClassLinker dependencies on OatFile to break
the #include dependency and reduce incremental build times.

Test: m test-art-host
Change-Id: Iebc5b9f81b48fbcf79821cc827a5d7c4a0261bf6
b890130a66e167404a9a60cf0893a015538778ca 30-Sep-2016 Mathieu Chartier <mathieuc@google.com> Use ObjPtr for ResolvedFieldAccessTest and ResolvedMethodAccessTest

Also added LookupResolvedType that is guaranteed to not do thread
suspension but deals with multidex since GetResolvedType will
return null if the type was resolved in another dex file.

Added test.

Bug: 31113334

Test: test-art-host CC baker

Change-Id: I50493bca7d8ce9760546c3116b717484c62c47a4
25352fc06c84cdab8a2ab6d173b0514066ade2b9 03-Aug-2016 Narayan Kamath <narayan@google.com> class_linker: Add support for resolving method types.

- Add a new fixed size dex cache array for resolved method types.
The size of this array is set to 1024.
- Also introduces a new runtime flag that controls this feature.

Test: make test-art-host
Bug: 30550796

Change-Id: I147b33398d71ee21f2e91b418d3700d4630801ff
afa48270228832ecd7df4506915354d1a41f374a 03-Aug-2016 Narayan Kamath <narayan@google.com> java.lang.invoke: Add mirror types for MethodHandle / MethodType.

Bug: 30550796
Test: make test-art-host
Change-Id: I096160464bc6e84f7e5ad021306a7e462cf3b0c5
496577fb4d6d7baea9c093d35d17e208c831bbca 21-Sep-2016 Mathieu Chartier <mathieuc@google.com> Smarter image layout

Put strings in the dex file that resolves them.

Depth first traversal with overrides for class and dex cache. The
work list keeps track of what oat_index with each pushed item. This
means the static fields of a class will usually be in the same image.

Added layout test to image_test to make sure things are somewhat
reasonably attributed.

Bug: 28640955

Test: test-art-host

(cherry picked from commit 4e9c4e746617bad6a012d799d2f5cf9e01d24ea2)

Change-Id: I67a536c33aeed603b252d8e0f75622c9efbf2559
4e9c4e746617bad6a012d799d2f5cf9e01d24ea2 21-Sep-2016 Mathieu Chartier <mathieuc@google.com> Smarter image layout

Put strings in the dex file that resolves them.

Depth first traversal with overrides for class and dex cache. The
work list keeps track of what oat_index with each pushed item. This
means the static fields of a class will usually be in the same image.

Added layout test to image_test to make sure things are somewhat
reasonably attributed.

Bug: 28640955

Test: test-art-host

Change-Id: I67a536c33aeed603b252d8e0f75622c9efbf2559
268764da8022cafa5661c5b514eaa343c5257e57 13-Sep-2016 Mathieu Chartier <mathieuc@google.com> Make ScopedAssertNoThreadSuspension no overhead for non-debug

Previously it required Thread::Current() which may not be free.
The plan is to add a lot more ScopedAssertNoThreadSuspension in
the codebase.

Also cleaned up callers.

Bug: 31458474
Change-Id: I5a1621a5435476504d22266cc01a9bf26aab7568
5fd66d0546805f0d86ec3365762c00b8dd3415f5 13-Sep-2016 Andreas Gampe <agampe@google.com> ART: Remove LogSeverity NONE

Remove non-standard severity, and instead use a new enum to
configure verifier logging.

Partially reverts commit 7fe30233d32a872f5349e921dba65bd767ad994b.

Bug: 31338270
Test: m test-art-host
Change-Id: If52ee23c4902fbf2dabe7b232f6742448764ff8c
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
db16f2a0a71503fe046e41fb8d249a1a25e0658e 05-Aug-2016 Mathieu Chartier <mathieuc@google.com> Card mark holding class instead of declaring class

For profiling info, we need to mark the card of the holding class
instead of declaring class. This is required for GC correctness since
the GC relies on the card table to track cross space references.

Test: test-art-host ART_TEST_JIT=true

Bug: 30655270

(cherry picked from commit 65975776f807d55c83af6cca1e447f8daa794413)

Change-Id: I3de518693d3cac1ad9770eae671db740ebdf1d8d
65975776f807d55c83af6cca1e447f8daa794413 05-Aug-2016 Mathieu Chartier <mathieuc@google.com> Card mark holding class instead of declaring class

For profiling info, we need to mark the card of the holding class
instead of declaring class. This is required for GC correctness since
the GC relies on the card table to track cross space references.

Test: test-art-host ART_TEST_JIT=true

Bug: 30655270

Change-Id: Ia4690219ded0df38032b644440273e06bc303956
542451cc546779f5c67840e105c51205a1b0a8fd 26-Jul-2016 Andreas Gampe <agampe@google.com> ART: Convert pointer size to enum

Move away from size_t to dedicated enum (class).

Bug: 30373134
Bug: 30419309
Test: m test-art-host
Change-Id: Id453c330f1065012e7d4f9fc24ac477cc9bb9269
df2d4f22d5e89692c90b443da82fe2930518418b 30-Jun-2016 Artem Udovichenko <artem.u@samsung.com> Revert "Revert "Optimize IMT""

This reverts commit 88f288e3564d79d87c0cd8bb831ec5a791ba4861.

Test: Includes smali tests to exercise cts failures that led to revert.
These tests check that objects that don't implement any interfaces are
handled properly when interface methods are invoked on them.

Bug: 29188168 (for initial CL)
Bug: 29778499 (reason for revert)

Change-Id: I49605d53692cbec1e2622e23ff2893fc51ed4115
a62cb9bb6cb2278cb41ab0664191623e178c6a4f 30-Jun-2016 Artem Udovichenko <artem.u@samsung.com> Revert "Revert "Optimize IMT""

This reverts commit 88f288e3564d79d87c0cd8bb831ec5a791ba4861.

Change-Id: I49605d53692cbec1e2622e23ff2893fc51ed4115
88f288e3564d79d87c0cd8bb831ec5a791ba4861 29-Jun-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Optimize IMT"

Bug: 29188168 (for initial CL)
Bug: 29778499 (reason for revert)

This reverts commit badee9820fcf5dca5f8c46c3215ae1779ee7736e.

Change-Id: I32b8463122c3521e233c34ca95c96a5078e88848
fd43db68d204caaa0e411ca79a37af15d1c001af 29-Jun-2016 Jeff Hao <jeffhao@google.com> Revert "Optimize IMT"

This reverts commit 0790af1391b316c5c12b4e135be357008c060696.

Bug: 29188168 (for initial CL)
Bug: 29778499 (reason for revert)

Change-Id: I2c3e4ec2cebdd40faec67ddb721b7acdc8e90061
0790af1391b316c5c12b4e135be357008c060696 13-May-2016 Nelli Kim <nelli.kim@samsung.com> Optimize IMT

* Remove IMT for classes which do not implement interfaces
* Remove IMT for array classes
* Share same IMT

Saved memory (measured on hammerhead):
boot.art:
Total number of classes: 3854
Number of affected classes: 1637
Saved memory: 409kB

Chrome (excluding classes in boot.art):
Total number of classes: 2409
Number of affected classes: 1259
Saved memory: 314kB

Google Maps (excluding classes in boot.art):
Total number of classes: 6988
Number of affected classes: 2574
Saved memory: 643kB

Performance regression on benchmarks/InvokeInterface.java benchmark
(measured timeCall10Interface)
1st launch: 9.6%
2nd launch: 6.8%

Bug: 29188168

(cherry picked from commit badee9820fcf5dca5f8c46c3215ae1779ee7736e)

Change-Id: If8db765e3333cb78eb9ef0d66c2fc78a5f17f497
badee9820fcf5dca5f8c46c3215ae1779ee7736e 13-May-2016 Nelli Kim <nelli.kim@samsung.com> Optimize IMT

* Remove IMT for classes which do not implement interfaces
* Remove IMT for array classes
* Share same IMT

Saved memory (measured on hammerhead):
boot.art:
Total number of classes: 3854
Number of affected classes: 1637
Saved memory: 409kB

Chrome (excluding classes in boot.art):
Total number of classes: 2409
Number of affected classes: 1259
Saved memory: 314kB

Google Maps (excluding classes in boot.art):
Total number of classes: 6988
Number of affected classes: 2574
Saved memory: 643kB

Performance regression on benchmarks/InvokeInterface.java benchmark
(measured timeCall10Interface)
1st launch: 9.6%
2nd launch: 6.8%

Change-Id: If07e45390014a6ee8f3c1c4ca095b43046f0871f
7a62e6728463237684d3d9834d81bd7bba7ab197 11-Jun-2016 Hiroshi Yamauchi <yamauchi@google.com> Propagate the read barrier option to Class::VisitNativeRoots.

Propagate the read barrier option from Object::VisitReferences to
Class::VisitNativeRoots.

This is a step toward the GC thread avoiding graying objects (and
reducing dirty pages) in the immune spaces.

Bug: 12687968

Change-Id: I29c4126a4ad4c40e63a934e62451fb3fb36aad43
c92a7a14ce44c4bb7e63e4c447a008b558bc0bca 06-Jun-2016 Jeff Hao <jeffhao@google.com> Wrap certain exception types when loading an erroneous class.

Bug: 28787733

(cherry-picked from commit 7c8aa8357196781c811a73d2eb66aaaa1681ce36)

Change-Id: Iea55486c4b95ee16e1f19c8ba2d24c18b9100c97
7c8aa8357196781c811a73d2eb66aaaa1681ce36 06-Jun-2016 Jeff Hao <jeffhao@google.com> Wrap certain exception types when loading an erroneous class.

Bug: 28787733
Change-Id: I22e1e4339a95706a0fb9c1474b360e9bde232539
696632e6113a379f24dc6fe4c38e4dee57a249f8 04-Jun-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Hold dex caches live in class table""

Bug: 29083330

This reverts commit f102faf1bcbdb2149e3e7bf27b1819f621b7894b.

(cherry picked from commit c9dbb1df3b5c06ba122cacaf35b17cb53c6be3c6)

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

This reverts commit d6d49e56c2b7b11f474acb80cb02bb1fe9b7861e.

Bug: 29083330

(cherry picked from commit f102faf1bcbdb2149e3e7bf27b1819f621b7894b)

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

Bug: 29083330

This reverts commit f102faf1bcbdb2149e3e7bf27b1819f621b7894b.

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

This reverts commit d6d49e56c2b7b11f474acb80cb02bb1fe9b7861e.

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

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

Bug: 29083330

(cherry picked from commit f284d448e3edd428b6ade473d0993028638b2064)

Change-Id: Ie1b0b0cf835a998e19227cbb90014011a6cd40c4
f284d448e3edd428b6ade473d0993028638b2064 02-Jun-2016 Mathieu Chartier <mathieuc@google.com> Hold dex caches live in class table

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

Bug: 29083330
Change-Id: Ia44668f013ceef1f5eb80f653a48d0f8004548c9
f0192c86a58b2f43378c9a2113007538dd38ddbf 29-Mar-2016 Jeff Hao <jeffhao@google.com> Support to pass <uses-library> option through to dex2oat.

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

Part of a multi-project change.

Bug: 26880306

(cherry-picked from commit 26e8a2f150cd7f7195a10650ab8a5b6fa5014bc8)

Change-Id: I72a352abdfc37eacd8bedfa6c218e3809ca8e39c
f9ebc41ffbf4d996bc8657b002adcda4a2aaee1d 16-May-2016 Mathieu Chartier <mathieuc@google.com> Visit IMT of all classes during image writing

We still need to visit the IMT for classes that does not have any
methods. It is required to visit the IMT of every class to assign
image offsets for the conflict table methods.

Added regression test.

Bug: 28707801

(cherry picked from commit 54689b7d5568dcf01ff42d69435d0af7ae4e4d8e)

Change-Id: If780c6d7c30249a4106988722f0658c40d78d387
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
946593d7c593c912684022a808fd156e17852248 27-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Write conflict tables in image"

Some strange issues on angler.

This reverts commit cda9386add68d94697449c6cb08b356747e55c21.

(cherry picked from commit 8e2478d23e89a7022c93ddc608dcbba7b29b91e6)

Change-Id: I475ca30e60691cd00b818aabbeb88e6ce3a2ae17
5c4b2ec16bcd779731bed1d2a0bd902dba3d5f92 14-Apr-2016 Mathieu Chartier <mathieuc@google.com> Write conflict tables in image

Add image sections for runtime methods and conflict tables. This
makes it that we do not need to fake up a length prefixed array
for runtime methods.

Reduces .art private dirty and PSS.

System wide .art PSS goes from 32.5MB to 30.5MB after system boot.

Business card .art private dirty goes from 588K to 504K.

Increases image size by ~100K.

Bug: 27906566

(cherry picked from commit cda9386add68d94697449c6cb08b356747e55c21)

Change-Id: I3ce151651bf95047b0f692c185016f693ac4f820
dd5214db2eb81110929101ef90886bf52210b3c3 14-Apr-2016 Mathieu Chartier <mathieuc@google.com> Add support for eagerly calculating conflict tables

Will be used to put them in the image by having the compiler eagerly
calculate them.

Enabled for debug builds (non compiler). Support for having conflict
tables written in the image will come in the next CL.

(cherry picked from commit 49b5cede15d69930a8c156a3aea240164ca7af80)

Bug: 27906566

Change-Id: I03d1671a4b49317aaab5a741bbeaed7957cd6229
ab880f4371e1ae5239c1b887911bd88f0c216a3d 12-May-2016 Roland Levillain <rpl@google.com> Typos and stylistic fixes.

Change-Id: I1c88af9bd1d2cac6c803c8c61088c569a3847e01
92091bde26fb9fc54b7e5f459b696d4b88ea30de 11-May-2016 Mathieu Chartier <mathieuc@google.com> Prevent ArtMethod clearing race

There was race condition where the GC would be visiting the methods
of a class while the class linker overwrote the contents with 0xFE
when copying to a new array.

Since the GC is holding the class table lock at this time, we can
use this lock in the class linker to prevent the race.

Bug: 28699001

(cherry picked from commit 10c5f56423feaf3eadb3d4c09c61d2b998404162)

Change-Id: I5ddca93106cb8e48962cf44e5ce434c45e05cd0c
10c5f56423feaf3eadb3d4c09c61d2b998404162 11-May-2016 Mathieu Chartier <mathieuc@google.com> Prevent ArtMethod clearing race

There was race condition where the GC would be visiting the methods
of a class while the class linker overwrote the contents with 0xFE
when copying to a new array.

Since the GC is holding the class table lock at this time, we can
use this lock in the class linker to prevent the race.

Bug: 28699001
Change-Id: I91ca2406ef723e7be69cd1c53f4bafa2e5f63657
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
d23d7d145c86975acbcc75505b8a323337066ac0 27-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Write conflict tables in image"

Some strange issues on angler.

This reverts commit cda9386add68d94697449c6cb08b356747e55c21.

(cherry picked from commit 8e2478d23e89a7022c93ddc608dcbba7b29b91e6)

Change-Id: Iffd25c5fb732ff72b58c787c107dc33c56f8c8d4
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
8e2478d23e89a7022c93ddc608dcbba7b29b91e6 27-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Write conflict tables in image"

Some strange issues on angler.

This reverts commit cda9386add68d94697449c6cb08b356747e55c21.

Change-Id: Iba3a8bac6ce40ee16d83163823356951fecb6787
e42888f9df4163303244070c65d5229d3e201742 14-Apr-2016 Mathieu Chartier <mathieuc@google.com> Write conflict tables in image

Add image sections for runtime methods and conflict tables. This
makes it that we do not need to fake up a length prefixed array
for runtime methods.

Reduces .art private dirty and PSS.

System wide .art PSS goes from 32.5MB to 30.5MB after system boot.

Business card .art private dirty goes from 588K to 504K.

Increases image size by ~100K.

Bug: 27906566

(cherry picked from commit cda9386add68d94697449c6cb08b356747e55c21)

Change-Id: I38cbe3150c3eeb385b8cad7cf93614e3980f4162
7f98c9a6babe3a21d84ce1f1e1273c99975a47f5 14-Apr-2016 Mathieu Chartier <mathieuc@google.com> Add support for eagerly calculating conflict tables

Will be used to put them in the image by having the compiler eagerly
calculate them.

Enabled for debug builds (non compiler). Support for having conflict
tables written in the image will come in the next CL.

Bug: 27906566

(cherry picked from commit 49b5cede15d69930a8c156a3aea240164ca7af80)

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

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

Part of a multi-project change.

Includes fix from a6d46161aea07ebd1cbd6ab78b2b323f940e9c1e

Bug: 26880306

(cherry-picked from commit 26e8a2f150cd7f7195a10650ab8a5b6fa5014bc8)

Change-Id: I6bfc13693dbb835ca52fed2d03ec5346d43ec5d9
cda9386add68d94697449c6cb08b356747e55c21 14-Apr-2016 Mathieu Chartier <mathieuc@google.com> Write conflict tables in image

Add image sections for runtime methods and conflict tables. This
makes it that we do not need to fake up a length prefixed array
for runtime methods.

Reduces .art private dirty and PSS.

System wide .art PSS goes from 32.5MB to 30.5MB after system boot.

Business card .art private dirty goes from 588K to 504K.

Increases image size by ~100K.

Bug: 27906566

Change-Id: I38cbe3150c3eeb385b8cad7cf93614e3980f4162
21aa4d405cbe3d4612e3f50ebb7610cc0b3503a2 25-Apr-2016 Nicolas Geoffray <ngeoffray@google.com> Make sure the referring class is in the dex cache.

The method CanAccessResolvedMethod expects the referring class
in the dex file is already in the dex cache, which is true during AOT,
but not necessarilly during JIT.

bug:28295348

(cherry picked from commit 393fdb8b4822d80bbbd6347b088e28c03a72289e)

Change-Id: I9665d377070278639eb4b5a6eeced85d656e6cb6
393fdb8b4822d80bbbd6347b088e28c03a72289e 25-Apr-2016 Nicolas Geoffray <ngeoffray@google.com> Make sure the referring class is in the dex cache.

The method CanAccessResolvedMethod expects the referring class
in the dex file is already in the dex cache, which is true during AOT,
but not necessarilly during JIT.

bug:28295348
Change-Id: I58739903f0dff3867b920a7444f53b99ecf86e85
49b5cede15d69930a8c156a3aea240164ca7af80 14-Apr-2016 Mathieu Chartier <mathieuc@google.com> Add support for eagerly calculating conflict tables

Will be used to put them in the image by having the compiler eagerly
calculate them.

Enabled for debug builds (non compiler). Support for having conflict
tables written in the image will come in the next CL.

Bug: 27906566

Change-Id: I03d1671a4b49317aaab5a741bbeaed7957cd6229
26e8a2f150cd7f7195a10650ab8a5b6fa5014bc8 29-Mar-2016 Jeff Hao <jeffhao@google.com> Support to pass <uses-library> option through to dex2oat.

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

Part of a multi-project change.

Bug: 26880306

Change-Id: Ib70a48ff700a5db9a5b4aaf731552556878ad8f7
6d25cf6cbda1b95fb014a3fd22c01a6bdf47725e 13-Apr-2016 Mathieu Chartier <mathieuc@google.com> Fix InsertDexFileInToClassLoader to handle null class loaders

Maybe used by legacy apps. This functionality is planned for
deprecation.

Bug: 27954959

(cherry picked from commit f2bf9d640e37b72be8b4f6016d4aa95a0e27b7b4)

Change-Id: I1ae2cf1e33f2f1b237a41c8cc50d2a814a52a95a
f2bf9d640e37b72be8b4f6016d4aa95a0e27b7b4 13-Apr-2016 Mathieu Chartier <mathieuc@google.com> Fix InsertDexFileInToClassLoader to handle null class loaders

Maybe used by legacy apps. This functionality is planned for
deprecation.

Bug: 27954959

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

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

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

Bug: 26884697
Change-Id: Iec7266ce67e6fedc107be78fab2e742a8dab2696
7fe30233d32a872f5349e921dba65bd767ad994b 26-Mar-2016 Andreas Gampe <agampe@google.com> ART: Make verifier fail log level adjustable

To help for build failures.

Change-Id: I6c94dfb50177daa7d89902d78715ccec31bf0e45
796d63050a18f263b93ea34951a61deaecab3422 13-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Add an ImtConflictTable to better resolve IMT conflicts.

- Attach a ImtConflictTable to conflict runtime ArtMethod.
- Initially 0, a new one will be created at the first hit of
the conflict method.
- If the assembly code does not find a target method in the table,
we will create a new one again, copying the data from the previous
table and adding the new mapping.

Implemented for arm/arm64/x86/x64.

bug:27556801
bug:24769046

Change-Id: Ie74d1c77cf73d451a1142bdc5e3683f9f84bb4e7
6300fd77033817664aee3056c4ff5fab85698d2b 18-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Code cleanup between debugger and jit.

This is to allow secondary dex files to be fully compiled.

- No need to do full deopt anymore for breakpoints: code in boot.oat
is deoptimized as soon as the debugger attaches (and we decided that
existing frames could not be debugged), and application being
debugged is compiled debuggable.

- jit should only call UpdateMethodsCode if exit stubs are not
installed due to lock violation otherwise (the lock level of the
jit code cache is lower than the deoptimization lock).
This part needs an overall cleanup beyond the scope of this change.

Change-Id: I38d85dcb270db746c1d6b0ceb7893a1aad8c9655
0b4cbd0c2a75b47ae09d21e5d73d2b1709cb5b9e 09-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add oatdump support for app images

Example usage on host:
oatdumpd --app-oat=art/plus32.odex --app-image=art/plus32.art
--image=art/oats/system@framework@boot.art --instruction-set=arm

TODO: Add to oatdump test.

Bug: 27408512
Bug: 22858531

(cherry picked from commit bcb6a72569a1401b36a3ad3b6aa4d13e29966cf0)

Change-Id: I9d1aa7eaa16795e5fbabc6974d245849e16b1d03
bcb6a72569a1401b36a3ad3b6aa4d13e29966cf0 09-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add oatdump support for app images

Example usage on host:
oatdumpd --app-oat=art/plus32.odex --app-image=art/plus32.art
--image=art/oats/system@framework@boot.art --instruction-set=arm

TODO: Add to oatdump test.

Bug: 27408512
Bug: 22858531

Change-Id: I320db8b76c780c6eadabcb45ce88f45950741484
f28a99a90b68e45f39191258832e7a526c4742ba 02-Mar-2016 Mathieu Chartier <mathieuc@google.com> Fix potential linear alloc memory leak

Previously, if we created a linear alloc for a class loader but
never created the class table, the linear alloc would never get
freed since it would have no corresponding ClassLoaderData.

Fixes valgrind-test-art-host-gtest-oat_test

Bug: 27384882
Bug: 22858531

(cherry picked from commit 5b83050affa6a3b1d3863c0b903f9d48fe4aefb2)

Change-Id: I71b650eac4e33212a7f03c43141db99e635a19ad
88027bd6810b9a5b785dba5396eec5301e4540b2 03-Mar-2016 Mathieu Chartier <mathieuc@google.com> Only visit app image classes in class loader

Only update dex cache arrays of added classes since the declaring
class is in image DCHECK fails for other classes in the class loader.

Also some cleanup to prevent app images leaving invalid state if
they get rejected.

Bug: 22858531
Bug: 27431418

(cherry picked from commit 6973100705716bffce3768a8a0908d7ca1d02ec1)

Change-Id: Ib05364c44f2b943e3341ef2b1dd43337833de143
6973100705716bffce3768a8a0908d7ca1d02ec1 03-Mar-2016 Mathieu Chartier <mathieuc@google.com> Only visit app image classes in class loader

Only update dex cache arrays of added classes since the declaring
class is in image DCHECK fails for other classes in the class loader.

Also some cleanup to prevent app images leaving invalid state if
they get rejected.

Bug: 22858531
Bug: 27431418
Change-Id: Ib2a5692a1ad78b014a1bfc6b27fb1c12bc8565e6
5b83050affa6a3b1d3863c0b903f9d48fe4aefb2 02-Mar-2016 Mathieu Chartier <mathieuc@google.com> Fix potential linear alloc memory leak

Previously, if we created a linear alloc for a class loader but
never created the class table, the linear alloc would never get
freed since it would have no corresponding ClassLoaderData.

Fixes valgrind-test-art-host-gtest-oat_test

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

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

TODO: Add tests for profile stuff.

Bug: 22858531

(cherry picked from commit 8913fc1a27df8cf3b37fd99e94d87f290591328e)

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

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

TODO: Add tests for profile stuff.

Bug: 22858531

Change-Id: I91ccd686394cc2517512f66abb0e277f3d26d4da
6ea1a0e2168c8d9b6d97c075c73a72d84080f45b 29-Jan-2016 Mingyao Yang <mingyao@google.com> AOT compile framework code as non-debuggable

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

Change-Id: Id148069ccad95e2339ba214742ae3ef4f084f495
dd5e5e975e1965c3e4568143e8e1c7b65b319f58 12-Feb-2016 Tamas Berghammer <tberghammer@google.com> Revert "Revert "Make it possible to enable native debugging through debug flags""

This reverts commit 3a98aae1b9b20bc78dc5e05d2e60cb1d0072db02.

* Add support for a new debug flag disabling the optimizations in
the compiler and enable the generation of some additional debug
info (--native-debuggable).
* Ignore the content of the oat files if force JIT is enabled so
the runtime ignores the AOT-ed code what doesn't contain any
debug info.

Time measurements on a Nexus 5 with running:
am start -n com.facebook.katana/com.facebook.katana.LoginActivity -W

Before change: | AVG | DEV
--------------------------------------
ThisTime: 549 492 512 511 | 516 | 24
TotalTime: 549 492 512 511 | 516 | 24
WaitTime: 662 511 528 526 | 557 | 71

After change: | AVG | DEV
--------------------------------------
ThisTime: 530 467 503 544 | 511 | 34
TotalTime: 530 467 503 544 | 511 | 34
WaitTime: 551 497 536 583 | 541 | 36

Based on the numbers the speed impact of the change is less then the
accuracy of the measurement and it is also negligible.

The minor speed improvement displayed in the measurements are just
the cause of the variance of the measurement and not caused by this
change.

Change-Id: Ibf7294bfd14f8632a0fdeb27a5b90bfe5037d085
3a98aae1b9b20bc78dc5e05d2e60cb1d0072db02 08-Feb-2016 Tamas Berghammer <tberghammer@google.com> Revert "Make it possible to enable native debugging through debug flags"

The change causes issues in test-art-target-gtest-jni_internal_test32

This reverts commit c94a61f06ffc13288c67891048128c987b29bf33.

Change-Id: Iecfe3c6874d7b0dd59f10156fe2eb743ab7221dc
c94a61f06ffc13288c67891048128c987b29bf33 05-Feb-2016 Tamas Berghammer <tberghammer@google.com> Make it possible to enable native debugging through debug flags

* Add support for a new debug flag disabling the optimizations in
the compiler and enable the generation of some additional debug
info (--native-debuggable).
* Ignore the content of the oat files if force JIT is enabled so
the runtime ignores the AOT-ed code what doesn't contain any
debug info.

Time measurements on a Nexus 5 with running:
am start -n com.facebook.katana/com.facebook.katana.LoginActivity -W

Before change: | AVG | DEV
--------------------------------------
ThisTime: 549 492 512 511 | 516 | 24
TotalTime: 549 492 512 511 | 516 | 24
WaitTime: 662 511 528 526 | 557 | 71

After change: | AVG | DEV
--------------------------------------
ThisTime: 530 467 503 544 | 511 | 34
TotalTime: 530 467 503 544 | 511 | 34
WaitTime: 551 497 536 583 | 541 | 36

Based on the numbers the speed impact of the change is less then the
accuracy of the measurement and it is also negligible.

The minor speed improvement displayed in the measurements are just
the cause of the variance of the measurement and not caused by this
change.

Change-Id: Ia9022cbc1bbfcc072314b6c95f63a4bf8060c36c
7ba5a67686a5c6fc5735a4a9457958c79e6ca818 05-Feb-2016 Andreas Gampe <agampe@google.com> ART: Better InitWithoutImage error messages

InitWithoutImage can easily fail when assumptions of the runtime
with respect to core classes are wrong. Give some more general
helpful messages.

Change-Id: Icedac9a0d6ad84b2d1dde9e30bf4fab2f48a3efd
df707e406877e9c0426dd051c00933ebb331673e 03-Feb-2016 Igor Murashkin <iam@google.com> runtime: Don't skip verification for -Xverify:soft-fail

When forcing the interpreter into access checks mode,
make sure that the regular verification is still run,
giving the verifier an opportunity to throw a VerifyError.

If verification would've succeeded (without -Xverify:soft-fail flag),
override this and soft-fail, to force the interpreter-with-access-checks to be run
instead of the normal faster interpreter.

This fixes the following run-tests under the interpeter-access-checks:
* 135
* 412
* 471
* 506
* 800

Bug: 22414682
Change-Id: I5cb86a8bba71c7af9361a63c0802786c852b857b
1aa8ec2ccdd7bedb6d30d91c89f1e94ab23c4439 01-Feb-2016 Mathieu Chartier <mathieuc@google.com> Fix up dex cache strings stored in classes

Previously we left the image pointer instead of fixing up the pointer
to the one in the BSS. This only showed up because JIT does the same
as boot image, bypassing null check.

Fixed a bug where oat files without embedded dex cache arrays would
get their dex cache arrays corrupted.

Added a non virtual class visitor for performance.

Bug: 26846419
Bug: 22858531

Change-Id: I8cd0d61e440f753b4628ddb8c932eb23a0a81027
5a5598609f4f65f446e46327e7b6789c41c92bde 29-Jan-2016 Alex Light <allight@google.com> Fix issue with exception type resolution during linking.

When using default methods that cross dex-files we would sometimes
attempt to lookup method information using the wrong dex file. This
fixes this issue.

Bug: 26872564

Change-Id: I3c4b64ef970017356962060f3bd3781b4629a3c8
fedd91d50930e160c021d65b3740264f6ffec260 07-Jan-2016 Alex Light <allight@google.com> Optimizing compiler support for directly calling interface methods

This teaches the optimizing compiler how to perform invoke-super on
interfaces. This should make the invokes generally faster.

Bug: 24618811

Change-Id: I7f9b0fb1209775c1c8837ab5d21f8acba3cc72a5
76172164667d565c1d3316935a24b0d9712bb2f6 26-Jan-2016 Mathieu Chartier <mathieuc@google.com> Convert to UTF8 before doing dex file location comparison

Need to have strings in the same format or else the lengths
might not match due to UTF8 conversion.

Added regression test.

Bug: 26799552

(cherry picked from commit 3776db4e51ab61a6e535772417c2adf95920b569)

Change-Id: Ifbc8c38418c9da307a0ff4446d18cea4fb5e71bc
3776db4e51ab61a6e535772417c2adf95920b569 26-Jan-2016 Mathieu Chartier <mathieuc@google.com> Convert to UTF8 before doing dex file location comparison

Need to have strings in the same format or else the lengths
might not match due to UTF8 conversion.

Added regression test.

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

This reverts commit 1bc977cf2f8199311a97f2ba9431a184540e3e9c.

Bug: 22858531

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

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

Bug: 22858531

This reverts commit f7fd970244f143b1abb956e29794c446e4d57f46.

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

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

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

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

Bug: 22858531

Change-Id: I9cbc645645e62ea2ed1ad8e139e91af7d88514c1
966878d987cec1940fdfa8633fc79f8112320821 14-Jan-2016 Mathieu Chartier <mathieuc@google.com> Revert "Create parent class loader for dex2oat"

Bug: 22858531

This reverts commit d37d364c27e74a7b49970a8c970482e273aa7b1a.

Change-Id: Id71a6f3bb9a29c04a5c13210633674e05d798114
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
e64300b8488716056775ecbfa2915dd1b4ce7e08 16-Dec-2015 Alex Light <allight@google.com> Revert "Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class""

This reverts commit ae358c1d5cef227b44d6f4971b79e1ab91aa26eb.

Bug: 24618811

Change-Id: I8becf9bae3258450b90cfef5e79589db7c535a4d
2efb0aa57da168944f99a2d13aed2a426cfa76e7 15-Dec-2015 Alex Light <allight@google.com> Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class"

This reverts commit 9539150b85142c18e9e8c2264b5b6100942667c3.

Change-Id: I596876cd643ec0ad524a56621efb6b89e8886230
ae358c1d5cef227b44d6f4971b79e1ab91aa26eb 15-Dec-2015 Alex Light <allight@google.com> Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class"

This reverts commit 6286a97bea0f584342803a215550038852b24776.

Change-Id: I5b00f6d1350e9c587acd4b185367dc815ea707de
9539150b85142c18e9e8c2264b5b6100942667c3 04-Dec-2015 Alex Light <allight@google.com> Combine direct_methods_ and virtual_methods_ fields of mirror::Class

Manual cherry-pick of 6286a97 to master

This makes several parts of the overall runtime simpler and reduces
the size of a class object by 32-bits.

Bug: 24618811

Change-Id: I36129b52189e26898ea56fa2b7b45652e06af236
6286a97bea0f584342803a215550038852b24776 04-Dec-2015 Alex Light <allight@google.com> Combine direct_methods_ and virtual_methods_ fields of mirror::Class

This makes several parts of the overall runtime simpler and reduces
the size of a class object by 32-bits.

Bug: 24618811

Change-Id: I36129b52189e26898ea56fa2b7b45652e06af236
42ef8ab151a3d0cbb42cb43f6841c3708d65fca3 04-Dec-2015 Andreas Gampe <agampe@google.com> ART: Stash a resolved method late in the verifier

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

Clean up the test a bit.

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

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

This reverts commit dae24142127c64551142a50423085aabdb0a6060.

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

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

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

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

Bug: 21869691
Change-Id: Ica27158f675b5aa223d9229248189612f4706832
a7a4759946d9f11c88dc108b2b6a9518ce9c1e18 24-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "lambda: Add support for invoke-interface for boxed innate lambdas"

955-lambda is flaky

Bug: 24618608
Bug: 25107649

This reverts commit 457e874459ae638145cab6d572e34d48480e39d2.

(cherry picked from commit 3a0909248e04b22c3981cbf617bc2502ed5b6380)

Change-Id: I24884344d21d7a4262e53e3f5dba57032687ddb7
3a0909248e04b22c3981cbf617bc2502ed5b6380 24-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "lambda: Add support for invoke-interface for boxed innate lambdas"

955-lambda is flaky

Bug: 24618608
Bug: 25107649

This reverts commit 457e874459ae638145cab6d572e34d48480e39d2.

Change-Id: I24884344d21d7a4262e53e3f5dba57032687ddb7
457e874459ae638145cab6d572e34d48480e39d2 23-Oct-2015 Igor Murashkin <iam@google.com> lambda: Add support for invoke-interface for boxed innate lambdas

Lambda closures created with the 'create-lambda' instruction
(termed "innate lambdas") can be turned into an object with 'box-lambda'.

This CL enables support for those kinds of lambdas to work with
'invoke-interface' by generating a proxy class for the lambda.

Note: MIPS32/64 support not included.

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

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

Bug: 22858531
Change-Id: I30761b59421c8a24cffd62b469134b25d2929e2e
3db9c5da2925ca5ca82cc37b60a8e9fc39e88d1d 17-Nov-2015 Andreas Gampe <agampe@google.com> ART: Change Init{From,Without}Image to return bool

Rewrite some CHECKs to return false. For a common failure (missing)
image, this improves the abort (as it's not a runtime abort with
lots of stack traces anymore).

Change-Id: I717b1db74950267ced0ad3bafa1aed1693680062
04302dbb106d590ff72c0dfecda23d85b6565059 12-Nov-2015 Hiroshi Yamauchi <yamauchi@google.com> Fix class unloading with the CC collector.

Avoid unnecessarily decoding dex cache and class loader weak roots,
which would trigger read barriers.

Re-enable 141-class-unload with the CC collector.

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

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

Generalized some logic in the class linker for image spaces.

Bug: 22858531

Change-Id: Ib3e12bb061a247e232d3dc93b0d6b35eb3a34d25
9139e008abe30b7beaf4afd6533228a1dd9b202c 10-Oct-2015 Alex Light <allight@google.com> Correct exception behavior for default methods

Default methods are defined to throw an IncompatibleClassChangeError
(ICCE) when they are called and there is no "best" implementation.
Previously we would simply throw an ICCE during class loading as soon
as we noticed that this would happen if called. This makes us wait
until we actually attempt to execute the method. Furthermore, this
allows us to use other, non-conflicting, methods on the object as
normal.

Furthermore, this makes us correctly throw AbstractMethodErrors in
cases where all default implementations of a method are overridden by
abstract declarations.

Adds 3 tests for this new behavior.

Bug: 24618811

Change-Id: Id891958a81f9b3862b2ce5919636aabef7d3422e
f1f104935bc9a200f6e79c52c56c5d7cf0f43bb2 08-Oct-2015 Alex Light <allight@google.com> Class Linker: Implement default interface verification ordering.

We ensure that default interface verification failure is propagated to
the implementing class so that the compiler is able to properly handle
verification failures. Furthermore we ensure that default interfaces
are verified at the same time their implementing classes are.

This does not add additional support for default methods to the verifier.

This adds a basic test of this functionality.

Previously assumptions made about the order of verification in our
code could cause a check failure during compilation. Our old code
assumed that all code that would be run during a classes
initialization had been verified before any of it was run. The default
interfaces broke this assumption. Now we will simply verify default
interfaces with any classes that implement them.

Bug: 24618811

Change-Id: Ia11a50a28889dbd7ca22ffa730ef443e39f3cb5b
a808bac971255ff4e62a6c5feadeca1ddcc4b3c0 06-Nov-2015 Mathieu Chartier <mathieuc@google.com> Add more image writer comments and clean up

Bug: 22858531

Change-Id: Ia3663856a7d9f67d9d9af329a54707ae2dc55a48
cb086955c2a21270cd2f53a8bce71e577d776506 03-Nov-2015 Andreas Gampe <agampe@google.com> ART: Change behavior for rethrowing init failures (2)

Always store the pending exception when making a class erroneous.
Instead of filtering by ExceptionInInitializerError, add an option
to the rethrow that enforces a NoClassDefFoundError, which is required
by the specification.

Use the libcore companion change to add the stored error (if any) as
a cause to the NoClassDefFoundError, which should significantly help
tracking down issues.

Fix run-test 008 to expect spec-compliant behavior. Test that a cause
has been set.

Bug: 25445103
Change-Id: I6a0dc54e78312283faf23415887eff387531407f
99babb6add7db19ce7605f6d5e4aee79d52e386f 03-Nov-2015 Andreas Gampe <agampe@google.com> ART: Change behavior for rethrowing init failures

Allow to store a Throwable instance or a throwable class. Handle
rethrow accordingly.

Bug: 25444180
Change-Id: I703c2c6eaf34ad0e3bc0f5a104d65f2ff1b212ca
1dad3f68b7f5a4a4cb2b281413357adc2309a8fd 23-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Support garbage collection of JITted code.

Change-Id: I9afc544460ae4fb31149644b6196ac7f5182c784
00310e0bb4ee541b99f0b687dbf5f706db2aabca 17-Oct-2015 Mathieu Chartier <mathieuc@google.com> Keep dex files live in class table

The DexFile.loadClass API allows callers to load classes using a
dex file without having that dex file owned by the specified class
loader. We now add the dex file to the class table to make sure it
stays live until the class loader is unreachable.

Fixes interpreter gcstress test 087 with 64 bit.

Bug: 22720414
Change-Id: Ia4341149f45b6293312f8b275c7a68cea179f718
32cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7ee 15-Oct-2015 Mathieu Chartier <mathieuc@google.com> Change hash table load factors

Changed class table and intern table load factors to query the
runtime. The runtime returns load factors based on whether or not we
are a low ram device.

DescriptorEquals time for class linking goes from 10% -> 1.2% for
compiling GmsCore with interpret only.

Added test.

Bug: 24917584

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

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

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

Added regression test.

Bug: 22720414

Change-Id: Ia50333a06a339efbdaedb5ad94b7a1ae841124ec
eb7c144a6aff7da673ba53d501c46f00311d4d7f 31-Aug-2015 Alex Light <allight@google.com> Add initial default method support to Art

This commit starts the process of adding default methods and their
associated pieces to ART.

This adds full support for calling default methods using
invoke-interface and invoke-virtual on objects implementing the
interfaces. Verifier is changed to allow this when the runtime is
started with -Xexperimental:default-methods.

This also adds support for defining and calling static methods on
interface classes with invoke-static.

Directly calling overridden default methods using invoke-super is not
yet supported.

This adds 5 new run-tests for this functionality.

Bug: 24618811

Change-Id: I35ca800d99d3329348b277789b70ceeeba6e7f03
f9c6fc610b27887f832e453a0da1789187293408 07-Oct-2015 Mathieu Chartier <mathieuc@google.com> Add OatFileManager

Takes over a large amount of functionality from the class linker.

Changed OatFile to loading the same OatFile multiple times. This is
required for unloading OatFiles and moving dex caches to BSS since
these require a different OatFile for each dex cache and class
loader.

Bug: 22720414

Change-Id: I0321096723a294dc72949f21e66da82727b512fc
5f4a09a54eed55de89e194780214a2acfd2cb431 28-Sep-2015 Andreas Gampe <agampe@google.com> ART: Add CheckJNI lock checking

JNI MonitorEnter and MonitorExit have similar rules to structured
locking. Count locks in CheckJNI mode.

Bug: 23502994
Change-Id: Ie3f53d3aa669a6bd0c7153c50c168116b43764d9
c3fcd41f15dffbb5f28c9900f421471a3d2dd420 26-Sep-2015 Mathieu Chartier <mathieuc@google.com> Address some code comments

Change-Id: I0a38a387c4328d45bbc04d095bf3388c27495c12
951ec2c93c79c5539cbcc669566f0808d4460338 22-Sep-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Add one LinearAlloc per ClassLoader""

Issue was fixed by:
https://android-review.googlesource.com/#/c/171945/

Bug: 22720414

This reverts commit 7de5dfe37f3cf24e1166412b589f6f67dcd1f1c0.
7de5dfe37f3cf24e1166412b589f6f67dcd1f1c0 22-Sep-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Add one LinearAlloc per ClassLoader"

Times out on 32bit target/host for 132-daemon-locks-shutdown test.

Bug: 22720414

This reverts commit 356412e2b7ba3fde164bc08a44fee0ddc19c54e1.

Change-Id: I5ab3a09e88a5ad8c306a27d2606ecbecc80b9326
356412e2b7ba3fde164bc08a44fee0ddc19c54e1 21-Sep-2015 Mathieu Chartier <mathieuc@google.com> Add one LinearAlloc per ClassLoader

Also added freeing linear alloc and class table when the
corresponding class loader is no longer reachable.

Bug: 22720414

Change-Id: Icb32c3a4c865f240e147bc87ed080a6b1d8a5795
9b1c71ec77d92d63f1c2183b0cd3588727b2c265 03-Sep-2015 Mathieu Chartier <mathieuc@google.com> Make class loaders weak roots

Making the class loaders weak roots in the class linker prevents them
from keeping the classes as live. However we currently do mark them
as strong roots to make sure no accidental class unloading occurs
until the logic to free from linear alloc is complete.

Bug: 22720414

Change-Id: I57466236d9ce6fd064dda9a30ce8ab68094fb8b0
c77f3ab25939727346b0b6ec2f9421e218ac836a 04-Sep-2015 Mathieu Chartier <mathieuc@google.com> Clean up formatting in class linker

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

This reverts commit 81a9087f0df0518c39405b7d18ba5858a6d8b77b.

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

Bug: 23602225
Bug: 22720414

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

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

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

Also deleted some unused functionality in image writer.

Bug: 22720414
Change-Id: If22cb3cad7e3baabc8158a77d7f20799faf4c341
13e748b28c5f2bd1e83674d2ca899ff61ae5c0a1 25-Aug-2015 Jeff Hao <jeffhao@google.com> Revert "Revert "Move annotations to native.""

This reverts commit 7db6dd79a24570448ae737ee1946b00396696cac.

Adds check if field's declaring class is proxy.
Bug: 23508574

Change-Id: Ie829f1526e74427711e818b56d1588d92946cbf6
7db6dd79a24570448ae737ee1946b00396696cac 25-Aug-2015 Roland Levillain <rpl@google.com> Revert "Move annotations to native."

This reverts commit 0042c6d49b8488c78f0b937063e316e8d6244439.

Reverting this change (as well as the companion CL
https://android-review.googlesource.com/#/c/167510/ in
platform/libcore) as they make libcore test
libcore.java.lang.reflect.ProxyTest#test24846 fail.

Change-Id: Ie0676cabb128277c7df5dab7bde17aefd3b2c09c
0042c6d49b8488c78f0b937063e316e8d6244439 30-Jul-2015 Jeff Hao <jeffhao@google.com> Move annotations to native.

Art side of this change. There is also a corresponding Libcore change.

Seeing ~2-3x speedup over dalvik KK MR1 in AnnotatedElementBenchmark.
Benchmark Speedup of Art AOSP to Dalvik KK MR1
GetAllReturnsLargeAnnotation 2.99
GetAllReturnsMarkerAnnotation 2.20
GetAllReturnsNoAnnotation 2.43
GetAllReturnsSmallAnnotation 2.52
GetAllReturnsThreeAnnotations 2.87
GetAnnotationsOnSubclass 2.42
GetDeclaredAnnotationsOnSubclass 2.49
GetFieldAnnotation 2.68
GetFieldAnnotations 2.60
GetMethodAnnotation 2.66
GetMethodAnnotations 2.61
GetParameterAnnotations 2.52
GetTypeAnnotation 2.56
GetTypeAnnotations 2.17
IsFieldAnnotationPresent 3.26
IsMethodAnnotationPresent 4.99
IsTypeAnnotationPresent 1.34

Change-Id: Ibdbb6d23b17eaab6e83c8774b1bb9401e8227941
6b06953817bdf613b52389c457e2f4ed6cf46f5c 06-Aug-2015 Mathieu Chartier <mathieuc@google.com> Add class table field to class loader

Fixes bug with the class table where the comparator would cause read
barriers and break the map strict ordering properties.

Bug: 22957957

Change-Id: I8dbc042db6e22e2172ab4ec58ddf1db0345dcaaa
54d220eb9cc51215d75b9e0fe921b94bebbb3fd6 31-Jul-2015 Mathieu Chartier <mathieuc@google.com> Move ArtFields and ArtMethods to be a length prefixed array

Fixes race conditions between changing method and fields arrays
being seen in the wrong order by the GC.

Bug: 22832610
Change-Id: Ia21d6698f73ba207a6392c3d6b9be2658933073f
b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7 04-Aug-2015 Igor Murashkin <iam@google.com> Revert "cleanup: Replace pointers with out-parameters and fix-up formatting"

This reverts commit a315f5c546b796f55f4872bb6efc15eb858d9639.

--

Revert "runtime: cleanup class_linker out-parameters and formatting"

This reverts commit bc1d78daa463572c5a770cdca858a3b51d8e1b7b.

--

Revert "base: replace raw pointers for out-parameters with safer out<T>"

This reverts commit fb326cffc679cab8eb873b9e44795706f023cb3c.
bc1d78daa463572c5a770cdca858a3b51d8e1b7b 31-Jul-2015 Igor Murashkin <iam@google.com> runtime: cleanup class_linker out-parameters and formatting

* Use out<T> instead of parameters
* Fixes up some other signatures to be more correct
* Reformat parameters to be one per line if they can't fit on one line
* Reformat locks to be one per line if they can't fit on the decl line

Change-Id: Ib71b08707d3ed0bb85299406c0b23a1de4e92a1c
40c8141b48275afd1680b99878782848ab3a6761 01-Aug-2015 Igor Murashkin <iam@google.com> Revert "runtime: cleanup class_linker out-parameters and formatting"

This reverts commit 0de694ed3efe8412b83622a24074831edcc7e384.

Change-Id: I4b185584d6e47918179b16d76709cc3366872f3c
0de694ed3efe8412b83622a24074831edcc7e384 31-Jul-2015 Igor Murashkin <iam@google.com> runtime: cleanup class_linker out-parameters and formatting

* Use out<T> instead of parameters
* Fixes up some other signatures to be more correct
* Reformat parameters to be one per line if they can't fit on one line
* Reformat locks to be one per line if they can't fit on the decl line

Change-Id: I1031cf4edc41f95b89edb343d43ef93e15384206
e0671ce5a6cb34e44e3afefa8e29c0c3e30d2855 29-Jul-2015 Mathieu Chartier <mathieuc@google.com> Clean up class visitors

Move from function pointers to virtual function visitors.

Change-Id: I68cb83c1d2ed9b5a89f8e534fe7ca4bbc1c91f45
cc5ebdf29ea47e24e79279169e0192dfc08b38c8 27-Jul-2015 Mathieu Chartier <mathieuc@google.com> Split the class table for each class loader

Each class loader now has its own class table. This makes it easier
to mark classes when a classloader is marked.

Fixed a bug in LookupClass where we used to look ignore the return
value of InsertClass.

Bug: 22720414

Change-Id: If2cd717989a20a6e245ebec24ad52dc47dd3207d
4e2cb098017bf073335ebb02b1bc0a36828cd720 23-Jul-2015 Mathieu Chartier <mathieuc@google.com> Add uninterruptible role

Example error:
cannot call function 'CopyOf' while mutex 'uninterruptible_' is held

TODO: Add annotation to more locations.

Bug: 20072211

Change-Id: I1bbf5a77e3deeafa5898df529cb7cb53a6d010d2
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
9523a3ed0ae6fa31cd978a3999fd88233218f98b 17-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Use the quickened metadata to compile -QUICK opcodes.""

This reverts commit 8ab9a9010f3929acbb6c671008b8885b762b01e1.

Change-Id: I1e654d5010ea2112982c3055fcb8c8f9c10e9ac8
8ab9a9010f3929acbb6c671008b8885b762b01e1 17-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Use the quickened metadata to compile -QUICK opcodes."

Broke sdk build. Investigating.

This reverts commit 4515a67434c9e3e1627586629a1f2aba1a99aa6a.

Change-Id: I6c1107ab626758570a59dc6bf3e4228c70a57196
4515a67434c9e3e1627586629a1f2aba1a99aa6a 16-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Use the quickened metadata to compile -QUICK opcodes.

Change-Id: I28a8d68921698bea81f54c95cc6e4c6d2c03f2b4
3cf225386e8129dcbe32b289279ecb87ec255318 10-Jul-2015 Mathieu Chartier <mathieuc@google.com> Clean up some includes

Change-Id: Ia03a3b54b235df38d5cfe096fef1aebe2b80eb29
8ac75952f13f0a80803628f0c2aa06120ad42126 03-Jun-2015 Andreas Gampe <agampe@google.com> ART: Prune FindArrayClass cache in image writer

The ClassLinker cache speeds up FindArrayClass requests, but all
entries are roots. It is possible that an entry is a non-image
class when creating the boot image, artificially keeping the
class around.

Bug: 21596650

(cherry picked from commit 44905ce1c97613a5cb44046049843fe1029a64cf)

Change-Id: Ief9b439945d0e293a3cb5dcddfeb189b5e174f06
44905ce1c97613a5cb44046049843fe1029a64cf 03-Jun-2015 Andreas Gampe <agampe@google.com> ART: Prune FindArrayClass cache in image writer

The ClassLinker cache speeds up FindArrayClass requests, but all
entries are roots. It is possible that an entry is a non-image
class when creating the boot image, artificially keeping the
class around.

Bug: 21596650
Change-Id: Ief9b439945d0e293a3cb5dcddfeb189b5e174f06
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
679b1cf291f364dcc3a142f53a07b0ad15c01e9a 21-May-2015 Hiroshi Yamauchi <yamauchi@google.com> Fix for potential moving GC bugs around proxy class.

- Handlerize proxy_class which is live across multiple allocation
points in ClassLinker::CreateProxyClass().

- In ClassLinker::CreateProxyClass(), insert a proxy class into the
class table before creating ArtFields for it (and update it later in
LinkClass()) because the field roots (ArtField::declaring_class_)
won't be updated by GC unless the class is in the class table. If GC
happens before they are updated by FixupTemporaryDeclaringClass()
from LinkClass(), FixupTemporaryDeclaringClass() may not update the
field roots correctly because the old class may already be moved but
the fields roots may not. Reduce a window of time where the fields
roots could be stale.

- In ClassLinker::LinkClass(), directly wrap a new class in a handle
to avoid a window of time where new_class may be potentially stale.

- Print more diagnostic info about the holder of the field upon a mark
sweep invalid ref crash.

- Add an additional sanity check in Field::GetArtField().

(cherry pick commit 08d1b5f2296c0f51507b8b443f4e39dfc161572c)

Bug: 20557050

Change-Id: I9ad32d304922da96b7e1fad262d97de21cbac776
08d1b5f2296c0f51507b8b443f4e39dfc161572c 21-May-2015 Hiroshi Yamauchi <yamauchi@google.com> Fix for potential moving GC bugs around proxy class.

- Handlerize proxy_class which is live across multiple allocation
points in ClassLinker::CreateProxyClass().

- In ClassLinker::CreateProxyClass(), insert a proxy class into the
class table before creating ArtFields for it (and update it later in
LinkClass()) because the field roots (ArtField::declaring_class_)
won't be updated by GC unless the class is in the class table. If GC
happens before they are updated by FixupTemporaryDeclaringClass()
from LinkClass(), FixupTemporaryDeclaringClass() may not update the
field roots correctly because the old class may already be moved but
the fields roots may not. Reduce a window of time where the fields
roots could be stale.

- In ClassLinker::LinkClass(), directly wrap a new class in a handle
to avoid a window of time where new_class may be potentially stale.

- Print more diagnostic info about the holder of the field upon a mark
sweep invalid ref crash.

- Add an additional sanity check in Field::GetArtField().

Bug: 20557050

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

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

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

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

Bug: 20944228

(cherry picked from commit 0de1133ba600f299b3d67938f650720d9f859eb2)

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

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

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

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

Bug: 20944228
Change-Id: I59119f3468adb27ab1d6026f2cefbebbd814224c
b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188 24-Apr-2015 Andreas Gampe <agampe@google.com> ART: Check for duplicate classes when loading oat files

Oat files are usually produced standalone, and the compilers take
advantage of any information they get. It is thus possible that
when compile-time and runtime class-path are not the same, classes
are resolved differently and optimized code is incorrect.

This is a very conservative check, scanning the complete class tables
of dex files. In case any duplicate class is found, the new oat file
will be rejected and the original dex files will be used in interpreted
mode.

A possible refinement to this is actual tracking of the compile-time
class-path instead. That is however significantly complicated by the
DexFile API and the non-standard uses it allows.

An alternative for both optimized code and correct resolution is
native multidex. Apps should switch to multidex and benefit from
the optimization as well as the shift of all compile time to install
time. Split APKs are currently compiled separately, but it is a goal
to change that install flow to simulated multidex.

Change-Id: Ib9e0db5091e060e3bb2c0e5e6c007430becbfc21
bfdcdc1e2c0af34aeaf7b5b4d499975e0c3157be 23-Apr-2015 Andreas Gampe <agampe@google.com> ART: Fix re-throwing failures of non-convention errors

While it is convention that Throwable subclasses should have a
constructor with a String argument, that is not rigorously enforced.
So if a static initializer throws an error that omits that
constructor, we must not provide a message when trying to throw
again.

Bug: 20495321
Bug: 20497840
Change-Id: Ia4334fa24223750f90a8f2732f1eb1e738575e8d
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
fc58af45e342ba9e18bbdf597f205a58ec731658 17-Apr-2015 Mathieu Chartier <mathieuc@google.com> Add AbstractMethod, Constructor, Method

Moves functionality to ART from libcore. Precursor to moving
ArtMethods to native. Mostly performance improvements.

N5 perf before (irrelevant results removed):
Class_getConstructor 962.87 ===========
Class_getDeclaredMethod 2394.37 ============================
Class_getMethod 2509.20 ==============================
Class_newInstance 1999.81 =======================
Method_invokeI 1439.02 =================
Method_invokePreBoxedI 1415.82 ================
Method_invokeStaticI 1456.24 =================
Method_invokeStaticPreBoxedI 1427.32 =================
Method_invokeStaticV 814.47 =========
Method_invokeV 816.56 =========
After:
benchmark ns linear runtime
Class_getConstructor 1302.04 ================
Class_getDeclaredMethod 1459.01 ==================
Class_getMethod 1560.40 ===================
Class_newInstance 2029.94 =========================
Method_invokeI 1312.89 ================
Method_invokePreBoxedI 1255.01 ===============
Method_invokeStaticI 1289.13 ===============
Method_invokeStaticPreBoxedI 1196.52 ==============
Method_invokeStaticV 790.82 =========
Method_invokeV 791.73 =========

Performance improvements are more than just fixing regressions introduced
in: http://android-review.googlesource.com/#/c/146069/

Bug: 19264997

Change-Id: Ife79c469fdb09f30e3aefcfc3e0ce5ed32303fce
f865ea9557e6fe017caf99832dc3adf9fadbf86f 14-Apr-2015 Andreas Gampe <agampe@google.com> ART: Make the PathClassLoader fast-path recursive

Allow an arbitrary nesting of path class-loaders. This will also
handle the fake java.lang.BootClassLoader as a class-loader object
correctly (which is of some importance to compile-time initialization).

Bug: 19781184
Bug: 19542228
Change-Id: I61f0249cf4ec8df08a83ccbd29bcf067619c28c0
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
bb87e0f1a52de656bc77cb01cb887e51a0e5198b 03-Apr-2015 Mathieu Chartier <mathieuc@google.com> Refactor and improve GC root handling

Changed GcRoot to use compressed references. Changed root visiting to
use virtual functions instead of function pointers. Changed root visting
interface to be an array of roots instead of a single root at a time.
Added buffered root marking helper to avoid dispatch overhead.

Root marking seems a bit faster on EvaluateAndApplyChanges due to batch
marking. Pause times unaffected.

Mips64 is untested but might work, maybe.

Before:
MarkConcurrentRoots: Sum: 67.678ms 99% C.I. 2us-664.999us Avg: 161.138us Max: 671us

After:
MarkConcurrentRoots: Sum: 54.806ms 99% C.I. 2us-499.986us Avg: 136.333us Max: 602us

Bug: 19264997

Change-Id: I0a71ebb5928f205b9b3f7945b25db6489d5657ca
07b3c2351bb527ea91c084dc19434600af9ae66b 01-Apr-2015 Richard Uhler <ruhler@google.com> Store OatDexFile instead of OatFile in DexFile.

This requires moving OatDexFile out of the OatFile class so that
a forward class declaration can be used for OatDexFile.

Bug: 19071355
Change-Id: Ibda85b78d0577e9e81073090616fc0f2fa526be3
daaf3265806eb2eadb2e03302bd68022fab5ca28 24-Mar-2015 Mathieu Chartier <mathieuc@google.com> Add AccessibleObject and Field to mirror

Main motivation is to remove all the functionality / field access on
java side to ArtField. Also comes with some reflection speedups /
slowdowns.

Summary results:
getDeclaredField/getField are slower mostly due to JNI overhead.
However, there is a large speedup in getInt, setInt,
GetInstanceField, and GetStaticField.

Before timings (N5 --compiler-filter=everything):

benchmark ns linear runtime
Class_getDeclaredField 782.86 ===
Class_getField 832.77 ===
Field_getInt 160.17 =
Field_setInt 195.88 =
GetInstanceField 3214.38 ==============
GetStaticField 6809.49 ==============================

After:
Class_getDeclaredField 1068.15 ============
Class_getField 1180.00 ==============
Field_getInt 121.85 =
Field_setInt 139.98 =
GetInstanceField 1986.15 =======================
GetStaticField 2523.63 ==============================

Bug: 19264997

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

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

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

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

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

Bug: 19781184

Change-Id: I7f36af12dd7852d21281110a25c119e8c0669c1d
47f867a0ae34d743f6159c2261e5b11e39693e15 18-Mar-2015 Mathieu Chartier <mathieuc@google.com> Clean up hash set

Added vertical whitespace, const iterators, made some functions
const.

Change-Id: I188dc0384a98d6dae2822f0ac38b740f2356c23d
66d874d96d5699bb090c59f47a5a528956ca053e 15-Jan-2015 Richard Uhler <ruhler@google.com> Create OatFileAssistant class for assisting with oat files.

The oat file assistant is used for determining whether dex2oat or
patchoat is needed, for running dex2oat or patchoat as needed to make
an oat file up to date, and to load dex files associated with a given
dex location.

The introduction of the OatFileAssistant class is meant to clean up and
consolidate code related to the management of oat files that was
duplicated and spread across dalvik_system_DexFile.cc and
class_linker.cc.

Bug: 11301553
Change-Id: I0c16027b9bae4570c2c50faa9c14f581c0cbafb8
7f418db815f0eaef5b2f43e1f06fb8773a415494 26-Nov-2014 Sebastien Hertz <shertz@google.com> JDWP: fix breakpoint for method in the image

When we set a breakpoint in a compiled method, we deoptimize it by
changing its entrypoint so it is executed with the interpreter.
However, methods in the image can be called with their direct code
pointer, ignoring the updated entrypoint. In that case, the method
is not executed with the interpreter and we miss the breakpoint.

This CL avoids that situation by forcing a full deoptimization so
everything runs with the interpreter. However, if the image has been
compiled in PIC mode, we keep using selective deoptimization because
direct code pointer is not used in this mode.

Bug: 17965285

(cherry picked from commit 6963e44331258b131bcc0599b868ba15902d6d22)

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

Bug: 18809837
Change-Id: Ie571eae8fc19ee9207390cff5c7e2a38071b126a
956af0f0cb05422e38c1d22cbef309d16b8a1a12 11-Dec-2014 Elliott Hughes <enh@google.com> Remove portable.

Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
a89d7ed6f091ac495cd43560ece6988776d14d61 05-Dec-2014 Mathieu Chartier <mathieuc@google.com> Add pointer size logic to InitFromImageInterpretOnly

Previously we didn't have this logic which broke dex2oat if passed
--runtime-option -Xint flag.

Also we now no longer call InitFromImageInterpretOnlyCallback if
we are the compiler.

Bug: 18631640
Change-Id: Ie84fceeb85cabeeec7a5fedefd73dd919cca8e5e
6963e44331258b131bcc0599b868ba15902d6d22 26-Nov-2014 Sebastien Hertz <shertz@google.com> JDWP: fix breakpoint for method in the image

When we set a breakpoint in a compiled method, we deoptimize it by
changing its entrypoint so it is executed with the interpreter.
However, methods in the image can be called with their direct code
pointer, ignoring the updated entrypoint. In that case, the method
is not executed with the interpreter and we miss the breakpoint.

This CL avoids that situation by forcing a full deoptimization so
everything runs with the interpreter. However, if the image has been
compiled in PIC mode, we keep using selective deoptimization because
direct code pointer is not used in this mode.

Bug: 17965285
Change-Id: Icaf8cbb7fe9ad01d36f7378c59d50d9ce42ae57f
72267f9b0cf19afae278d8a2f272f3038b999c33 02-Dec-2014 Sebastien Hertz <shertz@google.com> Fix build

Fixes bad merge with duplicated method.

Change-Id: I3059f4d5c0efcca67c4bbf166e4f5a19f8b0c9c1
f2134f684923454e00c8ca7675b431a8538131bc 17-Nov-2014 Sebastien Hertz <shertz@google.com> JDWP: only deoptimize when it is required

We don't need to deoptimize anything when we forced the use of the
interpreter (-Xint). In this case, no compiled code is executed
(except native methods which are not concerned by deoptimization).
Therefore we even don't need to enable/disable deoptimization support
in instrumentation.

We also don't need to deoptimize a method that hasn't been compiled.
Since it will run with interpreter, there is no point deoptimizing
it. However this method may be inlined in a compiled caller method
so we still need to deoptimize everything in this case.

This CL updates breakpoint support by storing the required kind of
deoptimization for a particular method. There are 3 cases:
- kNothing: the method does not require deoptimization.
- kSelectiveDeoptimization: the method needs to be deoptimized.
- kFullDeoptimization: we must deoptimize everythinig.
When uninstalling a breakpoint, we need to do the reverse operation.

Also fixes the SanityCheckExistingBreakpoints function to control
breakpoints related to the given method only and adds extra verbose
ilogs when choosing the appropriate deoptimization kind.

Includes a partial cherry-pick of commit
87553c9fa1298ffb40127b2bb6413859fd3f79df to use method
ClassLinker::GetOatMethodQuickCodeFor.

Bug: 18407046

(cherry picked from commit f3928794a10516e2ac0ffe2686a10891788d4b9c)

Change-Id: I50853cc5fc5c52650485785a1198d35ea0f7fb8e
3242729362b74d22f11d8bc7b4800ba0a8695df6 19-Nov-2014 Ian Rogers <irogers@google.com> Avoid JNI call with pending OOME.

If EnsureResolved fails with an exception then FindClassInPathClassLoader may
fall-through to a call to NewStringUTF with a pending exception.
Bug: 15446488

Change-Id: I007f7bee7c50aa588d0b1c776da67a38314dc897
2d7210188805292e463be4bcf7a133b654d7e0ea 10-Nov-2014 Mathieu Chartier <mathieuc@google.com> Change 64 bit ArtMethod fields to be pointer sized

Changed the 64 bit entrypoint and gc map fields in ArtMethod to be
pointer sized. This saves a large amount of memory on 32 bit systems.
Reduces ArtMethod size by 16 bytes on 32 bit.

Total number of ArtMethod on low memory mako: 169957
Image size: 49203 methods -> 787248 image size reduction.
Zygote space size: 1070 methods -> 17120 size reduction.
App methods: ~120k -> 2 MB savings.

Savings per app on low memory mako: 125K+ per app
(less active apps -> more image methods per app).

Savings depend on how often the shared methods are on dirty pages vs
shared.

TODO in another CL, delete gc map field from ArtMethod since we
should be able to get it from the Oat method header.

Bug: 17643507

Change-Id: Ie9508f05907a9f693882d4d32a564460bf273ee8

(cherry picked from commit e832e64a7e82d7f72aedbd7d798fb929d458ee8f)
e832e64a7e82d7f72aedbd7d798fb929d458ee8f 10-Nov-2014 Mathieu Chartier <mathieuc@google.com> Change 64 bit ArtMethod fields to be pointer sized

Changed the 64 bit entrypoint and gc map fields in ArtMethod to be
pointer sized. This saves a large amount of memory on 32 bit systems.
Reduces ArtMethod size by 16 bytes on 32 bit.

Total number of ArtMethod on low memory mako: 169957
Image size: 49203 methods -> 787248 image size reduction.
Zygote space size: 1070 methods -> 17120 size reduction.
App methods: ~120k -> 2 MB savings.

Savings per app on low memory mako: 125K+ per app
(less active apps -> more image methods per app).

Savings depend on how often the shared methods are on dirty pages vs
shared.

TODO in another CL, delete gc map field from ArtMethod since we
should be able to get it from the Oat method header.

Bug: 17643507

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

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

(cherry-picked from AOSP master
7ba649636c4475c3992fa15a57acd2546d69ff38)

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

(cherry picked from commit d7392faea80acb5d73a027bb384e3222bc2c2e43)

Change-Id: If5f6cf13f4c7ecb6038415e68fbb0ae9cee5ec60
e7c9a8c2b8481aafbc6af4ce6229bd361ba24742 07-Nov-2014 Mathieu Chartier <mathieuc@google.com> Add hash map, reduce excessive hashing

Changed the class def index to use a HashMap instead of unordered_map
so that we can use FindWithHash to reduce how often we need to compute
hashes.

Fixed a bug in ClassLinker::UpdateClass where we didn't properly
handle classes with the same descriptor but different class loaders.
Introduced by previous CL.

Before (fb launch):
1.74% art::ComputeModifiedUtf8Hash(char const*)

After:
0.95% art::ComputeModifiedUtf8Hash(char const*)

Bug: 18054905
Bug: 16828525

Change-Id: Iba2ee37c9837289e0ea187800ba4af322225a994

(cherry picked from commit 564ff985184737977aa26c485d0c1a413e530705)
564ff985184737977aa26c485d0c1a413e530705 07-Nov-2014 Mathieu Chartier <mathieuc@google.com> Add hash map, reduce excessive hashing

Changed the class def index to use a HashMap instead of unordered_map
so that we can use FindWithHash to reduce how often we need to compute
hashes.

Fixed a bug in ClassLinker::UpdateClass where we didn't properly
handle classes with the same descriptor but different class loaders.
Introduced by previous CL.

Before (fb launch):
1.74% art::ComputeModifiedUtf8Hash(char const*)

After:
0.95% art::ComputeModifiedUtf8Hash(char const*)

Bug: 18054905
Bug: 16828525

Change-Id: Iba2ee37c9837289e0ea187800ba4af322225a994
c2e20629c7dfdb0f679fa30c14b41fe68588697f 03-Nov-2014 Mathieu Chartier <mathieuc@google.com> Add hash set

More memory efficient than libcxx since we do not box the values.

Change intern table to use new hash set. Clean up intern table by
removing const casts and deleting unnecessary code.

Changed the class linker to use a hash set, also added a pre-zygote
class table.

5 samples of:
adb shell stop && adb shell start && sleep 60 && adb shell dumpsys meminfo
Before:
165929 kB: Native
175859 kB: Native
168434 kB: Native
166559 kB: Native
169958 kB: Native

After:
160972 kB: Native
159439 kB: Native
157204 kB: Native
165093 kB: Native
163039 kB: Native

TODO: Add HashTable which is implemented by using a HashSet.
TODO: Use for DexFile::find_class_def_misses_.
TODO: Investigate using mem maps instead of native heap.

Bug: 17808975

Change-Id: I93e376cf6eb9628cf52f4aefdadb6157acfb799a

(cherry picked from commit e05d1d5fd86867afc7513b1c546375dba11eee50)
e05d1d5fd86867afc7513b1c546375dba11eee50 03-Nov-2014 Mathieu Chartier <mathieuc@google.com> Add hash set

More memory efficient than libcxx since we do not box the values.

Change intern table to use new hash set. Clean up intern table by
removing const casts and deleting unnecessary code.

Changed the class linker to use a hash set, also added a pre-zygote
class table.

5 samples of:
adb shell stop && adb shell start && sleep 60 && adb shell dumpsys meminfo
Before:
165929 kB: Native
175859 kB: Native
168434 kB: Native
166559 kB: Native
169958 kB: Native

After:
160972 kB: Native
159439 kB: Native
157204 kB: Native
165093 kB: Native
163039 kB: Native

TODO: Add HashTable which is implemented by using a HashSet.
TODO: Use for DexFile::find_class_def_misses_.
TODO: Investigate using mem maps instead of native heap.

Bug: 17808975

Change-Id: I93e376cf6eb9628cf52f4aefdadb6157acfb799a
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
d7392faea80acb5d73a027bb384e3222bc2c2e43 23-Oct-2014 Andreas Gampe <agampe@google.com> ART: Add pic flag to oat header store

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

(cherry-picked from AOSP master
7ba649636c4475c3992fa15a57acd2546d69ff38)

Bug: 18035729
Signed-off-by: Igor Murashkin <iam@google.com>
Change-Id: Ie1f1ef37125386a968228033d1e2bec565315510
7ba649636c4475c3992fa15a57acd2546d69ff38 23-Oct-2014 Andreas Gampe <agampe@google.com> ART: Add pic flag to oat header store

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

Change-Id: Ie1f1ef37125386a968228033d1e2bec565315510
2d2621a1463d2f3f03fa73503fa42e43657cdcfc 24-Oct-2014 Mathieu Chartier <mathieuc@google.com> Optimize method linking

Added more inlining, removed imt array allocation and replaced it
with a handle scope. Removed some un-necessary handle scopes.

Added logic to base interface method tables from the superclass so
that we dont need to reconstruct for every interface (large win).

Facebook launch Dalvik KK MR2:
TotalTime: 3165
TotalTime: 3652
TotalTime: 3143
TotalTime: 3298
TotalTime: 3212
TotalTime: 3211

Facebook launch TOT before:
WaitTime: 3702
WaitTime: 3616
WaitTime: 3616
WaitTime: 3687
WaitTime: 3742
WaitTime: 3767

After optimizations:
WaitTime: 2903
WaitTime: 2953
WaitTime: 2918
WaitTime: 2940
WaitTime: 2879
WaitTime: 2792

LinkInterfaceMethods no longer one of the hottest methods, new list:
4.73% art::ClassLinker::LinkVirtualMethods(art::Thread*, art::Handle<art::mirror::Class>)
3.07% art::DexFile::FindClassDef(char const*) const
2.94% art::mirror::Class::FindDeclaredStaticField(art::mirror::DexCache const*, unsigned int)
2.90% art::DexFile::FindStringId(char const*) const

Bug: 18054905
Bug: 16828525

(cherry picked from commit 1fb463e42cf1d67595cff66d19c0f99e3046f4c4)

Change-Id: I27cc70178fd3655fbe5a3178887fcba189d21321
1fb463e42cf1d67595cff66d19c0f99e3046f4c4 24-Oct-2014 Mathieu Chartier <mathieuc@google.com> Optimize method linking

Added more inlining, removed imt array allocation and replaced it
with a handle scope. Removed some un-necessary handle scopes.

Added logic to base interface method tables from the superclass so
that we dont need to reconstruct for every interface (large win).

Facebook launch Dalvik KK MR2:
TotalTime: 3165
TotalTime: 3652
TotalTime: 3143
TotalTime: 3298
TotalTime: 3212
TotalTime: 3211

Facebook launch TOT before:
WaitTime: 3702
WaitTime: 3616
WaitTime: 3616
WaitTime: 3687
WaitTime: 3742
WaitTime: 3767

After optimizations:
WaitTime: 2903
WaitTime: 2953
WaitTime: 2918
WaitTime: 2940
WaitTime: 2879
WaitTime: 2792

LinkInterfaceMethods no longer one of the hottest methods, new list:
4.73% art::ClassLinker::LinkVirtualMethods(art::Thread*, art::Handle<art::mirror::Class>)
3.07% art::DexFile::FindClassDef(char const*) const
2.94% art::mirror::Class::FindDeclaredStaticField(art::mirror::DexCache const*, unsigned int)
2.90% art::DexFile::FindStringId(char const*) const

Bug: 18054905
Bug: 16828525

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

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

(cherry picked from commit 6f3dbbadf4ce66982eb3d400e0a74cb73eb034f3)

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

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

Change-Id: I5f4b49e88c3b02a79f9bee04f83395146ed7be23
13735955f39b3b304c37d2b2840663c131262c18 08-Oct-2014 Ian Rogers <irogers@google.com> stdint types all the way!

Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
cdc1aaffabbdf417d29b203b2cd2763ed2d623f8 09-Oct-2014 Ian Rogers <irogers@google.com> Simplify instance reference offsets.

Don't encode Object's class. Use trailing rather than leading zeroes to give
offset position.

Change-Id: I1ae74e7a01f63696429644adf81cdf6ee58832fe
c8ccf68b805c92674545f63e0341ba47e8d9701c 30-Sep-2014 Andreas Gampe <agampe@google.com> ART: Fix some -Wpedantic errors

Remove extra semicolons.

Dollar signs in C++ identifiers are an extension.

Named variadic macros are an extension.

Binary literals are a C++14 feature.

Enum re-declarations are not allowed.

Overflow.

Change-Id: I7d16b2217b2ef2959ca69de84eaecc754517714a
63bc11efaac0c041e849ab401f9fc368631a00f5 18-Sep-2014 Ian Rogers <irogers@google.com> DO NOT MERGE. Only have a portable entrypoint in portable builds.

Bug: 16214885

Change-Id: Iff7b7415efdbdabd7e6020e221a540f6a774c852
5a4b8a236030460651a3136397d23ca6744e7eb7 11-Sep-2014 Andreas Gampe <agampe@google.com> ART: Rename Handle hierarchy

Bring the names in line with normal OO principles: ConstHandle
becomes Handle, and Handle becomes MutableHandle.

Change-Id: I0f018eb7ba28bc422e3a23dd73a6cbe6fc2d2044
7b078e8c04f3e1451dbdd18543c8b9692b5b067e 10-Sep-2014 Ian Rogers <irogers@google.com> Compile time performance improvements focusing on interpret-only.

Reduce virtual method dispatch in the method verifier and make more code
inline-able.
Add a StringPiece with const char* equality operator to avoid redundant
StringPieces and strlens.
Remove back link from register line to verifier and pass as argument to reduce
size of RegisterLine.
Remove instruction length from instruction flags and compute from the
instruction, again to reduce size.
Add suspend checks to resolve and verify to allow for more easy monitor
inflation and reduce contention on Locks::thread_list_suspend_thread_lock_.
Change ThrowEarlierClassFailure to throw pre-allocated exception.
Avoid calls to Thread::Current() by passing self.
Template specialize IsValidClassName.
Make ANR reporting with SIGQUIT run using checkpoints rather than suspending
all threads. This makes the stack/lock analysis less lock error prone.
Extra Barrier assertions and condition variable time out is now returned as a
boolean both from Barrier and ConditionVariable::Wait.

2 threaded host x86-64 interpret-only numbers from 341 samples:
Before change: Avg 176.137ms 99% CI 3.468ms to 1060.770ms
After change: Avg 139.163% 99% CI 3.027ms to 838.257ms
Reduction in average compile time after change is 20.9%.
Slow-down without change is 26.5%.

Bug: 17471626 - Fix bug where RegTypeCache::JavaLangObject/String/Class/Throwable
could return unresolved type when class loading is disabled.
Bug: 17398101

Change-Id: Id59ce3cc520701c6ecf612f7152498107bc40684
ab0ed82ff64ba5a751dcc0a38d0e0c41c53dc923 11-Sep-2014 Mathieu Chartier <mathieuc@google.com> Add fast path to VMClassLoader.findLoadedClass

VMClassLoader.findLoadedClass now calls FindClassInPathClassLoader
as a fast path. Exclusive time results (trace view maps launch):

Before:
nativeFillInStackTrace 1.4%
defineClassNative 1.2%
findLoadedClass 0.2%

After:
nativeFillInStackTrace 0.5%
defineClassNative 0.0%
findLoadedClass 0.9%

(cherry picked from commit 194116c836080de14245a3a7c4617d07b8abf8cf)

Change-Id: I63fd7b4bccb71789e92bd39d1d3f9d0de22535de
194116c836080de14245a3a7c4617d07b8abf8cf 11-Sep-2014 Mathieu Chartier <mathieuc@google.com> Add fast path to VMClassLoader.findLoadedClass

VMClassLoader.findLoadedClass now calls FindClassInPathClassLoader
as a fast path. Exclusive time results (trace view maps launch):

Before:
nativeFillInStackTrace 1.4%
defineClassNative 1.2%
findLoadedClass 0.2%

After:
nativeFillInStackTrace 0.5%
defineClassNative 0.0%
findLoadedClass 0.9%

Bug: 16828525

Change-Id: I1bde48effcd28529778c00ec0fa0dda4e32026a3
48498591b90a8ff7b24b1ce05c220e3bc42013df 11-Sep-2014 Andreas Gampe <agampe@google.com> ART: Correctly make methods preverified

Bug: 16828525

(cherry picked from commit df1532b9ba0cda2d00b78fbdef461f8a6cf8a737)

Change-Id: I66756348b2aa50e41dacca59769b6810a91c73b0
52be37cb506d3313f3fc5b0afdc5d0322b1191e3 11-Sep-2014 Brian Carlstrom <bdc@google.com> Move EnsurePreverifiedMethods to take ConstHandle to reconcile with AOSP

Bug: 16828525
Change-Id: I7b6a3771ed78ef609d84ee539e9d9575deb2476a
df1532b9ba0cda2d00b78fbdef461f8a6cf8a737 11-Sep-2014 Andreas Gampe <agampe@google.com> ART: Correctly make methods preverified

Bug: 16828525
Change-Id: I66756348b2aa50e41dacca59769b6810a91c73b0
faff0f05fef90577c9744505555675185832aacd 10-Sep-2014 Mingyao Yang <mingyao@google.com> Remove reference_static_offsets used for iterating through class static fields.

Since static fields are contiguous in class object and there is no need to
traverse super classes, it's not meaningful to use reference_static_offsets.
Also especially with embedded vtable/imt, static field offset can't be encoded
with an unsigned integer anyway.

A corresponding change is made to Class.java to remove the member field.

Bug: 16236588
Change-Id: I1fde3cd9efce884945876f0658c63d992164fd94
be4e64303cc66bda0a12eaab835caa0bcfda3cd9 05-Sep-2014 Vladimir Marko <vmarko@google.com> Improve dex location canonicalization-related performance.

Eagerly add canonical dex file locations to the OatFile's
primary lookup map in Setup(). This moves the boot.oat work
from every app startup to the zygote initialization. Since
we always ended up initializing the canonical location map
anyway due to the way that we're loading dex files, the lazy
initialization didn't save anything.

Clean up dex file name canonicalization to make sure we
free() the memory returned by realpath() rather than using
std::unique_ptr<> with the default deleter.

Avoid some unnecessary duplicate OatDexFile lookups.

Bug: 16828525
Bug: 17346103

(cherry picked from commit aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4)

Change-Id: Icc4b14ebe903282ca91ce24e33a6d7c75dff991c
aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4 05-Sep-2014 Vladimir Marko <vmarko@google.com> Improve dex location canonicalization-related performance.

Eagerly add canonical dex file locations to the OatFile's
primary lookup map in Setup(). This moves the boot.oat work
from every app startup to the zygote initialization. Since
we always ended up initializing the canonical location map
anyway due to the way that we're loading dex files, the lazy
initialization didn't save anything.

Clean up dex file name canonicalization to make sure we
free() the memory returned by realpath() rather than using
std::unique_ptr<> with the default deleter.

Avoid some unnecessary duplicate OatDexFile lookups.

Bug: 16828525
Bug: 17346103
Change-Id: Id8fbc8992f62996138eb2006a0046c6529747c09
ca0c8d3f81cdee58bd9a70c0fd26f79917dff3b5 30-Aug-2014 Ian Rogers <irogers@google.com> VisitClassesWithoutClassesLock isn't safe if classes move.

Which they do, so avoid by doing an array allocation.
Also, tidy member variables to the end of ClassLinker.
Remove unnecessary mutable. Tidy and fix a locks required/excluded.

Change-Id: I2404a9e7a1ea997d68ab1206f97d2a20dffbda06
(cherry picked from commit dbf3be0f133c0bdf454f637fee2452dbb5f7c027)
621962a0872bf328dba7eda44061f0f505014cef 02-Sep-2014 Calin Juravle <calin@google.com> Avoid recomputing the dex checksum during class loading

Thread the already computed checksum to VerifyOatAndDexFileChecksums and
LoadMultiDexFilesFromOatFile to avoid recomputing it.

Bug:17346103

(cherry picked from commit ca3459398018360d9968a52eebf727df085caf83)

Change-Id: Ie244efaca55b9e7c814b35feec7fce11fab3856d
ca3459398018360d9968a52eebf727df085caf83 02-Sep-2014 Calin Juravle <calin@google.com> Avoid recomputing the dex checksum during class loading

Thread the already computed checksum to VerifyOatAndDexFileChecksums and
LoadMultiDexFilesFromOatFile to avoid recomputing it.

Bug:17346103
Change-Id: Ifa0c1cad952853751e98cbb3c999631b9909a9f9
dbf3be0f133c0bdf454f637fee2452dbb5f7c027 30-Aug-2014 Ian Rogers <irogers@google.com> VisitClassesWithoutClassesLock isn't safe if classes move.

Which they do, so avoid by doing an array allocation.
Also, tidy member variables to the end of ClassLinker.
Remove unnecessary mutable. Tidy and fix a locks required/excluded.

Change-Id: I2404a9e7a1ea997d68ab1206f97d2a20dffbda06
c0542af3e2170143ba40d89136e284997e16bf64 04-Sep-2014 Ian Rogers <irogers@google.com> Remove abuse of mirror::Object* to reference special values.

Remove kInvalidIndirectRefObject, kClearedJniWeakGlobal and
ObjectRegistry::kInvalidObject. Handle error conditions by passing in or
returning an error value.
GetObjectRefType is simplified to be faster and not return invalid references
that are not expected according to the spec. Adjust check JNI and
jni_internal_test appropriately.
Fix cases in the debugger/JDWP of out arguments being passed by reference.
Bug: 17376993

Change-Id: I3ce8a28c01827e163f4dc288449959464da788b1
79cfc0e93e210e548b45459478a154168d2d8cc2 05-Jun-2014 Ian Rogers <irogers@google.com> Pre-allocate the NoClassDefFoundError to be thrown for boot classes.

Bring over a Dalvik "optimization".
Bug: 12804658
Bug: 16853450
Change-Id: I6419de7bd2ba18d91479cb52489104954f5c4524

(cherry picked from commit 63557459a4098294a9ff44d035241de2966047c0)
cc2f2393e69a9b1425bad1a89f41aaaf8c38f9e2 30-Aug-2014 Ian Rogers <irogers@google.com> Reduce and speed-up class def searches.

Use the class linker for descriptor lookups from the compile driver so that
dex caches are populated.
Reduce the scope of functions for scanning class paths to just the class
linker where they are performed.
If we see more than a threshold number of find class def misses on a dex file
lazily compute an index, so that future lookups are constant time (part of the
collection code is taken from
https://android-review.googlesource.com/#/c/103865/3). Note that we take a lazy
approach so that we don't serialize on loading dex files, this avoids the
reason the index was removed in 8b2c0b9abc3f520495f4387ea040132ba85cae69.
Remove an implicit and unnecessary std::string creation for PrintableString.

Single threaded interpret-only dex2oat performance is improved by roughly 10%.

Bug: 16853450

Change-Id: Icf72df76b0a4328f2a24075e81f4ff267b9401f4
(cherry picked from commit 68b56858367e29461ae290fd797443a1ef6d8005)
63557459a4098294a9ff44d035241de2966047c0 05-Jun-2014 Ian Rogers <irogers@google.com> Pre-allocate the NoClassDefFoundError to be thrown for boot classes.

Bring over a Dalvik "optimization".
Bug: 12804658
Bug: 16853450
Change-Id: I6419de7bd2ba18d91479cb52489104954f5c4524
68b56858367e29461ae290fd797443a1ef6d8005 30-Aug-2014 Ian Rogers <irogers@google.com> Reduce and speed-up class def searches.

Use the class linker for descriptor lookups from the compile driver so that
dex caches are populated.
Reduce the scope of functions for scanning class paths to just the class
linker where they are performed.
If we see more than a threshold number of find class def misses on a dex file
lazily compute an index, so that future lookups are constant time (part of the
collection code is taken from
https://android-review.googlesource.com/#/c/103865/3). Note that we take a lazy
approach so that we don't serialize on loading dex files, this avoids the
reason the index was removed in 8b2c0b9abc3f520495f4387ea040132ba85cae69.
Remove an implicit and unnecessary std::string creation for PrintableString.

Single threaded interpret-only dex2oat performance is improved by roughly 10%.

Bug: 16853450

Change-Id: Icf72df76b0a4328f2a24075e81f4ff267b9401f4
bad0267eaab9d6a522d05469ff90501deefdb88b 25-Aug-2014 Mathieu Chartier <mathieuc@google.com> Add native memory accounting through custom allocator.

Added a custom allocator that lets you pass in a special tag which
specifices where the allocation came from. This is used when
dumping. The performance overhead is low since each allocation only
does a atomic add/sub for each allocation/free.

The measurements are dumped to traces.txt during SIGQUIT.

Example output:
I/art (27274): AllocatorTagHeap active=120 max=120 total=168
I/art (27274): AllocatorTagMonitorList active=1572 max=6240 total=11724
I/art (27274): AllocatorTagClassTable active=185208 max=185208 total=268608
I/art (27274): AllocatorTagInternTable active=430368 max=430368 total=436080
I/art (27274): AllocatorTagMaps active=5616 max=6168 total=34392
I/art (27274): AllocatorTagLOS active=1024 max=1536 total=2044
I/art (27274): AllocatorTagSafeMap active=0 max=51936 total=533688
I/art (27274): AllocatorTagLOSMaps active=144 max=1248 total=5760
I/art (27274): AllocatorTagReferenceTable active=10944 max=11840 total=19136
I/art (27274): AllocatorTagHeapBitmap active=32 max=40 total=56
I/art (27274): AllocatorTagHeapBitmapLOS active=8 max=8 total=8
I/art (27274): AllocatorTagVerifier active=0 max=18844 total=1073156
I/art (27274): AllocatorTagModUnionCardSet active=5300 max=5920 total=56020
I/art (27274): AllocatorTagModUnionReferenceArray active=24864 max=24864 total=24864
I/art (27274): AllocatorTagJNILibrarires active=320 max=320 total=320
I/art (27274): AllocatorTagOatFile active=1400 max=1400 total=5852

Change-Id: Ibb470ef2e9c9a24563bb46422d46a55799704d82

(cherry picked from commit 5369c40f75fdcb1be7a7c06db212ce965c83a164)
5369c40f75fdcb1be7a7c06db212ce965c83a164 25-Aug-2014 Mathieu Chartier <mathieuc@google.com> Add native memory accounting through custom allocator.

Added a custom allocator that lets you pass in a special tag which
specifices where the allocation came from. This is used when
dumping. The performance overhead is low since each allocation only
does a atomic add/sub for each allocation/free.

The measurements are dumped to traces.txt during SIGQUIT.

Example output:
I/art (27274): AllocatorTagHeap active=120 max=120 total=168
I/art (27274): AllocatorTagMonitorList active=1572 max=6240 total=11724
I/art (27274): AllocatorTagClassTable active=185208 max=185208 total=268608
I/art (27274): AllocatorTagInternTable active=430368 max=430368 total=436080
I/art (27274): AllocatorTagMaps active=5616 max=6168 total=34392
I/art (27274): AllocatorTagLOS active=1024 max=1536 total=2044
I/art (27274): AllocatorTagSafeMap active=0 max=51936 total=533688
I/art (27274): AllocatorTagLOSMaps active=144 max=1248 total=5760
I/art (27274): AllocatorTagReferenceTable active=10944 max=11840 total=19136
I/art (27274): AllocatorTagHeapBitmap active=32 max=40 total=56
I/art (27274): AllocatorTagHeapBitmapLOS active=8 max=8 total=8
I/art (27274): AllocatorTagVerifier active=0 max=18844 total=1073156
I/art (27274): AllocatorTagModUnionCardSet active=5300 max=5920 total=56020
I/art (27274): AllocatorTagModUnionReferenceArray active=24864 max=24864 total=24864
I/art (27274): AllocatorTagJNILibrarires active=320 max=320 total=320
I/art (27274): AllocatorTagOatFile active=1400 max=1400 total=5852

Bug: 16238192

Change-Id: Ibb470ef2e9c9a24563bb46422d46a55799704d82
381e4ca3cc9fc6405ff20e1de873a56d78d51923 26-Aug-2014 Fred Shih <ffred@google.com> Filling hole between subclass and superclass.

Subclasses no longer need to be 4-byte aligned at the end. Any gaps
between a superclass and its subclasses will be filled in by halfword
or byte fields if possible.

Refactored the alignment and shuffling methods to use a priority queue
in order to reduce the amount of logic when laying out objects.

Change-Id: Ifed71af534e0c5e77bb14555c44b973fe66df6da
8850011ceffce5de38262169de74e4a41ced50eb 22-Aug-2014 Hiroshi Yamauchi <yamauchi@google.com> Remove an intermediate field array in ClassLinker::InitializeClass.

This improves on CL 105090 by removing the need for the intermediate
field array by iterating two iterators in parallel.

Bug: 12687968
Change-Id: I32d4570948a9d39ccb1c20a02e18b48f15ed0738
37f05ef45e0393de812d51261dc293240c17294d 17-Jul-2014 Fred Shih <ffred@google.com> Reduced memory usage of primitive fields smaller than 4-bytes

Reduced memory used by byte and boolean fields from 4 bytes down to a
single byte and shorts and chars down to two bytes. Fields are now
arranged as Reference followed by decreasing component sizes, with
fields shuffled forward as needed.

Bug: 8135266
Change-Id: I65eaf31ed27e5bd5ba0c7d4606454b720b074752
507e6180ad271eb719c67ce7394852c731d975a5 19-Aug-2014 Alex Light <allight@google.com> Support running without a boot image.

Bug: 17000769

(cherry picked from commit 64ad14dbe2225441fb7734bf6d89358d96692eea)

Change-Id: I6404d5050c8a2f4ee6e70d58532eb25ee9de248e
64ad14dbe2225441fb7734bf6d89358d96692eea 19-Aug-2014 Alex Light <allight@google.com> Support running without a boot image.

Bug: 17000769

Change-Id: I6404d5050c8a2f4ee6e70d58532eb25ee9de248e
bf99f77dda749e2b653e8c45259b1fb56e7bb012 24-Aug-2014 Mathieu Chartier <mathieuc@google.com> Clean up Handle usage.

Prefer using ConstHandle instead of Handle as function arguments
since you can't assign new references to ConstHandle which helps
prevent bugs.

Changed NullHandle to be a ConstHandle so that you can never modify
it to be a non null reference.

Change-Id: I81cb979f6f8d5b49e5614966a2caf28c3701dd4f
67ef46adfb2c4990832e23aebeb9c0582d8519c4 22-Aug-2014 Hiroshi Yamauchi <yamauchi@google.com> Avoid handle-less fields in ClassLinker::InitializeClass()

There were some handle-less fields in a SafeMap across GC points.

Bug: 12687968
Change-Id: Ib8c6527d4e23031f1d0074fa11d8f85499b68340
0a112bbbcd761c749c346bfec0ec39c1ef37a590 14-Aug-2014 Alex Light <allight@google.com> Make apps able to run with a failing patchoat

Bug: 17000769

(cherry picked from commit 9dcc4572949f6a8231a1b4ed859676ba6f411726)

Change-Id: I0a1a4dc7f5d4bb268530840302ecfb1555231e05
9dcc4572949f6a8231a1b4ed859676ba6f411726 14-Aug-2014 Alex Light <allight@google.com> Make apps able to run with a failing patchoat

Bug: 17000769

Change-Id: I0a1a4dc7f5d4bb268530840302ecfb1555231e05
9bdec8839c1a34d09ec3e8916a4bd3a022ac45b6 16-Aug-2014 Hiroshi Yamauchi <yamauchi@google.com> Check that we don't accidentally invoke compiled code when -Xint.

The heap poisoning breakge (b/17018234) would have been detected with
this check.

Bug: 17018234
Change-Id: If4827ea1b02396d41012f0955e55c887387a0565
9c290012b7f505ae1943ab87236f775b97a46e2d 22-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Execute an application even when dex2oat crashes.

Bug: 17000769

(cherry picked from commit 4fcdc94d22a4608e355aa8df36240181149d10e8)

Change-Id: Iccb1fec94fe64ce4c3097510952f275482b86aa9
97b52f89e5e0b52a08d4b9a3953d0973a3cf5636 14-Aug-2014 Ian Rogers <irogers@google.com> Make OatClass and OatMethod immutable once more.

OatClass and OatMethod are representation of disk data and we don't want the
runtime to mutate this.

Change-Id: Id5b8658fd544f5d6e1b9120af134d3644ff1a52c
4fcdc94d22a4608e355aa8df36240181149d10e8 22-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Execute an application even when dex2oat crashes.

Bug: 17000769

Change-Id: Iffeb582862a5e794b6c7364c7ec2368cfd0f2214
345c4b19758703793ed31024cfb79940e2c63b75 18-Jul-2014 Alex Light <allight@google.com> Make system use patchoat to relocate during runtime.

Change dalvik_system_DexFile.cc so that isDexOptNeededInternal will be
able to indicate that a patchoat is required. Change default of relocate
option to be on.

Bug: 15358152

(cherry picked from commit 6e183f2e973a20f2eaca135c240908e1bf98c5d0)

Change-Id: Ib21f4f41b6cbf18094e3ca1a30d65a3b197b71b0
6e183f2e973a20f2eaca135c240908e1bf98c5d0 18-Jul-2014 Alex Light <allight@google.com> Make system use patchoat to relocate during runtime.

Change dalvik_system_DexFile.cc so that isDexOptNeededInternal will be
able to indicate that a patchoat is required. Change default of relocate
option to be on.

Bug: 15358152

Change-Id: Ibe92d8b55a24bbf718b0416a21b76e5df7a2de26
94f7b49578b6aaa80de8ffed230648d601393905 23-Jul-2014 Hiroshi Yamauchi <yamauchi@google.com> Add GcRoot to clean up and enforce read barriers.

Introduce a value-type wrapper around Object* for GC roots so that 1)
we won't have to directly add the read barrier code in many places and
2) we can avoid accidentally bypassing/missing read barriers on GC
roots (the GcRoot interface ensures that the read barrier is executed
on a read).

The jdwp test passed.

Bug: 12687968
Change-Id: Ib167c7c325b3c7e3900133578815f04d219972a1
b76cac637691c29daa9c44e493b5bc26346ed116 23-Jul-2014 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Disable adding main and non moving spaces to immune region in GSS""

This reverts commit f85c2fb317399ab540854cd7551ac47690366543.
a59dd80f9f48cb750d329d4d4af2d99d72b484d1 03-Jul-2014 Alex Light <allight@google.com> Runtime can now be set to require relocation

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

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

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

Bug: 15358152

Change-Id: I91166c62dd1ab80e5cbcb7883a2cd0d56afca32d
f85c2fb317399ab540854cd7551ac47690366543 22-Jul-2014 Mathieu Chartier <mathieuc@google.com> Revert "Disable adding main and non moving spaces to immune region in GSS"

Bug: 16399257

This reverts commit be0562fb14e6754ee932b8d9c97e2a6df3a91119.

Change-Id: I29e07a8fa1e972990e5bf1ddf8c9a3538ea5f9cf
39c86bc9de106e3641ecab2374a24e41d0430694 16-Jul-2014 Calin Juravle <calin@google.com> Make ART fail gracefully when it can't update the desired code.

ART was exiting with a fatal error when it couldn't clean an obsolete
file. Relaxing this and failing gracefully preserves the behaviour that
Dalvik had.

Bug: 15313272

(cherry picked from commit c54aea7f4acd1a32bb298d43c20e3e0217638926)

Change-Id: I862a8925a0edd6370e94af8fa984a64099240029
be0562fb14e6754ee932b8d9c97e2a6df3a91119 14-Jul-2014 Mathieu Chartier <mathieuc@google.com> Disable adding main and non moving spaces to immune region in GSS

Disabled adding the main and non moving space to the immune region.
This will enable us to recycle bump pointer spaces for malloc space
-> malloc space compaction as well as collector transitions.

Also added logic for falling back to the non moving space, we may
copy objects there.

Refactored mod union table logic into MarkReachableObjects.

No measurable performance benefit or regression.

Bug: 14059466
Bug: 16291259

(cherry picked from commit 4c13a3ff475f206c4d0a86ee2595c45392fd942f)

Change-Id: I858b4fbddca888e164052ad247565a0bdbea68b5
4c13a3ff475f206c4d0a86ee2595c45392fd942f 14-Jul-2014 Mathieu Chartier <mathieuc@google.com> Disable adding main and non moving spaces to immune region in GSS

Disabled adding the main and non moving space to the immune region.
This will enable us to recycle bump pointer spaces for malloc space
-> malloc space compaction as well as collector transitions.

Also added logic for falling back to the non moving space, we may
copy objects there.

Refactored mod union table logic into MarkReachableObjects.

No measurable performance benefit or regression.

Bug: 14059466
Bug: 16291259

Change-Id: If663d9fdbde943b988173b7f6ac844e5f78a0327
c54aea7f4acd1a32bb298d43c20e3e0217638926 16-Jul-2014 Calin Juravle <calin@google.com> Make ART fail gracefully when it can't update the desired code.

ART was exiting with a fatal error when it couldn't clean an obsolete
file. Relaxing this and failing gracefully preserves the behaviour that
Dalvik had.

Bug: 15313272
Change-Id: I8d0d6d374c90d2a434909dd4ae56f0799f30134d
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
833a48501d560c9fa7fc78ef619888138c2d374f 22-May-2014 Andreas Gampe <agampe@google.com> ART: Native support for multidex

Native support for zip files with multiple classesX.dex.

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

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

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

Change-Id: I0de107e1369cbc94416c544aca3b17525c9eac8b
e9e3e697f0c426132bee10aaa6aee9107d2d7dc6 24-Jun-2014 Hiroshi Yamauchi <yamauchi@google.com> Add more read barriers to the class linker.

This change makes it possible to concurrently scan the remaining roots
in the class linker (the non-class-table roots that are visited by
ClassLinker::VisitRoots()) by adding read barriers.

Bug: 12687968
Change-Id: I66fecf7a303eee7537429e018f38da8270b18c67
52e4b43d62896b56f8c2bd041e528472bb4a0d8d 10-Jun-2014 Mathieu Chartier <mathieuc@google.com> Add mark compact collector.

The mark compact collector is a 4 phase collection, doing a normal
full mark_sweep, calculating forwarding addresses of objects in the
from space, updating references of objects in the from space, and
moving the objects in the from space.

Support is diabled by default since it needs to have non movable
classes and field arrays. Performance numbers is around 50% as fast.

The main advantage that this has over semispace is that the worst
case memory usage is 50% since we only need one space isntead of two.

TODO: Make field arrays and classes movable. This causes complication
since Object::VisitReferences relies on these, so if we update the
fields of an object but another future object uses this object to
figure out what fields are reference fields it doesn't work.

Bug: 14059466

Change-Id: I661ed3b71ad4dde124ef80312c95696b4a5665a1
a91a4bc1f8960f64c5f7e4616d46e21b8e1bfba2 14-Jun-2014 Hiroshi Yamauchi <yamauchi@google.com> Add read barriers for the class and the intern tables.

Add read barriers for the strong roots in the intern table and the
(strong) roots in the class table to make possible concurrent scanning
of them.

Bug: 12687968
Change-Id: If6edc33a37e65a8494e66dc3b144138b1530367f
bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe 22-May-2014 Mathieu Chartier <mathieuc@google.com> Change MethodHelper to use a Handle.

Added ConstHandle to help prevent errors where you modify the value
stored in the handle of the caller. Also fixed compaction bugs
related to not knowing MethodHelper::GetReturnType can resolve types.
This bug was present in interpreter RETURN_OBJECT.

Bug: 13077697

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

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
b74cd29802f364b4cec88f4913fa38ade26b8fab 29-May-2014 Mathieu Chartier <mathieuc@google.com> Compaction cleanup for FindArrayClass.

We now pass double pointer in to signify that it can cause thread
suspension, this double pointer gets wrapped by a handle if don't
find the array class in the cache.

Change-Id: I43436b6c35597c7252b65d1180baddb5ac4caabb
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
2b7c4d196c8abe32f4ca633534917da9de53c359 19-May-2014 Mathieu Chartier <mathieuc@google.com> Don't get and restore thread state for ScopedFastNativeObjectAccess.

Before we would ensure that we were runnable for fast native object
access. However, these are done when you are already runnable.

Change-Id: Ia4c6e4c83d146fe2a988b37b3133ca46b0f0fa42
2afe49450f2e018f18b5de45428b9174bfd6f196 19-May-2014 Brian Carlstrom <bdc@google.com> Follow up to "Add ISA directory to image and odex pathnames."

Change-Id: I7f08cc3052fbed93a56ccf1ab7675ae8bc129da9
f0972a410a0665dbe32bd96df09a572d69f9f3a3 16-May-2014 Dmitry Petrochenko <dmitry.petrochenko@intel.com> Fix generic jni issue in ArtMethod::GetQuickFrameInfo

The 64-bit host mode fails to start due to incorrect
detection of GetQuickGenericJniTrampoline.
The quick_code is 32-bit and taken from oat file, but
GetQuickGenericJniTrampoline returnf 0x7fffxx (64-bit)
address of trampoline and execution went to incorrect way.

Some clean-up.

Original Author: Dmitry Petrochenko <dmitry.petrochenko@intel.com>
Signed-off-by: Dmitry Petrochenko <dmitry.petrochenko@intel.com>
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
Change-Id: I0952443b2a9f6833ad37ec373837ae208681fad7
0e12bdc49744eb6d5c29b9611a8dbe10bac4cd53 15-May-2014 Brian Carlstrom <bdc@google.com> Add ISA directory to image and odex pathnames.

Bug: 14882223
Bug: 14694978
Change-Id: Ic1b5ae836b8e91ea461dcd4f3da8e38dc3bec00f
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
52f84884433f3875f4b1bc5595b8d5a2d6fb3d99 02-May-2014 Narayan Kamath <narayan@google.com> Prevent spurious dexopts in 32-64 builds.

When we're checking if a file needs to be dexopted, we
need to compare oat file checksums with the image checksum
for the oat file's target instruction set and not the current
runtime's target instruction set.

bug:14475807

Change-Id: Ib44d8e3c6cdf3a37fce6332c694a6602c658e925
b0fa5dc7769c1e054032f39de0a3f6d6dd06f8cf 29-Apr-2014 Ian Rogers <irogers@google.com> Force inlining on trivial accessors.

Make volatility for GetFieldObject a template parameter.
Move some trivial mirror::String routines to a -inl.h.

Bug: 14285442

Change-Id: Ie23b11d4f18cb15a62c3bbb42837a8aaf6b68f92
8a630577ed2d9e9571c3434c505e5de223b23c07 09-Apr-2014 Vladimir Marko <vmarko@google.com> Move mapping table and vmap table offsets to OatMethodHeader.

This change has a libcore/ companion CL
"Remove ArtMethod's quick fields mapping table and vmap table."
https://android-review.googlesource.com/91254

Bug: 11767815
Change-Id: I46ce2067e1ecd915da3890606498e31ffc332813
d3c5bebcb52a67cb06e7ab303eaf45f230c08b60 11-Apr-2014 Vladimir Marko <vmarko@google.com> Avoid allocating OatFile::OatClass on the heap.

Avoid allocating a BitVector for OatFile::OatClass::bitmap_
with kOatClassSomeCompiled methods. That makes the OatClass
copy-constructible as it doesn't own any memory. We use that
in OatFile::OatDexFile::GetOatClass() to return the result
by value thus avoiding one or two heap allocations per call.

Change-Id: Ic7098109028a5b49e39ef626f877de86e732ed18
329d18806792771dfee064203fe27875d79cd53a 08-Apr-2014 Andreas Gampe <agampe@google.com> Better error reporting when loading dex files

Collect all partial error messages and return them as cause
exceptions for the top-level exception returned.

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

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

Change-Id: I72cea8da9a3757b1a0b3acb4081feccb7c6cef90
893263b7d5bc2ca43a91ecb8071867f5134fc60a 04-Mar-2014 Mathieu Chartier <mathieuc@google.com> Avoid marking old class linker and intern table roots during pause.

The new root visiting logic has a concept of a root log which holds
new roots which were added since the start of the GC. This is an
optimization since it lets us only mark these newly added roots
during the pause (or pre-cleaning) since the other roots intern table
and class linker roots were marked concurrently at the start of the
GC.

Before (EvaluateAndApplyChanges):
MarkConcurrentRoots: Sum: 605.193ms
After:
MarkConcurrentRoots: Sum: 271.858ms

This should also reduce pathological GC pauses which used to be able
to happen when the intern table or class linker became "dirty"
during the concurrent GC.

Change-Id: I433fab021f2c339d50c35aaae7161a50a0901dec
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
6fac447555dc94a935b78198479cce645c837b89 26-Feb-2014 Ian Rogers <irogers@google.com> Make allocations report usable size.

Work-in-progress to allow arrays to fill usable size. Bug: 13028925.
Use C++11's override keyword on GCC >= 2.7 to ensure that we override GC and
allocator methods.
Move initial mirror::Class set up into a Functor so that all allocated objects
have non-zero sizes. Use this property to assert that all objects are never
larger than their usable size.
Other bits of GC related clean-up, missing initialization, missing use of
const, hot methods in .cc files, "unimplemented" functions that fail at
runtime in header files, reducing header file includes, move valgrind's space
into its own files, reduce number of array allocation routines.

Change-Id: Id5760041a2d7f94dcaf17ec760f6095ec75dadaa
9837939678bb5dcba178e5fb00ed59b5d14c8d9b 25-Feb-2014 Ian Rogers <irogers@google.com> Avoid std::string allocations for finding an array class.

Introduce ClassLinker::FindArrayClass which performs an array class lookup
given the element/component class. This has a 16 element cache of recently
looked up arrays.
Pass the current thread to ClassLinker Find .. Class routines to avoid calls
to Thread::Current().
Avoid some uses of FindClass in the debugger where WellKnownClasses is a
faster and more compacting GC friendly alternative.

Change-Id: I60e231820b349543a7edb3ceb9cf1ce92db3c843
83c8ee000d525017ead8753fce6bc1020249b96a 28-Jan-2014 Mathieu Chartier <mathieuc@google.com> Add root types and thread id to root visiting.

Enables us to pass the root type and thread id to hprof.

Bug: 12680863
Change-Id: I6a0f1f9e3aa8f9b4033d695818ae7ca3460d67cb
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
60836d5a9bcf8b30984aae4279a4f6233b0bf622 16-Jan-2014 Vladimir Marko <vmarko@google.com> Fix opening oat files that are out of date.

Make sure we're not using an old MAP_PRIVATE mapping of an
OatFile after a forked process modifies the underlying file.

Change-Id: I5c6caaf34272c805e40e95ee690dd948d7406751
08cbf66dc4632913f80f8ac18082c39b7d52c7dd 11-Dec-2013 Brian Carlstrom <bdc@google.com> Do not require classes.dex to support stripped zip files

Change-Id: Ief34c1b559dbebda85d181ae49da7d35446c9b37
c528dba35b5faece51ca658fc008b688f8b690ad 26-Nov-2013 Mathieu Chartier <mathieuc@google.com> Enable moving classes.

Slight reduction in Zygote size, memory savings are in the noise.
Before: Zygote size: 8739224
After: Zygote size: 8733568

Fixed a bug where we didn't set the concurrent start bytes after
switching the allocator from bump pointer to ROSAlloc in the
zygote. This caused excessive memory usage.

Added the method verifiers as roots to fix an issue caused by
RegTypes holding a Class*.

Added logic to clear card table in the SemiSpace collector, this
reduces DalvikOther from ~2400k -> ~1760k when using the SemiSpace
collector.

Added a missing lock to the timing loggers which caused a rare
one time crash in std::set.

Bug: 11771255
Bug: 8499494
Bug: 10802951

Change-Id: I99d2b528cd51c1c5ed7012e3220b3aefded680ae
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
88474b416eb257078e590bf9bc7957cee604a186 24-Oct-2013 Jeff Hao <jeffhao@google.com> Implement Interface Method Tables (IMT).

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

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

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

Change-Id: I80058652e11e7ea63457cc01a0cb48afe1c15543
e810452722ac83b294d1f7aa80bdd88e547d5af0 16-Oct-2013 Brian Carlstrom <bdc@google.com> Preload DexCaches

Bug: 11045348
Change-Id: I6f9c0d11613b6b4933a04ae23dbf4bc7879cea65
756ee4e090bc1e1812b41fb7b4661df601a32ef9 04-Oct-2013 Brian Carlstrom <bdc@google.com> Find OatDexFile by DexFile name and checksum, not just checksum

Bug: 10614658
Change-Id: Ie0b5a34fd396b6299000c37909108c5e7e6ab80f
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
c4621985bdfc2b27494087e5dee65a6d0cc5a632 17-Sep-2013 Mathieu Chartier <mathieuc@google.com> Fix race in root marking.

There was a race which caused the class linker / intern table to not
become dirty after adding a root. We now guard the is dirty flag by
the corresponding locks to prevent this from occuring. This was
causing roots to be occasionally missed.

Also fixes the bug where we occasionally scan more cards than
needed.

Bug: 10626133

Change-Id: I0f6e72d92035ff463954d66988ef610ea0df61be
7dfb28c066159e6cde8181720f0c451a700ef966 22-Aug-2013 Ian Rogers <irogers@google.com> Don't scan image space when starting runtime.

Bug 10432288.
Find Classes and Strings from dex caches lazily rather than when the image is
loaded.
Make class status changes do notifies when there can be waiters.
For Class lookup there's a pathology if we always search dex caches and
so after 1000 failures move all classes into the class table.
Be consistent in using "const char*" for class linker descriptors as this
most easily agrees with the type in the dex file.
Improve the intern run-test so that it has a case of a literal contained in the
image.
Modify image_test to allow any valid lock word rather than expecting 0, ideally
we wouldn't see inflated monitors but we do due to NotifyAll (see bug 6961405).

Change-Id: Ia9bfa748eeccb9b4498784b97c6823141b1f6db8
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
be7149fc2e7cc607937209f2819e3c1d672e2668 20-Aug-2013 Ian Rogers <irogers@google.com> Avoid throwing NoClassDefFoundError at compile time.

Change-Id: I8ba56a8750e1718babcb1f94e0408d89f58ea9b5
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)
b0f871965d588cce066785728fb105248b38bb4a 08-Aug-2013 Dragos Sbirlea <dragoss@google.com> Removed unused friend classes for tests.

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

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