Search in sources :

Example 46 with StackContext

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

the class IShR 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 47 with StackContext

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

the class If method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext one = stack.pop();
    StackContext two = stack.pop();
    ins.pop(one, two);
    Frame other = frame.dup();
    other.jump(ins, to);
    ins.branch(other);
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) Frame(net.runelite.asm.execution.Frame) StackContext(net.runelite.asm.execution.StackContext) Stack(net.runelite.asm.execution.Stack)

Example 48 with StackContext

use of net.runelite.asm.execution.StackContext 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 49 with StackContext

use of net.runelite.asm.execution.StackContext 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 50 with StackContext

use of net.runelite.asm.execution.StackContext 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)

Aggregations

StackContext (net.runelite.asm.execution.StackContext)162 InstructionContext (net.runelite.asm.execution.InstructionContext)153 Stack (net.runelite.asm.execution.Stack)119 Value (net.runelite.asm.execution.Value)47 Field (net.runelite.asm.Field)15 Variables (net.runelite.asm.execution.Variables)14 VariableContext (net.runelite.asm.execution.VariableContext)13 Instruction (net.runelite.asm.attributes.code.Instruction)12 GetFieldInstruction (net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction)12 Instructions (net.runelite.asm.attributes.code.Instructions)8 PushConstantInstruction (net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction)8 LVTInstruction (net.runelite.asm.attributes.code.instruction.types.LVTInstruction)7 Execution (net.runelite.asm.execution.Execution)7 Frame (net.runelite.asm.execution.Frame)7 DupInstruction (net.runelite.asm.attributes.code.instruction.types.DupInstruction)6 InvokeInstruction (net.runelite.asm.attributes.code.instruction.types.InvokeInstruction)6 Method (net.runelite.asm.pool.Method)5 ClassFile (net.runelite.asm.ClassFile)4 Method (net.runelite.asm.Method)4 Type (net.runelite.asm.Type)4