Check-cast, instance-of, misc fixes
Support for check-cast and instanceof (largely untested). Added a bunch of
helper stubs, a debugging option to show the method name if we try to branch
to an uncompiled method, new tests and a missing call to reset the compiler's
arena storage.
Change-Id: I933ad1fbdbca110f92c9201cae2353bf4862a8ac
diff --git a/test/IntMath/IntMath.java b/test/IntMath/IntMath.java
index 14c68d1..758e6df 100644
--- a/test/IntMath/IntMath.java
+++ b/test/IntMath/IntMath.java
@@ -25,6 +25,28 @@
foo_ = 123;
}
+ static int instanceTest(int x) {
+ IntMathBase a = new IntMathBase();
+ IntMath b = new IntMath();
+
+ if (a instanceof IntMathBase) {
+ x = x * 2;
+ }
+
+ if (a instanceof IntMath) {
+ x = x + 13;
+ }
+
+ if (b instanceof IntMathBase) {
+ x = x -1;
+ }
+
+ if (b instanceof IntMath) {
+ x = x + 1333;
+ }
+ return x;
+ }
+
int tryThing() {
int val = super.tryThing();
return val + 10;
@@ -48,9 +70,8 @@
}
static int constStringTest(int x) {
- /* TODO: flesh this test out when we can call string library */
String str = "Hello World!";
- return x * 2;
+ return x + str.length();
}
static void throwNullPointerException() {
@@ -867,6 +888,20 @@
} else {
System.out.println("superTest FAILED: " + res);
}
+
+ res = constStringTest(10);
+ if (res == 22) {
+ System.out.println("stringTest PASSED");
+ } else {
+ System.out.println("stringTest FAILED: " + res);
+ }
+
+ res = instanceTest(10);
+ if (res == 1352) {
+ System.out.println("instanceTest PASSED");
+ } else {
+ System.out.println("instanceTest FAILED: " + res);
+ }
}
}