Class JSRInlinerAdapter

All Implemented Interfaces:
Opcodes

public class JSRInlinerAdapter extends MethodNode implements Opcodes
A MethodVisitor that removes JSR instructions and inlines the referenced subroutines.
  • Constructor Details

    • JSRInlinerAdapter

      public JSRInlinerAdapter(MethodVisitor methodVisitor, int access, String name, String descriptor, String signature, String[] exceptions)
      Constructs a new JSRInlinerAdapter. Subclasses must not use this constructor. Instead, they must use the JSRInlinerAdapter(int, MethodVisitor, int, String, String, String, String[]) version.
      Parameters:
      methodVisitor - the method visitor to send the resulting inlined method code to, or null.
      access - the method's access flags.
      name - the method's name.
      descriptor - the method's descriptor.
      signature - the method's signature. May be null.
      exceptions - the internal names of the method's exception classes (see Type.getInternalName()). May be null.
      Throws:
      IllegalStateException - if a subclass calls this constructor.
    • JSRInlinerAdapter

      protected JSRInlinerAdapter(int api, MethodVisitor methodVisitor, int access, String name, String descriptor, String signature, String[] exceptions)
      Constructs a new JSRInlinerAdapter.
      Parameters:
      api - the ASM API version implemented by this visitor. Must be one of the ASMx values in Opcodes.
      methodVisitor - the method visitor to send the resulting inlined method code to, or null.
      access - the method's access flags (see Opcodes). This parameter also indicates if the method is synthetic and/or deprecated.
      name - the method's name.
      descriptor - the method's descriptor.
      signature - the method's signature. May be null.
      exceptions - the internal names of the method's exception classes (see Type.getInternalName()). May be null.
  • Method Details

    • setComputeLimits

      public void setComputeLimits(int maxBytes, long maxOperations)
      Sets the maximum number of bytes which can be allocated, and the maximum number of "operations" which can be performed, to inline the subroutines. Operations are not formally defined but their total number is deterministic and approximatively proportional to the computation time.

      The default limits should be sufficient for any "normal" class. You only need to set new limits if visitEnd() throws a LimitExceededException on some of your classes.

      Parameters:
      maxBytes - the maximum number of bytes which can be allocated. Not all object instantiations are tracked (and garbage collection is ignored), but the most important ones are. The default value is 20MB.
      maxOperations - the maximum number of "operations" that can be performed. The default value is 100M.
    • visitJumpInsn

      public void visitJumpInsn(int opcode, Label label)
      Description copied from class: MethodVisitor
      Visits a jump instruction. A jump instruction is an instruction that may jump to another instruction.
      Overrides:
      visitJumpInsn in class MethodNode
      Parameters:
      opcode - the opcode of the type instruction to be visited. This opcode is either IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL.
      label - the operand of the instruction to be visited. This operand is a label that designates the instruction to which the jump instruction may jump.
    • visitEnd

      public void visitEnd()
      Description copied from class: MethodVisitor
      Visits the end of the method. This method, which is the last one to be called, is used to inform the visitor that all the annotations and attributes of the method have been visited.
      Overrides:
      visitEnd in class MethodNode