Package net.bytebuddy.asm
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.MethodVisitorA visitor for translating an advice method's byte code for inlining into the instrumented method.
-
-
Field Summary
Fields Modifier and Type Field Description protected MethodDescription.InDefinedShapeadviceMethodThe advice method.protected Advice.ArgumentHandler.ForAdviceargumentHandlerA handler for accessing values on the local variable array.private AssignerassignerThe assigner to use.protected org.objectweb.asm.LabelendOfMethodA label indicating the end of the advice byte code.private booleanexittrueif this visitor is for exit advice.protected Implementation.ContextimplementationContextThe implementation context to use.private MethodDescriptioninstrumentedMethodThe instrumented method.private TypeDescriptioninstrumentedTypeThe instrumented type.protected Advice.MethodSizeHandler.ForAdvicemethodSizeHandlerA handler for computing the method size requirements.protected org.objectweb.asm.MethodVisitormethodVisitorThe original method visitor to which all instructions are eventually written to.private java.util.Map<java.lang.Integer,Advice.OffsetMapping.Target>offsetMappingsA mapping of offsets to resolved target offsets in the instrumented method.private Advice.PostProcessorpostProcessorThe post processor to apply.private Advice.Dispatcher.RelocationHandler.BoundrelocationHandlerA bound relocation handler that is responsible for considering a non-standard control flow.protected Advice.StackMapFrameHandler.ForAdvicestackMapFrameHandlerA handler for translating and injecting stack map frames.private Advice.Dispatcher.SuppressionHandler.BoundsuppressionHandlerA bound suppression handler that is used for suppressing exceptions of this advice method.
-
Constructor Summary
Constructors Modifier Constructor Description protectedCodeTranslationVisitor(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, java.util.Map<java.lang.Integer,Advice.OffsetMapping.Target> offsetMappings, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler, Advice.Dispatcher.RelocationHandler.Bound relocationHandler, Advice.PostProcessor postProcessor, boolean exit)Creates a new code translation visitor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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(java.lang.String descriptor, boolean visible)org.objectweb.asm.AnnotationVisitorvisitAnnotationDefault()voidvisitAttribute(org.objectweb.asm.Attribute attribute)voidvisitCode()voidvisitEnd()voidvisitFrame(int type, int localVariableLength, java.lang.Object[] localVariable, int stackSize, java.lang.Object[] stack)voidvisitIincInsn(int offset, int value)voidvisitInsn(int opcode)voidvisitMaxs(int stackSize, int localVariableLength)voidvisitParameter(java.lang.String name, int modifiers)org.objectweb.asm.AnnotationVisitorvisitParameterAnnotation(int index, java.lang.String descriptor, boolean visible)org.objectweb.asm.AnnotationVisitorvisitTypeAnnotation(int typeReference, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)voidvisitVarInsn(int opcode, int offset)-
Methods inherited from class org.objectweb.asm.MethodVisitor
visitFieldInsn, visitInsnAnnotation, visitIntInsn, visitInvokeDynamicInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLocalVariableAnnotation, visitLookupSwitchInsn, visitMethodInsn, visitMethodInsn, visitMultiANewArrayInsn, visitTableSwitchInsn, visitTryCatchAnnotation, visitTryCatchBlock, visitTypeInsn
-
-
-
-
Field Detail
-
methodVisitor
protected final org.objectweb.asm.MethodVisitor methodVisitor
The original method visitor to which all instructions are eventually written to.
-
implementationContext
protected final Implementation.Context implementationContext
The implementation context to use.
-
argumentHandler
protected final Advice.ArgumentHandler.ForAdvice argumentHandler
A handler for accessing values on the local variable array.
-
methodSizeHandler
protected final Advice.MethodSizeHandler.ForAdvice methodSizeHandler
A handler for computing the method size requirements.
-
stackMapFrameHandler
protected final Advice.StackMapFrameHandler.ForAdvice stackMapFrameHandler
A handler for translating and injecting stack map frames.
-
instrumentedType
private final TypeDescription instrumentedType
The instrumented type.
-
instrumentedMethod
private final MethodDescription instrumentedMethod
The instrumented method.
-
assigner
private final Assigner assigner
The assigner to use.
-
adviceMethod
protected final MethodDescription.InDefinedShape adviceMethod
The advice method.
-
offsetMappings
private final java.util.Map<java.lang.Integer,Advice.OffsetMapping.Target> offsetMappings
A mapping of offsets to resolved target offsets in the instrumented method.
-
suppressionHandler
private final Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler
A bound suppression handler that is used for suppressing exceptions of this advice method.
-
relocationHandler
private final Advice.Dispatcher.RelocationHandler.Bound relocationHandler
A bound relocation handler that is responsible for considering a non-standard control flow.
-
postProcessor
private final Advice.PostProcessor postProcessor
The post processor to apply.
-
exit
private final boolean exit
trueif this visitor is for exit advice.
-
endOfMethod
protected final org.objectweb.asm.Label endOfMethod
A label indicating the end of the advice byte code.
-
-
Constructor Detail
-
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, java.util.Map<java.lang.Integer,Advice.OffsetMapping.Target> offsetMappings, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler, Advice.Dispatcher.RelocationHandler.Bound relocationHandler, 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.postProcessor- The post processor to apply.exit-trueif this visitor is for exit advice.
-
-
Method Detail
-
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
public void visitParameter(java.lang.String name, int modifiers)- Overrides:
visitParameterin classorg.objectweb.asm.MethodVisitor
-
visitAnnotableParameterCount
public void visitAnnotableParameterCount(int count, boolean visible)- Overrides:
visitAnnotableParameterCountin classorg.objectweb.asm.MethodVisitor
-
visitAnnotationDefault
public org.objectweb.asm.AnnotationVisitor visitAnnotationDefault()
- Overrides:
visitAnnotationDefaultin classorg.objectweb.asm.MethodVisitor
-
visitAnnotation
public org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String descriptor, boolean visible)- Overrides:
visitAnnotationin classorg.objectweb.asm.MethodVisitor
-
visitTypeAnnotation
public org.objectweb.asm.AnnotationVisitor visitTypeAnnotation(int typeReference, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)- Overrides:
visitTypeAnnotationin classorg.objectweb.asm.MethodVisitor
-
visitParameterAnnotation
public org.objectweb.asm.AnnotationVisitor visitParameterAnnotation(int index, java.lang.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, java.lang.Object[] localVariable, int stackSize, java.lang.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
-
-