History log of /art/runtime/stack.h
Revision Date Author Comments
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
1d011d9306fd4ff57d72411775d415a86f5ed398 04-Apr-2016 Bill Buzbee <buzbee@google.com> Revert "Revert "Revert "Revert "ART: Improve JitProfile perf in arm/arm64 mterp""""

Bug: 28081559

This reverts commit 961ea9fe42edcc2c57469bf451d1ca421da5cd59.

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

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

Disable the broken StubTest.IMT, b/27991555 .

Change-Id: I05fe45c28c8ffb7a0fa8b1117b969786748b1039
961ea9fe42edcc2c57469bf451d1ca421da5cd59 01-Apr-2016 Hiroshi Yamauchi <yamauchi@google.com> Revert "Revert "Revert "ART: Improve JitProfile perf in arm/arm64 mterp"""

This reverts commit 4a8ac9cee4312ac910fabf31c64d28d4c8362836.

570-checker-osr intermittently failing.

Bug: 27939339
45bf250d61de433c18ded824348e87bd4ffd7678 31-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add way to disable resolving for stack walk

Only occurs for walking the inlined frames case.

Bug: 27857910

(cherry picked from commit be2892bf771435eb451c74297b553f7dc9fea4ca)

Change-Id: Ied92be96f2f74ba02c02168f704443b95e7a4b04
be2892bf771435eb451c74297b553f7dc9fea4ca 31-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add way to disable resolving for stack walk

Only occurs for walking the inlined frames case.

Bug: 27857910

Change-Id: Idb90254879ebae4c756ee1a3d235999ae589a2a8
d6190dcdfb1f247ff0bf8268dacf413c93b58cf5 31-Mar-2016 Calin Juravle <calin@google.com> Revert "Revert "Revert "ART: Improve JitProfile perf in arm/arm64 mterp"""

This reverts commit 4a8ac9cee4312ac910fabf31c64d28d4c8362836.

Bug: 27939339
4a8ac9cee4312ac910fabf31c64d28d4c8362836 25-Mar-2016 Bill Buzbee <buzbee@google.com> Revert "Revert "ART: Improve JitProfile perf in arm/arm64 mterp""

Ready for review.

This reverts commit 6aef867f4d1a98a12bcdd65e9bf2ff894f0f2d7e.

Change-Id: I5d53ed2bedc7e429ce7d3cdf80b6696a9628740e
6aef867f4d1a98a12bcdd65e9bf2ff894f0f2d7e 25-Mar-2016 Calin Juravle <calin@google.com> Revert "ART: Improve JitProfile perf in arm/arm64 mterp"

This reverts commit c1d6b341eed646e5adafc6c4fd4e3748f0292368.
c1d6b341eed646e5adafc6c4fd4e3748f0292368 02-Mar-2016 buzbee <buzbee@google.com> ART: Improve JitProfile perf in arm/arm64 mterp

ART currently requires two profiling-related things from the
interpreters: hotness updates and OSR switch checks. The hotness
updates previously used the existing instrumentation framework - which
is flexible, but quite heavyweight. For most things, the
instrumentation framework overhead is acceptable, but because we do a
hotness update on every backwards branch the overhead is unacceptable.
Prior to this CL, branch profiling dominates interpreter cost.

Here, we bypass the instrumentation framework for hotness updates
and deliver a significant performance improvement. Running
interpreter-only (dalvikvm -Xint) on a Nexus 6, we see the logic
subtest of Caffeinemark improving from 2600 to 9200, and the
overall score going from 1979 to over 3000. Compared to the
C++ switch interpreter, we see a 6x improvement on the branchy logic
subtest and a 2.6x improvement overall.

Compared with the previous mterp which did not have support for
jit profiling, we see a few (1% to 5%) performance loss on the
standard command-line benchmarks. I consider this acceptable
(we could create an alternate non-profiling mterp which would
have no penalty, but I don't consider this overhead big enough to
justify that).

Change-Id: I50b5b8c5ed8ebda3c8b4e65d27ba7393c3feae04
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
636b9252af8d8848dbf8f30b7e9638867b62c791 01-Aug-2015 Mingyao Yang <mingyao@google.com> Support deoptimization only to set vreg

This CL removes the old API that was used to update vreg. We now rely
exclusively on deoptimization to change the value of a vreg (mainly
from the debugger). This allows to have only one mechanism working
with both Quick and Optimizing compilers. It also remove run-test
455-set-vreg which was the only user of the old API.

This CL also renames StackVisitor::SetVReg[Pair]FromDebugger to
StackVisitor::SetVReg[Pair] to reflect that change.

Bug: 25428216
Change-Id: Ib09510185280dbd0f6d02c52549ae9671c187e32
efc3f02504e8e3768cc18ab5347c5a6d19d6a935 28-Oct-2015 David Brazdil <dbrazdil@google.com> ART: Fix deopt from optimized code under inlining

Deoptimization of inlined frames would use the outer method's
vreg map, thus starting interpreter in bogus state.

Bug: 25331616
Change-Id: I1d4aefc731bb1386f3e6186a89b59981836480b3
338565069cc221cb73ba55dc586c8ab8dc0d592c 20-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Do not run the verifier when deopting optimized frames.

The stack maps contain all the required information.

Change-Id: I709e72b3de0d76a4203a3a004f093071e7865642
524e7ea8cd17bad17bd9f3e0ccbb19ad0d4d9c02 16-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Remove ArtCode.

- Instead use OatQuickMethodHeader.
- Various cleanups now that we don't have all those
ArtMethod -> ArtCode -> OatQuickMethodHeader indirections.

