| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
Change-Id: I9b69a23b308fe851ed49722c0da3953433b3f5b8
|
| |
|
|
|
|
|
|
|
|
| |
Instead of method instrumentation, allow traceview to periodically
sample stack traces of threads. Disabled by default until we add
gui support for this new mode.
(cherry picked from commit 676f8a527fb62abd39663d55c7d9208f5ca03093)
Change-Id: Ia5d0d57012305a5830d042bcb903a429432b035b
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch provides a fully functional x86 trace JIT compiler for Dalvik
VM. It is built on top of the existing x86 fast interpreter
with bug fixes and needed extension to support trace JIT interface. The
x86 trace JIT code generator was developed independent of the existing
template-based code generator and thus does not share exactly the same
infrastructure. Included in this patch are:
* Deprecated and removed the x86-atom fast interpreter that is no
longer functional since ICS.
* Augmented x86 fast interpreter to provide interfaces for x86 trace JIT
compiler.
* Added x86 trace JIT code generator with full JDWP debugging support.
* Method JIT and self-verification mode are not supported.
The x86 code generator uses the x86 instruction encoder/decoder library
from the Apache Harmony project. Additional wrapper extension and bug
fixes were added to support the x86 trace JIT code generator. The x86
instruction encoder/decoder is embedded inside the x86 code generator
under the libenc subdirectory.
Change-Id: I241113681963a16c13a3562390813cbaaa6eedf0
Signed-off-by: Dong-Yuan Chen <dong-yuan.chen@intel.com>
Signed-off-by: Yixin Shou <yixin.shou@intel.com>
Signed-off-by: Johnnie Birch <johnnie.l.birch.jr@intel.com>
Signed-off-by: Udayan <udayan.banerji@intel.com>
Signed-off-by: Sushma Kyasaralli Thimmappa <sushma.kyasaralli.thimmappa@intel.com>
Signed-off-by: Bijoy Jose <bijoy.a.jose@intel.com>
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
Signed-off-by: Tim Hartley <timothy.d.hartley@intel.com>
|
| |
|
|
|
| |
Change-Id: Ibf08d50c7a01a4c30559dd2ee9511c28fb1365a5
Signed-off-by: Chris Dearman <chris@mips.com>
|
| |
|
|
|
|
|
|
|
|
| |
An leading underscore followed by a capital letter is a reserved
name space in C and C++.
This change also moves any #include directives within the include
guard in some of the compiler/codegen/arm header files.
Change-Id: I9715e2c5301699d31886e61d0fe6e29483555a2a
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
In particular, when we're waiting on a Class, say which class:
I(16573) - waiting on <0xf5ed54f8> (java.lang.Class<java.lang.ref.ReferenceQueue>)
versus:
I(16573) - waiting on <0xf5feda38> (a java.util.LinkedList)
Bug: http://code.google.com/p/android/issues/detail?id=17349
Change-Id: I844d02c008b1499adb02995ff3da25ba8cad0e0a
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This one was tricky to track down. The underlying problem arose
with the consolidation of InterpState with Thread. Rather than
having a state structure for each instance of the interpreter, we
moved to a model that had a single thread-local struct shared by all
interpreter instances running on that thread. A portion of interpreter
state can't be shared - and thus was saved and restored on nested
invocations of the interpreter.
The bug here was that the storage for method return values was not
included in the state that needed save/retore. In normal operation,
it doesn't need to be saved - that storage isn't live across an
invoke that could trigger a nested interpreter activation. However,
when debugging, the debugger itself may hijack threads and create
new interpreter instances for its own purposed - and there is a small
window in which live retval can be trashed.
The fix is simply to move retval into the InterpSave struct.
Change-Id: Ib621824b799c5caa16fdfa8f5689a181159059df
|
| |
|
|
| |
Change-Id: I9f9fe52bd4ceebb6dde48251a89190ba6bb00ce4
|
| |
|
|
| |
Change-Id: I236c5a1553a51f82c9bc3eaaab042046c854d3b4
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Replace dvmUpdateInterpBreak() and friends with more direct
enable/disable subMode calls. Hide breakFlags manipulation from
higher-level callers and infer what is needed from the active
subMode.
Add documentation to the interpreter control section of
mterp/README.txt
Change-Id: If7ebee5d8e4db8154c4caed72cf89ec088045998
|
| |
|
|
|
|
|
|
|
| |
Moved the suspend count variables from the interpBreak structure. These
are already protected by a mutex, and we need the space in interpBreak
for additional subMode flags. This CL just does the move and expands
the width of subMode to 16-bits.
Change-Id: I4a6070b1ba4fb08a0f6e0aba6f150b30f9159eed
|
| |
|
|
|
|
|
| |
We ended up with two locations in the Thread structure for saved
Dalvik frame pointer. This change consolidates them.
Change-Id: I78f288e4e57e232f29663be930101e775bfe370f
|
| |
|
|
| |
Change-Id: I25d8fa821987a3dd6d7109d07fd42dbf2fe0e589
|
| |
|
|
| |
Change-Id: Ief382b9acb0fa6ce1e0371ecbb7d86f7059102d8
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds a safepoint callback registration mechanism.
On a per-thread (or all-thread) basis, you pass in a function to be
called at the next safe point by the target thread. That if that
function returns 0, it will be automatically disarmed. If not,
the callback will stay in effect and the function will be called
on all subsequent safe points.
GC is the expected customer of this feature.
Change-Id: Icd3b93128b1fd547e142d047a12df7ae8ee646e3
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a restructuring of the Dalvik ARM and x86 interpreters:
o Combine the old portstd and portdbg interpreters into a single
portable interpreter.
o Add debug/profiling support to the fast (mterp) interpreters.
o Delete old mechansim of switching between interpreters. Now, once
you choose an interpreter at startup, you stick with it.
o Allow JIT to co-exist with profiling & debugging (necessary for
first-class support of debugging with the JIT active).
o Adds single-step capability to the fast assembly interpreters without
slowing them down (and, in fact, measurably improves their performance).
o Remove old "polling for safe point" mechanism. Breakouts now achieved
via modifying base of interpreter handler table.
o Simplify interpeter control mechanism.
o Allow thread-granularity control for profiling & debugging
The primary motivation behind this change was to improve the responsiveness
of debugging and profiling and to make it easier to add new debugging and
profiling capabilities in the future. Instead of always bailing out to the
slow debug portable interpreter, we can now stay in the fast interpreter.
A nice side effect of the change is that the fast interpreters
got a healthy speed boost because we were able to replace the
polling safepoint check that involved a dozen or so instructions
with a single table-base reload. When combined with the two earlier CLs
related to this restructuring, we show a 5.6% performance improvement
using libdvm_interp.so on the Checkers benchmark relative to Honeycomb.
Change-Id: I8d37e866b3618def4e582fc73f1cf69ffe428f3c
|
| |
|
|
|
|
| |
This change removes support for direct references.
Change-Id: I2af043ecfc5811c16a7d02a5bbb6c071ec6f0a82
|
| |
|
|
|
|
|
|
|
|
|
|
| |
I pulled out all the initialization code that I could find that was
merely looking up class and member names during early VM initialization,
putting them all in a new file, InitRefs.c. I didn't do any real restructuring
of the code, though. That will come in a follow-up.
This was instigated by discussion surrounding bug #3500987, but it's not
directly related to it.
Change-Id: I59e93e552d29a5518f2cc4e1e30c4a8d51750d7b
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce parallel handler entry points for mterp interpreters as a step
towards fully supporting debug, profile and JIT within mterp (instead of
bailing out to the portable debug interpreter).
This CL contains most of the structural changes that need to happen,
but does not yet enable the new switch mode. In short, within the
mterp assembly interpreter register rIBASE points to an array of handlers
for Dalvik opcodes. Instead of periodically checking for suspend,
debug, profiling and JIT trace selection breakouts, rIBASE may simply
be altered to point to the parallel breakout handlers when control needs
to be rerouted. This will enable us to eliminate the separate portable
debug interpreter and the entire mechanism of switching between the fast
and portable interpreters.
The x86 implementation required a large number of changes because of the
need to dedicate a register to holding the table base. It will now use %edx
(which was previously scratch).
Changes include:
o Support for two styles of mterp assembly code generation: computed goto
and jump table (ARM uses computed goto, x86 uses jump table)
o New mterp config operators to trigger generation of alternate entry points.
o Alternate entries route execution through new dvmCheckInst(). That's
where the checking code will go.
o For x86, reserved register edx as dedicated rIBASE.
o For jump-table mterps, ignore "%break" operator and allow variable-sized
handlers with no "sister" region.
Note that the x86-atom implementation will need substantial changes
to function in this new model.
Change-Id: I3a22048adb7dcfdeba4f94fbb977b26c3ab2fcb3
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The key datastructure for the interpreter is InterpState.
This change eliminates it, merging its data with the Thread structure.
Here's why:
In principio creavit Fadden Thread et InterpState. And it was good.
Thread holds thread-private state, while InterpState captures data
associated with a Dalvik interpreter activation. Because JNI calls
can result in nested interpreter invocations, we can have more than one
InterpState for each actual thread. InterpState was relatively small,
and it all worked well. It was used enough that in the Arm version
a register (rGLUE) was dedicated to it.
Then, along came the JIT guys, who saw InterpState as a convenient place
to dump all sorts of useful data that they wanted quick access to through
that dedicated register. InterpState grew and grew. In terms of
space, this wasn't a big problem - but it did mean that the initialization
cost of each interpreter activation grew as well. For applications
that do a lot of callbacks from native code into Dalvik, this is
measurable. It's also mostly useless cost because much of the JIT-related
InterpState initialization was setting up useful constants - things that
don't need to be saved and restored all the time.
The biggest problem, though, deals with thread control. When something
interesting is happening that needs all threads to be stopped (such as
GC and debugger attach), we have access to all of the Thread structures,
but we don't have access to all of the InterpState structures (which
may be buried/nested on the native stack). As a result, polling for
thread suspension is done via a one-indirection pointer chase. InterpState
itself can't hold the stop bits because we can't always find it, so
instead it holds a pointer to the global or thread-specific stop control.
Yuck.
With this change, we eliminate InterpState and merge all needed data
into Thread. Further, we replace the decidated rGLUE register with a
pointer to the Thread structure (rSELF). The small subset of state
data that needs to be saved and restored across nested interpreter
activations is collected into a record that is saved to the interpreter
frame, and restored on exit. Further, these small records are linked
together to allow tracebacks to show nested activations. Old InterpState
variables that simply contain useful constants are initialized once at
thread creation time.
This CL is large enough by itself that the new ability to streamline
suspend checks is not done here - that will happen in a future CL. Here
we just focus on consolidation.
Change-Id: Ide6b2fb85716fea454ac113f5611263a96687356
|
| |
|
|
|
|
|
| |
This feature has been in the code base for several releases but has never
been enabled.
Change-Id: Ia770b03ebc90a3dc7851c0cd8ef301f9762f50db
|
| |
|
|
|
|
|
|
| |
This increases the default stack size from 12KB to 16KB.
Bug 3388513
Change-Id: I7f7c3f75b749ca2145a96434e89e6500f79973e4
|
| |
|
|
| |
Change-Id: Ie9a23da2baf201c50cad5ba0d0992cec9bcace54
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the beginning, the only way to traverse the roots and heap was to
piggyback off the garbage collector. As such, HPROF was implemented
by instrumenting the root- and object traversal routines to check a
mode flag and call into HPROF during a GC when the flag was set.
This change moves the HPROF calls out of the GC and into callbacks
invoked through the visitor. Notably, it allows HPROF dumps to be
computed at any point in time without invoking a GC and potentially
destroying evidence relating to the cause of an OOM.
Change-Id: I2b74c4f10f35af3ca33b7c0bbfe470a8b586ff66
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
There were some paths to "thread list lock must be held" functions that
weren't locking the thread list. We now do trylock/unlock in dumpFrames
to ensure that doesn't happen.
Also, append "tid=N" to the "waiting on" line in stack trace output
when we're waiting on a VMThread object (i.e. we're in Thread.join()).
Bug 2827015 (for the thread list lock).
Change-Id: I05aa27dd440c671b22ef7cfe47e31dfe54b0ed2d
|
| |
|
|
|
|
|
|
| |
dalvik/vm/native/SystemThread.[ch] was added for the old sampling
profiler, and can be removed as it's not needed for the new one.
Bug: 2967741
Change-Id: Ibd306b4ba579f9796facbf7a69719b3cb6640762
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are at least three ways to handle detection of thread suspension
correctly: (1) hold a mutex, (2) pile all state into a single 32-bit
location and use atomic ops, and (3) order the operations carefully.
Of these, #3 has the least overhead on uniprocessors, so we're going
with that.
It does introduce one quirk, because we're now changing to "running"
mode before checking to see if we're allowed to run. This creates
a tiny window of opportunity for assertions and thread dumps to see
what appears to be a thread that's running when it shouldn't be.
This is correctable with additional work (e.g. transitioning through
a pre-running state) but probably not worth worrying about.
This eliminates the separate self->isSuspended flag in favor of the
new THREAD_SUSPENDED thread state.
Bug 2667016.
(cherry-pick from dalvik-dev)
Change-Id: Ibc77ebbb03a7993bc4057c1c375498172ca8ff1c
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This eliminates the use of the WITH_DEBUGGER and WITH_PROFILER
conditional compilation flags. We've never shipped a device without
these features, and it's unlikely we ever will. They're not worth
the code clutter they cause.
As usual, since I can't test the x86-atom code I left that alone and
added an item to the TODO list.
Bug 2923442.
Change-Id: I335ebd5193bc86f7641513b1b41c0378839be1fe
|
| |
|
|
|
|
|
|
|
|
|
| |
Wandered through Thread.c looking for SMP trouble spots. Changed a
couple of stores to android_atomic_release_store, and added some
comments.
Also, wrapped the self-suspend stuff that's in the thread status change
code so it only happens if we're actually going to suspend the thread.
Change-Id: I2d3feae7ce8937eada9111bd31928b61875a86d3
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changes include:
1) Force the trace that ends with an invoke instruction to include
the next instruction if it is a move-result (because both need
to be turned into no-ops if callee is inlined).
2) Interpreter entry point/trace builder changes so that return
target won't automatically be considered as trace starting points
(to avoid duplicate traces that include the move result
instructions).
3) Codegen changes to handle getters/setters invoked from both
monomorphic and polymorphic callsites.
4) Extend/fix self-verification to form identical trace regions and
handle traces with inlined callees.
5) Apply touchups to the method based parsing - still not in use.
Change-Id: I116b934df01bf9ada6d5a25187510e352bccd13c
|
| |
|
|
|
|
|
|
|
|
| |
This change also introduces wrappers for condition variable operations
similar to what we have already for mutex operations.
Almost all the remaining warnings are now in the compiler or non-debug
uses of the CHECK_JIT macro.
Change-Id: I9f492f1582a06065e3a52287c7834adddfbefff9
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the stars aligned correctly (or you were running valgrind), it was
possible for a thread to change its status to RUNNING immediately after
having its suspend count incremented. The problem is that the thread
initiating the suspension regards the target thread as being in (say)
VMWAIT with sCount=1, which means its safe to kick off a GC. The target
thread thinks it's happily in RUNNING and can go do whatever it wants.
The fix is to move the status change so that it's guarded by the
suspension count mutex.
This shouldn't affect performance. The number of instructions executed
is about the same.
Also, the "self can be NULL" feature of dvmCheckSuspendPending had very
few customers, so we now skip that check and just require it to be set.
For bug 2309331.
Change-Id: Id512e16e321515a467c20b382c85017cef9cea4d
|
| |
|
|
|
|
|
|
| |
reference verification routine adds an extra argument so the base
address of an object can be passed to the verification code without
provoking a warning from GCC about breaking alias analysis.
Change-Id: Idd921bcc0e084c18bff1e209a8591ef55f57843a
|
| |\
| |
| |
| |
| |
| |
| | |
Merge commit 'f8a44e85b2beed31f0cb1688ac6bdc08bc37ece1' into dalvik-dev
* commit 'f8a44e85b2beed31f0cb1688ac6bdc08bc37ece1':
Point debuggerd at the interesting thread.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There are a couple of situations (spin-on-suspend, HeapWorker wedged)
where the current thread's native stack is much less interesting than one
of the others. This change will cause a couple of signals to be thrown
at the "interesting" thread in an attempt to get more useful information
out of debuggerd in these cases.
For bug 2517042.
Change-Id: Ib8c0e0ef93f07b7114e5f4638a907a0f7802bdc0
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A thread in the MONITOR state is blocked waiting on a monitor. This
raises two interesting questions: (1) what lock is it waiting on, and
(2) who holds that lock? The answer to (1) can be determined easily by
looking at the source code, but (2) is a bit harder.
This change extracts the target object from the instruction stream and
prints some information about it, e.g.:
- waiting to lock <0x40028c68> (a java.lang.Object) held by threadid=1 (main)
Also: fiddled with "must [not] be locked" on a recently-added function.
(cherry-picked from dalvik-dev)
Change-Id: Ic16695741760d50be70e70fb7470972cef28bb09
|
| | |
| |
| |
| |
| |
| |
| | |
functions with calls to the error checked wrapper functions. This
ensures that all mutex operations are checked in debug builds.
Change-Id: I4a5f181e025a2974f3325bcd9efa861eb6a92978
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A thread in the MONITOR state is blocked waiting on a monitor. This
raises two interesting questions: (1) what lock is it waiting on, and
(2) who holds that lock? The answer to (1) can be determined easily by
looking at the source code, but (2) is a bit harder.
This change extracts the target object from the instruction stream and
prints some information about it, e.g.:
- waiting to lock <0x40028c68> (a java.lang.Object) held by threadid=1 (main)
Change-Id: Iad18fc6f2df4142368bdf1063b8cc71de2d66156
Also: fiddled with "must [not] be locked" on a recently-added function.
|
| |\|
| |
| |
| |
| |
| |
| | |
Merge commit '77fbf5c29a9dd62f64e8e98376724b86e79ae8f6' into dalvik-dev
* commit '77fbf5c29a9dd62f64e8e98376724b86e79ae8f6':
If a finalizer wedges, raise prio and retry.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The VM uses a watchdog mechanism to detect stuck finalizers. It appears
that, in some cases, the watchdog may be firing because the HeapWorker
thread in a background process doesn't get any CPU time after a
remotely-induced GC finishes. With this change, if the HeapWorker is
running at a reduced priority, we raise the priority and allow it to
try some more.
No attempt is made to put the thread priority back. (The HeapWorker
thread doesn't do anything in an idle process, and what it does do is
geared toward freeing one kind of resource or another.)
For bug 2492196.
Change-Id: Ic734c2e2819b9d60d20b2961f2a75085d5879495
|
| |/
|
|
|
|
| |
where unused attributes have been added, arguably, the return code
should be passed up to the caller or, if the return code indicates an
error, we should fast-fail.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Defer initialization of jit to support upcoming feature to wait until
first screen is painted to start in order to avoid wasting effort on
jit'ng initialization code. Timed delay in place for the moment.
To change the on/off state, call dvmSuspendAllThreads(), update the
value of gDvmJit.pJitTable and then dvmResumeAllThreads().
Each time a thread goes through the heavyweight check suspend path, returns
from a monitor lock/unlock or returns from a JNI call, it will refresh
its on/off state.
Also:
Recognize and handle failure to increase size of JitTable.
Avoid repeated lock/unlock of JitTable modification mutex during resize
Make all work order enqueue actions non-blocking, which includes adding
a non-blocking mutex lock: dvmTryLockMutex().
Fix bug Jeff noticed where we were using a half-word form of a Thumb2
instruction rather than the byte form.
Minor comment changes.
|
| |
|
|
|
|
| |
Add a new flag in the Thread struct to track the whereabout of the top frame
in each Java thread. It is not safe to blow away the code cache if any thread
is in the JIT'ed land.
|
| |
|
|
|
|
| |
Because the code cache may be wiped out after safe points now the patching of
inline cache for predicted chains is done through the compiler thread's work
queue.
|
| |
|
|
|
| |
Also, move the waitMutex above the values it guards to improve the
readability of the Thread structure.
|
| |
|
|
|
| |
queue to represent the wait set instead of the implicit queue within
the monitor condition variable.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The Dalvik VM includes a helpful check that kicks and screams if a thread
exits without detaching from the VM first. It manages this with a pthread
TLS destructor. This is handy, but it will interfere with anyone who
wants to use a TLS destructor to initiate the thread detach.
With this change, we now iterate a couple of times to allow other
destructors a chance to detach the thread before we get snippy.
For 2319072.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
r12 is a scratch register and apparently gcc 4.4 starts to actively use it in
dvmFindInterfaceMethodInCache, the very function that the original live value
is being protected around. This results in useless values setup in the chaining
cell and increases the chances to patch the cell (thus the suspend-all
requests).
Add verbose names for new JIT-related suspend reasons.
With all these changes, the thread state warning will still occur but much less
frequently.
bug 2194174.
|
| |\
| |
| |
| |
| |
| |
| | |
Merge commit '49f9187825d898e1b696449a0162fa8a616e0ba0'
* commit '49f9187825d898e1b696449a0162fa8a616e0ba0':
dalvik: Switch to common cutils sched_policy api
|
| | |
| |
| |
| | |
Signed-off-by: San Mehat <san@google.com>
|