History log of /dalvik/vm/mterp/out/InterpAsm-x86.S
Revision Date Author Comments
ed2876e520bbdf295f894c5fb7c5a58bf90bf60f 29-Mar-2013 Udayan Banerji <udayan.banerji@intel.com> [x86] Fix errors with WITH_JIT_TUNING defined

This patch makes the necessary changes to pass on correct information to
dvmBumpNoChain, so that WITH_JIT_TUNING flag can be enabled for x86 codegen

Signed-off-by: Udayan Banerji <udayan.banerji@intel.com>

(cherry picked from commit 19eb287ac848f10e03ca2614bf53bd9d1ddd3724)

Change-Id: I6871dd0839b3656beed4633e3a0f3df780af98a0
3599cdd1b4e72f4cb047fc31bf7c579764fa93d2 14-Feb-2013 Elliott Hughes <enh@google.com> Remove stray references to non-existent opcodes.

Change-Id: I83ca6ea12344a8df7ef14d600baf5060b76870f5
22cf4ac092fa952fc2ebf04cb63736fe7b7f744b 02-Feb-2013 Jeff Hao <jeffhao@google.com> Remove dead instruction in common_exceptionThrown.

Addresses bug: https://code.google.com/p/android/issues/detail?id=43920

Change-Id: Ie735222db17b883416543ca5617b4f02fd8a8d76
0c2dc522d0e120f346cf0a40c8cf0c93346131c2 03-Jul-2012 Dong-Yuan Chen <dong-yuan.chen@intel.com> [X86] X86 trace JIT compiler support

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>
3185a41fe8b3223003a07685c1acdf44bfe148d0 30-Jan-2012 buzbee <buzbee@google.com> x86 mterp debug/profile fix (issue 5938080)

When profiling or debugging is active, the Dalvik vm calls out to
a helper function to handle any pending debug/profile activities
before and after native invokes. The assembly code in footer.s
was passing arguments to these routines in the wrong oder.

Issue 5938080

Change-Id: I425eb2bfbee504a70eda8b382f4cf7340e458241
ab35b50311951feea3782151dd5422ee944685c2 05-Jan-2012 Elliott Hughes <enh@google.com> Remove unsupported experimental opcodes.

External developers were starting to try to get themselves into trouble with
this stuff...

Change-Id: I2b03bfeaa8c98b6a994bc7924fc8dcf4e4d4f6cb
97b22b8d41742fa84812f46d1125e9735420782a 23-May-2011 buzbee <buzbee@google.com> Fix alt handling for Jumbo ops

The mterp alt mechanism allows us to break out of the fast
interpreter loop to handle debugging, JIT trace selection and
other non-standard behavior. It does this by replacing the
base pointer to the instruction handlers with an alternate
base that references a set of dummy handlers that first call
out the dvmCheckBefore() to handle special actions before
routing control to the real handlers.

This mechanism was slightly broken for the Jumbo ops - which
have a first opcode byte of 0xFF (Dispatch), followed by the
Jumbo opcode byte. In short, when the altHandlerBase was active
dvmCheckBefore() was getting called for both the dispatch opcode
byte and the Jumbo byte.

This change adds special ALT_OP_DISPATCH_FF handlers which skip
the dvmCheckBefore() call.

Change-Id: If57c298a33404cdaca7456bc8fe1159c70240bea
2ec9f7802034144383261b2fd915bdf1eb396ea4 03-May-2011 buzbee <buzbee@google.com> x86 interpreter fix

Correct the ordering of FP save prior to special subMode handling.
Also added a stress test mode to help catch this sort of problem in
the future.

Change-Id: I5bcd325858fa63023498bfd47e910aaf1530d6bb
389e258a5b9b2afb7bfaee3344c615d3310fae4e 23-Apr-2011 buzbee <buzbee@google.com> InterpBreak cleanup (part 1)

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
30bc0d46ae730d78c42c39cfa56a59ba3025380b 22-Apr-2011 buzbee <buzbee@google.com> Consolidate curFrame fields in thread storage

We ended up with two locations in the Thread structure for saved
Dalvik frame pointer. This change consolidates them.

Change-Id: I78f288e4e57e232f29663be930101e775bfe370f
a4a19037f75e0e3c85fb5f3c7fa31732f8475719 05-Apr-2011 buzbee <buzbee@google.com> Fix x86 fast interpreter

Was passing wrong value to dvmResolveField() in OP_IGET_WIDE_JUMBO

