History log of /art/compiler/dex/verified_method.cc
Revision Date Author Comments
e5de54cfab5f14ba0b8ff25d8d60901c7021943f 20-Apr-2016 Calin Juravle <calin@google.com> Split profile recording from jit compilation

We still use ProfileInfo objects to record profile information. That
gives us the flexibility to add the inline caches in the future and the
convenience of the already implemented GC.

If UseJIT is false and SaveProfilingInfo true, we will only record the
ProfileInfo and never launch compilation tasks.

Bug: 27916886
Change-Id: I6e4768dc5d58f2f85f947b276b4244aa11ce3fca
bf9611f821697b14bf9e170f503c3f47613b046b 26-Mar-2016 Andreas Gampe <agampe@google.com> ART: Clean up verifier

Clean up verifier post-Quick.

Change-Id: I0b05e10dd06edd228fe2068c8afffc4b7d7fdffa
98e6ce44c700abd9375fe17f0aa31fea1e1e938b 16-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Remove string init map.

Partial revert of the String init change.

- Make Quick bailout in the presence of String allocation.
- Rely on the compiler for knowing when dex registers alias.

bug:27173201

Change-Id: I0bf58ba3825c71cef110b53f3a0a6f567cb2ef9a
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
0760a81257fa427646c309500d603194009265ef 27-Aug-2015 Andreas Gampe <agampe@google.com> ART: Propagate verifier failure types to the compilers

Add a bit-set encoding of seen failure types to the verifier and
make it available. Store this in VerifiedMethod, so that compilers
can inspect it and make choices based on failures. Rewrite the
current punting of runtime-throw errors to be at the compiler-driver
level.

Bug: 23502994
Change-Id: I1cfc7cbdf2aec1f14ba18f0169e432ba4ae16883
286763464072ffb599846f76720c7ec54392ae6e 24-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Use a flag from the verifier to know if we should compile.

Only used for the lack of bottom type in the aget-object case
for now. Could be used for more.

bug:21865466

(cherry picked from commit 4824c27988c8eeb302791624bb3ce1d557b0db6c)

Change-Id: I2bb7fe1d4737bd92c1076b5193607d74d8761ee7
4824c27988c8eeb302791624bb3ce1d557b0db6c 24-Jun-2015 Nicolas Geoffray <ngeoffray@google.com> Use a flag from the verifier to know if we should compile.

Only used for the lack of bottom type in the aget-object case
for now. Could be used for more.

bug:21865466

Change-Id: I64c2c84dfa1c0d259631e65e5f44b94e4139e6a7
f8da196097d1b33121a73abcaf443d173ceab8eb 19-Jun-2015 Mathieu Chartier <mathieuc@google.com> Fix GC map generation edge case

Previously we checked the number of bits, but then rounded up to a
byte boundary. If ref_bitmap_bits was 65535, it would pass the check
but not actually fit in the 13 bits for ref_bitmap_bytes since we
rounded up to 8192 bytes.

(cherry picked from commit 1626b919005df42ccc90ebe68fc57b7c56d44029)

Regression test infeasible due to smali limitations.

Bug: 21888453
Change-Id: If4b769431f27ecca14fe7852d017bcde01b3e146
1626b919005df42ccc90ebe68fc57b7c56d44029 19-Jun-2015 Mathieu Chartier <mathieuc@google.com> Fix GC map generation edge case

Previously we checked the number of bits, but then rounded up to a
byte boundary. If ref_bitmap_bits was 65535, it would pass the check
but not actually fit in the 13 bits for ref_bitmap_bytes since we
rounded up to 8192 bytes.

Regression test infeasible due to smali limitations.

Bug: 21888453
Change-Id: If4b769431f27ecca14fe7852d017bcde01b3e146
c449e8b79aaaf156ce055524c41474cc1200ed5a 11-Jun-2015 Igor Murashkin <iam@google.com> runtime: Minor cleanup and extra comments around interpreter

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

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

Change-Id: I797b992a8feb566f9ad73060011ab6f51eb7ce01
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
f1c6d9e87cbfd27702103ccc7c7f08ce784dc872 13-Apr-2015 Calin Juravle <calin@google.com> Fallback to quick in case of soft verification errors

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

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

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

This reverts commit c751d37e692d89b360f3c09421401f581b5c6d06.

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

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

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

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

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

No reflection performance changes.

Bug: 19264997
Bug: 17643507

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

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

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

Bug: 19988704

Change-Id: I2493f737efd3fad72f6b41fb60eff1d3731613fb
66cdcbeeedc6e51b4c56da6969ce193b8c520bbc 06-Mar-2015 Mathieu Chartier <mathieuc@google.com> Fix incompatible class change error for JIT stress mode

There was a problem with miranda methods, when we would dequicken to
one of these, it wouldn't resolve as virtual during the method
lowering resolve. The solution is to try resolving as interface if we
fail to resolve as virtual.

Fixed a bug in dequickening where unreachable register lines with
quick invokes would cause CHECK failuers. In this case we punt to the
interpreter (test 435-try-*).

