History log of /art/runtime/jit/jit_code_cache.cc
Revision Date Author Comments
b06c2974ea5e17f2fc0763d751a13b3fe660a4b9 25-May-2017 Nicolas Geoffray <ngeoffray@google.com> Flush data cache after updating the JIT table.

Otherwise, other cores could see an incomplete table when executing
the new code.

bug: 37949368
Test: test.py --jit

(cherry picked from commit 352b17af5263b27cad7a1dbf2351f9cb71d6af58)

Change-Id: Ib1e4d2386477cb537b5921bb395e4bcd0ff760b7
60889dcb3fe8e718debaddd6d2fb05a880ed87fa 18-May-2017 Calin Juravle <calin@google.com> Record inline caches only for the strictly hot methods

Warm methods might have incomplete inline caches which could cause
unnecessary deoptimizations.

Test: m test-art-host
Bug: 38426301
Bug: 38412648

(cherry picked from commit a39fd980000d10ee0b3a49555cc8bcbbfacde943)

Change-Id: I12e2c068663e8bb948dcd7ba89d0c1d4c9118153
d0384a7faffcf1dc52a74c1b2a30ab3f36edfb89 16-May-2017 Andreas Gampe <agampe@google.com> ART: Fix iterator invalidation

Erasing an item of a map invalidates the iterator.

(cherry picked from commit 39e673811d73ac09a822d9ee0082bba5d8e8cbad)

Bug: 38324641
Test: m test-art-host
Change-Id: I9f7499eb4a4b49e4fcd6c99d170d9b681adfd9b0
70c94bf292bfb3113b757778fd6760fad81f5f79 10-May-2017 Nicolas Geoffray <ngeoffray@google.com> Use a sentinel when clearing JIT table entries.

This can help diagnosing crashes we see.

bug: 38128052
bug: 37949368
Test: test.py --jit

(cherry picked from commit 6ca115b5fa185a2cc162a453f425efd87d8f38bd)

Change-Id: Ib048f72cef7acfdb15f515c63a2ff0ac8e3744ce
79efadfdd861584f1c47654ade975eae6c43c360 08-May-2017 Nicolas Geoffray <ngeoffray@google.com> Add runtime reasons for deopt.

Currently to help investigate. Also:
1) Log when deoptimization happens (which method and what reason)
2) Trace when deoptimization happens (to make it visible in systrace)

bug:37655083
Test: test-art-host test-art-target

(cherry picked from commit 4e92c3ce7ef354620a785553bbada554fca83a67)

Change-Id: I992398a1038ab61ea0e5106af6b6ad0a3305312e
f6d4668c42933e2f85ddbc94e276c49db4e2b1dd 28-Feb-2017 Nicolas Geoffray <ngeoffray@google.com> Improvements in the Inliner.

- Change from a depth limit to a total number of HInstructions
inlined limit. Remove the dex2oat depth limit argument.
- Add more stats to diagnose reasons for not inlining.
- Clean up logging to easily parse output.

Individual Ritz benchmarks improve from 3 to 10%.

No change in other heuristics. There was already an instruction budget.
Note that the instruction budget is rarely hit in the "apps" I've tried
with.

Compile-times improve from 5 to 15%.
Code size go from 4% increase (Gms) to 1% decrease (Docs).

bug:35724239
test: test-art-host test-art-target

Change-Id: I5a35c4bd826cf21fead77859709553c5b57608d6
cbcedbf9382bc773713cd3552ed96f417bf1daeb 13-Mar-2017 Mathieu Chartier <mathieuc@google.com> Add method info to oat files

The method info data is stored separately from the code info to
reduce oat size by improving deduplication of stack maps.

To reduce code size, this moves the invoke info and inline info
method indices to this table.

Oat size for a large app (arm64): 77746816 -> 74023552 (-4.8%)
Average oat size reduction for golem (arm64): 2%

Repurposed unused SrcMapElem deduping to be for MethodInfo.
TODO: Delete SrcMapElem in a follow up CL.

Bug: 36124906

Test: clean-oat-host && test-art-host-run-test

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

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

Test: m test-art-host-run-test-638-checker-inline-caches
Bug: 32434870
Change-Id: Ifcc27b3cebc79b84617412aaae64a73324151b55
589e71eb71477603c88b14118b2d3a33508c3c79 04-Mar-2017 Calin Juravle <calin@google.com> Encode inline caches with missing types in the profile

Not all runtime types can be encoded in the profile. For example if the
receiver type is in a dex file which is not tracked for profiling its
type cannot be encoded.

Previously we would just skip over these types but that can lead to
encode a polymorphic inline cache when in fact it should be megamorphic.

With this CL, inline caches for which types are missing are marked in
the profile with a special bit, kIsMissingTypesEncoding.

Also, extend profman to understand text lines which specify an inline
cache with missing types.

Test: test-art-host

Bug: 35927981
Bug: 32434870
Change-Id: I34528a39c227f3133771fd4454701c1ddc234f40
3b1a7f40ad69ab5332d13ed0abf0a3a1fa7f2a9e 22-Feb-2017 Nicolas Geoffray <ngeoffray@google.com> Update entrypoint directly when doing JIT code cache GC.

Otherwise, the Instrumentation::UpdateMethodsCode might access
the declaring class while the GC is concurrently processing
references.

bug:35598395
test: run-libcore-tests.sh --mode=host --variant=X64
Change-Id: I0f059b1823e81672d43cf1f7eed64482f8927232
e21806f053c1a001738b121e7f7807f6cb79b97a 22-Feb-2017 Calin Juravle <calin@google.com> Add more comments in GetProfiledMethods

Explain why we are looking in the method dex file for array types.

Test: m test-art-host
Change-Id: Ib94475f79844968591f72f46a2c714f9971778ba
4ca70a3102c10e2e77e97fc3b9180f00304ed29b 22-Feb-2017 Calin Juravle <calin@google.com> Fix handling of array types when extracting the offline inline caches

Test: m test-art-host
regression test is being worked out
Bug: 35621933

Change-Id: If762db76cc0493db8c8babab62035e915b660da5
940eb0c00ef531dd9a0a68dbd61e377832e81eb4 31-Jan-2017 Calin Juravle <calin@google.com> Add inline caches to offline profiles

Add support for inline caches in profiles:
- extract inline caches from the jit cache when the profile saver
queries the hot methods
- bump profile version to support the new data
- add new tests
- inline caches are only supported for same-apk calls (including
multidex)

