summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-09-15 15:33:30 +0000
committerNicolas Geoffray <ngeoffray@google.com>2014-09-16 16:18:12 +0100
commitfbc695f9b8e2084697e19c1355ab925f99f0d235 (patch)
tree03e643aa9b468a512873293528bec93438580bab /test
parent3d2d7fb7ad24f4aec681ddc68a9565fa837b97ef (diff)
downloadart-fbc695f9b8e2084697e19c1355ab925f99f0d235.zip
art-fbc695f9b8e2084697e19c1355ab925f99f0d235.tar.gz
art-fbc695f9b8e2084697e19c1355ab925f99f0d235.tar.bz2
Revert "Revert "Implement suspend checks in new compiler.""
This reverts commit 7e3652c45c30c1f2f840e6088e24e2db716eaea7. Change-Id: Ib489440c34e41cba9e9e297054f9274f6e81a2d8
Diffstat (limited to 'test')
-rw-r--r--test/121-simple-suspend-check/expected.txt1
-rw-r--r--test/121-simple-suspend-check/info.txt1
-rw-r--r--test/121-simple-suspend-check/src/Main.java35
3 files changed, 37 insertions, 0 deletions
diff --git a/test/121-simple-suspend-check/expected.txt b/test/121-simple-suspend-check/expected.txt
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/test/121-simple-suspend-check/expected.txt
@@ -0,0 +1 @@
+PASS
diff --git a/test/121-simple-suspend-check/info.txt b/test/121-simple-suspend-check/info.txt
new file mode 100644
index 0000000..61611f9
--- /dev/null
+++ b/test/121-simple-suspend-check/info.txt
@@ -0,0 +1 @@
+Simple test to ensure the compiler emits suspend checks on loops.
diff --git a/test/121-simple-suspend-check/src/Main.java b/test/121-simple-suspend-check/src/Main.java
new file mode 100644
index 0000000..80daf37
--- /dev/null
+++ b/test/121-simple-suspend-check/src/Main.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2014 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 void main(String args[]) {
+ SpinThread thread = new SpinThread();
+ thread.setDaemon(true);
+ thread.start();
+ Runtime.getRuntime().gc();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException ie) {/*ignore */}
+ Runtime.getRuntime().gc();
+ System.out.println("PASS");
+ }
+}
+
+class SpinThread extends Thread {
+ public void run() {
+ while (true) {}
+ }
+}