Top Description Inners Fields Constructors Methods
javassist.bytecode

public Class StackMap

extends AttributeInfo
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .DataInputStream, .IOException, java.util.Map, javassist.CannotCompileException

Another stack_map attribute defined in CLDC 1.1 for J2ME.

This is an entry in the attributes table of a Code attribute. It was introduced by J2ME CLDC 1.1 (JSR 139) for pre-verification.

According to the CLDC specification, the sizes of some fields are not 16bit but 32bit if the code size is more than 64K or the number of the local variables is more than 64K. However, for the J2ME CLDC technology, they are always 16bit. The implementation of the StackMap class assumes they are 16bit.

Since
3.12
See Also
MethodInfo#doPreverify, StackMapTable

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
public static class
StackMap.Walker

A code walker for a StackMap attribute.

public static class
StackMap.Writer

Internal use only.

Field Summary

Modifier and TypeField and Description
public static final int
DOUBLE

Double_variable_info.tag.

public static final int
FLOAT

Float_variable_info.tag.

public static final int
INTEGER

Integer_variable_info.tag.

public static final int
LONG

Long_variable_info.tag.

public static final int
NULL

Null_variable_info.tag.

public static final int
OBJECT

Object_variable_info.tag.

public static final String
tag

The name of this attribute "StackMap".

public static final int
THIS

UninitializedThis_variable_info.tag.

public static final int
TOP

Top_variable_info.tag.

public static final int
UNINIT

Uninitialized_variable_info.tag.

Inherited from javassist.bytecode.AttributeInfo:
constPoolinfoname

Constructor Summary

AccessConstructor and Description
pack-priv
StackMap(ConstPool cp, byte[] newInfo)

Constructs a stack_map attribute.

pack-priv
StackMap(ConstPool cp, int name_id, DataInputStream in)

Method Summary

Modifier and TypeMethod and Description
public AttributeInfo
copy(ConstPool
the constant pool table used by the new copy.
newCp
,
Map<String, String>
pairs of replaced and substituted class names.
classnames
)

Overrides javassist.bytecode.AttributeInfo.copy.

Makes a copy.

public void
insertLocal(int
the index of the added local variable.
index
,
int
the type tag of that local variable. It is available by StackMapTable.typeTagOf(char).
tag
,
int
the index of the CONSTANT_Class_info structure in a constant pool table. This should be zero unless the tag is ITEM_Object.
classInfo
)

Updates this stack map table when a new local variable is inserted for a new parameter.

public int
numOfEntries()

Returns number_of_entries.

public void
removeNew(int
the position of the removed NEW opcode.
where
)

Undocumented method.

pack-priv void
shiftForSwitch(int where, int gapSize)

pack-priv void
shiftPc(int where, int gapSize, boolean exclusive)

Inherited from javassist.bytecode.AttributeInfo:
copyAllgetgetConstPoolgetLengthgetNamegetRefClassesgetRefClasseslengthlookupreadremoverenameClassrenameClassrenameClassrenameClasssetwritewriteAll

Field Detail

DOUBLEback to summary
public static final int DOUBLE

Double_variable_info.tag.

FLOATback to summary
public static final int FLOAT

Float_variable_info.tag.

INTEGERback to summary
public static final int INTEGER

Integer_variable_info.tag.

LONGback to summary
public static final int LONG

Long_variable_info.tag.

NULLback to summary
public static final int NULL

Null_variable_info.tag.

OBJECTback to summary
public static final int OBJECT

Object_variable_info.tag.

tagback to summary
public static final String tag

The name of this attribute "StackMap".

THISback to summary
public static final int THIS

UninitializedThis_variable_info.tag.

TOPback to summary
public static final int TOP

Top_variable_info.tag.

UNINITback to summary
public static final int UNINIT

Uninitialized_variable_info.tag.

Constructor Detail

StackMapback to summary
pack-priv StackMap(ConstPool cp, byte[] newInfo)

Constructs a stack_map attribute.

StackMapback to summary
pack-priv StackMap(ConstPool cp, int name_id, DataInputStream in) throws IOException