Test: m art-test-host-gtest-profile_compilation_info_test
Bug: 32434870
Change-Id: I38b4ca0a54568d2224765ff76023baef1b8fd1a2
eee0bd448ec057d3f224895ddb868786758eeb5b 14-Feb-2017 Alex Light <allight@google.com> Revert^6 "Make class redefinition work with native methods on stack."

We were incorrectly trying to obtain the profiling information of a
native method.

This reverts commit 02b2349b1cd2a78e86b1a7542f8330e6c3aaeb35.

Reason for revert: Fixed test failure with jit configurations

Test: ART_TEST_JIT=true mma -j40 test-art-host

Change-Id: Ic7112104aec64e597d2df80db5dc2a505d2cc2dd
b93ce1853e1a28bbd6ca992c5b646aa2d2699892 15-Dec-2016 Kevin Brodsky <kevin.brodsky@linaro.org> Clarify comment on JIT cache flush issue

The original fix (#304947) is needed, but the comment was suggesting a
hardware cause and a link with A53 errata. In all likelihood neither
of these is true, and the issue is actually caused by a kernel issue
affecting many Qualcomm devices (like those using the msm tree).

Change-Id: Ie750e6fd9eb7130982d184c22917b5c3ea4beed0
1ebe4fe1a6cb0835197ee3a848d554b79ca9d367 30-Jan-2017 Alex Light <allight@google.com> Fix creating self-recursive obsolete methods.

We were using recursive loading of the current art method which was
making us miss obsolete methods in some cases.

We could also end up checking the wrong method when walking the stack.

We also add tests for recursive obsolete methods in general.

Bug: 34815470

Test: mma -j40 test-art-host
Test: ART_TEST_JIT=true mma -j40 test-art-host
Change-Id: I522fd4cac4e3f9d35d03b128bad6d6971cfe6c4a
433b79a9130df5f2375b9d3d7518c1f3fb84a467 30-Jan-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Make --debuggable rely on JIT code.""

Fixed by https://android-review.googlesource.com/#/c/330165/

This reverts commit 81356645157af44152c7b7db383596b5cf3479b5.

Change-Id: Ifb74e1cc90ab6dea621f7f54a00b540d6ccd0cf6
81356645157af44152c7b7db383596b5cf3479b5 30-Jan-2017 Vladimir Marko <vmarko@google.com> Revert "Make --debuggable rely on JIT code."

Breaks 137-cfi with ART_TEST_RUN_TEST_DEBUGGABLE=true

This reverts commit a0619e25aacf8b8074132f4951f75fdbcfd42925.

bug: 28769520
Change-Id: Ifd7b8fc7c9b72c0a523fd57c4b1b80edd3547caa
a0619e25aacf8b8074132f4951f75fdbcfd42925 20-Dec-2016 Nicolas Geoffray <ngeoffray@google.com> Make --debuggable rely on JIT code.

Removes -Xfully-deoptable in the process, which was added as a
temporary workaround until this CL.
Partial revert of https://android-review.googlesource.com/#/c/302232/

Makes things consistent with existing infrastructure:

- Parse the --debuggable from the compiler options, just like
--compiler-filter.

- Add DEBUG_JAVA_DEBUGGABLE, passed by the zygote, for debuggable apps.

- Java debuggable now solely relies on JIT for simplicity.

- Debugging under userdebug for non-java-debuggable apps is still
best effort.

Test: test-art-host, jdwp

bug: 28769520
Change-Id: Id0593aacd85b9780da97f20914a50943957c858f
3f3d4d63199e57cb1dccad62d2d3ef69fc170c06 17-Nov-2016 Artem Udovichenko <artem.u@samsung.com> Cache flush/invalidate needs RWX permission

When generating JIT code, perform cache maintenance operations before
removing page write permissions. Errata on some cores require data
flush operations to be followed by data invalidate operations
requiring write permission.

Test: ART_TEST_JIT=true test-art-target on an arm64 device.
bug: 27265969

(cherry picked from commit b18a669259aa6ba08d9ca01b5b32c1aa0417138b)

Change-Id: I53080c664f9e7cfebe25f87cf6a45cd6eb33b281
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
f6abcda293b115a9d7d8a26376ea2dcf2d1dc510 21-Dec-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Revert "Basic obsolete methods support"""

Fails in tracing mode

Bug: 32369913
Bug: 33630159

This reverts commit ce77fc0e7f60a15354bb20c356537cbf8b53b722.

Change-Id: I1bdcf6ad467f2e31f9c5d0c3c987b90a4f5efc69
ce77fc0e7f60a15354bb20c356537cbf8b53b722 15-Dec-2016 Alex Light <allight@google.com> Revert "Revert "Basic obsolete methods support""

This reverts commit b81a9840b44480bfeacd74b8d9f51e06f295411d.

There were 2 issues with the original CL's test 916-obsolete-jit that
caused it to sporadically fail.

First, when checking if we had jitted the function under test in
916-obsolete-jit we failed to check to see if the function 'doCall',
which is used to work-around bugs in our deoptimization & compilation
systems, had also been jitted.

In the case where the 'sayHi' function had been jitted but the
'doCall' function had not we would (correctly) fail to redefine the
'Transform' class since we would not be able to deoptimize the 'sayHi'
function since it is under a quick_to_interpreter_bridge (runtime)
frame.

Secondly, the function Main.isInterpretedFunction was incorrect and
would always return false, regardless of the actual state of the
function. This would cause the test to fail as the
quick_to_interpreter_bridge frame prevented deoptimization of the
obsoleted function. Usually the warm-up period was enough to make sure
the methods were jitted anyway but this was not guaranteed.

Both of these problems become more likely to occur on systems with
more cpu contention such as the buildbots.

Test: stress --cpu 60 &; while ./test/run-test --host --jit 916; do ; done

Reason for revert: Fixed bug in test that was causing failures.

Original Tests:

Test: ./test/run-test --host 914
Test: ./test/run-test --host 915
Test: ./test/run-test --host 916
Test: mma -j40 test-art-host
Test: ART_TEST_JIT=true \
ART_TEST_INTERPRETER=true mma -j40 test-art-host
Test: ./art/tools/run-jdwp-tests.sh --mode=host --variant=X64
Test: ./art/tools/run-jdwp-tests.sh --mode=host --variant=X64 --no-jit

Bug: 32369913
Bug: 33630159

Change-Id: If1a92e47b90965a7dc21c5826185debe62bd1554
ed015acdd0fbb1b837b3f74e8c5f624956189691 15-Dec-2016 Nicolas Geoffray <ngeoffray@google.com> Flush JIT data cache when committing code.

Otherwise, executing compiled code may see old data from
the data cache.

Test: ART_TEST_JIT=true test-art-target on arm/arm64
Test: run-libcore-tests.sh (especially jsr166) on arm/arm64
Change-Id: Id037c68897aa0e9ccacd4c5121f3743fb722c6f3
b81a9840b44480bfeacd74b8d9f51e06f295411d 15-Dec-2016 Alex Light <allight@google.com> Revert "Basic obsolete methods support"

This reverts commit d8936da27b792d1ca02e59c92456a1a53c7b9905.

Reason for revert: Some sort of race in JIT

Change-Id: Ibb4e520bb0721d6d7aa2c841a52eb5baff07740e
d8936da27b792d1ca02e59c92456a1a53c7b9905 29-Nov-2016 Alex Light <allight@google.com> Basic obsolete methods support

Add support for executing obsolete methods following redefinitions.
This support includes methods that have been jitted. This does not add
any additional validity checks to our redefinition functions.

Note using work-arounds to ensure 916 works pending some fixes to the
compiler, deoptimizer, or both.

Test: ./test/run-test --host 914
Test: ./test/run-test --host 915
Test: ./test/run-test --host 916
Test: mma -j40 test-art-host
Test: ART_TEST_JIT=true \
ART_TEST_INTERPRETER=true mma -j40 test-art-host
Test: ./art/tools/run-jdwp-tests.sh --mode=host --variant=X64
Test: ./art/tools/run-jdwp-tests.sh --mode=host --variant=X64 --no-jit

Bug: 32369913
Bug: 33630159

Change-Id: I78ef95f484146f1fb93c37fc50f56575bdab2432
22384aeab988df7fa5ccdc48a668589c5f602c39 12-Dec-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Add kJitTableAddress for HLoadClass.""

This reverts commit d2d5262c8370309e1f2a009f00aafc24f1cf00a0.

Change-Id: I6149d5c7d5df0b0fc5cb646a802a2eea8d01ac08
d2d5262c8370309e1f2a009f00aafc24f1cf00a0 12-Dec-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Add kJitTableAddress for HLoadClass."

One test failure after merge.

This reverts commit 5b12f7973636bfea29da3956a9baa7a6bbe2b666.

Change-Id: I120c49e53274471fc1c82a10d52e99c83f5f85cc
5b12f7973636bfea29da3956a9baa7a6bbe2b666 09-Dec-2016 Nicolas Geoffray <ngeoffray@google.com> Add kJitTableAddress for HLoadClass.

This new kind loads classes from the root table associated with
JIT compiled code.

Also remove kDexCacheAddress, which is replaced by kJitTableAddress.

test: ART_TEST_JIT=true test-art-host-jit test-art-target-jit
Change-Id: Ia23029688d1a60c178bf2ffa7463927c5d5de4d0
f4b94427072a42ee6814aa6e1abc04ced5235355 05-Dec-2016 Nicolas Geoffray <ngeoffray@google.com> Set the root table size when allocating.

In order to deallocate it at any point.

test: ART_TEST_JIT=true m test-art-host-run-test-jit
Change-Id: I36574fd1a34c9d67800a164fa801db7a17c827bf
063fc772b5b8aed7d769cd7cccb6ddc7619326ee 02-Aug-2016 Mingyao Yang <mingyao@google.com> Class Hierarchy Analysis (CHA)

The class linker now tracks whether a method has a single implementation
and if so, the JIT compiler will try to devirtualize a virtual call for
the method into a direct call. If the single-implementation assumption
is violated due to additional class linking, compiled code that makes the
assumption is invalidated. Deoptimization is triggered for compiled code
live on stack. Instead of patching return pc's on stack, a CHA guard is
added which checks a hidden should_deoptimize flag for deoptimization.
This approach limits the number of deoptimization points.

This CL does not devirtualize abstract/interface method invocation.

Slides on CHA:
https://docs.google.com/a/google.com/presentation/d/1Ax6cabP1vM44aLOaJU3B26n5fTE9w5YU-1CRevIDsBc/edit?usp=sharing

Change-Id: I18bf716a601b6413b46312e925a6ad9e4008efa4
Test: ART_TEST_JIT=true m test-art-host/target-run-test test-art-host-gtest
b84defb1b09803d5a47035e8010ac43984da1d4c 30-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Do not call IsMarked on null.

The concurrent collector checks it.

Test: ART_TEST_JIT=true test-art-host-run-test-jit
Change-Id: I02c2462ce1d8f3092f0b2f52f8b6dede8ff4a339
e51ca8bfa8a193b64901ad214842f213adca92eb 22-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Move inline caches GC handling in JitCodeCache.

Make the classes they hold weak references and visit
them during SweepJitRoots.

This fixes the newly introduced deadlock:

Thread1:
1) Lock JitCodeCache lock to create Profiling info for
ArtMethod m.
2) m is a copied method, we need to track the actual holder,
needing to decode a weak reference.
3) Weak references are not accessible due to GC.

