summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/478-checker-clinit-check-pruning/src/Main.java53
-rw-r--r--test/548-checker-inlining-and-dce/src/Main.java10
-rw-r--r--test/609-checker-inline-interface/expected.txt0
-rw-r--r--test/609-checker-inline-interface/info.txt2
-rw-r--r--test/609-checker-inline-interface/src/Main.java70
5 files changed, 31 insertions, 104 deletions
diff --git a/test/478-checker-clinit-check-pruning/src/Main.java b/test/478-checker-clinit-check-pruning/src/Main.java
index 95ac1ee7ed..6fc12f138c 100644
--- a/test/478-checker-clinit-check-pruning/src/Main.java
+++ b/test/478-checker-clinit-check-pruning/src/Main.java
@@ -103,8 +103,10 @@ public class Main {
static boolean doThrow = false;
static void $noinline$staticMethod() {
- // Try defeating inlining.
- if (doThrow) { throw new Error(); }
+ if (doThrow) {
+ // Try defeating inlining.
+ throw new Error();
+ }
}
}
@@ -179,8 +181,10 @@ public class Main {
static boolean doThrow = false;
static void $noinline$staticMethod() {
+ if (doThrow) {
// Try defeating inlining.
- if (doThrow) { throw new Error(); }
+ throw new Error();
+ }
}
}
@@ -241,8 +245,10 @@ public class Main {
static boolean doThrow = false;
static void $noinline$staticMethod() {
+ if (doThrow) {
// Try defeating inlining.
- if (doThrow) { throw new Error(); }
+ throw new Error();
+ }
}
static {
@@ -308,7 +314,7 @@ public class Main {
static void constClassAndInvokeStatic(Iterable<?> it) {
$opt$inline$ignoreClass(ClassWithClinit7.class);
- ClassWithClinit7.$noinline$someStaticMethod(it);
+ ClassWithClinit7.someStaticMethod(it);
}
static void $opt$inline$ignoreClass(Class<?> c) {
@@ -319,10 +325,10 @@ public class Main {
System.out.println("Main$ClassWithClinit7's static initializer");
}
- static void $noinline$someStaticMethod(Iterable<?> it) {
+ // Note: not inlined from constClassAndInvokeStatic() but fully inlined from main().
+ static void someStaticMethod(Iterable<?> it) {
+ // We're not inlining invoke-interface at the moment.
it.iterator();
- // We're not inlining throw at the moment.
- if (doThrow) { throw new Error(""); }
}
}
@@ -339,7 +345,7 @@ public class Main {
static void sgetAndInvokeStatic(Iterable<?> it) {
$opt$inline$ignoreInt(ClassWithClinit8.value);
- ClassWithClinit8.$noinline$someStaticMethod(it);
+ ClassWithClinit8.someStaticMethod(it);
}
static void $opt$inline$ignoreInt(int i) {
@@ -351,10 +357,10 @@ public class Main {
System.out.println("Main$ClassWithClinit8's static initializer");
}
- static void $noinline$someStaticMethod(Iterable<?> it) {
+ // Note: not inlined from sgetAndInvokeStatic() but fully inlined from main().
+ static void someStaticMethod(Iterable<?> it) {
+ // We're not inlining invoke-interface at the moment.
it.iterator();
- // We're not inlining throw at the moment.
- if (doThrow) { throw new Error(""); }
}
}
@@ -371,7 +377,7 @@ public class Main {
static void constClassSgetAndInvokeStatic(Iterable<?> it) {
$opt$inline$ignoreClass(ClassWithClinit9.class);
$opt$inline$ignoreInt(ClassWithClinit9.value);
- ClassWithClinit9.$noinline$someStaticMethod(it);
+ ClassWithClinit9.someStaticMethod(it);
}
static class ClassWithClinit9 {
@@ -380,10 +386,10 @@ public class Main {
System.out.println("Main$ClassWithClinit9's static initializer");
}
- static void $noinline$someStaticMethod(Iterable<?> it) {
+ // Note: not inlined from constClassSgetAndInvokeStatic() but fully inlined from main().
+ static void someStaticMethod(Iterable<?> it) {
+ // We're not inlining invoke-interface at the moment.
it.iterator();
- // We're not inlining throw at the moment.
- if (doThrow) { throw new Error(""); }
}
}
@@ -416,9 +422,8 @@ public class Main {
static void inlinedForNull(Iterable<?> it) {
if (it != null) {
+ // We're not inlining invoke-interface at the moment.
it.iterator();
- // We're not inlining throw at the moment.
- if (doThrow) { throw new Error(""); }
}
}
}
@@ -455,11 +460,8 @@ public class Main {
}
static void inlinedForNull(Iterable<?> it) {
+ // We're not inlining invoke-interface at the moment.
it.iterator();
- if (it != null) {
- // We're not inlining throw at the moment.
- if (doThrow) { throw new Error(""); }
- }
}
}
@@ -492,8 +494,8 @@ public class Main {
static void inlinedForNull(Iterable<?> it) {
if (it != null) {
- // We're not inlining throw at the moment.
- if (doThrow) { throw new Error(""); }
+ // We're not inlining invoke-interface at the moment.
+ it.iterator();
}
}
}
@@ -508,9 +510,8 @@ public class Main {
}
public static void $noinline$getIterator(Iterable<?> it) {
+ // We're not inlining invoke-interface at the moment.
it.iterator();
- // We're not inlining throws at the moment.
- if (doThrow) { throw new Error(""); }
}
}
diff --git a/test/548-checker-inlining-and-dce/src/Main.java b/test/548-checker-inlining-and-dce/src/Main.java
index bf64c3bb36..38fdcc0b94 100644
--- a/test/548-checker-inlining-and-dce/src/Main.java
+++ b/test/548-checker-inlining-and-dce/src/Main.java
@@ -16,19 +16,17 @@
public class Main {
- static boolean doThrow = false;
-
private void inlinedForNull(Iterable it) {
if (it != null) {
- // We're not inlining throw at the moment.
- if (doThrow) { throw new Error(""); }
+ // We're not inlining invoke-interface at the moment.
+ it.iterator();
}
}
private void inlinedForFalse(boolean value, Iterable it) {
if (value) {
- // We're not inlining throw at the moment.
- if (doThrow) { throw new Error(""); }
+ // We're not inlining invoke-interface at the moment.
+ it.iterator();
}
}
diff --git a/test/609-checker-inline-interface/expected.txt b/test/609-checker-inline-interface/expected.txt
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/609-checker-inline-interface/expected.txt
+++ /dev/null
diff --git a/test/609-checker-inline-interface/info.txt b/test/609-checker-inline-interface/info.txt
deleted file mode 100644
index 35eee08985..0000000000
--- a/test/609-checker-inline-interface/info.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Checker test that we inline interface calls and if we can't inline
-them, we can turn them into a virtual invoke.
diff --git a/test/609-checker-inline-interface/src/Main.java b/test/609-checker-inline-interface/src/Main.java
deleted file mode 100644
index e9b3e87881..0000000000
--- a/test/609-checker-inline-interface/src/Main.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public final class Main implements Interface {
-
- static void methodWithInvokeInterface(Interface interf) {
- interf.$noinline$doCall();
- }
-
- public void $noinline$doCall() {
- if (doThrow) throw new Error("");
- }
-
- public static void main(String[] args) {
- testInlineInterfaceCall();
- testInterfaceToVirtualCall();
- }
-
- /// CHECK-START: void Main.testInlineInterfaceCall() inliner (before)
- /// CHECK: InvokeStaticOrDirect method_name:Main.methodWithInvokeInterface
-
- /// CHECK-START: void Main.testInlineInterfaceCall() inliner (before)
- /// CHECK-NOT: InvokeInterface
-
- /// CHECK-START: void Main.testInlineInterfaceCall() inliner (after)
- /// CHECK: InvokeInterface method_name:Interface.$noinline$doCall
-
- /// CHECK-START: void Main.testInlineInterfaceCall() inliner (after)
- /// CHECK-NOT: InvokeStaticOrDirect
- public static void testInlineInterfaceCall() {
- methodWithInvokeInterface(itf);
- }
-
- /// CHECK-START: void Main.testInterfaceToVirtualCall() inliner (before)
- /// CHECK: InvokeStaticOrDirect method_name:Main.methodWithInvokeInterface
-
- /// CHECK-START: void Main.testInterfaceToVirtualCall() inliner (before)
- /// CHECK-NOT: InvokeInterface
-
- /// CHECK-START: void Main.testInterfaceToVirtualCall() inliner (after)
- /// CHECK: InvokeVirtual method_name:Main.$noinline$doCall
-
- /// CHECK-START: void Main.testInterfaceToVirtualCall() inliner (after)
- /// CHECK-NOT: InvokeStaticOrDirect
- /// CHECK-NOT: InvokeInterface
- public static void testInterfaceToVirtualCall() {
- methodWithInvokeInterface(m);
- }
-
- static Interface itf = new Main();
- static Main m = new Main();
- static boolean doThrow = false;
-}
-
-interface Interface {
- public void $noinline$doCall();
-}