History log of /art/runtime/instrumentation.cc
Revision Date Author Comments
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
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
c934e483ceabbd589422beea1fa35f5182ecfa99 21-Nov-2014 Mathieu Chartier <mathieuc@google.com> Fix oatdump to use OatHeader pointer size

Bug: 18473190
Change-Id: If505b4f62105899f4f1257d3bccda3e6eb0dcd7c
a98ffd745bbecb2e84a492194950c0b94966546b 26-Sep-2014 Mathieu Chartier <mathieuc@google.com> Fix broken runtime SetStatsEnabled logic

Previously, Runtime::SetStatsEnabled wouldn't take stats_enabled_
into account when deciding whether or not to increment / decrement
teh stats enabled counter. This resulted in counter underflows and
other errors which caused some CTS tests to fail.

Also added some locking to prevent race conditions.

Bug: 17360878

Change-Id: I779237d55dda4f35054a4d27fb2c660a38750fc0
63bc11efaac0c041e849ab401f9fc368631a00f5 18-Sep-2014 Ian Rogers <irogers@google.com> DO NOT MERGE. Only have a portable entrypoint in portable builds.

Bug: 16214885

Change-Id: Iff7b7415efdbdabd7e6020e221a540f6a774c852
1d6ee090fddd4bfd35c304d6ceb929d5c529dfcc 16-Sep-2014 Jeff Hao <jeffhao@google.com> Avoid suspending for alloc trace enabling when already suspended.

Bug: 17499772
Change-Id: Id98c10967b28e8859e5ac46f5878c304fb85c498
e246f33605a2d6b96f2c7221fa0165dc067c3079 21-Aug-2014 Daniel Mihalyi <daniel.mihalyi@mattakis.com> Fixed wrong field usage in Instrumentation::RemoveListener

Signed-off-by: Daniel Mihalyi <daniel.mihalyi@mattakis.com>

Bug: 16814665

(cherry picked from commit 6644521cfaff718a55e3602efb3b54bf19a0cd1a)

Change-Id: Ie68c70ba6ee2e0bd918717c8659c057f98e66ff7
96add97815ba8418fb4e8c0fc08dbf9c7198f244 18-Aug-2014 Daniel Mihalyi <daniel.mihalyi@mattakis.com> Optimized instrumentation listener handling

Some instrumentation listener lists may be modified while iterating
over the list to deliver an instrumentation event. Therefore the
previous implementation copied the list of listeners before starting
the iteration.

This new implementation only copies the list of instrumentation
listeners when the list is changed. Instances of the list are
reference counted using std::shared_ptr<>.

Bug: 16814665

(cherry picked from commit ca1d06cfa2f2b8d2be4390644e126cb68cdbb5ba)

Change-Id: Ib2e6b980de85b75f1c8f4a8825bdc7767154663a
5afe466c027c6ac821bf7c9a88cd7de5260a639b 19-Aug-2014 Jeff Hao <jeffhao@google.com> Check for constructor first when installing tracing stubs.

Addresses comments in
https://android-review.googlesource.com/#/c/104383/ made after the commit.

Bug: 16386215
Change-Id: I0e59b8507f601fd6508fbda8d24dd3c98ead1537
95b4c65da93500cdbdcaa3e01010771ef3f466f1 15-Aug-2014 Jeff Hao <jeffhao@google.com> Prevent stubs from being installed in java.lang.reflect.Proxy.<init>.

This CL is a better fix for proxy tracing and undoes the changes in
https://android-review.googlesource.com/#/c/103025/

Bug: 16386215

(cherry picked from commit db8a664e0b68c7c4d36270cd21dce8de1912d7f9)

Change-Id: Ic9e0ea2af7cb2da5d90c56aa009de92dba14cc47
b21f1336be9dd0c2607b2ff53834d62a218d1c83 12-Aug-2014 Jeff Hao <jeffhao@google.com> Make method tracing deoptimize on startup.

Bug: 16848366

(cherry picked from commit bc678bba8ec45dfcb1865676dd6d8188da9e56fc)