As a consequence of this cleanup, exception handling got a bit
faster.

ParserCombinators benchmark (exception intensive) on x64: (lower is better)
Before:
ParserCombinators(RunTime): 1062500.0 us.
After:
ParserCombinators(RunTime): 833000.0 us.

Change-Id: Idac917b6f1b0dc254ad68fb3781cd61bccadb0f3
6bc4374e3fa00e3ee5e832e1761c43e0b8a71558 12-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Add an abstraction over a compiled code.

That's just step 1, moving code-related functions of ArtMethod to
another class. That class is only a wrapper on an ArtMethod, but will
be changed to be a wrapper around compiled code.

Change-Id: I6f35fc06d37220558dff61691e51ae20066b0dd6
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
ccc61972ca31bbb3bf82cdc30656c13bebfbe6a9 01-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Do more inlining when JITting.

We now check the verification status of the class.

This triggered a bug when an inlined method was not compiled
(typically in a JIT configuration), and the path for deopting in
StackVisitor was using the wrong ArtMethod in order to know the
compiler that compiled the current frame.

Change-Id: I81d3ca0cf5cd3864b83b63dd954c58e1f2adaad4
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
99170c636dfae4908b102347cfe9f92bad1881cc 06-Jul-2015 Mingyao Yang <mingyao@google.com> Deoptimization support in optimizing compiler for setting local values

Due to compiler optimizations, we may not always be able to update
the value of a local variable in a compiled frame (like a variable
seen as constant by the compiler). To avoid that situation, we simply
deoptimize compiled frames updated by the debugger so they are
executed by the interpreter with the updated value.

When the debugger attempts to set a local variable (actually a DEX
register or a pair of registers) in a compiled frame, we allocate a
ShadowFrame associated to that frame (using its frame id) and set the
new value in that ShadowFrame. When we know we are about to continue
the execution of the compiled frame, we deoptimize the stack using
the preallocated ShadowFrame (instead of creating a new one). We
initialize it with the current value of all DEX registers except
the ones that have been set by the debugger. Therefore, the
ShadowFrame represent the runtime context modified by the debugger.

Bumps oat version to force recompilation.

Bug: 19944235
Change-Id: I0ebe6241264f7a3be0f14ee4516c1f7436e04da6
26f728661a08062a373a3203b72dc2555c2aed2d 15-Sep-2015 Sebastien Hertz <shertz@google.com> Cleanup thread access in StackVisitor

Adds method StackVisitor::GetThread to give access to the visited
Thread* so we no longer need to copy that pointer in subclasses.

Also adds a few missing const and DISALLOW_COPY_AND_ASSIGN.

Change-Id: I57649ee7742ef4ef1e01447ac2fbb66f977b22eb
2a5c4681ba19411c1cb22e9a7ab446dab910af1c 14-Aug-2015 Andreas Gampe <agampe@google.com> ART: Some header cleaning around bit-utils

Try to remove dependencies where they are not necessary.

Change-Id: I5ff35cb17aea369bed3725b1610b50d7eb05b81e
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
c449e8b79aaaf156ce055524c41474cc1200ed5a 11-Jun-2015 Igor Murashkin <iam@google.com> runtime: Minor cleanup and extra comments around interpreter

Change-Id: I24c0b261de8cf737babd9d01bf679482d48c8bc9
3d21bdf8894e780d349c481e5c9e29fe1556051c 22-Apr-2015 Mathieu Chartier <mathieuc@google.com> Move mirror::ArtMethod to native

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS.
Some of the savings are from removal of virtual methods and direct
methods object arrays.

Bug: 19264997

(cherry picked from commit e401d146407d61eeb99f8d6176b2ac13c4df1e33)

Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d

Fix some ArtMethod related bugs

Added root visiting for runtime methods, not currently required
since the GcRoots in these methods are null.

Added missing GetInterfaceMethodIfProxy in GetMethodLine, fixes
--trace run-tests 005, 044.

Fixed optimizing compiler bug where we used a normal stack location
instead of double on ARM64, this fixes the debuggable tests.

TODO: Fix JDWP tests.

Bug: 19264997

Change-Id: I7c55f69c61d1b45351fd0dc7185ffe5efad82bd3

ART: Fix casts for 64-bit pointers on 32-bit compiler.

Bug: 19264997
Change-Id: Ief45cdd4bae5a43fc8bfdfa7cf744e2c57529457

Fix JDWP tests after ArtMethod change

Fixes Throwable::GetStackDepth for exception event detection after
internal stack trace representation change.

Adds missing ArtMethod::GetInterfaceMethodIfProxy call in case of
proxy method.

Bug: 19264997
Change-Id: I363e293796848c3ec491c963813f62d868da44d2

Fix accidental IMT and root marking regression

Was always using the conflict trampoline. Also included fix for
regression in GC time caused by extra roots. Most of the regression
was IMT.

Fixed bug in DumpGcPerformanceInfo where we would get SIGABRT due to
detached thread.

EvaluateAndApplyChanges:
From ~2500 -> ~1980
GC time: 8.2s -> 7.2s due to 1s less of MarkConcurrentRoots

Bug: 19264997
Change-Id: I4333e80a8268c2ed1284f87f25b9f113d4f2c7e0

Fix bogus image test assert

Previously we were comparing the size of the non moving space to
size of the image file.

Now we properly compare the size of the image space against the size
of the image file.

Bug: 19264997
Change-Id: I7359f1f73ae3df60c5147245935a24431c04808a

