From 4a3164faefd255b1c1e911e7ad7c3d57749caaf6 Mon Sep 17 00:00:00 2001 From: buzbee Date: Sat, 3 Sep 2011 11:25:10 -0700 Subject: 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 --- test/IntMath/IntMath.java | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'test/IntMath/IntMath.java') 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; } } -- cgit v1.2.3-59-g8ed1b