GC Thread:
- Disallow weak reference access.
- Wait for checkpoint.

Thread2:
- Try to lock JitCodeCache lock
- Deadlock, as Thread1 owns the JitCodeCache lock.

Test: test-art-host
bug: 31289185
bug: 33198826

Change-Id: I7ee17631015450ace8d2a0264415a81c5a902bb8
b18a669259aa6ba08d9ca01b5b32c1aa0417138b 17-Nov-2016 Artem Udovichenko <artem.u@samsung.com> Cache flush/invalidate needs RWX permission

When generating JIT code, perform cache maintenance operations before
removing page write permissions. Errata on some cores require data
flush operations to be followed by data invalidate operations
requiring write permission.

Test: ART_TEST_JIT=true test-art-target on an arm64 device.
bug: 27265969

Change-Id: I70cbb0dc2ea37e42f2011d23333e386ae3f639c7
7a704bea1b1ff1e7deb903513997e0f35040287b 22-Nov-2016 Mathieu Chartier <mathieuc@google.com> Always fill in root table length

Otherwise, there may be DCHECK failure in JitCodeCache::ClearData.
Fixes gcstress JIT tests.

Test: test/run-test --host --relocate --prebuild --64 --jit --gcstress --dev 021-string2

Change-Id: I757ccd1e5a015c5e686254417a2a3f68b650da1c
f46501c6ad11025843682267c10f221323a206b1 22-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Clear the right data pointer.

Internally, stack_map_data is an offset of the roots_data allocation.
Pass both to the ClearData method, which will use the right pointer
to deallocate.

