Search in sources :

Example 81 with StackContext

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

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

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

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

Example 85 with StackContext

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

the class Swap 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);
    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