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/dex2oat.cc b/src/dex2oat.cc
index 053575a..6c967ed 100644
--- a/src/dex2oat.cc
+++ b/src/dex2oat.cc
@@ -189,7 +189,10 @@
   if (!runtime->HasJniStubArray()) {
     runtime->SetJniStubArray(JniCompiler::CreateJniStub(kThumb2));
   }
-
+  // similarly for the callee save method
+  if (!runtime->HasCalleeSaveMethod()) {
+    runtime->SetCalleeSaveMethod(runtime->CreateCalleeSaveMethod(kThumb2));
+  }
   Compiler compiler(kThumb2);
   if (method_names.empty()) {
     compiler.CompileAll(class_loader);