summaryrefslogtreecommitdiffstats
path: root/java-allocation-instrumenter/src/main/java/com/google/monitoring/runtime/instrumentation/AllocationClassAdapter.java
diff options
context:
space:
mode:
Diffstat (limited to 'java-allocation-instrumenter/src/main/java/com/google/monitoring/runtime/instrumentation/AllocationClassAdapter.java')
-rw-r--r--java-allocation-instrumenter/src/main/java/com/google/monitoring/runtime/instrumentation/AllocationClassAdapter.java56
1 files changed, 0 insertions, 56 deletions
diff --git a/java-allocation-instrumenter/src/main/java/com/google/monitoring/runtime/instrumentation/AllocationClassAdapter.java b/java-allocation-instrumenter/src/main/java/com/google/monitoring/runtime/instrumentation/AllocationClassAdapter.java
deleted file mode 100644
index d66bd15..0000000
--- a/java-allocation-instrumenter/src/main/java/com/google/monitoring/runtime/instrumentation/AllocationClassAdapter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2009 Google Inc. All Rights Reserved.
-
-package com.google.monitoring.runtime.instrumentation;
-
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-import org.objectweb.asm.commons.LocalVariablesSorter;
-import org.objectweb.asm.commons.JSRInlinerAdapter;
-
-/**
- * Instruments bytecodes that allocate heap memory to call a recording hook.
- * A <code>ClassVisitor</code> that processes methods with a
- * <code>AllocationMethodAdapter</code> to instrument heap allocations.
- *
- * @author jeremymanson@google.com (Jeremy Manson)
- * @author fischman@google.com (Ami Fischman) (Original Author)
- */
-class AllocationClassAdapter extends ClassVisitor {
- private final String recorderClass;
- private final String recorderMethod;
-
- public AllocationClassAdapter(ClassVisitor cv, String recorderClass,
- String recorderMethod) {
- super(Opcodes.ASM4, cv);
- this.recorderClass = recorderClass;
- this.recorderMethod = recorderMethod;
- }
-
- /**
- * For each method in the class being instrumented, <code>visitMethod</code>
- * is called and the returned MethodVisitor is used to visit the method.
- * Note that a new MethodVisitor is constructed for each method.
- */
- @Override
- public MethodVisitor visitMethod(int access, String base, String desc,
- String signature, String[] exceptions) {
- MethodVisitor mv =
- cv.visitMethod(access, base, desc, signature, exceptions);
-
- if (mv != null) {
- // We need to compute stackmaps (see
- // AllocationInstrumenter#instrument). This can't really be
- // done for old bytecode that contains JSR and RET instructions.
- // So, we remove JSRs and RETs.
- JSRInlinerAdapter jsria = new JSRInlinerAdapter(
- mv, access, base, desc, signature, exceptions);
- AllocationMethodAdapter aimv =
- new AllocationMethodAdapter(jsria, recorderClass, recorderMethod);
- LocalVariablesSorter lvs = new LocalVariablesSorter(access, desc, aimv);
- aimv.lvs = lvs;
- mv = lvs;
- }
- return mv;
- }
-}