mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
declare array types only once; add "value" field to array with GC objects
This commit is contained in:
parent
54ad287ed6
commit
28b03b05c2
@ -59,6 +59,11 @@ public class TypeManager {
|
|||||||
*/
|
*/
|
||||||
static final String FIELD_HASHCODE = ".hashcode";
|
static final String FIELD_HASHCODE = ".hashcode";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of field with array value.
|
||||||
|
*/
|
||||||
|
static final String FIELD_VALUE = ".val";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Byte position in the type description that contains the offset to the interfaces. Length 4 bytes.
|
* Byte position in the type description that contains the offset to the interfaces. Length 4 bytes.
|
||||||
*/
|
*/
|
||||||
@ -225,13 +230,13 @@ public class TypeManager {
|
|||||||
public StructType valueOf( String name ) {
|
public StructType valueOf( String name ) {
|
||||||
StructType type = structTypes.get( name );
|
StructType type = structTypes.get( name );
|
||||||
if( type == null ) {
|
if( type == null ) {
|
||||||
checkStructTypesState( name );
|
|
||||||
|
|
||||||
if( name.startsWith( "[" ) ) {
|
if( name.startsWith( "[" ) ) {
|
||||||
type = (StructType)new ValueTypeParser( name, options.types ).next();
|
return (StructType)new ValueTypeParser( name, options.types ).next();
|
||||||
} else {
|
} else {
|
||||||
|
checkStructTypesState( name );
|
||||||
type = new StructType( name, structTypes.size() );
|
type = new StructType( name, structTypes.size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
structTypes.put( name, type );
|
structTypes.put( name, type );
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
@ -583,6 +588,9 @@ public class TypeManager {
|
|||||||
} else {
|
} else {
|
||||||
fields.add( new NamedStorageType( ValueType.i32, className, FIELD_VTABLE ) );
|
fields.add( new NamedStorageType( ValueType.i32, className, FIELD_VTABLE ) );
|
||||||
fields.add( new NamedStorageType( ValueType.i32, className, FIELD_HASHCODE ) );
|
fields.add( new NamedStorageType( ValueType.i32, className, FIELD_HASHCODE ) );
|
||||||
|
if( getComponentClassIndex() >= 0 ) {
|
||||||
|
fields.add( new NamedStorageType( this, className, FIELD_VALUE ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// list all fields
|
// list all fields
|
||||||
|
Loading…
x
Reference in New Issue
Block a user