History log of /art/runtime/verifier/method_verifier.h
Revision Date Author Comments
62e631a678ef18c80f37862a2dc74004954a8502 20-Apr-2016 Nicolas Geoffray <ngeoffray@google.com> Add flag to ArtMethod to skip compilation.

To ensure even the JIT will not try to compile methods with
soft failures a runtime_throw.

bug:28293819
bug:28313047

(cherry picked from commit 250a378d5a2152662e0fa820f2b38f794ddd3596)

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

To help for build failures.

Change-Id: I6c94dfb50177daa7d89902d78715ccec31bf0e45
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
361e04aaa5d3eca9f978a802ee44b1213f31da58 16-Feb-2016 Mathieu Chartier <mathieuc@google.com> Add custom arena deleter for RegisterLine

Previously it protected by using sizeof(RegisterLine) but this was
not accurate due to register lines being variable sized.

Bug: 27156726
Change-Id: Ia4b134b85a2e61993d17bd4f0eff60c89c164dc3
9fcfb8add23042713165f761b4f098e14b9a823b 05-Feb-2016 Andreas Gampe <agampe@google.com> ART: Curb lock-verification-failure spam

Just print one message per class. Also print a helpful message once.

Bug: 26951356
Change-Id: I83702b67dc535d86e03835df7a72afda081c83be
be10e8e99a78caae01fb65769218800d465144ae 22-Jan-2016 Vladimir Marko <vmarko@google.com> Optimizing: Try pattern substitution when we cannot inline.

Change-Id: I7c01f4494bac8498accc0f087044ec509fee4c98
7268d47a6d2d44dcd844fcfff4699ad7689308d6 21-Jan-2016 Alex Light <allight@google.com> Add a METHOD_SUPER to the MethodType enum.

This makes some of the code simpler by disambiguating between regular
invoke-virtual and invoke-super, which have slightly different
requirements.

Change-Id: I50e86e681bb63c617c043367feb5b89e2ddbfc00
705ad49f353d3f90d8b63625aca2c2035bacdbef 21-Sep-2015 Alex Light <allight@google.com> Support directly invoking interface default methods

With the Java 8 Language one is allowed to directly call default
interface methods of interfaces one (directly) implements through the
use of the super keyword. We support this behavior through the
invoke-super opcode with the target being an interface.

We add 3 tests for this behavior.

Currently only supports slow-path interpreter.

Invoke-super is currently extremely slow.

Bug: 24618811

Change-Id: I7e06e17326f7dbae0116bd7dfefca151f0092bd2
53e32d14d7a51198c6ef09120c15bafdd1d055c2 10-Dec-2015 Andreas Gampe <agampe@google.com> ART: Refactor verifier callbacks

Change the return type of MethodVerified to void. It was never
used anyways.

Remove the callbacks calls from the core of the verifier (Verify()).
Instead, make the convenience functions do the work, and add a
parameter to supply the callback so that the verifier becomes
independent of the Runtime-stored one.

Fix up calls that now need to provide a callback, but leave places
that only run the verifier to get metadata (e.g., register type data,
lock state) without callback. This avoids callback calls when in JIT
mode.

Bug: 26075442
Change-Id: I2c270f01e4de088771d4d4b19dae4f07d77640f0
ec6e6c19662260c059b273dfc9c502900756487d 06-Nov-2015 Andreas Gampe <agampe@google.com> ART: Rerun the verifier for compile-time failures

To aid app failure diagnosis, by default re-run the verifier at
runtime to compute a better VerifyError message.

Rewrite the verifier driver code to pass the last actual low-level
verifier message.

Bug: 25432718
Change-Id: Ib8e6dd1ce8121045c0d38f54969100094c3dde6e
de40d478930d0889a2aea5cbf58aa63da24e5dfa 16-Oct-2015 Mathieu Chartier <mathieuc@google.com> Use arenas for the verifier

Improvements are from using arenas for verifier. The things that
were moved into arenas are register lines, reg types, and reg type
descriptors.

Also some minor cleanup. Fixed double space formatting error in
string piece.

