History log of /art/runtime/interpreter/interpreter_common.h
Revision Date Author Comments
df2d4f22d5e89692c90b443da82fe2930518418b 30-Jun-2016 Artem Udovichenko <artem.u@samsung.com> Revert "Revert "Optimize IMT""

This reverts commit 88f288e3564d79d87c0cd8bb831ec5a791ba4861.

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

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

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

This reverts commit 0790af1391b316c5c12b4e135be357008c060696.

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

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

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

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

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

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

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

Bug: 29188168

(cherry picked from commit badee9820fcf5dca5f8c46c3215ae1779ee7736e)

Change-Id: If8db765e3333cb78eb9ef0d66c2fc78a5f17f497
6b2ddc8d347840b230b5984ce0f22b765e6cdf6c 19-May-2016 Mingyao Yang <mingyao@google.com> Revert "Revert "Move rewritten StringFactory call results into dex registers for deopt""

Potential gc points can make the result value stale. We now set the result value
to null proactively once it's moved to shadow frame registers. IsStringInit()
is written in a way that does string comparison instead of requiring method
resolution so that it doesn't have a gc point. Also we don't cache the callee
method during frame unwinding since the method may be rewritten already.

(cherry picked from commit ffedec510c07cf0f77d0cce51940838f2e630514)

Bug: 28555675

Change-Id: Ic51511a4a0fc84a852d8d907f91e7835f49ac478
5a6171d7909666cb58383e2b2a0c2f51ace3f5ef 19-May-2016 Roland Levillain <rpl@google.com> Revert "Move rewritten StringFactory call results into dex registers for deopt"

This reverts commit 0ea451b4d74e8ddc28ea5ce87ef6d21113a3cdd5.

597-deopt-new-string is failing.

Bug: 28846692
Bug: 28555675
Change-Id: I8274e5ae1d065dedc562132882b39e7f3fe5baf4
0ea451b4d74e8ddc28ea5ce87ef6d21113a3cdd5 16-May-2016 Mingyao Yang <mingyao@google.com> Move rewritten StringFactory call results into dex registers for deopt

Bug: 28555675

(cherry picked from commit 8ca33bf04060fadd5b35fa93fa56547c62fe52e7)

Change-Id: I9236df283f2e83ca5dcde01f73dc0522d745cd59
f517e283d477dd2ae229ee3f054120c6953895db 28-Apr-2016 Andreas Gampe <agampe@google.com> ART: Disambiguate access-checks mode from lock-counting

Lock-counting (when structural locking verification failed) is a
special sub-mode of access-checks and must be disambiguated, because
we currently use access-checks mode class-wide when at least one
method soft-fails, but do not stop the compiler/JIT to compile
the "working" methods. So we may end up in the access-checks
interpreter for a working method through deopt without knowing
which locks are already held.

Bug: 28351535
Change-Id: I083032f064d88df8f8f0611ad8b57d1b39cd09fb
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
bb11c8b1219f5b4b3154c2c83fca19ec8add6646 12-Apr-2016 Nicolas Geoffray <ngeoffray@google.com> Remove the JIT from the instrumentation framework.

This was slowing down the interpreter for no reason.
Also, call AddSamples for invoke-static and invoke-direct.

bug:27865109

(cherry picked from commit 274fe4adcb0610a9920be7814d9beb9cac6417ce)

Change-Id: I3519456ac8e0c7211cbe3f12e88d134beee87479
9fb0ac70e4627be7113533cc126483117bfca068 19-Feb-2016 Serguei Katkov <serguei.i.katkov@intel.com> Enable bytecode tracing in ART FI

Trace bytecode execution in Fast Interpreter similar to
other interpreters.

Update TraceExecutionEnabled function to switch on tracing.

Change-Id: Icabc17871c8198b11cd4c3dbfaa901e4fbf67946
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
05d241565f36df825cf56a4f1b61bfb7e4dcb056 06-Jan-2016 Siva Chandra <sivachandra@google.com> Add option to never interpret.

Change-Id: Ib6d6170fa60c77c2e6a8844964f14fa0de4c9e7b
1452bee8f06b9f76a333ddf4760e4beaa82f8099 06-Mar-2015 buzbee <buzbee@google.com> Fast Art interpreter

Add a Dalvik-style fast interpreter to Art.
Three primary deficiencies in the existing Art interpreter
will be addressed:

1. Structural inefficiencies (primarily the bloated
fetch/decode/execute overhead of the C++ interpreter
implementation).
2. Stack memory wastage. Each managed-language invoke
adds a full copy of the interpreter's compiler-generated
locals on the shared stack. We're at the mercy of
the compiler now in how much memory is wasted here. An
assembly based interpreter can manage memory usage more
effectively.
3. Shadow frame model, which not only spends twice the memory
to store the Dalvik virtual registers, but causes vreg stores
to happen twice.