[MIPS64] Fix art_quick_invoke_stub argument offsets.

ArtMethod reference's size got bigger, so we need to move other args
and leave enough space for ArtMethod* and 'this' pointer.

This fixes mips64 boot.

Bug: 19264997
Change-Id: I47198d5f39a4caab30b3b77479d5eedaad5006ab
e401d146407d61eeb99f8d6176b2ac13c4df1e33 22-Apr-2015 Mathieu Chartier <mathieuc@google.com> Move mirror::ArtMethod to native

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS.
Some of the savings are from removal of virtual methods and direct
methods object arrays.

Bug: 19264997
Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
41b175aba41c9365a1c53b8a1afbd17129c87c14 19-May-2015 Vladimir Marko <vmarko@google.com> ART: Clean up arm64 kNumberOfXRegisters usage.

Avoid undefined behavior for arm64 stemming from 1u << 32 in
loops with upper bound kNumberOfXRegisters.

Create iterators for enumerating bits in an integer either
from high to low or from low to high and use them for
<arch>Context::FillCalleeSaves() on all architectures.

Refactor runtime/utils.{h,cc} by moving all bit-fiddling
functions to runtime/base/bit_utils.{h,cc} (together with
the new bit iterators) and all time-related functions to
runtime/base/time_utils.{h,cc}. Improve test coverage and
fix some corner cases for the bit-fiddling functions.

Bug: 13925192

(cherry picked from commit 80afd02024d20e60b197d3adfbb43cc303cf29e0)

Change-Id: I905257a21de90b5860ebe1e39563758f721eab82
80afd02024d20e60b197d3adfbb43cc303cf29e0 19-May-2015 Vladimir Marko <vmarko@google.com> ART: Clean up arm64 kNumberOfXRegisters usage.

Avoid undefined behavior for arm64 stemming from 1u << 32 in
loops with upper bound kNumberOfXRegisters.

Create iterators for enumerating bits in an integer either
from high to low or from low to high and use them for
<arch>Context::FillCalleeSaves() on all architectures.

Refactor runtime/utils.{h,cc} by moving all bit-fiddling
functions to runtime/base/bit_utils.{h,cc} (together with
the new bit iterators) and all time-related functions to
runtime/base/time_utils.{h,cc}. Improve test coverage and
fix some corner cases for the bit-fiddling functions.

Bug: 13925192
Change-Id: I704884dab15b41ecf7a1c47d397ab1c3fc7ee0f7
57f61612a6101a2d246727640676acf8d8a6b51c 15-May-2015 Nicolas Geoffray <ngeoffray@google.com> Stack walking of inlined frames.

Be "true" to the stack visitor design, which seems to be:
1) Carry minimal state, so this CL just adds an inlining depth to it.
2) Compute needed information for each method, which is what GetDexPc,
GetMethod, and GetVRegFromOptimized code do.

Change-Id: I3d14126766f12216a7b448ce856259f1e7f37395
8e5bd18fc665d7ec5461ea068e98740a65da754c 06-May-2015 Nicolas Geoffray <ngeoffray@google.com> Add a flag to StackVisitor for inlining.

The flag tells whether the stack walk needs to include inlined
Java frames.

This does not do anything just yet, as we're not inlining anyways.

Change-Id: I716e25094fe56fa335ca1f9a398c1bcdba478e73
50030ef998be09789da4a9a56738362852068f12 08-May-2015 Mathieu Chartier <mathieuc@google.com> Check IsReferenceVReg during deopt

Required since the quick GC maps may not agree with the verifier
ones. Without this check we may copy stale object references into
the shadow frame.

(cherry picked from commit f00baf56ef647684888a407dbb6adadd704a2039)

Bug: 20736048
Change-Id: I7783c8a8ee45cf601b08b4c38f1dec7f7d11380c
f00baf56ef647684888a407dbb6adadd704a2039 08-May-2015 Mathieu Chartier <mathieuc@google.com> Check IsReferenceVReg during deopt

Required since the quick GC maps may not agree with the verifier
ones. Without this check we may copy stale object references into
the shadow frame.

Bug: 20736048
Change-Id: I7783c8a8ee45cf601b08b4c38f1dec7f7d11380c
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
7cc56a1fe81475d5126785c45606dd491dec2d8c 24-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Debugger: Remove support for setting values in optimizing.

bug:19944235
Change-Id: I3bcd56c7844847a7f0367f8ce6a72bddcd09d441
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
bb87e0f1a52de656bc77cb01cb887e51a0e5198b 03-Apr-2015 Mathieu Chartier <mathieuc@google.com> Refactor and improve GC root handling

Changed GcRoot to use compressed references. Changed root visiting to
use virtual functions instead of function pointers. Changed root visting
interface to be an array of roots instead of a single root at a time.
Added buffered root marking helper to avoid dispatch overhead.

Root marking seems a bit faster on EvaluateAndApplyChanges due to batch
marking. Pause times unaffected.

Mips64 is untested but might work, maybe.

Before:
MarkConcurrentRoots: Sum: 67.678ms 99% C.I. 2us-664.999us Avg: 161.138us Max: 671us

After:
MarkConcurrentRoots: Sum: 54.806ms 99% C.I. 2us-499.986us Avg: 136.333us Max: 602us

Bug: 19264997

Change-Id: I0a71ebb5928f205b9b3f7945b25db6489d5657ca
15b9d5274399736ac09705f0507df24fac4f00c1 12-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> API change in StackVisitor::GetVReg*.

