History log of /art/runtime/interpreter/interpreter.cc
Revision Date Author Comments
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
0b80b746f295469f143b3088741642114c6e2a7d 29-Apr-2016 Mingyao Yang <mingyao@google.com> Fix assert failure in interpreter after deoptimization.

There is code that does
new String(chararr, 0, chararr_count);
which under debuggable turns into a call into pNewEmptyString() plus a
call into pNewStringFromChars_CII().
Even though we currently don't patch return pc in a runtime method,
calling into pNewEmptyString() is special since it's hacked such
that it's acting as if the caller calls into the java method
StringFactory.newEmptyString() directly. So deoptimization can now
happen at the NewEmptyString site and the assert is triggered since
it's a new instance instead of an invoke instruction.

The fix relaxes the assert to allow the special case.

Bug: 28555675

(cherry picked from commit 504a69081f63818ca332ddaf54e8198448554538)

Change-Id: Idbb159b5aa450df2344cd93ae74fef5f55bdc534
b28abe4a648d85863655a8af3ab9a4b633be3512 06-May-2016 Aart Bik <ajcbik@google.com> Break the debug cycle!

Rationale:
When entering the path that implements method invocation,
it is possible for the interpreter and JIT to cycle around
trying to interpret or compile a method, never making a
decision. This bug fix avoids such cycling with a minimum
of extra runtime overhead.

BUG=28537292

(cherry picked from commit 0122320f86ae004aa195d76814c52564d84ee632)

Change-Id: Ied47e0089a8c674a1504f1718f1a3a667863ada3
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
af3f5e0136277bd0c01e7e2b7c4797c63ecddca6 02-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Use the interpreter as a heartbeat for the JIT.""

Bug: 27398183
Bug: 23128949
Bug: 26846185

This reverts commit a96917a6983a5abbe973255a3846fda549fb1657.

(cherry picked from commit 35122443e5f8606cc5a660ac32745a06aefb341b)

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

Bug: 27398183
Bug: 23128949
Bug: 26846185

This reverts commit a96917a6983a5abbe973255a3846fda549fb1657.

Change-Id: I5c4f0d87d3293a6a7ab56a33396670704b66a347
00b53b7f3f9ce5996b767b52c28dd846f47a723c 03-Feb-2016 Alexey Frunze <Alexey.Frunze@imgtec.com> Fast ART MIPS64 interpreter

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

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


Bug: 27398183
Bug: 23128949
Bug: 26846185

This reverts commit 7273a5d045d3ceb3ff011ad65765356b69b155e8.

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

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

bug:27398183
bug:23128949
bug:26846185

Change-Id: I4423f5c4810dac183dc8973078bf218818745e80
6cbe0814952bd3bbb329c4ca4dc683ac87c2c2de 01-Mar-2016 Serguei Katkov <serguei.i.katkov@intel.com> Revert "Revert "Fast ART x86_64 interpretator""

CFI is updated. Now unwinder can fall through fast interpreter.

This reverts commit c4a575f58007036ff3408b15c2ec48108add20f3.

Change-Id: Ibb0a2ef41e4d02ab0b4ecc4f030ba0e72971aa9d
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
c4a575f58007036ff3408b15c2ec48108add20f3 26-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Fast ART x86_64 interpretator"

Fails gcstress configuration.

This reverts commit c669beb798e273dd3d44cfa6a7a95ff90eba7209.

Change-Id: Ifac92471f91a116fc271d0dde8356fbbb0a08048
200f040af3e4fe9e178cb63c90860d58d90ef665 26-Feb-2016 Douglas Leung <douglas.leung@imgtec.com> [MIPS] Add Fast Art interpreter for Mips32.

Change-Id: I6b9714dc8c01b8c9080bcba175faec1d2de08f8f
fd522f9039befff986701ff05054ffdd1be1dd33 11-Feb-2016 Bill Buzbee <buzbee@google.com> Revert "Revert "Revert "Revert "ART: Enable Jit Profiling in Mterp for arm/arm64""""

This reverts commit 5d03317a834efdf3b5240c401f1bc2ceac7a2f25.

We need to catch all possible cases in which new instrumentation appears
or the debugger is attached, and then switch to the reference interpreter
if necessary. We may, in a future CL, use the alt-mterp mechanism to accompish
this (as did Dalvik).

Only enables Arm64 for now. Once it survives extended testing, will enable
arm and update x86.

Updated OSR handling to match other interpreters.

Change-Id: I076f1d752d6f59899876bab26b18e2221cd92f69
c669beb798e273dd3d44cfa6a7a95ff90eba7209 14-Jan-2016 Serguei Katkov <serguei.i.katkov@intel.com> Fast ART x86_64 interpretator

Introduce the ART x86_64 fast interpreter.

Change-Id: I3649698eb251ac8acc98851969f9445f60d17b02
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
dd5e5e975e1965c3e4568143e8e1c7b65b319f58 12-Feb-2016 Tamas Berghammer <tberghammer@google.com> Revert "Revert "Make it possible to enable native debugging through debug flags""

This reverts commit 3a98aae1b9b20bc78dc5e05d2e60cb1d0072db02.

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

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

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

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

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

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

Change-Id: Ibf7294bfd14f8632a0fdeb27a5b90bfe5037d085
5d03317a834efdf3b5240c401f1bc2ceac7a2f25 11-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Revert "ART: Enable Jit Profiling in Mterp for arm/arm64"""

