summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-03-27 10:27:22 +0000
committerNicolas Geoffray <ngeoffray@google.com>2015-03-30 12:45:58 +0100
commit5b168deeae2c5a8a566ce5c140741f0e2227af21 (patch)
tree4a572dfc6932d1f478eae594801c59af11628ef8 /test
parentb3665e3dfdd23cc7a2f17a0b53bb16205bf4151f (diff)
downloadart-5b168deeae2c5a8a566ce5c140741f0e2227af21.zip
art-5b168deeae2c5a8a566ce5c140741f0e2227af21.tar.gz
art-5b168deeae2c5a8a566ce5c140741f0e2227af21.tar.bz2
Fix user-build on fugu.
Calling Delete on an array shifts the elements, so when iterating over inactives and removing entries we need to decrement for the found interval, but also its potential other half. The code used to not decrement for the other half Change-Id: Idcb1533643c11a37ed4f459fe88aaef208a4bfd6
Diffstat (limited to 'test')
-rw-r--r--test/467-regalloc-pair/expected.txt1
-rw-r--r--test/467-regalloc-pair/info.txt2
-rw-r--r--test/467-regalloc-pair/smali/TestCase.smali59
-rw-r--r--test/467-regalloc-pair/src/Main.java37
4 files changed, 99 insertions, 0 deletions
diff --git a/test/467-regalloc-pair/expected.txt b/test/467-regalloc-pair/expected.txt
new file mode 100644
index 0000000..da39d9d
--- /dev/null
+++ b/test/467-regalloc-pair/expected.txt
@@ -0,0 +1 @@
+In interface
diff --git a/test/467-regalloc-pair/info.txt b/test/467-regalloc-pair/info.txt
new file mode 100644
index 0000000..882a29c
--- /dev/null
+++ b/test/467-regalloc-pair/info.txt
@@ -0,0 +1,2 @@
+Regression test for optimizing's register allocator
+that used to trip when compiling TestCase.testCase on x86.
diff --git a/test/467-regalloc-pair/smali/TestCase.smali b/test/467-regalloc-pair/smali/TestCase.smali
new file mode 100644
index 0000000..a3101fe
--- /dev/null
+++ b/test/467-regalloc-pair/smali/TestCase.smali
@@ -0,0 +1,59 @@
+# 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 LTestCase;
+
+.super Ljava/lang/Object;
+
+.method public static testCase([BLMain;)V
+ .registers 12
+ const/4 v2, 0
+ array-length v0, v10
+ div-int/lit8 v0, v0, 7
+ invoke-static {v2, v0}, Ljava/lang/Math;->max(II)I
+ move-result v7
+ move v6, v2
+ move v3, v2
+ :label5
+ if-ge v6, v7, :label1
+ const-wide/16 v0, 0
+ move-wide v4, v0
+ move v1, v2
+ move v0, v3
+ :label4
+ const/4 v3, 6
+ if-ge v1, v3, :label2
+ const/16 v3, 8
+ shl-long/2addr v4, v3
+ add-int/lit8 v3, v0, 1
+ aget-byte v0, v10, v0
+ if-gez v0, :label3
+ add-int/lit16 v0, v0, 256
+ :label3
+ int-to-long v8, v0
+ or-long/2addr v4, v8
+ add-int/lit8 v0, v1, 1
+ move v1, v0
+ move v0, v3
+ goto :label4
+ :label2
+ add-int/lit8 v3, v0, 1
+ aget-byte v0, v10, v0
+ invoke-interface {v11, v4, v5, v0}, LItf;->invokeInterface(JI)V
+ add-int/lit8 v0, v6, 1
+ move v6, v0
+ goto :label5
+ :label1
+ return-void
+.end method
diff --git a/test/467-regalloc-pair/src/Main.java b/test/467-regalloc-pair/src/Main.java
new file mode 100644
index 0000000..aac07fd
--- /dev/null
+++ b/test/467-regalloc-pair/src/Main.java
@@ -0,0 +1,37 @@
+/*
+ * 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;
+
+interface Itf {
+ public void invokeInterface(long l, int i);
+}
+
+public class Main implements Itf {
+
+ // Workaround for b/18051191.
+ class InnerClass {}
+
+ public static void main(String[] args) throws Exception {
+ Class<?> c = Class.forName("TestCase");
+ Method m = c.getMethod("testCase", byte[].class, Main.class);
+ m.invoke(null, new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, new Main());
+ }
+
+ public void invokeInterface(long l, int i) {
+ System.out.println("In interface");
+ }
+}