This CL mostly deals with #1 (but does provide some stack memory
savings). Subsequent CLs will address the other issues.

Current status:
Passes all run-tests.
Phone boots interpret-only.
2.5x faster than Clang-compiled Art goto interpreter on fetch/decode/execute
microbenchmark, 5x faster than gcc-compiled goto interpreter.
1.6x faster than Clang goto on Caffeinemark overall
2.0x faster than Clang switch on Caffeinemark overall
68% of Dalvik interpreter performance on Caffeinemark (still much slower,
primarily because of poor invoke performance and lack of execute-inline)
Still nearly an order of magnitude slower than Dalvik on invokes
(but slightly better than Art Clang goto interpreter.
Importantly, saves ~200 bytes of stack memory per invoke (but still
wastes ~400 relative to Dalvik).

What's needed:
Remove the (large quantity of) bring-up hackery in place.
Integrate into the build mechanism. I'm still using the old Dalvik manual
build step to generate assembly code from the stub files.
Remove the suspend check hack. For bring-up purposes, I'm using an explicit
suspend check (like the other Art interpreters). However, we should be
doing a Dalvik style suspend check via the table base switch mechanism.
This should be done during the alternative interpreter activation.
General cleanup.
Add CFI info.
Update the new target bring-up README documentation.
Add other targets.

In later CLs:
Consolidate mterp handlers for expensive operations (such as new-instance) with
the code used by the switch interpreter. No need to duplicate the code for
heavyweight operations (but will need some refactoring to align).
Tuning - some fast paths needs to be moved down to the assembly handlers,
rather than being dealt with in the out-of-line code.
JIT profiling. Currently, the fast interpreter is used only in the fast
case - no instrumentation, no transactions and no access checks. We
will want to implement fast + JIT-profiling as the alternate fast
interpreter. All other cases can still fall back to the reference
interpreter.
Improve invoke performance. We're nearly an order of magnitude slower than
Dalvik here. Some of that is unavoidable, but I suspect we can do
better.
Add support for our other targets.

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

955-lambda is flaky

Bug: 24618608
Bug: 25107649

This reverts commit 457e874459ae638145cab6d572e34d48480e39d2.

(cherry picked from commit 3a0909248e04b22c3981cbf617bc2502ed5b6380)

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

955-lambda is flaky

Bug: 24618608
Bug: 25107649

This reverts commit 457e874459ae638145cab6d572e34d48480e39d2.

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

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

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

Note: MIPS32/64 support not included.

Bug: 24618608
Bug: 25107649
Change-Id: Ic8f1bb66ebeaed4097e758a50becf1cff6ccaefb
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
30c475a2046951a81769c2db0b2dad66cd71e189 06-Oct-2015 Igor Murashkin <iam@google.com> lambda: Minor capture-variable/liberate-variable clean-up after post-merge reviews.

Change-Id: I64f867d4ed5a5efcac138097f38efe4bb7f1281d
2d096c94fbd3fd2470b8ac1a0da6f577b3f69f42 13-Oct-2015 Mathieu Chartier <mathieuc@google.com> Fix moving GC bugs in MonitorEnter and MonitorExit

Fixes test 088 with gcstress mode.

Change-Id: Iaeb91f62f22233e403e97e954bfdc8dc367e63c8
03ec930faded5bbfa096533ce60b6893847922db 28-Aug-2015 Andreas Gampe <agampe@google.com> ART: Lock counting in the interpreter

To support structured locking when balanced-locking verification
failed, count lock and unlock operations in the verifier.

Bug: 23502994
Change-Id: I2bb915da6e3d43c49723a943b42d4d5a7c939aa1
6918bf13eb855b3aa8ccdddda2d27ae8c60cec56 28-Sep-2015 Igor Murashkin <iam@google.com> Revert "Revert "lambda: Experimental support for capture-variable and liberate-variable""

This reverts commit 7bbb80ab52c203e44d2ded2c947b3b03b4b31ec4.

Change-Id: If806ce5c6c5e96fdb2c3761dee096f74e7e5b001
7bbb80ab52c203e44d2ded2c947b3b03b4b31ec4 27-Sep-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "lambda: Experimental support for capture-variable and liberate-variable"

Test fails.

This reverts commit b72123440d8541362ebdb131436f9dbdda5fd329.

Change-Id: Ic9ed92f8c826d8465eb36b746dc44af05caf041c
b72123440d8541362ebdb131436f9dbdda5fd329 25-Sep-2015 Igor Murashkin <iam@google.com> lambda: Experimental support for capture-variable and liberate-variable

Supports capturing/liberating any primitive variables.
No support for capturing objects/lambdas yet since they would both
need GC changes to track roots through closures.

Change-Id: Ibfb68bfe4c579dbf93823aac4c0e6ac8f6360c5d
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
05792b98980741111b4d0a24d68cff2a8e070a3a 03-Aug-2015 Vladimir Marko <vmarko@google.com> ART: Move DexCache arrays to native.

This CL has a companion CL in libcore/
https://android-review.googlesource.com/162985

Change-Id: Icbc9e20ad1b565e603195b12714762bb446515fa
3a35714ebca10c989aa383c0861e2e84fe8dadf8 08-Aug-2015 Andreas Gampe <agampe@google.com> ART: Clean up unnecessary ArtMethod**

ArtMethods are no longer Java objects, so the additional indirection
is no longer necessary here.

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

This reverts commit a315f5c546b796f55f4872bb6efc15eb858d9639.

--

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

This reverts commit bc1d78daa463572c5a770cdca858a3b51d8e1b7b.

--

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

This reverts commit fb326cffc679cab8eb873b9e44795706f023cb3c.
fb326cffc679cab8eb873b9e44795706f023cb3c 24-Jul-2015 Igor Murashkin <iam@google.com> base: replace raw pointers for out-parameters with safer out<T>

Add a zero-cost type-safe abstraction for representing "out" parameters
(i.e. when the calling function has to return multiple results out
by-reference into the argument slots instead of using the return slot).

Change-Id: I33a941e4863b6bed71d2bfa43d7f48e9b111f83f
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
e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7 10-Jul-2015 Igor Murashkin <iam@google.com> runtime: Add lambda box/unbox object equality

A lambda that is boxed with box-lambda is now stored as a weak reference
in a global runtime table (lambda::BoxTable). Repeatedly boxing the same
lambda closure value will always return the same java.lang.Object back.

Since there is no way to observe the address of an object, a GC can
happen and clean up the table of any dead boxed lambdas, which can also
shrink the table to prevent the memory use from growing too much.

(Note that a lambda closure is immutable, so hashing over it is
guaranteed safe.)

Change-Id: I786c1323ff14eed937936b303d511875f9642524
14d90579f013b374638b599361970557ed4b3f09 16-Jul-2015 Roland Levillain <rpl@google.com> Use (D)CHECK_ALIGNED more.

Change-Id: I9d740f6a88d01e028d4ddc3e4e62b0a73ea050af
2ee54e249ad21c74f29a161e248bebe7d22fddf1 18-Jun-2015 Igor Murashkin <iam@google.com> runtime: Partially implement box-lambda and unbox-lambda experimental opcodes

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 box/unbox-lambda.
* box-lambda will take a closure and convert it into an Object
* unbox-lambda will take an Object and convert it to a closure

(Currently does not implement object identity or variable capture).

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

Change-Id: I3c15ccf8a26ccecd1d35808a8c1b4149220f6019
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
df75bca6bd100ca9c2c395b1b8d2f8a871ab2c62 17-Jun-2015 David Brazdil <dbrazdil@google.com> ART: Allow PackedSwitch instructions with zero targets

Optimizing and the interpreter wrongly assumed that a PackedSwitch
always has at least one target. This patch removes the corresponding
DCHECKs and adds a regression test case.

This is a resubmission of CL I32b7033ed38de6f1d1a6ee5d5bf12f3a47c9b37e

Bug: 21863783
Change-Id: I04e6e124bdd16591ba27c79490e6ce183c36b691
(cherry picked from commit 2ef645ba50544b879a82ea30e606f18c9af98917)
2ef645ba50544b879a82ea30e606f18c9af98917 17-Jun-2015 David Brazdil <dbrazdil@google.com> ART: Allow PackedSwitch instructions with zero targets

Optimizing and the interpreter wrongly assumed that a PackedSwitch
always has at least one target. This patch removes the corresponding
DCHECKs and adds a regression test case.

This is a resubmission of CL I32b7033ed38de6f1d1a6ee5d5bf12f3a47c9b37e

Bug: 21863783
Change-Id: I04e6e124bdd16591ba27c79490e6ce183c36b691
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
45b1597c152af90f6d5792d02b64fd4e7c81ac9d 03-Apr-2015 Sebastien Hertz <shertz@google.com> Use va_list argument to abort transaction

Creates AbortTransactionV taking a va_list argument and renames
AbortTransaction to AbortTransactionF which calls AbortTransactionV.

This fixes the compiler_driver_test under valgrind.

Change-Id: Ia1c57330091c055ae9e46585a944ce0b78864920
935e01a1e4c0f0ac257c5a9b71bda50a9d441fa3 21-Mar-2015 Jeff Hao <jeffhao@google.com> Fix interpreter to allow 0 size sparse switches.

Bug: 19827056
Change-Id: I12eaf717f1a4b9bd5e0c8e2a508df9da4e61c4ec
2969bcdcd80624e4a4fef696b54c2c76b44b6853 09-Mar-2015 Andreas Gampe <agampe@google.com> ART: Refactor unstarted runtime

Refactor and clean up unstarted runtime.

Bug: 19542228
Change-Id: Ib3e4b3517e06e8242d4fed32ca59419fef553a47
0aa50ce2fb75bfc2e815a0c33adf9b049561923b 10-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Remove ThrowLocation.

Note that this is a cleanup change, and has no functionality change.
The ThrowLocation had no use anymore.

Change-Id: I3d2126af1dc673cec3a0453ff3d56a172663a5f6
794ad76e8d5b5b9132819d5b08a0570e27615644 23-Feb-2015 Andreas Gampe <agampe@google.com> ART: Introduce NO_RETURN, Mark DoLongJump noreturn

Add NO_RETURN macro that adds C++11 noreturn attribute. Mark
DoLongJump methods as noreturn.

Change-Id: Ifde4318e370493237050d4c1349285a0382df23f
e94652f1e321b2c8b71acbe5b07d2ebf69fbdb99 02-Dec-2014 Ian Rogers <irogers@google.com> Remove MethodHelper from the interpreter.

Use ShadowFrame to get the executing method to avoid a handle for the current
method.
Various associated bits of header file clean-up and removal of an unnecessary
use of MethodHelper in CompilerDriver.

Change-Id: I3b6f4413701e8fc6b0c58b0041a0dd15472bedaa
eace45873190a27302b3644c32ec82854b59d299 25-Nov-2014 Mathieu Chartier <mathieuc@google.com> Move dexCacheStrings from ArtMethod to Class

Adds one load for const strings which are not direct.

Saves >= 60KB of memory avg per app.
Image size: -350KB.

Bug: 17643507
Change-Id: I2d1a3253d9de09682be9bc6b420a29513d592cc8

(cherry picked from commit f521f423b66e952f746885dd9f6cf8ef2788955d)
f72a11dd4b0dd86bc4b1baa37bfa47fc8d5572b5 30-Oct-2014 Ian Rogers <irogers@google.com> Add math routines with defined wrapping behavior for the interpreter.

Add a RSUB_INT_LIT16 instruction alias to make instruction opcode switch
statements easier to read.

Change-Id: I3bac07c9518665abf0b05b5c3105a90be22f780a
6786a58659420c0631a1ebe1f2fde434b8bcd1e4 28-Oct-2014 Ian Rogers <irogers@google.com> Remove ResolveString from MethodHelper.

Change-Id: Ice0fff0680f876285539f78cd79d520d424e2f5e
cf7f19135f0e273f7b0136315633c2abfc715343 23-Oct-2014 Ian Rogers <irogers@google.com> C++11 related clean-up of DISALLOW_..

Move DISALLOW_COPY_AND_ASSIGN to delete functions. By no having declarations
with no definitions this prompts better warning messages so deal with these
by correcting the code.
Add a DISALLOW_ALLOCATION and use for ValueObject and mirror::Object.
Make X86 assembly operand types ValueObjects to fix compilation errors.
Tidy the use of iostream and ostream.
Avoid making cutils a dependency via mutex-inl.h for tests that link against
libart. Push tracing dependencies into appropriate files and mutex.cc.
x86 32-bit host symbols size is increased for libarttest, avoid copying this
in run-test 115 by using symlinks and remove this test's higher than normal
ulimit.
Fix the RunningOnValgrind test in RosAllocSpace to not use GetHeap as it
returns NULL when the heap is under construction by Runtime.

Change-Id: Ia246f7ac0c11f73072b30d70566a196e9b78472b
c7dd295a4e0cc1d15c0c96088e55a85389bade74 22-Oct-2014 Ian Rogers <irogers@google.com> Tidy up logging.

Move gVerboseMethods to CompilerOptions. Now "--verbose-methods=" option to
dex2oat rather than runtime argument "-verbose-methods:".
Move ToStr and Dumpable out of logging.h, move LogMessageData into logging.cc
except for a forward declaration.
Remove ConstDumpable as Dump methods are all const (and make this so if not
currently true).
Make LogSeverity an enum and improve compile time assertions and type checking.
Remove log_severity.h that's only used in logging.h.
With system headers gone from logging.h, go add to .cc files missing system
header includes.
Also, make operator new in ValueObject private for compile time instantiation
checking.

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

Remove extra semicolons.

Dollar signs in C++ identifiers are an extension.

Named variadic macros are an extension.

Binary literals are a C++14 feature.

Enum re-declarations are not allowed.

Overflow.

Change-Id: I7d16b2217b2ef2959ca69de84eaecc754517714a
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
e19f2b00eebd61e73761ab531866654f08968711 16-Jul-2014 Mingyao Yang <mingyao@google.com> Set vtable in class object to null after linking.

This is follow-up work of embedding imt and vtable for
faster interface/virtual call dispatching.
Once vtable becomes embedded, the original vtable is nulled.

(cherry picked from commit 2cdbad7c62f126581ec5177104de961c4d71adaa)

Change-Id: I6acdcd1ee560d387fb77c55c58bbe3598c197ba1
2cdbad7c62f126581ec5177104de961c4d71adaa 16-Jul-2014 Mingyao Yang <mingyao@google.com> Set vtable in class object to null after linking.

This is follow-up work of embedding imt and vtable for
faster interface/virtual call dispatching.
Once vtable becomes embedded, the original vtable is nulled.

Change-Id: I307696657d1e283654169dbecb8f7815c42bbabc
22d5e735f403c57525fe868304c7123f0ce66399 16-Jul-2014 Ian Rogers <irogers@google.com> Remove object_utils.h.

Break into object_lock, field_helper and method_helper.
Clean up header files following this.
Also tidy some of the Handle code in response to compiler errors when resolving
the changes in this CL.

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

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

Bug: 8142917
Change-Id: I4240d58cfbe9250107c95c0708c036854c455968
4965c02b9074f4a3dc0a6ffe6d1b7e256f1c26c7 11-Jun-2014 Douglas Leung <douglas@mips.com> Fix compilation errors when setting kTracing = true.

Change-Id: I946c98021166bd099983a8f50a18b57d8eac6af6
Signed-off-by: Douglas Leung <douglas@mips.com>
5487494e54e719d3bb4ead7a0b73e1d456fec8da 11-Jun-2014 Ian Rogers <irogers@google.com> Workaround frame size issues.

x86 and x86-64 are exceeding the frame size for the switch interpreter.
The SOMETIMES_INLINE hack doesn't work with GCC as inline and the noinline
attribute are mutually exclusive. As a temporary solution move the effected
code to the the interpreter_common.cc file.
Bug: 14882674

Change-Id: Id5383ef5436046b36565cd1d76de8e3d59f42cff
9f1020305292a21fd14a402b189c765a125226ab 23-May-2014 Sebastien Hertz <shertz@google.com> Fix exception reporting from interpreter

To comply with JDWP exception report rules, we must report an exception at the
location of the throw (or the first instruction encountered after a native
call). To do this, we use the CatchLocationFinder visitor to look for a catch
handler until we reach a native frame or the top frame.

Because interpreter handles pending exception on a method-by-method basis, we
need a flag to remember we already reported the exception and avoid reporting
it multiple times when unwinding methods. The drawback is we need to maintain
the state of this flag. We clear it when the exception is cleared. In the case
we temporarily clear the exception (when finding a catch handler for instance),
we restore the flag to its previous value at the same time we restore the
pending exception.

Bump oat version to force recompilation because we modify Thread offsets.

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

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

Bug: 13077697

Change-Id: I71f964d4d810ab4debda1a09bc968af8f3c874a3
61c5ebc6aee2cac1c363de6fbdac25ada1697fdb 06-Jun-2014 Mathieu Chartier <mathieuc@google.com> Change FieldHelper to use a handle.

Fixed compaction bugs related to FieldHelper::GetType in:
artSet32InstanceFromCode
SetFieldValueImpl
CheckReceiver
Field_set
interpreter::DoFieldPut
MethodVerifier::VerifyISGet
MethodVerifier::VerifyISPut
MethodVerifier::VerifyIGetQuick

Bug: 13077697

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

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
822266b9dc7d8dc9e084192ae0f4bc95af4e8cf8 30-May-2014 Ian Rogers <irogers@google.com> Ignore catch blocks whose type can't be resolved.

Reverts change 72b3e430d880ef57eaa6a34a0822165994052202 but keeps unit test and
missing delete that would fail assertions on long jump context recycling.

Change-Id: I926755e8b831b208aa7e1ce46421bef3793a1441
da843e11bd5f2177a776c37de033228a7ea230af 28-May-2014 Sebastien Hertz <shertz@google.com> Another workaround for stack overflow issue with clang

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

Fixed the generic trampoline to not use ToJObject when unnecessary.

Bug: 15167269

This reverts commit 3bdb873122964da7937eb070cbcf2ef638a8e459.

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

This reverts commit e09ae0920be57760fb390b6944bce420fa0b5582.

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

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

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

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

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

Change-Id: I1b51723920a2e4f4f8b2907066f578a3e879fd5b
865df6eb95f0fbb2b7761dd29689b26473c37ffe 20-May-2014 Sebastien Hertz <shertz@google.com> Workaround stack overflow issue with clang

Bug: 14882674
Change-Id: I633251eb5229f0a65c27c6d771a7ff21f616a0f3
82aeddb83c58db5fe1e227de574eb8ced4fc6130 20-May-2014 Sebastien Hertz <shertz@google.com> Workaround stack overflow issue with clang

Bug: 14882674
Change-Id: I633251eb5229f0a65c27c6d771a7ff21f616a0f3
f832284dd847ff077577bb5712225430bbbb3b67 16-May-2014 Mathieu Chartier <mathieuc@google.com> Delete ClassHelper and fix compaction bug in GetDirectInterface

Cleanup helps to prevent compaction bugs. Fixed a fairly serious
compaction error caused by calling ClassHelper::GetDirectInterface
without handling the case where it causes thread suspension due to
ResolveType.

Bug: 8981901

Change-Id: I82b3bb6dd48d21eb6ece7aae0733c4a23c2bc408
72b3e430d880ef57eaa6a34a0822165994052202 14-May-2014 Andreas Gampe <agampe@google.com> ART: Fix typo in ArtMethod::FindCatchBlock

The thrown exception is always resolved, as we have an instance of
it. What is potentially not resolved is the catch handler's exception
type.

The resolution failure will trigger a NoClassDefFoundError, which
should replace the original exception. For this, the API has to be
changed a little bit to tell callers that there was this change.

Change-Id: Id51d54a15c732ed175eb617b3b0331b89cbb2051
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
b2c7ead6bb5c98282cdfbc89db8984a004bea030 29-Apr-2014 Mathieu Chartier <mathieuc@google.com> Don't allow allocating finalizable objects during transactions.

It doesn't make sense to allocate finalizable objects during a
transcation since they will never get finalized without a started
runtime.

Before StatusInitialized in core.host.oatdump.txt: 3564
After StatusInitialized in core.host.oatdump.txt: 3564

Bug: 14078487

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

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

Bug: 14285442

Change-Id: Ie23b11d4f18cb15a62c3bbb42837a8aaf6b68f92
479fc1ecc12fa6560ca90d841c4d5174fb346618 04-Apr-2014 Sebastien Hertz <shertz@google.com> Support field watchpoint in interpreter

We report field read/write events to instrumentation from the interpreter. This
allows it to send JDWP field access and field modification events to debugger.
This completes CL https://android-review.googlesource.com/90390.

We also fix the JDWP FieldOnly modifier by introducing ModBasket.fieldTypeID.
We incorrectly used ModBasket.classId which is actually dedicated to ClassOnly
modifier based on thread's location's class id.

Finally, we now enable canWatchFieldModification and canWatchFieldAccess JDWP
capabilities so a debugger can request these events to be reported.

Bug: 8267708
Change-Id: I987852ad47abb27b2f7e78544a8189c7a4e2f462
aa961918da5142220029da2809287e0dd537a5d7 22-Apr-2014 Jeff Hao <jeffhao@google.com> Fix FindCatchBlock to work in -Xverify:none mode.

FindCatchBlock now uses ResolveType to get the exception type,
since it might not be able to find it in the dex cache.

Bug: 13948502
Change-Id: Ia6f1c7dc743206ae1c8551bf6239f48ee4d3a784
53b8b09fc80329539585dcf43657bc5f4ecefdff 14-Mar-2014 Ian Rogers <irogers@google.com> Refactor reflective method invocation.

Move invocation code out of JNI internal into reflection, including ArgArray
code. Make reflective invocation use the ArgArray to build arguments rather
than allocating a jvalue[] and unboxing arguments into that.
Move reflection part of jni_internal_test into reflection_test.
Make greater use of fast JNI.

Change-Id: Ib381372df5f9a83679e30e7275de24fa0e6b1057
b48b9eb6d181a1f52e2e605cf26a21505f1d46ed 01-Mar-2014 Ian Rogers <irogers@google.com> Fix clang to compile and run host tests.

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

Change-Id: Ia54348f6b1bd3f76d3b71c6e8c5f97626386b903
d2fe10a3a34af171bf1631219cd2d6ff6b7778b5 15-Jan-2014 Sebastien Hertz <shertz@google.com> Remove blacklist

Removes the class initialization blacklist and use transaction to detect and
revert class initialization attempting to invoke native method. This only
concerns class initialization happening at compilation time when generating an
image (like boot.art for the system).

In transactional mode, we log every object's field assignment and array update.
Therefore we're able to abort a transaction to restore values of fields and
array as they were before the transaction starts. We also log changes to the
intern string table so we can restore its state prior to transaction start.

Since transactional mode only happens at compilation time, we don't need to log
all these changes at runtime. In order to reduce the overhead of testing if
transactional mode is on/off, we templatize interfaces of mirror::Object and
mirror::Array, respectively responsible for setting a field and setting an
array element.

For various reasons, we skip some specific fields from transaction:
- Object's class and array's length must remain unchanged so garbage collector
can compute object's size.
- Immutable fields only set during class loading: list of fields, method,
dex caches, vtables, ... as all classes have been loaded and verified before a
transaction occurs.
- Object's monitor for performance reason.

Before generating the image, we browse the heap to collect objects that need to
be written into it. Since the heap may still holds references to unreachable
objects due to aborted transactions, we trigger one collection at the end of
the class preinitialization phase.

Since the transaction is held by the runtime and all compilation threads share
the same runtime, we need to ensure only one compilation thread has exclusive
access to the runtime. To workaround this issue, we force class initialization
phase to run with only one thread. Note this is only done when generating image
so application compilation is not impacted. This issue will be addressed in a
separate CL.

Bug: 9676614
Change-Id: I221910a9183a5ba6c2b99a277f5a5a68bc69b5f9
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
9119c5f9e4f447f4209d51cff66d1aace510ce5e 16-Dec-2013 Sebastien Hertz <shertz@google.com> Cleanup invoke's receiver handling in interpreter.

To comply with a moving collector, we used to load invoke's receiver (for non
static methods only) from the caller shadow frame after resolving the method
itself (in case the garbage collector is triggered inside) but before passing
invoke arguments, including loading receiver from the caller's shadow frame
into the callee's shadow frame. Therefore, we used to load the receiver 3 times
in the fast path but only twice in the slow path.

