Search in sources :

Example 1 with StackContext

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

the class Dup_X1 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);
    StackContext ctx = new StackContext(ins, one.getType(), one.getValue());
    stack.push(ctx);
    ins.push(ctx);
    ctx = new StackContext(ins, two.getType(), two.getValue());
    stack.push(ctx);
    ins.push(ctx);
    ctx = new StackContext(ins, one.getType(), one.getValue());
    stack.push(ctx);
    ins.push(ctx);
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Stack(net.runelite.asm.execution.Stack)

Example 2 with StackContext

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

the class F2D method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext object = stack.pop();
    ins.pop(object);
    StackContext ctx = new StackContext(ins, Type.DOUBLE, object.getValue().cast(double.class));
    stack.push(ctx);
    ins.push(ctx);
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Stack(net.runelite.asm.execution.Stack)

Example 3 with StackContext

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

the class DSub 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();
        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 4 with StackContext

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

the class Dup2 method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext one = stack.pop();
    StackContext two = null;
    if (one.getType().getSize() == 1)
        two = stack.pop();
    ins.pop(one);
    if (two != null)
        ins.pop(two);
    if (two != null) {
        StackContext ctx = new StackContext(ins, two.getType(), two.getValue());
        stack.push(ctx);
        ins.push(ctx);
    }
    StackContext ctx = new StackContext(ins, one.getType(), one.getValue());
    stack.push(one);
    ins.push(ctx);
    if (two != null) {
        ctx = new StackContext(ins, two.getType(), two.getValue());
        stack.push(ctx);
        ins.push(ctx);
    }
    ctx = new StackContext(ins, one.getType(), one.getValue());
    stack.push(one);
    ins.push(ctx);
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Stack(net.runelite.asm.execution.Stack)

Example 5 with StackContext

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

the class Dup2_X2 method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext one = stack.pop();
    StackContext two = null;
    if (one.getType().getSize() == 1)
        two = stack.pop();
    StackContext three = stack.pop();
    StackContext four = null;
    if (one.getType().getSize() == 1)
        four = stack.pop();
    ins.pop(one);
    if (two != null)
        ins.pop(two);
    ins.pop(three);
    if (four != null)
        ins.pop(four);
    if (two != null) {
        StackContext ctx = new StackContext(ins, two.getType(), two.getValue());
        stack.push(ctx);
        ins.push(ctx);
    }
    StackContext ctx = new StackContext(ins, one.getType(), one.getValue());
    stack.push(one);
    ins.push(ctx);
    if (four != null) {
        ctx = new StackContext(ins, four.getType(), four.getValue());
        stack.push(ctx);
        ins.push(ctx);
    }
    ctx = new StackContext(ins, three.getType(), three.getValue());
    stack.push(one);
    ins.push(ctx);
    if (two != null) {
        ctx = new StackContext(ins, two.getType(), two.getValue());
        stack.push(ctx);
        ins.push(ctx);
    }
    ctx = new StackContext(ins, one.getType(), one.getValue());
    stack.push(one);
    ins.push(ctx);
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) 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