========================================
Before:
=======================================
compile GmsCore 50x on host -j1:
real 3m5.510s
user 2m48.139s
sys 0m11.753s

50 random APKs:
real 1m18.157s
user 1m8.167s
sys 0m8.071s

RAM (GmsCore):
(threads: 1) arena alloc=0B java alloc=27MB native alloc=64MB free=792KB
(threads: 4) arena alloc=0B java alloc=27MB native alloc=64MB free=397KB
Perf:

=============================
After:
=============================
compile GmsCore 50x on host -j1:
real 2m31.455s
user 2m14.784s
sys 0m10.888s

50 random APKs:
Speed up from arena allocating:
real 1m12.094s
user 1m2.325s
sys 0m7.872s

Speed up from areans + CreateFindClassDefIndex + unordered_map for DexFileVerifier.
real 1m8.654s
user 0m58.955s
sys 0m7.777s

RAM (GmsCore):
(threads: 1) arena alloc=1049KB java alloc=27MB native alloc=65MB free=538KB
(threads: 4) arena alloc=4MB java alloc=27MB native alloc=69MB free=650KB

Perf on host key results:
_int_malloc: 3.60% -> 1.39%
malloc: 1.48% -> 0.65%
_int_free: 1.59% -> 0.61%
RegTypeCache::FromClass: 1.47% -> 0.86%
malloc_consolidate: 0.89% -> 0.63%

Real speed up is ~22% on GmsCore, ~14% on the set of 60 APKs.

Bug: 10921004

Change-Id: If13d4ab4284a176f93a26a412549b6b1149dfb16
e6215c0ec4b1bb71b722fdbf7e62eaf3be8a91d5 01-Sep-2015 Andreas Gampe <agampe@google.com> ART: Move access flags checking to dex file verifier

Actually implement all the access flags checking in the dex file
verifier. Add tests.

Change-Id: I8b797357831b588589d56d6e2e22f7b410f33008
637ee0b9c10ab7732a7ee7b8335f3fff4ac1549c 04-Sep-2015 Vladimir Marko <vmarko@google.com> ART: Add some utilities for working with containers.

Add utility functions for searching, removing and replacing
existing values in a container, to be used with std::vector
(including the ArenaVector alias) and other containers.

Also move UniqueCPtr<> and MakeUnique() to base/stl_utils.h
and clean up related includes.

Change-Id: I1e61762df91c046866591bda167d42bf8b67a692
a727e372d8f6929cd30b983f6969c7a50fc83bb6 25-Aug-2015 Andreas Gampe <agampe@google.com> ART: Balanced locking

Change the verifier to check for balanced locking. When balanced
locking can't be guaranteed, use a new failure kind to punt to
the interpreter.

Add smali tests, with JNI code to check the balanced-locking result.

Bug: 23502994
Change-Id: Icd7db0be20ef2f69f0ac784de43dcba990035cd8
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
e682a0250702c65a668e39eefdd1c49cfea5f388 12-Aug-2015 Andreas Gampe <agampe@google.com> ART: Change UninitializedThis tracking in the verifier

Only relying on register types is error-prone. For example, we may
inadvertently reject correct code when the constructor terminates
abnormally.

Bug: 20843113

(cherry picked from commit f10b6e109bfb595b6752d1b59db680694ac1684d)
(cherry picked from commit af31802e5b74f5b9b8d3aadbaaf48cfde14ff7d1)

Change-Id: I8826cd167780df25a6166740f183d216483fa550
f10b6e109bfb595b6752d1b59db680694ac1684d 12-Aug-2015 Andreas Gampe <agampe@google.com> ART: Change UninitializedThis tracking in the verifier

Only relying on register types is error-prone. For example, we may
inadvertently reject correct code when the constructor terminates
abnormally.

Bug: 20843113
Change-Id: I8826cd167780df25a6166740f183d216483fa550
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
4d7b75f9cbcf99134c0a1c69b267b6bc8d94134e 22-Jul-2015 Igor Murashkin <iam@google.com> verifier: Skip verification of methods when seeing experimental opcodes