Test: test-art-host in debug mode
Change-Id: Ibfe38e7f1853870076048427f2efe7121c11c136
132d8363bf8cb043d910836672192ec8c36649b6 16-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Revert "Revert "JIT root tables.""""

Test: 626-set-resolved-string, test-art-host, test-art-target
Test: run-libcore-tests.sh
Test: phone boots and runs

This reverts commit 3395fbc20bcd20948bec8958db91b304c17cacd8.

Change-Id: I104b73d093e3eb6a271d564cfdb9ab09c1c8cf24
3395fbc20bcd20948bec8958db91b304c17cacd8 14-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Revert "JIT root tables."""

libcore failures:
dalvikvm32 F 11-14 03:04:06 14870 14870 jit_code_cache.cc:310] Check failed: new_string != nullptr

This reverts commit 75afcdd3503a8a8518e5b23d21b6e73306ce39ce.

Change-Id: I5a6b6b48aa79a763d1ff1ba4d85d63811254787d
75afcdd3503a8a8518e5b23d21b6e73306ce39ce 10-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "JIT root tables.""

Also contains Revert "Support kJitTableAddress in x86/arm/arm64."

This reverts commit 4acd03638fcdb4e5d1666f8eec7eb3bf6d6be035.
This reverts commit 997d1217830c0a18b70faeabd53c04700a87d7d9.

Test: ART_USE_READ_BARRIER=true/false test-art-host test-art-target

Change-Id: I77cb1e9bf8f1b4c58b72d3cf5ca31ced2aaa1ea3
4acd03638fcdb4e5d1666f8eec7eb3bf6d6be035 09-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "JIT root tables."

May be the offender for jit-gcstress failure of 902.

This reverts commit ac3ebc3150760425ed00abd56da48f9a6e0666bc.

Change-Id: I9ea6c9236fd1729fed7d1868dd8a111172932308
ac3ebc3150760425ed00abd56da48f9a6e0666bc 05-Oct-2016 Nicolas Geoffray <ngeoffray@google.com> JIT root tables.

Implement root tables for the JIT. Each JIT compiled method
gets a table allocated before the stack maps.

The table gets visited through Runtime::SweepSystemWeaks.

Implement String roots for x86_64 as an example.

Test: test-art-host test-art-target

Change-Id: Id3d5bc67479e08b52dd4b253e970201203a0f0d2
709b070044354d9f47641f273edacaeeb0240ab7 13-Oct-2016 David Sehr <sehr@google.com> Remove mirror:: and ArtMethod deps in utils.{h,cc}

The latest chapter in the ongoing saga of attempting to dump a DEX
file without having to start a whole runtime instance. This episode
finds us removing references to ArtMethod/ArtField/mirror.

One aspect of this change that I would like to call out specfically
is that the utils versions of the "Pretty*" functions all were written
to accept nullptr as an argument. I have split these functions up as
follows:
1) an instance method, such as PrettyClass that obviously requires
this != nullptr.
2) a static method, that behaves the same way as the util method, but
calls the instance method if p != nullptr.
This requires using a full class qualifier for the static methods,
which isn't exactly beautiful. I have tried to remove as many cases
as possible where it was clear p != nullptr.

Bug: 22322814
Test: test-art-host
Change-Id: I21adee3614aa697aa580cd1b86b72d9206e1cb24
0795f23920ee9aabf28e45c63cd592dcccf00216 28-Sep-2016 Mathieu Chartier <mathieuc@google.com> Clean up ScopedThreadStateChange to use ObjPtr

Also fixed inclusion of -inl.h files in .h files by adding
scoped_object_access-inl.h and scoped_fast_natvie_object_access-inl.h

Changed AddLocalReference / Decode to use ObjPtr.

Changed libartbenchmark to be debug to avoid linkage errors.

Bug: 31113334

Test: test-art-host

Change-Id: I4d2e160483a29d21e1e0e440585ed328b9811483
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
99c959f3868512bb95432cf02a1f0ad3971698bf 30-Jul-2016 Nicolas Geoffray <ngeoffray@google.com> Put the deletion of profiling info under a GC critical section.

Otherwise the GC could see dangling pointers.

bug:30033802

(cherry picked from commit cf48fa030780c3185f225d558b704c396f7713cc)

Change-Id: I2c43e973878f50dc147aa0af81551ecc942a790d
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
cf48fa030780c3185f225d558b704c396f7713cc 30-Jul-2016 Nicolas Geoffray <ngeoffray@google.com> Put the deletion of profiling info under a GC critical section.

Otherwise the GC could see dangling pointers.

bug:30033802
Change-Id: I839c4f6e537aba98769e99e4d75ff869c9ff13eb
9962962eb26f906e8f92cde1d6854dadbbc5e8ad 19-Apr-2016 Calin Juravle <calin@google.com> ProfileSaver: query profiling_infos instead of the code_map

This is the first step in being able to record profiles without jit
being active.

Bug: 27916886

(cherry picked from commit e2d066d0337b7c81d47e4806e6025b70d83fcd56)

Change-Id: Ie36c4b4a11d3b6e5de959121a1acea22a9e25121
c8a4f2c632afd44fc558aa37c98b9cf042b4bb5b 18-Apr-2016 Nicolas Geoffray <ngeoffray@google.com> Fix interaction between instrumentation and jit lock.

The jit lock needs to have higher priority than the
deoptimized methods lock.

bug:28236735

(cherry picked from commit 480d5108fa62f28cbc2e7072610f974953ff73a8)

Change-Id: I6e5f8597c4ab88993f6a32a204383b766ff03e33
e2d066d0337b7c81d47e4806e6025b70d83fcd56 19-Apr-2016 Calin Juravle <calin@google.com> ProfileSaver: query profiling_infos instead of the code_map

This is the first step in being able to record profiles without jit
being active.

Bug: 27916886
Change-Id: I2fcbd03560e109e6866ad6d82c79b902a889e620
480d5108fa62f28cbc2e7072610f974953ff73a8 18-Apr-2016 Nicolas Geoffray <ngeoffray@google.com> Fix interaction between instrumentation and jit lock.

The jit lock needs to have higher priority than the
deoptimized methods lock.

bug:28236735

Change-Id: I82862b8bfc82a5641156290926c04c80b1371534
f3f9cf6b65c4bcf9ea44253188d8d910b7cf7e64 14-Apr-2016 Nicolas Geoffray <ngeoffray@google.com> Add weight to compiled/interpreter transitions.

