summaryrefslogtreecommitdiffstats
path: root/test/121-simple-suspend-check/src
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-09-10 10:23:58 +0100
committerNicolas Geoffray <ngeoffray@google.com>2014-09-15 12:43:06 +0100
commit6fbce029fba3ed5da6c36017754ed408e6bcb632 (patch)
tree71debbb7c475be1508e14a7986ed69e75e5b0e4c /test/121-simple-suspend-check/src
parent8accb5ac557598fd40b80214bf87517bc4b7bc41 (diff)
downloadart-6fbce029fba3ed5da6c36017754ed408e6bcb632.zip
art-6fbce029fba3ed5da6c36017754ed408e6bcb632.tar.gz
art-6fbce029fba3ed5da6c36017754ed408e6bcb632.tar.bz2
Implement suspend checks in new compiler.
For simplicity, they are currently placed on all (dex-level) back edges, and at method entry. Change-Id: I6e833e244d559dd788c69727e22fe40aff5b3435
Diffstat (limited to 'test/121-simple-suspend-check/src')
-rw-r--r--test/121-simple-suspend-check/src/Main.java35
1 files changed, 35 insertions, 0 deletions
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) {}
+ }
+}