package ex6; import ch.usi.dag.disl.staticcontext.AbstractStaticContext; import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.InsnList; import org.objectweb.asm.tree.JumpInsnNode; public class LoopContext extends AbstractStaticContext { // considered loop instruction if loop footer. public boolean isLoopInstruction() { final InsnList insList = staticContextData.getMethodNode().instructions; final AbstractInsnNode ins = staticContextData.getRegionStart(); if (ins instanceof final JumpInsnNode jIns) { final int nextInsOffset = insList.indexOf(jIns.label); final int insOffset = insList.indexOf(jIns); return nextInsOffset < insOffset; } return false; } }