Class CodeAttr
java.lang.Object
org.openjdk.asmtools.jasm.AttrData
org.openjdk.asmtools.jasm.CodeAttr
- All Implemented Interfaces:
ConstantPoolDataVisitor, DataWriter
4.7.3. The Code Attribute
Code_attribute { u2 attribute_name_index; u4 attribute_length; u2 max_stack; u2 max_locals; u4 code_length; u1 code[code_length]; u2 exception_table_length; { u2 start_pc; u2 end_pc; u2 handler_pc; u2 catch_type; } exception_table[exception_table_length]; u2 attributes_count; attribute_info attributes[attributes_count]; }
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DataVector<DataVectorAttr<? extends DataWriter>> protected ClassDataprotected intprotected JasmEnvironmentprotected DataVector<ExceptionData> protected DataVectorAttr<TypeAnnotationData> protected HashMap<String, CodeAttr.Label> protected Instrprotected longprotected DataVectorAttr<LineNumberData> protected DataVectorAttr<LocalVariableData> protected DataVectorAttr<LocalVariableData> protected final List<LocalVariableData> protected final List<LocalVariableData> protected Indexerprotected Indexerprotected MethodDataprotected List<StackMapData> protected DataVectorAttr<StackMapData> protected HashMap<String, CodeAttr.RangePC> private final LocalVariableDataprotected DataVectorAttr<TypeAnnotationData> protected Instr -
Constructor Summary
ConstructorsConstructorDescriptionCodeAttr(MethodData methodData, int paramCount, Indexer max_stack, Indexer max_locals) -
Method Summary
Modifier and TypeMethodDescriptionvoid(package private) voidaddInstr(long mnenoc_pos, OpcodeTables.Opcode opcode, Indexer arg, Object arg2) int(package private) void(package private) void(package private) voidcheckLocVars(OpcodeTables.Opcode opcode) (package private) void(package private) voidendCode()(package private) voidvoidfillLineTable(List<LineNumberData> list) voidfillLocalVariableTable(boolean isTypeTable, List<LocalVariableData> list) Fills either localVariableTable or localVariableTypeTable according to the boolean parameter isTypeTablevoidfillStackMapTable(List<StackMapData> list) private StackMapDataboolean(package private) CodeAttr.LabelvoidLocVarDataDef(OpcodeTables.Opcode opcode, long position, int index, ConstCell<?> nameCell, ConstCell<?> descriptorCell) Constructs the local variable nameCell:descriptorCell assigned to the slot index.voidLocVarDataEnd(OpcodeTables.Opcode opcode, short slot, long position) Marks the end of Local Variable (Type) presented in the form endVar index: locVarSlots[slot] = VACANT and sets the Length of the Local Var(package private) CodeAttr.RangePC(package private) voidtrapHandler(long pos, String name, Indexer type) voidMethods inherited from class AttrData
classifyConstCell, getAttribute, getLength, visitMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ConstantPoolDataVisitor
visitConstCell, visitDataMethods inherited from interface DataWriter
isCountable
-
Field Details
-
locVarSlots
-
locVarTypeSlots
-
VACANT
-
classData
-
methodData
-
environment
-
max_stack
-
max_locals
-
zeroInstr
-
lastInstr
-
curPC
protected int curPC -
exceptionTable
-
lineNumberTable
-
lastLineNumber
protected long lastLineNumber -
localVariableTable
-
localVariableTypeTable
-
attributes
-
labelsHash
-
trapsHash
-
stackMapEntries
-
stackMapTable
-
visTypeAnnotations
-
inVisTypeAnnotations
-
-
Constructor Details
-
CodeAttr
-
-
Method Details
-
endCode
void endCode() -
addAnnotations
-
fillLineTable
-
fillLocalVariableTable
Fills either localVariableTable or localVariableTypeTable according to the boolean parameter isTypeTable- Parameters:
isTypeTable- defines which localVariableTypeTable or localVariableTable is filledlist- list of local_variable_table[i] or local_variable_type_table[i] entries
-
fillStackMapTable
-
trapDecl
-
beginTrap
-
endTrap
-
trapHandler
-
checkTraps
void checkTraps() -
labelDecl
-
LabelDef
-
LabelRef
-
checkLabels
void checkLabels() -
LocVarDataDef
public void LocVarDataDef(OpcodeTables.Opcode opcode, long position, int index, ConstCell<?> nameCell, ConstCell<?> descriptorCell) Constructs the local variable nameCell:descriptorCell assigned to the slot index.- Parameters:
opcode- var or type opcode that defines type of filled table -LocalVariableTypeTable or LocalVariableTableposition- scanners' position to navigate where a syntax error happened if anyindex- a valid index into the local variable array of the current framenameCell- valid unqualified name denoting a local variabledescriptorCell- a field descriptor which encodes a type of local variable in the source program
-
LocVarDataEnd
Marks the end of Local Variable (Type) presented in the form endVar index: locVarSlots[slot] = VACANT and sets the Length of the Local Var- Parameters:
slot- The value of the index item is a valid index into the local variable array of the current frame.position- the position of the scanner
-
checkLocVars
-
getStackMapTable
-
getNextStackMapTable
-
isTypeCheckingVerifier
public boolean isTypeCheckingVerifier() -
addInstr
-
getPreviousStackMapEntry
-
attrLength
public int attrLength()- Overrides:
attrLengthin classAttrData
-
write
- Specified by:
writein interfaceDataWriter- Overrides:
writein classAttrData- Throws:
IOExceptionParser.CompilerError
-