Class Advice.Dispatcher.Inlining.CodeTranslationVisitor
java.lang.Object
org.objectweb.asm.MethodVisitor
net.bytebuddy.asm.Advice.Dispatcher.Inlining.CodeTranslationVisitor
- Enclosing class:
Advice.Dispatcher.Inlining
protected static class Advice.Dispatcher.Inlining.CodeTranslationVisitor
extends org.objectweb.asm.MethodVisitor
A visitor for translating an advice method's byte code for inlining into the instrumented method.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final MethodDescription.InDefinedShapeThe advice method.protected final Advice.ArgumentHandler.ForAdviceA handler for accessing values on the local variable array.private final AssignerThe assigner to use.protected final org.objectweb.asm.LabelA label indicating the end of the advice byte code.private final StackManipulationThe exception handler that is resolved for the instrumented method.private final booleantrueif this visitor is for exit advice.protected final Implementation.ContextThe implementation context to use.private final MethodDescriptionThe instrumented method.private final TypeDescriptionThe instrumented type.protected final Advice.MethodSizeHandler.ForAdviceA handler for computing the method size requirements.protected final org.objectweb.asm.MethodVisitorThe original method visitor to which all instructions are eventually written to.private final Map<Integer, Advice.OffsetMapping.Target> A mapping of offsets to resolved target offsets in the instrumented method.private final Advice.PostProcessorThe post processor to apply.private final Advice.Dispatcher.RelocationHandler.BoundA bound relocation handler that is responsible for considering a non-standard control flow.protected final Advice.StackMapFrameHandler.ForAdviceA handler for translating and injecting stack map frames.private final Advice.Dispatcher.SuppressionHandler.BoundA bound suppression handler that is used for suppressing exceptions of this advice method.Fields inherited from class org.objectweb.asm.MethodVisitor
api, mv -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCodeTranslationVisitor(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Advice.ArgumentHandler.ForAdvice argumentHandler, Advice.MethodSizeHandler.ForAdvice methodSizeHandler, Advice.StackMapFrameHandler.ForAdvice stackMapFrameHandler, TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, MethodDescription.InDefinedShape adviceMethod, Map<Integer, Advice.OffsetMapping.Target> offsetMappings, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler, Advice.Dispatcher.RelocationHandler.Bound relocationHandler, StackManipulation exceptionHandler, Advice.PostProcessor postProcessor, boolean exit) Creates a new code translation visitor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidpropagateHandler(org.objectweb.asm.Label label) Propagates a label for an exception handler that is typically suppressed by the overlayingAdvice.Dispatcher.Inlining.Resolved.AdviceMethodInliner.ExceptionTableSubstitutor.voidvisitAnnotableParameterCount(int count, boolean visible) org.objectweb.asm.AnnotationVisitorvisitAnnotation(String descriptor, boolean visible) org.objectweb.asm.AnnotationVisitorvoidvisitAttribute(org.objectweb.asm.Attribute attribute) voidvoidvisitEnd()voidvisitFrame(int type, int localVariableLength, Object[] localVariable, int stackSize, Object[] stack) voidvisitIincInsn(int offset, int value) voidvisitInsn(int opcode) voidvisitMaxs(int stackSize, int localVariableLength) voidvisitParameter(String name, int modifiers) org.objectweb.asm.AnnotationVisitorvisitParameterAnnotation(int index, String descriptor, boolean visible) org.objectweb.asm.AnnotationVisitorvisitTypeAnnotation(int typeReference, org.objectweb.asm.TypePath typePath, String descriptor, boolean visible) voidvisitVarInsn(int opcode, int offset) Methods inherited from class org.objectweb.asm.MethodVisitor
getDelegate, visitFieldInsn, visitInsnAnnotation, visitIntInsn, visitInvokeDynamicInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLocalVariableAnnotation, visitLookupSwitchInsn, visitMethodInsn, visitMethodInsn, visitMultiANewArrayInsn, visitTableSwitchInsn, visitTryCatchAnnotation, visitTryCatchBlock, visitTypeInsn
-
Field Details
-
methodVisitor
protected final org.objectweb.asm.MethodVisitor methodVisitorThe original method visitor to which all instructions are eventually written to. -
implementationContext
The implementation context to use. -
argumentHandler
A handler for accessing values on the local variable array. -
methodSizeHandler
A handler for computing the method size requirements. -
stackMapFrameHandler
A handler for translating and injecting stack map frames. -
instrumentedType
The instrumented type. -
instrumentedMethod
The instrumented method. -
assigner
The assigner to use. -
adviceMethod
The advice method. -
offsetMappings
A mapping of offsets to resolved target offsets in the instrumented method. -
suppressionHandler
A bound suppression handler that is used for suppressing exceptions of this advice method. -
relocationHandler
A bound relocation handler that is responsible for considering a non-standard control flow. -
exceptionHandler
The exception handler that is resolved for the instrumented method. -
postProcessor
The post processor to apply. -
exit
private final boolean exittrueif this visitor is for exit advice. -
endOfMethod
protected final org.objectweb.asm.Label endOfMethodA label indicating the end of the advice byte code.
-
-
Constructor Details
-
CodeTranslationVisitor
protected CodeTranslationVisitor(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Advice.ArgumentHandler.ForAdvice argumentHandler, Advice.MethodSizeHandler.ForAdvice methodSizeHandler, Advice.StackMapFrameHandler.ForAdvice stackMapFrameHandler, TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, MethodDescription.InDefinedShape adviceMethod, Map<Integer, Advice.OffsetMapping.Target> offsetMappings, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler, Advice.Dispatcher.RelocationHandler.Bound relocationHandler, StackManipulation exceptionHandler, Advice.PostProcessor postProcessor, boolean exit) Creates a new code translation visitor.- Parameters:
methodVisitor- A method visitor for writing the instrumented method's byte code.implementationContext- The implementation context to use.argumentHandler- A handler for accessing values on the local variable array.methodSizeHandler- A handler for computing the method size requirements.stackMapFrameHandler- A handler for translating and injecting stack map frames.instrumentedType- The instrumented type.instrumentedMethod- The instrumented method.assigner- The assigner to use.adviceMethod- The advice method.offsetMappings- A mapping of offsets to resolved target offsets in the instrumented method.suppressionHandler- A bound suppression handler that is used for suppressing exceptions of this advice method.relocationHandler- A bound relocation handler that is responsible for considering a non-standard control flow.exceptionHandler- The exception handler that is resolved for the instrumented method.postProcessor- The post processor to apply.exit-trueif this visitor is for exit advice.
-
-
Method Details
-
propagateHandler
protected void propagateHandler(org.objectweb.asm.Label label) Propagates a label for an exception handler that is typically suppressed by the overlayingAdvice.Dispatcher.Inlining.Resolved.AdviceMethodInliner.ExceptionTableSubstitutor.- Parameters:
label- The label to register as a target for an exception handler.
-
visitParameter
- Overrides:
visitParameterin classorg.objectweb.asm.MethodVisitor
-
visitAnnotableParameterCount
public void visitAnnotableParameterCount(int count, boolean visible) - Overrides:
visitAnnotableParameterCountin classorg.objectweb.asm.MethodVisitor
-
visitAnnotationDefault
- Overrides:
visitAnnotationDefaultin classorg.objectweb.asm.MethodVisitor
-
visitAnnotation
@MaybeNull public org.objectweb.asm.AnnotationVisitor visitAnnotation(String descriptor, boolean visible) - Overrides:
visitAnnotationin classorg.objectweb.asm.MethodVisitor
-
visitTypeAnnotation
@MaybeNull public org.objectweb.asm.AnnotationVisitor visitTypeAnnotation(int typeReference, @MaybeNull org.objectweb.asm.TypePath typePath, String descriptor, boolean visible) - Overrides:
visitTypeAnnotationin classorg.objectweb.asm.MethodVisitor
-
visitParameterAnnotation
@MaybeNull public org.objectweb.asm.AnnotationVisitor visitParameterAnnotation(int index, String descriptor, boolean visible) - Overrides:
visitParameterAnnotationin classorg.objectweb.asm.MethodVisitor
-
visitAttribute
public void visitAttribute(org.objectweb.asm.Attribute attribute) - Overrides:
visitAttributein classorg.objectweb.asm.MethodVisitor
-
visitCode
public void visitCode()- Overrides:
visitCodein classorg.objectweb.asm.MethodVisitor
-
visitFrame
public void visitFrame(int type, int localVariableLength, @MaybeNull Object[] localVariable, int stackSize, @MaybeNull Object[] stack) - Overrides:
visitFramein classorg.objectweb.asm.MethodVisitor
-
visitVarInsn
public void visitVarInsn(int opcode, int offset) - Overrides:
visitVarInsnin classorg.objectweb.asm.MethodVisitor
-
visitIincInsn
public void visitIincInsn(int offset, int value) - Overrides:
visitIincInsnin classorg.objectweb.asm.MethodVisitor
-
visitInsn
public void visitInsn(int opcode) - Overrides:
visitInsnin classorg.objectweb.asm.MethodVisitor
-
visitEnd
public void visitEnd()- Overrides:
visitEndin classorg.objectweb.asm.MethodVisitor
-
visitMaxs
public void visitMaxs(int stackSize, int localVariableLength) - Overrides:
visitMaxsin classorg.objectweb.asm.MethodVisitor
-