package ex8; import ch.usi.dag.disl.annotation.Before; import ch.usi.dag.disl.marker.BytecodeMarker; import org.objectweb.asm.Opcodes; public class Instrumentation { @Before(marker = BytecodeMarker.class, args = "invokestatic,invokespecial,invokevirtual,invokedynamic", scope = "*") static void handleInvoke(InvocationContext ic) { switch (ic.getInvocationOp()){ case Opcodes.INVOKEDYNAMIC -> Profiler.countInvoke(Thread.currentThread().getName(), "dynamic"); case Opcodes.INVOKEVIRTUAL -> Profiler.countInvoke(Thread.currentThread().getName(), "virtual"); case Opcodes.INVOKESTATIC -> Profiler.countInvoke(Thread.currentThread().getName(), "static"); case Opcodes.INVOKESPECIAL -> Profiler.countInvoke(Thread.currentThread().getName(), "special"); } } }