Search in sources :

Example 86 with InstructionContext

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

the class PutField method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext value = stack.pop();
    StackContext object = stack.pop();
    ins.pop(value, object);
    if (myField != null) {
        frame.getExecution().order(frame, myField);
    }
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Stack(net.runelite.asm.execution.Stack)

Example 87 with InstructionContext

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

the class PutField method map.

@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other) {
    net.runelite.asm.Field myField = this.getMyField();
    net.runelite.asm.Field otherField = ((PutField) other.getInstruction()).getMyField();
    assert MappingExecutorUtil.isMaybeEqual(myField.getType(), otherField.getType());
    mapping.map(this, myField, otherField);
    // map assignment
    StackContext object1 = ctx.getPops().get(1), object2 = other.getPops().get(1);
    InstructionContext base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
    InstructionContext base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
    mapGetFieldInstructrions(mapping, base1, base2);
    // map value
    object1 = ctx.getPops().get(0);
    object2 = other.getPops().get(0);
    base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
    base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
    mapGetFieldInstructrions(mapping, base1, base2);
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext)

Example 88 with InstructionContext

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

the class PutStatic method map.

@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other) {
    net.runelite.asm.Field myField = this.getMyField();
    net.runelite.asm.Field otherField = ((PutStatic) other.getInstruction()).getMyField();
    assert MappingExecutorUtil.isMaybeEqual(myField.getType(), otherField.getType());
    mapping.map(this, myField, otherField);
    StackContext 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();
        net.runelite.asm.Field f1 = gf1.getMyField();
        net.runelite.asm.Field f2 = gf2.getMyField();
        if (f1 != null && f2 != null) {
            mapping.map(this, f1, f2);
        }
    }
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) GetFieldInstruction(net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction)

Example 89 with InstructionContext

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

the class PutStatic 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);
    if (myField != null) {
        frame.getExecution().order(frame, myField);
    }
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Stack(net.runelite.asm.execution.Stack)

Example 90 with InstructionContext

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

the class Return method map.

@Override
public void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other) {
    StackContext s1 = ctx.getPops().get(0);
    StackContext s2 = other.getPops().get(0);
    InstructionContext i1 = MappingExecutorUtil.resolve(s1.getPushed(), s1);
    InstructionContext i2 = MappingExecutorUtil.resolve(s2.getPushed(), s2);
    if (i1.getInstruction() instanceof GetFieldInstruction && i2.getInstruction() instanceof GetFieldInstruction) {
        GetFieldInstruction f1 = (GetFieldInstruction) i1.getInstruction();
        GetFieldInstruction f2 = (GetFieldInstruction) i2.getInstruction();
        Field fi1 = f1.getMyField(), fi2 = f2.getMyField();
        if (fi1 != null && fi2 != null) {
            mappings.map(this, fi1, fi2);
        }
    }
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) Field(net.runelite.asm.Field) StackContext(net.runelite.asm.execution.StackContext) GetFieldInstruction(net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction)

Aggregations

InstructionContext (net.runelite.asm.execution.InstructionContext)179 StackContext (net.runelite.asm.execution.StackContext)153 Stack (net.runelite.asm.execution.Stack)120 Value (net.runelite.asm.execution.Value)48 Field (net.runelite.asm.Field)18 Instruction (net.runelite.asm.attributes.code.Instruction)18 Variables (net.runelite.asm.execution.Variables)16 GetFieldInstruction (net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction)15 VariableContext (net.runelite.asm.execution.VariableContext)14 Instructions (net.runelite.asm.attributes.code.Instructions)12 Frame (net.runelite.asm.execution.Frame)12 PushConstantInstruction (net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction)11 Execution (net.runelite.asm.execution.Execution)11 LVTInstruction (net.runelite.asm.attributes.code.instruction.types.LVTInstruction)9 InvokeInstruction (net.runelite.asm.attributes.code.instruction.types.InvokeInstruction)8 IMul (net.runelite.asm.attributes.code.instructions.IMul)7 ClassFile (net.runelite.asm.ClassFile)6 Method (net.runelite.asm.Method)6 Label (net.runelite.asm.attributes.code.Label)6 DupInstruction (net.runelite.asm.attributes.code.instruction.types.DupInstruction)6