diff options
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 3c01e5df5..be1c27d03 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1472,6 +1472,10 @@ void WasmBinaryWriter::writeType(Type type) { o << S32LEB(BinaryConsts::EncodedType::externref); return; } + if (Type::isSubType(type, Type(HeapType::exn, Nullable))) { + o << S32LEB(BinaryConsts::EncodedType::exnref); + return; + } if (Type::isSubType(type, Type(HeapType::string, Nullable))) { o << S32LEB(BinaryConsts::EncodedType::stringref); return; @@ -1502,6 +1506,9 @@ void WasmBinaryWriter::writeType(Type type) { case HeapType::array: o << S32LEB(BinaryConsts::EncodedType::arrayref); return; + case HeapType::exn: + o << S32LEB(BinaryConsts::EncodedType::exnref); + return; case HeapType::string: o << S32LEB(BinaryConsts::EncodedType::stringref); return; @@ -1523,6 +1530,9 @@ void WasmBinaryWriter::writeType(Type type) { case HeapType::nofunc: o << S32LEB(BinaryConsts::EncodedType::nullfuncref); return; + case HeapType::noexn: + o << S32LEB(BinaryConsts::EncodedType::nullexnref); + return; } } if (type.isNullable()) { @@ -1570,6 +1580,8 @@ void WasmBinaryWriter::writeHeapType(HeapType type) { type = HeapType::func; } else if (HeapType::isSubType(type, HeapType::ext)) { type = HeapType::ext; + } else if (HeapType::isSubType(type, HeapType::exn)) { + type = HeapType::exn; } else if (wasm->features.hasStrings()) { // Strings are enabled, and this isn't a func or an ext, so it must be a // string type (string or stringview), which we'll emit below, or a bottom @@ -1609,6 +1621,9 @@ void WasmBinaryWriter::writeHeapType(HeapType type) { case HeapType::array: ret = BinaryConsts::EncodedHeapType::array; break; + case HeapType::exn: + ret = BinaryConsts::EncodedHeapType::exn; + break; case HeapType::string: ret = BinaryConsts::EncodedHeapType::string; break; @@ -1630,6 +1645,9 @@ void WasmBinaryWriter::writeHeapType(HeapType type) { case HeapType::nofunc: ret = BinaryConsts::EncodedHeapType::nofunc; break; + case HeapType::noexn: + ret = BinaryConsts::EncodedHeapType::noexn; + break; } o << S64LEB(ret); // TODO: Actually s33 } @@ -1980,6 +1998,9 @@ bool WasmBinaryReader::getBasicType(int32_t code, Type& out) { case BinaryConsts::EncodedType::arrayref: out = Type(HeapType::array, Nullable); return true; + case BinaryConsts::EncodedType::exnref: + out = Type(HeapType::exn, Nullable); + return true; case BinaryConsts::EncodedType::stringref: out = Type(HeapType::string, Nullable); return true; @@ -2001,6 +2022,9 @@ bool WasmBinaryReader::getBasicType(int32_t code, Type& out) { case BinaryConsts::EncodedType::nullfuncref: out = Type(HeapType::nofunc, Nullable); return true; + case BinaryConsts::EncodedType::nullexnref: + out = Type(HeapType::noexn, Nullable); + return true; default: return false; } @@ -2029,6 +2053,9 @@ bool WasmBinaryReader::getBasicHeapType(int64_t code, HeapType& out) { case BinaryConsts::EncodedHeapType::array: out = HeapType::array; return true; + case BinaryConsts::EncodedHeapType::exn: + out = HeapType::exn; + return true; case BinaryConsts::EncodedHeapType::string: out = HeapType::string; return true; @@ -2050,6 +2077,9 @@ bool WasmBinaryReader::getBasicHeapType(int64_t code, HeapType& out) { case BinaryConsts::EncodedHeapType::nofunc: out = HeapType::nofunc; return true; + case BinaryConsts::EncodedHeapType::noexn: + out = HeapType::noexn; + return true; default: return false; } |