new execute stuff

This commit is contained in:
Adam
2015-05-31 16:03:37 -04:00
parent 1e34e0ec66
commit 0fcbcd262c
205 changed files with 2977 additions and 1451 deletions

View File

@@ -136,12 +136,6 @@ public class ConstantPool
return (NameAndType) getEntry(index);
}
public Object get(int index)
{
PoolEntry entry = getEntry(index);
return entry.getObject();
}
public int make(PoolEntry entry)
{
int i = 1;

View File

@@ -1,6 +1,9 @@
package info.sigterm.deob;
import info.sigterm.deob.execution.Execution;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.pool.NameAndType;
import info.sigterm.deob.attributes.Code;
import info.sigterm.deob.attributes.code.Block;
@@ -50,7 +53,7 @@ public class Deob
checkBlockGraph(group);
//checkParameters(group);
//execute(group);
execute(group);
JarOutputStream jout = new JarOutputStream(new FileOutputStream(args[1]), new Manifest());
@@ -71,11 +74,21 @@ public class Deob
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);
int count = 0, fcount = 0;
for (ClassFile cf : group.getClasses())
for (Method method : cf.getMethods().getMethods())
{
if (method.getCode() == null)
continue;
Frame f = new Frame(e, method);
e.frames.add(f);
fcount += e.run();
++count;
}
System.out.println("Processed " + count + " methods and " + fcount + " paths");
}
private static void checkCallGraph(ClassGroup group)

View File