The slow path is rarely used (only in method requiring extra runtime checks) so
we now move this extra reload to the slow path. Therefore an invoke using the
fast path loads the receiver twice while the slow path loads it 3 times.

I don't expect much improvement here. The main reason is to keep extra code in
the slow path.

Change-Id: I10e96b10de4b8c2992e276bd564bc3e2f191779c
460536209b741bc469f1b0857775449abb2102fb 12-Dec-2013 Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> Don't rely on gcc extensions

Make the code more compatible with different compilers.
clang doesn't allow extra static qualifiers on template
specializations, const qualifiers on function types,
or inline attributes on lambda functions, and is more
picky about casting away constness with reinterpret_cast.

These modifications are compatible with both gcc and
clang.

Change-Id: I739b10df2780bec537827a13679fd2bcc2cc7188
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
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
d4beb6bc2b42b176c6d04fdd91d6c758e542c7c2 02-Oct-2013 Sebastien Hertz <shertz@google.com> Inline field and method resolution.

According to profiling results, field and method resolutions are hot points
during interpreter execution. This CL attempts to speed up these resolutions.

Forces aggressive inlining of FindFieldFromCode and FindMethodFromCode. This
allows to reduce the overhead of access check code when the interpreter runs
without these checks. Templatize these functions to optimize inlining and their
callers.

