org.objectweb.asm.commons

Class AnalyzerAdapter

Implemented Interfaces:
MethodVisitor

public class AnalyzerAdapter
extends MethodAdapter

A MethodAdapter that keeps track of stack map frame changes between visitFrame calls. This adapter must be used with the ClassReader.EXPAND_FRAMES option. Each visitXXX instruction delegates to the next visitor in the chain, if any, and then simulates the effect of this instruction on the stack map frame, represented by locals and stack. The next visitor in the chain can get the state of the stack map frame before each instruction by reading the value of these fields in its visitXXX methods (this requires a reference to the AnalyzerAdapter that is before it in the chain).
Author:
Eric Bruneton

Field Summary

List
locals
List of the local variable slots for current execution frame.
List
stack
List of the operand stack slots for current execution frame.

Fields inherited from class org.objectweb.asm.MethodAdapter

mv

Constructor Summary

AnalyzerAdapter(String owner, int access, String name, String desc, MethodVisitor mv)
Creates a new AnalyzerAdapter.

Method Summary

void
visitFieldInsn(int opcode, String owner, String name, String desc)
void
visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack)
void
visitIincInsn(int var, int increment)
void
visitInsn(int opcode)
void
visitIntInsn(int opcode, int operand)
void
visitJumpInsn(int opcode, Label label)
void
visitLabel(Label label)
void
visitLdcInsn(Object cst)
void
visitLookupSwitchInsn(Label dflt, keys[] , labels[] )
void
visitMaxs(int maxStack, int maxLocals)
void
visitMethodInsn(int opcode, String owner, String name, String desc)
void
visitMultiANewArrayInsn(String desc, int dims)
void
visitTableSwitchInsn(int min, int max, Label dflt, labels[] )
void
visitTypeInsn(int opcode, String type)
void
visitVarInsn(int opcode, int var)

Methods inherited from class org.objectweb.asm.MethodAdapter

visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitEnd, visitFieldInsn, visitFrame, visitIincInsn, visitInsn, visitIntInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLookupSwitchInsn, visitMaxs, visitMethodInsn, visitMultiANewArrayInsn, visitParameterAnnotation, visitTableSwitchInsn, visitTryCatchBlock, visitTypeInsn, visitVarInsn

Field Details

locals

public List locals
List of the local variable slots for current execution frame. Primitive types are represented by Opcodes.TOP, Opcodes.INTEGER, Opcodes.FLOAT, Opcodes.LONG, Opcodes.DOUBLE,Opcodes.NULL or Opcodes.UNINITIALIZED_THIS (long and double are represented by a two elements, the second one being TOP). 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). This field is null for unreacheable instructions.

stack

public List stack
List of the operand stack slots for current execution frame. Primitive types are represented by Opcodes.TOP, Opcodes.INTEGER, Opcodes.FLOAT, Opcodes.LONG, Opcodes.DOUBLE,Opcodes.NULL or Opcodes.UNINITIALIZED_THIS (long and double are represented by a two elements, the second one being TOP). 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). This field is null for unreacheable instructions.

Constructor Details

AnalyzerAdapter

public AnalyzerAdapter(String owner,
                       int access,
                       String name,
                       String desc,
                       MethodVisitor mv)
Creates a new AnalyzerAdapter.
Parameters:
owner - the owner's class name.
access - the method's access flags (see Opcodes).
name - the method's name.
desc - the method's descriptor (see Type).
mv - the method visitor to which this adapter delegates calls. May be null.

Method Details

visitFieldInsn

public void visitFieldInsn(int opcode,
                           String owner,
                           String name,
                           String desc)
Specified by:
visitFieldInsn in interface MethodVisitor
Overrides:
visitFieldInsn in interface MethodAdapter

visitFrame

public void visitFrame(int type,
                       int nLocal,
                       Object[] local,
                       int nStack,
                       Object[] stack)
Specified by:
visitFrame in interface MethodVisitor
Overrides:
visitFrame in interface MethodAdapter

visitIincInsn

public void visitIincInsn(int var,
                          int increment)
Specified by:
visitIincInsn in interface MethodVisitor
Overrides:
visitIincInsn in interface MethodAdapter

visitInsn

public void visitInsn(int opcode)
Specified by:
visitInsn in interface MethodVisitor
Overrides:
visitInsn in interface MethodAdapter

visitIntInsn

public void visitIntInsn(int opcode,
                         int operand)
Specified by:
visitIntInsn in interface MethodVisitor
Overrides:
visitIntInsn in interface MethodAdapter

visitJumpInsn

public void visitJumpInsn(int opcode,
                          Label label)
Specified by:
visitJumpInsn in interface MethodVisitor
Overrides:
visitJumpInsn in interface MethodAdapter

visitLabel

public void visitLabel(Label label)
Specified by:
visitLabel in interface MethodVisitor
Overrides:
visitLabel in interface MethodAdapter

visitLdcInsn

public void visitLdcInsn(Object cst)
Specified by:
visitLdcInsn in interface MethodVisitor
Overrides:
visitLdcInsn in interface MethodAdapter

visitLookupSwitchInsn

public void visitLookupSwitchInsn(Label dflt,
                                  keys[] ,
                                  labels[] )
Specified by:
visitLookupSwitchInsn in interface MethodVisitor
Overrides:
visitLookupSwitchInsn in interface MethodAdapter

visitMaxs

public void visitMaxs(int maxStack,
                      int maxLocals)
Specified by:
visitMaxs in interface MethodVisitor
Overrides:
visitMaxs in interface MethodAdapter

visitMethodInsn

public void visitMethodInsn(int opcode,
                            String owner,
                            String name,
                            String desc)
Specified by:
visitMethodInsn in interface MethodVisitor
Overrides:
visitMethodInsn in interface MethodAdapter

visitMultiANewArrayInsn

public void visitMultiANewArrayInsn(String desc,
                                    int dims)
Specified by:
visitMultiANewArrayInsn in interface MethodVisitor
Overrides:
visitMultiANewArrayInsn in interface MethodAdapter

visitTableSwitchInsn

public void visitTableSwitchInsn(int min,
                                 int max,
                                 Label dflt,
                                 labels[] )
Specified by:
visitTableSwitchInsn in interface MethodVisitor
Overrides:
visitTableSwitchInsn in interface MethodAdapter

visitTypeInsn

public void visitTypeInsn(int opcode,
                          String type)
Specified by:
visitTypeInsn in interface MethodVisitor
Overrides:
visitTypeInsn in interface MethodAdapter

visitVarInsn

public void visitVarInsn(int opcode,
                         int var)
Specified by:
visitVarInsn in interface MethodVisitor
Overrides:
visitVarInsn in interface MethodAdapter