Fix "all stubs" interpreter
The "all stubs" interpreter is the recommended starting point for
anyone creating a "fast" interpreter on a new CPU. This cleans
up some minor bit rot in the code and documentation.
Bug 3452689
Change-Id: I6bc3b0b5da11955d842d5fc5f16cb1a2209d4a89
diff --git a/docs/porting-guide.html b/docs/porting-guide.html
index 9b02d17..d1a1ea3 100644
--- a/docs/porting-guide.html
+++ b/docs/porting-guide.html
@@ -164,6 +164,9 @@
<li>Make sure <code>dalvik/vm/Android.mk</code> will find the files for
your architecture. If <code>$(TARGET_ARCH)</code> is configured this
will happen automatically.
+<li>Disable the Dalvik JIT. You can do this in the general device
+configuration, or by editing the initialization of WITH_JIT in
+<code>dalvik/vm/Dvm.mk</code> to always be <code>false</code>.
</ol>
</p><p>
You now have the basic framework in place. Whenever you make a change, you
@@ -177,7 +180,7 @@
in assembly.
<li>In the <code>dalvik</code> directory, regenerate the
<code>libdvm.so</code> library with <code>mm</code>. You can also use
-<code>make libdvm</code> from the top of the tree.
+<code>mmm dalvik/vm</code> from the top of the tree.
</ol>
</p><p>
This will leave you with an updated libdvm.so, which can be pushed out to
@@ -241,7 +244,7 @@
<h3>Replacing Stubs</h3>
<p>
-There are roughly 230 Dalvik opcodes, including some that are inserted by
+There are roughly 250 Dalvik opcodes, including some that are inserted by
<a href="dexopt.html">dexopt</a> and aren't described in the
<a href="dalvik-bytecode.html">Dalvik bytecode</a> documentation. Each
one must perform the appropriate actions, fetch the next opcode, and
diff --git a/vm/mterp/cstubs/entry.c b/vm/mterp/cstubs/entry.c
index af31a3d..4fe0d2c 100644
--- a/vm/mterp/cstubs/entry.c
+++ b/vm/mterp/cstubs/entry.c
@@ -30,9 +30,8 @@
*/
changeInterp = setjmp(jmpBuf) -1;
if (changeInterp >= 0) {
- Thread* threadSelf = dvmThreadSelf();
LOGVV("mterp threadid=%d returning %d\n",
- threadSelf->threadId, changeInterp);
+ dvmThreadSelf()->threadId, changeInterp);
return changeInterp;
}
@@ -64,6 +63,7 @@
u2 inst = /*glue->*/pc[0];
Handler handler = (Handler) gDvmMterpHandlers[inst & 0xff];
+ (void) gDvmMterpHandlerNames; /* avoid gcc "defined but not used" */
LOGVV("handler %p %s\n",
handler, (const char*) gDvmMterpHandlerNames[inst & 0xff]);
(*handler)(glue);
diff --git a/vm/mterp/out/InterpAsm-x86-atom.S b/vm/mterp/out/InterpAsm-x86-atom.S
index 136e2f2..d4dd705 100644
--- a/vm/mterp/out/InterpAsm-x86-atom.S
+++ b/vm/mterp/out/InterpAsm-x86-atom.S
@@ -477,6 +477,7 @@
.LintMax:
.long 0x7FFFFFFF
+
.global dvmAsmInstructionStart
.type dvmAsmInstructionStart, %function
dvmAsmInstructionStart = .L_OP_NOP
diff --git a/vm/mterp/out/InterpC-allstubs.c b/vm/mterp/out/InterpC-allstubs.c
index 5d8e3d6..fb72f26 100644
--- a/vm/mterp/out/InterpC-allstubs.c
+++ b/vm/mterp/out/InterpC-allstubs.c
@@ -3079,9 +3079,8 @@
*/
changeInterp = setjmp(jmpBuf) -1;
if (changeInterp >= 0) {
- Thread* threadSelf = dvmThreadSelf();
LOGVV("mterp threadid=%d returning %d\n",
- threadSelf->threadId, changeInterp);
+ dvmThreadSelf()->threadId, changeInterp);
return changeInterp;
}
@@ -3113,12 +3112,14 @@
u2 inst = /*glue->*/pc[0];
Handler handler = (Handler) gDvmMterpHandlers[inst & 0xff];
+ (void) gDvmMterpHandlerNames; /* avoid gcc "defined but not used" */
LOGVV("handler %p %s\n",
handler, (const char*) gDvmMterpHandlerNames[inst & 0xff]);
(*handler)(glue);
}
}
+
/*
* C mterp exit point. Call here to bail out of the interpreter.
*/