Also spread the use of C++11 "nullptr" in place of "NULL" in field access and
invoke helpers.

Change-Id: Ic1a69834d8975b2cddcddaae32f08a7de146a951
e861ebd5d9490cc86200f3859f3d36fadad4588c 10-Oct-2013 Mathieu Chartier <mathieuc@google.com> Fix interpreter bugs.

These showed up in compaction work.

Change-Id: Iac8eb0a1395c25aabba9f2e0ff6b01fc6180bdca
c67148594b1580c278ae71e3ce5c6fd59bfa6bd3 30-Sep-2013 Sebastien Hertz <shertz@google.com> Enable thread analysis on template functions.

All template functions using thread analysis must be explicitly instantiated
with the thread analysis attributes to enable thread analysis. We use macros
to do this since there are many variants of a same function depending the
number of template arguments.

Also add documentation of these functions.

Change-Id: I3c79acc2f0a6a8dfb5c42924439145292dd68812
c61124bdeaae94f977ffc36ac69535e792c226f2 10-Sep-2013 Sebastien Hertz <shertz@google.com> Cleanup invoke in interpreter.

Some cleanup in invocation stuff:
- Get the number of invoke arguments from instruction (vA) rather than get it
from its code item. This benefits to native invoke since we no longer need to
parse the method's shorty. Also pass the low 16 bits of instructions to avoid
fetching it twice when reading vA.
- Remove "is_static" tests by taking advantage of invoke type template argument
rather than testing method's access flags.
- Ensure Instruction::GetArgs is inlined.
- Check exception when initializing method's class when transitioning from
interpreter to compiled code (artInterpreterToCompiledCodeBridge).
- Move UnstartedRuntimeInvoke function to interpreter_common.cc and make it
static as it's only used by DoInvoke and DoInvokeVirtualQuick functions.
- Avoid duplicating code in ShadowFrame::Create.

