Stack<> to TranslteStack in translateInverted

This commit is contained in:
honfika
2014-08-23 21:59:48 +02:00
parent 665caba920
commit 8f981eb5eb
20 changed files with 21 additions and 25 deletions

View File

@@ -567,7 +567,7 @@ public class ABC {
MethodBody bod=bodies.get(bodyIdxFromMethodIdx.get(script_info.get(i).init_index));
GraphTextWriter t=new HilightedTextWriter(Configuration.getCodeFormatting(),false);
try {
bod.toString("script", ScriptExportMode.PCODE, false,i, 0, this, null, constants, method_info, new Stack<GraphTargetItem>(), false, t ,new ArrayList<String>(), null);
bod.toString("script", ScriptExportMode.PCODE, false,i, 0, this, null, constants, method_info, new TranslateStack(), false, t ,new ArrayList<String>(), null);
} catch (InterruptedException ex) {
Logger.getLogger(ABC.class.getName()).log(Level.SEVERE, null, ex);
}

View File

@@ -2883,7 +2883,7 @@ public class AVM2Code implements Serializable {
}
}
}
//int cnt = removeTraps(refs, true, false, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), new HashMap<Integer, Integer>(), new HashMap<Integer, HashMap<Integer, GraphTargetItem>>(), decisions, path);
//int cnt = removeTraps(refs, true, false, localData, new TranslateStack(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), new HashMap<Integer, Integer>(), new HashMap<Integer, HashMap<Integer, GraphTargetItem>>(), decisions, path);
code.getCode().removeIgnored(constants, trait, info, body);
return cnt;
}

View File

@@ -17,10 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
import java.util.Stack;
public interface IfTypeIns {
public abstract void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins);
public abstract void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins);
}

View File

@@ -31,7 +31,6 @@ import com.jpexs.decompiler.graph.ScopeStack;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
public class IfEqIns extends InstructionDefinition implements IfTypeIns {
@@ -47,7 +46,7 @@ public class IfEqIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = stack.pop();
stack.push(new NeqAVM2Item(ins, v1, v2));

View File

@@ -30,7 +30,6 @@ import com.jpexs.decompiler.graph.TranslateStack;
import com.jpexs.decompiler.graph.model.NotItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
public class IfFalseIns extends InstructionDefinition implements IfTypeIns {
@@ -45,7 +44,7 @@ public class IfFalseIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
//String v1 = stack.pop().toString();
//stack.push("(" + v1 + ")");
}

View File

@@ -31,7 +31,6 @@ import com.jpexs.decompiler.graph.ScopeStack;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
public class IfGeIns extends InstructionDefinition implements IfTypeIns {
@@ -47,7 +46,7 @@ public class IfGeIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = stack.pop();
stack.push(new LtAVM2Item(ins, v1, v2));

View File

@@ -47,7 +47,7 @@ public class IfGtIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = stack.pop();
stack.push(new LeAVM2Item(ins, v1, v2));

View File

@@ -47,7 +47,7 @@ public class IfLeIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = stack.pop();
stack.push(new GtAVM2Item(ins, v1, v2));

View File

@@ -31,7 +31,6 @@ import com.jpexs.decompiler.graph.ScopeStack;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
public class IfLtIns extends InstructionDefinition implements IfTypeIns {
@@ -47,7 +46,7 @@ public class IfLtIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = stack.pop();
stack.push(new GeAVM2Item(ins, v1, v2));

View File

@@ -47,7 +47,7 @@ public class IfNGeIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = stack.pop();
stack.push(new GeAVM2Item(ins, v1, v2));

View File

@@ -47,7 +47,7 @@ public class IfNGtIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = stack.pop();
stack.push(new GtAVM2Item(ins, v1, v2));

View File

@@ -47,7 +47,7 @@ public class IfNLeIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = stack.pop();
stack.push(new LeAVM2Item(ins, v1, v2));

View File

@@ -47,7 +47,7 @@ public class IfNLtIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = stack.pop();
stack.push(new LtAVM2Item(ins, v1, v2));

View File

@@ -47,7 +47,7 @@ public class IfNeIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = stack.pop();
stack.push(new EqAVM2Item(ins, v1, v2));

View File

@@ -47,7 +47,7 @@ public class IfStrictEqIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = stack.pop();
stack.push(new StrictNeqAVM2Item(ins, v1, v2));

View File

@@ -47,7 +47,7 @@ public class IfStrictNeIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = stack.pop();
stack.push(new StrictEqAVM2Item(ins, v1, v2));

View File

@@ -45,7 +45,7 @@ public class IfTrueIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
GraphTargetItem v1 = stack.pop();
stack.push(new NotItem(ins, v1));
}

View File

@@ -43,6 +43,6 @@ public class JumpIns extends InstructionDefinition implements IfTypeIns {
}
@Override
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
}
}

View File

@@ -826,7 +826,7 @@ public class Action implements GraphSourceItem {
}
if (action instanceof GraphSourceItemContainer) {
GraphSourceItemContainer cnt = (GraphSourceItemContainer) action;
//List<GraphTargetItem> out=actionsPartToTree(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(),new HashMap<String, GraphTargetItem>(), new Stack<GraphTargetItem>(), src, ip+1,endip-1 , version);
//List<GraphTargetItem> out=actionsPartToTree(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(),new HashMap<String, GraphTargetItem>(), new TranslateStack(), src, ip+1,endip-1 , version);
long endAddr = action.getAddress() + cnt.getHeaderSize();
String cntName = cnt.getName();
List<List<GraphTargetItem>> outs = new ArrayList<>();

View File

@@ -381,7 +381,7 @@ public class Graph {
part = part.getSubParts().get(0).nextParts.get(0);
}
/*localData = prepareBranchLocalData(localData);
Stack<GraphTargetItem> st = new Stack<>();
TranslateStack st = new TranslateStack();
List<GraphTargetItem> output=new ArrayList<>();
GraphPart startPart = part;
for (int i = part.start; i <= part.end; i++) {