Package xyz.cofe.trambda.bc.mth
Class MFrame
- java.lang.Object
-
- xyz.cofe.trambda.bc.mth.MAbstractBC
-
- xyz.cofe.trambda.bc.mth.MFrame
-
- All Implemented Interfaces:
Serializable,xyz.cofe.collection.ImTree<ByteCode>,xyz.cofe.collection.ImTreeWalk<ByteCode>,ByteCode,MethodByteCode,MethodWriter
public class MFrame extends MAbstractBC implements MethodWriter
Visits the current state of the local variables and operand stack elements. This method must(*) be called just before any instruction i that follows an unconditional branch instruction such as GOTO or THROW, that is the target of a jump instruction, or that starts an exception handler block. The visited types must describe the values of the local variables and of the operand stack elements just before i is executed.
(*) this is mandatory only for classes whose version is greater than or equal toOpcodes.V1_6.
The frames of a method must be given either in expanded form, or in compressed form (all frames must use the same format, i.e. you must not mix expanded and compressed frames within a single method):- In expanded form, all frames must have the F_NEW type.
- In compressed form, frames are basically "deltas" from the state of the previous frame:
Opcodes.F_SAMErepresenting frame with exactly the same locals as the previous frame and with the empty stack.Opcodes.F_SAME1representing frame with exactly the same locals as the previous frame and with single value on the stack (numStackis 1 andstack[0]contains value for the type of the stack item).Opcodes.F_APPENDrepresenting frame with current locals are the same as the locals in the previous frame, except that additional locals are defined (numLocalis 1, 2 or 3 andlocalelements contains values representing added types).Opcodes.F_CHOPrepresenting frame with current locals are the same as the locals in the previous frame, except that the last 1-3 locals are absent and with the empty stack (numLocalis 1, 2 or 3).Opcodes.F_FULLrepresenting complete frame data.
In both cases the first frame, corresponding to the method's parameters and access flags, is implicit and must not be visited. Also, it is illegal to visit two or more frames for the same code location (i.e., at least one instruction must be visited between two calls to visitFrame).-
typethe type of this stack map frame. Must beOpcodes.F_NEWfor expanded frames, orOpcodes.F_FULL,Opcodes.F_APPEND,Opcodes.F_CHOP,Opcodes.F_SAMEorOpcodes.F_APPEND,Opcodes.F_SAME1for compressed frames. -
numLocalthe number of local variables in the visited frame. -
localthe local variable types in this frame. This array must not be modified. Primitive types are represented byOpcodes.TOP,Opcodes.INTEGER,Opcodes.FLOAT,Opcodes.LONG,Opcodes.DOUBLE,Opcodes.NULLorOpcodes.UNINITIALIZED_THIS(long and double are represented by a single element). Reference types are represented by String objects (representing internal names), and uninitialized types by Label objects (this label designates the NEW instruction that created this uninitialized value). -
numStackthe number of operand stack elements in the visited frame. -
stackthe operand stack types in this frame. This array must not be modified. Its content has the same format as the "local" array.
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MFrameclone()List<Object>getLocal()intgetNumLocal()intgetNumStack()List<Object>getStack()intgetType()voidsetLocal(List<Object> local)voidsetNumLocal(int numLocal)voidsetNumStack(int numStack)voidsetStack(List<Object> stack)voidsetType(int type)StringtoString()voidwrite(org.objectweb.asm.MethodVisitor mv, MethodWriterCtx ctx)
-
-
-
Method Detail
-
clone
public MFrame clone()
- Specified by:
clonein interfaceMethodByteCode- Specified by:
clonein classMAbstractBC
-
getType
public int getType()
-
setType
public void setType(int type)
-
getNumLocal
public int getNumLocal()
-
setNumLocal
public void setNumLocal(int numLocal)
-
getNumStack
public int getNumStack()
-
setNumStack
public void setNumStack(int numStack)
-
write
public void write(org.objectweb.asm.MethodVisitor mv, MethodWriterCtx ctx)- Specified by:
writein interfaceMethodWriter
-
-