Performance remains the same according to benchmarks. Hopefully, this should be
addressed in next CLs, especially by improving new shadow frame initialization.

Bug: 10668955
Change-Id: I514b8f098d0ef3e35921ceb770383aac1a9c7902
a3faaf4bece7f42529c013fe87bd41de59798656 04-Sep-2013 Jeff Hao <jeffhao@google.com> Fix handling of unresolved references in verifier.

The verifier should not treat use of unresolved references as a reason to reject
the entire class. Instead, the verifier treats the instruction as a throw. If
that class is run, the interpreter with extra checks will throw an exception.

Bug: 10457426

Change-Id: I3799da843a7ffb3519bbf6dc13a6276519d9cb95
2e2deeb6df3e5a952c194276146706e63ab644a1 23-Sep-2013 Ian Rogers <irogers@google.com> Fix compiler warning in interpreter.

Change-Id: I320a8dbbd27bf7d20cf8b60a3e5d0aaebcda861e
3b588e09eac6fb2aff64595e2232e479703850fc 11-Sep-2013 Sebastien Hertz <shertz@google.com> Optimize instruction data fetch in interpreter.

The computed goto implementation prevents the compiler from detecting we are
loading the first 16 bits of instruction twice: first one to get the opcode and
second one to fetch first instruction's operand(s) like vA and vB.