Bug: 22638098
Change-Id: I9f172f3e0e7ad2aa8873e4036415702fee6bf2eb
8f1e08af6172781f91a17fce0a5a4183a9f70aa9 26-Jun-2015 Vladimir Marko <vmarko@google.com> ART: Don't nest indenters in oatdump.

Reduces the time taken by the oatdump_test by ~12s (15%)
on host and ~55s (9%) on N5.

Change-Id: I99bb16ff5f3640389815f1fe54379ca64eac071b
6415013f0b9509fed8367871daaf66c6841223f1 25-Jun-2015 Andreas Gampe <agampe@google.com> ART: Reset runtime_throw_failure flag

The flag is instruction-specific. It transports the info from Fail
to the main loop. It must be cleared after each iteration.

Introduce a second flag to store whether we saw such a failure at
all.

Update test expectations.

Bug: 22080519

(cherry picked from commit d12e782bcee03ecb6dec41aa9673ef53b638dcea)

Change-Id: I32be914819946233babaa4cb7343844d97b61ba5
d12e782bcee03ecb6dec41aa9673ef53b638dcea 25-Jun-2015 Andreas Gampe <agampe@google.com> ART: Reset runtime_throw_failure flag

The flag is instruction-specific. It transports the info from Fail
to the main loop. It must be cleared after each iteration.

Introduce a second flag to store whether we saw such a failure at
all.

Update test expectations.

Bug: 22080519
Change-Id: I32be914819946233babaa4cb7343844d97b61ba5
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
a497d1cf500f3b06fb401c33e21d38f1bd0026ad 23-Jun-2015 Andreas Gampe <agampe@google.com> ART: Follow-up to 507cc6f83bf6379728f2dd20391f2ed5fbfe6371

Do not trigger DCHECK aborts for final and abstract classes when
they are used from other classes. Instead issue a soft error that
leads to a runtime failure.

Bug: 21873151

(cherry picked from commit f23f33de8b3e9abd16720e0f48d43d63d41dee16)

Change-Id: Ie5251a176722811b3c74585222874313a53f7e02
f23f33de8b3e9abd16720e0f48d43d63d41dee16 23-Jun-2015 Andreas Gampe <agampe@google.com> ART: Follow-up to 507cc6f83bf6379728f2dd20391f2ed5fbfe6371

Do not trigger DCHECK aborts for final and abstract classes when
they are used from other classes. Instead issue a soft error that
leads to a runtime failure.

Bug: 21873151
Change-Id: Ie5251a176722811b3c74585222874313a53f7e02
158f35c98e2ec0d40d2c032b8cdce5fb60944a7f 11-Jun-2015 Igor Murashkin <iam@google.com> interpreter: Add experimental lambda opcodes for invoke/create-lambda

These opcodes are not yet fully specified, and *will* change before they become shippable.
Do not write production code against experimental opcodes.

--

Implement partial interpreter support for new dex instructions invoke/create-lambda, and a
new opcode format 25x.

* Does not verify, in fact verification will soft fail when we see those opcodes.
* Compilers will punt to interpreter since they don't support new opcodes.
* As there is no way to capture/liberate variables yet, the "closure" is just
an ArtMethod for the time being.

All new opcodes are disabled by default, use runtime option -Xexperimental-lambdas to enable them.

For example:
dalvikvm ... -Xexperimental-lambdas ...
dex2oat --runtime-arg -Xexperimental-lambdas ...

Change-Id: I6c996ca32a9b54ec45ec21d7a959b84dfb8a24eb
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
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
d0ad2eea51850ed5972c23d03380b2305cdf7cb7 31-Mar-2015 Mathieu Chartier <mathieuc@google.com> Add support for nested method verifiers

Can occur in the following scenario:
MethodVerifier::Verify -> MethodVerifier::GetStaticField ->
ResolveFieldJLS -> ThrowNoSuchFieldError -> EnsureInitialized ->
VerifyClass

Also fixed another case where we can be requested to dump for ANR
while we are suspended in one of the AllowSuspension points.

Bug: 20140397

Change-Id: Ib17f6b98954caa5d1ea1c1dcde66091cc6d11c25
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
12d625f87bcd6c4059a205bb39007a255f57f382 13-Mar-2015 Mathieu Chartier <mathieuc@google.com> Change method verifiers to be thread local roots

