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/thread.h b/src/thread.h
index 212abdc..e198d9a 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -212,12 +212,12 @@
   void (*pSetObjStatic)(uint32_t, const Method*, Object*);
   void (*pCanPutArrayElementFromCode)(const Object*, const Class*);
   bool (*pInstanceofNonTrivialFromCode) (const Object*, const Class*);
-  void (*pCheckCastFromCode) (const Class*, const Class*);
+  void (*pCheckCastFromCode) (void*, void*);
   Method* (*pFindInterfaceMethodInCache)(Class*, uint32_t, const Method*, struct DvmDex*);
-  void (*pUnlockObjectFromCode)(Thread*, Object*);
+  void (*pUnlockObjectFromCode)(void*, void*);
   void (*pLockObjectFromCode)(Thread*, Object*);
   void (*pDeliverException)(void*);
-  void (*pHandleFillArrayDataFromCode)(Array*, const uint16_t*);
+  void (*pHandleFillArrayDataFromCode)(void*, void*);
   Class* (*pInitializeTypeFromCode)(uint32_t, Method*);
   void (*pResolveMethodFromCode)(Method*, uint32_t);
   void (*pInvokeInterfaceTrampoline)(void*, void*, void*, void*);
@@ -234,7 +234,7 @@
   void (*pThrowRuntimeExceptionFromCode)(int32_t);
   void (*pThrowInternalErrorFromCode)(int32_t);
   void (*pThrowNoSuchMethodFromCode)(int32_t);
-  void (*pThrowAbstractMethodErrorFromCode)(Method* method, Thread* thread);
+  void (*pThrowAbstractMethodErrorFromCode)(Method* method, Thread* thread, Method** sp);
   void* (*pFindNativeMethod)(Thread* thread);
   Object* (*pDecodeJObjectInThread)(Thread* thread, jobject obj);
 
@@ -339,7 +339,7 @@
   }
 
   // Find catch block and perform long jump to appropriate exception handle
-  void DeliverException(Throwable* exception);
+  void DeliverException();
 
   Context* GetLongJumpContext();
 
@@ -358,10 +358,6 @@
     top_of_managed_stack_pc_ = pc;
   }
 
-  // Returns a special method that describes all callee saves being spilt to the
-  // stack.
-  Method* CalleeSaveMethod() const;
-
   void ThrowNewException(const char* exception_class_descriptor, const char* fmt, ...)
       __attribute__ ((format(printf, 3, 4)));