diff options
Diffstat (limited to 'test/401-optimizing-compiler/src/Main.java')
-rw-r--r-- | test/401-optimizing-compiler/src/Main.java | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/test/401-optimizing-compiler/src/Main.java b/test/401-optimizing-compiler/src/Main.java index aa08137caa..e5706a52fe 100644 --- a/test/401-optimizing-compiler/src/Main.java +++ b/test/401-optimizing-compiler/src/Main.java @@ -28,6 +28,84 @@ public class Main { System.out.println(error); $opt$TestInvokeNew(); + + int result = $opt$TestInvokeIntParameter(42); + if (result != 42) { + throw new Error("Different value returned: " + result); + } + + + $opt$TestInvokeObjectParameter(new Object()); + + Object a = new Object(); + Object b = $opt$TestInvokeObjectParameter(a); + if (a != b) { + throw new Error("Different object returned " + a + " " + b); + } + + result = $opt$TestInvokeWith2Parameters(10, 9); + if (result != 1) { + throw new Error("Unexpected result: " + result); + } + + result = $opt$TestInvokeWith3Parameters(10, 9, 1); + if (result != 0) { + throw new Error("Unexpected result: " + result); + } + + result = $opt$TestInvokeWith5Parameters(10000, 1000, 100, 10, 1); + if (result != 8889) { + throw new Error("Unexpected result: " + result); + } + + result = $opt$TestInvokeWith7Parameters(100, 6, 5, 4, 3, 2, 1); + if (result != 79) { + throw new Error("Unexpected result: " + result); + } + + Main m = new Main(); + if (m.$opt$TestThisParameter(m) != m) { + throw new Error("Unexpected value returned"); + } + + if (m.$opt$TestOtherParameter(new Main()) == m) { + throw new Error("Unexpected value returned"); + } + } + + static int $opt$TestInvokeIntParameter(int param) { + return param; + } + + static Object $opt$TestInvokeObjectParameter(Object a) { + forceGCStaticMethod(); + return a; + } + + static int $opt$TestInvokeWith2Parameters(int a, int b) { + return a - b; + } + + static int $opt$TestInvokeWith3Parameters(int a, int b, int c) { + return a - b - c; + } + + static int $opt$TestInvokeWith5Parameters(int a, int b, int c, int d, int e) { + return a - b - c - d - e; + } + + static int $opt$TestInvokeWith7Parameters(int a, int b, int c, int d, int e, int f, int g) { + return a - b - c - d - e - f - g; + } + + Object $opt$TestThisParameter(Object other) { + forceGCStaticMethod(); + return other; + } + + Object $opt$TestOtherParameter(Object other) { + forceGCStaticMethod(); + return other; } public static void $opt$TestInvokeStatic() { |