Method Detail

copyback to summary
public AttributeInfo copy(ConstPool newCp, Map<String, String> classnames)

Overrides javassist.bytecode.AttributeInfo.copy.

Makes a copy.

Parameters
newCp:ConstPool

Doc from javassist.bytecode.AttributeInfo.copy.

the constant pool table used by the new copy.

classnames:Map<String, String>

Doc from javassist.bytecode.AttributeInfo.copy.

pairs of replaced and substituted class names.

Annotations
@Override
insertLocalback to summary
public void insertLocal(int index, int tag, int classInfo) throws BadBytecode

Updates this stack map table when a new local variable is inserted for a new parameter.

Parameters
index:int

the index of the added local variable.

tag:int

the type tag of that local variable. It is available by StackMapTable.typeTagOf(char).

classInfo:int

the index of the CONSTANT_Class_info structure in a constant pool table. This should be zero unless the tag is ITEM_Object.

See Also
javassist.CtBehavior#addParameter(javassist.CtClass), StackMapTable#typeTagOf(char), ConstPool
numOfEntriesback to summary
public int numOfEntries()

Returns number_of_entries.

removeNewback to summary
public void removeNew(int where) throws CannotCompileException

Undocumented method. Do not use; internal-use only.

This method is for javassist.convert.TransformNew. It is called to update the stack map when the NEW opcode (and the following DUP) is removed.

Parameters
where:int

the position of the removed NEW opcode.

shiftForSwitchback to summary
pack-priv void shiftForSwitch(int where, int gapSize) throws BadBytecode
See Also
CodeIterator.Switcher#adjustOffsets(int, int)
shiftPcback to summary
pack-priv void shiftPc(int where, int gapSize, boolean exclusive) throws BadBytecode
javassist.bytecode back to summary

pack-priv Class StackMap.Copier

extends Walker
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv Map<String, String>
pack-priv byte[]
pack-priv ConstPool
pack-priv ConstPool
Inherited from javassist.bytecode.StackMap.Walker:
info

Constructor Summary

AccessConstructor and Description
pack-priv
Copier(StackMap map, ConstPool newCp, Map<String, String> classnames)

Method Summary

Modifier and TypeMethod and Description
public StackMap
public int
locals(int pos, int offset, int num)

Overrides javassist.bytecode.StackMap.Walker.locals.

Invoked when locals of stack_map_frame is visited.

public void
objectVariable(int pos, int clazz)

Overrides javassist.bytecode.StackMap.Walker.objectVariable.

Invoked when an element of type Object_variable_info is visited.

public void
typeInfo(int pos, byte tag)

Overrides javassist.bytecode.StackMap.Walker.typeInfo.

Invoked when an element of verification_type_info (except Object_variable_info and Uninitialized_variable_info) is visited.

public int
typeInfoArray(int pos, int offset, int
the number of elements.
num
,
boolean
true if this array is for locals. false if it is for stack.
isLocals
)

Overrides javassist.bytecode.StackMap.Walker.typeInfoArray.

Invoked when an array of verification_type_info is visited.

public void
uninitialized(int pos, int offset)

Overrides javassist.bytecode.StackMap.Walker.uninitialized.

Invoked when an element of type Uninitialized_variable_info is visited.

public void
visit()

Overrides javassist.bytecode.StackMap.Walker.visit.

Visits each entry of the stack map frames.

Inherited from javassist.bytecode.StackMap.Walker:
stacktypeInfoArray2

Field Detail

classnamesback to summary
pack-priv Map<String, String> classnames
destback to summary
pack-priv byte[] dest
destCpback to summary
pack-priv ConstPool destCp
srcCpback to summary
pack-priv ConstPool srcCp

Constructor Detail

Copierback to summary
pack-priv Copier(StackMap map, ConstPool newCp, Map<String, String> classnames)

Method Detail

getStackMapback to summary
public StackMap getStackMap()
localsback to summary
public int locals(int pos, int offset, int num)

Overrides javassist.bytecode.StackMap.Walker.locals.

Doc from javassist.bytecode.StackMap.Walker.locals.

