Search in sources :

Example 26 with Value

use of net.runelite.asm.execution.Value in project runelite by runelite.

the class FNeg method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext value = stack.pop();
    ins.pop(value);
    Value result = Value.UNKNOWN;
    if (!value.getValue().isUnknownOrNull()) {
        float f = (float) value.getValue().getValue();
        result = new Value(-f);
    }
    StackContext ctx = new StackContext(ins, Type.FLOAT, result);
    stack.push(ctx);
    ins.push(ctx);
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Value(net.runelite.asm.execution.Value) Stack(net.runelite.asm.execution.Stack)

Example 27 with Value

use of net.runelite.asm.execution.Value in project runelite by runelite.

the class SiPush method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    // sign extend
    StackContext ctx = new StackContext(ins, Type.INT, new Value((int) s));
    stack.push(ctx);
    ins.push(ctx);
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Value(net.runelite.asm.execution.Value) Stack(net.runelite.asm.execution.Stack)

Example 28 with Value

use of net.runelite.asm.execution.Value in project runelite by runelite.

the class LAnd method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext two = stack.pop();
    StackContext one = stack.pop();
    ins.pop(two, one);
    Value result = Value.UNKNOWN;
    if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull()) {
        long l2 = (long) two.getValue().getValue(), l1 = (long) one.getValue().getValue();
        result = new Value(l1 & l2);
    }
    StackContext ctx = new StackContext(ins, Type.LONG, result);
    stack.push(ctx);
    ins.push(ctx);
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Value(net.runelite.asm.execution.Value) Stack(net.runelite.asm.execution.Stack)

Example 29 with Value

use of net.runelite.asm.execution.Value in project runelite by runelite.

the class LCmp method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext two = stack.pop();
    StackContext one = stack.pop();
    ins.pop(two, one);
    Value result = Value.UNKNOWN;
    if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull()) {
        long l2 = (long) two.getValue().getValue(), l1 = (long) one.getValue().getValue();
        if (l1 > l2) {
            result = new Value(1);
        } else if (l1 == l2) {
            result = new Value(0);
        } else if (l1 < l2) {
            result = new Value(-1);
        }
    }
    StackContext ctx = new StackContext(ins, Type.INT, result);
    stack.push(ctx);
    ins.push(ctx);
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Value(net.runelite.asm.execution.Value) Stack(net.runelite.asm.execution.Stack)

Example 30 with Value

use of net.runelite.asm.execution.Value in project runelite by runelite.

the class LDC method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext ctx = new StackContext(ins, Type.getType(value), new Value(value));
    stack.push(ctx);
    ins.push(ctx);
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Value(net.runelite.asm.execution.Value) Stack(net.runelite.asm.execution.Stack)

Aggregations

InstructionContext (net.runelite.asm.execution.InstructionContext)48 Value (net.runelite.asm.execution.Value)48 Stack (net.runelite.asm.execution.Stack)47 StackContext (net.runelite.asm.execution.StackContext)47 Variables (net.runelite.asm.execution.Variables)3 Instructions (net.runelite.asm.attributes.code.Instructions)2 Frame (net.runelite.asm.execution.Frame)2 VariableContext (net.runelite.asm.execution.VariableContext)2 Test (org.junit.Test)2 Instruction (net.runelite.asm.attributes.code.Instruction)1 ParallelExecutorMapping (net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping)1