mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 10:44:47 +01:00
implements ref.null
This commit is contained in:
parent
ba118b8531
commit
1b09c5fd8c
@ -826,10 +826,16 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
|
||||
case SET:
|
||||
opCode = STRUCT_SET;
|
||||
break;
|
||||
case NULL:
|
||||
opCode = REF_NULL;
|
||||
type = null;
|
||||
break;
|
||||
default:
|
||||
throw new Error( "Unknown operator: " + op );
|
||||
}
|
||||
codeStream.writeOpCode( opCode );
|
||||
codeStream.writeValueType( type );
|
||||
if( type != null ) {
|
||||
codeStream.writeValueType( type );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -400,21 +400,34 @@ public class TextModuleWriter extends ModuleWriter {
|
||||
String operation;
|
||||
switch( op ) {
|
||||
case NEW:
|
||||
operation = "new";
|
||||
operation = "struct.new";
|
||||
break;
|
||||
case NEW_DEFAULT:
|
||||
operation = "new_default";
|
||||
operation = "struct.new_default";
|
||||
break;
|
||||
case GET:
|
||||
operation = "get";
|
||||
operation = "struct.get";
|
||||
break;
|
||||
case SET:
|
||||
operation = "set";
|
||||
operation = "struct.set";
|
||||
break;
|
||||
case NULL:
|
||||
operation = "ref.null";
|
||||
type = null;
|
||||
break;
|
||||
default:
|
||||
throw new Error( "Unknown operator: " + op );
|
||||
}
|
||||
newline( methodOutput );
|
||||
methodOutput.append( "struct." ).append( operation ).append( ' ' ).append( type );
|
||||
methodOutput.append( operation );
|
||||
if( type != null ) {
|
||||
int typeCode = type.getCode();
|
||||
methodOutput.append( ' ' );
|
||||
if( typeCode < 0 ) {
|
||||
methodOutput.append( type );
|
||||
} else {
|
||||
methodOutput.append( typeCode );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user