Class cast, fill array and interface exception support.

This change uses the deliver exception mechanism to implement support
for a number of runtime exceptions. It also tidies up code in the
compiler and allocates a singular callee save method in the image.

Also adds a fix for JNI internal test where we weren't passing
Thread::Current() and that this value is now being used in generated code.

Change-Id: I57eefd9afe40e92fa3a7e737f1a2ed7e1094b5c1
diff --git a/src/runtime.h b/src/runtime.h
index b3d3ebf..ee5f524 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -12,6 +12,7 @@
 
 #include <jni.h>
 
+#include "constants.h"
 #include "heap.h"
 #include "globals.h"
 #include "macros.h"
@@ -28,6 +29,7 @@
 class Heap;
 class InternTable;
 class JavaVMExt;
+class Method;
 class SignalCatcher;
 class String;
 class ThreadList;
@@ -154,6 +156,21 @@
     jni_stub_array_ = jni_stub_array;
   }
 
+  Method* CreateCalleeSaveMethod(InstructionSet insns);
+
+  bool HasCalleeSaveMethod() const {
+    return callee_save_method_ != NULL;
+  }
+
+  // Returns a special method that describes all callee saves being spilled to the stack.
+  Method* GetCalleeSaveMethod() const {
+    return callee_save_method_;
+  }
+
+  void SetCalleeSaveMethod(Method* method) {
+    callee_save_method_ = method;
+  }
+
   int32_t GetStat(int kind);
 
   RuntimeStats* GetStats();
@@ -198,6 +215,8 @@
 
   ByteArray* jni_stub_array_;
 
+  Method* callee_save_method_;
+
   bool started_;
 
   // Hooks supported by JNI_CreateJavaVM