summaryrefslogtreecommitdiffstats
path: root/test/460-multiple-returns3
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-03-12 10:34:11 +0000
committerNicolas Geoffray <ngeoffray@google.com>2015-03-12 10:57:47 +0000
commit4f1a384762bf49fe8f3ecae8dd2bcb0e19d044a9 (patch)
tree3cb359f31e1f3080fb7cfffd5a6fd417f61753d7 /test/460-multiple-returns3
parentd304629202eec2ab053a47fc7bcf10223b5ccea4 (diff)
downloadart-4f1a384762bf49fe8f3ecae8dd2bcb0e19d044a9.tar.gz
art-4f1a384762bf49fe8f3ecae8dd2bcb0e19d044a9.tar.bz2
art-4f1a384762bf49fe8f3ecae8dd2bcb0e19d044a9.zip
Give an expected type to phis created for multiple returns.
When inlining, we used to take the type of the inlined method for the phi in case of multiple returns. I recently changed the logic of phi types to only be of int/float/double/ref, so we need to call ToPhiType when creating the phi. Change-Id: I960067ca8a8814509c2a7c52c08387d892ebf4a3
Diffstat (limited to 'test/460-multiple-returns3')
-rw-r--r--test/460-multiple-returns3/expected.txt0
-rw-r--r--test/460-multiple-returns3/info.txt2
-rw-r--r--test/460-multiple-returns3/smali/MultipleReturns.smali40
-rw-r--r--test/460-multiple-returns3/src/Main.java32
4 files changed, 74 insertions, 0 deletions
diff --git a/test/460-multiple-returns3/expected.txt b/test/460-multiple-returns3/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/460-multiple-returns3/expected.txt
diff --git a/test/460-multiple-returns3/info.txt b/test/460-multiple-returns3/info.txt
new file mode 100644
index 0000000000..cdd354bbdf
--- /dev/null
+++ b/test/460-multiple-returns3/info.txt
@@ -0,0 +1,2 @@
+Tests inlining of a pattern not generated by DX: multiple
+returns in a single method.
diff --git a/test/460-multiple-returns3/smali/MultipleReturns.smali b/test/460-multiple-returns3/smali/MultipleReturns.smali
new file mode 100644
index 0000000000..38569a7aa9
--- /dev/null
+++ b/test/460-multiple-returns3/smali/MultipleReturns.smali
@@ -0,0 +1,40 @@
+# Copyright (C) 2015 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.
+
+.class public LMultipleReturns;
+
+.super Ljava/lang/Object;
+
+.method public static caller()S
+ .registers 1
+ invoke-static {}, LMultipleReturns;->$opt$CalleeReturnShort()S
+ move-result v0
+ return v0
+.end method
+
+.method public static $opt$CalleeReturnShort()S
+ .registers 2
+ const/4 v0, 0x0
+ const/4 v1, 0x1
+ if-eq v1, v0, :else
+ if-eq v1, v0, :else2
+ const/4 v0, 0x4
+ :else2
+ return v0
+ :else
+ if-eq v1, v0, :else3
+ const/4 v1, 0x1
+ :else3
+ return v1
+.end method
diff --git a/test/460-multiple-returns3/src/Main.java b/test/460-multiple-returns3/src/Main.java
new file mode 100644
index 0000000000..fb8a1151d1
--- /dev/null
+++ b/test/460-multiple-returns3/src/Main.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+import java.lang.reflect.Method;
+
+public class Main {
+
+ // Workaround for b/18051191.
+ class InnerClass {}
+
+ public static void main(String[] args) throws Exception {
+ Class<?> c = Class.forName("MultipleReturns");
+ Method m = c.getMethod("caller");
+ short result = (Short) m.invoke(null);
+ if (result != 4) {
+ throw new Error("Expected 4, got " + result);
+ }
+ }
+}