- Remove GetVReg() and SetVReg() that were expecting to always succeed.
- Change Quick-only methods to take a FromQuickCode suffix.
- Change deopt to use dead values when GetVReg does not succeed:
the optimizing compiler will not have a location for uninitialized
Dex registers and potentially dead registers.

Change-Id: Ida05773a97aff8aa69e0caf42ea961f80f854b77
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
7cde48c56df5b57aed524cce44c902bc720f2d6c 20-Jan-2015 Sebastien Hertz <shertz@google.com> Stack support for Optimizing compiler

Allows to read/write DEX registers from physical register or stack
location when the method is compiled with the Optimizing compiler.

Required fixing arm and arm64 JNI compiler by saving floating
point registers.

Bug: 18547544
Change-Id: I401579f251d1c0a130f6cf4a93a960cdcd7518f5
96ba8dc82e7bd859106af837623fe8b2e9e772c3 22-Jan-2015 Sebastien Hertz <shertz@google.com> Refactor register access from StackVisitor

Moves register access checking up to StackVisitor by adding methods
IsAccessibleGPR and IsAccessibleFPR in Context class. It allows to
simplify GetGPR/FPR and SetGPR/FPR methods in the Context class (and
its subclasses).

Also simplifies code in StackVisitor by adding IsAccessibleRegister,
GetRegister and SetRegister methods which then call either GPR or FPR
specific methods in Context depending on the nature of the accessed
register.

Bug: 18547544
Bug: 19106446
Change-Id: I6e707608d935a71571d0e975a6e766053de3763a
2cd334ae2d4287216523882f0d298cf3901b7ab1 09-Jan-2015 Hiroshi Yamauchi <yamauchi@google.com> More of the concurrent copying collector.

Bug: 12687968
Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
e34fa1df67fbe0173b4ea9abddcc3ae3d0537037 14-Jan-2015 Mathieu Chartier <mathieuc@google.com> Print more info in MarkSweep::VerifyRoot

Refactored old root callback to use a new class called RootInfo.
RootInfo contains all the relevant info related to the root
associated with the callback. The MarkSweep::VerifyRoot function
now uses this info to print the StackVisitor's described location
if the GC root is of the type kRootJavaFrame.

Some other cleanup.

Example output:
E/art (12167): Tried to mark 0x123 not contained by any spaces
E/art (12167): Attempting see if it's a bad root
E/art (12167): Found invalid root: 0x123 with type RootJavaFrame
E/art (12167): Location=Visiting method
'void java.lang.Runtime.gc()' at dex PC 0xffffffff (native PC 0x0)
vreg=0

(cherry picked from commit 12f7423a2bb4bfab76700d84eb6d4338d211983a)

Bug: 18588862
Change-Id: Ic5a2781f704e931265ffb3621c2eab4b2e25f60f
12f7423a2bb4bfab76700d84eb6d4338d211983a 14-Jan-2015 Mathieu Chartier <mathieuc@google.com> Print more info in MarkSweep::VerifyRoot

Refactored old root callback to use a new class called RootInfo.
RootInfo contains all the relevant info related to the root
associated with the callback. The MarkSweep::VerifyRoot function
now uses this info to print the StackVisitor's described location
if the GC root is of the type kRootJavaFrame.

Some other cleanup.

Example output:
E/art (12167): Tried to mark 0x123 not contained by any spaces
E/art (12167): Attempting see if it's a bad root
E/art (12167): Found invalid root: 0x123 with type RootJavaFrame
E/art (12167): Location=Visiting method
'void java.lang.Runtime.gc()' at dex PC 0xffffffff (native PC 0x0)
vreg=0

Bug: 18588862
Change-Id: Ic5a2781f704e931265ffb3621c2eab4b2e25f60f
956af0f0cb05422e38c1d22cbef309d16b8a1a12 11-Dec-2014 Elliott Hughes <enh@google.com> Remove portable.

Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
d582fa4ea62083a7598dded5b82dc2198b3daac7 06-Nov-2014 Ian Rogers <irogers@google.com> Instruction set features for ARM64, MIPS and X86.

Also, refactor how feature strings are handled so they are additive or
subtractive.
Make MIPS have features for FPU 32-bit and MIPS v2. Use in the quick compiler
rather than #ifdefs that wouldn't have worked in cross-compilation.
Add SIMD features for x86/x86-64 proposed in:
https://android-review.googlesource.com/#/c/112370/

Bug: 18056890

Change-Id: Ic88ff84a714926bd277beb74a430c5c7d5ed7666
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
1d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5 23-Sep-2014 Ian Rogers <irogers@google.com> Refactor quick entrypoints

Remove FinishCalleeSaveFrameSetup.
Assembly routines write down anchor into TLS as well as placing runtime
method in callee save frame.
Simplify artSet64InstanceFromCode by not computing the referrer from the
stack in the C++ code.
Move assembly offset tests next to constant declaration and tidy arch_test.

Change-Id: Iededeebc05e54a1e2bb7bb3572b8ba012cffa1c8
13735955f39b3b304c37d2b2840663c131262c18 08-Oct-2014 Ian Rogers <irogers@google.com> stdint types all the way!

Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
2cbaccb67e22c0b313a9785bfc65bcb4b25d0676 15-Sep-2014 Brian Carlstrom <bdc@google.com> Avoid printing absolute addresses in oatdump

- Added printing of OatClass offsets.
- Added printing of OatMethod offsets.
- Added bounds checks for code size size, code size, mapping table, gc map, vmap table.
- Added sanity check of 100k for code size.
- Added partial disassembly of questionable code.
- Added --no-disassemble to disable disassembly.
- Added --no-dump:vmap to disable vmap dumping.
- Reordered OatMethod info to be in file order.

