Search in sources :

Example 1 with LCmp

use of net.runelite.asm.attributes.code.instructions.LCmp in project runelite by runelite.

the class ModArith method getInsInExpr.

private static List<InstructionContext> getInsInExpr(InstructionContext ctx, Set<Instruction> set, boolean imul) {
    List<InstructionContext> l = new ArrayList<>();
    if (ctx == null || set.contains(ctx.getInstruction())) {
        return l;
    }
    set.add(ctx.getInstruction());
    if (imul) {
        if (!(ctx.getInstruction() instanceof IMul) & !(ctx.getInstruction() instanceof LMul)) {
            l.add(ctx);
            return l;
        }
    } else {
        // invoke and array store pops are unrelated to each other
        if (ctx.getInstruction() instanceof InvokeInstruction || ctx.getInstruction() instanceof ArrayStoreInstruction || ctx.getInstruction() instanceof ArrayLoad || ctx.getInstruction() instanceof If || ctx.getInstruction() instanceof If0 || ctx.getInstruction() instanceof LCmp || ctx.getInstruction() instanceof DivisionInstruction || ctx.getInstruction() instanceof IShR) {
            return l;
        }
        l.add(ctx);
    }
    for (StackContext s : ctx.getPops()) {
        l.addAll(getInsInExpr(s.getPushed(), set, imul));
    }
    for (StackContext s : ctx.getPushes()) {
        for (InstructionContext i : s.getPopped()) {
            l.addAll(getInsInExpr(i, set, imul));
        }
    }
    return l;
}
Also used : ArrayLoad(net.runelite.asm.attributes.code.instruction.types.ArrayLoad) InstructionContext(net.runelite.asm.execution.InstructionContext) DivisionInstruction(net.runelite.asm.attributes.code.instruction.types.DivisionInstruction) ArrayList(java.util.ArrayList) ArrayStoreInstruction(net.runelite.asm.attributes.code.instruction.types.ArrayStoreInstruction) InvokeInstruction(net.runelite.asm.attributes.code.instruction.types.InvokeInstruction) If0(net.runelite.asm.attributes.code.instructions.If0) IShR(net.runelite.asm.attributes.code.instructions.IShR) StackContext(net.runelite.asm.execution.StackContext) IMul(net.runelite.asm.attributes.code.instructions.IMul) LCmp(net.runelite.asm.attributes.code.instructions.LCmp) LMul(net.runelite.asm.attributes.code.instructions.LMul) If(net.runelite.asm.attributes.code.instructions.If)

Aggregations

ArrayList (java.util.ArrayList)1 ArrayLoad (net.runelite.asm.attributes.code.instruction.types.ArrayLoad)1 ArrayStoreInstruction (net.runelite.asm.attributes.code.instruction.types.ArrayStoreInstruction)1 DivisionInstruction (net.runelite.asm.attributes.code.instruction.types.DivisionInstruction)1 InvokeInstruction (net.runelite.asm.attributes.code.instruction.types.InvokeInstruction)1 IMul (net.runelite.asm.attributes.code.instructions.IMul)1 IShR (net.runelite.asm.attributes.code.instructions.IShR)1 If (net.runelite.asm.attributes.code.instructions.If)1 If0 (net.runelite.asm.attributes.code.instructions.If0)1 LCmp (net.runelite.asm.attributes.code.instructions.LCmp)1 LMul (net.runelite.asm.attributes.code.instructions.LMul)1 InstructionContext (net.runelite.asm.execution.InstructionContext)1 StackContext (net.runelite.asm.execution.StackContext)1