Change-Id: Idf75288026a837b95f4619acadec57e38bacbd7b
94f7b49578b6aaa80de8ffed230648d601393905 23-Jul-2014 Hiroshi Yamauchi <yamauchi@google.com> Add GcRoot to clean up and enforce read barriers.

Introduce a value-type wrapper around Object* for GC roots so that 1)
we won't have to directly add the read barrier code in many places and
2) we can avoid accidentally bypassing/missing read barriers on GC
roots (the GcRoot interface ensures that the read barrier is executed
on a read).

The jdwp test passed.

Bug: 12687968
Change-Id: Ib167c7c325b3c7e3900133578815f04d219972a1
799eb3a5555254427db269921042419bc30d4d86 19-Jul-2014 Hiroshi Yamauchi <yamauchi@google.com> Add read barriers for the GC roots in Instrumentation.

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

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

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

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

Bug: 8142917
Change-Id: I4240d58cfbe9250107c95c0708c036854c455968
320deb2ebe5cce96ca2779875c82853182326685 11-Jun-2014 Sebastien Hertz <shertz@google.com> Fix missing single-step event

During debugging, we used to suspend too lately after a step. It occurred when
we were stepping out of an interpreted method into a compiled "caller" method.
The issue is we did not deoptimize when returning from the interpreted method
but only did it when returning from the compiled method. Therefore we were not
executing the rest of the compiled method's code with interpreter which
prevents from debugging it.

This CL fixes this issue by using instrumentation entry/exit stubs when calling
interpreted method from compiled code. Therefore, we execute instrumentation
exit stub when returning from interpreter and are able to deoptimize from this
point. This allows to execute compiled method's code with interpreter and to
debug it.

We now also prevent from reporting method entry/exit twice while instrumenting
interpreted methods. We report method entry/exit events only from interpreter.

Bug: 14422182
Bug: 11705760
Change-Id: Ia1175d36202239273083c4e9733c7e9290244090
bae182cbc6adc8796154162a87fc54ae804e0469 17-Dec-2013 Sebastien Hertz <shertz@google.com> Fix method tracing from command-line

Transitions current thread to the new kWaitingForMethodTracingStart thread
state when starting method tracing.

Ensures there is a current thread when method tracing is stopped due to runtime
shutdown. If the current thread has been detached, we now re-attach it.
Note: we only do this if method tracing has been activated from command-line.

Fixes instrumentation when forcing interpreter mode (-Xint) with method tracing
enabled.

Removes unused parameter from UnsafeLogFatalForThreadSuspendAllTimeout.

Bug: https://code.google.com/p/android/issues/detail?id=72094
Bug: 11683397
Change-Id: I70f000fb46ddd95d6ad51ea0a8eee77697a045e9
9f1020305292a21fd14a402b189c765a125226ab 23-May-2014 Sebastien Hertz <shertz@google.com> Fix exception reporting from interpreter

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

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

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

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

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

Bug: 13077697

Change-Id: I71f964d4d810ab4debda1a09bc968af8f3c874a3
d58342caa97108ba413bad467c285c0377f138f5 05-Jun-2014 Andreas Gampe <agampe@google.com> ART: Add instrumentation stubs for ARM64 and X86-64

Adds instrumentation stubs necessary for debugger support.

Refactors MethodAndCode to a top-level TwoWordReturn. A function
having a return type of TwoWordReturn will return its two-word
content, either 2x32b or 2x64b, in two registers according to
the architecture's ABI.

Bug: 15443938
Change-Id: Id7e1fbd4ad8eb6f29e23d48903c76f77b28d981a
83f8f65641dcc83c1aece4f40860a89505084c49 28-May-2014 Jeff Hao <jeffhao@google.com> Fix method tracing's handling of shadow frames on startup.

Bug: 15142926

(cherry picked from commit a15a81b2bd6d08d131e0726ddb622d940ed3c6da)

Change-Id: I3c099a2ba15faeed8d40472566ada197d46a72e5
a15a81b2bd6d08d131e0726ddb622d940ed3c6da 28-May-2014 Jeff Hao <jeffhao@google.com> Fix method tracing's handling of shadow frames on startup.

