More execution stuff

This commit is contained in:
Adam
2014-12-02 12:02:29 -05:00
parent 4a24560be5
commit 37dac95ee0
69 changed files with 1563 additions and 110 deletions

View File

@@ -1,12 +1,14 @@
package info.sigterm.deob.execution;
import info.sigterm.deob.ClassGroup;
import info.sigterm.deob.pool.Method;
import info.sigterm.deob.Method;
import java.util.ArrayList;
public class Execution
{
private ClassGroup group;
private java.util.Stack<Frame> frames = new java.util.Stack<Frame>();
private ArrayList<Path> paths = new ArrayList<Path>(); // paths of execution
public Execution(ClassGroup group)
{
@@ -15,5 +17,7 @@ public class Execution
public void run(Method method, Object... args)
{
Path p = new Path(this);
p.init(method, args);
}
}

View File

@@ -5,19 +5,38 @@ import info.sigterm.deob.attributes.Code;
public class Frame
{
private Execution execution;
private Path path;
private Method method;
private Stack stack;
private Variables variables;
public Frame(Execution execution, Method method)
public Frame(Path path, Method method)
{
Code code = method.getCode();
this.execution = execution;
this.path = path;
this.method = method;
stack = new Stack(code.getMaxStack());
variables = new Variables(code.getMaxLocals());
}
public Stack getStack()
{
return stack;
}
public Variables getVariables()
{
return variables;
}
public void init(Method method, Object[] args)
{
for (Object o : args)
stack.push(o);
Code code = method.getCode();
code.execute(this);
}
}

View File

@@ -0,0 +1,21 @@
package info.sigterm.deob.execution;
import info.sigterm.deob.Method;
public class Path
{
private Execution execution;
private java.util.Stack<Frame> frames = new java.util.Stack<Frame>(); // current execution frames
public Path(Execution execution)
{
this.execution = execution;
}
public void init(Method method, Object[] args)
{
Frame f = new Frame(this, method);
frames.push(f);
f.init(method, args);
}
}

View File

@@ -2,10 +2,20 @@ package info.sigterm.deob.execution;
public class Variables
{
private Object variables;
private Object[] variables;
public Variables(int sz)
{
variables = new Object[sz];
}
public void set(int index, Object value)
{
variables[index] = value;
}
public Object get(int index)
{
return variables[index];
}
}