Bug: 10921004

Change-Id: I3a1425d76cd380587ba67ef6d5ec1227564e55bf
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
4306ef8a7ec8e3887e51f64e80d940d974cc3ac3 20-Dec-2014 Mathieu Chartier <mathieuc@google.com> Don't allow suspension from FindLocksAtDexPc

Transitioning to suspended from runnable sometimes runs dump
checkpoints in ThreadStress which can cause deadlocks. This happens
since FindLocksAtDexPC runs the verifier which calls
AllowThreadSuspension. This results in a blocked thread which holds
the monitor lock, and if another thread tries to do a monitor enter,
it deadlocks while holding the mutator lock (assuming the GC is
suspending all).

The fix for avoiding this deadlock is not calling
AllowThreadSuspension from FindLocksAtDexPc.

Bug: 18576985
Change-Id: I7e5faaf3bbbd5b5f680de95d53c33b5106705b0c
7e541c91997b7747fa79014a8ea540395e54efc8 17-Dec-2014 Stephen Kyle <stephen.kyle@arm.com> ART: Fix verification of constructors.

Summary:

A constructor must call its superclass constructor. However, if one
replaces the invoke-direct superclass.<init>() instruction with a
variety of instructions, the verifier would NOT complain that the
superclass constructor hadn't been called.

Detailed explanation:

This was because if we are verifying the return-void insn of a
constructor, then we check that the register line doesn't contain a
register with an UninitializedThis type. With a method like follows:

Class.<init>()V:
return-void

Then we hit the return-void, see the UninitializedThis, and fail the
method. However, with a method like follows:

Class.<init>()V:
nop
return-void

Any insn that continues or branches onto a return-void instruction will
mark all of the registers as Conflict. This meant that the check in
return-void for an UninitializedThis residing the register line would
_always_ pass if there were any insns before it - the entire line had
been set to Conflict.

The fix is to bring the check for an UninitializedThis forward to the
point just before we set all registers to Conflict, if we're about to
hit a return-void insn in a constructor. It still needs to be done
again in the verification of return-void itself, to avoid the solo
return-void case.

This patch also deals with the case where the only remaining
UninitializedThis reference is overwritten, to avoid a method like the
following from getting through verification:

Class.<init>()V:
const/4 v0, 0
return-void

Bug: 18800943

Change-Id: I2e317261844d3b6c78e35228669f3da173316570
Fuzzed-With: https://android-review.googlesource.com/#/c/119463/
36b58f5ebb85d58f8b5966b8577a6dfe720d1e16 10-Dec-2014 Mathieu Chartier <mathieuc@google.com> Add verifier support for dequickening

Also some cleanup.

Bug: 17950037

Change-Id: I1f50fe07f1558e9c4f78953b7afa639d7f310b3c
8e1f4f8f848f2dbb36265a019310498a61cd674d 05-Nov-2014 Ian Rogers <irogers@google.com> Avoid abort in malformed dex code.

Don't allow a perceived double monitor-enter on a register
to abort libartd.
Allow expected verifier errors in the smali tests.
Tidy includes in the method verifier.
Bug: 17978759

Change-Id: Ic44924c788cd2334f91a047fb41b459b89a1843b
896df40bbb20f4a1c468e87313b510c082016dd3 21-Oct-2014 Andreas Gampe <agampe@google.com> ART: Fix possible soft+hard failure in verifier

It was possible to generate a hard failure and a subsequent soft
failure, which violates a CHECKed invariant.

Refactor code slightly to share common code.

Bug: 17625962

(cherry picked from commit f08663b47ccd3aa083972d62937a328ad80d080e)

Change-Id: Iccd9e30f1087363b19b2faedc10243a2290202c0
f08663b47ccd3aa083972d62937a328ad80d080e 21-Oct-2014 Andreas Gampe <agampe@google.com> ART: Fix possible soft+hard failure in verifier

It was possible to generate a hard failure and a subsequent soft
failure, which violates a CHECKed invariant.

Refactor code slightly to share common code.

