summaryrefslogtreecommitdiff
path: root/test/IntMath/IntMath.java
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2011-09-03 11:25:10 -0700
committer buzbee <buzbee@google.com> 2011-09-03 20:31:41 -0700
commit4a3164faefd255b1c1e911e7ad7c3d57749caaf6 (patch)
treef9594eb97a19358ba3ba5b050c61c5234214ba3d /test/IntMath/IntMath.java
parent9baa4aefc370f48774b6104680193d9a7e4fb631 (diff)
Codegen for invoke-super, invoke-interface
Completed fast & slow paths for invoke-super and the single path for invoke-interface. Added test for invoke-super, but invoke-interface is untested (needs runtime-support routines to be fleshed out). Some trickiness in the invoke-interface code-generation. Because they are going to be glacially slow anyway, inline code has been minimized and all interesting work pushed off to TODO runtime support routines. However, we can't simultaneously pass the arguments needed by the final destination and the arguments needed by the runtime lookup helpers. So, I've added a trampoline to save the target args, load the args needed by the helpers, call the lookup routines, restore the final target arguments and continue on the journey. More detailed comments in the code. Change-Id: Ice2343798a91a37da982811fd1c6384f584a3c0b
Diffstat (limited to 'test/IntMath/IntMath.java')
-rw-r--r--test/IntMath/IntMath.java33
1 files changed, 32 insertions, 1 deletions
diff --git a/test/IntMath/IntMath.java b/test/IntMath/IntMath.java
index 05cecce0b2..ba7d575927 100644
--- a/test/IntMath/IntMath.java
+++ b/test/IntMath/IntMath.java
@@ -1,6 +1,6 @@
// Copyright 2011 Google Inc. All Rights Reserved.
-class IntMath {
+class IntMath extends IntMathBase {
public static boolean mBoolean1, mBoolean2;
public static byte mByte1, mByte2;
@@ -16,13 +16,28 @@ class IntMath {
private int foo_;
public IntMath(int stuff) {
+ super();
foo_ = stuff;
}
public IntMath() {
+ super();
foo_ = 123;
}
+ int tryThing() {
+ int val = super.tryThing();
+ return val + 10;
+ }
+
+ static int superTest(int x) {
+ IntMath instance = new IntMath();
+ IntMath base = instance;
+ int val1 = instance.tryThing();
+ int val2 = base.tryThing();
+ return val1 + val2 + x;
+ }
+
static int constClassTest(int x) {
Class c = String.class;
if (c != null) {
@@ -837,5 +852,21 @@ class IntMath {
} else {
System.out.printf("catchBlock FAILED: %d\n", res);
}
+
+ res = superTest(4141);
+ if (res == 4175) {
+ System.out.printf("superTest PASSED\n");
+ } else {
+ System.out.printf("superTest FAILED: %d\n", res);
+ }
+ }
+}
+
+class IntMathBase {
+ IntMathBase() {
+ }
+
+ int tryThing() {
+ return 7;
}
}