summaryrefslogtreecommitdiffstats
path: root/test/109-suspend-check
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2014-11-27 14:52:37 +0000
committerVladimir Marko <vmarko@google.com>2014-12-09 10:07:30 +0000
commit8b858e16563ebf8e522df026a6ab409f1bd9b3de (patch)
tree910900d8eefd5bed3f3c144894c970bb1973c71e /test/109-suspend-check
parentf7ebda43cb185b6414a2e86eef95eaf10b74db2c (diff)
downloadart-8b858e16563ebf8e522df026a6ab409f1bd9b3de.zip
art-8b858e16563ebf8e522df026a6ab409f1bd9b3de.tar.gz
art-8b858e16563ebf8e522df026a6ab409f1bd9b3de.tar.bz2
Quick: Redefine the notion of back-egdes.
Redefine a back-edge to really mean an edge to a loop head instead of comparing instruction offsets. Generate suspend checks also on fall-through to a loop head; insert an extra GOTO for these edges. Add suspend checks to fused cmp instructions. Rewrite suspend check elimination to track whether there is an invoke on each path from the loop head to a given back edge, instead of using domination info to look for a basic block with invoke that must be on each path. Ignore invokes to intrinsics and move the optimization to a its own pass. The new loops in 109-suspend-check should prevent intrinsics and fused cmp-related regressions. Bug: 18522004 Change-Id: I96ac818f76ccf9419a6e70e9ec00555f9d487a9e
Diffstat (limited to 'test/109-suspend-check')
-rw-r--r--test/109-suspend-check/src/Main.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/109-suspend-check/src/Main.java b/test/109-suspend-check/src/Main.java
index ae10576..cd5130d 100644
--- a/test/109-suspend-check/src/Main.java
+++ b/test/109-suspend-check/src/Main.java
@@ -21,10 +21,15 @@ public class Main {
System.out.println("Running (" + TEST_TIME + " seconds) ...");
InfiniteForLoop forLoop = new InfiniteForLoop();
InfiniteWhileLoop whileLoop = new InfiniteWhileLoop();
+ InfiniteWhileLoopWithIntrinsic whileLoopWithIntrinsic =
+ new InfiniteWhileLoopWithIntrinsic();
+ InfiniteDoWhileLoopWithLong doWhileLoopWithLong = new InfiniteDoWhileLoopWithLong();
InfiniteDoWhileLoop doWhileLoop = new InfiniteDoWhileLoop();
MakeGarbage garbage = new MakeGarbage();
forLoop.start();
whileLoop.start();
+ whileLoopWithIntrinsic.start();
+ doWhileLoopWithLong.start();
doWhileLoop.start();
garbage.start();
for (int i = 0; i < TEST_TIME; i++) {
@@ -34,6 +39,8 @@ public class Main {
}
forLoop.stopNow();
whileLoop.stopNow();
+ whileLoopWithIntrinsic.stopNow();
+ doWhileLoopWithLong.stopNow();
doWhileLoop.stopNow();
garbage.stopNow();
System.out.println("Done.");
@@ -48,6 +55,35 @@ public class Main {
}
}
+class InfiniteWhileLoopWithIntrinsic extends Thread {
+ volatile private boolean keepGoing = true;
+ private String[] strings = { "a", "b", "c", "d" };
+ private int sum = 0;
+ public void run() {
+ int i = 0;
+ while (keepGoing) {
+ i++;
+ sum += strings[i & 3].length();
+ }
+ }
+ public void stopNow() {
+ keepGoing = false;
+ }
+}
+
+class InfiniteDoWhileLoopWithLong extends Thread {
+ volatile private long keepGoing = 7L;
+ public void run() {
+ int i = 0;
+ do {
+ i++;
+ } while (keepGoing >= 4L);
+ }
+ public void stopNow() {
+ keepGoing = 1L;
+ }
+}
+
class InfiniteWhileLoop extends Thread {
volatile private boolean keepGoing = true;
public void run() {