Bug: 17625962
Change-Id: Iccd9e30f1087363b19b2faedc10243a2290202c0
9bc6199a9a6e140102951f6f38845b43b561af83 22-Sep-2014 Stephen Kyle <stephen.kyle@arm.com> ART: Reject branch/switch/throw to move-result.

move-result* instructions must occur after invoke instructions,
however it was still possible to branch or switch to a move-result*
instruction with creative DEX manipulation. The verifier now rejects
this situation, as well as having a move-result* instruction as the
first instruction in a try block's handler. This now ensures that
move-result* must happen dynamically after an invoke, not just
statically.

Change-Id: Ida97852f4051310fdaf38bed1d6e1c5a541c85c5
Signed-off-by: Stephen Kyle <stephen.kyle@arm.com>
0036cd492ab19668c4efe0975654b7d11d1d8998 18-Sep-2014 Brian Carlstrom <bdc@google.com> Remove MethodVerifier whitespace diff from aosp/master

(cherry picked from commit 6e5251e154cf7e1ce0965f62146467c91a69f811)

Change-Id: I821eee8cfacfbb9b7cc8fa972faa58e9ad47f58e
6e5251e154cf7e1ce0965f62146467c91a69f811 18-Sep-2014 Brian Carlstrom <bdc@google.com> Remove MethodVerifier whitespace diff from aosp/master

Change-Id: Iaec0afe71ed05e44850ed22d4849b464e423c218
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
2ed8deff799448e094fa7a7cb9cf3b718820f4c6 28-Aug-2014 Andreas Gampe <agampe@google.com> ART: Allow quickening in the boot image

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

Bug: 17316928

(cherry picked from commit 35439baf287b291b67ee406308e17fc6194facbf)

Change-Id: I9ef1bfd78b0d93625b89b3d662131d7d6e5f2903
7c438b19b71932ac8a44eff44f20744a01559c8d 13-Sep-2014 Mathieu Chartier <mathieuc@google.com> Fix stale root error in verifier

There was a stale root error caused by the static roots from
the reg types. These were visitied if there was an active verifier
in the method_verifiers_ but this is not always the case when a GC
is run. The fix is to always visit the static method verifier roots.

This only showed up as a bug without an image since these roots
were primitive classes and always in the image, and therefore
didn't ever need to be updated due to moving GC.

(cherry picked from commit 6167864e28e4e12658ebdbaf1d5239acdaf4aaa4)

Change-Id: I592f2770570de97b431671cfbd409f63697892f1
6167864e28e4e12658ebdbaf1d5239acdaf4aaa4 13-Sep-2014 Mathieu Chartier <mathieuc@google.com> Fix stale root error in verifier

There was a stale root error caused by the static roots from
the reg types. These were visitied if there was an active verifier
in the method_verifiers_ but this is not always the case when a GC
is run. The fix is to always visit the static method verifier roots.

This only showed up as a bug without an image since these roots
were primitive classes and always in the image, and therefore
didn't ever need to be updated due to moving GC.

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

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

Bug: 17316928
Change-Id: I9ef1bfd78b0d93625b89b3d662131d7d6e5f2903
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
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
dc3761719fb5e2d1ced5708e3c73b965f9ef0c73 22-Aug-2014 Hiroshi Yamauchi <yamauchi@google.com> Handlerize MethodVerifier::mirror_method_.

The method (mirror_method_) wasn't handlerized across some
allocation/GC points such as the ResolveType() call in
ScanTryCatchBlocks() and the GetReturnType() calls in
CodeFlowVerifyInstruction().

Bug: 12687968
Change-Id: I95323de14459eb5a7c4abfcf44f882f86d59be64
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
ebbdd87cbb57e45da341fbf7325406e982810c10 08-Jul-2014 Ian Rogers <irogers@google.com> Only allow instance-of to improve knowledge of a type for downcasts.

Previous "not upcast" test could improve a type to an impossible type that
following a merge back with the original register would lead to conflict
(and subsequent verifier errors).
Modify UpdateRegisters so that the work line will be updated if merging
causes changes in the fall-through case.

