From 783b90bdd20bf4863a854cc130a75e5e0a170146 Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Mon, 9 Jan 2023 18:04:35 +0100 Subject: [PATCH] fix ex5 --- DiSLProject2022/src-profiler/ex5/Instrumentation.java | 9 +++++++-- DiSLProject2022/src-profiler/ex8/InvocationContext.java | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/DiSLProject2022/src-profiler/ex5/Instrumentation.java b/DiSLProject2022/src-profiler/ex5/Instrumentation.java index 3ed21f8..81d5dca 100644 --- a/DiSLProject2022/src-profiler/ex5/Instrumentation.java +++ b/DiSLProject2022/src-profiler/ex5/Instrumentation.java @@ -13,9 +13,14 @@ public class Instrumentation { Profiler.addSafeAllocation(); } -// TODO why is it always 0 @Before(marker = BodyMarker.class, scope = "jdk.internal.misc.Unsafe.allocateInstance") - static void handleUnsafeAllocation() { + static void handleUnsafeAllocations() { + Profiler.addUnsafeAllocation(); + } + + + @Before(marker = BodyMarker.class, scope = "sun.misc.Unsafe.allocateInstance") + static void handleUnsafeAllocationsPraiseTheSun() { Profiler.addUnsafeAllocation(); } } diff --git a/DiSLProject2022/src-profiler/ex8/InvocationContext.java b/DiSLProject2022/src-profiler/ex8/InvocationContext.java index d4ce4b7..de705e8 100644 --- a/DiSLProject2022/src-profiler/ex8/InvocationContext.java +++ b/DiSLProject2022/src-profiler/ex8/InvocationContext.java @@ -4,7 +4,7 @@ import ch.usi.dag.disl.staticcontext.AbstractStaticContext; import org.objectweb.asm.tree.AbstractInsnNode; public class InvocationContext extends AbstractStaticContext { - public int getInvocationOp(){ + public int getInvocationOp() { final AbstractInsnNode ins = staticContextData.getRegionStart(); return ins.getOpcode(); }