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/object.cc b/src/object.cc
index 40bc2e2..e92c8c7 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -62,8 +62,8 @@
   Monitor::MonitorEnter(thread, this);
 }
 
-void Object::MonitorExit(Thread* thread) {
-  Monitor::MonitorExit(thread, this);
+bool Object::MonitorExit(Thread* thread) {
+  return Monitor::MonitorExit(thread, this);
 }
 
 void Object::Notify() {
@@ -604,15 +604,15 @@
     // Set the low-order bit so a BLX will switch to Thumb mode
     address |= 0x1;
   }
-  SetFieldPtr<const void*>(OFFSET_OF_OBJECT_MEMBER(Method, code_), reinterpret_cast<const void*>(address), false);
+  SetFieldPtr<const void*>(OFFSET_OF_OBJECT_MEMBER(Method, code_),
+                           reinterpret_cast<const void*>(address), false);
 }
 
 bool Method::IsWithinCode(uintptr_t pc) const {
-  if (GetCode() == NULL) {
-    return false;
-  }
   if (pc == 0) {
-    // assume that this is some initial value that will always lie in code
+    // PC of 0 represents the beginning of a stack trace either a native or where we have a callee
+    // save method that has no code
+    DCHECK(IsNative() || IsPhony());
     return true;
   } else {
 #if defined(__arm__)