Some thinking about execution

This commit is contained in:
Adam
2014-12-01 14:37:19 -05:00
parent 0d50085e03
commit 228f650b6c
14 changed files with 131 additions and 18 deletions

View File

@@ -0,0 +1,19 @@
package info.sigterm.deob.execution;
import info.sigterm.deob.ClassGroup;
import info.sigterm.deob.pool.Method;
public class Execution
{
private ClassGroup group;
private java.util.Stack<Frame> frames = new java.util.Stack<Frame>();
public Execution(ClassGroup group)
{
this.group = group;
}
public void run(Method method, Object... args)
{
}
}

View File

@@ -0,0 +1,23 @@
package info.sigterm.deob.execution;
import info.sigterm.deob.Method;
import info.sigterm.deob.attributes.Code;
public class Frame
{
private Execution execution;
private Method method;
private Stack stack;
private Variables variables;
public Frame(Execution execution, Method method)
{
Code code = method.getCode();
this.execution = execution;
this.method = method;
stack = new Stack(code.getMaxStack());
variables = new Variables(code.getMaxLocals());
}
}

View File

@@ -0,0 +1,28 @@
package info.sigterm.deob.execution;
public class Stack
{
private int size;
private Object[] stack;
public Stack(int sz)
{
stack = new Object[sz];
}
public void push(Object obj)
{
if (size == stack.length)
throw new RuntimeException("Stack overflow");
stack[size++] = obj;
}
public Object pop()
{
if (size <= 0)
throw new RuntimeException("Stack underflow");
return stack[--size];
}
}

View File

@@ -0,0 +1,11 @@
package info.sigterm.deob.execution;
public class Variables
{
private Object variables;
public Variables(int sz)
{
variables = new Object[sz];
}
}