Invoked when locals of stack_map_frame is visited.

Annotations
@Override
objectVariableback to summary
public void objectVariable(int pos, int clazz)

Overrides javassist.bytecode.StackMap.Walker.objectVariable.

Doc from javassist.bytecode.StackMap.Walker.objectVariable.

Invoked when an element of type Object_variable_info is visited.

Annotations
@Override
typeInfoback to summary
public void typeInfo(int pos, byte tag)

Overrides javassist.bytecode.StackMap.Walker.typeInfo.

Doc from javassist.bytecode.StackMap.Walker.typeInfo.

Invoked when an element of verification_type_info (except Object_variable_info and Uninitialized_variable_info) is visited.

Annotations
@Override
typeInfoArrayback to summary
public int typeInfoArray(int pos, int offset, int num, boolean isLocals)

Overrides javassist.bytecode.StackMap.Walker.typeInfoArray.

Doc from javassist.bytecode.StackMap.Walker.typeInfoArray.

Invoked when an array of verification_type_info is visited.

Parameters
num:int

the number of elements.

isLocals:boolean

true if this array is for locals. false if it is for stack.

Annotations
@Override
uninitializedback to summary
public void uninitialized(int pos, int offset)

Overrides javassist.bytecode.StackMap.Walker.uninitialized.

Doc from javassist.bytecode.StackMap.Walker.uninitialized.

Invoked when an element of type Uninitialized_variable_info is visited.

Annotations
@Override
visitback to summary
public void visit()

Overrides javassist.bytecode.StackMap.Walker.visit.

Doc from javassist.bytecode.StackMap.Walker.visit.

Visits each entry of the stack map frames.

Annotations
@Override
javassist.bytecode back to summary

pack-priv Class StackMap.InsertLocal

extends SimpleCopy
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private int
private int
Inherited from javassist.bytecode.StackMap.SimpleCopy:
writer

Constructor Summary

AccessConstructor and Description
pack-priv
InsertLocal(StackMap map, int varIndex, int varTag, int varData)

Method Summary

Modifier and TypeMethod and Description
public int
typeInfoArray(int pos, int offset, int
the number of elements.
num
,
boolean
true if this array is for locals. false if it is for stack.
isLocals
)

Overrides javassist.bytecode.StackMap.SimpleCopy.typeInfoArray.

Invoked when an array of verification_type_info is visited.

private void
Inherited from javassist.bytecode.StackMap.SimpleCopy:
doitlocalsobjectVariabletypeInfouninitializedvisit

Field Detail

varDataback to summary
private int varData
varIndexback to summary
private int varIndex
varTagback to summary
private int varTag

Constructor Detail

InsertLocalback to summary
pack-priv InsertLocal(StackMap map, int varIndex, int varTag, int varData)

Method Detail

typeInfoArrayback to summary
public int typeInfoArray(int pos, int offset, int num, boolean isLocals)

Overrides javassist.bytecode.StackMap.SimpleCopy.typeInfoArray.

Doc from javassist.bytecode.StackMap.Walker.typeInfoArray.

Invoked when an array of verification_type_info is visited.

Parameters
num:int

the number of elements.

isLocals:boolean

true if this array is for locals. false if it is for stack.

Annotations
@Override
writeVarTypeInfoback to summary
private void writeVarTypeInfo()
javassist.bytecode back to summary

pack-priv Class StackMap.NewRemover

extends SimpleCopy
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv int
Inherited from javassist.bytecode.StackMap.SimpleCopy:
writer

Constructor Summary

AccessConstructor and Description
pack-priv
NewRemover(StackMap map, int where)

Method Summary

Modifier and TypeMethod and Description
public int
stack(int pos, int offset, int num)

Overrides javassist.bytecode.StackMap.Walker.stack.

Invoked when stack of stack_map_frame is visited.

private int
stackTypeInfoArray(int pos, int offset, int num)

Inherited from javassist.bytecode.StackMap.SimpleCopy:
doitlocalsobjectVariabletypeInfotypeInfoArrayuninitializedvisit

Field Detail