Unfortunately, run-test interpreter on arm32 are still timing out, and the following jdwp tests on armv8 are failing:

org.apache.harmony.jpda.tests.jdwp.Events.EventWithExceptionTest#testBreakpoint_BeforeException (no test history available)
org.apache.harmony.jpda.tests.jdwp.Events.EventWithExceptionTest#testFieldAccess (no test history available)
org.apache.harmony.jpda.tests.jdwp.Events.EventWithExceptionTest#testFieldModification (no test history available)
org.apache.harmony.jpda.tests.jdwp.Events.EventWithExceptionTest#testMethodExit (no test history available)
org.apache.harmony.jpda.tests.jdwp.Events.EventWithExceptionTest#testMethodExitWithReturnValue (no test history available)
org.apache.harmony.jpda.tests.jdwp.Events.FieldAccessTest#testFieldAccessEvent (no test history available)
org.apache.harmony.jpda.tests.jdwp.Events.FieldModification002Test#testFieldModifyEvent (no test history available)
org.apache.harmony.jpda.tests.jdwp.Events.FieldModificationTest#testFieldModifyEvent (no test history available)
org.apache.harmony.jpda.tests.jdwp.Events.MethodExitWithReturnValueTest#testMethodExitWithReturnValueException (no test history available)

This reverts commit 9687f244bdb5dd0b4d9dd804a7c8c7b4a911d364.

Change-Id: Iadac4902ab8d7eb574cc4abeba5f93388d59dcb4
9687f244bdb5dd0b4d9dd804a7c8c7b4a911d364 05-Feb-2016 Bill Buzbee <buzbee@google.com> Revert "Revert "ART: Enable Jit Profiling in Mterp for arm/arm64""

Fixes: missing sign extension in iget template
Call to wrong branch profiling helper in arm/goto_16 and arm/goto_32
Missing export PCs
Reworks: Branch handlers to reduce cost of branch profiling.

Re-enables Jit profiling for both Arm and Arm64.

Performance note:
Branch profiling is relatively expensive, though the real
cost will depend on branch frequency. Taking a very
branch intensive benchmark, CaffeineMark's logic test, we
see the following scores (higher is better):

Mterp (profiling off) 6187
Mterp (profiling on) 4305

Switch (profiling off) 3931
Switch (profiling on) 2032

This reverts commit 95717f0010e7a9445450f4d39babfaf3a83e29b5.

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

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

This reverts commit c94a61f06ffc13288c67891048128c987b29bf33.

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

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

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

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

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

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

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

Change-Id: Ia9022cbc1bbfcc072314b6c95f63a4bf8060c36c
95717f0010e7a9445450f4d39babfaf3a83e29b5 05-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "ART: Enable Jit Profiling in Mterp for arm/arm64"

Not super happy to revert this, but unfortunately, too many problems when testing:

arm: tests timeout when running run-tests with the interpreter.

arm64 failures:
test-art-target-run-test-ndebug-prebuild-jit-relocate-ntrace-cms-checkjni-image-npictest-ndebuggable-003-omnibus-opcodes64
test-art-target-run-test-ndebug-prebuild-jit-relocate-ntrace-cms-checkjni-image-npictest-ndebuggable-005-annotations64
test-art-target-run-test-ndebug-prebuild-jit-relocate-ntrace-cms-checkjni-image-npictest-ndebuggable-064-field-access64
test-art-target-run-test-ndebug-prebuild-jit-relocate-ntrace-cms-checkjni-image-npictest-ndebuggable-406-fields64

org.apache.harmony.jpda.tests.jdwp.Events.EventWithExceptionTest#testBreakpoint_BeforeException
org.apache.harmony.jpda.tests.jdwp.Events.EventWithExceptionTest#testFieldAccess
org.apache.harmony.jpda.tests.jdwp.Events.EventWithExceptionTest#testFieldModification
org.apache.harmony.jpda.tests.jdwp.Events.EventWithExceptionTest#testMethodExit
org.apache.harmony.jpda.tests.jdwp.Events.EventWithExceptionTest#testMethodExitWithReturnValue
org.apache.harmony.jpda.tests.jdwp.Events.FieldAccessTest#testFieldAccessEvent
org.apache.harmony.jpda.tests.jdwp.Events.FieldModification002Test#testFieldModifyEvent
org.apache.harmony.jpda.tests.jdwp.Events.FieldModificationTest#testFieldModifyEvent
org.apache.harmony.jpda.tests.jdwp.Events.MethodExitWithReturnValueTest#testMethodExitWithReturnValueException