Bug: 15142926
Change-Id: I7d7896ec3f62f46a43578f536292db6e219d83f0
3e5cf305db800b2989ad57b7cde8fb3cc9fa1b9e 21-May-2014 Ian Rogers <irogers@google.com> Begin migration of art::Atomic to std::atomic.

Change-Id: I4858d9cbed95e5ca560956b9dabd976cebe68333
700a402244a1a423da4f3ba8032459f4b65fa18f 20-May-2014 Ian Rogers <irogers@google.com> Now we have a proper C++ library, use std::unique_ptr.

Also remove the Android.libcxx.mk and other bits of stlport compatibility
mechanics.

Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
8a630577ed2d9e9571c3434c505e5de223b23c07 09-Apr-2014 Vladimir Marko <vmarko@google.com> Move mapping table and vmap table offsets to OatMethodHeader.

This change has a libcore/ companion CL
"Remove ArtMethod's quick fields mapping table and vmap table."
https://android-review.googlesource.com/91254

Bug: 11767815
Change-Id: I46ce2067e1ecd915da3890606498e31ffc332813
3f52eafe5577b8489f90dc8ed5981b3455206147 04-Apr-2014 Sebastien Hertz <shertz@google.com> Prepare field watchpoint support

Adds field read/write events in the instrumentation. The debugger now registers
as a listener for these events so JDWP field access and field modification
events can be reported.

This CL will be followed by another one to report these events from the
interpreter. Therefore no JDWP field access and field modification events
can be sent for now.

Bug: 8267708
Change-Id: If2a93eb590805567d69015c83cce9cd2ab712cbd
7ec2f1ca3cbd021848da75d5566f7239ce29676f 27-Mar-2014 Sebastien Hertz <shertz@google.com> Speed up single-stepping

During single-stepping sequence, we need to deoptimize everything when we
register a single-step event and undeoptimize everything when it is done. This
causes a slow pattern where we continuously deoptimize-undeoptimize everything
for each single-step.

This CL introduces a special handling of single-step undeoptimization. We now
delay the undeoptimization to the next resume (one thread or all threads) or
the end of the debugging session. Indeed, a single-step event registration is
always followed by a resume command.
At the "resume" point, we know if a single-step event is registered and if we
really need to undeoptimize. At the "registration" point, we know we did not
undeoptimized everything so we don't need to deoptimize everything again.
Therefore, in a sequence of single-steps, we only do a full deoptimization for
the first single-step and a full undeoptimization for the last single-step.

We update logs at deoptimization points so we can track more precisely. Note
they are verbose logs that still must be enabled with -verbose:jdwp option.

We also make some improvement inside instrumentation:
* updates Instrumentation::ShouldNotifyMethodEnterExitEvents to comply with its
name.
* compute frame id only once when looking for the corresponding instrumentation
frame.
* compute the OatMethod once in ClassLinker::GetPortableOatCodeFor to avoid
looking for it again.

Bug: 13577964
Change-Id: If6fa198a676b515cd474b8c4d7bf7ef3626f2dc7
bf079fe015e3b2d966e111efc61728b6e6892ec3 01-Apr-2014 Sebastien Hertz <shertz@google.com> Fix crash when debugging exception

Fixes a crash when detaching the debugger during an exception event. The cause
is a concurrent modification of Instrumentation::exception_caught_listeners_
list (consequence of debugger being detached) while we loop over its elements.

Workaround the issue by making a copy of the listeners list.

Bug: 13738672
Change-Id: I56b84c5c8f31d6fbda1ba7cb35caeefc5e7ca60f
3b05e9ba874449dbff65b01b8781001f7d93eea6 25-Mar-2014 Mathieu Chartier <mathieuc@google.com> Add missing debugger root visiting.

Bug: 13634574
Change-Id: I2a76f6c43f1d0ad1922f06deb40a71ff651129fd
661974a5561e5ccdfbac8cb5d8df8b7e6f3483b8 09-Jan-2014 Mathieu Chartier <mathieuc@google.com> Fix valgrind gtests and memory leaks.

All tests pass other than image_test which passes if some bad reads
are disabled (buzbee working on this).

