summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author David Brazdil <dbrazdil@google.com> 2016-03-03 11:40:15 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-03-03 11:40:15 +0000
commit19a133b2e26770b900119aaac25e3e73bd287e3f (patch)
tree3769b2c1394d5ff2218f953b36c6c90817a3881d
parent982a1ac93d03379fc82f4f5b1a1b13eeea035d5b (diff)
parent7ba9966b76bbf818513018fa1da72c89330fe384 (diff)
Merge "ART: cleanup exit_block_ in graph if exit block is removed"
-rw-r--r--compiler/optimizing/nodes.cc5
-rw-r--r--test/579-inline-infinite/expected.txt0
-rw-r--r--test/579-inline-infinite/info.txt2
-rw-r--r--test/579-inline-infinite/src/Main.java38
4 files changed, 44 insertions, 1 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 0e0b83e4b4..77ded29b49 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -127,6 +127,9 @@ void HGraph::RemoveDeadBlocks(const ArenaBitVector& visited) {
// Remove the block from the list of blocks, so that further analyses
// never see it.
blocks_[i] = nullptr;
+ if (block->IsExitBlock()) {
+ SetExitBlock(nullptr);
+ }
}
}
}
@@ -1870,7 +1873,7 @@ void HGraph::DeleteDeadEmptyBlock(HBasicBlock* block) {
DCHECK(block->GetPhis().IsEmpty());
if (block->IsExitBlock()) {
- exit_block_ = nullptr;
+ SetExitBlock(nullptr);
}
RemoveElement(reverse_post_order_, block);
diff --git a/test/579-inline-infinite/expected.txt b/test/579-inline-infinite/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/579-inline-infinite/expected.txt
diff --git a/test/579-inline-infinite/info.txt b/test/579-inline-infinite/info.txt
new file mode 100644
index 0000000000..6fb917c222
--- /dev/null
+++ b/test/579-inline-infinite/info.txt
@@ -0,0 +1,2 @@
+Regression test for optimizing.
+Inlining of method with infinite loop cause a crash.
diff --git a/test/579-inline-infinite/src/Main.java b/test/579-inline-infinite/src/Main.java
new file mode 100644
index 0000000000..f214ed4ffd
--- /dev/null
+++ b/test/579-inline-infinite/src/Main.java
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+class Infinite implements Runnable {
+ public int field;
+
+ private final void $noinline$infinite() {
+ while(true) {
+ field++;
+ }
+ }
+
+ public void run() {
+ $noinline$infinite();
+ }
+}
+
+public class Main {
+ public static void main(String[] args) {
+ Thread thr = new Thread(new Infinite());
+ thr.setDaemon(true);
+ thr.start();
+ // This is a compiler test, so just finish.
+ }
+}