Added test regression test. Example failure:
java.lang.IncompatibleClassChangeError: The method
'void Main$TheInterface.m()' was expected to be of type virtual but
instead was found to be of type interface (declaration of
'java.lang.reflect.ArtMethod' appears in
out/host/linux-x86/framework/core-libart-hostdex.jar)
at Main.DoStuff(Main.java:37)
at Main.main(Main.java:44)

Bug: 17950037

(cherry picked from commit 091d238936809f6668ca6b7606c62bc224add430)

Change-Id: I90d2bea1cec81a3acac1da875320e1f90510edf4
091d238936809f6668ca6b7606c62bc224add430 06-Mar-2015 Mathieu Chartier <mathieuc@google.com> Fix incompatible class change error for JIT stress mode

There was a problem with miranda methods, when we would dequicken to
one of these, it wouldn't resolve as virtual during the method
lowering resolve. The solution is to try resolving as interface if we
fail to resolve as virtual.

Fixed a bug in dequickening where unreachable register lines with
quick invokes would cause CHECK failuers. In this case we punt to the
interpreter (test 435-try-*).

Added test regression test. Example failure:
java.lang.IncompatibleClassChangeError: The method
'void Main$TheInterface.m()' was expected to be of type virtual but
instead was found to be of type interface (declaration of
'java.lang.reflect.ArtMethod' appears in
out/host/linux-x86/framework/core-libart-hostdex.jar)
at Main.DoStuff(Main.java:37)
at Main.main(Main.java:44)

Bug: 17950037

Change-Id: I39c32cc8849bf02032a4f61a7ce57462b7fcac75
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
0b9203e7996ee1856f620f95d95d8a273c43a3df 23-Jan-2015 Andreas Gampe <agampe@google.com> ART: Some Quick cleanup

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

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

Change-Id: I898405907c68923581373b5981d8a85d2e5d185a
6c170c9e884e9dddf61d963d403042ee2a399e7d 17-Dec-2014 Andreas Gampe <agampe@google.com> ART: Punt to the interpreter for VerifiedMethod errors

In case that the GC map can't be created (because of size restrictions),
do not fail the class. Instead punt to the interpreter.

Bug: 17791183

(cherry picked from commit f535c69f115c61ffadca1bd2706244d0aa30f9aa)

Change-Id: I348bb306dbfc85c235fa93c0c527fba6627551fe
f535c69f115c61ffadca1bd2706244d0aa30f9aa 17-Dec-2014 Andreas Gampe <agampe@google.com> ART: Punt to the interpreter for VerifiedMethod errors

In case that the GC map can't be created (because of size restrictions),
do not fail the class. Instead punt to the interpreter.

Bug: 17791183
Change-Id: I348bb306dbfc85c235fa93c0c527fba6627551fe
36b58f5ebb85d58f8b5966b8577a6dfe720d1e16 10-Dec-2014 Mathieu Chartier <mathieuc@google.com> Add verifier support for dequickening

Also some cleanup.

Bug: 17950037

Change-Id: I1f50fe07f1558e9c4f78953b7afa639d7f310b3c
40d3518414202f33c9569ddd8daceabb30208fc2 03-Oct-2014 Stephen Kyle <stephen.kyle@arm.com> ART: Fix crash with unreachable void check-cast

return-void
check-cast v0, V
return-void

The above code sequence will not be rejected for the check-cast of a
void type because the check-cast is not reachable. However, when
GenerateSafeCastSet() is called from the compiler, this will cause
IsAssignableFrom(Conflict, Undefined) to be called, as it scans for all
check-casts across the code, regardless of its reachableness.

RegType::AssignableFrom() has been changed to handle a Conflict type,
whereas previously this would break the check that the lhs type is a
ReferenceType.

Additionally, GenerateSafeCastSet has been changed to never assess
instructions that weren't visited during verification.

Included is a new test DEX file, 801-VoidCheckCast, that uses this code
sequence.

Change-Id: I600055ab670ee48a075ffa867b46d2e74f5aa9c0
Signed-off-by: Stephen Kyle <stephen.kyle@arm.com>
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
d8f69b086baf6717ce949d1c4de90d73b91083b0 10-Sep-2014 Ian Rogers <irogers@google.com> Revert "Add read barriers for the roots in the verifier."

This reverts commit 7da9586b559290e1c16207c6513ffe485de61655.

Bug: 17398101

Change-Id: I1d6110fdf0d3a3c9241c8e7e7f4b85a298f9dd8e
7da9586b559290e1c16207c6513ffe485de61655 30-Jul-2014 Hiroshi Yamauchi <yamauchi@google.com> Add read barriers for the roots in the verifier.

Note: Because the roots (the class references in RegType objects) can
be updated by the read barriers, a lot of uses of type "const RegType"
were replaced with "RegType".

Bug: 12687968
Change-Id: I6cf37a87f352938d43fb51560a8d927ada104f50
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
507dfdd147c97bfbadebfd63584d094b6a4e7b47 16-May-2014 Ian Rogers <irogers@google.com> Compatibility layer to transition from UniquePtr to std::unique_ptr.

Use ART_WITH_STLPORT (enabled for the target) to cause the use of UniquePtr,
for the host switch to std::unique_ptr. For now the type remains called
UniquePtr.
Make dalvik compile with clang on the host, move its build to C++11.

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

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

Change-Id: Ife1ac67cede20f3a2f9c7f5345f08a851cf1ed20