Also:
- Cleanup logging.
- Check ArtMethod status before adding compilation requests.
- Don't request osr compilation if we know AddSamples does not come
from a back edge.

Bug: 27865109

(cherry picked from commit 71cd50fb67fa48667b0ab59aa436a582c04ba43d)

Change-Id: Icbe89fe6cc495b113616391a8f257758d34b4b60
71cd50fb67fa48667b0ab59aa436a582c04ba43d 14-Apr-2016 Nicolas Geoffray <ngeoffray@google.com> Add weight to compiled/interpreter transitions.

Also:
- Cleanup logging.
- Check ArtMethod status before adding compilation requests.
- Don't request osr compilation if we know AddSamples does not come
from a back edge.

Bug: 27865109

Change-Id: I84512f7d957b61ce2458360ed430adb151830278
454b3b6774fe07765273b917ccc97da2eba776ac 07-Apr-2016 buzbee <buzbee@google.com> ART: Fix race in on-stack replacement

The expected sequence of events for on-stack replacement is:

1. Method goes warm, triggering enhanced profiling
2. Method goes hot, triggering method compilation
3. Method goes really hot, triggering an osr method compilation.
4. Interpreter polls for the existence of an osr entry point,
and transitons to compiled code if found.

We have a race problem if #2 and #3 happen closely together, and
the osr method compilation begins before the regular method
compilation. In that case, the jit sees that the method is
already being compiled (the osr method - but it does not
distinguish the two), and discards the normal compilation request.
So, the osr version is compiled and the normal version is discarded.
In #4, the MaybeDoOnStackReplacement() check assumes that a normal
version of the compiled method must exist before doing an on-stack
replacement, so it keeps returning false.

This is why we were seeing sporadic timeout failures of
570-checker-osr when the mterp fast branch profiling was
introduced. The branch profiling performance enhancements
greatly reduced the time between #2 and #3, increasing the liklihood
of losing the race. Further, the new code clamped hotness to avoid
wrap-around. The race existed (and likely occurred) in the previous
version, but because hotness counters were allowed to overflow and
wrap around you'd eventually hit the threshold a second time and
try again - masking the problem.

Tip 'o the hat to Serguei Katkov for identifying the problem.

A possible solution (taken in this CL) is to differentiate osr
compilations from normal method compilations.

Bug: 27939339
Change-Id: I71044516b35dc69de9fc2d2a445e33809ac650ed
9d07e3d128ccfa0ef7670feadd424a825e447d1d 31-Mar-2016 Vladimir Marko <vmarko@google.com> Clean up OatQuickMethodHeader after Quick removal.

This reduces the size of the pre-header by 8 bytes, reducing
oat file size and mmapped .text section size. The memory
needed to store a CompiledMethod by dex2oat is also reduced,
for 32-bit dex2oat by 8B and for 64-bit dex2oat by 16B. The
aosp_flounder-userdebug 32-bit and 64-bit boot.oat are each
about 1.1MiB smaller.

Disable the broken StubTest.IMT, b/27991555 .

Change-Id: I05fe45c28c8ffb7a0fa8b1117b969786748b1039
b9a639df2f21dd67b9f4379f31b7ccc5dd48ebd6 22-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Fix braino in JitCodeCache.

A OatQuickMethodHeader can never have its entry point be the
interpreter entrypoint.

Clear hotness counter of methods in more relevant places.

Change-Id: I0563a57eace2e0e4fe2abc76f5e293ddf47b25e3
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
933330a192d43d7c7304120999907857a89c2f96 16-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Add more statistics for memory use of the JIT.

Collect data for stack maps, profiling info, and compiled code.

bug:27520994

Change-Id: Ic87361230c96ce0090027a37d750e948d806c597
07e3ca9a46801990d662c48d0fddedc63c4c053c 11-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Fix thread race when fetching the ProfilingInfo object.

Problem is:
1) Compiler fetches the ProfilingInfo of A, it's null.
2) Mutator creates the ProfilingInfo.
3) Compiler notifies it's not using A anymore, calls
ProfilingInfo::DecrementInlineUse -> Crash as we expected
ProfilingInfo::IncrementUse to be called before.

Also update some namings to better reflect what is going on.

Change-Id: I55ea4c5d81988131467095e18a0d13a8be9d0ef7
b6e20ae17d0881a66c22532e4152ce6779454a92 07-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Clear inline caches at each full GC.

This fixes occasional failures of 141-class-unload.

Also fix a bug where clearing inline caches also cleared the dex
pc associated with it.

bug:26846185
bug:23128949
Change-Id: I77bf1dee229d7764c3cc21440829c7fba7b37001
33fbf37feb959293b10d0b6e26d5e8ee7dff786c 07-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add systrace logging to ScopedCodeCacheWrite

Shows if we are taking a long time to mprotect.

Bug: 27502458

(cherry picked from commit 462cd2cfa8c5fbb6548419eb8f27b448a12aca11)

Change-Id: Ic0f24641f5856b13f3b949dcd53dc01ec952d171
462cd2cfa8c5fbb6548419eb8f27b448a12aca11 07-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add systrace logging to ScopedCodeCacheWrite

Shows if we are taking a long time to mprotect.

Bug: 27502458

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

Added to:
JIT
DexFile functions
Oat file manager

Added helper ScopedTrace to prevent errors and reduce excess code.

Bug: 27502458

(cherry picked from commit dabdc0fe183d4684f3cf4d70cb09d318cff81b42)

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

Added to:
JIT
DexFile functions
Oat file manager

Added helper ScopedTrace to prevent errors and reduce excess code.

Bug: 27502458

Change-Id: Ifaeff8913d79eefc797380987d13cc00456266f8
9abb2978f09643227664ab70c0677744b8f6e946 04-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Fix very rare bug around JIT code cache collection.

The bug is the following:
1) JIT thread: We start a code cache collection.
2) JIT thread: We mark all code that is in the call stack of all
threads.
3) Mutator thread: after marking its stack, resumes and does call
that pushes JIT compiled code to the call stack.
4) Mutator thread: deoptimizes compiled code of ArtMethod Foo,
and therefore updates the entry point of Foo through
JitCodeCache::InvalidateCompiledCodeFor.
(Note that updating the entrypoint could also be done through
instrumentation).
5) JIT thread: Call JitCodeCache::RemoveUnusedAndUnmarkedCode.
The method used to remove entries that were not entrypoints.
It sees the compiled code for Foo but that is not an entrypoint
anymore, so deletes it.
6) Mutator thread problem: it now has compiled code in its call
stack that is deleted.

