This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
AJP/DiSLProject2022/src-profiler/ex6/LoopContext.java

22 lines
774 B
Java
Raw Normal View History

2023-01-09 07:01:15 +00:00
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;
}
}