Change-Id: Ifd6b6e3aed0bc867703b6e818353a9f296609422
d889178ec78930538d9d6a66c3df9ee9afaffbb4 02-Mar-2014 Mathieu Chartier <mathieuc@google.com> Guard entrypoint changing by runtime shutdown lock.

There was a race when we changed the allocation entrypoints where a
new thread would be starting (Thread::Init) and initialize to the
wrong entrypoints. Guarding allocation entrypoint changing
with the runtime shutdown lock fixes this race condition since
Thread::Init is only called with the runtime shutdown lock held.

Bug: 13250963

Change-Id: I8eb209c124b6bf17020de874e1b0083f158b8200
563b47cc142e477da244539b1d63070425e7fd78 01-Mar-2014 Hiroshi Yamauchi <yamauchi@google.com> Fix the bug that some compiled code was invoked with -Xint.

Some compiled code (probably static methods) is still being invoked
with -Xint. Added an assert to detect this case.

Bug: 13250375
Change-Id: Iecfe8ef40c6c326962593db78e6e1d9f1c93842e
11d40c250ec86c784cf76b8c31e1cf9285d555dc 19-Feb-2014 Sebastien Hertz <shertz@google.com> Fix deoptimization deadlock

Fixes a deadlock occuring during undeoptimization on debugging session end.

Before disconnecting debugger, we must unregister all requested events. We take
the event list lock to browse all these events. Some of them (as METHOD_EXIT)
may have activated deoptimization so we need to undeoptimize. During this
process, we restore all original entrypoints of every method in the stack and
notify method exit events to the instrumentation listener (see method
InstrumentationLister::MethodExited). In our case, the instrumentation listener
is the debugger. It takes the event list lock (to browse the event list and see
if this event must be posted) but hangs waiting for it. Since it's already
holding the event list lock (which is not recursive), it ends up in a deadlock
situation.

This CL fixes the way we prevent from posting method enter/exit events during
the process of deoptimization/undeoptimization. We now explicitly set a flag
indicating if deoptimization is enabled (by the debugger).

Also removes unused field in InstallStackVisitor class and remove debugger as
listener before disabling deoptimization to ensure it does not receive any
event when disconnecting.

Change-Id: I49a2ae43e86cf29094f4b462bfa754d7740d3e97
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
138dbfc3336e379d74d157086f69a0fbe830089b 04-Dec-2013 Sebastien Hertz <shertz@google.com> Selective deoptimization.

Update the instrumentation to allow selective deoptimization.

Separate instrumentation listener registration from stubs configuration. A
listener is now responsible for configuring the appropriate stubs.
- The method tracing listener installs instrumentation entry/exit stubs or
the interpreter depending on the accuracy of events we want (controlled by
kDeoptimizeForAccurateMethodEntryExitListeners).
- The debugger registers itself as an instrumentation listener but does not
modify methods entrypoints. It only does this on demand when deoptimizing one
method or all the methods.

The selective deoptimization is used for breakpoint only. When a breakpoint is
requested, the debugger deoptimizes this method by setting its entrypoint to
the interpreter stub. As several breakpoints can be set on the same method, we
deoptimize only once. When the last breakpoint on a method is removed, we
reoptimize it by restoring the original entrypoints.

The full deoptimization is used for method entry, method exit and single-step
events. When one of these events is requested, we force eveything to run with
the interpreter (except native and proxy methods). When the last of these
events is removed, we restore all methods entrypoints except those which are
currently deoptimized.

Deoptimizing a method requires all mutator threads be suspended in order to
walk each thread's stack and ensure no code is actually executing while we
modify methods entrypoints. Suspending all the threads requires to not hold
any lock.
In the debugger, we deoptimize/undeoptimize when the JDWP event list changes
(add or remove a breakpoint for instance). During the update, we need to hold
the JDWP event list lock. This means we cannot suspend all the threads at this
time.
In order to deal with these constraints, we support a queue of deoptimization
requests. When an event needs selective/full deoptimization/undeoptimization,
we save its request in the queue. Once we release the JDWP event list lock, we
suspend all the threads, process this queue and finally resume all the threads.
This is done in Dbg::ManageDeoptimization. Note: threads already suspended
before doing this remain suspended so we don't "break" debugger suspensions.