If it's only one mutator thread, we only hit a DCHECK when walking
the stack, as we are now seeing an invalid pc. The deoptimization
will longjmp to the caller of that invalid entry anyway.

However, if multiple mutator threads are involved, one thread
might invalidate the compiled code while the other is still
running it. And we end up deleting code that is in the call
stack of a thread, and we will crash.

The fix is to mark entrypoints before marking call stacks,
so that anything a thread might jump to is marked and kept.

bug:27424509
bug:23128949
bug:26846185

Change-Id: I07cd08cedd96b9900629f7535e95404f622104ea
bcd94c8ea9bde4e075c25fbdfb3a2ef6858eed7b 03-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Refine statistics around the JIT.

- Better namings.
- Now also time the code cache collection time.
- Random cleanups.

bug:23128949
bug:27445008
bug:27442890

Change-Id: I1dd52544bea678af868e7c47907f7a0fc9a146c3
67e4f81b232150605cbba03d0818313737b904d3 02-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Clear inline caches if a ProfilingInfo gets revived.

This avoids stalled class references.

Bug: 27398183
Bug: 23128949
Bug: 26846185

(cherry picked from commit 511e41b4ec2d378a5c434598ebd0b3d6136fff9d)

Change-Id: I5e33496859e65456d185cc09ca12736dd6414d77
af3f5e0136277bd0c01e7e2b7c4797c63ecddca6 02-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Use the interpreter as a heartbeat for the JIT.""

Bug: 27398183
Bug: 23128949
Bug: 26846185

This reverts commit a96917a6983a5abbe973255a3846fda549fb1657.

(cherry picked from commit 35122443e5f8606cc5a660ac32745a06aefb341b)

Change-Id: Ib02401c76bf28e1aac6bbce01f97ddd0373c1ba5
511e41b4ec2d378a5c434598ebd0b3d6136fff9d 02-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Clear inline caches if a ProfilingInfo gets revived.

This avoids stalled class references.

Bug: 27398183
Bug: 23128949
Bug: 26846185
Change-Id: I9539215241708e26fef887e02201ce1feabc2d1a
35122443e5f8606cc5a660ac32745a06aefb341b 02-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Use the interpreter as a heartbeat for the JIT.""

Bug: 27398183
Bug: 23128949
Bug: 26846185

This reverts commit a96917a6983a5abbe973255a3846fda549fb1657.

Change-Id: I5c4f0d87d3293a6a7ab56a33396670704b66a347
a96917a6983a5abbe973255a3846fda549fb1657 01-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Use the interpreter as a heartbeat for the JIT."

Hits a DCHECK testing libcore.
art F 11973 12675 art/runtime/jit/jit_code_cache.cc:644] Check failed: it.second->GetProfilingInfo(sizeof(void*)) != nullptr


Bug: 27398183
Bug: 23128949
Bug: 26846185

This reverts commit 7273a5d045d3ceb3ff011ad65765356b69b155e8.

Change-Id: I6614a82e775ea71aa16f041313f67546db41eac8
034eb1a6ae870d53f9b3774e416ebbbd9859fdda 01-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Fix bogus interaction between code cache and instrumentation."

hits a DCHECK when testing libcore:
art F 11973 12675 art/runtime/jit/jit_code_cache.cc:644] Check failed: it.second->GetProfilingInfo(sizeof(void*)) != nullptr


This reverts commit e9924b7d4fcafe7261233d2c16ebb73d7bb5e8e8.

Change-Id: I37d05991b9506a53a7c76738a7e4a6def1010958
e9924b7d4fcafe7261233d2c16ebb73d7bb5e8e8 01-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Fix bogus interaction between code cache and instrumentation.

Change-Id: Icc314089ec1a05248b8994476d478a543e629e4d
1e7da9bd04bdd2664a4196f1d7e285c010f8881f 01-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Do a TryLock when allocating a ProfilingInfo from the interpreter.

This removes some thread contentions just for allocating ProfilingInfo.

bug:23128949

Change-Id: I9ff7d44c4b0ee272425cf4c6248d3065f67958f3
7273a5d045d3ceb3ff011ad65765356b69b155e8 29-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Use the interpreter as a heartbeat for the JIT.

When doing a partial code cache collection, update all entrypoints to
interpreter, so that the next full collection will remove code
that wasn't executed during that window.

bug:27398183
bug:23128949
bug:26846185

Change-Id: I4423f5c4810dac183dc8973078bf218818745e80
932282595045739d624cbbf5b3a3d337fe3b6797 24-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Forgot to initialize JIT memory use fields.

bug:23128949

(cherry picked from commit b0d220835f2ddc03510f17fcc4fb4c64b426a0f5)

Change-Id: Iea81925ebd0fd60fe58a972269313a98f93fdac5
5b3fbd26a9f8b8c15e8e85db2403b3545536cd87 25-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Dump the number of OSR compiled code.

bug:23128949

(cherry picked from commit fcdd72941810f03460a8efca0c6255439be80c35)

Change-Id: I7f6c428511ee7fe346c665be8f02880bcc317cae
82de410ad37ea90f43e61fb5dc44ab420a159b54 23-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Introduce partial code cache collection.

It will collect code that is known unused (because it deoptimized),
and osr code.

bug:26846185

(cherry picked from commit 8d37250f7b9a7839b11488f45a1842b025026f94)

Change-Id: Iffe87e356066a3f0bd28cb3df41c17bf2ac9ea0f
fcdd72941810f03460a8efca0c6255439be80c35 25-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Dump the number of OSR compiled code.

Change-Id: I20efc80e8556da8220dab92c3a7947f883d48cf8
b0d220835f2ddc03510f17fcc4fb4c64b426a0f5 24-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Forgot to initialize JIT memory use fields.

Change-Id: I82ae97adffd8e633de048f044cdbdb953b2f9763
8d37250f7b9a7839b11488f45a1842b025026f94 23-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Introduce partial code cache collection.

It will collect code that is known unused (because it deoptimized),
and osr code.

bug:26846185

Change-Id: Ic27dfeb944efb2ca464039007ba365c1e0d4a040
65b83d875e4f9c021bc8380024455c9f1e658b14 22-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Add a new kReservedCapacity to decide when to start GC code.

Change-Id: Ib9d0ad9bc86c66ac29975f7f907f79f842342500
38ea9bd50debc63ceb77ec1e65036d8e2070ec7d 19-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Track memory usage of code cache.

Needed once we start having a strategy based on how full the code
cache is.