This reverts commit a0a16105423459287497a98129dcba2828ccd7f0.

Change-Id: I8ff0512265ed0a422be67e7410998ad02639509c
a0a16105423459287497a98129dcba2828ccd7f0 04-Feb-2016 buzbee <buzbee@google.com> ART: Enable Jit Profiling in Mterp for arm/arm64

Adds the hooks for branch profiling to arm and arm64. The
other Jit profiling modes are handled in common code.

Stubbed out support for on-stack replacement.

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

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

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

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

Bug: 22414682
Change-Id: I5cb86a8bba71c7af9361a63c0802786c852b857b
3b0b4b9d09baae7234fc26b7970b3ec55560735e 02-Feb-2016 Bill Buzbee <buzbee@google.com> Revert "Revert "ART: Mterp for arm64""

Looks like some of our assemblers disagree on valid arm64 assembly syntax
Force use of clang for art runtime. In a subsequent CL, will use form
that both gcc and clang accept.

This reverts commit 43f3fb960bce978df699c8a68a972be2a0d0d221.

Change-Id: Ice83072171ab502c43d492e2238b446c4814ea67
43f3fb960bce978df699c8a68a972be2a0d0d221 02-Feb-2016 Sebastien Hertz <shertz@google.com> Revert "ART: Mterp for arm64"

This reverts commit e0c269e0a5f50b1a551ddba1205f6e5b4b5e6c98.

The CL is causing build breakages on arm64 targets.

Change-Id: I7402fe34869258ae870c57308b2062e50d801bdd
e0c269e0a5f50b1a551ddba1205f6e5b4b5e6c98 27-Jan-2016 buzbee <buzbee@google.com> ART: Mterp for arm64

Ready for review. All opcodes handled. All applicable run-tests pass.
Device boots to desktop in interpret-only mode.

Change-Id: I937d8bcf848a831e04d4b9de8d1914667a197d75
d6b48dbe715fbf1431394d2b6ef75cb19a4012dd 29-Jan-2016 buzbee <buzbee@google.com> ART: Fix single-step interpretation for mterp

