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);
}
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);
}
}
}
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;
}
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);
}
}
}
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;
}
Aggregations