Bug: 15567083

(cherry picked from commit 34fa79ece5b3a1940d412cd94dbdcc4225aae72f)

Change-Id: I2c368f3b81af53b735149a866f3e491c9ac33fb8
8d0d03e24325463f0060abfd05dba5598044e9b1 07-Jun-2014 Razvan A Lupusoru <razvan.a.lupusoru@intel.com> ART: Change temporaries to positive names

Changes compiler temporaries to have positive names. The numbering now
puts them above the code VRs (locals + ins, in that order). The patch also
introduces APIs to query the number of temporaries, locals and ins.

The compiler temp infrastructure suffered from several issues
which are also addressed by this patch:
-There is no longer a queue of compiler temps. This would be polluted
with Method* when post opts were called multiple times.
-Sanity checks have been added to allow requesting of temps from BE
and to prevent temps after frame is committed.
-None of the structures holding temps can overflow because they are
allocated to allow holding maximum temps. Thus temps can be requested
by BE with no problem.
-Since the queue of compiler temps is no longer maintained, it is no
longer possible to refer to a temp that has invalid ssa (because it
was requested before ssa was run).
-The BE can now request temps after all ME allocations and it is guaranteed
to actually receive them.
-ME temps are now treated like normal VRs in all cases with no special
handling. Only the BE temps are handled specially because there are no
references to them from MIRs.
-Deprecated and removed several fields in CompilationUnit that saved
register information and updated callsites to call the new interface from
MIRGraph.

Change-Id: Ia8b1fec9384a1a83017800a59e5b0498dfb2698c
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
Signed-off-by: Udayan Banerji <udayan.banerji@intel.com>
2e981cbaa2e869ec3910ebdc5cce9d4ab9edb758 13-Aug-2014 Hiroshi Yamauchi <yamauchi@google.com> More efficient stack walk in exception throwing.

In the exception handling code, we currently walk down the stack
twice, once to get the stack height which we use to compute frame IDs
(the bottom frame is zero), and once more to find the catch block to
jump to.

For a deep stack, this could result in very slow exception
handling. That is, if have a lot of finally or catch blocks that we
end up jumping to in a deep stack, we need to do a lot of
catch/rethrow chains. Since we'd need to walk down to the bottom each
time to compute frames IDs in each catch/rethrow, we'd need to walk
down O(N^2) frames at the worst case.