@@ -50,6 +50,11 @@ public abstract class Instruction
return instructions;
}
public InstructionType getType()
{
return type;
}
public ConstantPool getPool()
{
return instructions.getCode().getAttributes().getClassFile().getPool();

View File

@@ -0,0 +1,9 @@
package info.sigterm.deob.attributes.code.instruction.types;
import java.io.DataOutputStream;
import java.io.IOException;
public interface WideInstruction
{
public void writeWide(DataOutputStream out, int pc) throws IOException;
}

View File

@@ -3,9 +3,10 @@ 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 info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class AALoad extends Instruction
{
@@ -17,14 +18,17 @@ public class AALoad extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
int index = (int) stack.pop();
ArrayInstance array = (ArrayInstance) stack.pop();
StackContext index = stack.pop();
StackContext array = stack.pop();
if (index >= 0 && index < array.getLength())
stack.push(this, array.get(index));
else
frame.getPath().throwException(this, null);
ins.pop(index, array);
StackContext ctx = new StackContext(ins, array.getType().getSubtype());
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -3,9 +3,10 @@ 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 info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class AAStore extends Instruction
{
@@ -17,15 +18,17 @@ public class AAStore extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object value = stack.pop();
int index = (int) stack.pop();
ArrayInstance array = (ArrayInstance) stack.pop();
StackContext value = stack.pop();
StackContext index = stack.pop();
StackContext array = stack.pop();
if (array == null)
return;
ins.pop(value);
ins.pop(index);
ins.pop(array);
array.put(value, index);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,7 +20,12 @@ public class AConstNull extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
stack.push(this, null);
StackContext ctx = new StackContext(ins, Object.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,13 +4,19 @@ 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.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.attributes.code.instruction.types.WideInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class ALoad extends Instruction implements LVTInstruction
public class ALoad extends Instruction implements LVTInstruction, WideInstruction
{
private int index;
@@ -23,6 +29,15 @@ public class ALoad extends Instruction implements LVTInstruction
length += 1;
}
public ALoad(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
{
super(instructions, type, pc);
DataInputStream is = instructions.getCode().getAttributes().getStream();
index = is.readShort();
length += 2;
}
@Override
public void write(DataOutputStream out, int pc) throws IOException
{
@@ -33,8 +48,17 @@ public class ALoad extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(index);
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables var = frame.getVariables();
VariableContext vctx = var.get(index);
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override
@@ -48,4 +72,11 @@ public class ALoad extends Instruction implements LVTInstruction
{
return false;
}
@Override
public void writeWide(DataOutputStream out, int pc) throws IOException
{
super.write(out, pc);
out.writeShort(index);
}
}

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,8 +23,17 @@ public class ALoad_0 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(0);
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables var = frame.getVariables();
VariableContext vctx = var.get(0);
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,8 +23,17 @@ public class ALoad_1 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(1);
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables var = frame.getVariables();
VariableContext vctx = var.get(1);
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,8 +23,17 @@ public class ALoad_2 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(2);
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables var = frame.getVariables();
VariableContext vctx = var.get(2);
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,8 +23,17 @@ public class ALoad_3 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(3);
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables var = frame.getVariables();
VariableContext vctx = var.get(3);
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -1,12 +1,13 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.ClassFile;
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.ClassInstance;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.pool.Class;
import java.io.DataInputStream;
@@ -37,20 +38,17 @@ public class ANewArray extends Instruction
@Override
public void execute(Frame frame)
{
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile();
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
int count = (int) frame.getStack().pop();
StackContext count = stack.pop();
ClassFile cf = thisClass.getGroup().findClass(clazz.getName());
if (cf == null)
{
frame.getStack().push(this, null);
return;
}
ins.pop(count);
ClassInstance type = frame.getPath().getClassInstance(cf);
ArrayInstance array = frame.getPath().createArray(type, count);
Type t = new Type(new info.sigterm.deob.signature.Type("[" + clazz.getName()));
StackContext ctx = new StackContext(ins, t);
stack.push(ctx);
frame.getStack().push(this, array);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,13 +4,19 @@ 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.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.attributes.code.instruction.types.WideInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class AStore extends Instruction implements LVTInstruction
public class AStore extends Instruction implements LVTInstruction, WideInstruction
{
private int index;
@@ -23,6 +29,15 @@ public class AStore extends Instruction implements LVTInstruction
length += 1;
}
public AStore(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
{
super(instructions, type, pc);
DataInputStream is = instructions.getCode().getAttributes().getStream();
index = is.readShort();
length += 2;
}
@Override
public void write(DataOutputStream out, int pc) throws IOException
{
@@ -33,8 +48,16 @@ public class AStore extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
frame.getVariables().set(index, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext object = stack.pop();
ins.pop(object);
variables.set(index, new VariableContext(ins, object.getType()));
frame.addInstructionContext(ins);
}
@Override
@@ -48,4 +71,11 @@ public class AStore extends Instruction implements LVTInstruction
{
return true;
}
@Override
public void writeWide(DataOutputStream out, int pc) throws IOException
{
super.write(out, pc);
out.writeShort(index);
}
}

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,8 +23,16 @@ public class AStore_0 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
frame.getVariables().set(0, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext object = stack.pop();
ins.pop(object);
variables.set(0, new VariableContext(ins, object.getType()));
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,8 +23,16 @@ public class AStore_1 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
frame.getVariables().set(1, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext object = stack.pop();
ins.pop(object);
variables.set(1, new VariableContext(ins, object.getType()));
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,8 +23,16 @@ public class AStore_2 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
frame.getVariables().set(2, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext object = stack.pop();
ins.pop(object);
variables.set(2, new VariableContext(ins, object.getType()));
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,8 +23,16 @@ public class AStore_3 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
frame.getVariables().set(3, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext object = stack.pop();
ins.pop(object);
variables.set(3, new VariableContext(ins, object.getType()));
frame.addInstructionContext(ins);
}
@Override

View File

@@ -4,7 +4,9 @@ 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 info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -16,10 +18,18 @@ public class AThrow extends Instruction
}
@Override
public void execute(Frame e)
public void execute(Frame frame)
{
ObjectInstance exception = (ObjectInstance) e.getStack().pop();
e.getPath().throwException(this, exception);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
// XXX this actually clears the stack and puts only the value on, after jumping to the handler
//StackContext value = stack.pop();
//ins.pop(value);
frame.addInstructionContext(ins);
frame.throwException(null);//value.getType());
}
@Override

View File

@@ -3,8 +3,10 @@ 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 info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,7 +20,16 @@ public class ArrayLength extends Instruction
@Override
public void execute(Frame frame)
{
ArrayInstance array = (ArrayInstance) frame.getStack().pop();
frame.getStack().push(this, array.getLength());
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
StackContext array = stack.pop();
ins.pop(array);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class BALoad extends Instruction
{
@@ -16,11 +18,17 @@ public class BALoad extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
int index = (int) stack.pop();
boolean[] array = (boolean[]) stack.pop();
StackContext index = stack.pop();
StackContext array = stack.pop();
stack.push(this, array[index]);
ins.pop(index, array);
StackContext ctx = new StackContext(ins, int.class); // sign extend
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class BAStore extends Instruction
{
@@ -16,12 +18,15 @@ public class BAStore extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
boolean value = (boolean) stack.pop();
int index = (int) stack.pop();
boolean[] array = (boolean[]) stack.pop();
StackContext value = stack.pop();
StackContext index = stack.pop();
StackContext array = stack.pop();
array[index] = value;
ins.pop(value, index, array);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,6 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@@ -32,6 +35,12 @@ public class BiPush extends Instruction
@Override
public void execute(Frame frame)
{
frame.getStack().push(this, (int) b);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
StackContext ctx = new StackContext(ins, int.class); // bipush sign extends the value to an int
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class CALoad extends Instruction
{
@@ -16,11 +18,17 @@ public class CALoad extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
int index = (int) stack.pop();
char[] array = (char[]) stack.pop();
StackContext index = stack.pop();
StackContext array = stack.pop();
stack.push(this, array[index]);
ins.pop(index, array);
StackContext ctx = new StackContext(ins, int.class); // zero extended to int
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class CAStore extends Instruction
{
@@ -16,12 +18,15 @@ public class CAStore extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
char value = (char) stack.pop();
int index = (int) stack.pop();
char[] array = (char[]) stack.pop();
StackContext value = stack.pop();
StackContext index = stack.pop();
StackContext array = stack.pop();
array[index] = value;
ins.pop(value, index, array);
frame.addInstructionContext(ins);
}
}

View File

@@ -6,7 +6,10 @@ 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 info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.pool.Class;
import java.io.DataInputStream;
@@ -34,28 +37,18 @@ public class CheckCast extends Instruction
}
@Override
public void execute(Frame e)
public void execute(Frame frame)
{
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile();
ConstantPool pool = thisClass.getPool();
Frame other = frame.dup();
Stack stack = other.getStack();
ObjectInstance obj = (ObjectInstance) e.getStack().pop();
if (obj == null)
{
e.getStack().push(this, null);
return;
}
InstructionContext ins = new InstructionContext(this, other);
ClassFile otherClass = thisClass.getGroup().findClass(clazz.getName());
boolean instanceOf = obj.getType().getClassFile().instanceOf(otherClass);
StackContext what = stack.pop();
if (!instanceOf)
{
// XXX throw
}
ins.pop(what);
e.getStack().push(this, obj);
other.throwException(new Type("java.lang.ClassCastException"));
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,12 +20,16 @@ public class D2F extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Double;
Double d = (Double) obj;
stack.push(this, d.floatValue());
StackContext value = stack.pop();
ins.pop(value);
StackContext ctx = new StackContext(ins, float.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,12 +20,16 @@ public class D2I extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Double;
Double d = (Double) obj;
stack.push(this, d.intValue());
StackContext value = stack.pop();
ins.pop(value);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,12 +20,16 @@ public class D2L extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Double;
Double d = (Double) obj;
stack.push(this, d.longValue());
StackContext value = stack.pop();
ins.pop(value);
StackContext ctx = new StackContext(ins, long.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DALoad extends Instruction
{
@@ -16,11 +18,17 @@ public class DALoad extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
int index = (int) stack.pop();
double[] array = (double[]) stack.pop();
StackContext index = stack.pop();
StackContext array = stack.pop();
stack.push(this, array[index]);
ins.pop(index, array);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DAStore extends Instruction
{
@@ -16,12 +18,15 @@ public class DAStore extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
double value = (double) stack.pop();
int index = (int) stack.pop();
double[] array = (double[]) stack.pop();
StackContext value = stack.pop();
StackContext index = stack.pop();
StackContext array = stack.pop();
array[index] = value;
ins.pop(value, index, array);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DAdd extends Instruction
{
@@ -16,11 +18,17 @@ public class DAdd extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Double two = (Double) stack.pop();
Double one = (Double) stack.pop();
StackContext two = stack.pop();
StackContext one = stack.pop();
stack.push(this, one + two);
ins.pop(two, one);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,18 +20,17 @@ public class DCmpG extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Double one = (Double) stack.pop();
Double two = (Double) stack.pop();
if (one.isNaN() || two.isNaN())
stack.push(this, 1);
else if (one > two)
stack.push(this, 1);
else if (one < two)
stack.push(this, -1);
else
stack.push(this, 0);
StackContext one = stack.pop();
StackContext two = stack.pop();
ins.pop(one, two);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,18 +20,17 @@ public class DCmpL extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Double one = (Double) stack.pop();
Double two = (Double) stack.pop();
if (one.isNaN() || two.isNaN())
stack.push(this, -1);
else if (one > two)
stack.push(this, 1);
else if (one < two)
stack.push(this, -1);
else
stack.push(this, 0);
StackContext one = stack.pop();
StackContext two = stack.pop();
ins.pop(one, two);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,7 +20,12 @@ public class DConst_0 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
stack.push(this, 0d);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,7 +20,12 @@ public class DConst_1 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
stack.push(this, 1d);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DDiv extends Instruction
{
@@ -16,11 +18,17 @@ public class DDiv extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Double two = (Double) stack.pop();
Double one = (Double) stack.pop();
StackContext one = stack.pop();
StackContext two = stack.pop();
stack.push(this, one / two);
ins.pop(one, two);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,13 +4,20 @@ 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.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.attributes.code.instruction.types.WideInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class DLoad extends Instruction implements LVTInstruction
public class DLoad extends Instruction implements LVTInstruction, WideInstruction
{
private int index;
@@ -23,6 +30,15 @@ public class DLoad extends Instruction implements LVTInstruction
length += 1;
}
public DLoad(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
{
super(instructions, type, pc);
DataInputStream is = instructions.getCode().getAttributes().getStream();
index = is.readShort();
length += 2;
}
@Override
public void write(DataOutputStream out, int pc) throws IOException
{
@@ -33,8 +49,18 @@ public class DLoad extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
double d = (double) frame.getVariables().get(index);
frame.getStack().push(this, d);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
VariableContext vctx = variables.get(index);
assert vctx.getType().equals(new Type(double.class.getName()));
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override
@@ -48,4 +74,11 @@ public class DLoad extends Instruction implements LVTInstruction
{
return false;
}
@Override
public void writeWide(DataOutputStream out, int pc) throws IOException
{
super.write(out, pc);
out.writeShort(index);
}
}

View File

@@ -5,6 +5,12 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +24,18 @@ public class DLoad_0 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(0);
assert obj instanceof Double;
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
VariableContext vctx = variables.get(0);
assert vctx.getType().equals(new Type(double.class.getName()));
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,12 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +24,18 @@ public class DLoad_1 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(1);
assert obj instanceof Double;
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
VariableContext vctx = variables.get(1);
assert vctx.getType().equals(new Type(double.class.getName()));
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,12 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +24,18 @@ public class DLoad_2 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(2);
assert obj instanceof Double;
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
VariableContext vctx = variables.get(2);
assert vctx.getType().equals(new Type(double.class.getName()));
ins.read(vctx);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,12 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +24,18 @@ public class DLoad_3 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(3);
assert obj instanceof Double;
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
VariableContext vctx = variables.get(3);
assert vctx.getType().equals(new Type(double.class.getName()));
ins.read(vctx);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DMul extends Instruction
{
@@ -16,11 +18,17 @@ public class DMul extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Double two = (Double) stack.pop();
Double one = (Double) stack.pop();
StackContext one = stack.pop();
StackContext two = stack.pop();
stack.push(this, one * two);
ins.pop(one, two);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DNeg extends Instruction
{
@@ -16,9 +18,15 @@ public class DNeg extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Double value = (Double) stack.pop();
stack.push(this, -value);
StackContext value = stack.pop();
ins.pop(value);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DRem extends Instruction
{
@@ -16,11 +18,17 @@ public class DRem extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Double two = (Double) stack.pop();
Double one = (Double) stack.pop();
StackContext one = stack.pop();
StackContext two = stack.pop();
stack.push(this, one % two);
ins.pop(one, two);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,13 +4,19 @@ 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.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.attributes.code.instruction.types.WideInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class DStore extends Instruction implements LVTInstruction
public class DStore extends Instruction implements LVTInstruction, WideInstruction
{
private int index;
@@ -23,6 +29,15 @@ public class DStore extends Instruction implements LVTInstruction
length += 1;
}
public DStore(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
{
super(instructions, type, pc);
DataInputStream is = instructions.getCode().getAttributes().getStream();
index = is.readShort();
length += 2;
}
@Override
public void write(DataOutputStream out, int pc) throws IOException
{
@@ -33,8 +48,16 @@ public class DStore extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
double d = (double) frame.getStack().pop();
frame.getVariables().set(index, d);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(index, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
}
@Override
@@ -48,4 +71,11 @@ public class DStore extends Instruction implements LVTInstruction
{
return true;
}
@Override
public void writeWide(DataOutputStream out, int pc) throws IOException
{
super.write(out, pc);
out.writeShort(index);
}
}

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +23,16 @@ public class DStore_0 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
assert obj instanceof Double;
frame.getVariables().set(0, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(0, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +23,16 @@ public class DStore_1 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
assert obj instanceof Double;
frame.getVariables().set(1, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(1, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +23,16 @@ public class DStore_2 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
assert obj instanceof Double;
frame.getVariables().set(2, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(2, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +23,16 @@ public class DStore_3 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
assert obj instanceof Double;
frame.getVariables().set(3, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(3, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
}
@Override

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DSub extends Instruction
{
@@ -16,11 +18,17 @@ public class DSub extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Double two = (Double) stack.pop();
Double one = (Double) stack.pop();
StackContext two = stack.pop();
StackContext one = stack.pop();
stack.push(this, one - two);
ins.pop(two, one);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,6 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -17,8 +20,18 @@ public class Dup extends Instruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
frame.getStack().push(this, obj);
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
StackContext obj = stack.pop();
ins.pop(obj);
StackContext ctx = new StackContext(ins, obj.getType());
stack.push(ctx);
ctx = new StackContext(ins, obj.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,10 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import java.io.IOException;
@@ -18,19 +21,36 @@ public class Dup2 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object one = stack.pop();
Object two = null;
if (!(one instanceof Double) && !(one instanceof Long))
StackContext one = stack.pop();
StackContext two = null;
if (!one.getType().equals(new Type(double.class.getCanonicalName())) && !one.getType().equals(new Type(long.class.getCanonicalName())))
two = stack.pop();
ins.pop(one);
if (two != null)
ins.pop(two);
if (two != null)
{
StackContext ctx = new StackContext(ins, two.getType());
stack.push(ctx);
}
StackContext ctx = new StackContext(ins, one.getType());
stack.push(one);
if (!(one instanceof Double) && !(one instanceof Long))
stack.push(this, two);
stack.push(this, one);
if (!(one instanceof Double) && !(one instanceof Long))
stack.push(this, two);
stack.push(this, one);
if (two != null)
{
ctx = new StackContext(ins, two.getType());
stack.push(ctx);
}
ctx = new StackContext(ins, one.getType());
stack.push(one);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,10 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import java.io.IOException;
@@ -18,22 +21,41 @@ public class Dup2_X1 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object one = stack.pop();
Object two = null;
if (!(one instanceof Double) && !(one instanceof Long))
StackContext one = stack.pop();
StackContext two = null;
if (!one.getType().equals(new Type(double.class.getCanonicalName())) && !one.getType().equals(new Type(long.class.getCanonicalName())))
two = stack.pop();
Object three = stack.pop();
if (!(one instanceof Double) && !(one instanceof Long))
stack.push(this, two);
stack.push(this, one);
stack.push(this, three);
if (!(one instanceof Double) && !(one instanceof Long))
stack.push(this, two);
stack.push(this, one);
StackContext three = stack.pop();
ins.pop(one);
if (two != null)
ins.pop(two);
ins.pop(three);
if (two != null)
{
StackContext ctx = new StackContext(ins, two.getType());
stack.push(ctx);
}
StackContext ctx = new StackContext(ins, one.getType());
stack.push(ctx);
ctx = new StackContext(ins, three.getType());
stack.push(ctx);
if (two != null)
{
ctx = new StackContext(ins, two.getType());
stack.push(ctx);
}
ctx = new StackContext(ins, one.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,10 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import java.io.IOException;
@@ -18,27 +21,52 @@ public class Dup2_X2 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object one = stack.pop();
Object two = null;
if (!(one instanceof Double) && !(one instanceof Long))
StackContext one = stack.pop();
StackContext two = null;
if (!one.getType().equals(new Type(double.class.getCanonicalName())) && !one.getType().equals(new Type(long.class.getCanonicalName())))
two = stack.pop();
Object three = stack.pop();
Object four = null;
if (!(three instanceof Double) && !(three instanceof Long))
StackContext three = stack.pop();
StackContext four = null;
if (!three.getType().equals(new Type(double.class.getCanonicalName())) && !three.getType().equals(new Type(long.class.getCanonicalName())))
four = stack.pop();
if (!(one instanceof Double) && !(one instanceof Long))
stack.push(this, two);
stack.push(this, one);
if (!(three instanceof Double) && !(three instanceof Long))
stack.push(this, four);
stack.push(this, three);
if (!(one instanceof Double) && !(one instanceof Long))
stack.push(this, two);
stack.push(this, one);
ins.pop(one);
if (two != null)
ins.pop(two);
ins.pop(three);
if (four != null)
ins.pop(four);
if (two != null)
{
StackContext ctx = new StackContext(ins, two.getType());
stack.push(ctx);
}
StackContext ctx = new StackContext(ins, one.getType());
stack.push(one);
if (four != null)
{
ctx = new StackContext(ins, four.getType());
stack.push(ctx);
}
ctx = new StackContext(ins, three.getType());
stack.push(one);
if (two != null)
{
ctx = new StackContext(ins, two.getType());
stack.push(ctx);
}
ctx = new StackContext(ins, one.getType());
stack.push(one);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,13 +20,23 @@ public class Dup_X1 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object one = stack.pop();
Object two = stack.pop();
stack.push(this, one);
stack.push(this, two);
stack.push(this, one);
StackContext one = stack.pop();
StackContext two = stack.pop();
ins.pop(one, two);
StackContext ctx = new StackContext(ins, one.getType());
stack.push(ctx);
ctx = new StackContext(ins, two.getType());
stack.push(ctx);
ctx = new StackContext(ins, one.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,10 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import java.io.IOException;
@@ -18,18 +21,34 @@ public class Dup_X2 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object one = stack.pop();
Object two = stack.pop();
Object three = null;
if (!(two instanceof Double) && !(two instanceof Long))
StackContext one = stack.pop();
StackContext two = stack.pop();
StackContext three = null;
if (!two.getType().equals(new Type(double.class.getCanonicalName())) && !two.getType().equals(new Type(long.class.getCanonicalName())))
three = stack.pop();
stack.push(this, one);
if (!(two instanceof Double) && !(two instanceof Long))
stack.push(this, three);
stack.push(this, two);
stack.push(this, one);
ins.pop(one, two);
if (three != null)
ins.pop(three);
StackContext ctx = new StackContext(ins, one.getType());
stack.push(ctx);
if (three != null)
{
ctx = new StackContext(ins, three.getType());
stack.push(ctx);
}
ctx = new StackContext(ins, two.getType());
stack.push(ctx);
ctx = new StackContext(ins, one.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,12 +20,15 @@ public class F2D extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Float;
Float f = (Float) obj;
stack.push(this, f.doubleValue());
StackContext object = stack.pop();
ins.pop(object);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,12 +20,15 @@ public class F2I extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Float;
Float f = (Float) obj;
stack.push(this, f.intValue());
StackContext object = stack.pop();
ins.pop(object);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,12 +20,15 @@ public class F2L extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Float;
Float f = (Float) obj;
stack.push(this, f.longValue());
StackContext object = stack.pop();
ins.pop(object);
StackContext ctx = new StackContext(ins, long.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FALoad extends Instruction
{
@@ -16,11 +18,17 @@ public class FALoad extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
int index = (int) stack.pop();
float[] array = (float[]) stack.pop();
StackContext index = stack.pop();
StackContext array = stack.pop();
stack.push(this, array[index]);
ins.pop(index, array);
StackContext ctx = new StackContext(ins, float.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FAStore extends Instruction
{
@@ -16,12 +18,15 @@ public class FAStore extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
float value = (float) stack.pop();
int index = (int) stack.pop();
float[] array = (float[]) stack.pop();
StackContext value = stack.pop();
StackContext index = stack.pop();
StackContext array = stack.pop();
array[index] = value;
ins.pop(value, index, array);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FAdd extends Instruction
{
@@ -16,11 +18,17 @@ public class FAdd extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Float one = (Float) stack.pop();
Float two = (Float) stack.pop();
StackContext two = stack.pop();
StackContext one = stack.pop();
stack.push(this, one + two);
ins.pop(two, one);
StackContext ctx = new StackContext(ins, float.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,18 +20,17 @@ public class FCmpG extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Float one = (Float) stack.pop();
Float two = (Float) stack.pop();
if (one.isNaN() || two.isNaN())
stack.push(this, 1);
else if (one > two)
stack.push(this, 1);
else if (one < two)
stack.push(this, -1);
else
stack.push(this, 0);
StackContext one = stack.pop();
StackContext two = stack.pop();
ins.pop(one, two);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,18 +20,17 @@ public class FCmpL extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Float one = (Float) stack.pop();
Float two = (Float) stack.pop();
if (one.isNaN() || two.isNaN())
stack.push(this, -1);
else if (one > two)
stack.push(this, 1);
else if (one < two)
stack.push(this, -1);
else
stack.push(this, 0);
StackContext one = stack.pop();
StackContext two = stack.pop();
ins.pop(one, two);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,7 +20,12 @@ public class FConst_0 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
stack.push(this, 0f);
StackContext ctx = new StackContext(ins, float.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,7 +20,12 @@ public class FConst_1 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
stack.push(this, 1f);
StackContext ctx = new StackContext(ins, float.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,7 +20,12 @@ public class FConst_2 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
stack.push(this, 2f);
StackContext ctx = new StackContext(ins, float.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FDiv extends Instruction
{
@@ -16,11 +18,17 @@ public class FDiv extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Float two = (Float) stack.pop();
Float one = (Float) stack.pop();
StackContext one = stack.pop();
StackContext two = stack.pop();
stack.push(this, one / two);
ins.pop(one, two);
StackContext ctx = new StackContext(ins, float.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,13 +4,20 @@ 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.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.attributes.code.instruction.types.WideInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class FLoad extends Instruction implements LVTInstruction
public class FLoad extends Instruction implements LVTInstruction, WideInstruction
{
private int index;
@@ -23,6 +30,15 @@ public class FLoad extends Instruction implements LVTInstruction
length += 1;
}
public FLoad(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
{
super(instructions, type, pc);
DataInputStream is = instructions.getCode().getAttributes().getStream();
index = is.readShort();
length += 2;
}
@Override
public void write(DataOutputStream out, int pc) throws IOException
{
@@ -33,8 +49,18 @@ public class FLoad extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
float f = (float) frame.getVariables().get(index);
frame.getStack().push(this, f);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
VariableContext vctx = variables.get(index);
assert vctx.getType().equals(new Type(float.class.getName()));
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override
@@ -48,4 +74,11 @@ public class FLoad extends Instruction implements LVTInstruction
{
return false;
}
@Override
public void writeWide(DataOutputStream out, int pc) throws IOException
{
super.write(out, pc);
out.writeShort(index);
}
}

View File

@@ -5,6 +5,12 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +24,18 @@ public class FLoad_0 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(0);
assert obj instanceof Float;
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
VariableContext vctx = variables.get(0);
assert vctx.getType().equals(new Type(float.class.getName()));
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,12 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +24,18 @@ public class FLoad_1 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(1);
assert obj instanceof Float;
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
VariableContext vctx = variables.get(1);
assert vctx.getType().equals(new Type(float.class.getName()));
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,12 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +24,18 @@ public class FLoad_2 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(2);
assert obj instanceof Float;
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
VariableContext vctx = variables.get(2);
assert vctx.getType().equals(new Type(float.class.getName()));
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,12 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +24,18 @@ public class FLoad_3 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getVariables().get(3);
assert obj instanceof Float;
frame.getStack().push(this, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
VariableContext vctx = variables.get(3);
assert vctx.getType().equals(new Type(float.class.getName()));
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx.getType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FMul extends Instruction
{
@@ -16,11 +18,17 @@ public class FMul extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Float two = (Float) stack.pop();
Float one = (Float) stack.pop();
StackContext one = stack.pop();
StackContext two = stack.pop();
stack.push(this, one * two);
ins.pop(one, two);
StackContext ctx = new StackContext(ins, float.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FNeg extends Instruction
{
@@ -16,9 +18,15 @@ public class FNeg extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Float value = (Float) stack.pop();
stack.push(this, -value);
StackContext value = stack.pop();
ins.pop(value);
StackContext ctx = new StackContext(ins, float.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FRem extends Instruction
{
@@ -16,11 +18,17 @@ public class FRem extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Float two = (Float) stack.pop();
Float one = (Float) stack.pop();
StackContext one = stack.pop();
StackContext two = stack.pop();
stack.push(this, one % two);
ins.pop(one, two);
StackContext ctx = new StackContext(ins, float.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,13 +4,19 @@ 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.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.attributes.code.instruction.types.WideInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class FStore extends Instruction implements LVTInstruction
public class FStore extends Instruction implements LVTInstruction, WideInstruction
{
private int index;
@@ -23,6 +29,15 @@ public class FStore extends Instruction implements LVTInstruction
length += 1;
}
public FStore(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
{
super(instructions, type, pc);
DataInputStream is = instructions.getCode().getAttributes().getStream();
index = is.readShort();
length += 2;
}
@Override
public void write(DataOutputStream out, int pc) throws IOException
{
@@ -33,8 +48,16 @@ public class FStore extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
float f = (float) frame.getStack().pop();
frame.getVariables().set(index, f);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(index, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
}
@Override
@@ -48,4 +71,11 @@ public class FStore extends Instruction implements LVTInstruction
{
return true;
}
@Override
public void writeWide(DataOutputStream out, int pc) throws IOException
{
super.write(out, pc);
out.writeShort(index);
}
}

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +23,16 @@ public class FStore_0 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
assert obj instanceof Float;
frame.getVariables().set(0, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(0, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +23,16 @@ public class FStore_1 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
assert obj instanceof Float;
frame.getVariables().set(1, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(1, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +23,16 @@ public class FStore_2 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
assert obj instanceof Float;
frame.getVariables().set(2, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(2, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
}
@Override

View File

@@ -5,6 +5,11 @@ import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.VariableContext;
import info.sigterm.deob.execution.Variables;
import java.io.IOException;
@@ -18,9 +23,16 @@ public class FStore_3 extends Instruction implements LVTInstruction
@Override
public void execute(Frame frame)
{
Object obj = frame.getStack().pop();
assert obj instanceof Float;
frame.getVariables().set(3, obj);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(3, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
}
@Override

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FSub extends Instruction
{
@@ -16,11 +18,17 @@ public class FSub extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Float two = (Float) stack.pop();
Float one = (Float) stack.pop();
StackContext two = stack.pop();
StackContext one = stack.pop();
stack.push(this, one - two);
ins.pop(two, one);
StackContext ctx = new StackContext(ins, float.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -5,9 +5,11 @@ import info.sigterm.deob.ConstantPool;
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.FieldInstance;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.ObjectInstance;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.pool.Field;
import info.sigterm.deob.pool.NameAndType;
@@ -38,21 +40,15 @@ public class GetField extends Instruction
@Override
public void execute(Frame frame)
{
ObjectInstance object = (ObjectInstance) frame.getStack().pop();
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile();
ConstantPool pool = thisClass.getPool();
NameAndType nat = field.getNameAndType();
StackContext object = stack.pop();
ins.pop(object);
if (object == null)
{
frame.getStack().push(this, null);
return;
}
StackContext ctx = new StackContext(ins, new Type(field.getNameAndType().getDescriptorType()).toStackType());
stack.push(ctx);
FieldInstance field = object.getField(nat);
frame.getStack().push(this, field.getValue());
frame.addInstructionContext(ins);
}
}

View File

@@ -5,9 +5,11 @@ import info.sigterm.deob.ConstantPool;
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.ClassInstance;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.StaticFieldInstance;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import info.sigterm.deob.pool.Class;
import info.sigterm.deob.pool.Field;
import info.sigterm.deob.pool.NameAndType;
@@ -39,24 +41,13 @@ public class GetStatic extends Instruction
@Override
public void execute(Frame frame)
{
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile();
Class clazz = field.getClassEntry();
NameAndType nat = field.getNameAndType();
ClassFile cf = thisClass.getGroup().findClass(clazz.getName());
if (cf == null)
{
Object ovalue = nat.getStackObject();
frame.getStack().push(this, ovalue);
return;
}
ClassInstance ci = frame.getPath().getClassInstance(cf);
StaticFieldInstance fi = ci.findStaticField(nat);
Object ovalue = fi.getValue();
frame.getStack().push(this, ovalue);
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
StackContext ctx = new StackContext(ins, new Type(field.getNameAndType().getDescriptorType()).toStackType());
stack.push(ctx);
frame.addInstructionContext(ins);
}
@Override

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,12 +20,15 @@ public class I2B extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Integer;
Integer i = (Integer) obj;
stack.push(this, i.byteValue());
StackContext object = stack.pop();
ins.pop(object);
StackContext ctx = new StackContext(ins, int.class); // sign extneded
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,12 +20,15 @@ public class I2C extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Integer;
Integer i = (Integer) obj;
stack.push(this, (char) i.intValue());
StackContext object = stack.pop();
ins.pop(object);
StackContext ctx = new StackContext(ins, int.class); // sign extended
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,12 +20,15 @@ public class I2D extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Integer;
Integer i = (Integer) obj;
stack.push(this, i.doubleValue());
StackContext object = stack.pop();
ins.pop(object);
StackContext ctx = new StackContext(ins, double.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,12 +20,15 @@ public class I2F extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Integer;
Integer i = (Integer) obj;
stack.push(this, i.floatValue());
StackContext object = stack.pop();
ins.pop(object);
StackContext ctx = new StackContext(ins, float.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,12 +20,15 @@ public class I2L extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Integer;
Integer i = (Integer) obj;
stack.push(this, i.longValue());
StackContext object = stack.pop();
ins.pop(object);
StackContext ctx = new StackContext(ins, long.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,12 +20,15 @@ public class I2S extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Integer;
Integer i = (Integer) obj;
stack.push(this, i.shortValue());
StackContext object = stack.pop();
ins.pop(object);
StackContext ctx = new StackContext(ins, int.class); // sign extended
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class IALoad extends Instruction
{
@@ -16,11 +18,17 @@ public class IALoad extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
int index = (int) stack.pop();
int[] array = (int[]) stack.pop();
StackContext index = stack.pop();
StackContext array = stack.pop();
stack.push(this, array[index]);
ins.pop(index, array);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class IAStore extends Instruction
{
@@ -16,12 +18,15 @@ public class IAStore extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
int value = (int) stack.pop();
int index = (int) stack.pop();
int[] array = (int[]) stack.pop();
StackContext value = stack.pop();
StackContext index = stack.pop();
StackContext array = stack.pop();
array[index] = value;
ins.pop(value, index, array);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class IAdd extends Instruction
{
@@ -16,11 +18,17 @@ public class IAdd extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Integer two = (Integer) stack.pop();
Integer one = (Integer) stack.pop();
StackContext two = stack.pop();
StackContext one = stack.pop();
stack.push(this, one + two);
ins.pop(two, one);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class IAnd extends Instruction
{
@@ -16,10 +18,17 @@ public class IAnd extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Integer two = (Integer) stack.pop();
Integer one = (Integer) stack.pop();
stack.push(this, one & two);
StackContext two = stack.pop();
StackContext one = stack.pop();
ins.pop(two, one);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,7 +20,12 @@ public class IConst_0 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
stack.push(this, 0);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,7 +20,12 @@ public class IConst_1 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
stack.push(this, 1);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,7 +20,12 @@ public class IConst_2 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
stack.push(this, 2);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,7 +20,12 @@ public class IConst_3 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
stack.push(this, 3);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

View File

@@ -4,7 +4,9 @@ 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.InstructionContext;
import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException;
@@ -18,7 +20,12 @@ public class IConst_4 extends Instruction
@Override
public void execute(Frame frame)
{
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
stack.push(this, 4);
StackContext ctx = new StackContext(ins, int.class);
stack.push(ctx);
frame.addInstructionContext(ins);
}
}

Some files were not shown because too many files have changed in this diff Show More