mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Also write prefix ref_type in the local variable declaration.
This commit is contained in:
parent
2be6f1a3be
commit
e037de5646
@ -467,6 +467,9 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
|
|||||||
localsStream.writeVaruint32( locals.size() );
|
localsStream.writeVaruint32( locals.size() );
|
||||||
for( AnyType valueType : locals ) {
|
for( AnyType valueType : locals ) {
|
||||||
localsStream.writeVaruint32( 1 ); // TODO optimize, write the count of same types.
|
localsStream.writeVaruint32( 1 ); // TODO optimize, write the count of same types.
|
||||||
|
if( valueType.getCode() >= 0 ) {
|
||||||
|
localsStream.writeValueType( ValueType.ref_type );
|
||||||
|
}
|
||||||
localsStream.writeValueType( valueType );
|
localsStream.writeValueType( valueType );
|
||||||
}
|
}
|
||||||
WasmOutputStream functionsStream = function.functionsStream = new WasmOutputStream();
|
WasmOutputStream functionsStream = function.functionsStream = new WasmOutputStream();
|
||||||
|
@ -60,7 +60,7 @@ class StructTypeEntry extends TypeEntry {
|
|||||||
for( NamedStorageType field : this.fields ) {
|
for( NamedStorageType field : this.fields ) {
|
||||||
stream.writeVarint( 1 ); // 0 - immutable; 1 - mutable
|
stream.writeVarint( 1 ); // 0 - immutable; 1 - mutable
|
||||||
if( field.type.getCode() > 0 ) {
|
if( field.type.getCode() > 0 ) {
|
||||||
stream.writeVaruint32( 0x6E );
|
stream.writeValueType( ValueType.ref_type );
|
||||||
}
|
}
|
||||||
stream.writeValueType( field.type );
|
stream.writeValueType( field.type );
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ public enum ValueType implements AnyType {
|
|||||||
i16(-0x06), //TODO dummy value for https://github.com/WebAssembly/gc
|
i16(-0x06), //TODO dummy value for https://github.com/WebAssembly/gc
|
||||||
anyfunc(-0x10),
|
anyfunc(-0x10),
|
||||||
anyref(-0x11),
|
anyref(-0x11),
|
||||||
|
ref_type(-0x12 ), // 0x6E https://github.com/lars-t-hansen/moz-gc-experiments/blob/master/version2.md
|
||||||
except_ref(-0x18), // https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md
|
except_ref(-0x18), // https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md
|
||||||
func(-0x20),
|
func(-0x20),
|
||||||
struct(-0x30),
|
struct(-0x30),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user