Search in sources :

Example 26 with StackContext

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

the class AStore method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    Variables variables = frame.getVariables();
    StackContext object = stack.pop();
    ins.pop(object);
    variables.set(index, new VariableContext(ins, object));
    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 27 with StackContext

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

the class ArrayStore method map.

@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other) {
    assert ctx.getInstruction().getClass() == other.getInstruction().getClass();
    Field myField = this.getMyField(ctx), otherField = ((ArrayStore) other.getInstruction()).getMyField(other);
    mapping.map(this, myField, otherField);
    // map value
    StackContext // value set to.
    object1 = ctx.getPops().get(0), object2 = other.getPops().get(0);
    InstructionContext base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
    InstructionContext base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
    if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction) {
        GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(), gf2 = (GetFieldInstruction) base2.getInstruction();
        Field f1 = gf1.getMyField(), f2 = gf2.getMyField();
        assert MappingExecutorUtil.isMaybeEqual(f1, f2);
        if (f1 != null && f2 != null) {
            mapping.map(this, f1, f2);
        }
    }
}
Also used : Field(net.runelite.asm.Field) InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) GetFieldInstruction(net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction)

Example 28 with StackContext

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

the class BAStore method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext value = stack.pop();
    StackContext index = stack.pop();
    StackContext array = stack.pop();
    ins.pop(value, index, array);
    array.getValue().arraySet(index.getValue(), value.getValue());
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Stack(net.runelite.asm.execution.Stack)

Example 29 with StackContext

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

the class SubtractionInstruction method map.

@Override
default void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other) {
    StackContext s1 = ctx.getPops().get(0), s2 = ctx.getPops().get(1);
    StackContext o1 = other.getPops().get(0), o2 = other.getPops().get(1);
    InstructionContext i1 = MappingExecutorUtil.resolve(s1.getPushed(), s1);
    InstructionContext i2 = MappingExecutorUtil.resolve(s2.getPushed(), s2);
    InstructionContext io1 = MappingExecutorUtil.resolve(o1.getPushed(), o1);
    InstructionContext io2 = MappingExecutorUtil.resolve(o2.getPushed(), o2);
    if (i1.getInstruction() instanceof GetFieldInstruction && io1.getInstruction() instanceof GetFieldInstruction) {
        GetFieldInstruction f1 = (GetFieldInstruction) i1.getInstruction();
        GetFieldInstruction f2 = (GetFieldInstruction) io1.getInstruction();
        Field fi1 = f1.getMyField(), fi2 = f2.getMyField();
        assert MappingExecutorUtil.isMaybeEqual(fi1, fi2);
        if (fi1 != null && fi2 != null) {
            mappings.map((Instruction) this, fi1, fi2);
        }
    }
    if (i2.getInstruction() instanceof GetFieldInstruction && io2.getInstruction() instanceof GetFieldInstruction) {
        GetFieldInstruction f1 = (GetFieldInstruction) i2.getInstruction();
        GetFieldInstruction f2 = (GetFieldInstruction) io2.getInstruction();
        Field fi1 = f1.getMyField(), fi2 = f2.getMyField();
        assert MappingExecutorUtil.isMaybeEqual(fi1, fi2);
        if (fi1 != null && fi2 != null) {
            mappings.map((Instruction) this, fi1, fi2);
        }
    }
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) Field(net.runelite.asm.Field) StackContext(net.runelite.asm.execution.StackContext)

Example 30 with StackContext

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

the class AConstNull method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext ctx = new StackContext(ins, Type.OBJECT, Value.NULL);
    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)

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