diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-04-07 13:20:42 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-04-07 15:24:23 +0100 |
commit | f583e5976e1de9aa206fb8de4f91000180685066 (patch) | |
tree | 0e7c2d30af5c713012f0a33e6dd7d8f71e7fc85d /test/401-optimizing-compiler | |
parent | 7ab4e5c5288e04b7beb6d8ddfd5e8bf878002732 (diff) | |
download | art-f583e5976e1de9aa206fb8de4f91000180685066.zip art-f583e5976e1de9aa206fb8de4f91000180685066.tar.gz art-f583e5976e1de9aa206fb8de4f91000180685066.tar.bz2 |
Add support for taking parameters in optimizing compiler.
- Fix stack layout to mimic Quick's.
- Implement some sub operations.
Change-Id: I8cf75a4d29b662381a64f02c0bc61d859482fc4e
Diffstat (limited to 'test/401-optimizing-compiler')
-rw-r--r-- | test/401-optimizing-compiler/expected.txt | 4 | ||||
-rw-r--r-- | test/401-optimizing-compiler/src/Main.java | 78 |
2 files changed, 82 insertions, 0 deletions
diff --git a/test/401-optimizing-compiler/expected.txt b/test/401-optimizing-compiler/expected.txt index a65e544..97492a4 100644 --- a/test/401-optimizing-compiler/expected.txt +++ b/test/401-optimizing-compiler/expected.txt @@ -7,3 +7,7 @@ java.lang.Error: Error Forced GC In static method with object arg class java.lang.Object Forced GC +Forced GC +Forced GC +Forced GC +Forced GC diff --git a/test/401-optimizing-compiler/src/Main.java b/test/401-optimizing-compiler/src/Main.java index aa08137..e5706a5 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() { |