Change-Id: I7773fd0932d7d032fce30dc57b33ef6a8fbc7afb
99e3e6e72e3471eb85fc2e405866392b01c080fe 29-Mar-2011 buzbee <buzbee@google.com> Fix interpreter debug attach

Fix a few miscellaneous bugs from the interpreter restructuring that were
causing a segfault on debugger attach.

Added a sanity checking routine for debugging.

Fixed a problem in which the JIT's threshold and on/off switch
wouldn't get initialized properly on thread creation.

Renamed dvmCompilerStateRefresh() to dvmCompilerUpdateGlobalState() to
better reflect its function.

Change-Id: I5b8af1ce2175e3c6f53cda19dd8e052a5f355587
9a3147c7412f4794434b4c2604aa2ba784867774 03-Mar-2011 buzbee <buzbee@google.com> Interpreter restructuring

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
61f4c7e40b885ccb0a55d9553f07a888469621dc 16-Mar-2011 Dan Bornstein <danfuzz@android.com> Clean up ArrayStoreException some more.

Each of the four variants thrown by the VM now has a
descriptively-named function defined in Exception.c, and the messages
uniformly use human-oriented class names instead of the internal
"[[Lfoo/bar/Baz;" forms.

Bug: 3500987
Change-Id: I747315e36005c6d352116ce6a8af9d49c622f59a
24bd4c50bb3ea13be4f049710967961f0546fb2c 10-Mar-2011 Andy McFadden <fadden@android.com> Add volatile/jumbo opcodes

This adds 12 dexopt-generated "volatile/jumbo" instructions, to
be used for replacing appropriate get/put ops, plus a jumbo
replacement for invoke-object-init/range.

The new instructions are defined but not yet used. For x86 and
x86-atom, C stubs are selected.

Also, guarded macro args used in arithmetic expressions in header.S.

Bug 3403118

Change-Id: I283cea053d1cee1d70c3715df3e71177e8b8d3b2
4570ad0a7706d3338d58bd0204e102719e4d68fb 09-Mar-2011 Eugene Surovegin <surovegin@google.com> x86: restore standard stack frame layout and fix stack alignment.

Native x86 can contain SSE instructions, this requires 16-byte aligned stack
which is what GCC expects these days. Enforce this in dvmPlatformInvoke and
in mterp.

Also fix stack frame layout, so debuggers can produce backtraces across
dvmMterpStdRun invocations.

Change-Id: I43d00a6bf8210b7d3aa9276edabc08978084e4f2
47f58250c5177adba475b0b11a36151ac0ce9ab9 07-Mar-2011 Dan Bornstein <danfuzz@android.com> Consistency in exception throws.

Make the messages that consist of a series of values consistently use
semicolons between the values, and make the call order for exception
throws that take both "info about a thing" as well as "info about a
use of that thing" take the "info about a thing" argument first.

Practical upshot: Adding a second semicolon in the message for
StringIndexOutOfBoundsException being thrown for a region, and
switching the order of arguments of
dvmThrowArrayIndexOutOfBoundsException().

Bug: 3500987
Change-Id: I97eb0046ab8997a68e2d6dfde5dbf3d02290c1f7
6a52d1d4061950c5358b67e180e25e8c55cbdda7 06-Mar-2011 buzbee <buzbee@google.com> Fix JUMBO failures

Fix some failures w/ the new Dalvik JUMBO opcodes on the x86 and portable
interpreters. These showed up on dalvik/test/089-jumbo-opcodes when
running with:

run-test --host 089 # x86 host-mode
run-test --portable --host 089 # portable host-mode
run-test --portable 089 # on device, portable

Change-Id: I520c8d2e001db95aa7525e4ffde7a81e2e786d38
0346e9dcddccd449c731e42ef83708ff6d8f0976 02-Mar-2011 Andy McFadden <fadden@android.com> Change invoke-object-init to /range form

The invoke-object-init instruction pretends to be a regular invoke
that only knows how to call Object.<init>. As such it always takes
one argument, and if we use the /range version we can specify the
"this" register with 16 bits instead of only 4.

Bug 3486699

Change-Id: I9ee4700c6935beee1dcbaa583b57befd33641414
3d054be0780e2bee9553711d409608495cc2c19e 02-Mar-2011 buzbee <buzbee@google.com> mterp generation cleanup

Change I3a22048a introduced a new interpreter breakout mechanism, and
with it a bit of hackish ugliness in the mechanism to automatically
generate interpreter source files.