We now load the 16 bits into a local variable and decode opcode and operands
from this variable. And do the same in the switch-based implementation for
consistency.

The performance improvement is 5% in average on benchmark applications suite.

Also remove unused "Thread* self" parameter from DoIGetQuick and DoIPutQuick.

Bug: 10703860
Change-Id: I83026ed6e78f642ac3dcdc6edbb6056fe012005f
947ff080753c786a74f1cd7aeb09f717bb7074bd 17-Sep-2013 Sebastien Hertz <shertz@google.com> Load shadow frame's this object only upon instrumentation.

We used to load the shadow frame's this object when entering the interpreter
and push it into thread's SIRT to make it visible to garbage collector. But
it is only used by instrumentation listeners.

We now move this load at each place an instrumentation listener is called. This
avoids loading it when instrumentation is disabled. This also allows to remove
the SIRT reference and the push/pop management it implies when entering/exiting
the interpreter.

The performance improvement is 6% in average on our benchmarks suite.

This CL also makes method Instrumentation::ExceptionCaughtEvent const so we can
use a "const instrumentation::Instrumentation*" object in interpreter.

Change-Id: I2caccba9a906f244c8057b24031250f9824cc711
1eda2268e84d384256814cb6c2ba2440a848f9ed 09-Sep-2013 Sebastien Hertz <shertz@google.com> Move thread suspend check at safepoints.