Instead of frames IDs ((the bottom frame is zero), we will use the
frame depth (the top frame is zero) and no longer need to walk down
the stack just to get the stack height. We walk down O(N) frames.

This was what was happening with
code.google.gson.functional.CircularReferenceTest. With this change,
the test run time went from ~120s down to ~3s on N5 and it no longer
crashes due to the thread suspension timeout.

(cherry pick commit 649278cec7119cdd1bea3d0b710dbb2aa7c650b6)

Bug: 16800209
Change-Id: Ie815df1e3e8fb9d82e40685d4cc2b8838fd8aa07
649278cec7119cdd1bea3d0b710dbb2aa7c650b6 13-Aug-2014 Hiroshi Yamauchi <yamauchi@google.com> More efficient stack walk in exception throwing.

In the exception handling code, we currently walk down the stack
twice, once to get the stack height which we use to compute frame IDs
(the bottom frame is zero), and once more to find the catch block to
jump to.

For a deep stack, this could result in very slow exception
handling. That is, if have a lot of finally or catch blocks that we
end up jumping to in a deep stack, we need to do a lot of
catch/rethrow chains. Since we'd need to walk down to the bottom each
time to compute frames IDs in each catch/rethrow, we'd need to walk
down O(N^2) frames at the worst case.

Instead of frames IDs ((the bottom frame is zero), we will use the
frame depth (the top frame is zero) and no longer need to walk down
the stack just to get the stack height. We walk down O(N) frames.

This was what was happening with
code.google.gson.functional.CircularReferenceTest. With this change,
the test run time went from ~120s down to ~3s on N5 and it no longer
crashes due to the thread suspension timeout.

Bug: 16800209
Change-Id: Ie815df1e3e8fb9d82e40685d4cc2b8838fd8aa07
5dc158e9b6635b6c5d3916ae4094e8886feb4580 16-Jul-2014 Sebastien Hertz <shertz@google.com> Fix access to long/double stack values from debugger

Long and double values live in a pair of DEX registers. When we compile DEX
code with the Quick compiler, a DEX register either lives in the stack or is
promoted to a physical register. In the case of a pair of DEX registers, the
Quick compiler assumes both registers live in the same "area": both live in
the stack or both are promoted to physical registers.

From the debugger, we used to access these values by reading/writing each DEX
register separately. However, this does not work when only one DEX register of
a pair is promoted and the other lives in the stack. In this case, the compiled
code reads from/writes to the stack only.

To fix that, the debugger must follow the same rule than the Quick compiler: if
both DEX registers are promoted, read/write them from/to physical registers,
otherwise read/write them from/to the stack. We add StackVisitor:GetVRegPair and
StackVisitor:SetVRegPair for this purpose.

We also follow the same rule when deoptimizing. However we need to do that only
when we know two consecutive DEX registers are part of a pair (long or double).
We know that thanks to the verifier.

Bug: 15527793

(cherry picked from commit c901dd7bdc80b953d04100ef2f54b8d1ca5f466b)

Change-Id: I981e088295254d75352f83a3e6ba0b292cfe3ed3
c901dd7bdc80b953d04100ef2f54b8d1ca5f466b 16-Jul-2014 Sebastien Hertz <shertz@google.com> Fix access to long/double stack values from debugger

Long and double values live in a pair of DEX registers. When we compile DEX
code with the Quick compiler, a DEX register either lives in the stack or is
promoted to a physical register. In the case of a pair of DEX registers, the
Quick compiler assumes both registers live in the same "area": both live in
the stack or both are promoted to physical registers.

From the debugger, we used to access these values by reading/writing each DEX
register separately. However, this does not work when only one DEX register of
a pair is promoted and the other lives in the stack. In this case, the compiled
code reads from/writes to the stack only.

To fix that, the debugger must follow the same rule than the Quick compiler: if
both DEX registers are promoted, read/write them from/to physical registers,
otherwise read/write them from/to the stack. We add StackVisitor:GetVRegPair and
StackVisitor:SetVRegPair for this purpose.

We also follow the same rule when deoptimizing. However we need to do that only
when we know two consecutive DEX registers are part of a pair (long or double).
We know that thanks to the verifier.

Bug: 15527793
Change-Id: I04812285ff26ef0129f39792a1cf776f3591ca2d
e63db27db913f1a88e2095a1ee8239b2bb9124e8 16-Jul-2014 Ian Rogers <irogers@google.com> Break apart header files.

Create libart-gtest for common runtime and compiler gtest routines.
Rename CompilerCallbacksImpl that is quick compiler specific.
Rename trace clock source constants to not use the overloaded profiler term.

Change-Id: I4aac4bdc7e7850c68335f81e59a390133b54e933
aa9b3aee1e06f922e4518713f9b3dff00a0b2597 13-Jun-2014 Sebastien Hertz <shertz@google.com> Fix access to FP registers when visiting stack

Adds GetFPR and SetFPR to Context class so we can read from and write to
floating-point registers during stack visit. They return a boolean flag
indicating whether the read/write is successful. This allows the debugger to
return the JDWP error ABSENT_INFORMATION when we can't read/write a register.
We also update GetGPR and SetGPR for consistency. We keep a default GetGPR
implementation asserting the read was successful using a CHECK so we don't
silently fail.

Adds missing JDWP object tags for StackFrame.SetValues to avoid crash when
setting corresponding objects (thread, thread group, class object or class
loader). Also returns JDWP error INVALID_OBJECT (when the given object id is
invalid) instead of crashing with an unimplemented message.

Bug: 15433097
Change-Id: I70843c9280e694aec1eae5cf6f2dc155cb9ea10e
0bcb2902ec21393d71c94e63aa6733cb5311a0cc 17-Jun-2014 Sebastien Hertz <shertz@google.com> Revert "Revert "Fix access to FP registers when visiting stack""

This reverts commit 8ebd94ab2e0d9867a7d384f00fa4cab24235216f.

Fixes StackVisitor::GetVReg to read register value in a uintptr_t local and
cast it into uint32_t pointer argument.

Bug: 15433097
Change-Id: I4e13ed5446e823e9ec50fbc378b16be5b17b2294
8ebd94ab2e0d9867a7d384f00fa4cab24235216f 17-Jun-2014 Sebastien Hertz <shertz@google.com> Revert "Fix access to FP registers when visiting stack"

This reverts commit aa9b3aee1e06f922e4518713f9b3dff00a0b2597.

Change-Id: Ied27deb89cca5ec9094d391374e03f83fcb76c33
828186492aac39397ee4c139e54c2767bf3d7b66 05-Jun-2014 buzbee <buzbee@google.com> Fix GetOutVROffset to use correct Method* size.

[Tip 'o the hat to Mark Mendell for noticing this one]

Use StackReference to find Method* size in GetOutVROffset.

Change-Id: Ie1b25eb839c59305cadc5fdc7cbb5f41f1a85686
511c8a653d5896e81428393a1c3d427da64e36f3 03-Jun-2014 Zheng Xu <zheng.xu@arm.com> AArch64: Fix cmp-long and method with long arguments.

1. Fix cmp-long.
2. Use single register to pass long argument.
3. Flush StackReference<ArtMethod> on arm64 the same as in common code.
3. Fix the mismatch in calculate reg offset.

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

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
5cf98196d488437acd1e989c08a554ef697fded1 30-May-2014 Ian Rogers <irogers@google.com> Don't report down-calls as unhandled exceptions.

Bug: 15310540
Also, narrow scope of catch/deoptimize stack visitors that are specific to
quick exception delivery.

Change-Id: Ib13a006ce1347acb93a36b0186550d4c3ec2034b
cf4035a4c41ccfcc3e89a0cee25f5218a11b0705 29-May-2014 Andreas Gampe <agampe@google.com> ART: Use StackReference in Quick Stack Frame

The method reference at the bottom of a quick frame is a stack
reference and not a native pointer. This is important for 64b
architectures, where the notions do not coincide.

Change key methods to have StackReference<mirror::ArtMethod>*
parameter instead of mirror::ArtMethod**. Make changes to
invoke stubs for 64b archs, change the frame setup for JNI code
(both generic JNI and compilers), tie up loose ends.

Tested on x86 and x86-64 with host tests. On x86-64, tests succeed
with jni compiler activated. x86-64 QCG was not tested.

Tested on ARM32 with device tests.

Fix ARM64 not saving x19 (used for wSUSPEND) on upcalls.

Tested on ARM64 in interpreter-only + generic-jni mode.

Fix ARM64 JNI Compiler to work with the CL.

Tested on ARM64 in interpreter-only + jni compiler.

Change-Id: I77931a0cbadd04d163b3eb8d6f6a6f8740578f13
92d1a666534aa98b173bb33dc5dba86b2d48aedb 16-May-2014 Hiroshi Yamauchi <yamauchi@google.com> Visit methods in stack frames during root visits.

This is necessary for a Baker-style read barrier to-space invariant to
hold. That is, an object either needs to be marked/forwarded as root
or it must be accessed only through a read barrier by mutators. Since
stack frames have direct pointers to methods that a mutator can access
without a read barrier, stack frame methods have to be visited as
root, which makes sense as stack frames are thread roots. This is the
case even if methods do not move as they have to be marked 'gray' for
the objects pointed to by them, which can move, to be recursively
marked/forwarded.

This also puts us in the right direction toward moving methods (and
fields) in the future.

Bug: 12687968
Change-Id: Id32b913c021a140073deea9149a8782e8f308303
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
5cd33753b96d92c03e3cb10cb802e68fb6ef2f21 16-Apr-2014 Dave Allison <dallison@google.com> Handle implicit stack overflow without affecting stack walks

This changes the way in which implicit stack overflows are handled
to satisfy concerns about changes to the stack walk code.

Instead of creating a gap in the stack and checking for it in
the stack walker, use the ManagedStack infrastructure to concoct
an invisible gap that will never be seen by a stack walk.

Also, this uses madvise to tell the kernel that the main stack's
protected region will probably never be accessed, and instead
of using memset to map the pages in, use memcpy to read from
them. This will save 32K on the main stack.

Also adds a 'signals' verbosity level as per a review request.

Bug: 14066862
Change-Id: I5257305feeaea241d11e6aa6f021d2a81da20b81
8194963098247be6bca9cc4a54dbfa65c73e8ccc 02-May-2014 Vladimir Marko <vmarko@google.com> Replace CountOneBits and __builtin_popcount with POPCOUNT.

Clean up utils.h, make some functions constexpr.

Change-Id: I2399100280cbce81c3c4f5765f0680c1ddcb5883
42fcd9838a87abaf7a2ef86853a5287f86dbe391 22-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "64bit changes to the stack walker for the Quick ABI.""

This reverts commit 8d5ead52a92675c258113d3dfa71bf8fceba5d9f.

Change-Id: I6b4774a9bd180de33551975e106322ba1192e6ab
8d5ead52a92675c258113d3dfa71bf8fceba5d9f 22-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "64bit changes to the stack walker for the Quick ABI."

This reverts commit 5cb328362a633302ca0fcdbaa0da7d94069df051.

Change-Id: Icc0ec1a9f15c2e4e9103e732d7ba75a4feb853b1
5cb328362a633302ca0fcdbaa0da7d94069df051 17-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> 64bit changes to the stack walker for the Quick ABI.

- Spill registers have different sizes.
- The ArtMethod at the bottom of the stack is always of kWordSize.

Change-Id: I92f67ff928477970c393c7146980255d08e8e6af
f943914730db8ad2ff03d49a2cacd31885d08fd7 27-Mar-2014 Dave Allison <dallison@google.com> Implement implicit stack overflow checks

This also fixes some failing run tests due to missing
null pointer markers.

The implementation of the implicit stack overflow checks introduces
the ability to have a gap in the stack that is skipped during
stack walk backs. This gap is protected against read/write and
is used to trigger a SIGSEGV at function entry if the stack
will overflow.

Change-Id: I0c3e214c8b87dc250cf886472c6d327b5d58653e
b373e091eac39b1a79c11f2dcbd610af01e9e8a9 21-Feb-2014 Dave Allison <dallison@google.com> Implicit null/suspend checks (oat version bump)

This adds the ability to use SEGV signals
to throw NullPointerException exceptions from Java code rather
than having the compiler generate explicit comparisons and
branches. It does this by using sigaction to trap SIGSEGV and when triggered
makes sure it's in compiled code and if so, sets the return
address to the entry point to throw the exception.

It also uses this signal mechanism to determine whether to check
for thread suspension. Instead of the compiler generating calls
to a function to check for threads being suspended, the compiler
will now load indirect via an address in the TLS area. To trigger
a suspend, the contents of this address are changed from something
valid to 0. A SIGSEGV will occur and the handler will check
for a valid instruction pattern before invoking the thread
suspension check code.

If a user program taps SIGSEGV it will prevent our signal handler
working. This will cause a failure in the runtime.

There are two signal handlers at present. You can control them
individually using the flags -implicit-checks: on the runtime
command line. This takes a string parameter, a comma
separated set of strings. Each can be one of:

none switch off
null null pointer checks
suspend suspend checks
all all checks

So to switch only suspend checks on, pass:
-implicit-checks:suspend

There is also -explicit-checks to provide the reverse once
we change the default.

For dalvikvm, pass --runtime-arg -implicit-checks:foo,bar

The default is -implicit-checks:none

There is also a property 'dalvik.vm.implicit_checks' whose value is the same
string as the command option. The default is 'none'. For example to switch on
null checks using the option:

setprop dalvik.vm.implicit_checks null

It only works for ARM right now.

Bumps OAT version number due to change to Thread offsets.

Bug: 13121132
Change-Id: If743849138162f3c7c44a523247e413785677370
bf6b92a158053c98b15f4393abb3b86344ec9a20 06-Mar-2014 Andreas Gampe <agampe@google.com> Generic JNI implementation for x86_64

Starting implementation for generic JNI on x86_64. Frames are of
large static size (>4K) right now, should be compacted later. Passes
the whole of jni_compiler_test.

Change-Id: I88ac3e13a534afe7568d62a1ef97cb766e8260e4
4e30541a92381fb280cd0be9a1763b713ee4d64c 19-Feb-2014 Mathieu Chartier <mathieuc@google.com> Fix and optimize verify object.

VerifyObject no longer resides in heap. You can now enable
VerifyObject for non-debug builds. VerifyStack is still slow, so it
is now guarded by its own flag.

Fixed the image writer to not use verification at places where
verification fails due to invalid reads.

Fixed RosAlloc to use SizeOf which doesn't call verify object.

Added a flag paremeter to some of the mirror getters / setters to
be able to selectively disable VerifyObject on certain calls.

Optimized the GC to not verify each object multiple times during
object scanning if verify object is enabled.

Added 3 verification options: verify reads, verify this, and verify
writes so that you can select how much verification you want for
mirror getters and setters.

Removed some useless DCHECKs which would slow debug builds without
providing any benefits.

TODO: RosAlloc verification doesn't currently work with verify
objects.

Bug: 12934910
Bug: 12879358

Change-Id: Ic61033104dfc334543f89b0fc0ad8cd4f4015d69
815873ecc312b1d231acce71e1a16f42cdaf09f2 14-Feb-2014 Mathieu Chartier <mathieuc@google.com> Change root visitor to use Object**.

Simplifies code and improves the performance of root visiting since
we usually don't need to check to see if the object moved.

Change-Id: Iba998f5a15ae1fa1b53ca5226dd2168a411196cf
3bc01748ef1c3e43361bdf520947a9d656658bf8 06-Feb-2014 Razvan A Lupusoru <razvan.a.lupusoru@intel.com> GenSpecialCase support for x86

Moved GenSpecialCase from being ARM specific to common code to allow
it to be used by x86 quick as well.

Change-Id: I728733e8f4c4da99af6091ef77e5c76ae0fee850
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
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
da7a69b3fa7bb22d087567364b7eb5a75824efd8 09-Jan-2014 Razvan A Lupusoru <razvan.a.lupusoru@intel.com> Enable compiler temporaries

Compiler temporaries are a facility for having virtual register sized space
for dealing with intermediate values during MIR transformations. They receive
explicit space in managed frames so they can have a home location in case they
need to be spilled. The facility also supports "special" temporaries which
have specific semantic purpose and their location in frame must be tracked.

The compiler temporaries are treated in the same way as virtual registers
so that the MIR level transformations do not need to have special logic. However,
generated code needs to know stack layout so that it can distinguish between
home locations.

MIRGraph has received an interface for dealing with compiler temporaries. This
interface allows allocation of wide and non-wide virtual register temporaries.

The information about how temporaries are kept on stack has been moved to
stack.h. This is was necessary because stack layout is dependent on where the
temporaries are placed.

Change-Id: Iba5cf095b32feb00d3f648db112a00209c8e5f55
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
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
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
74e256b8e442417d4ba2054c771c1e4f41062768 04-Oct-2013 Sebastien Hertz <shertz@google.com> Add missing references.

This mainly avoids implicit copies when extracting an object from a container.

Change-Id: If4d0e6153e8c2b48345fde5bb546b4c65649fcf3
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
e47637cc7c96e654d2c340e6006c232c8078673b 20-Sep-2013 Jeff Hao <jeffhao@google.com> 4-byte align 64-bit values in Get/Set Double/Long for GCC 4.8.

Bug: 10837416
Change-Id: Ibb562407d81c2085666ae8824e7570f22e56eaa7
423d2a3dcbb260b020efb5da59f784c9f02accbf 13-Sep-2013 Mathieu Chartier <mathieuc@google.com> Add support for changing roots through the root visitor callback.

Needed for copying collectors.

Change-Id: Icc4a342a57e0cfb79587edb02ef8c85e08808877
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
96faf5b363d922ae91cf25404dee0e87c740c7c5 10-Aug-2013 Ian Rogers <irogers@google.com> Uleb128 compression of vmap and mapping table.

Bug 9437697.

Change-Id: I30bcb97d12cd8b46d3b2cdcbdd358f08fbb9947a
(cherry picked from commit 1809a72a66d245ae598582d658b93a24ac3bf01e)
1809a72a66d245ae598582d658b93a24ac3bf01e 10-Aug-2013 Ian Rogers <irogers@google.com> Uleb128 compression of vmap and mapping table.

Bug 9437697.

Change-Id: I30bcb97d12cd8b46d3b2cdcbdd358f08fbb9947a
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
166db04e259ca51838c311891598664deeed85ad 26-Jul-2013 Ian Rogers <irogers@google.com> Move assembler out of runtime into compiler/utils.

Other directory layout bits of clean up. There is still work to separate quick
and portable in some files (e.g. argument visitor, proxy..).

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

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

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

Change-Id: Id7735be1d75bc315733b1773fba45c1deb8ace43
7940e44f4517de5e2634a7e07d58d0fb26160513 12-Jul-2013 Brian Carlstrom <bdc@google.com> Create separate Android.mk for main build targets

The runtime, compiler, dex2oat, and oatdump now are in seperate trees
to prevent dependency creep. They can now be individually built
without rebuilding the rest of the art projects. dalvikvm and jdwpspy
were already this way. Builds in the art directory should behave as
before, building everything including tests.

Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81