use of net.runelite.asm.execution.InstructionContext 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;
}
use of net.runelite.asm.execution.InstructionContext 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;
}
use of net.runelite.asm.execution.InstructionContext in project runelite by runelite.
the class Dup_X2 method getOriginal.
@Override
public StackContext getOriginal(StackContext sctx) {
// 3 2 1 -> 1 3 2 1
InstructionContext ctx = sctx.getPushed();
assert ctx.getInstruction() == this;
assert ctx.getPushes().contains(sctx);
int pushedIndex = ctx.getPushes().indexOf(sctx);
int poppedIndex;
switch(pushedIndex) {
case 0:
case 3:
poppedIndex = 0;
break;
case 1:
poppedIndex = 2;
break;
case 2:
poppedIndex = 1;
break;
default:
throw new IllegalStateException();
}
return ctx.getPops().get(poppedIndex);
}
use of net.runelite.asm.execution.InstructionContext in project runelite by runelite.
the class F2I 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.INT, object.getValue().cast(int.class));
stack.push(ctx);
ins.push(ctx);
return ins;
}
use of net.runelite.asm.execution.InstructionContext in project runelite by runelite.
the class FALoad method execute.
@Override
public InstructionContext execute(Frame frame) {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
StackContext index = stack.pop();
StackContext array = stack.pop();
ins.pop(index, array);
StackContext ctx = new StackContext(ins, Type.FLOAT, array.getValue().arrayGet(index.getValue()).cast(float.class));
stack.push(ctx);
ins.push(ctx);
return ins;
}
Aggregations