posOfNewback to summary
pack-priv int posOfNew

Constructor Detail

NewRemoverback to summary
pack-priv NewRemover(StackMap map, int where)

Method Detail

stackback to summary
public int stack(int pos, int offset, int num)

Overrides javassist.bytecode.StackMap.Walker.stack.

Doc from javassist.bytecode.StackMap.Walker.stack.

Invoked when stack of stack_map_frame is visited.

Annotations
@Override
stackTypeInfoArrayback to summary
private int stackTypeInfoArray(int pos, int offset, int num)
javassist.bytecode back to summary

pack-priv Class StackMap.Printer

extends Walker
Class Inheritance

Field Summary

Modifier and TypeField and Description
private PrintWriter
Inherited from javassist.bytecode.StackMap.Walker:
info

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
locals(int pos, int offset, int num)

Overrides javassist.bytecode.StackMap.Walker.locals.

Invoked when locals of stack_map_frame is visited.

public void
Inherited from javassist.bytecode.StackMap.Walker:
objectVariablestacktypeInfotypeInfoArraytypeInfoArray2uninitializedvisit

Field Detail

writerback to summary
private PrintWriter writer

Constructor Detail

Printerback to summary
public Printer(StackMap map, PrintWriter out)

Method Detail

localsback to summary
public int locals(int pos, int offset, int num)

Overrides javassist.bytecode.StackMap.Walker.locals.

Doc from javassist.bytecode.StackMap.Walker.locals.

Invoked when locals of stack_map_frame is visited.

Annotations
@Override
printback to summary
public void print()
javassist.bytecode back to summary

pack-priv Class StackMap.Shifter

extends Walker
Class Inheritance

Field Summary

Modifier and TypeField and Description
private boolean
private int
private int
Inherited from javassist.bytecode.StackMap.Walker:
info

Constructor Summary

AccessConstructor and Description
public
Shifter(StackMap smt, int where, int gap, boolean exclusive)

Method Summary

Modifier and TypeMethod and Description
public int
locals(int pos, int offset, int num)

Overrides javassist.bytecode.StackMap.Walker.locals.

Invoked when locals of stack_map_frame is visited.

public void
uninitialized(int pos, int offset)

Overrides javassist.bytecode.StackMap.Walker.uninitialized.

Invoked when an element of type Uninitialized_variable_info is visited.

Inherited from javassist.bytecode.StackMap.Walker:
objectVariablestacktypeInfotypeInfoArraytypeInfoArray2visit

Field Detail

exclusiveback to summary
private boolean exclusive
gapback to summary
private int gap
whereback to summary
private int where

Constructor Detail

Shifterback to summary
public Shifter(StackMap smt, int where, int gap, boolean exclusive)

Method Detail

localsback to summary
public int locals(int pos, int offset, int num)

Overrides javassist.bytecode.StackMap.Walker.locals.

Doc from javassist.bytecode.StackMap.Walker.locals.

Invoked when locals of stack_map_frame is visited.

Annotations
@Override
uninitializedback to summary
public void uninitialized(int pos, int offset)

Overrides javassist.bytecode.StackMap.Walker.uninitialized.

Doc from javassist.bytecode.StackMap.Walker.uninitialized.

Invoked when an element of type Uninitialized_variable_info is visited.

Annotations
@Override
javassist.bytecode back to summary

pack-priv Class StackMap.SimpleCopy

extends Walker
Class Inheritance
Known Direct Subclasses
javassist.bytecode.StackMap.InsertLocal, javassist.bytecode.StackMap.NewRemover

Field Summary

Modifier and TypeField and Description
pack-priv StackMap.Writer
Inherited from javassist.bytecode.StackMap.Walker:
info

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv byte[]
doit()

public int
locals(int pos, int offset, int num)

Overrides javassist.bytecode.StackMap.Walker.locals.

Invoked when locals of stack_map_frame is visited.

public void
objectVariable(int pos, int clazz)

Overrides javassist.bytecode.StackMap.Walker.objectVariable.

Invoked when an element of type Object_variable_info is visited.

