< prev index next >

src/jdk.jfr/share/classes/jdk/jfr/internal/instrument/ConstructorWriter.java

Print this page
rev 52456 : imported patch asm.additional


  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.internal.instrument;
  27 
  28 import static jdk.internal.org.objectweb.asm.Opcodes.ACONST_NULL;
  29 import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
  30 import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC;
  31 import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
  32 import jdk.internal.org.objectweb.asm.MethodVisitor;
  33 import jdk.internal.org.objectweb.asm.Opcodes;
  34 
  35 final class ConstructorWriter extends MethodVisitor {
  36 
  37     private boolean useInputParameter;
  38     private String shortClassName;
  39     private String fullClassName;
  40 
  41     ConstructorWriter(Class<?> classToChange, boolean useInputParameter) {
  42         super(Opcodes.ASM5);
  43         this.useInputParameter = useInputParameter;
  44         shortClassName = classToChange.getSimpleName();
  45         fullClassName = classToChange.getName().replace('.', '/');
  46     }
  47 
  48     @Override
  49     public void visitInsn(int opcode)
  50     {
  51         if (opcode == RETURN) {
  52             if (useInputParameter) {
  53                 useInput();
  54             } else {
  55                 noInput();
  56             }
  57         }
  58         mv.visitInsn(opcode);
  59     }
  60     @SuppressWarnings("deprecation")
  61     private void useInput()
  62     {




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.internal.instrument;
  27 
  28 import static jdk.internal.org.objectweb.asm.Opcodes.ACONST_NULL;
  29 import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
  30 import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC;
  31 import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
  32 import jdk.internal.org.objectweb.asm.MethodVisitor;
  33 import jdk.internal.org.objectweb.asm.Opcodes;
  34 
  35 final class ConstructorWriter extends MethodVisitor {
  36 
  37     private boolean useInputParameter;
  38     private String shortClassName;
  39     private String fullClassName;
  40 
  41     ConstructorWriter(Class<?> classToChange, boolean useInputParameter) {
  42         super(Opcodes.ASM7);
  43         this.useInputParameter = useInputParameter;
  44         shortClassName = classToChange.getSimpleName();
  45         fullClassName = classToChange.getName().replace('.', '/');
  46     }
  47 
  48     @Override
  49     public void visitInsn(int opcode)
  50     {
  51         if (opcode == RETURN) {
  52             if (useInputParameter) {
  53                 useInput();
  54             } else {
  55                 noInput();
  56             }
  57         }
  58         mv.visitInsn(opcode);
  59     }
  60     @SuppressWarnings("deprecation")
  61     private void useInput()
  62     {


< prev index next >