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/test/IntMath/IntMath.java b/test/IntMath/IntMath.java
index a38525e..c43d09e 100644
--- a/test/IntMath/IntMath.java
+++ b/test/IntMath/IntMath.java
@@ -767,6 +767,25 @@
         return foo.getFoo();
     }
 
+    static int throwClassCast(Object o) {
+      return ((Integer)o).intValue();
+    }
+
+    static int testClassCast() {
+      int res = 0;
+      try {
+        res += throwClassCast(Integer.valueOf(123));
+      } catch(ClassCastException e) {
+        res += 456;
+      }
+      try {
+        res += throwClassCast(new Short((short)321));
+      } catch(ClassCastException e) {
+        res += 765;
+      }
+      return res;
+    }
+
     public static void main(String[] args) {
         boolean failure = false;
         int res;
@@ -920,6 +939,14 @@
             failure = true;
         }
 
+        res = testClassCast();
+        if (res == 888) {
+            System.out.println("testClassCast PASSED");
+        } else {
+            System.out.println("testClassCast FAILED: " + res);
+            failure = true;
+        }
+
         res = manyArgs(0, 1L, 2, 3L, 4, 5L, 6, 7, 8.0, 9.0f, 10.0,
                        (short)11, 12, (char)13, 14, 15, (byte)-16, true, 18,
                        19, 20L, 21L, 22, 23, 24, 25, 26);