diff options
author | Orion Hodson <oth@google.com> | 2017-12-05 07:52:30 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-12-05 07:52:30 +0000 |
commit | 564fd39d34f27fb87978907d2f3a9083ff10ef78 (patch) | |
tree | c895106a94e1a57e8172ef595b35cca8c5ad1b75 | |
parent | 4b24faf485b22064ca321d27c6b0c7f757729732 (diff) | |
parent | 60bacea0b899a82f05d2b8caf2a0aafc755eb823 (diff) | |
download | dalvik-564fd39d34f27fb87978907d2f3a9083ff10ef78.tar.gz |
Merge "dx: Fix missing critical edge classification" am: 04d126d57e am: af2735e9e6
am: 60bacea0b8
Change-Id: I32a1212815bbea0c812d1f288278e9d0e054d3b3
-rw-r--r-- | dx/src/com/android/dx/Version.java | 2 | ||||
-rw-r--r-- | dx/src/com/android/dx/ssa/SsaBasicBlock.java | 7 | ||||
-rw-r--r-- | dx/src/com/android/dx/ssa/SsaConverter.java | 17 |
3 files changed, 23 insertions, 3 deletions
diff --git a/dx/src/com/android/dx/Version.java b/dx/src/com/android/dx/Version.java index 239270f3c..8bc56d1ed 100644 --- a/dx/src/com/android/dx/Version.java +++ b/dx/src/com/android/dx/Version.java @@ -21,5 +21,5 @@ package com.android.dx; */ public class Version { /** {@code non-null;} version string */ - public static final String VERSION = "1.15"; + public static final String VERSION = "1.16"; } diff --git a/dx/src/com/android/dx/ssa/SsaBasicBlock.java b/dx/src/com/android/dx/ssa/SsaBasicBlock.java index 9c2137f45..0ac618bd4 100644 --- a/dx/src/com/android/dx/ssa/SsaBasicBlock.java +++ b/dx/src/com/android/dx/ssa/SsaBasicBlock.java @@ -566,6 +566,13 @@ public final class SsaBasicBlock { * @param source move source */ public void addMoveToEnd(RegisterSpec result, RegisterSpec source) { + /* + * Check that there are no other successors otherwise we may + * insert a move that affects those (b/69128828). + */ + if (successors.cardinality() > 1) { + throw new IllegalStateException("Inserting a move to a block with multiple successors"); + } if (result.getReg() == source.getReg()) { // Sometimes we end up with no-op moves. Ignore them here. diff --git a/dx/src/com/android/dx/ssa/SsaConverter.java b/dx/src/com/android/dx/ssa/SsaConverter.java index 1fd6f7825..a7d044c55 100644 --- a/dx/src/com/android/dx/ssa/SsaConverter.java +++ b/dx/src/com/android/dx/ssa/SsaConverter.java @@ -254,9 +254,12 @@ public class SsaConverter { /** * Returns {@code true} if block and successor need a Z-node - * between them. Presently, this is {@code true} if the final - * instruction has any sources or results and the current + * between them. Presently, this is {@code true} if either: + * <p><ul> + * <li> there is a critical edge between block and successor. + * <li> the final instruction has any sources or results and the current * successor block has more than one predecessor. + * </ul></p> * * @param block predecessor node * @param succ successor node @@ -267,6 +270,16 @@ public class SsaConverter { ArrayList<SsaInsn> insns = block.getInsns(); SsaInsn lastInsn = insns.get(insns.size() - 1); + // This is to address b/69128828 where the moves associated + // with a phi were being propagated along a critical + // edge. Consequently, the move instruction inserted was + // positioned before the first instruction in the predecessor + // block. The generated bytecode was rejected by the ART + // verifier. + if (block.getSuccessors().cardinality() > 1 && succ.getPredecessors().cardinality() > 1) { + return true; + } + return ((lastInsn.getResult() != null) || (lastInsn.getSources().size() > 0)) && succ.getPredecessors().cardinality() > 1; |