More execution, including getstatic

This commit is contained in:
Adam
2014-12-02 15:36:06 -05:00
parent 37dac95ee0
commit 81095be5da
44 changed files with 1091 additions and 26 deletions

View File

@@ -93,12 +93,12 @@ public enum InstructionType
SASTORE(0x56, "sastore", Instruction.class),
POP(0x57, "pop", Pop.class),
POP2(0x58, "pop2", Pop2.class),
DUP(0x59, "dup", Instruction.class),
DUP_X1(0x5a, "dup_x1", Instruction.class),
DUP_X2(0x5b, "dup_x2", Instruction.class),
DUP2(0x5c, "dup2", Instruction.class),
DUP2_X1(0x5d, "dup2_x1", Instruction.class),
DUP2_X2(0x5e, "dup2_x2", Instruction.class),
DUP(0x59, "dup", Dup.class),
DUP_X1(0x5a, "dup_x1", Dup_X1.class),
DUP_X2(0x5b, "dup_x2", Dup_X2.class),
DUP2(0x5c, "dup2", Dup2.class),
DUP2_X1(0x5d, "dup2_x1", Dup2_X1.class),
DUP2_X2(0x5e, "dup2_x2", Dup2_X2.class),
SWAP(0x5f, "swap", Instruction.class),
IADD(0x60, "iadd", Instruction.class),
LADD(0x61, "ladd", Instruction.class),
@@ -137,26 +137,26 @@ public enum InstructionType
IXOR(0x82, "ixor", Instruction.class),
LXOR(0x83, "lxor", Instruction.class),
IINC(0x84, "iinc", IInc.class),
I2L(0x85, "i2l", Instruction.class),
I2F(0x86, "i2f", Instruction.class),
I2D(0x87, "i2d", Instruction.class),
L2I(0x88, "l2i", Instruction.class),
L2F(0x89, "l2f", Instruction.class),
L2D(0x8a, "l2d", Instruction.class),
F2I(0x8b, "f2i", Instruction.class),
F2L(0x8c, "f2l", Instruction.class),
F2D(0x8d, "f2d", Instruction.class),
D2I(0x8e, "d2i", Instruction.class),
D2L(0x8f, "d2l", Instruction.class),
D2F(0x90, "d2f", Instruction.class),
I2B(0x91, "i2b", Instruction.class),
I2C(0x92, "i2c", Instruction.class),
I2S(0x93, "i2s", Instruction.class),
LCMP(0x94, "lcmp", Instruction.class),
FCMPL(0x95, "fcmpl", Instruction.class),
FCMPG(0x96, "fcmpg", Instruction.class),
DCMPL(0x97, "dcmpl", Instruction.class),
DCMPG(0x98, "dcmpg", Instruction.class),
I2L(0x85, "i2l", I2L.class),
I2F(0x86, "i2f", I2F.class),
I2D(0x87, "i2d", I2D.class),
L2I(0x88, "l2i", L2I.class),
L2F(0x89, "l2f", L2F.class),
L2D(0x8a, "l2d", L2D.class),
F2I(0x8b, "f2i", F2I.class),
F2L(0x8c, "f2l", F2L.class),
F2D(0x8d, "f2d", F2D.class),
D2I(0x8e, "d2i", D2I.class),
D2L(0x8f, "d2l", D2L.class),
D2F(0x90, "d2f", D2F.class),
I2B(0x91, "i2b", I2B.class),
I2C(0x92, "i2c", I2C.class),
I2S(0x93, "i2s", I2S.class),
LCMP(0x94, "lcmp", LCmp.class),
FCMPL(0x95, "fcmpl", FCmpL.class),
FCMPG(0x96, "fcmpg", FCmpG.class),
DCMPL(0x97, "dcmpl", DCmpL.class),
DCMPG(0x98, "dcmpg", DCmpG.class),
IFEQ(0x99, "ifeq", Branch.class),
IFNE(0x9a, "ifne", Branch.class),
IFLT(0x9b, "iflt", Branch.class),

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class D2F extends Instruction
{
public D2F(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Double;
Double d = (Double) obj;
stack.push(d.floatValue());
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class D2I extends Instruction
{
public D2I(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Double;
Double d = (Double) obj;
stack.push(d.intValue());
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class D2L extends Instruction
{
public D2L(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Double;
Double d = (Double) obj;
stack.push(d.longValue());
}
}

View File

@@ -0,0 +1,35 @@
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;
import java.io.IOException;
public class DCmpG extends Instruction
{
public DCmpG(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Double one = (Double) stack.pop();
Double two = (Double) stack.pop();
if (one.isNaN() || two.isNaN())
stack.push(1);
else if (one > two)
stack.push(1);
else if (one < two)
stack.push(-1);
else
stack.push(0);
}
}

View File

@@ -0,0 +1,35 @@
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;
import java.io.IOException;
public class DCmpL extends Instruction
{
public DCmpL(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Double one = (Double) stack.pop();
Double two = (Double) stack.pop();
if (one.isNaN() || two.isNaN())
stack.push(-1);
else if (one > two)
stack.push(1);
else if (one < two)
stack.push(-1);
else
stack.push(0);
}
}

View File

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

View File

@@ -0,0 +1,36 @@
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;
import java.io.IOException;
public class Dup2 extends Instruction
{
public Dup2(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object one = stack.pop();
Object two = null;
if (!(one instanceof Double) && !(one instanceof Long))
two = stack.pop();
if (!(one instanceof Double) && !(one instanceof Long))
stack.push(two);
stack.push(one);
if (!(one instanceof Double) && !(one instanceof Long))
stack.push(two);
stack.push(one);
}
}

View File

@@ -0,0 +1,39 @@
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;
import java.io.IOException;
public class Dup2_X1 extends Instruction
{
public Dup2_X1(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object one = stack.pop();
Object two = null;
if (!(one instanceof Double) && !(one instanceof Long))
two = stack.pop();
Object three = stack.pop();
if (!(one instanceof Double) && !(one instanceof Long))
stack.push(two);
stack.push(one);
stack.push(three);
if (!(one instanceof Double) && !(one instanceof Long))
stack.push(two);
stack.push(one);
}
}

View File

@@ -0,0 +1,44 @@
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;
import java.io.IOException;
public class Dup2_X2 extends Instruction
{
public Dup2_X2(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object one = stack.pop();
Object two = null;
if (!(one instanceof Double) && !(one instanceof Long))
two = stack.pop();
Object three = stack.pop();
Object four = null;
if (!(three instanceof Double) && !(three instanceof Long))
four = stack.pop();
if (!(one instanceof Double) && !(one instanceof Long))
stack.push(two);
stack.push(one);
if (!(three instanceof Double) && !(three instanceof Long))
stack.push(four);
stack.push(three);
if (!(one instanceof Double) && !(one instanceof Long))
stack.push(two);
stack.push(one);
}
}

View File

@@ -0,0 +1,30 @@
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;
import java.io.IOException;
public class Dup_X1 extends Instruction
{
public Dup_X1(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object one = stack.pop();
Object two = stack.pop();
stack.push(one);
stack.push(two);
stack.push(one);
}
}

View File

@@ -0,0 +1,35 @@
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;
import java.io.IOException;
public class Dup_X2 extends Instruction
{
public Dup_X2(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object one = stack.pop();
Object two = stack.pop();
Object three = null;
if (!(two instanceof Double) && !(two instanceof Long))
three = stack.pop();
stack.push(one);
if (!(two instanceof Double) && !(two instanceof Long))
stack.push(three);
stack.push(two);
stack.push(one);
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class F2D extends Instruction
{
public F2D(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Float;
Float f = (Float) obj;
stack.push(f.doubleValue());
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class F2I extends Instruction
{
public F2I(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Float;
Float f = (Float) obj;
stack.push(f.intValue());
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class F2L extends Instruction
{
public F2L(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Float;
Float f = (Float) obj;
stack.push(f.longValue());
}
}

View File

@@ -0,0 +1,35 @@
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;
import java.io.IOException;
public class FCmpG extends Instruction
{
public FCmpG(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Float one = (Float) stack.pop();
Float two = (Float) stack.pop();
if (one.isNaN() || two.isNaN())
stack.push(1);
else if (one > two)
stack.push(1);
else if (one < two)
stack.push(-1);
else
stack.push(0);
}
}

View File

@@ -0,0 +1,35 @@
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;
import java.io.IOException;
public class FCmpL extends Instruction
{
public FCmpL(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Float one = (Float) stack.pop();
Float two = (Float) stack.pop();
if (one.isNaN() || two.isNaN())
stack.push(-1);
else if (one > two)
stack.push(1);
else if (one < two)
stack.push(-1);
else
stack.push(0);
}
}

View File

@@ -2,12 +2,17 @@ package info.sigterm.deob.attributes.code.instructions;
import info.sigterm.deob.ClassFile;
import info.sigterm.deob.ConstantPool;
import info.sigterm.deob.attributes.ConstantValue;
import info.sigterm.deob.attributes.code.Instruction;
import info.sigterm.deob.attributes.code.InstructionType;
import info.sigterm.deob.attributes.code.Instructions;
import info.sigterm.deob.execution.ClassInstance;
import info.sigterm.deob.execution.Frame;
import info.sigterm.deob.execution.StaticFieldInstance;
import info.sigterm.deob.pool.Class;
import info.sigterm.deob.pool.Field;
import info.sigterm.deob.pool.NameAndType;
import info.sigterm.deob.pool.PoolEntry;
import java.io.DataInputStream;
import java.io.IOException;
@@ -25,6 +30,35 @@ public class GetStatic extends Instruction
length += 2;
}
@Override
public void execute(Frame frame)
{
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile();
ConstantPool pool = thisClass.getPool();
Field entry = (Field) pool.getEntry(index);
Class clazz = entry.getClassEntry();
NameAndType nat = entry.getNameAndType();
ClassFile cf = thisClass.getGroup().findClass(clazz.getName());
if (cf == null)
{
Object ovalue = nat.getStackObject();
frame.getStack().push(ovalue);
return;
}
ClassInstance ci = frame.getPath().getClassInstance(cf);
StaticFieldInstance fi = ci.findStaticField(nat);
ConstantValue value = fi.getValue();
PoolEntry pe = value.getValue();
Object ovalue = pe.getObject();
frame.getStack().push(ovalue);
}
@Override
public void buildInstructionGraph()
{

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class I2B extends Instruction
{
public I2B(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Integer;
Integer i = (Integer) obj;
stack.push(i.byteValue());
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class I2C extends Instruction
{
public I2C(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Integer;
Integer i = (Integer) obj;
stack.push((char) i.intValue());
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class I2D extends Instruction
{
public I2D(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Integer;
Integer i = (Integer) obj;
stack.push(i.doubleValue());
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class I2F extends Instruction
{
public I2F(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Integer;
Integer i = (Integer) obj;
stack.push(i.floatValue());
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class I2L extends Instruction
{
public I2L(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Integer;
Integer i = (Integer) obj;
stack.push(i.longValue());
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class I2S extends Instruction
{
public I2S(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Integer;
Integer i = (Integer) obj;
stack.push(i.shortValue());
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class L2D extends Instruction
{
public L2D(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Long;
Long l = (Long) obj;
stack.push(l.doubleValue());
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class L2F extends Instruction
{
public L2F(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Long;
Long l = (Long) obj;
stack.push(l.floatValue());
}
}

View File

@@ -0,0 +1,29 @@
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;
import java.io.IOException;
public class L2I extends Instruction
{
public L2I(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Object obj = stack.pop();
assert obj instanceof Long;
Long l = (Long) obj;
stack.push(l.intValue());
}
}

View File

@@ -0,0 +1,33 @@
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;
import java.io.IOException;
public class LCmp extends Instruction
{
public LCmp(Instructions instructions, InstructionType type, int pc) throws IOException
{
super(instructions, type, pc);
}
@Override
public void execute(Frame frame)
{
Stack stack = frame.getStack();
Long one = (Long) stack.pop();
Long two = (Long) stack.pop();
if (one > two)
stack.push(1);
else if (one < two)
stack.push(-1);
else
stack.push(0);
}
}