use of net.runelite.asm.execution.StackContext in project runelite by runelite.
the class InvokeSpecial method execute.
@Override
public InstructionContext execute(Frame frame) {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
int count = method.getType().size();
for (int i = 0; i < count; ++i) {
StackContext arg = stack.pop();
ins.pop(arg);
}
StackContext object = stack.pop();
ins.pop(object);
if (!method.getType().isVoid()) {
StackContext ctx = new StackContext(ins, method.getType().getReturnValue(), Value.UNKNOWN);
stack.push(ctx);
ins.push(ctx);
}
if (myMethod != null) {
ins.invoke(myMethod);
assert myMethod.getCode() != null;
// add possible method call to execution
Execution execution = frame.getExecution();
execution.invoke(ins, myMethod);
frame.getExecution().order(frame, myMethod);
}
return ins;
}
use of net.runelite.asm.execution.StackContext in project runelite by runelite.
the class InvokeStatic method map.
@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other) {
List<net.runelite.asm.Method> myMethods = this.getMethods(), otherMethods = ((InvokeStatic) other.getInstruction()).getMethods();
assert myMethods.size() == otherMethods.size();
for (int i = 0; i < myMethods.size(); ++i) {
mapping.map(this, myMethods.get(i), otherMethods.get(i));
}
for (int i = 0; i < ctx.getPops().size(); ++i) {
StackContext s1 = ctx.getPops().get(i), s2 = other.getPops().get(i);
InstructionContext base1 = MappingExecutorUtil.resolve(s1.getPushed(), s1);
InstructionContext base2 = MappingExecutorUtil.resolve(s2.getPushed(), s2);
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();
if (f1 != null && f2 != null) {
mapping.map(this, f1, f2);
}
}
}
}
use of net.runelite.asm.execution.StackContext in project runelite by runelite.
the class GetField 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, field.getType(), Value.UNKNOWN);
stack.push(ctx);
ins.push(ctx);
if (myField != null) {
frame.getExecution().order(frame, myField);
}
return ins;
}
use of net.runelite.asm.execution.StackContext in project runelite by runelite.
the class I2B 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);
// sign extneded
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.StackContext in project runelite by runelite.
the class I2D 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.DOUBLE, object.getValue().cast(double.class));
stack.push(ctx);
ins.push(ctx);
return ins;
}
Aggregations