public void
typeInfo(int pos, byte tag)

Overrides javassist.bytecode.StackMap.Walker.typeInfo.

Invoked when an element of verification_type_info (except Object_variable_info and Uninitialized_variable_info) is visited.

public int
typeInfoArray(int pos, int offset, int
the number of elements.
num
,
boolean
true if this array is for locals. false if it is for stack.
isLocals
)

Overrides javassist.bytecode.StackMap.Walker.typeInfoArray.

Invoked when an array of verification_type_info is visited.

public void
uninitialized(int pos, int offset)

Overrides javassist.bytecode.StackMap.Walker.uninitialized.

Invoked when an element of type Uninitialized_variable_info is visited.

public void
visit()

Overrides javassist.bytecode.StackMap.Walker.visit.

Visits each entry of the stack map frames.

Inherited from javassist.bytecode.StackMap.Walker:
stacktypeInfoArray2

Field Detail

writerback to summary
pack-priv StackMap.Writer writer

Constructor Detail

SimpleCopyback to summary
pack-priv SimpleCopy(StackMap map)

Method Detail

doitback to summary
pack-priv byte[] doit()
localsback to summary
public int locals(int pos, int offset, int num)

Overrides javassist.bytecode.StackMap.Walker.locals.

Doc from javassist.bytecode.StackMap.Walker.locals.

Invoked when locals of stack_map_frame is visited.

Annotations
@Override
objectVariableback to summary
public void objectVariable(int pos, int clazz)

Overrides javassist.bytecode.StackMap.Walker.objectVariable.

Doc from javassist.bytecode.StackMap.Walker.objectVariable.

Invoked when an element of type Object_variable_info is visited.

Annotations
@Override
typeInfoback to summary
public void typeInfo(int pos, byte tag)

Overrides javassist.bytecode.StackMap.Walker.typeInfo.

Doc from javassist.bytecode.StackMap.Walker.typeInfo.

Invoked when an element of verification_type_info (except Object_variable_info and Uninitialized_variable_info) is visited.

Annotations
@Override
typeInfoArrayback to summary
public int typeInfoArray(int pos, int offset, int num, boolean isLocals)

Overrides javassist.bytecode.StackMap.Walker.typeInfoArray.

Doc from javassist.bytecode.StackMap.Walker.typeInfoArray.

Invoked when an array of verification_type_info is visited.

Parameters
num:int

the number of elements.

isLocals:boolean

true if this array is for locals. false if it is for stack.

Annotations
@Override
uninitializedback to summary
public void uninitialized(int pos, int offset)

Overrides javassist.bytecode.StackMap.Walker.uninitialized.

Doc from javassist.bytecode.StackMap.Walker.uninitialized.

Invoked when an element of type Uninitialized_variable_info is visited.

Annotations
@Override
visitback to summary
public void visit()

Overrides javassist.bytecode.StackMap.Walker.visit.

Doc from javassist.bytecode.StackMap.Walker.visit.

Visits each entry of the stack map frames.

Annotations
@Override
javassist.bytecode back to summary

pack-priv Class StackMap.SwitchShifter

extends Walker
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private int
Inherited from javassist.bytecode.StackMap.Walker:
info

Constructor Summary

AccessConstructor and Description
public
SwitchShifter(StackMap smt, int where, int gap)

Method Summary

Modifier and TypeMethod and Description
public int
locals(int pos, int offset, int num)

Overrides javassist.bytecode.StackMap.Walker.locals.

Invoked when locals of stack_map_frame is visited.

Inherited from javassist.bytecode.StackMap.Walker:
objectVariablestacktypeInfotypeInfoArraytypeInfoArray2uninitializedvisit

Field Detail

gapback to summary
private int gap
whereback to summary
private int where

Constructor Detail

SwitchShifterback to summary
public SwitchShifter(StackMap smt, int where, int gap)

Method Detail

localsback to summary
public int locals(int pos, int offset, int num)

Overrides javassist.bytecode.StackMap.Walker.locals.

Doc from javassist.bytecode.StackMap.Walker.locals.

Invoked when locals of stack_map_frame is visited.

