summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/003-omnibus-opcodes/src/FloatMath.java50
-rw-r--r--test/586-checker-null-array-get/expected.txt0
-rw-r--r--test/586-checker-null-array-get/info.txt3
-rw-r--r--test/586-checker-null-array-get/src/Main.java42
-rw-r--r--test/974-verify-interface-super/expected.txt1
-rw-r--r--test/974-verify-interface-super/info.txt3
-rw-r--r--test/974-verify-interface-super/smali/base.smali31
-rw-r--r--test/974-verify-interface-super/smali/iface.smali22
-rw-r--r--test/974-verify-interface-super/smali/main.smali40
-rwxr-xr-xtest/etc/run-test-jar4
-rwxr-xr-xtest/run-test2
11 files changed, 191 insertions, 7 deletions
diff --git a/test/003-omnibus-opcodes/src/FloatMath.java b/test/003-omnibus-opcodes/src/FloatMath.java
index 96befe9cdc..fcdb4fe305 100644
--- a/test/003-omnibus-opcodes/src/FloatMath.java
+++ b/test/003-omnibus-opcodes/src/FloatMath.java
@@ -135,7 +135,8 @@ public class FloatMath {
static float[] floatOperTest(float x, float y) {
System.out.println("FloatMath.floatOperTest");
- float[] results = new float[9];
+ float[] results = new float[10];
+ float tmp;
/* this seems to generate "op-float" instructions */
results[0] = x + y;
@@ -145,7 +146,21 @@ public class FloatMath {
results[4] = x % -y;
/* this seems to generate "op-float/2addr" instructions */
- results[8] = x + (((((x + y) - y) * y) / y) % y);
+ tmp = x;
+ tmp += y;
+ results[5] = tmp;
+ tmp = x;
+ tmp -= y;
+ results[6] = tmp;
+ tmp = x;
+ tmp *= y;
+ results[7] = tmp;
+ tmp = x;
+ tmp /= y;
+ results[8] = tmp;
+ tmp = x;
+ tmp %= -y;
+ results[9] = tmp;
return results;
}
@@ -155,7 +170,11 @@ public class FloatMath {
Main.assertTrue(results[2] > -210000.01f && results[2] < -209999.99f);
Main.assertTrue(results[3] > -23333.34f && results[3] < -23333.32f);
Main.assertTrue(results[4] > 0.999f && results[4] < 1.001f);
- Main.assertTrue(results[8] > 70000.99f && results[8] < 70001.01f);
+ Main.assertTrue(results[5] > 69996.99f && results[5] < 69997.01f);
+ Main.assertTrue(results[6] > 70002.99f && results[6] < 70003.01f);
+ Main.assertTrue(results[7] > -210000.01f && results[7] < -209999.99f);
+ Main.assertTrue(results[8] > -23333.34f && results[8] < -23333.32f);
+ Main.assertTrue(results[9] > 0.999f && results[9] < 1.001f);
}
/*
@@ -165,7 +184,8 @@ public class FloatMath {
static double[] doubleOperTest(double x, double y) {
System.out.println("FloatMath.doubleOperTest");
- double[] results = new double[9];
+ double[] results = new double[10];
+ double tmp;
/* this seems to generate "op-double" instructions */
results[0] = x + y;
@@ -175,7 +195,21 @@ public class FloatMath {
results[4] = x % -y;
/* this seems to generate "op-double/2addr" instructions */
- results[8] = x + (((((x + y) - y) * y) / y) % y);
+ tmp = x;
+ tmp += y;
+ results[5] = tmp;
+ tmp = x;
+ tmp -= y;
+ results[6] = tmp;
+ tmp = x;
+ tmp *= y;
+ results[7] = tmp;
+ tmp = x;
+ tmp /= y;
+ results[8] = tmp;
+ tmp = x;
+ tmp %= -y;
+ results[9] = tmp;
return results;
}
@@ -185,7 +219,11 @@ public class FloatMath {
Main.assertTrue(results[2] > -210000.01 && results[2] < -209999.99);
Main.assertTrue(results[3] > -23333.34 && results[3] < -23333.32);
Main.assertTrue(results[4] > 0.999 && results[4] < 1.001);
- Main.assertTrue(results[8] > 70000.99 && results[8] < 70001.01);
+ Main.assertTrue(results[5] > 69996.99 && results[5] < 69997.01);
+ Main.assertTrue(results[6] > 70002.99 && results[6] < 70003.01);
+ Main.assertTrue(results[7] > -210000.01 && results[7] < -209999.99);
+ Main.assertTrue(results[8] > -23333.34 && results[8] < -23333.32);
+ Main.assertTrue(results[9] > 0.999 && results[9] < 1.001);
}
/*
diff --git a/test/586-checker-null-array-get/expected.txt b/test/586-checker-null-array-get/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/586-checker-null-array-get/expected.txt
diff --git a/test/586-checker-null-array-get/info.txt b/test/586-checker-null-array-get/info.txt
new file mode 100644
index 0000000000..81b42e9789
--- /dev/null
+++ b/test/586-checker-null-array-get/info.txt
@@ -0,0 +1,3 @@
+Regression test for the load store elimination of optimizing
+that used to merge two array gets that have the same inputs but
+not the same type. Note that this only happens if the array is null.
diff --git a/test/586-checker-null-array-get/src/Main.java b/test/586-checker-null-array-get/src/Main.java
new file mode 100644
index 0000000000..4b03ff28eb
--- /dev/null
+++ b/test/586-checker-null-array-get/src/Main.java
@@ -0,0 +1,42 @@
+/*
+ * 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 class Main {
+ public static Object[] getObjectArray() { return null; }
+ public static long[] getLongArray() { return null; }
+
+ public static void main(String[] args) {
+ try {
+ foo();
+ throw new Error("Expected NullPointerException");
+ } catch (NullPointerException e) {
+ // Expected.
+ }
+ }
+
+ /// CHECK-START: void Main.foo() load_store_elimination (after)
+ /// CHECK-DAG: <<Null:l\d+>> NullConstant
+ /// CHECK-DAG: <<Check:l\d+>> NullCheck [<<Null>>]
+ /// CHECK-DAG: <<Get1:j\d+>> ArrayGet [<<Check>>,{{i\d+}}]
+ /// CHECK-DAG: <<Get2:l\d+>> ArrayGet [<<Check>>,{{i\d+}}]
+ public static void foo() {
+ longField = getLongArray()[0];
+ objectField = getObjectArray()[0];
+ }
+
+ public static long longField;
+ public static Object objectField;
+}
diff --git a/test/974-verify-interface-super/expected.txt b/test/974-verify-interface-super/expected.txt
new file mode 100644
index 0000000000..7ba7491891
--- /dev/null
+++ b/test/974-verify-interface-super/expected.txt
@@ -0,0 +1 @@
+OK. No exception before invoke!
diff --git a/test/974-verify-interface-super/info.txt b/test/974-verify-interface-super/info.txt
new file mode 100644
index 0000000000..c5ff1f69f1
--- /dev/null
+++ b/test/974-verify-interface-super/info.txt
@@ -0,0 +1,3 @@
+Test that we do the right thing with invoke-super on interfaces when there are
+verifier errors.
+
diff --git a/test/974-verify-interface-super/smali/base.smali b/test/974-verify-interface-super/smali/base.smali
new file mode 100644
index 0000000000..c7875de1d3
--- /dev/null
+++ b/test/974-verify-interface-super/smali/base.smali
@@ -0,0 +1,31 @@
+# Copyright 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.
+
+.class public LBase;
+
+.super La/klass/that/does/not/Exist;
+
+.method public static run()V
+ .locals 4
+ new-instance v0, LBase;
+ invoke-direct {v0}, LBase;-><init>()V
+ invoke-virtual {v0}, LBase;->SayHi()V
+ return-void
+.end method
+
+.method public SayHi()V
+.locals 2
+ invoke-super {p0}, LIface;->SayHi()V
+ return-void
+.end method
diff --git a/test/974-verify-interface-super/smali/iface.smali b/test/974-verify-interface-super/smali/iface.smali
new file mode 100644
index 0000000000..89f9c0beba
--- /dev/null
+++ b/test/974-verify-interface-super/smali/iface.smali
@@ -0,0 +1,22 @@
+# Copyright 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.
+
+.class public abstract interface LIface;
+
+.super Ljava/lang/Object;
+
+.method public SayHi()V
+.locals 0
+ return-void
+.end method
diff --git a/test/974-verify-interface-super/smali/main.smali b/test/974-verify-interface-super/smali/main.smali
new file mode 100644
index 0000000000..be4016c5c1
--- /dev/null
+++ b/test/974-verify-interface-super/smali/main.smali
@@ -0,0 +1,40 @@
+# Copyright 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.
+
+.class public LMain;
+
+.super Ljava/lang/Object;
+
+.method public static main([Ljava/lang/String;)V
+ .locals 4
+ const-string v0, "OK. No exception before invoke!"
+ sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
+ invoke-virtual {v1, v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
+ :try_start
+ invoke-static {}, LBase;->run()V
+ const-string v0, "FAIL: no exception!"
+ sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
+ invoke-virtual {v1, v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
+ goto :end
+ :try_end
+ .catch Ljava/lang/LinkageError; {:try_start .. :try_end} :end
+ .catch Ljava/lang/Throwable; {:try_start .. :try_end} :error
+ :error
+ move-exception v0
+ sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
+ invoke-virtual {v1, v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
+ invoke-virtual {v0}, Ljava/lang/Throwable;->printStackTrace()V
+ :end
+ return-void
+.end method
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 2db1e6c947..b360f67874 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -66,6 +66,10 @@ while true; do
fi
LIB="$1"
shift
+ elif [ "x$1" = "x--gc-stress" ]; then
+ # Give an extra 5 mins if we are gc-stress.
+ TIME_OUT_VALUE=$((${TIME_OUT_VALUE} + 300))
+ shift
elif [ "x$1" = "x--testlib" ]; then
shift
if [ "x$1" = "x" ]; then
diff --git a/test/run-test b/test/run-test
index 6bb154942c..3350b35783 100755
--- a/test/run-test
+++ b/test/run-test
@@ -389,7 +389,7 @@ if [ "$gc_verify" = "true" ]; then
run_args="${run_args} --runtime-option -Xgc:preverify_rosalloc --runtime-option -Xgc:postverify_rosalloc"
fi
if [ "$gc_stress" = "true" ]; then
- run_args="${run_args} --runtime-option -Xgc:SS,gcstress --runtime-option -Xms2m --runtime-option -Xmx16m"
+ run_args="${run_args} --gc-stress --runtime-option -Xgc:SS,gcstress --runtime-option -Xms2m --runtime-option -Xmx16m"
fi
if [ "$trace" = "true" ]; then
run_args="${run_args} --runtime-option -Xmethod-trace --runtime-option -Xmethod-trace-file-size:2000000"