use of net.runelite.asm.execution.Stack in project runelite by runelite.
the class AThrow method execute.
@Override
public InstructionContext execute(Frame frame) {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
// get exception
StackContext exception = stack.pop();
ins.pop(exception);
frame.stop();
return ins;
}
use of net.runelite.asm.execution.Stack in project runelite by runelite.
the class AALoad 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);
Type subtype;
if (array.getType().isArray()) {
subtype = array.getType().getSubtype();
} else {
// This will happen from aaloading from a aconst_null
subtype = array.getType();
}
StackContext ctx = new StackContext(ins, subtype, array.getValue().arrayGet(index.getValue()));
stack.push(ctx);
ins.push(ctx);
return ins;
}
use of net.runelite.asm.execution.Stack in project runelite by runelite.
the class ANewArray method execute.
@Override
public InstructionContext execute(Frame frame) {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
StackContext count = stack.pop();
ins.pop(count);
StackContext ctx = new StackContext(ins, type, Value.newArray(count.getValue()));
stack.push(ctx);
ins.push(ctx);
return ins;
}
use of net.runelite.asm.execution.Stack in project runelite by runelite.
the class InvokeInterface 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);
}
for (net.runelite.asm.Method method : getMethods()) {
ins.invoke(method);
if (method.getCode() == null) {
continue;
}
// add possible method call to execution
Execution execution = frame.getExecution();
execution.invoke(ins, method);
}
if (myMethods != null) {
for (net.runelite.asm.Method method : myMethods) {
frame.getExecution().order(frame, method);
}
}
return ins;
}
use of net.runelite.asm.execution.Stack in project runelite by runelite.
the class InvokeStatic 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);
}
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;
Execution execution = frame.getExecution();
if (execution.staticStep) {
Frame staticFrame = stepInto(frame, ins);
if (staticFrame != null) {
// this invokestatic instruction hasn't been added to this frame yet.. so it
// is not yet in the return frame
staticFrame.returnTo.addInstructionContext(ins);
staticFrame.returnTo.nextInstruction();
// returnTo has already be duped from frame which is why executing remains
// true and it is able to resume later
frame.stop();
}
} else {
// add possible method call to execution
execution.invoke(ins, myMethod);
}
frame.getExecution().order(frame, myMethod);
}
return ins;
}
Aggregations