Search in sources :

Example 6 with Value

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

the class DNeg 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()) {
        double d = (double) value.getValue().getValue();
        result = new Value(-d);
    }
    StackContext ctx = new StackContext(ins, Type.DOUBLE, 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 7 with Value

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

the class DRem 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()) {
        double d2 = (double) two.getValue().getValue(), d1 = (double) one.getValue().getValue();
        if (d2 != 0.0d)
            result = new Value(d1 % d2);
    }
    StackContext ctx = new StackContext(ins, Type.DOUBLE, 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 8 with Value

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

the class FSub 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()) {
        float f2 = (float) two.getValue().getValue(), f1 = (float) one.getValue().getValue();
        result = new Value(f1 - f2);
    }
    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 9 with Value

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

the class IAnd 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()) {
        int i2 = (int) two.getValue().getValue(), i1 = (int) one.getValue().getValue();
        result = new Value(i1 & i2);
    }
    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 10 with Value

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

the class IInc method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Variables var = frame.getVariables();
    VariableContext vctx = var.get(index);
    assert vctx.getType().isStackInt();
    ins.read(vctx);
    Value value = vctx.getValue();
    if (!vctx.getValue().isUnknownOrNull()) {
        int i = (int) vctx.getValue().getValue();
        i += inc;
        value = new Value(i);
    }
    vctx = new VariableContext(ins, Type.INT, value);
    var.set(index, vctx);
    return ins;
}
Also used : Variables(net.runelite.asm.execution.Variables) InstructionContext(net.runelite.asm.execution.InstructionContext) Value(net.runelite.asm.execution.Value) VariableContext(net.runelite.asm.execution.VariableContext)

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