Begin per-method executions in rename to use less memory. Runs still with 336.
This commit is contained in:
@@ -9,7 +9,6 @@ import net.runelite.deob.execution.Execution;
|
||||
import net.runelite.deob.util.JarUtil;
|
||||
|
||||
// XXX something to detect final fields and evaluate them
|
||||
// XXX ORDER IN WHICH FIELDS ARE ACCESSED
|
||||
|
||||
public class Deob
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ public class IInc extends Instruction implements LVTInstruction, WideInstruction
|
||||
assert vctx.getType().equals(new Type(int.class.getCanonicalName()));
|
||||
ins.read(vctx);
|
||||
|
||||
vctx = new VariableContext(ins, vctx.getStackContext()); // XXX this is probably not right.
|
||||
vctx = new VariableContext(ins, vctx);
|
||||
var.set(index, vctx);
|
||||
|
||||
frame.addInstructionContext(ins);
|
||||
|
||||
@@ -22,8 +22,10 @@ import net.runelite.deob.execution.Frame;
|
||||
|
||||
public class Rename
|
||||
{
|
||||
private ClassGroup groupOne, groupTwo;
|
||||
|
||||
// respective executions
|
||||
private Execution eone, etwo;
|
||||
//private Execution eone, etwo;
|
||||
|
||||
// old -> new object mapping
|
||||
private Map<Object, Object> objMap = new HashMap<>();
|
||||
@@ -78,9 +80,22 @@ public class Rename
|
||||
|
||||
private void process(Method one, Method two)
|
||||
{
|
||||
Execution eone = new Execution(groupOne);
|
||||
eone.setBuildGraph(true);
|
||||
eone.setFollowInvokes(false);
|
||||
eone.addMethod(one);
|
||||
eone.run();
|
||||
|
||||
Execution etwo = new Execution(groupTwo);
|
||||
etwo.setBuildGraph(true);
|
||||
etwo.setFollowInvokes(false);
|
||||
etwo.addMethod(two);
|
||||
etwo.run();
|
||||
|
||||
// get frames for respective methods
|
||||
List<Frame> f1 = eone.processedFrames.stream().filter(f -> f.getMethod() == one).collect(Collectors.toList());
|
||||
List<Frame> f2 = etwo.processedFrames.stream().filter(f -> f.getMethod() == two).collect(Collectors.toList());
|
||||
List<Frame> f1 = eone.processedFrames, f2 = etwo.processedFrames;
|
||||
//List<Frame> f1 = eone.processedFrames.stream().filter(f -> f.getMethod() == one).collect(Collectors.toList());
|
||||
//List<Frame> f2 = etwo.processedFrames.stream().filter(f -> f.getMethod() == two).collect(Collectors.toList());
|
||||
|
||||
Frame p1 = null, p2 = null;
|
||||
outer:
|
||||
@@ -110,12 +125,19 @@ public class Rename
|
||||
}
|
||||
public void run(ClassGroup one, ClassGroup two)
|
||||
{
|
||||
eone = new Execution(one);
|
||||
groupOne = one;
|
||||
groupTwo = two;
|
||||
|
||||
Execution eone = new Execution(one);
|
||||
eone.setBuildGraph(true);
|
||||
eone.setFollowInvokes(false);
|
||||
eone.populateInitialMethods();
|
||||
List<Method> initial1 = eone.getInitialMethods().stream().sorted((m1, m2) -> m1.getName().compareTo(m2.getName())).collect(Collectors.toList());
|
||||
eone.run();
|
||||
|
||||
etwo = new Execution(two);
|
||||
Execution etwo = new Execution(two);
|
||||
etwo.setBuildGraph(true);
|
||||
etwo.setFollowInvokes(false);
|
||||
etwo.populateInitialMethods();
|
||||
List<Method> initial2 = etwo.getInitialMethods().stream().sorted((m1, m2) -> m1.getName().compareTo(m2.getName())).collect(Collectors.toList());
|
||||
etwo.run();
|
||||
@@ -153,6 +175,12 @@ public class Rename
|
||||
Method m = (Method) next.get();
|
||||
Method m2 = (Method) objMap.get(m);
|
||||
|
||||
if (m.getCode() == null || m2.getCode() == null)
|
||||
{
|
||||
processed.add(m);
|
||||
continue;
|
||||
}
|
||||
|
||||
System.out.println("Scanning " + m.getMethods().getClassFile().getName() + "." + m.getName() + " -> " + m2.getMethods().getClassFile().getName() + "." + m2.getName());
|
||||
process(m, m2);
|
||||
processed.add(m);
|
||||
|
||||
@@ -27,7 +27,8 @@ public class Execution
|
||||
private Encryption encryption;
|
||||
public MultiValueMap<Instruction, InstructionContext> contexts = new MultiValueMap<>();
|
||||
private Map<Method, MethodContext> methodContexts = new HashMap<>();
|
||||
private boolean buildGraph;
|
||||
private boolean buildGraph; // if true the frame graph is built and execution hasJumped also compares previous instructions
|
||||
private boolean followInvokes = true;
|
||||
|
||||
public Execution(ClassGroup group)
|
||||
{
|
||||
@@ -43,6 +44,16 @@ public class Execution
|
||||
{
|
||||
this.encryption = encryption;
|
||||
}
|
||||
|
||||
public boolean isFollowInvokes()
|
||||
{
|
||||
return followInvokes;
|
||||
}
|
||||
|
||||
public void setFollowInvokes(boolean followInvokes)
|
||||
{
|
||||
this.followInvokes = followInvokes;
|
||||
}
|
||||
|
||||
public List<Method> getInitialMethods()
|
||||
{
|
||||
@@ -104,6 +115,9 @@ public class Execution
|
||||
|
||||
public void invoke(InstructionContext from, Method to)
|
||||
{
|
||||
if (!this.isFollowInvokes())
|
||||
return;
|
||||
|
||||
if (hasInvoked(from, to))
|
||||
return;
|
||||
|
||||
@@ -112,6 +126,13 @@ public class Execution
|
||||
this.addFrame(f);
|
||||
}
|
||||
|
||||
public void addMethod(Method to)
|
||||
{
|
||||
Frame f = new Frame(this, to);
|
||||
f.initialize();
|
||||
this.addFrame(f);
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
int fcount = 0;
|
||||
|
||||
@@ -22,6 +22,13 @@ public class VariableContext
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public VariableContext(InstructionContext i, VariableContext other)
|
||||
{
|
||||
ic = i;
|
||||
ctx = other.ctx;
|
||||
type = other.type;
|
||||
}
|
||||
|
||||
public StackContext getStackContext()
|
||||
{
|
||||
return ctx;
|
||||
|
||||
Reference in New Issue
Block a user