MethodVisitor that approximates the size of the methods it visits.
| Modifier and Type | Field and Description |
|---|---|
| private int | maxSize
The maximum size in bytes of the visited method. |
| private int | minSize
The minimum size in bytes of the visited method. |
| Access | Constructor and Description |
|---|---|
| public | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public int | |
| public void | visitFieldInsn(final int
the opcode of the type instruction to be visited. This opcode is either
GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD. opcode, final String the internal name of the field's owner class (see owner, final String Type#getInternalName()).the field's name. name, final String the field's descriptor (see descriptor)
Visits a field instruction.
Type). |
| public void | visitIincInsn(final int
index of the local variable to be incremented. varIndex, final int amount to increment the local variable by. increment)
Visits an IINC instruction.
|
| public void | visitInsn(final int
the opcode of the instruction to be visited. This opcode is either NOP,
ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5,
LCONST_0, LCONST_1, FCONST_0, FCONST_1, FCONST_2, DCONST_0, DCONST_1, IALOAD, LALOAD,
FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IASTORE, LASTORE, FASTORE, DASTORE,
AASTORE, BASTORE, CASTORE, SASTORE, POP, POP2, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2,
SWAP, IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV, LDIV,
FDIV, DDIV, IREM, LREM, FREM, DREM, INEG, LNEG, FNEG, DNEG, ISHL, LSHL, ISHR, LSHR, IUSHR,
LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I,
D2L, D2F, I2B, I2C, I2S, LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IRETURN, LRETURN, FRETURN,
DRETURN, ARETURN, RETURN, ARRAYLENGTH, ATHROW, MONITORENTER, or MONITOREXIT. opcode)Overrides org. |
| public void | visitIntInsn(final int
the opcode of the instruction to be visited. This opcode is either BIPUSH, SIPUSH
or NEWARRAY. opcode, final int the operand of the instruction to be visited. operand)When opcode is BIPUSH, operand value should be between Byte.MIN_VALUE and Byte.MAX_VALUE. When opcode is SIPUSH, operand value should be between Short.MIN_VALUE and Short.MAX_VALUE. When opcode is NEWARRAY, operand value should be one of Opcodes#T_BOOLEAN, Opcodes#T_CHAR, Opcodes#T_FLOAT, Opcodes#T_DOUBLE, Opcodes#T_BYTE,
Opcodes#T_SHORT, Opcodes#T_INT or Opcodes#T_LONG.Overrides org. |
| public void | visitInvokeDynamicInsn(final String
the method's name. name, final String the method's descriptor (see descriptor, final Handle Type).the bootstrap method. bootstrapMethodHandle, final Object... bootstrapMethodArguments)Overrides org. |
| public void | visitJumpInsn(final int
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. opcode, final 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. label)
Visits a jump instruction.
|
| public void | visitLdcInsn(final Object
the constant to be loaded on the stack. This parameter must be a non null value)Integer, a Float, a Long, a Double, a String, a Type of OBJECT or ARRAY sort for .class constants, for classes whose version is
49, a Type of METHOD sort for MethodType, a Handle for MethodHandle
constants, for classes whose version is 51 or a ConstantDynamic for a constant
dynamic for classes whose version is 55.Overrides org. |
| public void | visitLookupSwitchInsn(final Label
beginning of the default handler block. dflt, final int[] the values of the keys. keys, final Label[] beginnings of the handler blocks. labels)labels[i] is the beginning of the
handler block for the keys[i] key.Overrides org. |
| public void | visitMethodInsn(final int
the opcode of the type instruction to be visited. This opcode is either
INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE. opcodeAndSource, final String the internal name of the method's owner class (see owner, final String Type#getInternalName()).the method's name. name, final String the method's descriptor (see descriptor, final boolean Type).if the method's owner class is an interface. isInterface)
Visits a method instruction.
|
| public void | visitMultiANewArrayInsn(final String
an array type descriptor (see descriptor, final int Type).the number of dimensions of the array to allocate. numDimensions)Overrides org. |
| public void | visitTableSwitchInsn(final int
the minimum key value. min, final int the maximum key value. max, final Label beginning of the default handler block. dflt, final Label... beginnings of the handler blocks. labels)labels[i] is the beginning of the
handler block for the min + i key.Overrides org. |
| public void | visitTypeInsn(final int
the opcode of the type instruction to be visited. This opcode is either NEW,
ANEWARRAY, CHECKCAST or INSTANCEOF. opcode, final String the operand of the instruction to be visited. This operand must be the internal
name of an object or array class (see type)
Visits a type instruction.
Type#getInternalName()). |
| public void | visitVarInsn(final int
the opcode of the local variable instruction to be visited. This opcode is either
ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET. opcode, final int the operand of the instruction to be visited. This operand is the index of a
local variable. varIndex)Overrides org. |
| maxSize | back to summary |
|---|---|
| private int maxSize The maximum size in bytes of the visited method. | |
| minSize | back to summary |
|---|---|
| private int minSize The minimum size in bytes of the visited method. | |
| CodeSizeEvaluator | back to summary |
|---|---|
| public CodeSizeEvaluator(final MethodVisitor methodVisitor) | |
| CodeSizeEvaluator | back to summary |
|---|---|
| protected CodeSizeEvaluator(final int api, final MethodVisitor methodVisitor) | |
| getMaxSize | back to summary |
|---|---|
| public int getMaxSize() | |
| getMinSize | back to summary |
|---|---|
| public int getMinSize() | |
| visitFieldInsn | back to summary |
|---|---|
| public void visitFieldInsn(final int opcode, final String owner, final String name, final String descriptor) Overrides org. Doc from org. Visits a field instruction. A field instruction is an instruction that loads or stores the value of a field of an object.
| |
| visitIincInsn | back to summary |
|---|---|
| public void visitIincInsn(final int varIndex, final int increment) Overrides org. Doc from org. Visits an IINC instruction.
| |
| visitInsn | back to summary |
|---|---|
| public void visitInsn(final int opcode) Overrides org. Doc from org. Visits a zero operand instruction.
| |
| visitIntInsn | back to summary |
|---|---|
| public void visitIntInsn(final int opcode, final int operand) Overrides org. Doc from org. Visits an instruction with a single int operand.
| |
| visitInvokeDynamicInsn | back to summary |
|---|---|
| public void visitInvokeDynamicInsn(final String name, final String descriptor, final Handle bootstrapMethodHandle, final Object... bootstrapMethodArguments) Overrides org. Doc from org. Visits an invokedynamic instruction.
| |
| visitJumpInsn | back to summary |
|---|---|
| public void visitJumpInsn(final int opcode, final Label label) Overrides org. Doc from org. Visits a jump instruction. A jump instruction is an instruction that may jump to another instruction.
| |
| visitLdcInsn | back to summary |
|---|---|
| public void visitLdcInsn(final Object value) Overrides org. Doc from org. Visits a LDC instruction. Note that new constant types may be added in future versions of the Java Virtual Machine. To easily detect new constant types, implementations of this method should check for unexpected constant types, like this:
if (cst instanceof Integer) {
// ...
} else if (cst instanceof Float) {
// ...
} else if (cst instanceof Long) {
// ...
} else if (cst instanceof Double) {
// ...
} else if (cst instanceof String) {
// ...
} else if (cst instanceof Type) {
int sort = ((Type) cst).getSort();
if (sort == Type.OBJECT) {
// ...
} else if (sort == Type.ARRAY) {
// ...
} else if (sort == Type.METHOD) {
// ...
} else {
// throw an exception
}
} else if (cst instanceof Handle) {
// ...
} else if (cst instanceof ConstantDynamic) {
// ...
} else {
// throw an exception
}
| |
| visitLookupSwitchInsn | back to summary |
|---|---|
| public void visitLookupSwitchInsn(final Label dflt, final int[] keys, final Label[] labels) Overrides org. Doc from org. Visits a LOOKUPSWITCH instruction. | |
| visitMethodInsn | back to summary |
|---|---|
| public void visitMethodInsn(final int opcodeAndSource, final String owner, final String name, final String descriptor, final boolean isInterface) Overrides org. Doc from org. Visits a method instruction. A method instruction is an instruction that invokes a method.
| |
| visitMultiANewArrayInsn | back to summary |
|---|---|
| public void visitMultiANewArrayInsn(final String descriptor, final int numDimensions) Overrides org. Doc from org. Visits a MULTIANEWARRAY instruction. | |
| visitTableSwitchInsn | back to summary |
|---|---|
| public void visitTableSwitchInsn(final int min, final int max, final Label dflt, final Label... labels) Overrides org. Doc from org. Visits a TABLESWITCH instruction. | |
| visitTypeInsn | back to summary |
|---|---|
| public void visitTypeInsn(final int opcode, final String type) Overrides org. Doc from org. Visits a type instruction. A type instruction is an instruction that takes the internal name of
a class as parameter (see
| |
| visitVarInsn | back to summary |
|---|---|
| public void visitVarInsn(final int opcode, final int varIndex) Overrides org. Doc from org. Visits a local variable instruction. A local variable instruction is an instruction that loads or stores the value of a local variable.
| |