< prev index next >

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

Print this page
rev 52456 : imported patch asm.additional


  53     private final String oldClass;
  54     private final String newClass;
  55     private final MethodNode inlineTarget;
  56     private final List<CatchBlock> blocks = new ArrayList<>();
  57     private boolean inlining;
  58 
  59     /**
  60      * inlineTarget defines the method to inline and also contains the actual
  61      * code to inline.
  62      *
  63      * @param access
  64      * @param desc
  65      * @param mv
  66      * @param inlineTarget
  67      * @param oldClass
  68      * @param newClass
  69      * @param logger
  70      */
  71     public JIMethodCallInliner(int access, String desc, MethodVisitor mv,
  72             MethodNode inlineTarget, String oldClass, String newClass) {
  73         super(Opcodes.ASM5, access, desc, mv);
  74         this.oldClass = oldClass;
  75         this.newClass = newClass;
  76         this.inlineTarget = inlineTarget;
  77 
  78         Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG, "MethodCallInliner: targetMethod=" + newClass + "."
  79                 + inlineTarget.name + inlineTarget.desc);
  80     }
  81 
  82     @Override
  83     public void visitMethodInsn(int opcode, String owner, String name,
  84             String desc, boolean itf) {
  85         // Now we are looking at method call in the source method
  86         if (!shouldBeInlined(owner, name, desc)) {
  87             // If this method call should not be inlined, just keep it
  88             mv.visitMethodInsn(opcode, owner, name, desc, itf);
  89             return;
  90         }
  91         // If the call should be inlined, we create a MethodInliningAdapter
  92         // The MIA will walk the instructions in the inlineTarget and add them
  93         // to the current method, doing the necessary name remappings.




  53     private final String oldClass;
  54     private final String newClass;
  55     private final MethodNode inlineTarget;
  56     private final List<CatchBlock> blocks = new ArrayList<>();
  57     private boolean inlining;
  58 
  59     /**
  60      * inlineTarget defines the method to inline and also contains the actual
  61      * code to inline.
  62      *
  63      * @param access
  64      * @param desc
  65      * @param mv
  66      * @param inlineTarget
  67      * @param oldClass
  68      * @param newClass
  69      * @param logger
  70      */
  71     public JIMethodCallInliner(int access, String desc, MethodVisitor mv,
  72             MethodNode inlineTarget, String oldClass, String newClass) {
  73         super(Opcodes.ASM7, access, desc, mv);
  74         this.oldClass = oldClass;
  75         this.newClass = newClass;
  76         this.inlineTarget = inlineTarget;
  77 
  78         Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG, "MethodCallInliner: targetMethod=" + newClass + "."
  79                 + inlineTarget.name + inlineTarget.desc);
  80     }
  81 
  82     @Override
  83     public void visitMethodInsn(int opcode, String owner, String name,
  84             String desc, boolean itf) {
  85         // Now we are looking at method call in the source method
  86         if (!shouldBeInlined(owner, name, desc)) {
  87             // If this method call should not be inlined, just keep it
  88             mv.visitMethodInsn(opcode, owner, name, desc, itf);
  89             return;
  90         }
  91         // If the call should be inlined, we create a MethodInliningAdapter
  92         // The MIA will walk the instructions in the inlineTarget and add them
  93         // to the current method, doing the necessary name remappings.


< prev index next >