Most other instructions except for function calls and locking

This commit is contained in:
Adam
2014-12-04 16:05:41 -05:00
parent 98b4025a81
commit ea556bef32
18 changed files with 465 additions and 19 deletions

View File

@@ -50,14 +50,14 @@ public enum InstructionType
ALOAD_1(0x2b, "aload_1", ALoad_1.class),
ALOAD_2(0x2c, "aload_2", ALoad_2.class),
ALOAD_3(0x2d, "aload_3", ALoad_3.class),
IALOAD(0x2e, "iaload", Instruction.class),
LALOAD(0x2f, "laload", Instruction.class),
FALOAD(0x30, "faload", Instruction.class),
DALOAD(0x31, "daload", Instruction.class),
AALOAD(0x32, "aaload", Instruction.class),
BALOAD(0x33, "baload", Instruction.class),
CALOAD(0x34, "caload", Instruction.class),
SALOAD(0x35, "saload", Instruction.class),
IALOAD(0x2e, "iaload", IALoad.class),
LALOAD(0x2f, "laload", LALoad.class),
FALOAD(0x30, "faload", FALoad.class),
DALOAD(0x31, "daload", DALoad.class),
AALOAD(0x32, "aaload", AALoad.class),
BALOAD(0x33, "baload", BALoad.class),
CALOAD(0x34, "caload", CALoad.class),
SALOAD(0x35, "saload", SALoad.class),
ISTORE(0x36, "istore", IStore.class),
LSTORE(0x37, "lstore", LStore.class),
FSTORE(0x38, "fstore", FStore.class),
@@ -83,14 +83,14 @@ public enum InstructionType
ASTORE_1(0x4c, "astore_1", AStore_1.class),
ASTORE_2(0x4d, "astore_2", AStore_2.class),
ASTORE_3(0x4e, "astore_3", AStore_3.class),
IASTORE(0x4f, "iastore", Instruction.class),
LASTORE(0x50, "lastore", Instruction.class),
FASTORE(0x51, "fastore", Instruction.class),
DASTORE(0x52, "dastore", Instruction.class),
AASTORE(0x53, "aastore", Instruction.class),
BASTORE(0x54, "bastore", Instruction.class),
CASTORE(0x55, "castore", Instruction.class),
SASTORE(0x56, "sastore", Instruction.class),
IASTORE(0x4f, "iastore", IAStore.class),
LASTORE(0x50, "lastore", LAStore.class),
FASTORE(0x51, "fastore", FAStore.class),
DASTORE(0x52, "dastore", DAStore.class),
AASTORE(0x53, "aastore", AAStore.class),
BASTORE(0x54, "bastore", BAStore.class),
CASTORE(0x55, "castore", CAStore.class),
SASTORE(0x56, "sastore", SAStore.class),
POP(0x57, "pop", Pop.class),
POP2(0x58, "pop2", Pop2.class),
DUP(0x59, "dup", Dup.class),
@@ -194,7 +194,7 @@ public enum InstructionType
NEW(0xbb, "new", New.class),
NEWARRAY(0xbc, "newarray", NewArray.class),
ANEWARRAY(0xbd, "anewarray", ANewArray.class),
ARRAYLENGTH(0xbe, "arraylength", Instruction.class),
ARRAYLENGTH(0xbe, "arraylength", ArrayLength.class),
ATHROW(0xbf, "athrow", Instruction.class),
CHECKCAST(0xc0, "checkcast", CheckCast.class),
INSTANCEOf(0xc1, "instanceof", InstanceOf.class),
@@ -205,8 +205,7 @@ public enum InstructionType
IFNULL(0xc6, "ifnull", IfNull.class),
IFNONNULL(0xc7, "ifnonnull", IfNonNull.class),
GOTO_W(0xc8, "goto_w", GotoW.class),
JSR_W(0xc9, "jsr_w", JSR_W.class),
BREAKPOINT(0xca, "breakpoint", Instruction.class);
JSR_W(0xc9, "jsr_w", JSR_W.class);
private byte code;
private String name;

