Annotate all instructions with position information.
This addresses several outstanding issues: blocks can now be reordered without
issue, if positions are present all instructions will be annotated, in
particular move-exceptions for synchornized blocks. This change requires that
all IR tranformations properly transfer position information for each
instruction.
Bug: 65618023
Bug: 65567013
Bug: 65474153
Change-Id: I9ded6003c2b349e738f50e7be58f35536bc5b08b
diff --git a/src/test/debugTestResources/FinallyBlock.java b/src/test/debugTestResources/FinallyBlock.java
new file mode 100644
index 0000000..4b30391
--- /dev/null
+++ b/src/test/debugTestResources/FinallyBlock.java
@@ -0,0 +1,37 @@
+// Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+public class FinallyBlock {
+
+ public static int finallyBlock(Throwable obj) throws Throwable {
+ int x = 21;
+ try {
+ if (obj != null) {
+ throw obj;
+ }
+ } catch (AssertionError e) {
+ x = e.getMessage().length() + 1;
+ } catch (RuntimeException e) {
+ x = e.getMessage().length() + 2;
+ } finally {
+ x *= 2;
+ }
+ return x;
+ }
+
+ private static int callFinallyBlock(Throwable obj) {
+ try {
+ return finallyBlock(obj);
+ } catch (Throwable e) {
+ return -1;
+ }
+ }
+
+ public static void main(String[] args) throws Throwable {
+ System.out.println(callFinallyBlock(null));
+ System.out.println(callFinallyBlock(new AssertionError("assert error")));
+ System.out.println(callFinallyBlock(new RuntimeException("runtime error")));
+ System.out.println(callFinallyBlock(new Throwable("throwable")));
+ }
+}