From 53a94317a7d54546d30489522810a1bac7950bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Wed, 27 Feb 2013 22:38:54 +0100 Subject: [PATCH] AS3: SetLocal..GetLocal fix --- .../jpexs/decompiler/flash/abc/avm2/AVM2Code.java | 12 +++++++----- .../decompiler/flash/abc/avm2/graph/AVM2Graph.java | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index a2b579e46..96a94c825 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -945,7 +945,7 @@ public class AVM2Code implements Serializable { } boolean isCatched = false; - private boolean isKilled(int regName, int start, int end) { + public boolean isKilled(int regName, int start, int end) { for (int k = start; k <= end; k++) { if (code.get(k).definition instanceof KillIns) { if (code.get(k).operands[0] == regName) { @@ -1209,10 +1209,12 @@ public class AVM2Code implements Serializable { continue; } } - }*/ - - if ((ins.definition instanceof SetLocalTypeIns) && (ip + 1 <= end) && (isKilled(((SetLocalTypeIns) ins.definition).getRegisterId(ins), ip, end))) { //set_local_x,get_local_x..kill x - + }*/ + if((ins.definition instanceof GetLocalTypeIns)&&(!output.isEmpty())&&(output.get(output.size()-1) instanceof SetLocalTreeItem)&&(((SetLocalTreeItem)output.get(output.size()-1)).regIndex==((GetLocalTypeIns)ins.definition).getRegisterId(ins))&&isKilled(((SetLocalTreeItem)output.get(output.size()-1)).regIndex, start, end)){ + SetLocalTreeItem slt=(SetLocalTreeItem)output.remove(output.size()-1); + stack.push(slt.getValue()); + ip++; + }else if ((ins.definition instanceof SetLocalTypeIns) && (ip + 1 <= end) && (isKilled(((SetLocalTypeIns) ins.definition).getRegisterId(ins), ip, end))) { //set_local_x,get_local_x..kill x AVM2Instruction insAfter = code.get(ip + 1); if ((insAfter.definition instanceof GetLocalTypeIns) && (((GetLocalTypeIns) insAfter.definition).getRegisterId(insAfter) == ((SetLocalTypeIns) ins.definition).getRegisterId(ins))) { GraphTargetItem before = stack.peek(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index b2a34772c..13b71a88f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -1496,7 +1496,7 @@ public class AVM2Graph extends Graph { } @Override - protected void finalProcess(List list) { + protected void finalProcess(List list) { for(int i=0;i