mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Does not write the type eqref
to the output if GC is not enabled
This commit is contained in:
parent
2d7b7f2f50
commit
5d2a3805db
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2017 - 2020 Volker Berlin (i-net software)
|
* Copyright 2017 - 2021 Volker Berlin (i-net software)
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -84,6 +84,13 @@ class WasmOutputStream extends LittleEndianOutputStream {
|
|||||||
* if an I/O error occurs.
|
* if an I/O error occurs.
|
||||||
*/
|
*/
|
||||||
public void writeValueType( AnyType type ) throws IOException {
|
public void writeValueType( AnyType type ) throws IOException {
|
||||||
|
if( !type.isRefType() && !options.useGC() ) {
|
||||||
|
switch( (ValueType)type ) {
|
||||||
|
case eqref:
|
||||||
|
type = ValueType.externref;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
writeVarint( type.getCode() );
|
writeVarint( type.getCode() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,7 +362,23 @@ public class TextModuleWriter extends ModuleWriter {
|
|||||||
*/
|
*/
|
||||||
private void writeTypeName( Appendable output, AnyType type ) throws IOException {
|
private void writeTypeName( Appendable output, AnyType type ) throws IOException {
|
||||||
if( !type.isRefType() ) {
|
if( !type.isRefType() ) {
|
||||||
String name = type == ValueType.u16 ? "i16" : type == ValueType.bool ? "i8" : type.toString();
|
String name;
|
||||||
|
switch( (ValueType)type ) {
|
||||||
|
case u16:
|
||||||
|
name = "i16";
|
||||||
|
break;
|
||||||
|
case bool:
|
||||||
|
name = "i8";
|
||||||
|
break;
|
||||||
|
case eqref:
|
||||||
|
if( !options.useGC() ) {
|
||||||
|
name = ValueType.externref.toString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//$FALL-THROUGH$
|
||||||
|
default:
|
||||||
|
name = type.toString();
|
||||||
|
}
|
||||||
output.append( name );
|
output.append( name );
|
||||||
} else if( options.useGC() ) {
|
} else if( options.useGC() ) {
|
||||||
//output.append( ValueType.eqref.toString() );
|
//output.append( ValueType.eqref.toString() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user