Move CheckSuspend on backward branch, return and exception handling.

Bug: 10603072
Change-Id: Ic6c2c5066f133a345323d46edca7afde350849d8
8ece050d85fc244c72610244e440b0e00aa618fa 07-Aug-2013 Sebastien Hertz <shertz@google.com> Add an interpreter using computed goto table.

This CL adds a new implementation of the interpreter using computed goto table.
In order to keep the switch-based implementation, it reorders things as the
following:
- Keep interpreter entrypoints into interpreter.h/.cc files.
- Move common interpreter parts to interpreter_common.h/.cc files.
- Separate both implementations to their own modules.

The interpreter implementation can be selected by changing the value of the
kInterpreterImplKind global variable (see interpreter.cc file). The default one
remains the switch-based implementation.

Also updates the exception handling (FindNextInstructionFollowingException) and
SPARSE_SWITCH switch handling (DoSparseSwitch) routines to share code between both
implementations.

Finally, adds a PACKED_SWITCH handling routine (DoPackedSwitch) so we are
consistent with SPARSE_SWITCH handling.

The computed goto implementation use two handlers table: one for normal
instruction handling and one for instrumentation handling. The current handlers
table to be used is updated on backward branch depending on whether there is
listener to DEX pc change.

Bug: 10602809
Change-Id: Ibb53bcc68be75c473fe5440835e78fc9a74381b3