This CL applies some Lipo and Botox:
o New alt-op-start, alt-op-end commands removed - will just use
existing op-start & op-end.
o New command "handler-style" to explicitly declare interpreter
style (computed-goto, jump-table or all-c). Previous trigger
on "handler-size==0" removed.
o Alternate handler stub no longer using fixed file name, but
intead is named by command asm-alt-stub (which is modelled on
existing alt-stub command).
o Previous CL stated requirement for explicitly called-out handler
for the Dalvik dispatch opcode. Turns out this was not necessary.
Requirement removed.

Change-Id: I20f7411820715476533c2073d28f357e28c1ae52
98f3eb12bf2a33c49712e093d5cc2aa713a93aa5 01-Mar-2011 buzbee <buzbee@google.com> Exception cleanup in the assembly interpreters

Removed the last of the "exception as strings" calls from the
assembly interpreters, replacing them with the helper functions.

Change-Id: I4c44cde348ed7d2ea99f908bc22166afeb5e3d37
a7d59bbafea5430fe81fc21ba94ddf6f6a63b0b3 24-Feb-2011 buzbee <buzbee@google.com> New interpreter breakout mechanism

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
8cb0d098d79af61546e275f633325794f4587602 28-Feb-2011 buzbee <buzbee@google.com> Use new negative array size exception reporting

Follow-up to change 98624 to enhance assembly interpreters to use
the new dvmThrowNegativeArraySizeException.

Change-Id: I9c8b425b3255d42afa1dc466024c03eeeb4eec23
74501e600dcb5634aa26aee0a3f57f2b45b213f2 24-Feb-2011 Dan Bornstein <danfuzz@android.com> Round three of exception cleanup.

I expanded AIOOBE since it was the odd one out, migrated the wrappers
in Exception.h to the end of the file where they're less disruptive,
and tweaked a couple other throws in the main vm code.

Change-Id: Iae11fda2c47989ce7579483df226124ffeb2ac84
9f601a917c8878204482c37aec7005054b6776fa 12-Feb-2011 buzbee <buzbee@google.com> Interpreter restructuring: eliminate InterpState

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
6af2ddd107842c3737c04c37343cac9be17f4209 17-Feb-2011 Andy McFadden <fadden@android.com> Defer marking of objects as finalizable

