< prev index next >

src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/CodeSizeEvaluator.java

Print this page
rev 47452 : imported patch jdk-new-asmv6.patch


  58  */
  59 package jdk.internal.org.objectweb.asm.commons;
  60 
  61 import jdk.internal.org.objectweb.asm.Handle;
  62 import jdk.internal.org.objectweb.asm.Label;
  63 import jdk.internal.org.objectweb.asm.MethodVisitor;
  64 import jdk.internal.org.objectweb.asm.Opcodes;
  65 
  66 /**
  67  * A {@link MethodVisitor} that can be used to approximate method size.
  68  *
  69  * @author Eugene Kuleshov
  70  */
  71 public class CodeSizeEvaluator extends MethodVisitor implements Opcodes {
  72 
  73     private int minSize;
  74 
  75     private int maxSize;
  76 
  77     public CodeSizeEvaluator(final MethodVisitor mv) {
  78         this(Opcodes.ASM5, mv);
  79     }
  80 
  81     protected CodeSizeEvaluator(final int api, final MethodVisitor mv) {
  82         super(api, mv);
  83     }
  84 
  85     public int getMinSize() {
  86         return this.minSize;
  87     }
  88 
  89     public int getMaxSize() {
  90         return this.maxSize;
  91     }
  92 
  93     @Override
  94     public void visitInsn(final int opcode) {
  95         minSize += 1;
  96         maxSize += 1;
  97         if (mv != null) {
  98             mv.visitInsn(opcode);




  58  */
  59 package jdk.internal.org.objectweb.asm.commons;
  60 
  61 import jdk.internal.org.objectweb.asm.Handle;
  62 import jdk.internal.org.objectweb.asm.Label;
  63 import jdk.internal.org.objectweb.asm.MethodVisitor;
  64 import jdk.internal.org.objectweb.asm.Opcodes;
  65 
  66 /**
  67  * A {@link MethodVisitor} that can be used to approximate method size.
  68  *
  69  * @author Eugene Kuleshov
  70  */
  71 public class CodeSizeEvaluator extends MethodVisitor implements Opcodes {
  72 
  73     private int minSize;
  74 
  75     private int maxSize;
  76 
  77     public CodeSizeEvaluator(final MethodVisitor mv) {
  78         this(Opcodes.ASM6, mv);
  79     }
  80 
  81     protected CodeSizeEvaluator(final int api, final MethodVisitor mv) {
  82         super(api, mv);
  83     }
  84 
  85     public int getMinSize() {
  86         return this.minSize;
  87     }
  88 
  89     public int getMaxSize() {
  90         return this.maxSize;
  91     }
  92 
  93     @Override
  94     public void visitInsn(final int opcode) {
  95         minSize += 1;
  96         maxSize += 1;
  97         if (mv != null) {
  98             mv.visitInsn(opcode);


< prev index next >