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); return (NameAndType) getEntry(index);
} }
public Object get(int index)
{
PoolEntry entry = getEntry(index);
return entry.getObject();
}
public int make(PoolEntry entry) public int make(PoolEntry entry)
{ {
int i = 1; int i = 1;

View File

@@ -1,6 +1,9 @@
package info.sigterm.deob; package info.sigterm.deob;
import info.sigterm.deob.execution.Execution; 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.pool.NameAndType;
import info.sigterm.deob.attributes.Code; import info.sigterm.deob.attributes.Code;
import info.sigterm.deob.attributes.code.Block; import info.sigterm.deob.attributes.code.Block;
@@ -50,7 +53,7 @@ public class Deob
checkBlockGraph(group); checkBlockGraph(group);
//checkParameters(group); //checkParameters(group);
//execute(group); execute(group);
JarOutputStream jout = new JarOutputStream(new FileOutputStream(args[1]), new Manifest()); 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 private static void execute(ClassGroup group) throws IOException
{ {
ClassFile cf = group.findClass("client");
Method method = cf.findMethod("init");
Execution e = new Execution(group); 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) private static void checkCallGraph(ClassGroup group)

View File

@@ -50,6 +50,11 @@ public abstract class Instruction
return instructions; return instructions;
} }
public InstructionType getType()
{
return type;
}
public ConstantPool getPool() public ConstantPool getPool()
{ {
return instructions.getCode().getAttributes().getClassFile().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.Instruction;
import info.sigterm.deob.attributes.code.InstructionType; import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.ArrayInstance;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class AALoad extends Instruction public class AALoad extends Instruction
{ {
@@ -17,14 +18,17 @@ public class AALoad extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
int index = (int) stack.pop(); StackContext index = stack.pop();
ArrayInstance array = (ArrayInstance) stack.pop(); StackContext array = stack.pop();
if (index >= 0 && index < array.getLength()) ins.pop(index, array);
stack.push(this, array.get(index));
else StackContext ctx = new StackContext(ins, array.getType().getSubtype());
frame.getPath().throwException(this, null); 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.Instruction;
import info.sigterm.deob.attributes.code.InstructionType; import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.ArrayInstance;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class AAStore extends Instruction public class AAStore extends Instruction
{ {
@@ -17,15 +18,17 @@ public class AAStore extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object value = stack.pop(); StackContext value = stack.pop();
int index = (int) stack.pop(); StackContext index = stack.pop();
ArrayInstance array = (ArrayInstance) stack.pop(); StackContext array = stack.pop();
if (array == null) ins.pop(value);
return; 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,7 +20,12 @@ public class AConstNull extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; 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.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.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
public class ALoad extends Instruction implements LVTInstruction public class ALoad extends Instruction implements LVTInstruction, WideInstruction
{ {
private int index; private int index;
@@ -23,6 +29,15 @@ public class ALoad extends Instruction implements LVTInstruction
length += 1; 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 @Override
public void write(DataOutputStream out, int pc) throws IOException public void write(DataOutputStream out, int pc) throws IOException
{ {
@@ -33,8 +48,17 @@ public class ALoad extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(index); InstructionContext ins = new InstructionContext(this, frame);
frame.getStack().push(this, obj); 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 @Override
@@ -48,4 +72,11 @@ public class ALoad extends Instruction implements LVTInstruction
{ {
return false; 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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,8 +23,17 @@ public class ALoad_0 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(0); InstructionContext ins = new InstructionContext(this, frame);
frame.getStack().push(this, obj); 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 @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,8 +23,17 @@ public class ALoad_1 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(1); InstructionContext ins = new InstructionContext(this, frame);
frame.getStack().push(this, obj); 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 @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,8 +23,17 @@ public class ALoad_2 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(2); InstructionContext ins = new InstructionContext(this, frame);
frame.getStack().push(this, obj); 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 @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,8 +23,17 @@ public class ALoad_3 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(3); InstructionContext ins = new InstructionContext(this, frame);
frame.getStack().push(this, obj); 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 @Override

View File

@@ -1,12 +1,13 @@
package info.sigterm.deob.attributes.code.instructions; 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.Instruction;
import info.sigterm.deob.attributes.code.InstructionType; import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; 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.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 info.sigterm.deob.pool.Class;
import java.io.DataInputStream; import java.io.DataInputStream;
@@ -37,20 +38,17 @@ public class ANewArray extends Instruction
@Override @Override
public void execute(Frame frame) 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()); ins.pop(count);
if (cf == null)
{
frame.getStack().push(this, null);
return;
}
ClassInstance type = frame.getPath().getClassInstance(cf); Type t = new Type(new info.sigterm.deob.signature.Type("[" + clazz.getName()));
ArrayInstance array = frame.getPath().createArray(type, count); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; 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.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.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
public class AStore extends Instruction implements LVTInstruction public class AStore extends Instruction implements LVTInstruction, WideInstruction
{ {
private int index; private int index;
@@ -23,6 +29,15 @@ public class AStore extends Instruction implements LVTInstruction
length += 1; 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 @Override
public void write(DataOutputStream out, int pc) throws IOException public void write(DataOutputStream out, int pc) throws IOException
{ {
@@ -33,8 +48,16 @@ public class AStore extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
frame.getVariables().set(index, obj); 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 @Override
@@ -48,4 +71,11 @@ public class AStore extends Instruction implements LVTInstruction
{ {
return true; 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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,8 +23,16 @@ public class AStore_0 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
frame.getVariables().set(0, obj); 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 @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,8 +23,16 @@ public class AStore_1 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
frame.getVariables().set(1, obj); 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 @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,8 +23,16 @@ public class AStore_2 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
frame.getVariables().set(2, obj); 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 @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,8 +23,16 @@ public class AStore_3 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
frame.getVariables().set(3, obj); 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 @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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -16,10 +18,18 @@ public class AThrow extends Instruction
} }
@Override @Override
public void execute(Frame e) public void execute(Frame frame)
{ {
ObjectInstance exception = (ObjectInstance) e.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
e.getPath().throwException(this, exception); 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 @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.Instruction;
import info.sigterm.deob.attributes.code.InstructionType; import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.ArrayInstance;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,7 +20,16 @@ public class ArrayLength extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
ArrayInstance array = (ArrayInstance) frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
frame.getStack().push(this, array.getLength()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class BALoad extends Instruction public class BALoad extends Instruction
{ {
@@ -16,11 +18,17 @@ public class BALoad extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
int index = (int) stack.pop(); StackContext index = stack.pop();
boolean[] array = (boolean[]) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class BAStore extends Instruction public class BAStore extends Instruction
{ {
@@ -16,12 +18,15 @@ public class BAStore extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
boolean value = (boolean) stack.pop(); StackContext value = stack.pop();
int index = (int) stack.pop(); StackContext index = stack.pop();
boolean[] array = (boolean[]) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; 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.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
@@ -32,6 +35,12 @@ public class BiPush extends Instruction
@Override @Override
public void execute(Frame frame) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class CALoad extends Instruction public class CALoad extends Instruction
{ {
@@ -16,11 +18,17 @@ public class CALoad extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
int index = (int) stack.pop(); StackContext index = stack.pop();
char[] array = (char[]) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class CAStore extends Instruction public class CAStore extends Instruction
{ {
@@ -16,12 +18,15 @@ public class CAStore extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
char value = (char) stack.pop(); StackContext value = stack.pop();
int index = (int) stack.pop(); StackContext index = stack.pop();
char[] array = (char[]) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; 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 info.sigterm.deob.pool.Class;
import java.io.DataInputStream; import java.io.DataInputStream;
@@ -34,28 +37,18 @@ public class CheckCast extends Instruction
} }
@Override @Override
public void execute(Frame e) public void execute(Frame frame)
{ {
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile(); Frame other = frame.dup();
Stack stack = other.getStack();
ConstantPool pool = thisClass.getPool();
ObjectInstance obj = (ObjectInstance) e.getStack().pop(); InstructionContext ins = new InstructionContext(this, other);
if (obj == null)
{
e.getStack().push(this, null);
return;
}
ClassFile otherClass = thisClass.getGroup().findClass(clazz.getName()); StackContext what = stack.pop();
boolean instanceOf = obj.getType().getClassFile().instanceOf(otherClass);
if (!instanceOf) ins.pop(what);
{
// XXX throw
}
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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,12 +20,16 @@ public class D2F extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object obj = stack.pop(); StackContext value = stack.pop();
assert obj instanceof Double;
ins.pop(value);
Double d = (Double) obj;
stack.push(this, d.floatValue()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,12 +20,16 @@ public class D2I extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object obj = stack.pop(); StackContext value = stack.pop();
assert obj instanceof Double;
ins.pop(value);
Double d = (Double) obj;
stack.push(this, d.intValue()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,12 +20,16 @@ public class D2L extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object obj = stack.pop(); StackContext value = stack.pop();
assert obj instanceof Double;
ins.pop(value);
Double d = (Double) obj;
stack.push(this, d.longValue()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DALoad extends Instruction public class DALoad extends Instruction
{ {
@@ -16,11 +18,17 @@ public class DALoad extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
int index = (int) stack.pop(); StackContext index = stack.pop();
double[] array = (double[]) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DAStore extends Instruction public class DAStore extends Instruction
{ {
@@ -16,12 +18,15 @@ public class DAStore extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
double value = (double) stack.pop(); StackContext value = stack.pop();
int index = (int) stack.pop(); StackContext index = stack.pop();
double[] array = (double[]) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DAdd extends Instruction public class DAdd extends Instruction
{ {
@@ -16,11 +18,17 @@ public class DAdd extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Double two = (Double) stack.pop(); StackContext two = stack.pop();
Double one = (Double) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,18 +20,17 @@ public class DCmpG extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Double one = (Double) stack.pop(); StackContext one = stack.pop();
Double two = (Double) stack.pop(); StackContext two = stack.pop();
if (one.isNaN() || two.isNaN()) ins.pop(one, two);
stack.push(this, 1);
else if (one > two) StackContext ctx = new StackContext(ins, int.class);
stack.push(this, 1); stack.push(ctx);
else if (one < two)
stack.push(this, -1); frame.addInstructionContext(ins);
else
stack.push(this, 0);
} }
} }

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

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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,7 +20,12 @@ public class DConst_0 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,7 +20,12 @@ public class DConst_1 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DDiv extends Instruction public class DDiv extends Instruction
{ {
@@ -16,11 +18,17 @@ public class DDiv extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Double two = (Double) stack.pop(); StackContext one = stack.pop();
Double one = (Double) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; 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.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.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
public class DLoad extends Instruction implements LVTInstruction public class DLoad extends Instruction implements LVTInstruction, WideInstruction
{ {
private int index; private int index;
@@ -23,6 +30,15 @@ public class DLoad extends Instruction implements LVTInstruction
length += 1; 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 @Override
public void write(DataOutputStream out, int pc) throws IOException public void write(DataOutputStream out, int pc) throws IOException
{ {
@@ -33,8 +49,18 @@ public class DLoad extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
double d = (double) frame.getVariables().get(index); InstructionContext ins = new InstructionContext(this, frame);
frame.getStack().push(this, d); 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 @Override
@@ -48,4 +74,11 @@ public class DLoad extends Instruction implements LVTInstruction
{ {
return false; 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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +24,18 @@ public class DLoad_0 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(0); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Double; Stack stack = frame.getStack();
frame.getStack().push(this, obj); 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 @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +24,18 @@ public class DLoad_1 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(1); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Double; Stack stack = frame.getStack();
frame.getStack().push(this, obj); 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 @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +24,18 @@ public class DLoad_2 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(2); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Double; Stack stack = frame.getStack();
frame.getStack().push(this, obj); 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 @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +24,18 @@ public class DLoad_3 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(3); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Double; Stack stack = frame.getStack();
frame.getStack().push(this, obj); 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 @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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DMul extends Instruction public class DMul extends Instruction
{ {
@@ -16,11 +18,17 @@ public class DMul extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Double two = (Double) stack.pop(); StackContext one = stack.pop();
Double one = (Double) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DNeg extends Instruction public class DNeg extends Instruction
{ {
@@ -16,9 +18,15 @@ public class DNeg extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Double value = (Double) stack.pop(); StackContext value = stack.pop();
stack.push(this, -value); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DRem extends Instruction public class DRem extends Instruction
{ {
@@ -16,11 +18,17 @@ public class DRem extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Double two = (Double) stack.pop(); StackContext one = stack.pop();
Double one = (Double) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; 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.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.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
public class DStore extends Instruction implements LVTInstruction public class DStore extends Instruction implements LVTInstruction, WideInstruction
{ {
private int index; private int index;
@@ -23,6 +29,15 @@ public class DStore extends Instruction implements LVTInstruction
length += 1; 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 @Override
public void write(DataOutputStream out, int pc) throws IOException public void write(DataOutputStream out, int pc) throws IOException
{ {
@@ -33,8 +48,16 @@ public class DStore extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
double d = (double) frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
frame.getVariables().set(index, d); 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 @Override
@@ -48,4 +71,11 @@ public class DStore extends Instruction implements LVTInstruction
{ {
return true; 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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +23,16 @@ public class DStore_0 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Double; Stack stack = frame.getStack();
frame.getVariables().set(0, obj); Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(0, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
} }
@Override @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +23,16 @@ public class DStore_1 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Double; Stack stack = frame.getStack();
frame.getVariables().set(1, obj); Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(1, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
} }
@Override @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +23,16 @@ public class DStore_2 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Double; Stack stack = frame.getStack();
frame.getVariables().set(2, obj); Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(2, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
} }
@Override @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +23,16 @@ public class DStore_3 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Double; Stack stack = frame.getStack();
frame.getVariables().set(3, obj); Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(3, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
} }
@Override @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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class DSub extends Instruction public class DSub extends Instruction
{ {
@@ -16,11 +18,17 @@ public class DSub extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Double two = (Double) stack.pop(); StackContext two = stack.pop();
Double one = (Double) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -17,8 +20,18 @@ public class Dup extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
frame.getStack().push(this, obj); Stack stack = frame.getStack();
frame.getStack().push(this, obj);
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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import java.io.IOException; import java.io.IOException;
@@ -18,19 +21,36 @@ public class Dup2 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object one = stack.pop(); StackContext one = stack.pop();
Object two = null; StackContext two = null;
if (!(one instanceof Double) && !(one instanceof Long)) if (!one.getType().equals(new Type(double.class.getCanonicalName())) && !one.getType().equals(new Type(long.class.getCanonicalName())))
two = stack.pop(); 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)) if (two != null)
stack.push(this, two); {
stack.push(this, one); ctx = new StackContext(ins, two.getType());
stack.push(ctx);
if (!(one instanceof Double) && !(one instanceof Long)) }
stack.push(this, two);
stack.push(this, one); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import java.io.IOException; import java.io.IOException;
@@ -18,22 +21,41 @@ public class Dup2_X1 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object one = stack.pop(); StackContext one = stack.pop();
Object two = null; StackContext two = null;
if (!(one instanceof Double) && !(one instanceof Long)) if (!one.getType().equals(new Type(double.class.getCanonicalName())) && !one.getType().equals(new Type(long.class.getCanonicalName())))
two = stack.pop(); two = stack.pop();
Object three = stack.pop(); StackContext three = stack.pop();
if (!(one instanceof Double) && !(one instanceof Long)) ins.pop(one);
stack.push(this, two); if (two != null)
stack.push(this, one); ins.pop(two);
ins.pop(three);
stack.push(this, three);
if (two != null)
if (!(one instanceof Double) && !(one instanceof Long)) {
stack.push(this, two); StackContext ctx = new StackContext(ins, two.getType());
stack.push(this, one); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import java.io.IOException; import java.io.IOException;
@@ -18,27 +21,52 @@ public class Dup2_X2 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object one = stack.pop(); StackContext one = stack.pop();
Object two = null; StackContext two = null;
if (!(one instanceof Double) && !(one instanceof Long)) if (!one.getType().equals(new Type(double.class.getCanonicalName())) && !one.getType().equals(new Type(long.class.getCanonicalName())))
two = stack.pop(); two = stack.pop();
Object three = stack.pop(); StackContext three = stack.pop();
Object four = null; StackContext four = null;
if (!(three instanceof Double) && !(three instanceof Long)) if (!three.getType().equals(new Type(double.class.getCanonicalName())) && !three.getType().equals(new Type(long.class.getCanonicalName())))
four = stack.pop(); four = stack.pop();
if (!(one instanceof Double) && !(one instanceof Long)) ins.pop(one);
stack.push(this, two); if (two != null)
stack.push(this, one); ins.pop(two);
ins.pop(three);
if (!(three instanceof Double) && !(three instanceof Long)) if (four != null)
stack.push(this, four); ins.pop(four);
stack.push(this, three);
if (two != null)
if (!(one instanceof Double) && !(one instanceof Long)) {
stack.push(this, two); StackContext ctx = new StackContext(ins, two.getType());
stack.push(this, one); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,13 +20,23 @@ public class Dup_X1 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object one = stack.pop(); StackContext one = stack.pop();
Object two = stack.pop(); StackContext two = stack.pop();
stack.push(this, one); ins.pop(one, two);
stack.push(this, two);
stack.push(this, one); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import info.sigterm.deob.execution.Type;
import java.io.IOException; import java.io.IOException;
@@ -18,18 +21,34 @@ public class Dup_X2 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object one = stack.pop(); StackContext one = stack.pop();
Object two = stack.pop(); StackContext two = stack.pop();
Object three = null; StackContext three = null;
if (!(two instanceof Double) && !(two instanceof Long)) if (!two.getType().equals(new Type(double.class.getCanonicalName())) && !two.getType().equals(new Type(long.class.getCanonicalName())))
three = stack.pop(); three = stack.pop();
stack.push(this, one); ins.pop(one, two);
if (!(two instanceof Double) && !(two instanceof Long)) if (three != null)
stack.push(this, three); ins.pop(three);
stack.push(this, two);
stack.push(this, one); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,12 +20,15 @@ public class F2D extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object obj = stack.pop(); StackContext object = stack.pop();
assert obj instanceof Float; ins.pop(object);
Float f = (Float) obj; StackContext ctx = new StackContext(ins, double.class);
stack.push(this, f.doubleValue()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,12 +20,15 @@ public class F2I extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object obj = stack.pop(); StackContext object = stack.pop();
assert obj instanceof Float; ins.pop(object);
Float f = (Float) obj; StackContext ctx = new StackContext(ins, int.class);
stack.push(this, f.intValue()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,12 +20,15 @@ public class F2L extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object obj = stack.pop(); StackContext object = stack.pop();
assert obj instanceof Float; ins.pop(object);
Float f = (Float) obj; StackContext ctx = new StackContext(ins, long.class);
stack.push(this, f.longValue()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FALoad extends Instruction public class FALoad extends Instruction
{ {
@@ -16,11 +18,17 @@ public class FALoad extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
int index = (int) stack.pop(); StackContext index = stack.pop();
float[] array = (float[]) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FAStore extends Instruction public class FAStore extends Instruction
{ {
@@ -16,12 +18,15 @@ public class FAStore extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
float value = (float) stack.pop(); StackContext value = stack.pop();
int index = (int) stack.pop(); StackContext index = stack.pop();
float[] array = (float[]) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FAdd extends Instruction public class FAdd extends Instruction
{ {
@@ -16,11 +18,17 @@ public class FAdd extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Float one = (Float) stack.pop(); StackContext two = stack.pop();
Float two = (Float) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,18 +20,17 @@ public class FCmpG extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Float one = (Float) stack.pop(); StackContext one = stack.pop();
Float two = (Float) stack.pop(); StackContext two = stack.pop();
if (one.isNaN() || two.isNaN()) ins.pop(one, two);
stack.push(this, 1);
else if (one > two) StackContext ctx = new StackContext(ins, int.class);
stack.push(this, 1); stack.push(ctx);
else if (one < two)
stack.push(this, -1); frame.addInstructionContext(ins);
else
stack.push(this, 0);
} }
} }

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

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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,7 +20,12 @@ public class FConst_0 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,7 +20,12 @@ public class FConst_1 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,7 +20,12 @@ public class FConst_2 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FDiv extends Instruction public class FDiv extends Instruction
{ {
@@ -16,11 +18,17 @@ public class FDiv extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Float two = (Float) stack.pop(); StackContext one = stack.pop();
Float one = (Float) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; 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.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.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
public class FLoad extends Instruction implements LVTInstruction public class FLoad extends Instruction implements LVTInstruction, WideInstruction
{ {
private int index; private int index;
@@ -23,6 +30,15 @@ public class FLoad extends Instruction implements LVTInstruction
length += 1; 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 @Override
public void write(DataOutputStream out, int pc) throws IOException public void write(DataOutputStream out, int pc) throws IOException
{ {
@@ -33,8 +49,18 @@ public class FLoad extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
float f = (float) frame.getVariables().get(index); InstructionContext ins = new InstructionContext(this, frame);
frame.getStack().push(this, f); 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 @Override
@@ -48,4 +74,11 @@ public class FLoad extends Instruction implements LVTInstruction
{ {
return false; 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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +24,18 @@ public class FLoad_0 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(0); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Float; Stack stack = frame.getStack();
frame.getStack().push(this, obj); 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 @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +24,18 @@ public class FLoad_1 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(1); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Float; Stack stack = frame.getStack();
frame.getStack().push(this, obj); 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 @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +24,18 @@ public class FLoad_2 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(2); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Float; Stack stack = frame.getStack();
frame.getStack().push(this, obj); 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 @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +24,18 @@ public class FLoad_3 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getVariables().get(3); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Float; Stack stack = frame.getStack();
frame.getStack().push(this, obj); 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 @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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FMul extends Instruction public class FMul extends Instruction
{ {
@@ -16,11 +18,17 @@ public class FMul extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Float two = (Float) stack.pop(); StackContext one = stack.pop();
Float one = (Float) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FNeg extends Instruction public class FNeg extends Instruction
{ {
@@ -16,9 +18,15 @@ public class FNeg extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Float value = (Float) stack.pop(); StackContext value = stack.pop();
stack.push(this, -value); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FRem extends Instruction public class FRem extends Instruction
{ {
@@ -16,11 +18,17 @@ public class FRem extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Float two = (Float) stack.pop(); StackContext one = stack.pop();
Float one = (Float) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; 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.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.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
public class FStore extends Instruction implements LVTInstruction public class FStore extends Instruction implements LVTInstruction, WideInstruction
{ {
private int index; private int index;
@@ -23,6 +29,15 @@ public class FStore extends Instruction implements LVTInstruction
length += 1; 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 @Override
public void write(DataOutputStream out, int pc) throws IOException public void write(DataOutputStream out, int pc) throws IOException
{ {
@@ -33,8 +48,16 @@ public class FStore extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
float f = (float) frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
frame.getVariables().set(index, f); 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 @Override
@@ -48,4 +71,11 @@ public class FStore extends Instruction implements LVTInstruction
{ {
return true; 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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +23,16 @@ public class FStore_0 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Float; Stack stack = frame.getStack();
frame.getVariables().set(0, obj); Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(0, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
} }
@Override @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +23,16 @@ public class FStore_1 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Float; Stack stack = frame.getStack();
frame.getVariables().set(1, obj); Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(1, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
} }
@Override @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +23,16 @@ public class FStore_2 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Float; Stack stack = frame.getStack();
frame.getVariables().set(2, obj); Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(2, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
} }
@Override @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.Instructions;
import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction; import info.sigterm.deob.attributes.code.instruction.types.LVTInstruction;
import info.sigterm.deob.execution.Frame; 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; import java.io.IOException;
@@ -18,9 +23,16 @@ public class FStore_3 extends Instruction implements LVTInstruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
Object obj = frame.getStack().pop(); InstructionContext ins = new InstructionContext(this, frame);
assert obj instanceof Float; Stack stack = frame.getStack();
frame.getVariables().set(3, obj); Variables variables = frame.getVariables();
StackContext value = stack.pop();
ins.pop(value);
variables.set(3, new VariableContext(ins, value.getType()));
frame.addInstructionContext(ins);
} }
@Override @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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class FSub extends Instruction public class FSub extends Instruction
{ {
@@ -16,11 +18,17 @@ public class FSub extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Float two = (Float) stack.pop(); StackContext two = stack.pop();
Float one = (Float) 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.Instruction;
import info.sigterm.deob.attributes.code.InstructionType; import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.FieldInstance;
import info.sigterm.deob.execution.Frame; 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.Field;
import info.sigterm.deob.pool.NameAndType; import info.sigterm.deob.pool.NameAndType;
@@ -38,21 +40,15 @@ public class GetField extends Instruction
@Override @Override
public void execute(Frame frame) 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(); StackContext object = stack.pop();
ins.pop(object);
ConstantPool pool = thisClass.getPool();
NameAndType nat = field.getNameAndType();
if (object == null) StackContext ctx = new StackContext(ins, new Type(field.getNameAndType().getDescriptorType()).toStackType());
{ stack.push(ctx);
frame.getStack().push(this, null);
return;
}
FieldInstance field = object.getField(nat); frame.addInstructionContext(ins);
frame.getStack().push(this, field.getValue());
} }
} }

View File

@@ -5,9 +5,11 @@ import info.sigterm.deob.ConstantPool;
import info.sigterm.deob.attributes.code.Instruction; import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType; import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.ClassInstance;
import info.sigterm.deob.execution.Frame; 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.Class;
import info.sigterm.deob.pool.Field; import info.sigterm.deob.pool.Field;
import info.sigterm.deob.pool.NameAndType; import info.sigterm.deob.pool.NameAndType;
@@ -39,24 +41,13 @@ public class GetStatic extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile(); InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Class clazz = field.getClassEntry();
NameAndType nat = field.getNameAndType(); StackContext ctx = new StackContext(ins, new Type(field.getNameAndType().getDescriptorType()).toStackType());
stack.push(ctx);
ClassFile cf = thisClass.getGroup().findClass(clazz.getName());
if (cf == null) frame.addInstructionContext(ins);
{
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);
} }
@Override @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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,12 +20,15 @@ public class I2B extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object obj = stack.pop(); StackContext object = stack.pop();
assert obj instanceof Integer; ins.pop(object);
Integer i = (Integer) obj; StackContext ctx = new StackContext(ins, int.class); // sign extneded
stack.push(this, i.byteValue()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,12 +20,15 @@ public class I2C extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object obj = stack.pop(); StackContext object = stack.pop();
assert obj instanceof Integer; ins.pop(object);
Integer i = (Integer) obj; StackContext ctx = new StackContext(ins, int.class); // sign extended
stack.push(this, (char) i.intValue()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,12 +20,15 @@ public class I2D extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object obj = stack.pop(); StackContext object = stack.pop();
assert obj instanceof Integer; ins.pop(object);
Integer i = (Integer) obj; StackContext ctx = new StackContext(ins, double.class);
stack.push(this, i.doubleValue()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,12 +20,15 @@ public class I2F extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object obj = stack.pop(); StackContext object = stack.pop();
assert obj instanceof Integer; ins.pop(object);
Integer i = (Integer) obj; StackContext ctx = new StackContext(ins, float.class);
stack.push(this, i.floatValue()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,12 +20,15 @@ public class I2L extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object obj = stack.pop(); StackContext object = stack.pop();
assert obj instanceof Integer; ins.pop(object);
Integer i = (Integer) obj; StackContext ctx = new StackContext(ins, long.class);
stack.push(this, i.longValue()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,12 +20,15 @@ public class I2S extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Object obj = stack.pop(); StackContext object = stack.pop();
assert obj instanceof Integer; ins.pop(object);
Integer i = (Integer) obj; StackContext ctx = new StackContext(ins, int.class); // sign extended
stack.push(this, i.shortValue()); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class IALoad extends Instruction public class IALoad extends Instruction
{ {
@@ -16,11 +18,17 @@ public class IALoad extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
int index = (int) stack.pop(); StackContext index = stack.pop();
int[] array = (int[]) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class IAStore extends Instruction public class IAStore extends Instruction
{ {
@@ -16,12 +18,15 @@ public class IAStore extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
int value = (int) stack.pop(); StackContext value = stack.pop();
int index = (int) stack.pop(); StackContext index = stack.pop();
int[] array = (int[]) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class IAdd extends Instruction public class IAdd extends Instruction
{ {
@@ -16,11 +18,17 @@ public class IAdd extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Integer two = (Integer) stack.pop(); StackContext two = stack.pop();
Integer one = (Integer) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
public class IAnd extends Instruction public class IAnd extends Instruction
{ {
@@ -16,10 +18,17 @@ public class IAnd extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); Stack stack = frame.getStack();
Integer two = (Integer) stack.pop(); StackContext two = stack.pop();
Integer one = (Integer) 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,7 +20,12 @@ public class IConst_0 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,7 +20,12 @@ public class IConst_1 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,7 +20,12 @@ public class IConst_2 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,7 +20,12 @@ public class IConst_3 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); 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.InstructionType;
import info.sigterm.deob.attributes.code.Instructions; import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame; import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.InstructionContext;
import info.sigterm.deob.execution.Stack; import info.sigterm.deob.execution.Stack;
import info.sigterm.deob.execution.StackContext;
import java.io.IOException; import java.io.IOException;
@@ -18,7 +20,12 @@ public class IConst_4 extends Instruction
@Override @Override
public void execute(Frame frame) public void execute(Frame frame)
{ {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack(); 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