Bug: 15808277
Issue: https://code.google.com/p/android/issues/detail?id=72093
Change-Id: Ib16cae8506246177e902825af036d5a397ad0dac
95c0bf8fb5847cff263639f889d04c7c3c26eedd 16-Jun-2014 Andreas Gampe <agampe@google.com> ART: Make verifier check invocation args of unresolved methods

In the case of unresolvable methods it is not enough to bail out
with a soft verifier failure, as the compiler relies on the
invocation being well-formed. Check all arguments against the
proto id in such a case.

Also make sure to complete parsing arguments in the case the
method was resolved.

Refactored code to unite these two cases.

Bug: 15616104
Change-Id: I5ec58cbfbf6b09eaaf07ddf15edae7c6a8b62b17
576ca0cd692c0b6ae70e776de91015b8ff000a08 07-Jun-2014 Ian Rogers <irogers@google.com> Reduce header files including header files.

Main focus is getting heap.h out of runtime.h.

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

Merge ART from AOSP to lmp-preview-dev.

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

Fixed the generic trampoline to not use ToJObject when unnecessary.

Bug: 15167269

This reverts commit 3bdb873122964da7937eb070cbcf2ef638a8e459.

Change-Id: I0525d0e0f3afb753c770e1572070a0fa22b02271
46960fe5dcc1be07b39a55114338423a73554449 23-May-2014 Ian Rogers <irogers@google.com> Make the specification of when we need precise constants more precise.

Means that oatdump output showing values for deoptimization actually reflects
what we see at runtime.
Also, doesn't do precise in the case of determining methods and fields for the
quickened case, which may be an occasional performance win.

Change-Id: I62c7fb244f7996ba9d52e7a7ce75c046b663fa17
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
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
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
c645f1ddb7c40bea6a38eda4b3f83f6b6dec405b 07-Mar-2014 Mathieu Chartier <mathieuc@google.com> Add more VerifyObject calls.

Added verify object calls to SirtRef, IndirectReferenceTable,
ReferenceTable.

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

Bug: 12934910
Change-Id: I55a46a8ea61fed2a77526eda27fd2cce97a9b125
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
849600bb5cfc02bf5ab4aa9a810667ebd3b53328 20-Dec-2013 Sebastien Hertz <shertz@google.com> Use imprecise constants at compilation time.

During veriifcation, we create constant types for the following instructions:
const/4, const/16, const and const/high16. We used to create "precise" constant
types for each constant we process in the method being verified. Though precise
constants are only useful for deoptimization which happens at runtime.

This CL now creates "imprecise" constant types at compilation time. Since it
reduces the number of constant types we create during verification, it should
also reduce the amount of time spent in verification at compilation time.

Bug: 12167380
Bug: 12126841
Change-Id: I70522c4133a74a533fc2d2cb8d4f49888e590828
2b5eaa2b49f7489bafdadc4b4463ae27e4261817 13-Dec-2013 Vladimir Marko <vmarko@google.com> Move compiler code out of method verifier.

We want to detect small methods for inlining at the end of
the method verification. Instead of adding more compiler
code to the runtime, we create a callback from the runtime
into the compiler, so that we can keep the code there.
Additionally, we move the compiler-related code that was
already in the method verifier to the compiler since it
doesn't really belong to the runtime in the first place.

Change-Id: I708ca13227c809e07917ff3879a89722017e83a9
22cb09b35e8eb30c016065f0eec4b3b96666de43 12-Dec-2013 Jeff Hao <jeffhao@google.com> Add class to verifier's rejected list if superclass is erroneous.

This will prevent the compiler from trying to compile one of these
classes, which will fail because it has no GC map.

Bug: 12104117
Change-Id: I77ec77d30ee5dc92d7f4c594f1e8f1ce9b67855d
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
8171fc34bf74ed0df02385787d916bc13eb7f160 26-Nov-2013 Vladimir Marko <vmarko@google.com> Don't prefix GC map by length.

Bug: 11767815
Change-Id: I063917aefdf7674ee1a77736db059c9ee95ea075
c255e9723c4ac6eff7778ade21296bb5f11ea7bf 19-Nov-2013 Vladimir Marko <vmarko@google.com> Avoid unnecessary copy of dex_gc_map.

