mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
switch from anyref to eqref for GC code
This commit is contained in:
parent
4cd43a4d65
commit
1d3db1135b
@ -1394,7 +1394,7 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
|
||||
break;
|
||||
case NULL:
|
||||
opCode = REF_NULL;
|
||||
type = options.useGC() ? ValueType.anyref : ValueType.externref;
|
||||
type = options.useGC() ? ValueType.eqref : ValueType.externref;
|
||||
break;
|
||||
default:
|
||||
throw new Error( "Unknown operator: " + op );
|
||||
|
@ -55,8 +55,8 @@ class StructTypeEntry extends TypeEntry {
|
||||
void writeSectionEntryDetails( WasmOutputStream stream ) throws IOException {
|
||||
stream.writeVaruint32( this.fields.size() );
|
||||
for( NamedStorageType field : this.fields ) {
|
||||
stream.writeVarint( 1 ); // 0 - immutable; 1 - mutable
|
||||
stream.writeRefValueType( field.getType() );
|
||||
stream.writeVarint( 1 ); // 0 - immutable; 1 - mutable
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class WasmOutputStream extends LittleEndianOutputStream {
|
||||
if( type.isRefType() ) {
|
||||
if( options.useGC() ) {
|
||||
//TODO writeValueType( ValueType.ref_type );
|
||||
type = ValueType.anyref;
|
||||
type = ValueType.eqref;
|
||||
} else {
|
||||
type = ValueType.externref;
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ public class TypeManager {
|
||||
@Override
|
||||
public boolean isSubTypeOf( AnyType type ) {
|
||||
//TODO if type is StructType (class or interface)
|
||||
return type == this || type == ValueType.externref || type == ValueType.anyref;
|
||||
return type == this || type == ValueType.externref || type == ValueType.anyref || type == ValueType.eqref;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -203,7 +203,7 @@ class WasmStructInstruction extends WasmInstruction {
|
||||
AnyType getPushValueType() {
|
||||
switch( op ) {
|
||||
case NULL:
|
||||
return options.useGC() ? ValueType.anyref : ValueType.externref;
|
||||
return options.useGC() ? ValueType.eqref : ValueType.externref;
|
||||
case NEW:
|
||||
case NEW_DEFAULT:
|
||||
case CAST:
|
||||
|
@ -316,7 +316,7 @@ public class TextModuleWriter extends ModuleWriter {
|
||||
if( !type.isRefType() ) {
|
||||
output.append( type.toString() );
|
||||
} else if( options.useGC() ) {
|
||||
output.append( ValueType.anyref.toString() );
|
||||
output.append( ValueType.eqref.toString() );
|
||||
//TODO output.append( "(optref " ).append( normalizeName( type.toString() ) ).append( ')' );
|
||||
} else {
|
||||
output.append( ValueType.externref.toString() );
|
||||
@ -859,7 +859,7 @@ public class TextModuleWriter extends ModuleWriter {
|
||||
operation = "struct.set";
|
||||
break;
|
||||
case NULL:
|
||||
operation = options.useGC() ? "ref.null any" : "ref.null extern";
|
||||
operation = options.useGC() ? "ref.null eq" : "ref.null extern";
|
||||
type = null;
|
||||
break;
|
||||
default:
|
||||
|
@ -24,12 +24,14 @@ public enum ValueType implements AnyType {
|
||||
f32(-0x03),
|
||||
f64(-0x04),
|
||||
v128(-0x05),
|
||||
i8(-0x06), //TODO dummy value for https://github.com/WebAssembly/gc
|
||||
i16(-0x07), //TODO dummy value for https://github.com/WebAssembly/gc
|
||||
i8(-0x06),
|
||||
i16(-0x07),
|
||||
funcref(-0x10),
|
||||
externref(-0x11),
|
||||
anyref(-0x12),
|
||||
ref_type(-0x13 ), // 0x6D https://github.com/lars-t-hansen/moz-gc-experiments/blob/master/version2.md
|
||||
eqref(-0x13),
|
||||
optref(-0x14),
|
||||
ref(-0x15),
|
||||
exnref(-0x18), // https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md
|
||||
func(-0x20),
|
||||
struct(-0x21),
|
||||
|
Loading…
x
Reference in New Issue
Block a user