Search in sources :

Example 41 with Stack

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

the class LLoad method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    Variables variables = frame.getVariables();
    VariableContext vctx = variables.get(index);
    assert vctx.getType().equals(Type.LONG);
    ins.read(vctx);
    StackContext ctx = new StackContext(ins, vctx);
    stack.push(ctx);
    ins.push(ctx);
    return ins;
}
Also used : Variables(net.runelite.asm.execution.Variables) InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) VariableContext(net.runelite.asm.execution.VariableContext) Stack(net.runelite.asm.execution.Stack)

Example 42 with Stack

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

the class LMul 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 43 with Stack

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

the class LOr 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 44 with Stack

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

the class LRem 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 (l2 != 0L)
            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 45 with Stack

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

the class LShL 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().as(long.class), l1 = (long) two.getValue().as(long.class);
        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)

Aggregations

InstructionContext (net.runelite.asm.execution.InstructionContext)120 Stack (net.runelite.asm.execution.Stack)120 StackContext (net.runelite.asm.execution.StackContext)119 Value (net.runelite.asm.execution.Value)47 Variables (net.runelite.asm.execution.Variables)13 VariableContext (net.runelite.asm.execution.VariableContext)11 Frame (net.runelite.asm.execution.Frame)8 Execution (net.runelite.asm.execution.Execution)4 Instructions (net.runelite.asm.attributes.code.Instructions)3 Test (org.junit.Test)3 Type (net.runelite.asm.Type)2 InstructionType (net.runelite.asm.attributes.code.InstructionType)2 Label (net.runelite.asm.attributes.code.Label)2 Instruction (net.runelite.asm.attributes.code.Instruction)1 ParallelExecutorMapping (net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping)1