CodeAttributepublic class CodeAttribute extends Attribute
Fields Summary |
---|
public int | stack | public int | locals | public byte[] | code | public ExceptionEntry[] | exceptionTable | public Attribute[] | codeAttributes | private static Hashtable | codeAttributeTypes |
Methods Summary |
---|
public void | countConstantReferences(boolean isRelocatable)
super.countConstantReferences( isRelocatable );
if ( exceptionTable != null ){
for( int i = 0; i < exceptionTable.length; i++ ){
exceptionTable[i].countConstantReferences();
}
}
Attribute.countConstantReferences( codeAttributes, isRelocatable );
| public void | externalize(ConstantPool p)
super.externalize( p );
Attribute.externalizeAttributes( codeAttributes, p );
| public static Attribute | finishReadAttribute(java.io.DataInput in, UnicodeConstant name, ConstantObject[] locals, ConstantObject[] globals)
int l;
int nstack;
int nlocals;
ConstantObject d;
ExceptionEntry exceptionTable[];
l = in.readInt();
nstack = in.readUnsignedShort();
nlocals = in.readUnsignedShort();
int codesize = in.readInt();
byte code[] = new byte[ codesize ];
in.readFully( code );
int tableSize = in.readUnsignedShort();
exceptionTable = new ExceptionEntry[tableSize];
for (int j = 0; j < tableSize; j++) {
int sPC = in.readUnsignedShort();
int e = in.readUnsignedShort();
int h = in.readUnsignedShort();
int catchTypeIndex = in.readUnsignedShort();
ClassConstant ctype;
if ( catchTypeIndex == 0 ){
ctype = null;
} else {
ctype = (ClassConstant)locals[ catchTypeIndex ];
}
exceptionTable[j] = new ExceptionEntry(
sPC, e, h, ctype );
}
Attribute a[] = Attribute.readAttributes( in, locals, globals, codeAttributeTypes, false );
return new CodeAttribute(
name, l, nstack, nlocals, code, exceptionTable, a );
| public static Attribute | readAttribute(java.io.DataInput i, ConstantObject[] locals, ConstantObject[] globals)
codeAttributeTypes.put( "LineNumberTable", LineNumberTableAttributeFactory.instance );
codeAttributeTypes.put( "LocalVariableTable", LocalVariableTableAttributeFactory.instance );
codeAttributeTypes.put( "StackMap", StackMapAttributeFactory.instance );
UnicodeConstant name;
name = (UnicodeConstant)globals[i.readUnsignedShort()];
return finishReadAttribute( i, name, locals, globals );
| protected int | writeData(java.io.DataOutput o)
int trueLength = 8 + code.length;
o.writeShort( stack );
o.writeShort( locals );
o.writeInt( code.length );
o.write( code, 0, code.length );
if ( exceptionTable == null ){
o.writeShort( 0 );
trueLength += 2;
} else {
o.writeShort( exceptionTable.length );
for ( int i = 0; i < exceptionTable.length ; i ++ ){
exceptionTable[i].write( o );
}
trueLength += 2 + exceptionTable.length*ExceptionEntry.size;
}
if ( codeAttributes == null ){
o.writeShort(0);
trueLength += 2;
} else {
Attribute.writeAttributes( codeAttributes, o, false );
trueLength += Attribute.length( codeAttributes );
}
return trueLength;
|
|