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
diff --git a/vm/compiler/codegen/arm/CodegenDriver.c b/vm/compiler/codegen/arm/CodegenDriver.c
index 2937cf2..1272f9b 100644
--- a/vm/compiler/codegen/arm/CodegenDriver.c
+++ b/vm/compiler/codegen/arm/CodegenDriver.c
@@ -1422,15 +1422,16 @@
 #endif
 
 /*
- * Fetch *self->suspendCount. If the suspend count is non-zero,
+ * Fetch *self->info.breakFlags. If the breakFlags are non-zero,
  * punt to the interpreter.
  */
 static void genSuspendPoll(CompilationUnit *cUnit, MIR *mir)
 {
     int rTemp = dvmCompilerAllocTemp(cUnit);
     ArmLIR *ld;
-    ld = loadWordDisp(cUnit, r6SELF, offsetof(Thread, suspendCount),
-                      rTemp);
+    ld = loadBaseDisp(cUnit, NULL, r6SELF,
+                      offsetof(Thread, interpBreak.ctl.breakFlags),
+                      rTemp, kUnsignedByte, INVALID_SREG);
     setMemRefType(ld, true /* isLoad */, kMustNotAlias);
     genRegImmCheck(cUnit, kArmCondNe, rTemp, 0, mir->offset, NULL);
 }
diff --git a/vm/compiler/codegen/arm/armv5te-vfp/ArchVariant.c b/vm/compiler/codegen/arm/armv5te-vfp/ArchVariant.c
index 076f5f1..c1792ed 100644
--- a/vm/compiler/codegen/arm/armv5te-vfp/ArchVariant.c
+++ b/vm/compiler/codegen/arm/armv5te-vfp/ArchVariant.c
@@ -83,6 +83,9 @@
     /* No method JIT for Thumb backend */
     gDvmJit.disableOpt |= (1 << kMethodJit);
 
+    // Make sure all threads have current values
+    dvmJitUpdateState();
+
     return true;
 }
 
diff --git a/vm/compiler/codegen/arm/armv5te/ArchVariant.c b/vm/compiler/codegen/arm/armv5te/ArchVariant.c
index 73d27f9..817b68a 100644
--- a/vm/compiler/codegen/arm/armv5te/ArchVariant.c
+++ b/vm/compiler/codegen/arm/armv5te/ArchVariant.c
@@ -83,6 +83,9 @@
     /* No method JIT for Thumb backend */
     gDvmJit.disableOpt |= (1 << kMethodJit);
 
+    // Make sure all threads have current values
+    dvmJitUpdateState();
+
     return true;
 }
 
diff --git a/vm/compiler/codegen/arm/armv7-a-neon/ArchVariant.c b/vm/compiler/codegen/arm/armv7-a-neon/ArchVariant.c
index bcd6a46..ff80662 100644
--- a/vm/compiler/codegen/arm/armv7-a-neon/ArchVariant.c
+++ b/vm/compiler/codegen/arm/armv7-a-neon/ArchVariant.c
@@ -78,6 +78,9 @@
     /* FIXME - comment out the following to enable method-based JIT */
     gDvmJit.disableOpt |= (1 << kMethodJit);
 
+    // Make sure all threads have current values
+    dvmJitUpdateState();
+
     return true;
 }
 
diff --git a/vm/compiler/codegen/arm/armv7-a/ArchVariant.c b/vm/compiler/codegen/arm/armv7-a/ArchVariant.c
index bcd6a46..ff80662 100644
--- a/vm/compiler/codegen/arm/armv7-a/ArchVariant.c
+++ b/vm/compiler/codegen/arm/armv7-a/ArchVariant.c
@@ -78,6 +78,9 @@
     /* FIXME - comment out the following to enable method-based JIT */
     gDvmJit.disableOpt |= (1 << kMethodJit);
 
+    // Make sure all threads have current values
+    dvmJitUpdateState();
+
     return true;
 }