Change-Id: I8a7209d92aeee853f6a4e9e9bb0e094c5acd5e05
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
a9a8254c920ce8e22210abfc16c9842ce0aea28f 04-Oct-2013 Ian Rogers <irogers@google.com> Improve quick codegen for aput-object.

1) don't type check known null.
2) if we know types in verify don't check at runtime.
3) if we're runtime checking then move all the code out-of-line.

Also, don't set up a callee-save frame for check-cast, do an instance-of test
then throw an exception if that fails.
Tidy quick entry point of Ldivmod to Lmod which it is on x86 and mips.
Fix monitor-enter/exit NPE for MIPS.
Fix benign bug in mirror::Class::CannotBeAssignedFromOtherTypes, a byte[]
cannot be assigned to from other types.

Change-Id: I9cb3859ec70cca71ed79331ec8df5bec969d6745
d0fbd85a82a266c21d6b72c61d6dc098ec362de7 25-Sep-2013 Ian Rogers <irogers@google.com> Reduce memory allocation in verifier.

Remove the use of a map PcToRegisterLineTable for efficiency (matches Dalvik).
Place the register line register values inside the RegisterLine, saves a
secondary allocation and indirection.
Avoid the use of a deque in RegisterLine to avoid an allocation.
Simplify the SirtRef destructor in non-debug builds.
Saves >100ms from the two threaded compile time of ThinkFree on host.

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

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

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

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

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

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

Change-Id: I20c73a3b17d86286428ab0fd21bc13f51f36c85c
b8a0b94735f188bc739e4c55479c37699006b881 21-Aug-2013 Ian Rogers <irogers@google.com> Switch JNI globals lock to reader-writer.

Also, verifier rejected classes lock. These locks show as contended during
dex2oat, however, they're commonly only read access is required.

Change-Id: If8bb834cc69cd8c26494c87fb7f7b20d4e41cdfd
90af14d2743614e3e1453984b14258a6f145501d 16-Aug-2013 Dragos Sbirlea <dragoss@google.com> Get SEA fibonacci running in interpreter mode.

Android.mk: Added new file to build.
compile_driver.cc: Moved SE_IR usage test in the block
protected by bool compile, which is enabled by
adding a sepatate test in IsCnadidateForCompilation.
class_linker.cc: Added check in NeedsInterpreter to enable SEA_IR.
art_method-inl.h: DIsabled check in SEA_IR mode.
method_verifier.cc: Added check for SEA_IR mode.
method_verifier.h: Chenged IsCandidateForCompilation signature to
allow testing the function name (for SEA_IR selective
compilation).
dot_gen.h: Updated ART file API usage to altest version.
sea_ir/frontend.cc: Passing function symbol name to CompileMethod.
instruction_Nodes.h: Added accessor for method index for
InvokeStatic IR node.
sea.cc: Added additional IR SignatureNode for function calls (extra
Method parameter). Fixed UnnamedConstant constant value.
sea.h: Passing function_name to GenerateLLVM.
type_inference_visitor.cc: Aded type for first (placeholder) method
parameter.

Change-Id: I295858ea0761a3dffb36f35748d8b93d4919d6a9
02e25119b15a6f619f17db99f5d05124a5807ff3 15-Aug-2013 Mathieu Chartier <mathieuc@google.com> Fix up TODO: c++0x, update cpplint.

Needed to update cpplint to handle const auto.

Fixed a few cpplint errors that were being missed before.

Replaced most of the TODO c++0x with ranged based loops. Loops which
do not have a descriptive container name have a concrete type instead
of auto.

Change-Id: Id7cc0f27030f56057c544e94277300b3f298c9c5
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
7644966addc0d7760baffc8897799f019981d74f 01-Aug-2013 Jeff Hao <jeffhao@google.com> Move verification of primitive type puts into helper method.

Change-Id: Ia40d9f85303a52e20ca57acf13a0cfc8a9922024

Conflicts:
runtime/verifier/method_verifier.cc