When we deoptimize one method or every method, we need to browse each thread's
stack to install instrumentation exit PC as return PC and save information in
the instrumentation stack frame. Now we can deoptimize multiple times during
the execution of an application, we need to preserve exisiting instrumentation
frames (which is the result of a previous deoptimization). This require to push
new instrumentation frames before existing ones so we don't corrupt the
instrumentation stack frame while walking the stack.

Bug: 11538162
Change-Id: I477142df17edf2dab8ac5d879daacc5c08a67c39
e6da9af8dfe0a3e3fbc2be700554f6478380e7b9 16-Dec-2013 Mathieu Chartier <mathieuc@google.com> Background compaction support.

When the process state changes to a state which does not perceives
jank, we copy from the main free-list backed allocation space to
the bump pointer space and enable the semispace allocator.

When we transition back to foreground, we copy back to a free-list
backed space.

Create a seperate non-moving space which only holds non-movable
objects. This enables us to quickly wipe the current alloc space
(DlMalloc / RosAlloc) when we transition to background.

Added multiple alloc space support to the sticky mark sweep GC.

Added a -XX:BackgroundGC option which lets you specify
which GC to use for background apps. Passing in
-XX:BackgroundGC=SS makes the heap compact the heap for apps which
do not perceive jank.

Results:
Simple background foreground test:
0. Reboot phone, unlock.
1. Open browser, click on home.
2. Open calculator, click on home.
3. Open calendar, click on home.
4. Open camera, click on home.
5. Open clock, click on home.
6. adb shell dumpsys meminfo

PSS Normal ART:
Sample 1:
88468 kB: Dalvik
3188 kB: Dalvik Other
Sample 2:
81125 kB: Dalvik
3080 kB: Dalvik Other

PSS Dalvik:
Total PSS by category:
Sample 1:
81033 kB: Dalvik
27787 kB: Dalvik Other
Sample 2:
81901 kB: Dalvik
28869 kB: Dalvik Other

PSS ART + Background Compaction:
Sample 1:
71014 kB: Dalvik
1412 kB: Dalvik Other
Sample 2:
73859 kB: Dalvik
1400 kB: Dalvik Other

Dalvik other reduction can be explained by less deep allocation
stacks / less live bitmaps / less dirty cards.

TODO improvements: Recycle mem-maps which are unused in the current
state. Not hardcode 64 MB capacity of non movable space (avoid
returning linear alloc nightmares). Figure out ways to deal with low
virtual address memory problems.

Bug: 8981901

Change-Id: Ib235d03f45548ffc08a06b8ae57bf5bada49d6f3
b122a4bbed34ab22b4c1541ee25e5cf22f12a926 20-Nov-2013 Ian Rogers <irogers@google.com> Tidy up memory barriers.

Change-Id: I937ea93e6df1835ecfe2d4bb7d84c24fe7fc097b
cbb2d20bea2861f244da2e2318d8c088300a3710 15-Nov-2013 Mathieu Chartier <mathieuc@google.com> Refactor allocation entrypoints.

Adds support for switching entrypoints during runtime. Enables
addition of new allocators with out requiring significant copy
paste. Slight speedup on ritzperf probably due to more inlining.

TODO: Ensuring that the entire allocation path is inlined so
that the switch statement in the allocation code is optimized
out.

Rosalloc measurements:
4583
4453
4439
4434
4751

After change:
4184
4287
4131
4335
4097

Change-Id: I1352a3cbcdf6dae93921582726324d91312df5c9
51db44a194bafc3810a41164a8b39614f10e79df 19-Nov-2013 Sebastien Hertz <shertz@google.com> Propagate 'this_object' for method unwind event.

Propagates the 'this_object' to InstrumentationListener::MethodUnwind callback.

Change-Id: I12561f1a611b8399b94e669f9b8a6eaaf1a58631
5bfd5c9e75b31afab2cb3676b8dc71e58a7d90df 15-Nov-2013 Sebastien Hertz <shertz@google.com> Fix missing class initialization during instrumentation.

