mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 18:44:47 +01:00
Pass maxLocals ever to the LocalVariableTable
This commit is contained in:
parent
5ea58e30f8
commit
275db31ab3
@ -104,10 +104,12 @@ public class Code {
|
||||
}
|
||||
AttributeInfo data = attributes.get( "LocalVariableTable" );
|
||||
if( data != null ) {
|
||||
localVariableTable = new LocalVariableTable( maxLocals, constantPool );
|
||||
localVariableTable.read( data.getDataInputStream() );
|
||||
localVariableTable = new LocalVariableTable( maxLocals, constantPool, data.getDataInputStream() );
|
||||
// we does not need any generics information
|
||||
// data = attributes.get( "LocalVariableTypeTable" );
|
||||
} else {
|
||||
// return only the maxLocals
|
||||
localVariableTable = new LocalVariableTable( maxLocals );
|
||||
}
|
||||
return localVariableTable;
|
||||
}
|
||||
|
@ -24,8 +24,6 @@ import java.io.IOException;
|
||||
*/
|
||||
public class LocalVariableTable {
|
||||
|
||||
private final ConstantPool constantPool;
|
||||
|
||||
private final int maxLocals;
|
||||
|
||||
private LocalVariable[] table;
|
||||
@ -33,26 +31,21 @@ public class LocalVariableTable {
|
||||
/**
|
||||
* Create a new instance of the code attribute "LocalVariableTable".
|
||||
*
|
||||
* http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.13
|
||||
* http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#5956
|
||||
|
||||
* @param maxLocals
|
||||
* the count of local variables in the memory
|
||||
* @param constantPool
|
||||
* Reference to the current ConstantPool
|
||||
*/
|
||||
LocalVariableTable( int maxLocals, ConstantPool constantPool ) {
|
||||
this.maxLocals = maxLocals;
|
||||
this.constantPool = constantPool;
|
||||
}
|
||||
|
||||
/**
|
||||
* http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.13
|
||||
* http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#5956
|
||||
*
|
||||
* @param input
|
||||
* the stream of the class
|
||||
* @throws IOException
|
||||
* if any I/O error occurs.
|
||||
*/
|
||||
void read( DataInputStream input ) throws IOException {
|
||||
LocalVariableTable( int maxLocals, ConstantPool constantPool, DataInputStream input ) throws IOException {
|
||||
this.maxLocals = maxLocals;
|
||||
|
||||
int count = input.readUnsignedShort();
|
||||
table = new LocalVariable[count];
|
||||
for( int i = 0; i < count; i++ ) {
|
||||
@ -60,6 +53,18 @@ public class LocalVariableTable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance without any debug details.
|
||||
*
|
||||
* @param maxLocals
|
||||
* the count of local variables in the memory
|
||||
*/
|
||||
LocalVariableTable( int maxLocals ) {
|
||||
this.maxLocals = maxLocals;
|
||||
|
||||
table = new LocalVariable[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the count of variables/slots. This is not the count of declared LocalVariable in this table. There can be
|
||||
* unnamed helper variables for the compiler which are not in the table. There can be reused slots for different
|
||||
|
Loading…
x
Reference in New Issue
Block a user