summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2015-07-22 17:50:37 +0100
committerVladimir Marko <vmarko@google.com>2015-07-23 17:53:54 +0100
commitd021e166babaaf131e59caf5ad84772b73acb4c5 (patch)
tree136ae862ee4e61a18f999f57778011d7a917abba /test
parentbe86eabe578df433f46055bae08e77314a661d49 (diff)
downloadart-d021e166babaaf131e59caf5ad84772b73acb4c5.zip
art-d021e166babaaf131e59caf5ad84772b73acb4c5.tar.gz
art-d021e166babaaf131e59caf5ad84772b73acb4c5.tar.bz2
ART: Fix Quick/Optimizing suspend check assumption mismatch.
Quick's SuspendCheckElimination (SCE) expects that every method contains a suspend check and it eliminates suspend checks in loops containing an invoke. Optimizing eliminates the suspend check from leaf methods, so the combination of a Quick-compiled loop calling an Optimizing-compiled leaf method can lead to missing suspend checks and potentially leading to ANRs. Enable Quick's kLeafOptimization flag to remove suspend checks from leaf methods and disable Quick's SCE. This aligns the suspend check placement for the two backends and avoids the broken combination. Currently, all methods containing a try-catch are compiled with Quick, so it's relatively easy to create a regression test. However, this test will not be valid when Optimizing starts supporting try-catch. Bug: 22657404 (cherry picked from commit d29e8487ff1774b6eb5f0e18d854415c1ee8f6b0) Change-Id: I733c38bf68bfc2c618f2f2e6b59f8b0e015d7be1
Diffstat (limited to 'test')
-rw-r--r--test/109-suspend-check/src/Main.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/109-suspend-check/src/Main.java b/test/109-suspend-check/src/Main.java
index 8046d75..3c3353b 100644
--- a/test/109-suspend-check/src/Main.java
+++ b/test/109-suspend-check/src/Main.java
@@ -32,6 +32,8 @@ public class Main {
new InfiniteWhileLoopWithSpecialPutOrNop(new SpecialMethods2()),
new InfiniteWhileLoopWithSpecialConstOrIGet(new SpecialMethods1()),
new InfiniteWhileLoopWithSpecialConstOrIGet(new SpecialMethods2()),
+ new InfiniteWhileLoopWithSpecialConstOrIGetInTryCatch(new SpecialMethods1()),
+ new InfiniteWhileLoopWithSpecialConstOrIGetInTryCatch(new SpecialMethods2()),
};
doWhileLoopWithLong.start();
for (SimpleLoopThread loop : simpleLoops) {
@@ -135,6 +137,21 @@ class InfiniteWhileLoopWithSpecialConstOrIGet extends SimpleLoopThread {
}
}
+class InfiniteWhileLoopWithSpecialConstOrIGetInTryCatch extends SimpleLoopThread {
+ private SpecialMethodInterface smi;
+ public InfiniteWhileLoopWithSpecialConstOrIGetInTryCatch(SpecialMethodInterface smi) {
+ this.smi = smi;
+ }
+ public void run() {
+ try {
+ long i = 0L;
+ while (keepGoing) {
+ i += smi.ConstOrIGet();
+ }
+ } catch (Throwable ignored) { }
+ }
+}
+
class InfiniteWhileLoopWithIntrinsic extends SimpleLoopThread {
private String[] strings = { "a", "b", "c", "d" };
private int sum = 0;