diff options
author | Alon Zakai <azakai@google.com> | 2021-01-21 22:09:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-21 14:09:47 -0800 |
commit | 3f4d3b3eff5d8112a9da3674a5f5eea696ca3c7d (patch) | |
tree | 30d3ddedf6ae2de10f56d6acea64f2b17640041b /src/wasm/wasm-binary.cpp | |
parent | 527e9f9ed76cee0baaa67e89569c282a3782be08 (diff) | |
download | binaryen-3f4d3b3eff5d8112a9da3674a5f5eea696ca3c7d.tar.gz binaryen-3f4d3b3eff5d8112a9da3674a5f5eea696ca3c7d.tar.bz2 binaryen-3f4d3b3eff5d8112a9da3674a5f5eea696ca3c7d.zip |
[GC] Add dataref type (#3500)
This is not 100% of everything, but is enough to get tests passing, which
includes full binary and text format support, getting all switches to compile
without error, and some additions to InstrumentLocals.
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index eea0a9c21..62c8a6cb3 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1057,6 +1057,9 @@ void WasmBinaryWriter::writeType(Type type) { case Type::i31ref: ret = BinaryConsts::EncodedType::i31ref; break; + case Type::dataref: + ret = BinaryConsts::EncodedType::dataref; + break; default: WASM_UNREACHABLE("unexpected type"); } @@ -1089,6 +1092,9 @@ void WasmBinaryWriter::writeHeapType(HeapType type) { case HeapType::i31: ret = BinaryConsts::EncodedHeapType::i31; break; + case HeapType::data: + ret = BinaryConsts::EncodedHeapType::data; + break; } } else { WASM_UNREACHABLE("TODO: compound GC types"); @@ -1415,6 +1421,9 @@ Type WasmBinaryBuilder::getType(int initial) { case BinaryConsts::EncodedType::nonnullable: // FIXME: for now, force all inputs to be nullable return Type(getHeapType(), Nullable); + case BinaryConsts::EncodedType::dataref: + // FIXME: for now, force all inputs to be nullable + return Type(HeapType::BasicHeapType::data, Nullable); case BinaryConsts::EncodedType::i31ref: // FIXME: for now, force all inputs to be nullable return Type(HeapType::BasicHeapType::i31, Nullable); @@ -1456,6 +1465,8 @@ HeapType WasmBinaryBuilder::getHeapType() { return HeapType::eq; case BinaryConsts::EncodedHeapType::i31: return HeapType::i31; + case BinaryConsts::EncodedHeapType::data: + return HeapType::data; default: throwError("invalid wasm heap type: " + std::to_string(type)); } |