Check-cast, instance-of, misc fixes

Support for check-cast and instanceof (largely untested).  Added a bunch of
helper stubs, a debugging option to show the method name if we try to branch
to an uncompiled method, new tests and a missing call to reset the compiler's
arena storage.

Change-Id: I933ad1fbdbca110f92c9201cae2353bf4862a8ac
diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc
index 9c87659..44cbc0e 100644
--- a/src/compiler/codegen/arm/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc
@@ -15,6 +15,7 @@
  */
 
 #define FORCE_SLOW 0
+#define DISPLAY_MISSING_TARGETS
 
 static const RegLocation badLoc = {kLocDalvikFrame, 0, 0, INVALID_REG,
                                    INVALID_REG, INVALID_SREG, 0,
@@ -863,6 +864,19 @@
     return callState;
 }
 
+#ifdef DISPLAY_MISSING_TARGETS
+// Debugging routine - if null target, branch to DebugMe
+static void genShowTarget(CompilationUnit* cUnit)
+{
+    ArmLIR* branchOver = genCmpImmBranch(cUnit, kArmCondNe, rLR, 0);
+    loadWordDisp(cUnit, rSELF,
+                 OFFSETOF_MEMBER(Thread, pDebugMe), rLR);
+    ArmLIR* target = newLIR0(cUnit, kArmPseudoTargetLabel);
+    target->defMask = -1;
+    branchOver->generic.target = (LIR*)target;
+}
+#endif
+
 static void genInvokeStaticDirect(CompilationUnit* cUnit, MIR* mir,
                                   bool direct, bool range)
 {
@@ -886,6 +900,9 @@
     while (callState >= 0) {
         callState = nextCallInsn(cUnit, mir, dInsn, callState, NULL);
     }
+#ifdef DISPLAY_MISSING_TARGETS
+    genShowTarget(cUnit);
+#endif
     newLIR1(cUnit, kThumbBlxR, rLR);
 }
 
@@ -914,6 +931,9 @@
     while (callState >= 0) {
         callState = nextInterfaceCallInsn(cUnit, mir, dInsn, callState, NULL);
     }
+#ifdef DISPLAY_MISSING_TARGETS
+    genShowTarget(cUnit);
+#endif
     newLIR1(cUnit, kThumbBlxR, rLR);
 }
 
@@ -963,6 +983,9 @@
     while (callState >= 0) {
         callState = nextCallInsn(cUnit, mir, dInsn, callState, rollback);
     }
+#ifdef DISPLAY_MISSING_TARGETS
+    genShowTarget(cUnit);
+#endif
     newLIR1(cUnit, kThumbBlxR, rLR);
 }
 
@@ -999,6 +1022,9 @@
     while (callState >= 0) {
         callState = nextCallInsn(cUnit, mir, dInsn, callState, rollback);
     }
+#ifdef DISPLAY_MISSING_TARGETS
+    genShowTarget(cUnit);
+#endif
     newLIR1(cUnit, kThumbBlxR, rLR);
 }