Change-Id: I181ad05e1c216afabf106f91ac54bbf144d7406a
b88d59ef4fe611fe47e50a6a19785e03bbd5f93b 17-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Be a bit smarter with JIT code triggering deoptimization.

Do not re-use an OSR method that triggered deoptimization.
Also add a stack overflow check before doing OSR.

bug:27094810
Change-Id: I6ff6a7fb9b3df9b7c0ff37e3610595efa70ad067
a9b91313cee629d81d4784798d03419fc7fa9e11 17-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> We also need to delete osr entries when deleting ArtMethod.

In the unfortunate event an ArtMethod gets allocated at the
same location as an old (deleted) ArtMethod, the osr_code_map_
lookup will succeed and return garbage. So we need to delete
entries in the osr_code_map_ when an ArtMethod gets deleted.

This should finally fix:
dalvik.system.DexClassLoaderTest#test_twoJar_diff_getResourceAsStream

Change-Id: I7c8b775c3376a6cfcb907f09b783e393967ad82d
d9994f069dfeaa32ba929ca78816b5b83e2a4134 11-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Re-enable OSR.

Fixes two bugs:
- Dealing with proxy methods, which the compiler and code cache
does not handle.
- Dealing with phi types, that may have been speculatively optimized
but do not hold once jumping to the compiled code.

Change-Id: I7dcd9976ef7b12128fff95d2b7ed3e69cc42e90a
b331febbab8e916680faba722cc84b66b84218a3 05-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Implement on-stack replacement for arm/arm64/x86/x86_64.""

This reverts commit bd89a5c556324062b7d841843b039392e84cfaf4.

Change-Id: I08d190431520baa7fcec8fbdb444519f25ac8d44
bd89a5c556324062b7d841843b039392e84cfaf4 05-Feb-2016 David Brazdil <dbrazdil@google.com> Revert "Implement on-stack replacement for arm/arm64/x86/x86_64."

DCHECK whether loop headers are covered fails.

This reverts commit 891bc286963892ed96134ca1adb7822737af9710.

Change-Id: I0f9a90630b014b16d20ba1dfba31ce63e6648021
891bc286963892ed96134ca1adb7822737af9710 29-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Implement on-stack replacement for arm/arm64/x86/x86_64.

High-level overview:
- osr_method_threshold is used to know when to compile a method
in osr mode (-> treat all loops as irreducible).
- branch instructions in the compiler query whether they can
jump to an osr method.
- An osr entry point is found through the stack maps: if a stack
map is duplicated in the CodeInfo, it is an osr entry point.

Change-Id: Ifb39338cd281e2c7eccce67f4e18d46428be71e4
324302696c0a93511fef1310d309a54ebfb25a46 01-Feb-2016 Roland Levillain <rpl@google.com> Ensure instruction cache is flushed in compiler tests with Clang.

Invoke __builtin___clear_cache with Clang in
art::CommonCompilerTest::MakeExecutable. This fixes
"Illegal instruction" failures in codegen_test on angler.

Factor this logic in a function and use it in
art::jit::JitCodeCache::CommitCodeInternal too.

Bug: 26786447
Change-Id: I81fa056c8d7c6bf2168c9340deeab82231cb1084
c26f1288aaf9141ac4b2150869f0c594d52dbf36 29-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Re-enable test 566-polymorphic-inlining.

- Can not rely on debug builds.
- Need to wait for the method to be compiled.

Change-Id: I26ce89075075da8555fd59ade56bd04bec23f4ce
a42363f79832a6e14f348514664dc6dc3edf9da2 17-Dec-2015 Nicolas Geoffray <ngeoffray@google.com> Implement first kind of polymorphic inlining.

Add HClassTableGet to fetch an ArtMethod from the vtable or imt,
and compare it to the only method the profiling saw.

Change-Id: I76afd3689178f10e3be048aa3ac9a97c6f63295d
b4eddd21c364c51b6fc5c439cda6958ae255dcd5 14-Jan-2016 Calin Juravle <calin@google.com> Add profile support for apps with shared runtime.

- extend ProfileSaver to track different dex locations to different
profile files.
- allow repeated calls to Runtime::RegisterAppInfo() which will
register a new pair <profile_file, locations_to_track> with the profile
saver.

Bug: 26080105
Change-Id: I58c4587d5f462c557411ad7126a00c29cd7db3a6
0a52223d9173315aeaca05217b8c792b3088ea7d 19-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Keep track of number of JIT compilations.

Change-Id: Ic436bc3f939f6236190ddd840955cb72f76e8f85
3fdb3fec5c36127d8568b2f89698906ba4b68576 14-Jan-2016 Mathieu Chartier <mathieuc@google.com> Don't allow thread suspension in ProfilingInfo::Create

AddSamples calls ProfilingInfo::Create which would occasionally
transition to suspended and wait for code cache GC to complete.
This CL removes the thread state change and
WaitForPotentialCollectionToComplete which caused thread suspension.

The thread suspension caused occasional stale object references in
InvokeVirtualOrInterface since moving GC could occur.
If this_object became stale, we would put it's stale class into the
profile info, resulting in a GC crash.

Bug: 26086970
Change-Id: I5a86561098d72b7be80e8a3bcf3d8401403a0b00
c3fec4c4ca01055d4d5920f363620b5726ebbbef 14-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Fix braino in parameters passed.

Change-Id: I4683586184617bb8ac4f377b873263a339d1d960
a25dce9b452ba17ef7cef768926c884177a3025e 12-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Support --perf with jitted code.

Change-Id: I76f29d815234e9506efc59d4865780e52b2381a1
5cc349f3dd578e974f78314c50b6a0267c23e591 18-Dec-2015 David Srbecky <dsrbecky@google.com> Report DWARF debug information for JITed code.

Change-Id: Ia5b2133c54386932c76c22774cf3d2ae61e0925f
07f3564d73550495a937bc667d03721106315400 04-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Add a fence to ensure other threads see the correct data.

Other threads may see the ProfilingInfo pointer in the ArtMethod,
but the data they have for it is bogus due to a prior load in their
cache.

bug:26221227
Change-Id: I1fa8f088a3144df39d07a986ed57d6fc20edba18
4d77b6a511659f26fdc711e23825ffa6e7feed7a 01-Dec-2015 Calin Juravle <calin@google.com> Save profile information in a separate thread.

Previously we would save the profiling information only when the app
was sent to background. This missed on an important number of updates
on the jit code cache and it didn't work for background processes.

Bug: 26080105

Change-Id: I84075629870e69b3ed372f00f4806af1e9391e0f
66f55237679db90cb0a0a265043a787932b466f8 08-Dec-2015 Calin Juravle <calin@google.com> Pass down to the runtime the application code paths.

