Executor work
This commit is contained in:
@@ -115,6 +115,19 @@ public class ClassFile
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Method findMethod(String name)
|
||||
{
|
||||
Method m = methods.findMethod(name);
|
||||
if (m != null)
|
||||
return m;
|
||||
|
||||
ClassFile parent = getParent();
|
||||
if (parent != null)
|
||||
return parent.findMethod(name);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void buildClassGraph()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.sigterm.deob;
|
||||
|
||||
import info.sigterm.deob.execution.Execution;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -24,8 +26,20 @@ public class Deob
|
||||
InputStream is = jar.getInputStream(entry);
|
||||
group.addClass(entry.getName(), new DataInputStream(is));
|
||||
}
|
||||
jar.close();
|
||||
|
||||
group.buildClassGraph();
|
||||
group.buildInstructionGraph();
|
||||
|
||||
execute(group);
|
||||
}
|
||||
|
||||
private static void execute(ClassGroup group) throws IOException
|
||||
{
|
||||
ClassFile cf = group.findClass("client");
|
||||
Method method = cf.findMethod("init");
|
||||
|
||||
Execution e = new Execution(group);
|
||||
e.run(cf, method);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,14 @@ public class Methods
|
||||
return m;
|
||||
return null;
|
||||
}
|
||||
|
||||
public Method findMethod(String name)
|
||||
{
|
||||
for (Method m : methods)
|
||||
if (m.getName().equals(name))
|
||||
return m;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void buildInstructionGraph()
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Code extends Attribute
|
||||
|
||||
public int getMaxStack()
|
||||
{
|
||||
return getMaxStack();
|
||||
return maxStack;
|
||||
}
|
||||
|
||||
public int getMaxLocals()
|
||||
|
||||
@@ -174,12 +174,12 @@ public enum InstructionType
|
||||
GOTO(0xa7, "goto", Goto.class),
|
||||
TABLESWITCH(0xaa, "tableswitch", TableSwitch.class),
|
||||
LOOKUPSWITCH(0xab, "lookupswitch", LookupSwitch.class),
|
||||
IRETURN(0xac, "ireturn", Instruction.class),
|
||||
LRETURN(0xad, "lreturn", Instruction.class),
|
||||
FRETURN(0xae, "freturn", Instruction.class),
|
||||
DRETURN(0xaf, "dreturn", Instruction.class),
|
||||
ARETURN(0xb0, "areturn", Instruction.class),
|
||||
RETURN(0xb1, "return", Instruction.class),
|
||||
IRETURN(0xac, "ireturn", Return.class),
|
||||
LRETURN(0xad, "lreturn", Return.class),
|
||||
FRETURN(0xae, "freturn", Return.class),
|
||||
DRETURN(0xaf, "dreturn", Return.class),
|
||||
ARETURN(0xb0, "areturn", Return.class),
|
||||
RETURN(0xb1, "return", VReturn.class),
|
||||
GETSTATIC(0xb2, "getstatic", GetStatic.class),
|
||||
PUTSTATIC(0xb3, "putstatic", PutStatic.class),
|
||||
GETFIELD(0xb4, "getfield", GetField.class),
|
||||
@@ -192,7 +192,7 @@ public enum InstructionType
|
||||
NEWARRAY(0xbc, "newarray", NewArray.class),
|
||||
ANEWARRAY(0xbd, "anewarray", ANewArray.class),
|
||||
ARRAYLENGTH(0xbe, "arraylength", ArrayLength.class),
|
||||
ATHROW(0xbf, "athrow", Instruction.class),
|
||||
ATHROW(0xbf, "athrow", AThrow.class),
|
||||
CHECKCAST(0xc0, "checkcast", CheckCast.class),
|
||||
INSTANCEOf(0xc1, "instanceof", InstanceOf.class),
|
||||
MONITORENTER(0xc2, "monitorenter", MonitorEnter.class),
|
||||
|
||||
@@ -22,6 +22,6 @@ public class AALoad extends Instruction
|
||||
int index = (int) stack.pop();
|
||||
ArrayInstance array = (ArrayInstance) stack.pop();
|
||||
|
||||
stack.push(array.get(index));
|
||||
stack.push(this, array.get(index));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class AConstNull extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(null);
|
||||
stack.push(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ public class ALoad extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Object obj = frame.getVariables().get(index);
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class ALoad_0 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(0);
|
||||
assert obj != null;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ public class ALoad_1 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Object obj = frame.getVariables().get(1);
|
||||
assert obj != null;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ public class ALoad_2 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Object obj = frame.getVariables().get(2);
|
||||
assert obj != null;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class ALoad_3 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(3);
|
||||
assert obj != null;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ public class ANewArray extends Instruction
|
||||
ClassFile cf = thisClass.getGroup().findClass(clazz.getName());
|
||||
if (cf == null)
|
||||
{
|
||||
frame.getStack().push(null);
|
||||
frame.getStack().push(this, null);
|
||||
return;
|
||||
}
|
||||
|
||||
ClassInstance type = frame.getPath().getClassInstance(cf);
|
||||
ArrayInstance array = frame.getPath().createArray(type, count);
|
||||
|
||||
frame.getStack().push(array);
|
||||
frame.getStack().push(this, array);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ public class AStore_1 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Object obj = frame.getStack().pop();
|
||||
assert obj != null;
|
||||
frame.getVariables().set(1, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ public class AStore_2 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Object obj = frame.getStack().pop();
|
||||
assert obj != null;
|
||||
frame.getVariables().set(2, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
import info.sigterm.deob.execution.Frame;
|
||||
import info.sigterm.deob.execution.ObjectInstance;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class AThrow extends Instruction
|
||||
{
|
||||
public AThrow(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||
{
|
||||
super(instructions, type, pc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Frame e)
|
||||
{
|
||||
ObjectInstance exception = (ObjectInstance) e.getStack().pop();
|
||||
e.getPath().throwException(exception);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.attributes.code.instructions;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
import info.sigterm.deob.execution.ArrayInstance;
|
||||
import info.sigterm.deob.execution.Frame;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -17,7 +18,7 @@ public class ArrayLength extends Instruction
|
||||
@Override
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Object[] array = (Object[]) frame.getStack().pop();
|
||||
frame.getStack().push(array.length);
|
||||
ArrayInstance array = (ArrayInstance) frame.getStack().pop();
|
||||
frame.getStack().push(this, array.getLength());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class BALoad extends Instruction
|
||||
int index = (int) stack.pop();
|
||||
boolean[] array = (boolean[]) stack.pop();
|
||||
|
||||
stack.push(array[index]);
|
||||
stack.push(this, array[index]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class BiPush extends Instruction
|
||||
@Override
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
frame.getStack().push((int) b);
|
||||
frame.getStack().push(this, (int) b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class CALoad extends Instruction
|
||||
int index = (int) stack.pop();
|
||||
char[] array = (char[]) stack.pop();
|
||||
|
||||
stack.push(array[index]);
|
||||
stack.push(this, array[index]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class CheckCast extends Instruction
|
||||
ObjectInstance obj = (ObjectInstance) e.getStack().pop();
|
||||
if (obj == null)
|
||||
{
|
||||
e.getStack().push(null);
|
||||
e.getStack().push(this, null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CheckCast extends Instruction
|
||||
// XXX throw
|
||||
}
|
||||
|
||||
e.getStack().push(obj);
|
||||
e.getStack().push(this, obj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class D2F extends Instruction
|
||||
assert obj instanceof Double;
|
||||
|
||||
Double d = (Double) obj;
|
||||
stack.push(d.floatValue());
|
||||
stack.push(this, d.floatValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class D2I extends Instruction
|
||||
assert obj instanceof Double;
|
||||
|
||||
Double d = (Double) obj;
|
||||
stack.push(d.intValue());
|
||||
stack.push(this, d.intValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class D2L extends Instruction
|
||||
assert obj instanceof Double;
|
||||
|
||||
Double d = (Double) obj;
|
||||
stack.push(d.longValue());
|
||||
stack.push(this, d.longValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class DALoad extends Instruction
|
||||
int index = (int) stack.pop();
|
||||
double[] array = (double[]) stack.pop();
|
||||
|
||||
stack.push(array[index]);
|
||||
stack.push(this, array[index]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class DAdd extends Instruction
|
||||
Double two = (Double) stack.pop();
|
||||
Double one = (Double) stack.pop();
|
||||
|
||||
stack.push(one + two);
|
||||
stack.push(this, one + two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ public class DCmpG extends Instruction
|
||||
Double two = (Double) stack.pop();
|
||||
|
||||
if (one.isNaN() || two.isNaN())
|
||||
stack.push(1);
|
||||
stack.push(this, 1);
|
||||
else if (one > two)
|
||||
stack.push(1);
|
||||
stack.push(this, 1);
|
||||
else if (one < two)
|
||||
stack.push(-1);
|
||||
stack.push(this, -1);
|
||||
else
|
||||
stack.push(0);
|
||||
stack.push(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ public class DCmpL extends Instruction
|
||||
Double two = (Double) stack.pop();
|
||||
|
||||
if (one.isNaN() || two.isNaN())
|
||||
stack.push(-1);
|
||||
stack.push(this, -1);
|
||||
else if (one > two)
|
||||
stack.push(1);
|
||||
stack.push(this, 1);
|
||||
else if (one < two)
|
||||
stack.push(-1);
|
||||
stack.push(this, -1);
|
||||
else
|
||||
stack.push(0);
|
||||
stack.push(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class DConst_0 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(0d);
|
||||
stack.push(this, 0d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class DConst_1 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(1d);
|
||||
stack.push(this, 1d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class DDiv extends Instruction
|
||||
Double two = (Double) stack.pop();
|
||||
Double one = (Double) stack.pop();
|
||||
|
||||
stack.push(one / two);
|
||||
stack.push(this, one / two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ public class DLoad extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
double d = (double) frame.getVariables().get(index);
|
||||
frame.getStack().push(d);
|
||||
frame.getStack().push(this, d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class DLoad_0 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(0);
|
||||
assert obj instanceof Double;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class DLoad_1 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(1);
|
||||
assert obj instanceof Double;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class DLoad_2 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(2);
|
||||
assert obj instanceof Double;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class DLoad_3 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(3);
|
||||
assert obj instanceof Double;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class DMul extends Instruction
|
||||
Double two = (Double) stack.pop();
|
||||
Double one = (Double) stack.pop();
|
||||
|
||||
stack.push(one * two);
|
||||
stack.push(this, one * two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class DNeg extends Instruction
|
||||
Stack stack = frame.getStack();
|
||||
|
||||
Double value = (Double) stack.pop();
|
||||
stack.push(-value);
|
||||
stack.push(this, -value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class DRem extends Instruction
|
||||
Double two = (Double) stack.pop();
|
||||
Double one = (Double) stack.pop();
|
||||
|
||||
stack.push(one % two);
|
||||
stack.push(this, one % two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class DSub extends Instruction
|
||||
Double two = (Double) stack.pop();
|
||||
Double one = (Double) stack.pop();
|
||||
|
||||
stack.push(one - two);
|
||||
stack.push(this, one - two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class Dup extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Object obj = frame.getStack().pop();
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ public class Dup2 extends Instruction
|
||||
two = stack.pop();
|
||||
|
||||
if (!(one instanceof Double) && !(one instanceof Long))
|
||||
stack.push(two);
|
||||
stack.push(one);
|
||||
stack.push(this, two);
|
||||
stack.push(this, one);
|
||||
|
||||
if (!(one instanceof Double) && !(one instanceof Long))
|
||||
stack.push(two);
|
||||
stack.push(one);
|
||||
stack.push(this, two);
|
||||
stack.push(this, one);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ public class Dup2_X1 extends Instruction
|
||||
Object three = stack.pop();
|
||||
|
||||
if (!(one instanceof Double) && !(one instanceof Long))
|
||||
stack.push(two);
|
||||
stack.push(one);
|
||||
stack.push(this, two);
|
||||
stack.push(this, one);
|
||||
|
||||
stack.push(three);
|
||||
stack.push(this, three);
|
||||
|
||||
if (!(one instanceof Double) && !(one instanceof Long))
|
||||
stack.push(two);
|
||||
stack.push(one);
|
||||
stack.push(this, two);
|
||||
stack.push(this, one);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,15 +30,15 @@ public class Dup2_X2 extends Instruction
|
||||
four = stack.pop();
|
||||
|
||||
if (!(one instanceof Double) && !(one instanceof Long))
|
||||
stack.push(two);
|
||||
stack.push(one);
|
||||
stack.push(this, two);
|
||||
stack.push(this, one);
|
||||
|
||||
if (!(three instanceof Double) && !(three instanceof Long))
|
||||
stack.push(four);
|
||||
stack.push(three);
|
||||
stack.push(this, four);
|
||||
stack.push(this, three);
|
||||
|
||||
if (!(one instanceof Double) && !(one instanceof Long))
|
||||
stack.push(two);
|
||||
stack.push(one);
|
||||
stack.push(this, two);
|
||||
stack.push(this, one);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ public class Dup_X1 extends Instruction
|
||||
Object one = stack.pop();
|
||||
Object two = stack.pop();
|
||||
|
||||
stack.push(one);
|
||||
stack.push(two);
|
||||
stack.push(one);
|
||||
stack.push(this, one);
|
||||
stack.push(this, two);
|
||||
stack.push(this, one);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ public class Dup_X2 extends Instruction
|
||||
if (!(two instanceof Double) && !(two instanceof Long))
|
||||
three = stack.pop();
|
||||
|
||||
stack.push(one);
|
||||
stack.push(this, one);
|
||||
if (!(two instanceof Double) && !(two instanceof Long))
|
||||
stack.push(three);
|
||||
stack.push(two);
|
||||
stack.push(one);
|
||||
stack.push(this, three);
|
||||
stack.push(this, two);
|
||||
stack.push(this, one);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class F2D extends Instruction
|
||||
assert obj instanceof Float;
|
||||
|
||||
Float f = (Float) obj;
|
||||
stack.push(f.doubleValue());
|
||||
stack.push(this, f.doubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class F2I extends Instruction
|
||||
assert obj instanceof Float;
|
||||
|
||||
Float f = (Float) obj;
|
||||
stack.push(f.intValue());
|
||||
stack.push(this, f.intValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class F2L extends Instruction
|
||||
assert obj instanceof Float;
|
||||
|
||||
Float f = (Float) obj;
|
||||
stack.push(f.longValue());
|
||||
stack.push(this, f.longValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class FALoad extends Instruction
|
||||
int index = (int) stack.pop();
|
||||
float[] array = (float[]) stack.pop();
|
||||
|
||||
stack.push(array[index]);
|
||||
stack.push(this, array[index]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class FAdd extends Instruction
|
||||
Float one = (Float) stack.pop();
|
||||
Float two = (Float) stack.pop();
|
||||
|
||||
stack.push(one + two);
|
||||
stack.push(this, one + two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ public class FCmpG extends Instruction
|
||||
Float two = (Float) stack.pop();
|
||||
|
||||
if (one.isNaN() || two.isNaN())
|
||||
stack.push(1);
|
||||
stack.push(this, 1);
|
||||
else if (one > two)
|
||||
stack.push(1);
|
||||
stack.push(this, 1);
|
||||
else if (one < two)
|
||||
stack.push(-1);
|
||||
stack.push(this, -1);
|
||||
else
|
||||
stack.push(0);
|
||||
stack.push(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ public class FCmpL extends Instruction
|
||||
Float two = (Float) stack.pop();
|
||||
|
||||
if (one.isNaN() || two.isNaN())
|
||||
stack.push(-1);
|
||||
stack.push(this, -1);
|
||||
else if (one > two)
|
||||
stack.push(1);
|
||||
stack.push(this, 1);
|
||||
else if (one < two)
|
||||
stack.push(-1);
|
||||
stack.push(this, -1);
|
||||
else
|
||||
stack.push(0);
|
||||
stack.push(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class FConst_0 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(0f);
|
||||
stack.push(this, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class FConst_1 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(1f);
|
||||
stack.push(this, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class FConst_2 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(2f);
|
||||
stack.push(this, 2f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class FDiv extends Instruction
|
||||
Float two = (Float) stack.pop();
|
||||
Float one = (Float) stack.pop();
|
||||
|
||||
stack.push(one / two);
|
||||
stack.push(this, one / two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ public class FLoad extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
float f = (float) frame.getVariables().get(index);
|
||||
frame.getStack().push(f);
|
||||
frame.getStack().push(this, f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class FLoad_0 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(0);
|
||||
assert obj instanceof Float;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class FLoad_1 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(1);
|
||||
assert obj instanceof Float;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class FLoad_2 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(2);
|
||||
assert obj instanceof Float;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class FLoad_3 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(3);
|
||||
assert obj instanceof Float;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class FMul extends Instruction
|
||||
Float two = (Float) stack.pop();
|
||||
Float one = (Float) stack.pop();
|
||||
|
||||
stack.push(one * two);
|
||||
stack.push(this, one * two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class FNeg extends Instruction
|
||||
Stack stack = frame.getStack();
|
||||
|
||||
Float value = (Float) stack.pop();
|
||||
stack.push(-value);
|
||||
stack.push(this, -value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class FRem extends Instruction
|
||||
Float two = (Float) stack.pop();
|
||||
Float one = (Float) stack.pop();
|
||||
|
||||
stack.push(one % two);
|
||||
stack.push(this, one % two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class FSub extends Instruction
|
||||
Float two = (Float) stack.pop();
|
||||
Float one = (Float) stack.pop();
|
||||
|
||||
stack.push(one - two);
|
||||
stack.push(this, one - two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,13 @@ public class GetField extends Instruction
|
||||
|
||||
NameAndType nat = entry.getNameAndType();
|
||||
|
||||
if (object == null)
|
||||
{
|
||||
frame.getStack().push(this, null);
|
||||
return;
|
||||
}
|
||||
|
||||
FieldInstance field = object.getField(nat);
|
||||
frame.getStack().push(field.getValue());
|
||||
frame.getStack().push(this, field.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class GetStatic extends Instruction
|
||||
if (cf == null)
|
||||
{
|
||||
Object ovalue = nat.getStackObject();
|
||||
frame.getStack().push(ovalue);
|
||||
frame.getStack().push(this, ovalue);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class GetStatic extends Instruction
|
||||
StaticFieldInstance fi = ci.findStaticField(nat);
|
||||
Object ovalue = fi.getValue();
|
||||
|
||||
frame.getStack().push(ovalue);
|
||||
frame.getStack().push(this, ovalue);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,6 @@ public class I2B extends Instruction
|
||||
assert obj instanceof Integer;
|
||||
|
||||
Integer i = (Integer) obj;
|
||||
stack.push(i.byteValue());
|
||||
stack.push(this, i.byteValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class I2C extends Instruction
|
||||
assert obj instanceof Integer;
|
||||
|
||||
Integer i = (Integer) obj;
|
||||
stack.push((char) i.intValue());
|
||||
stack.push(this, (char) i.intValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class I2D extends Instruction
|
||||
assert obj instanceof Integer;
|
||||
|
||||
Integer i = (Integer) obj;
|
||||
stack.push(i.doubleValue());
|
||||
stack.push(this, i.doubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class I2F extends Instruction
|
||||
assert obj instanceof Integer;
|
||||
|
||||
Integer i = (Integer) obj;
|
||||
stack.push(i.floatValue());
|
||||
stack.push(this, i.floatValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class I2L extends Instruction
|
||||
assert obj instanceof Integer;
|
||||
|
||||
Integer i = (Integer) obj;
|
||||
stack.push(i.longValue());
|
||||
stack.push(this, i.longValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class I2S extends Instruction
|
||||
assert obj instanceof Integer;
|
||||
|
||||
Integer i = (Integer) obj;
|
||||
stack.push(i.shortValue());
|
||||
stack.push(this, i.shortValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class IALoad extends Instruction
|
||||
int index = (int) stack.pop();
|
||||
int[] array = (int[]) stack.pop();
|
||||
|
||||
stack.push(array[index]);
|
||||
stack.push(this, array[index]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class IAdd extends Instruction
|
||||
Integer two = (Integer) stack.pop();
|
||||
Integer one = (Integer) stack.pop();
|
||||
|
||||
stack.push(one + two);
|
||||
stack.push(this, one + two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ public class IAnd extends Instruction
|
||||
|
||||
Integer two = (Integer) stack.pop();
|
||||
Integer one = (Integer) stack.pop();
|
||||
stack.push(one & two);
|
||||
stack.push(this, one & two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class IConst_0 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(0);
|
||||
stack.push(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class IConst_1 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(1);
|
||||
stack.push(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class IConst_2 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(2);
|
||||
stack.push(this, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class IConst_3 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(3);
|
||||
stack.push(this, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class IConst_4 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(4);
|
||||
stack.push(this, 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class IConst_5 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(5);
|
||||
stack.push(this, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class IConst_M1 extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
stack.push(-1);
|
||||
stack.push(this, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class IDiv extends Instruction
|
||||
Double two = (Double) stack.pop();
|
||||
Double one = (Double) stack.pop();
|
||||
|
||||
stack.push(one / two);
|
||||
stack.push(this, one / two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ public class ILoad extends Instruction
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
int i = (int) frame.getVariables().get(index);
|
||||
frame.getStack().push(i);
|
||||
frame.getStack().push(this, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class ILoad_0 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(0);
|
||||
assert obj instanceof Integer;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class ILoad_1 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(1);
|
||||
assert obj instanceof Integer;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class ILoad_2 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(2);
|
||||
assert obj instanceof Integer;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class ILoad_3 extends Instruction
|
||||
{
|
||||
Object obj = frame.getVariables().get(3);
|
||||
assert obj instanceof Integer;
|
||||
frame.getStack().push(obj);
|
||||
frame.getStack().push(this, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class IMul extends Instruction
|
||||
Integer two = (Integer) stack.pop();
|
||||
Integer one = (Integer) stack.pop();
|
||||
|
||||
stack.push(one * two);
|
||||
stack.push(this, one * two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class INeg extends Instruction
|
||||
Stack stack = frame.getStack();
|
||||
|
||||
Integer value = (Integer) stack.pop();
|
||||
stack.push(-value);
|
||||
stack.push(this, -value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ public class IOr extends Instruction
|
||||
|
||||
Integer two = (Integer) stack.pop();
|
||||
Integer one = (Integer) stack.pop();
|
||||
stack.push(one | two);
|
||||
stack.push(this, one | two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class IRem extends Instruction
|
||||
Integer two = (Integer) stack.pop();
|
||||
Integer one = (Integer) stack.pop();
|
||||
|
||||
stack.push(one % two);
|
||||
stack.push(this, one % two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ public class IShL extends Instruction
|
||||
|
||||
Integer two = (Integer) stack.pop();
|
||||
Integer one = (Integer) stack.pop();
|
||||
stack.push(one << (two & 0x1F));
|
||||
stack.push(this, one << (two & 0x1F));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ public class IShR extends Instruction
|
||||
|
||||
Integer two = (Integer) stack.pop();
|
||||
Integer one = (Integer) stack.pop();
|
||||
stack.push(one >> (two & 0x1F));
|
||||
stack.push(this, one >> (two & 0x1F));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class ISub extends Instruction
|
||||
Integer two = (Integer) stack.pop();
|
||||
Integer one = (Integer) stack.pop();
|
||||
|
||||
stack.push(one - two);
|
||||
stack.push(this, one - two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ public class IUShR extends Instruction
|
||||
|
||||
Integer two = (Integer) stack.pop();
|
||||
Integer one = (Integer) stack.pop();
|
||||
stack.push(one >>> (two & 0x1F));
|
||||
stack.push(this, one >>> (two & 0x1F));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ public class IXor extends Instruction
|
||||
|
||||
Integer two = (Integer) stack.pop();
|
||||
Integer one = (Integer) stack.pop();
|
||||
stack.push(one ^ two);
|
||||
stack.push(this, one ^ two);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ public class InstanceOf extends Instruction
|
||||
ObjectInstanceBase obj = (ObjectInstanceBase) e.getStack().pop();
|
||||
if (obj == null)
|
||||
{
|
||||
e.getStack().push(0);
|
||||
e.getStack().push(this, 0);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
ClassFile otherClass = thisClass.getGroup().findClass(clazz.getName());
|
||||
boolean instanceOf = obj.getType().getClassFile().instanceOf(otherClass);
|
||||
e.getStack().push(instanceOf ? 1 : 0);
|
||||
e.getStack().push(this, instanceOf ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user