For bring-up (and failover) purposes, mterp can bail out to the
switch interpreter to handle a single opcode. This CL fixes the
handoff of the result register (a bug that was masked by an earlier
revision which passed it around by reference, rather than by value.

Change-Id: Iba9e1576f52b3660348c89466438bdc0526227d0
734f3aa9f758236b6f1ace6347895af90b0d813d 28-Jan-2016 buzbee <buzbee@google.com> Fix "Never Interpret" option for all interpreters

CL 196596 added support for an option to bypass interpretation.
However, it only covers 2 our of 3 interpreters (missing mterp).
This change moves the control up a level to the common interpreter
entry where it will take effect before we select which interpreter
to use.

Also, it corrects a somewhat academic bug in that the existing
code that assumes that (dex_pc == 0) means that we just entered a
method. If a method's dex code internally branched to address 0,
we could issue bogus method entry events. By moving this test up
a level, we should avoid this situation. Note, though, that dx
would never generate this pattern, and it's hard to imagine even
hand-generated dex code that would trigger a deoptimization in this
situation.

Change-Id: I6684bbf63570e02f5b01ce423c656889a890de7d
7c58bd41046bb9f87642caa0c2b094dc98be29ca 20-Jan-2016 Bill Buzbee <buzbee@google.com> Revert "Revert "Fast ART x86 interpreter""

This reverts commit 2d093a1213cc2f85b5e5e02782332657c479eb94.

Disable x86 mterp compilation on Mac host builds (but keep enabled
for all target builds).

Change-Id: Ie355279f166d2964a786646ee53f065b7e0f5ede
2d093a1213cc2f85b5e5e02782332657c479eb94 20-Jan-2016 Bill Buzbee <buzbee@google.com> Revert "Fast ART x86 interpreter"

This reverts commit 99229c71efda9363faa571017c52a215c6e28f83.

Assembly syntax issue with the Mac build.

Change-Id: I271d18d31963fae46e4077ddd39313bec0b3a39e
99229c71efda9363faa571017c52a215c6e28f83 31-Dec-2015 Serguei Katkov <serguei.i.katkov@intel.com> Fast ART x86 interpreter

Port of ART Dalvik-style interpreter for x86.
See Bill's patch for details
https://android-review.googlesource.com/#/c/188977/

Included fixes
https://android-review.googlesource.com/#/c/196153/
ART: Mterp read barrier fix + minor cleanup

https://android-review.googlesource.com/#/c/196501/
ART: Mterp - remove redundant null check

Change-Id: If447e3a14088559e3aa0b82cb2c91721bea586ee
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
9612a70aa77b183a3cb2103d7eeb25cec580d0c8 14-Jan-2016 Hiroshi Yamauchi <yamauchi@google.com> Revert "Disable mterp for the read barrier config."

Now that cl 196153 is in.

This reverts commit 987e44e6b65677587f37c26e630ddc4d4c563382.

Bug: 26510411
Change-Id: I006d7532973a6e26adde99e04f8b3eab491b3901
64320f9e275b0790e7321e6772bf51eb23db9f52 12-Jan-2016 buzbee <buzbee@google.com> Disable mterp if unstarted runtime

Mterp uses entrypoints that assume the runtime is started. If it isn't,
revert to the fallback interpreter.

Bug: 26510411

Change-Id: I08278981ee1e7bc21163c6584426cc18a5e261fc
987e44e6b65677587f37c26e630ddc4d4c563382 12-Jan-2016 Hiroshi Yamauchi <yamauchi@google.com> Disable mterp for the read barrier config.

For now. Volantis boots with this.

Bug: 26510411
Bug: 12687968
Change-Id: Ifc9799404306c973ad1085c42c399d6eef05dcc6
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
103992b9171fac9eceb2fe4015ab04f544b9c559 05-Jan-2016 Andreas Gampe <agampe@google.com> ART: Move ThrowStackOverflowError to common_throws

This should really be in common_throws considering all the callers.

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

Change-Id: If38171c2dc7d4a4378df5d050afc4fff4499c98f
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
eb7c144a6aff7da673ba53d501c46f00311d4d7f 31-Aug-2015 Alex Light <allight@google.com> Add initial default method support to Art

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

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

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

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

This adds 5 new run-tests for this functionality.

Bug: 24618811

Change-Id: I35ca800d99d3329348b277789b70ceeeba6e7f03
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
3cfa4d05afa76e19ca99ec964b535a15c73683f0 07-Oct-2015 Andreas Gampe <agampe@google.com> ART: Remove interpreter entrypoints

These are no longer used as entrypoints. Make them proper runtime
functions local to the interpreter.

Bump oat version.

Change-Id: Icdd92e20eafc5668b68eeebf55cf624560f462b3
b30259251b22430fad12f1adeab671e4bf8f88f5 01-Sep-2015 Andreas Gampe <agampe@google.com> ART: Use unique_ptr for alloca-ed ShadowFrames

To enable automated calls of the destructor (for extensions of
ShadowFrame), return a unique_ptr with a custom deleter. Use a
macro so that the alloca happens in the caller.

Change-Id: Id28a6ea131f108e4a94ff1699fc22e7b44aec018
520633bebd2bf4d70884d30f179dbde9f275aac6 08-Sep-2015 Sebastien Hertz <shertz@google.com> Support deoptimization on exception

Allows to deoptimize when an exception is being thrown. We only
deoptimize if an executable frame (starting from the catch handler)
needs to be executed with the interpreter.

Before executing deoptimized frames, the exception is restored. The
interpreter starts by handling this exception at the point of the
throwing instruction.

Bug: 23714835
Change-Id: I0c5f7d4b257644acf12210aae8e5b6bb0f4af1f7
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
99ca40cf9d390479a7243b8b3321cad7d9faa2a4 16-May-2015 Andreas Gampe <agampe@google.com> ART: Refactor UnstartedRuntime for testing

Expose the UnstartedRuntime implementation functions as private static
methods of a class. Add a gtest that can invoke these functions. Add
sample tests for String and Memory.

Bug: 21173514

(cherry picked from commit 799681b176ad25437ce2849639f54f610dcbf684)

Change-Id: Ib5bde6347fafaf7607c642542ea7d5938ff4b1df
799681b176ad25437ce2849639f54f610dcbf684 16-May-2015 Andreas Gampe <agampe@google.com> ART: Refactor UnstartedRuntime for testing

Expose the UnstartedRuntime implementation functions as private static
methods of a class. Add a gtest that can invoke these functions. Add
sample tests for String and Memory.

Bug: 21173514
Change-Id: Ib5bde6347fafaf7607c642542ea7d5938ff4b1df
241a9588c6d7d0fcb4c92da40c7141863930083a 28-Apr-2015 Christopher Ferris <cferris@google.com> Fix mismatched new[]/delete.

Another two cases where a new[] is used but only a delete occurs.

Bug: 18202869
Change-Id: If68264807150f3a9783e44ef8823cc366bff8df2
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
d43b3ac88cd46b8815890188c9c2b9a3f1564648 01-Apr-2015 Mingyao Yang <mingyao@google.com> Revert "Revert "Deoptimization-based bce.""

This reverts commit 0ba627337274ccfb8c9cb9bf23fffb1e1b9d1430.

Change-Id: I1ca10d15bbb49897a0cf541ab160431ec180a006
0ba627337274ccfb8c9cb9bf23fffb1e1b9d1430 24-Mar-2015 Andreas Gampe <agampe@google.com> Revert "Deoptimization-based bce."

This breaks compiling the core image:

Error after BCE: art::SSAChecker: Instruction 219 in block 1 does not dominate use 221 in block 1.

This reverts commit e295e6ec5beaea31be5d7d3c996cd8cfa2053129.

Change-Id: Ieeb48797d451836ed506ccb940872f1443942e4e
e295e6ec5beaea31be5d7d3c996cd8cfa2053129 07-Mar-2015 Mingyao Yang <mingyao@google.com> Deoptimization-based bce.

A mechanism is introduced that a runtime method can be called
from code compiled with optimizing compiler to deoptimize into
interpreter. This can be used to establish invariants in the managed code
If the invariant does not hold at runtime, we will deoptimize and continue
execution in the interpreter. This allows to optimize the managed code as
if the invariant was proven during compile time. However, the exception
will be thrown according to the semantics demanded by the spec.

The invariant and optimization included in this patch are based on the
length of an array. Given a set of array accesses with constant indices
{c1, ..., cn}, we can optimize away all bounds checks iff all 0 <= min(ci) and
max(ci) < array-length. The first can be proven statically. The second can be
established with a deoptimization-based invariant. This replaces n bounds
checks with one invariant check (plus slow-path code).

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

Refactor and clean up unstarted runtime.

Bug: 19542228
Change-Id: Ib3e4b3517e06e8242d4fed32ca59419fef553a47
90a33595bc637f5768a7726a186bdfe25efcd0d6 16-Jan-2015 Sebastien Hertz <shertz@google.com> Fix exception handling during deoptimization

When interpreting a deoptimized shadow frame, we may start with a
pending exception thrown by a previous deoptimized shadow frame (from
a previous invoke). Therefore, we need to handle it before executing
any instruction, otherwise we execute incorrect code.

Because we need the DEX pc of the throwing instruction to find a
matching catch handler, we initialize deoptimized shadow frames with
the current DEX pc at the time the stack is deoptimized.
When we are about to interpret a deoptimized shadow frame, we need to
update the shadow frame with the DEX pc of the next instruction to
interpret. There are three cases:
- if there is no pending exception, this is the instruction following
the current one.
- if there is a pending exception and we found a matching catch
handler, this is the first instruction of this handler.
- if there is a pending exception but there is no matching catch
handler, we do not execute the deoptimized shadow frame and continue
to its caller.

The verifier now fails when a method starts with a move-exception
instruction. Indeed we cannot start executing a method with a pending
exception.

Bug: 19057915
Bug: 19041195
Bug: 18607595

(cherry picked from commit 270a0e16c3b8e5b95cbfdbd8996ac137c7c6322b)

Change-Id: Ib4fdd0ad704b4f2369d229737c9cc77f559cea55
270a0e16c3b8e5b95cbfdbd8996ac137c7c6322b 16-Jan-2015 Sebastien Hertz <shertz@google.com> Fix exception handling during deoptimization

When interpreting a deoptimized shadow frame, we may start with a
pending exception thrown by a previous deoptimized shadow frame (from
a previous invoke). Therefore, we need to handle it before executing
any instruction, otherwise we execute incorrect code.

Because we need the DEX pc of the throwing instruction to find a
matching catch handler, we initialize deoptimized shadow frames with
the current DEX pc at the time the stack is deoptimized.
When we are about to interpret a deoptimized shadow frame, we need to
update the shadow frame with the DEX pc of the next instruction to
interpret. There are three cases:
- if there is no pending exception, this is the instruction following
the current one.
- if there is a pending exception and we found a matching catch
handler, this is the first instruction of this handler.
- if there is a pending exception but there is no matching catch
handler, we do not execute the deoptimized shadow frame and continue
to its caller.

The verifier now fails when a method starts with a move-exception
instruction. Indeed we cannot start executing a method with a pending
exception.

Bug: 19057915
Bug: 19041195
Bug: 18607595
Change-Id: I355ac81e6ac098edc7e3cc8c13dbfa24a2969ab2
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
2d7210188805292e463be4bcf7a133b654d7e0ea 10-Nov-2014 Mathieu Chartier <mathieuc@google.com> Change 64 bit ArtMethod fields to be pointer sized

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

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

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

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

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

Bug: 17643507

Change-Id: Ie9508f05907a9f693882d4d32a564460bf273ee8

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

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

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

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

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

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

Bug: 17643507

Change-Id: Ie9508f05907a9f693882d4d32a564460bf273ee8
277ccbd200ea43590dfc06a93ae184a765327ad0 04-Nov-2014 Andreas Gampe <agampe@google.com> ART: More warnings

Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general,
and -Wunused-but-set-parameter for GCC builds.

Change-Id: I81bbdd762213444673c65d85edae594a523836e5
6a3c1fcb4ba42ad4d5d142c17a3712a6ddd3866f 31-Oct-2014 Ian Rogers <irogers@google.com> Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.

Fix associated errors about unused paramenters and implict sign conversions.
For sign conversion this was largely in the area of enums, so add ostream
operators for the effected enums and fix tools/generate-operator-out.py.
Tidy arena allocation code and arena allocated data types, rather than fixing
new and delete operators.
Remove dead code.

Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
2c4257be8191c5eefde744e8965fcefc80a0a97d 24-Oct-2014 Ian Rogers <irogers@google.com> Tidy logging code not using UNIMPLEMENTED.

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

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

(cherry picked from commit 6f3dbbadf4ce66982eb3d400e0a74cb73eb034f3)

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

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

Change-Id: I5f4b49e88c3b02a79f9bee04f83395146ed7be23
5ad97daa3112ca626e3fbf2bf08971977344c3c3 06-Oct-2014 Hiroshi Yamauchi <yamauchi@google.com> Handlerize methods across some GC points.

Bug: 12687968
Change-Id: I0d5b0a78488ba76db4d25991d8db95b24bb624e9
fa888d06fd9ae90565254456e9b2e0cd62fbc91f 30-Sep-2014 Sebastien Hertz <shertz@google.com> Revert "Enable computed goto interpreter on the host"

This reverts commit 66d9bdb94f21106aaaa31a8fd686098672075e04.

Bug: 17716550
Change-Id: Ib404242c86e96e8edf019a2dcc14f0f8294b79e8
f0edfc355893d53d1104b05501c99ad5ccf305c4 25-Sep-2014 Hiroshi Yamauchi <yamauchi@google.com> Some optimizations for the array alloc path.

- Force Array::Alloc() to be inlined.
- Simplify the array size overflow check.
- Turn fill_usable into a template parameter.
- Remove a branch in Array::DataOffset() and avoid
Primitive::ComponentSize(), which has a switch, in the array alloc
path.
- Strength reductions in the array size computation by using component
size shifts instead of component sizes. Store component size shift
in the upper 16 bits of primitive_type field.
- Speedup: ~4% (3435->3284) in MemAllocTest on N4.

Bug: 9986565

Change-Id: I4b142ffac4ab8b5b915836f1660a949d6442344c
66d9bdb94f21106aaaa31a8fd686098672075e04 28-Aug-2014 Sebastien Hertz <shertz@google.com> Enable computed goto interpreter on the host

We disabled the computed goto interpreter when compiling with clang because of
compilation issues. Since we compile with clang on the host, we used the
switch-based interpreter.

Now clang is able to compile the computed goto interpreter, we can use it by
default on the host.

Change-Id: Ifa2a2d3c171b1116ecd3b3f213382c3c85e93f66
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
535a3fbc08e1577f43aec7402cab80c14ca64c41 22-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Interpreter can kick in even when implicit checks are enabled.

Add a GetStackEndForInterpreter for its stack overfow check.

Change-Id: I2d4fc229a8eb727fda509ff778e16d60d96ecc28
d8434439dc64add41cdfa69ddf96b960af9050de 11-Jul-2014 Hans Boehm <hboehm@google.com> Call strong CAS from unsafe. Add more CAS versions.

Adds a number of additional CAS versions. Calls the correct
one from sun.misc.unsafe, fixing a recently introduced bug.
Avoid unnecessary ordering constraint when installing hash code.

Change-Id: I7c09d0c95ceb2a549ec28ee34084198ab3107946
4e99b3d8955131f3fc71aa113f0fa71f0092cb6f 24-Jun-2014 Sebastien Hertz <shertz@google.com> Add missing class initialization during compilation and tests

Adds missing class initialization during compilation and tests, especially
java.lang.Class. Otherwise, we'd be able to execute code while the referring
class is not initialized or initializing.

Also adds mirror::Class::AssertInitializedOrInitializingInThread method to
check class initialization when entering the interpreter: the called method's
declaring class must either be initialized or be initializing by the current
thread (other threads must be waiting for the class initialization to complete
holding its lock). Note we only do this check in debug build.

Bump oat version to force compilation.

Bug: 15899971
Change-Id: I9a4edd3739a3ca4cf1c4929dcbb44cdf7a1ca1fe
228602f562f1d130d06e60a98752d99c2d467d6a 10-Jul-2014 Ian Rogers <irogers@google.com> Make CAS operations in Object use art::Atomic.

Make naming consistent with art::Atomic.

Change-Id: If3abdb019ef8b53bd809e3fef3fd5248aeb27e9a
6c5cb212fa7010ae7caf9dc765533aa967c95342 19-Jun-2014 Ian Rogers <irogers@google.com> Ensure classes are initialized rather than initializing.

A class can be being initialized on a different thread, in that case other
threads should block trying to access the class. The initializing state shows
the class is being initialized but not that its safe for other threads to
access. Change occurances of IsInitializing to IsInitialized primarily in
slow-path code.
Bug: 15347354

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

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

Bug: 13077697

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

Merge ART from AOSP to lmp-preview-dev.

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

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

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

Fixed the generic trampoline to not use ToJObject when unnecessary.

Bug: 15167269

This reverts commit 3bdb873122964da7937eb070cbcf2ef638a8e459.

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

This reverts commit e09ae0920be57760fb390b6944bce420fa0b5582.

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

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

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

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

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

Change-Id: I1b51723920a2e4f4f8b2907066f578a3e879fd5b
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
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
a4e7413aa3420d54e41f37f286866a8025caa373 06-May-2014 Ian Rogers <irogers@google.com> Allow VMRuntime.newUnpaddedArray allocations in unstarted runtime.

Change-Id: I15e9110718a553d7ca98b64e6e545055036ea20c
5d27fafdf03f259e92eaee9f6319b9349cc8d62e 03-May-2014 Ian Rogers <irogers@google.com> Allow ArtMethod::Invoke in unstarted runtimes.

Change-Id: I0141f4daef4751589d03d27484eb65c811b14f27
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
861ea56e20d60f28e21d47f331c29b2e303e2dbe 24-Apr-2014 Stephen Hines <srhines@google.com> Fix ART compilation for Clang 3.5.

This change adds required <> to some template instantiations, which
Clang was complaining about (and ignoring otherwise). It also updates
the integrated assembler defines, since Clang 3.5 now supports named
arguments.

Change-Id: I878b8c96bcbc29415582c18a2df678b7f9a9d4ad
ee1d79a603c77c0667b27c075a983579d5c51f7e 21-Feb-2014 Sebastien Hertz <shertz@google.com> Cleanup transaction support

Updates Thread::CreateInternalStackTrace to support both transactional and
non-transactional modes using template.

Generalizes non-transactional mode for invariant fields (which are set only
once).

Removes ArrayLog::VisitRoots as we never create Array logs of ObjectArray. As
ObjectArray elements are set using Object::SetFieldObject, they are already
recorded in the object logs: the object is the array itself and the offset
corresponds to the element index in this array. And also checks we never log
ObjectArray in array logs.

Fixes location of thrown exception when calling native method during class
initialization.

Change-Id: Idbc368d3b8292b85ff40bc8a7c559e085477bf89
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
92246bb5d6caae4fdb09cd3c8c10d78e41932d45 26-Feb-2014 Mathieu Chartier <mathieuc@google.com> Fix moving GC bugs in EnterInterpreterFromInvoke.

Calling EnterInterpreterFromInvoke on a static method could cause
class initialization and trash the args before calling the method.

Change-Id: If053d46dd6db403c8ebd1a816c20635194dd0e99
f48644b6cfd35fd029fc85dc7c837ad19b4a5ba3 17-Feb-2014 Sebastien Hertz <shertz@google.com> Update native methods whitelist.

Adds System.identityHashCode to native methods whitelist and updates
Unsafe.compareAndSwapInt to use mirror::Object::CasField32.

Bug: 12999675
Change-Id: I177015777927b2d2180cbfd0f3a646948e7557b3
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
4d2efce8bf1947880b90efc44448b4940c8016fb 11-Feb-2014 Hiroshi Yamauchi <yamauchi@google.com> Don't hardcode object layout in Unsafe and space_test.

Add a test for Unsafe.arrayBaseOffset() and Unsafe.arrayIndexScale().

Change-Id: I9cbdb79a4a7ee055129f41811a117910c8b2febd
5bb99037bef70784ae4630c2e4b81688d2a18621 09-Feb-2014 Mathieu Chartier <mathieuc@google.com> Fix CreateMultiArray to be compaction safe.

It used to be compaction safe before moving classes was enabled.
Added missing SIRTs.

Change-Id: I92963ed71fa6d2a20d16ec0e400b8fa0e41ac196
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
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
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
2c88b38ec22278c325c2917fdc60f0674e8b7976 18-Oct-2013 Sebastien Hertz <shertz@google.com> Make goto-based interpreter the default interpreter.

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

These showed up in compaction work.

Change-Id: Iac8eb0a1395c25aabba9f2e0ff6b01fc6180bdca
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
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
deb43702e611d6c75b459ea352a00f5d98fc0aa9 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

(cherry picked from commit a3faaf4bece7f42529c013fe87bd41de59798656)

Change-Id: I161bfdbfa116890ffa9e7a593c756229bd939eb4
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
89502fc63d5d2ef3586e49b1ec38e1777ce7accf 21-Aug-2013 Hiroshi Yamauchi <yamauchi@google.com> A char array copy optimization.

- Based on measurements, copy char by char for arrays of length <= 64.
- With this change, the Ritz MemAllocBench got ~25% faster on Nexus 4
and ~20% faster on host.
- This change only handles arraycopy calls in the core libraries and
char arrays with the rest future work.

Bug: 7103825
Change-Id: Ie88890eb65f011ca052b1f253f1b0e078ec24b6b
ea46f950e7a51585db293cd7f047de190a482414 30-Jul-2013 Brian Carlstrom <bdc@google.com> Refactor java.lang.reflect implementation

Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1.

Move to ArtMethod/Field instead of AbstractMethod/Field and have
java.lang.reflect APIs delegate to ArtMethod/ArtField.

Bug: 10014286.

Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
468532ea115657709bc32ee498e701a4c71762d4 05-Aug-2013 Ian Rogers <irogers@google.com> Entry point clean up.

Create set of entry points needed for image methods to avoid fix-up at load time:
- interpreter - bridge to interpreter, bridge to compiled code
- jni - dlsym lookup
- quick - resolution and bridge to interpreter
- portable - resolution and bridge to interpreter

Fix JNI work around to use JNI work around argument rewriting code that'd been
accidentally disabled.
Remove abstact method error stub, use interpreter bridge instead.
Consolidate trampoline (previously stub) generation in generic helper.
Simplify trampolines to jump directly into assembly code, keeps stack crawlable.
Dex: replace use of int with ThreadOffset for values that are thread offsets.
Tidy entry point routines between interpreter, jni, quick and portable.

Change-Id: I52a7c2bbb1b7e0ff8a3c3100b774212309d0828e
(cherry picked from commit 848871b4d8481229c32e0d048a9856e5a9a17ef9)
848871b4d8481229c32e0d048a9856e5a9a17ef9 05-Aug-2013 Ian Rogers <irogers@google.com> Entry point clean up.

Create set of entry points needed for image methods to avoid fix-up at load time:
- interpreter - bridge to interpreter, bridge to compiled code
- jni - dlsym lookup
- quick - resolution and bridge to interpreter
- portable - resolution and bridge to interpreter

Fix JNI work around to use JNI work around argument rewriting code that'd been
accidentally disabled.
Remove abstact method error stub, use interpreter bridge instead.
Consolidate trampoline (previously stub) generation in generic helper.
Simplify trampolines to jump directly into assembly code, keeps stack crawlable.
Dex: replace use of int with ThreadOffset for values that are thread offsets.
Tidy entry point routines between interpreter, jni, quick and portable.

Change-Id: I52a7c2bbb1b7e0ff8a3c3100b774212309d0828e
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
7655f29fabc0a12765de828914a18314382e5a35 29-Jul-2013 Ian Rogers <irogers@google.com> Portable refactorings.

Separate quick from portable entrypoints.
Move architectural dependencies into arch.

Change-Id: I9adbc0a9782e2959fdc3308215f01e3107632b7c
c449aa8151bf81d93d22ff24677ccf09a6da218e 29-Jul-2013 Ian Rogers <irogers@google.com> Clear exception if catch block doesn't have move-exception.

Bug: 10040419

Change-Id: Icc7a55cb3cdfbc3efd2b161bbe22b3e5007de35f
1521e95729c202f6b4a65656f62dfc8ba4dc818d 23-Jul-2013 Sebastien Hertz <shertz@google.com> Avoid unnecessary exception checks.

While we have inlined some handling functions in interpreter, we still have
conditional exception check in them. For instance, field access doesn't need to
check for a pending exception.
To help the compiler, these handling functions now return a boolean indicating
if an exception is pending.
Also updates macro POSSIBLY_HANDLE_PENDING_EXCEPTION to check against this
boolean.

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

Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
5fde12abafdcd3523ffd7d71f86e3b9e28f78065 24-Jul-2013 Sebastien Hertz <shertz@google.com> Update DEX pc before thread suspension.

This CL moves the DEX pc update before thread suspension for correctness.
It also update local variable declarations to use appropriate types.

Change-Id: Ia2a54b17d3dae1370bb84f0b24109f109473bea2
1895ea386ca78573302483f589ebabd8ce1480e7 18-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint readability/fn_size issues

Change-Id: I1efdb07a948a2af49db1a9d21ccab16dacc03a54
3e3d591f781b771de89f3b989830da2b6ac6fac8 18-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint build/namespaces issues

Change-Id: I19c68703270c1482d6c6aad8cdf97d3d2924360a
df62950e7a32031b82360c407d46a37b94188fbb 18-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint whitespace/parens issues

Change-Id: Ifc678d59a8bed24ffddde5a0e543620b17b0aba9
0cd7ec2dcd8d7ba30bf3ca420b40dac52849876c 18-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint whitespace/blank_line issues

Change-Id: Ice937e95e23dd622c17054551d4ae4cebd0ef8a2
2ce745c06271d5223d57dbf08117b20d5b60694a 18-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint whitespace/braces issues

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