mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +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:
|
case SET:
|
||||||
opCode = STRUCT_SET;
|
opCode = STRUCT_SET;
|
||||||
break;
|
break;
|
||||||
|
case NULL:
|
||||||
|
opCode = REF_NULL;
|
||||||
|
type = null;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error( "Unknown operator: " + op );
|
throw new Error( "Unknown operator: " + op );
|
||||||
}
|
}
|
||||||
codeStream.writeOpCode( opCode );
|
codeStream.writeOpCode( opCode );
|
||||||
codeStream.writeValueType( type );
|
if( type != null ) {
|
||||||
|
codeStream.writeValueType( type );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -400,21 +400,34 @@ public class TextModuleWriter extends ModuleWriter {
|
|||||||
String operation;
|
String operation;
|
||||||
switch( op ) {
|
switch( op ) {
|
||||||
case NEW:
|
case NEW:
|
||||||
operation = "new";
|
operation = "struct.new";
|
||||||
break;
|
break;
|
||||||
case NEW_DEFAULT:
|
case NEW_DEFAULT:
|
||||||
operation = "new_default";
|
operation = "struct.new_default";
|
||||||
break;
|
break;
|
||||||
case GET:
|
case GET:
|
||||||
operation = "get";
|
operation = "struct.get";
|
||||||
break;
|
break;
|
||||||
case SET:
|
case SET:
|
||||||
operation = "set";
|
operation = "struct.set";
|
||||||
|
break;
|
||||||
|
case NULL:
|
||||||
|
operation = "ref.null";
|
||||||
|
type = null;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error( "Unknown operator: " + op );
|
throw new Error( "Unknown operator: " + op );
|
||||||
}
|
}
|
||||||
newline( methodOutput );
|
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