use of net.runelite.asm.execution.InstructionContext in project runelite by runelite.
the class IOr method execute.
@Override
public InstructionContext execute(Frame frame) {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
StackContext two = stack.pop();
StackContext one = stack.pop();
ins.pop(two, one);
Value result = Value.UNKNOWN;
if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull()) {
int i2 = (int) two.getValue().getValue(), i1 = (int) one.getValue().getValue();
result = new Value(i1 | i2);
}
StackContext ctx = new StackContext(ins, Type.INT, result);
stack.push(ctx);
ins.push(ctx);
return ins;
}
use of net.runelite.asm.execution.InstructionContext in project runelite by runelite.
the class InvokeVirtual method isSame.
@Override
public boolean isSame(InstructionContext thisIc, InstructionContext otherIc) {
if (thisIc.getInstruction().getClass() != otherIc.getInstruction().getClass()) {
return false;
}
InvokeVirtual thisIi = (InvokeVirtual) thisIc.getInstruction(), otherIi = (InvokeVirtual) otherIc.getInstruction();
if (!MappingExecutorUtil.isMaybeEqual(thisIi.method.getType(), otherIi.method.getType())) {
return false;
}
List<net.runelite.asm.Method> thisMethods = thisIi.getMethods(), otherMethods = otherIi.getMethods();
if (thisMethods.size() != otherMethods.size()) {
return false;
}
for (int i = 0; i < thisMethods.size(); ++i) {
net.runelite.asm.Method m1 = thisMethods.get(i);
net.runelite.asm.Method m2 = otherMethods.get(i);
// were loaded, which might not be the same
if (!MappingExecutorUtil.isMaybeEqual(m1.getDescriptor(), m2.getDescriptor())) {
return false;
}
// descriptors for all methods must be the same
break;
}
/* check arguments */
assert thisIc.getPops().size() == otherIc.getPops().size();
for (int i = 0; i < thisIc.getPops().size(); ++i) {
StackContext s1 = thisIc.getPops().get(i), s2 = otherIc.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 (!MappingExecutorUtil.isMaybeEqual(f1, f2)) {
return false;
}
}
}
/* check field that was invoked on */
StackContext object1 = thisIc.getPops().get(thisIi.method.getType().size()), object2 = otherIc.getPops().get(otherIi.method.getType().size());
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();
Field f1 = gf1.getMyField(), f2 = gf2.getMyField();
if (!MappingExecutorUtil.isMaybeEqual(f1, f2)) {
return false;
}
}
return true;
}
use of net.runelite.asm.execution.InstructionContext in project runelite by runelite.
the class L2D 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;
}
use of net.runelite.asm.execution.InstructionContext in project runelite by runelite.
the class LALoad 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.LONG, array.getValue().arrayGet(index.getValue()).cast(long.class));
stack.push(ctx);
ins.push(ctx);
return ins;
}
use of net.runelite.asm.execution.InstructionContext in project runelite by runelite.
the class L2I 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;
}
Aggregations