(cherry-picked from commit fe1f7c84369abbf5a0121557aa0c6c58e9477710)
c6c6e222ab7ac479d849ac4143d589971b17425b 02-Aug-2013 Sebastien Hertz <shertz@google.com> Fix memory leak in verifier.

We create std::ostringstream objects for failure messages but it appears we did
not delete them upon destruction. This CL fixes this.

Change-Id: If95c6f1b154db9c1d49ade4c1384ef6015663419
(cherry picked from commit 33691abbc43850fd2b2951256c4b6bbc9733ccc8)
d678802609ad07ec2f307caecce5fe5a16fedd46 05-Aug-2013 Sebastien Hertz <shertz@google.com> Use reader writer mutex for safe checkcast map.

Use a ReaderWriterMutex to protect MethodVerifier::safecast_map_ like
what's done for MethodVerifier::dex_gc_maps_ and MethodVerifier::devirt_maps_.

Change-Id: Id2ac9c290cc524eb992ea7cabe63766e88753747
(cherry picked from commit b9c37fb5746cc240e86677e56cb0d74d829e3504)
b9c37fb5746cc240e86677e56cb0d74d829e3504 05-Aug-2013 Sebastien Hertz <shertz@google.com> Use reader writer mutex for safe checkcast map.

Use a ReaderWriterMutex to protect MethodVerifier::safecast_map_ like
what's done for MethodVerifier::dex_gc_maps_ and MethodVerifier::devirt_maps_.

Change-Id: Id2ac9c290cc524eb992ea7cabe63766e88753747
33691abbc43850fd2b2951256c4b6bbc9733ccc8 02-Aug-2013 Sebastien Hertz <shertz@google.com> Fix memory leak in verifier.

We create std::ostringstream objects for failure messages but it appears we did
not delete them upon destruction. This CL fixes this.

Change-Id: If95c6f1b154db9c1d49ade4c1384ef6015663419
fe1f7c84369abbf5a0121557aa0c6c58e9477710 01-Aug-2013 Jeff Hao <jeffhao@google.com> Move verification of primitive type puts into helper method.

Change-Id: Ia40d9f85303a52e20ca57acf13a0cfc8a9922024
834b394ee759ed31c5371d8093d7cd8cd90014a8 31-Jul-2013 Brian Carlstrom <bdc@google.com> Merge remote-tracking branch 'goog/dalvik-dev' into merge-art-to-dalvik-dev

Change-Id: I323e9e8c29c3e39d50d9aba93121b26266c52a46
7934ac288acfb2552bb0b06ec1f61e5820d924a4 26-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint whitespace/comments issues

Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
4d4adb1dae07bb7421e863732ab789413a3b43f0 24-Jul-2013 Sebastien Hertz <shertz@google.com> Prevent verifier from creating unused compilation data.

The verifier used to create data which may be unused like GC map. This is the
case for non-compiled method (which are interpreted). This CL aims to optimize
this.

Here are the changes:
- Move compilation selection to MethodVerifier::IsCandidateForCompilation.
- Compiler and verifier use this method to know if a method must be compiled.
- Only create compilation data while compiling using Runtime::IsCompiler.
- Do not create internal structures concerning GC map, ... in Runtime::Init and
Runtime::Shutdown when we are not compiling.
- Checks we are compiling when accessing these structures.
- Add missing destruction of MethodVerifier::safecast_map_lock_ and
MethodVerifier::safecast_map_ in Runtime::Shutdown.
- Call Runtime::Shutdown just before Runtime instance is destroyed to avoid a
crash.
- Add missing "GUARDED_BY" macro for MethodVerifier::rejected_classes_ field.
- Add "has_check_casts" to avoid the safecast pass if there is no check-cast
instruction.
- Add "has_virtual_or_interface_invokes" to avoid the devirtualization pass if
there is no invoke-virtual/range nor invoke-interface/range instructions.

Bug: 9987437
Change-Id: I418ee99f63e4203409cf5b7d2c2295b22fcf24c1
fc0e3219edc9a5bf81b166e82fd5db2796eb6a0d 17-Jul-2013 Brian Carlstrom <bdc@google.com> Fix multiple inclusion guards to match new pathnames

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