Static methods (except the <clinit>) all point to the resolution trampoline
to handle class initialization. When we enable instrumentation, we update the
entry point to the instrumentation stub. But doing so makes us miss the call
into the trampoline.

This CL fixes this issue by leaving the resolution trampoline. Once a method's
class is initialized, we update all its static methods' entry point. When
instrumentation is enabled, this entry point becomes the instrumentation entry
stub.

This also allows to post method enter events in the right order during static
invokes. First, we get into the trampoline which call the method's class
<clinit> method and post the corresponding "method enter" event. Then we get
into the instrumentation entry stub of the static method being called and post
the corresponding "method enter" event before getting into its code.

Bug: 11686442
Change-Id: I202db921225c8be0b2191074d09b0ba40f9248b2
02b10d6f493a7f15123c01048f05dba9e4567b48 07-Nov-2013 Jeff Hao <jeffhao@google.com> Do not instrument proxy methods.

This fixes issues with traceview on Books.

Bug: 11512992
Change-Id: Id67578af5e404fca51aa99860a3a61a68574ccf8
fa82427c68b09f4aedbee319dc71579afbfc66f5 06-Nov-2013 Ian Rogers <irogers@google.com> Fix oatdump and valgrind.

Bug: 11531382
Move allocation instrumentation out of runtime into instrumentation. Don't
attempt to suspend threads in unstarted runtimes.
Make indentation support sputc returning eof, on which it will sync and try
again. A further failure likely means the disk is full.
Move the dump-oat output directory to be art as now there's too much output to
fit all the dump-oat data in our standard /tmp.

Change-Id: I8ea848ace318552c180e2efa46570288ff1ca62c
ee1997a3b83334985e757f369c09e111b121661b 19-Sep-2013 Sebastien Hertz <shertz@google.com> Improve interpreter handler table management.

We still have two handlers table:
- the "main" table which holds execution handlers of each instruction,
- the "alternative" table which holds handlers supporting instrumentation
before jumping to the corresponding instruction handler from the "main" table.

Instrumentation holds the index of the handler table the interpreter must use.
This index is represented by the InterpreterHandlerTable enum and is stored in
the Instrumentation::interpreter_handler_table_ field.

Interpreter's current handler table update happens:
- on backward branch
- after invoke
- when throwing exception.
In the case of the backward branch and exception, we only update the table if
any thread's flags is set. This allows to only do one test for handling thread
suspension and handler table update.

This CL also removes the local variable "instrumentation". Every handler which
needs it will get it from Runtime::Current()->GetInstrumentation().

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

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

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

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

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

Change-Id: I2caccba9a906f244c8057b24031250f9824cc711
7b6da36ac600178f0cdc60a1c36843c3a4fd300e 11-Sep-2013 Ian Rogers <irogers@google.com> Don't deopt for tracing due to stability.

Change-Id: I49525f950c669a6dab4f7038b10fccb663087acf
816432e297f9d440902fd827ca2e78e8c28f9f6b 07-Sep-2013 Ian Rogers <irogers@google.com> Deopt for method entry/exit when not sampling.

Bug 9968239.
Note, this makes profiling performance horrendously slow. The real fix is to
get the sampling enabled flag to be set to true by frameworks.

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

Needed to update cpplint to handle const auto.

Fixed a few cpplint errors that were being missed before.

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

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

Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1.

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

Bug: 10014286.

Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
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
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
2d88862f0752a7a0e65145b088f49dabd49d4284 19-Jul-2013 Brian Carlstrom <bdc@google.com> Fixing cpplint readability/casting issues

Change-Id: I6821da0e23737995a9b884a04e9b63fac640cd05
65d15d985a27be01e1d64f473af0e9d8eb19051d 17-Jul-2013 Jeff Hao <jeffhao@google.com> Fixes to instrumentation for debug build and interpreter.

- Stub uninstall will put back the interpreter entry point if Xint
mode is specified.
- Copy method entry and exit listeners before iterating over them
to prevent problems that occur when they are modified during
iteration.
- Corrected checks from WalkStack and AssertPcIsWithinCode to
handle instrumented code since they are used to remove the stubs.

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