mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-05 20:37:32 +00:00
@@ -11,56 +11,56 @@ import java.util.Stack;
|
||||
*/
|
||||
public abstract class GraphSource {
|
||||
|
||||
public abstract int size();
|
||||
public abstract int size();
|
||||
|
||||
public abstract GraphSourceItem get(int pos);
|
||||
public abstract GraphSourceItem get(int pos);
|
||||
|
||||
public abstract boolean isEmpty();
|
||||
public abstract boolean isEmpty();
|
||||
|
||||
public abstract List<GraphTargetItem> translatePart(List localData, Stack<GraphTargetItem> stack, int start, int end);
|
||||
public abstract List<GraphTargetItem> translatePart(List localData, Stack<GraphTargetItem> stack, int start, int end);
|
||||
|
||||
private void visitCode(int ip, int lastIp, HashMap<Integer, List<Integer>> refs) {
|
||||
while (ip < size()) {
|
||||
refs.get(ip).add(lastIp);
|
||||
lastIp = ip;
|
||||
if (refs.get(ip).size() > 1) {
|
||||
break;
|
||||
}
|
||||
GraphSourceItem ins = get(ip);
|
||||
|
||||
|
||||
if (ins.isExit()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ins.isBranch() || ins.isJump()) {
|
||||
List<Integer> branches = ins.getBranches(this);
|
||||
for (int b : branches) {
|
||||
if (b >= 0) {
|
||||
visitCode(b, ip, refs);
|
||||
}
|
||||
private void visitCode(int ip, int lastIp, HashMap<Integer, List<Integer>> refs) {
|
||||
while (ip < size()) {
|
||||
refs.get(ip).add(lastIp);
|
||||
lastIp = ip;
|
||||
if (refs.get(ip).size() > 1) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
ip++;
|
||||
};
|
||||
}
|
||||
GraphSourceItem ins = get(ip);
|
||||
|
||||
public HashMap<Integer, List<Integer>> visitCode(List<Integer> alternateEntries) {
|
||||
HashMap<Integer, List<Integer>> refs = new HashMap<Integer, List<Integer>>();
|
||||
for (int i = 0; i < size(); i++) {
|
||||
refs.put(i, new ArrayList<Integer>());
|
||||
}
|
||||
visitCode(0, 0, refs);
|
||||
int pos = 0;
|
||||
for (int e : alternateEntries) {
|
||||
pos++;
|
||||
visitCode(e, -pos, refs);
|
||||
}
|
||||
return refs;
|
||||
}
|
||||
|
||||
public abstract int adr2pos(long adr);
|
||||
if (ins.isExit()) {
|
||||
break;
|
||||
}
|
||||
|
||||
public abstract long pos2adr(int pos);
|
||||
if (ins.isBranch() || ins.isJump()) {
|
||||
List<Integer> branches = ins.getBranches(this);
|
||||
for (int b : branches) {
|
||||
if (b >= 0) {
|
||||
visitCode(b, ip, refs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
ip++;
|
||||
};
|
||||
}
|
||||
|
||||
public HashMap<Integer, List<Integer>> visitCode(List<Integer> alternateEntries) {
|
||||
HashMap<Integer, List<Integer>> refs = new HashMap<Integer, List<Integer>>();
|
||||
for (int i = 0; i < size(); i++) {
|
||||
refs.put(i, new ArrayList<Integer>());
|
||||
}
|
||||
visitCode(0, 0, refs);
|
||||
int pos = 0;
|
||||
for (int e : alternateEntries) {
|
||||
pos++;
|
||||
visitCode(e, -pos, refs);
|
||||
}
|
||||
return refs;
|
||||
}
|
||||
|
||||
public abstract int adr2pos(long adr);
|
||||
|
||||
public abstract long pos2adr(int pos);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user