View File

@@ -0,0 +1,26 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class AALoad extends Instruction
{
public AALoad(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
int index = (int) stack.pop();
Object[] array = (Object[]) stack.pop();
stack.push(array[index]);
}
}

View File

@@ -0,0 +1,27 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class AAStore extends Instruction
{
public AAStore(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object value = stack.pop();
int index = (int) stack.pop();
Object[] array = (Object[]) stack.pop();
array[index] = value;
}
}

View File

@@ -0,0 +1,23 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import java.io.IOException;
public class ArrayLength extends Instruction
{
public ArrayLength(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Object[] array = (Object[]) frame.getStack().pop();
frame.getStack().push(array.length);
}
}

View File

@@ -0,0 +1,26 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class BALoad extends Instruction
{
public BALoad(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
int index = (int) stack.pop();
boolean[] array = (boolean[]) stack.pop();
stack.push(array[index]);
}
}

View File

@@ -0,0 +1,27 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class BAStore extends Instruction
{
public BAStore(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
boolean value = (boolean) stack.pop();
int index = (int) stack.pop();
boolean[] array = (boolean[]) stack.pop();
array[index] = value;
}
}

View File

@@ -0,0 +1,26 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class CALoad extends Instruction
{
public CALoad(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
int index = (int) stack.pop();
char[] array = (char[]) stack.pop();
stack.push(array[index]);
}
}

View File

@@ -0,0 +1,27 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class CAStore extends Instruction
{
public CAStore(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
char value = (char) stack.pop();
int index = (int) stack.pop();
char[] array = (char[]) stack.pop();
array[index] = value;
}
}

View File

@@ -0,0 +1,26 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class DALoad extends Instruction
{
public DALoad(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
int index = (int) stack.pop();
double[] array = (double[]) stack.pop();
stack.push(array[index]);
}
}

View File

@@ -0,0 +1,27 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class DAStore extends Instruction
{
public DAStore(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
double value = (double) stack.pop();
int index = (int) stack.pop();
double[] array = (double[]) stack.pop();
array[index] = value;
}
}

View File

@@ -0,0 +1,26 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class FALoad extends Instruction
{
public FALoad(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
int index = (int) stack.pop();
float[] array = (float[]) stack.pop();
stack.push(array[index]);
}
}

View File

@@ -0,0 +1,27 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class FAStore extends Instruction
{
public FAStore(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
float value = (float) stack.pop();
int index = (int) stack.pop();
float[] array = (float[]) stack.pop();
array[index] = value;
}
}

View File

@@ -0,0 +1,26 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class IALoad extends Instruction
{
public IALoad(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
int index = (int) stack.pop();
int[] array = (int[]) stack.pop();
stack.push(array[index]);
}
}

View File

@@ -0,0 +1,27 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class IAStore extends Instruction
{
public IAStore(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
int value = (int) stack.pop();
int index = (int) stack.pop();
int[] array = (int[]) stack.pop();
array[index] = value;
}
}

View File

@@ -0,0 +1,26 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class LALoad extends Instruction
{
public LALoad(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
int index = (int) stack.pop();
long[] array = (long[]) stack.pop();
stack.push(array[index]);
}
}

View File

@@ -0,0 +1,27 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class LAStore extends Instruction
{
public LAStore(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
long value = (long) stack.pop();
int index = (int) stack.pop();
long[] array = (long[]) stack.pop();
array[index] = value;
}
}

View File

@@ -0,0 +1,26 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class SALoad extends Instruction
{
public SALoad(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
int index = (int) stack.pop();
short[] array = (short[]) stack.pop();
stack.push(array[index]);
}
}

View File

@@ -0,0 +1,27 @@
package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.Stack;
public class SAStore extends Instruction
{
public SAStore(Instructions instructions, InstructionType type, int pc)
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
short value = (short) stack.pop();
int index = (int) stack.pop();
short[] array = (short[]) stack.pop();
array[index] = value;
}
}