Annotations
@Override
javassist.bytecode back to summary

public Class StackMap.Walker

extends Object
Class Inheritance
Known Direct Subclasses
javassist.bytecode.StackMap.Copier, javassist.bytecode.StackMap.SimpleCopy, javassist.bytecode.StackMap.Shifter, javassist.bytecode.StackMap.SwitchShifter, javassist.bytecode.StackMap.Printer

A code walker for a StackMap attribute.

Field Summary

Modifier and TypeField and Description
pack-priv byte[]

Constructor Summary

AccessConstructor and Description
public
Walker(StackMap sm)

Constructs a walker.

Method Summary

Modifier and TypeMethod and Description
public int
locals(int pos, int offset, int num)

Invoked when locals of stack_map_frame is visited.

public void
objectVariable(int pos, int clazz)

Invoked when an element of type Object_variable_info is visited.

public int
stack(int pos, int offset, int num)

Invoked when stack of stack_map_frame is visited.

public void
typeInfo(int pos, byte tag)

Invoked when an element of verification_type_info (except Object_variable_info and Uninitialized_variable_info) is visited.

public int
typeInfoArray(int pos, int offset, int
the number of elements.
num
,
boolean
true if this array is for locals. false if it is for stack.
isLocals
)

Invoked when an array of verification_type_info is visited.

pack-priv int
typeInfoArray2(int k, int pos)

public void
uninitialized(int pos, int offset)

Invoked when an element of type Uninitialized_variable_info is visited.

public void
visit()

Visits each entry of the stack map frames.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

infoback to summary
pack-priv byte[] info

Constructor Detail

Walkerback to summary
public Walker(StackMap sm)

Constructs a walker.

Method Detail

localsback to summary
public int locals(int pos, int offset, int num)

Invoked when locals of stack_map_frame is visited.

objectVariableback to summary
public void objectVariable(int pos, int clazz)

Invoked when an element of type Object_variable_info is visited.

stackback to summary
public int stack(int pos, int offset, int num)

Invoked when stack of stack_map_frame is visited.

typeInfoback to summary
public void typeInfo(int pos, byte tag)

Invoked when an element of verification_type_info (except Object_variable_info and Uninitialized_variable_info) is visited.

typeInfoArrayback to summary
public int typeInfoArray(int pos, int offset, int num, boolean isLocals)

Invoked when an array of verification_type_info is visited.

Parameters
num:int

the number of elements.

isLocals:boolean

true if this array is for locals. false if it is for stack.

typeInfoArray2back to summary
pack-priv int typeInfoArray2(int k, int pos)
uninitializedback to summary
public void uninitialized(int pos, int offset)

Invoked when an element of type Uninitialized_variable_info is visited.

visitback to summary
public void visit()

Visits each entry of the stack map frames.

javassist.bytecode back to summary

public Class StackMap.Writer

extends Object
Class Inheritance

Internal use only.

Field Summary

Modifier and TypeField and Description
private ByteArrayOutputStream

Constructor Summary

AccessConstructor and Description
public
Writer()

Constructs a writer.

Method Summary

Modifier and TypeMethod and Description
public byte[]
toByteArray()

Converts the written data into a byte array.

public StackMap
toStackMap(ConstPool cp)

Converts to a StackMap attribute.

public void
write16bit(int value)

Writes a 16bit value.

public void
writeVerifyTypeInfo(int tag, int
cpool_index or offset.
data
)

Writes a union verification_type_info value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

outputback to summary
private ByteArrayOutputStream output

Constructor Detail

Writerback to summary
public Writer()

Constructs a writer.

Method Detail

toByteArrayback to summary
public byte[] toByteArray()

Converts the written data into a byte array.

toStackMapback to summary
public StackMap toStackMap(ConstPool cp)

Converts to a StackMap attribute.

write16bitback to summary
public void write16bit(int value)

Writes a 16bit value.

writeVerifyTypeInfoback to summary
public void writeVerifyTypeInfo(int tag, int data)

Writes a union verification_type_info value.

Parameters
data:int

cpool_index or offset.