This shifts responsibility for marking an object as "finalizable" from
object creation to object initialization. We want to make the object
finalizable when Object.<init> completes. For performance reasons we
skip the call to the Object constructor (which doesn't do anything)
and just take the opportunity to check the class flag.

Handling of clone()d object isn't quite right yet.

Also, fixed a minor glitch in stubdefs.

Bug 3342343

Change-Id: I5b7b819079e5862dc9cbd1830bb445a852dc63bf
b387fe1b970a216c09d2abc98c893ff1fff3e512 16-Feb-2011 Andy McFadden <fadden@android.com> Fix some asm .size directives

We were missing a .size directive for dvmPlatformInvoke, and the
directive for the mterp handlers wasn't being handled right. Threw
in a bonus directive for the entry point and the "assist debugger"
stuff that wraps method calls.

Bug 3456786

Change-Id: Ideee64a496e54eb09008410e9e9eba652b59f403
750d110b62cef538e193b6f91f5239b0c4b63ef1 12-Feb-2011 Andy McFadden <fadden@android.com> Rename invoke-direct-empty to invoke-object-init

The invoke-direct-empty instruction was introduced to remove the
overhead of calling the empty Object constructor. We now need it
to do some extra work on behalf of object construction, so it's
appropriate to change the instruction name to match the role it
fills rather than the more general role it was hoped to fill.

No functional changes.

Bug 3342343

Change-Id: I65dd6a2c00c99581c9a19b16fe193b70642c8fbb
01605d2b668e8e1701cfdfa302dde847b9171fc9 01-Feb-2011 Carl Shapiro <cshapiro@google.com> Remove the unused monitor tracking and deadlock prediction code.

This feature has been in the code base for several releases but has never
been enabled.

Change-Id: Ia770b03ebc90a3dc7851c0cd8ef301f9762f50db
cfdeca37fcaa27c37bad5077223e4d1e87f1182e 14-Jan-2011 Ben Cheng <bccheng@android.com> Add runtime support for method based compilation.

Enhanced code cache management to accommodate both trace and method
compilations. Also implemented a hacky dispatch routine for virtual
leaf methods.

Microbenchmark showed 3x speedup in leaf method invocation.

Change-Id: I79d95b7300ba993667b3aa221c1df9c7b0583521
cb3081f675109049e63380170b60871e8275f9a8 14-Jan-2011 buzbee <buzbee@google.com> Consolidate mterp's debug/profile/suspend control

This is a step towards full debug & profiling support in JIT'd code.
Previously, the interpreter made multiple distinct checks for pending
suspend requests, debugger and profiler checks at each safe point.
This CL moves the individual controls into a single control word,
significantly speeding up the safe-point check code path in the common
fast case.

In short, any time some VM component wants control to break at a safe
point it will set a bit in gDvm.interpBreak, which will be examined
at the safe point check in footer.S. In the old code, the safe point
check consisted of 11 instructions (including 6 loads). The new sequence
is 6 instructions (4 loads - two of which are needed and two are
speculative to fill otherwise stalling slots).

This code path is hot enough in the interpreter that we actually see
some measureable speedups in benchmarks. The old sieve benchmark
improves from 252 to 256 (~1.5%).

As part of the change, global debuggerActive and activeProfilers variables
have been eliminated as redundant. Note also that there is a subtle
change in thread suspension. Thread suspend request counts are kept on
a per-thread basis, and previously each thread would only examine its own
suspend count. With this change, a bit has been allocated in interpBreak
to signify that at least one suspend request is active across all
threads. This bit is treated as "some thread is supposed to
suspend, check to see if it's me".

Change-Id: I527dc918f58d1486ef3324136080ef541a775ba8
71eee1f0c2eb514585fdbee16730c9c2209e8f68 04-Jan-2011 jeffhao <jeffhao@google.com> Added vm support for new jumbo opcodes.

This enables jumbo opcodes by default, and they will get used by the
current build without modification. Support has been added for arm, x86,
and the portable interpreter. x86-atom support is on the TODO list. This
commit also includes a test for the new jumbo opcodes.

Change-Id: Ic3f1b41b51645861c5196f76aaf0e96e727ea537
dfd1bbf07d98c82a6072182f705f64a30ebf480b 23-Sep-2010 buzbee <buzbee@google.com> Experimental x86 Jit trace selection

Experimental support for trace selection for x86 host mode operation.
Not enabled by default. Turned on by setting WITH_HOST_DALVIK true
and WITH_JIT true. When enabled, profiles during x86 fast interpreter
operation, selects hot traces and "compiles" traces consisting of jumps
back to the interpreter.

First in a series of experimental x86 support checkins.

Change-Id: I0e423ec58a7bf01f226cb486f55de2841fab1002
90f15431b24a4004fab2db70f273155fcd1c42a4 03-Dec-2010 Dan Bornstein <danfuzz@android.com> Make opcode 00ff be called "dispatch-ff".

With this change, it's still implemented as an unused opcode, but
it's now ready for its new life!

Change-Id: Ic70d311704925067e47d87b657d133a792144e65
7dc44a1c9a37d528f080eb51739da80696bb1f05 02-Dec-2010 buzbee <buzbee@google.com> x86-mterp bug fix; support host mode in tests

A recent x86 housecleaning change introduced a bug in OP_FILLED_ARRAY.
Fixed that, plus hacked up dalvik test scripts to support host
mode operation (with --host)

Change-Id: Iaf8b1ab753f93fa344e64f984a3c4696433ec9aa
63644657f74e0a5d05f2c5fb56a18872e7ac7427 20-Nov-2010 Elliott Hughes <enh@google.com> Better ArrayStoreException detail messages.

This fixes the portable interpreter, ARM, and x86. System.arraycopy was already
doing the right thing.

Bug: 3216051
Change-Id: I8a675eb62d6e7fd53a009f53ce8e34f93799b18c
bb08b668b174d6babcc3866201aaf1d3b7293ada 19-Nov-2010 Elliott Hughes <enh@google.com> Better ClassCastException detail messages for x86.

Bug: 3210374
Change-Id: I5b6ff68b611f56276ef6e519511ed4dee22b0136
3e1bbffab14075a340ad0165c6ada6a43875a01f 27-Oct-2010 buzbee <buzbee@google.com> x86: Improve ArrayIndexOutOfBoundsException detail messages

issue 3122084

Changes the x86 interpreter to use the new dvmThrowAIOOBE call
for out of bounds exception w/ more useful info.

Change-Id: Ic196cc99c561bf31953993a6928f574e5c5bf831
ef1ed3c5cbde4de64e1991de2dbea57efd964841 14-Oct-2010 buzbee <buzbee@google.com> x86 mterp: fix cherry-pick/merge, issue 3095771

Bug http://b/issue?id=3095771

Change
https://android-git.corp.google.com/g/#change,70700
was a cherry-pick/merge of
https://android-git.corp.google.com/g/#change,70388

It was not properly merged, and resulting in the register holding
the object head to be trashed (and subsequently broke GC).

Change-Id: Ic480104e3a643a5b744d36eb0aefaedd3e4f925c
e09a766f3a964fb98296939ce1f92b8c95bf8c25 14-Oct-2010 buzbee <buzbee@google.com> x86 mterp: fix cherry-pick/merge, issue 3095771

Bug http://b/issue?id=3095771

Change
https://android-git.corp.google.com/g/#change,70700
was a cherry-pick/merge of
https://android-git.corp.google.com/g/#change,70388

It was not properly merged, and resulting in the register holding
the object head to be trashed (and subsequently broke GC).

Change-Id: Ic480104e3a643a5b744d36eb0aefaedd3e4f925c
b78c76f88ea42e7a3b295c210ca9ee86e7290043 01-Oct-2010 buzbee <buzbee@google.com> GC Card marking fix for SPUT_OBJECT - use correct object head

Change-Id: I8b84a4f1e1690f5b62de7404ea6ede00317848bb
d82097f6b409c5cd48568e54eb701604c3cceb18 27-Sep-2010 buzbee <buzbee@google.com> Change GC card making to use object head, bug fix for volatile sput obj

This CL changes the way we mark GC card to consistently use the object
head (previously, we marked somewhere in the object - often the head, but
not always). Also, previously a coding error caused us to skip the card
mark for OP_APUT_OBJECT_VOLATILES. Fixed here.

Change-Id: I133ef6395c51a0466c9708209b08e79c3083aff2
d3b0a4bf6b2e38e6e9e80e203ca753e941084103 27-Sep-2010 buzbee <buzbee@google.com> Change GC card making to use object head, bug fix for volatile sput obj

This CL changes the way we mark GC card to consistently use the object
head (previously, we marked somewhere in the object - often the head, but
not always). Also, previously a coding error caused us to skip the card
mark for OP_APUT_OBJECT_VOLATILES. Fixed here.

Change-Id: I53eb333b9bd0b770201af0dc617d9a8f38afa699
b703ba2fbbf626a087903b5ee890989d18fd0c2b 26-Sep-2010 buzbee <buzbee@google.com> Fix OP_USHR_LONG in x86 mterp (Issue 3038137)

Change https://android-git.corp.google.com/g/#change,67744 introduced
bad hand-scheduling in 64-bit unsigned 3-operand right shifts which
clobbered the result before storing it.

Change-Id: Ic862fa683092d09476510d78e5edd1735f09f8c2
c11e0e14df2c0c4264e5cc6c3e96d14832cbecad 22-Sep-2010 buzbee <buzbee@google.com> Fix x86 mterp "longjmp"

The recent x86 mterp update failed to properly restore callee save
registers when returning from the call to dvmMterpStdRun.

Change-Id: Ied73cc5fb380a6375d1f71ce679003fbc293d08d
3b8a9072510222067b7c48fe2d59d1e58436be24 21-Sep-2010 buzbee <buzbee@google.com> Fix 64-bit 3-operand multiplication in x86 mterp.

rPC was being unspilled a bit late.

Change-Id: Idf73b9eeeb972f3fb1861224397d0592c6d3bb2f
f3e177289ac078f18401cfd8eebafe584dd0d01f 12-Sep-2010 buzbee <buzbee@google.com> x86 mterp: reduce x86/x86-atom differences

To ease future x86 development, elminate unnecessary differences
between x86 and x86-atom targets.

1. Macros instead of defines (cosmetic change)
2. Register naming convention (cosmetic change)
3. Register usage convention
- Drop rIBASE, freeing %edx for general usage
- use %edi for rPC (callee-save) & eliminate spills
4. Spill & temp frame layout
5. rGLUE usage 0(%ebp) instead of -24(%ebp)
6. Jump table transition between instruction interpretations
instead of computed goto.
7. Change entry convention for instruction handlers:
Previously:
%bl contains 8-bit Dalvik opcode
%bh contains 2nd half of 16-bit Dalvik insn (usually AA or BA)
upper 16 bits of %ebx are zero
Now:
%bl contains 2nd half of 16-bit Dalvik insn (usually AA or BA)
upper 24 bits of %ebx are zero
8. Include copies of x86-atom macros and defines into x86 build. This
allows the x86 build to mix-and-match x86 and x86-atom handlers
via the normal config mechanism. [Note - only for non-control-flow
instructions. There are still some conflicts in the footer.S
main loop re-entry points].

Change-Id: Ib9d549b56f7ffd7420f9dbf97b2169f65603ee83
7520ee7ff226e12e06818561b15741d2575072e3 18-Sep-2010 buzbee <buzbee@google.com> Add source code skeletons for x86 work. No actual JIT'ng yet.

Change-Id: Ic94a916e777e9bc5163cf205899daf9c18dcafe1
291758c5c4902900c6f86794ba8ab9cad9b26197 10-Sep-2010 Andy McFadden <fadden@android.com> Add return-void-barrier instruction.

This introduces the return-void-barrier instruction, which is identical
to return-void on UP systems, but provides an additional store/store
barrier on SMP. This is intended for use in constructors of objects
with final fields.

The assembler doesn't like "dmb st", and we don't have an
ANDROID_MEMBAR_STORE barrier defined, so this currently uses full
fences.

This just defines the new instruction. It's not actually used yet.

Also, removed some stale "unused" files from the x86 and x86-atom
directories.

Bug 2965743.

Change-Id: I072e372fd2d57f2617a8d4fff5fd4b38bdda75d1
0d615c3ce5bf97ae65b9347ee77968f38620d5e8 18-Aug-2010 Andy McFadden <fadden@android.com> Always support debugging and profiling.

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
f079e1d5c51fc33ab537bbdfc79cbac8e771d7e9 05-Aug-2010 buzbee <buzbee@google.com> Tweaks to x86 mterp periodic checks [issue 2634642]

Update the x86 mterp main interpetation loop to match Arm and the portable
interpreter by checking for debugger/profiler after suspends. Also,
enable ability to skip a load when checking for active debugger (both
Arm and x86).

Related cl: https://android-git.corp.google.com/g/#change,50229

Change-Id: Ic5d0f102b2250393eaf4405e4cafb7678b1a563e
3d95064ad1d8e6da4f9a523b2c2f11cf1f1ea952 16-Jul-2010 buzbee <buzbee@google.com> x86 interpreter write barrier support

Fix for 2837703. Also added support for new Dalvik volatile ops.

Change-Id: Ic2b8d31afc8806077c5bf27ec90c643f7e47591e
c35a2ef53d0cccd6f924eeba36633220ec67c32e 17-Jun-2010 Andy McFadden <fadden@android.com> Add opcodes for volatile field accesses

This adds instructions for {i,s}{get,put}{,-object}-volatile, for a
total of eight new instructions.

On SMP systems, these instructions will be substituted in for existing
field access instructions, either by dexopt or during just-in-time
verification. Unlike the wide-volatile instructions, these will not be
used at all when the VM is not built for SMP.

(Ideally we'd omit the volatile instruction implementations entirely on
non-SMP builds, but that requires a little work in gen-mterp.py.)

The change defines and implements the opcodes and support methods, but
does not cause them to be used.

Also, changed dvmQuasiAtomicRead64's argument to be const.

Change-Id: I9e44fe881e87f27aa41f6c6e898ec4402cb5493e
7365493ad8d360c1dcf9cd8b6eee62747af01cae 09-Jun-2010 Carl Shapiro <cshapiro@google.com> Remove repeated newlines at the end of files.

Change-Id: I1e3d103a7b932ef21acedb6438c0f26b315df28f
de75089fb7216d19e9c22cce4dc62a49513477d3 09-Jun-2010 Carl Shapiro <cshapiro@google.com> Remove trailing whitespace.

Change-Id: I95534bb2b88eaf48f2329282041118cd034c812b
8ba2708ea118381f2df5ca55b9bad2ae4c050504 21-May-2010 Andy McFadden <fadden@android.com> Added EXPORT_PC to "throw" instruction.

For bug 2700761.

Change-Id: I889e59ea35d9cadd99fc884e5b1301a4cf103f93
fbdcfb9ea9e2a78f295834424c3f24986ea45dac 29-May-2010 Brian Carlstrom <bdc@google.com> Merge remote branch 'goog/dalvik-dev' into dalvik-dev-to-master

Change-Id: I0c0edb3ebf0d5e040d6bbbf60269fab0deb70ef9
c95e0fbce4f77b2b08eb48205e405793de0d4248 29-Apr-2010 Andy McFadden <fadden@android.com> Rework common_periodicChecks.

The function was rewritten to optimize the common path. The control flow
now matches the C version, which tests for debugger/profiler even if the
previous test for suspension came up true.

This also adds a minor optimization on the test for debugger attachment,
allowing us to skip a load from memory if the process is simply not
debuggable. (The optimization isn't yet enabled because a similar change
must be made to the x86 asm code.)

The VM apparently hadn't been built without debugging/profiling support
for a while, so this fixes those places (necessary to be able to test
all forms of the new code).

Bug 2634642.

Change-Id: I096b58c961bb73ee0d128ba776d68dbf29bba924
5387824f19033ed51a945fbc8c2b574998404b3d 05-Mar-2010 Andy McFadden <fadden@android.com> Add instructions for volatile wide fields.

This adds four new instructions for accessing volatile wide fields (long
and double). The JLS requires that such accesses are atomic, but the
VM doesn't otherwise make guarantees about the atomicity of reads and
writes on 64-bit fields.

There are no behavioral changes. This just adds definitions for the new
instructions and a couple of tests. The current implementation is just
the non-volatile form of the instructions or a C stub, but since we're
not generating them it doesn't really matter yet.

Also:
- bumped Dalvik version to 1.3.0
- added a note to the x86-atom TODO list

For bug 1633591.
668628abe05cb30f86bd02c824f7219a7e20b82c 16-Feb-2010 Bill Buzbee <buzbee@google.com> Jit: Monitor exit, possible fix for Issue 2396073

Two problems with monitor-exit:
1. The Jit code wasn't checking for exception thrown following
unlocks of fat locks using dvmUnlockObject().
2. The mterp interpreter unlock code branched to handle exceptions
thrown during dvmUnlockObject() with the wrong dalvik PC (the
dPC of the unlock, rather than the instruction following the unlock).

Similar issue with the x86 interpreter fixed. Also, deleted armv7-a
MONITOR_ENTER template, which turned out to be identical to the armv5te
one.
6bbdd6b005ec5cb567ec9576190a7cd784248c5c 16-Feb-2010 Bill Buzbee <buzbee@google.com> Jit: Monitor exit, possible fix for Issue 2396073

Two problems with monitor-exit:
1. The Jit code wasn't checking for exception thrown following
unlocks of fat locks using dvmUnlockObject().
2. The mterp interpreter unlock code branched to handle exceptions
thrown during dvmUnlockObject() with the wrong dalvik PC (the
dPC of the unlock, rather than the instruction following the unlock).

Similar issue with the x86 interpreter fixed. Also, deleted armv7-a
MONITOR_ENTER template, which turned out to be identical to the armv5te
one.
b0a0541b59d1126ff77c88de742b4a74579fe296 19-Nov-2009 Andy McFadden <fadden@android.com> Add execute-inline/range instruction.

Like "execute-inline", this is an instruction generated by dexopt that
replaces a method invoke instruction. It's useful for small, frequently
called methods in the core libs.

As with execute-inline, we allow at most 4 arguments, but with /range
we're no longer limited to the low 16 registers.

Also: marked execute-inline as being able to throw an exception.

Needed: native x86 implementation; support in JIT.

For bug 2268232.
96516932f1557d8f48a8b2dbbb885af01a11ef6e 29-Oct-2009 Andy McFadden <fadden@android.com> Change the way breakpoints work.

This replaces the breakpoint mechanism with a more efficient approach.
We now insert breakpoint instructions into the bytecode stream instead of
maintaining a table. This requires mapping DEX files as private instead
of shared, which allows copy-on-write to work. mprotect() is used to
guard the pages against inadvertent writes.

Unused opcode EC is now OP_BREAKPOINT. It's not recognized by dexdump or
any interpreter except portdbg, but it can be encountered by the bytecode
verifier (the debugger can request breakpoints in unverified code).
Breakpoint changes are blocked while the verifier runs to avoid races.

This eliminates method->debugBreakpointCount, which is no longer needed.
(Also, it clashed with LinearAlloc's read-only mode.)

The deferred verification error mechanism was using a code-copying
approach to modify the bytecode stream. That has been changed to use
the same copy-on-write modification mechanism.

Also, normalized all PAGE_SIZE/PAGESIZE references to a single
SYSTEM_PAGE_SIZE define.

Simple Fibonacci computation test times (opal-eng):
JIT, no debugger: 10.6ms
Fast interp, no debugger: 36ms
Portable interp, no debugger: 43.8ms

ORIG debug interp, no breakpoints set: 458ms
ORIG debug interp, breakpoint set nearby: 697ms

NEW debug interp, no breakpoints set: 341ms
NEW debug interp, breakpoints set nearby: 341ms

Where "nearby" means there's a breakpoint in the method doing the
computation that isn't actually hit -- the VM had an optimization where
it flagged methods with breakpoints and skipped some of the processing
when possible.

The bottom line is that code should run noticeably faster while a
debugger is attached.
72e93344b4d1ffc71e9c832ec23de0657e5b04a5 13-Nov-2009 Jean-Baptiste Queru <jbq@google.com> eclair snapshot
6ed1a0f396a1857c31b486d3e93ee2dbeb49a6cd 11-Sep-2009 Andy McFadden <fadden@android.com> Display additional information on stack overflow.

This required passing an additional argument into dvmHandleStackOverflow,
which is called directly from mterp. Fortunately the method being
called is sitting in a register for both ARM and x86, so this is a
fairly simple change.

For internal bug 2110533.
d5ab726b65d7271be261864c7e224fb90bfe06e0 25-Aug-2009 Andy McFadden <fadden@android.com> Another round of scary indirect ref changes.

This change adds a not-really-working implementation to Jni.c, with
various changes #ifdefed throughout the code. The ifdef is currently
disabled, so the old behavior should continue. Eventually the old
version will be stripped out and the ifdefs removed.

This renames the stack's "localRefTop" field, which nudged a bunch of
code. The name wasn't really right before (it's the *bottom* of the
local references), and it's even less right now. This and one other
mterp-visible constant were changed, which caused some ripples through
mterp and the JIT, but the ifdeffing was limited to one in
asm-constants.h (and the constant is the same both ways, so toggling the
ifdef won't require rebuilding asm sources).

Some comments and arg names in ReferenceTable were updated for the
correct orientation of bottom vs. top.

Some adjustments were made to the JNI code, e.g. dvmCallMethod now needs
to understand if it needs to convert reference arguments from
local/global refs to pointers (it's called from various places
throughout the VM).
be74aeb457df67355ce7c16721ecc436c8fd770a 29-Jul-2009 Bill Buzbee <buzbee@google.com> Fix for 1857865: Need x86 implementation for OP_THROW_VERIFICATION_ERROR
b51ea11c70602918c42764bfafe92a997d3b1803 09-May-2009 Andy McFadden <fadden@android.com> Defer reporting of certain verifier failures.

The verifier currently reports all failures immediately. Certain failures,
such as the failure to resolve a method, or the determination that access
to a field is not allowed, are supposed to deferred until the first time
that executing code does something that could cause the resolution.

With this change, several kinds of verification failures are deferred.
This is done by making a writable copy of the bytecode and replacing the
failing instruction with an "always throw" opcode.

Gory details:
- Added throw-verification-error instruction. Implemented in "portable"
and ARM interpreters. x86 uses portable form through stub.
- Added a function that creates a copy of a DexCode area and makes the
bytecodes writable.
- Added code that replaces a single instruction with an "always throw".
- Replaced runtime check for abstract/interface in new-instance with a
check at verification time.
- Added a test to exercise the deferred error mechanism.
- Minor cleanups (replaced tab, bad valgrind command, ...).
3a1aedbc9777eab6275a360b93b81b079464238e 07-May-2009 Andy McFadden <fadden@android.com> Added throw-verification-error instruction.

This is for the deferred verifier error reporting. It replaces OP_UNUSED_ED.
The instructions aren't actually used yet, which is good since the x86
version hasn't been written yet.

The mterp regen also pushed out some recent-ish changes that hadn't
propagated to the armv4t sources.
99409883d9c4c0ffb49b070ce307bb33a9dfe9f1 19-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import //branches/master/...@140412
f6c387128427e121477c1b32ad35cdcaa5101ba3 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
f72d5de56a522ac3be03873bdde26f23a5eeeb3c 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
31e30105703263782efd450d356cd67ea01af3b7 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@132589
6dcac3deb3c19dc634470eb30b2daedf2b201bd4 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@137055
5d709784bbf5001012d7f25172927d46f6c1abe1 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
c4080f6bdeda19901a508cc75f96ac7e07903918 11-Feb-2009 Johnnie Birch <johnnie.l.birch.jr@intel.com> This patch rewrites common_invokeOld for the x86 fast interpreter. The implementation is similar to what is done for the armv5 code.
Testing shows the patch provides a performance boost to benchmarks such as Caffeine Mark. When testing the simulator build on an Intel(R) Core(TM)2 Quad CPU Q9550 @ 2.83GHz, the string score for Caffeine Mark improved by 6%, the Method score improved by 12% and the overall score improved by 3%.

This patch is one of our incremental efforts to merge some Intel's x86 fast interpreter features in http://review.source.android.com/Gerrit#change,6041 to the mterp/x86 directory.
4c1a2915e40eceeb68dbc323d28b8bf8763af83b 20-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@127101
cc05ad238516f1303687aba4a978e24e57c0c07a 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
89c1feb0a69a7707b271086e749975b3f7acacf7 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589