Package net.bytebuddy.asm
Class Advice.StackMapFrameHandler.Default
- java.lang.Object
-
- net.bytebuddy.asm.Advice.StackMapFrameHandler.Default
-
- All Implemented Interfaces:
Advice.StackMapFrameHandler,Advice.StackMapFrameHandler.ForInstrumentedMethod
- Direct Known Subclasses:
Advice.StackMapFrameHandler.Default.Trivial,Advice.StackMapFrameHandler.Default.WithPreservedArguments
- Enclosing interface:
- Advice.StackMapFrameHandler
public abstract static class Advice.StackMapFrameHandler.Default extends java.lang.Object implements Advice.StackMapFrameHandler.ForInstrumentedMethod
A default implementation of a stack map frame handler for an instrumented method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAdvice.StackMapFrameHandler.Default.ForAdviceA stack map frame handler for an advice method.protected static classAdvice.StackMapFrameHandler.Default.TranslationModeA translation mode that determines how the fixed frames of the instrumented method are written.protected static classAdvice.StackMapFrameHandler.Default.TrivialA trivial stack map frame handler that applies a trivial translation for the instrumented method's stack map frames.protected static classAdvice.StackMapFrameHandler.Default.WithPreservedArgumentsA stack map frame handler that requires the original arguments of the instrumented method to be preserved in their original form.-
Nested classes/interfaces inherited from interface net.bytebuddy.asm.Advice.StackMapFrameHandler
Advice.StackMapFrameHandler.Default, Advice.StackMapFrameHandler.ForInstrumentedMethod, Advice.StackMapFrameHandler.NoOp
-
-
Field Summary
Fields Modifier and Type Field Description protected intcurrentFrameDivergenceThe current frame's size divergence from the original local variable array.protected static java.lang.Object[]EMPTYAn empty array indicating an empty frame.protected java.util.List<? extends TypeDescription>enterTypesA list of virtual method arguments that are available before the instrumented method is executed.protected java.util.List<? extends TypeDescription>exitTypesA list of virtual method arguments that are available after the instrumented method has completed.protected booleanexpandFramestrueif the meta data handler is expected to expand its frames.protected MethodDescriptioninstrumentedMethodThe instrumented method.protected TypeDescriptioninstrumentedTypeThe instrumented type.
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefault(TypeDescription instrumentedType, MethodDescription instrumentedMethod, java.util.List<? extends TypeDescription> enterTypes, java.util.List<? extends TypeDescription> exitTypes, boolean expandFrames)Creates a new default stack map frame handler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Advice.StackMapFrameHandler.ForAdvicebindEnter(MethodDescription.InDefinedShape adviceMethod)Binds this meta data handler for the enter advice.intgetReaderHint()Returns a hint to supply to aClassReaderwhen parsing an advice method.protected voidinjectFullFrame(org.objectweb.asm.MethodVisitor methodVisitor, java.util.List<? extends TypeDescription> typesInArray, java.util.List<? extends TypeDescription> typesOnStack)Injects a full stack map frame after the instrumented method has completed.protected static Advice.StackMapFrameHandler.ForInstrumentedMethodof(TypeDescription instrumentedType, MethodDescription instrumentedMethod, java.util.List<? extends TypeDescription> enterTypes, java.util.List<? extends TypeDescription> exitTypes, boolean exitAdvice, boolean copyArguments, ClassFileVersion classFileVersion, int writerFlags, int readerFlags)Creates an appropriate stack map frame handler for an instrumented method.protected static java.lang.ObjecttoFrame(TypeDescription typeDescription)Translates a type into a representation of its form inside a stack map frame.protected voidtranslateFrame(org.objectweb.asm.MethodVisitor methodVisitor, Advice.StackMapFrameHandler.Default.TranslationMode translationMode, MethodDescription methodDescription, java.util.List<? extends TypeDescription> additionalTypes, int type, int localVariableLength, java.lang.Object[] localVariable, int stackSize, java.lang.Object[] stack)Translates a frame.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.bytebuddy.asm.Advice.StackMapFrameHandler
injectCompletionFrame, injectExceptionFrame, injectReturnFrame, translateFrame
-
Methods inherited from interface net.bytebuddy.asm.Advice.StackMapFrameHandler.ForInstrumentedMethod
bindExit, injectStartFrame
-
-
-
-
Field Detail
-
EMPTY
protected static final java.lang.Object[] EMPTY
An empty array indicating an empty frame.
-
instrumentedType
protected final TypeDescription instrumentedType
The instrumented type.
-
instrumentedMethod
protected final MethodDescription instrumentedMethod
The instrumented method.
-
enterTypes
protected final java.util.List<? extends TypeDescription> enterTypes
A list of virtual method arguments that are available before the instrumented method is executed.
-
exitTypes
protected final java.util.List<? extends TypeDescription> exitTypes
A list of virtual method arguments that are available after the instrumented method has completed.
-
expandFrames
protected final boolean expandFrames
trueif the meta data handler is expected to expand its frames.
-
currentFrameDivergence
protected int currentFrameDivergence
The current frame's size divergence from the original local variable array.
-
-
Constructor Detail
-
Default
protected Default(TypeDescription instrumentedType, MethodDescription instrumentedMethod, java.util.List<? extends TypeDescription> enterTypes, java.util.List<? extends TypeDescription> exitTypes, boolean expandFrames)
Creates a new default stack map frame handler.- Parameters:
instrumentedType- The instrumented type.instrumentedMethod- The instrumented method.enterTypes- A list of virtual method arguments that are available before the instrumented method is executed.exitTypes- A list of virtual method arguments that are available after the instrumented method has completed.expandFrames-trueif the meta data handler is expected to expand its frames.
-
-
Method Detail
-
of
protected static Advice.StackMapFrameHandler.ForInstrumentedMethod of(TypeDescription instrumentedType, MethodDescription instrumentedMethod, java.util.List<? extends TypeDescription> enterTypes, java.util.List<? extends TypeDescription> exitTypes, boolean exitAdvice, boolean copyArguments, ClassFileVersion classFileVersion, int writerFlags, int readerFlags)
Creates an appropriate stack map frame handler for an instrumented method.- Parameters:
instrumentedType- The instrumented type.instrumentedMethod- The instrumented method.enterTypes- A list of virtual method arguments that are available before the instrumented method is executed.exitTypes- A list of virtual method arguments that are available after the instrumented method has completed.exitAdvice-trueif the current advice implies exit advice.copyArguments-trueif the original arguments are copied before invoking the instrumented method.classFileVersion- The instrumented type's class file version.writerFlags- The flags supplied to the ASM writer.readerFlags- The reader flags supplied to the ASM reader.- Returns:
- An appropriate stack map frame handler for an instrumented method.
-
toFrame
protected static java.lang.Object toFrame(TypeDescription typeDescription)
Translates a type into a representation of its form inside a stack map frame.- Parameters:
typeDescription- The type to translate.- Returns:
- A stack entry representation of the supplied type.
-
bindEnter
public Advice.StackMapFrameHandler.ForAdvice bindEnter(MethodDescription.InDefinedShape adviceMethod)
Description copied from interface:Advice.StackMapFrameHandler.ForInstrumentedMethodBinds this meta data handler for the enter advice.- Specified by:
bindEnterin interfaceAdvice.StackMapFrameHandler.ForInstrumentedMethod- Parameters:
adviceMethod- The enter advice method.- Returns:
- An appropriate meta data handler for the enter method.
-
getReaderHint
public int getReaderHint()
Description copied from interface:Advice.StackMapFrameHandler.ForInstrumentedMethodReturns a hint to supply to aClassReaderwhen parsing an advice method.- Specified by:
getReaderHintin interfaceAdvice.StackMapFrameHandler.ForInstrumentedMethod- Returns:
- The reader hint to supply to an ASM class reader.
-
translateFrame
protected void translateFrame(org.objectweb.asm.MethodVisitor methodVisitor, Advice.StackMapFrameHandler.Default.TranslationMode translationMode, MethodDescription methodDescription, java.util.List<? extends TypeDescription> additionalTypes, int type, int localVariableLength, java.lang.Object[] localVariable, int stackSize, java.lang.Object[] stack)Translates a frame.- Parameters:
methodVisitor- The method visitor to write the frame to.translationMode- The translation mode to apply.methodDescription- The method description for which the frame is written.additionalTypes- The additional types to consider part of the instrumented method's parameters.type- The frame's type.localVariableLength- The local variable length.localVariable- An array containing the types of the current local variables.stackSize- The size of the operand stack.stack- An array containing the types of the current operand stack.
-
injectFullFrame
protected void injectFullFrame(org.objectweb.asm.MethodVisitor methodVisitor, java.util.List<? extends TypeDescription> typesInArray, java.util.List<? extends TypeDescription> typesOnStack)Injects a full stack map frame after the instrumented method has completed.- Parameters:
methodVisitor- The method visitor onto which to write the stack map frame.typesInArray- The types that were added to the local variable array additionally to the values of the instrumented method.typesOnStack- The types currently on the operand stack.
-
-