When registering the app with the runtime the framework needs to pass
down the list of application code paths. This will be used by JIT to
know what profile info to persist.

This fixes the reliance on OatFileManager::GetPrimaryOatFile which may
produce inconsistent results based on external factors (i.e. class path
order or failing to compile the first dex file from the class path)

Bug: 26080105
Change-Id: Iadcebd2684fcd48569e8f76ef21bd4d117fedc05
73be1e8f8609708f6624bb297c9628de44fd8b6f 17-Sep-2015 Nicolas Geoffray <ngeoffray@google.com> Inline monomorphic calls.

Change-Id: If38171c2dc7d4a4378df5d050afc4fff4499c98f
31f2c155975c5794d481df03eb0947cb48d2c6b5 23-Oct-2015 Calin Juravle <calin@google.com> Save jit profiling info to file.

Currently saves only the hot method references and omits the inline
cache.

Change-Id: I79e91f855f6b52dc19a9a86662604f2eee16613c
0a3be1620a3560253cfa789cb9819013293c5654 18-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Increase code cache after 1 full collection.

Also add a max capacity option.

Change-Id: Icd442b72e9be0c6b091b588b4c4473c69b7cde10
8ccbd279b91c96aa0f7bb649e399b12b31b8bda1 09-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Remove unused variable.

Change-Id: I29d80004eba897b72304ec83fe89ed1071a24024
a5891e81a2fb833307cf7c7e7267070dc0223dc8 06-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Fix interaction between JIT and instrumentation.

- The JIT needs to go through the instrumentation to update
entry points.
- The instrumention needs to know if a method got JITted
to know if needs to deoptimize.

bug:25438583

Change-Id: I4b186a1da9f4a3fb329efd052a774d5502a902a1
d28b969c273ab777ca9b147b87fcef671b4f695f 04-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Code cleanup to avoid CompilerDriver abstractions in JIT.

Avoids allocating a CompiledMethod.

Change-Id: I35b4aa0d7c74daba68e827a01e71c300fce3b3bf
5a23d2ea6e0d89112ff11ec765e676c03818b7c2 03-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Fix TODO on instrumentation and add some more DCHECKs.

bug:25343683
bug:25438583

Change-Id: I232deb1b6761466b514c687ce304f61928755cdc
62623401fe994ff2f2719faf3cdb3c23b92ccd96 28-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Fix deadlock with the JIT code cache.

Also remove hack done for ThreadStress.

Change-Id: Ie25c3bca08d9f2b8919706fa3fc26c5ab213f4a3
10d2508b105427ef1bcaf0c222873bae7acc66d3 29-Oct-2015 Mathieu Chartier <mathieuc@google.com> Change Checkpoint API to return total number of checkpoints

Fixes a race condition with SetStateUnsafe that caused some
warnings in the Barrier::~Barrier.

The race was:
RunCheckpoint sees suspended thread, runs the checkpoint. Inside the
checkpoint, the thread state had changed to runnable by
SetStateUnsafe. This occasionally caused more Barrier::Pass than
expected.

The fix is to return the total number of checkpoints instead of just
the runnable ones.

Bug: 24191051
Change-Id: If15a933ed4c8efa66a5f27cd5feaa2e5957ae804
4e915fbc2be5fc43c782389bbbb7306cd76a523a 28-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Tune heuristics a bit.

First version. Seems to be more in line with what we're seeing.

Change-Id: I5117352c13cb2e95d16f0c9b05b1faf37c05d710
26705e2b1245b65989a0341b24c5dbf2658d4bb6 28-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Add support for collection ProfilingInfo objects.

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

Change-Id: I9afc544460ae4fb31149644b6196ac7f5182c784
1e7de6cfcabc87ebd36bf6f2c9ed466152d21d4e 21-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Remove the magic 32 constant and ensure alignment.

Change-Id: I383315bf3cd5f0b8634e2982da55d5d864009a91
0c3c2668ef44fdbd18d97f9134a85d1a7d561aa4 15-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Use DlMallocSpace for the JIT code cache.

- Also tidy up some code in the JIT compiler.
- And mprotect code space to be writable only when allocating.

Change-Id: I46ea5c029aec489f2af63452de31db3736aebc20
5550ca8bcc742b109d77e62f3a0877c667d894d3 21-Aug-2015 Nicolas Geoffray <ngeoffray@google.com> Record profiling information before Jitting.

- Add a new instrumentation kind to record dynamic invokes.
- Use the JNI entry point field to store the profiling data.
- Record seen receivers for every dynamic invoke.

Change-Id: I2c1738ab2a72052d45964d055dc16b44b906e54c
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
a4885cbaafd35fe9c60eb6cd95e41e2c86f54f66 09-Mar-2015 Mathieu Chartier <mathieuc@google.com> Add way to print JIT related info at shutdown

Added a runtime option called -XX:DumpJITInfoOnShutdown with prints
various interesting JIT statistics during the shutdown of the runtime
if enabled.

Example of running EvaluateAndApplyChanges with the option:
I art : Code cache size=427KB data cache size=84KB num methods=1598
I art : Start Dumping histograms for 1598 iterations for JIT timings
I art : Compiling: Sum: 727.850ms 99% C.I. 135us-4402us Avg: 455.475us Max: 15567us
I art : Verifying: Sum: 191.074ms 99% C.I. 19us-1450.500us Avg: 119.570us Max: 5142us
I art : TrimMaps: Sum: 62.053ms 99% C.I. 13us-199.374us Avg: 38.831us Max: 10058us
I art : MakeExecutable: Sum: 11.153ms 99% C.I. 4us-47us Avg: 6.979us Max: 47us
I art : Initializing: Sum: 7.991ms 99% C.I. 1us-49.781us Avg: 5us Max: 4852us
I art : Done Dumping histograms

Bug: 17950037
Change-Id: I23538b24f947e5f6934f55579b8baa9d806eb3d5
5c42c29b89286e5efa4a4613132b09051ce5945b 25-Feb-2015 Vladimir Marko <vmarko@google.com> Add support for .bss section in oat files.

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

Added missing EntryPointToCodePointer.

This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399.

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

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

Bug: 17950037
This reverts commit 2535abe7d1fcdd0e6aca782b1f1932a703ed50a4.

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

Currently disabled by default unless -Xjit is passed in.

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

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

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

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

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

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

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

Bug: 17950037

Change-Id: Ifa5b2684a2d5059ec5a5210733900aafa3c51bca