diff options
author | Alon Zakai <azakai@google.com> | 2021-06-17 07:51:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-17 07:51:11 -0700 |
commit | c36c6fa9e42f4e917864312780ba95fb996eda79 (patch) | |
tree | 1e171bbd8b1a10f09ab14a59bc03b39bbe494c1e /src/wasm/wasm-binary.cpp | |
parent | 9d279c08b9f37b6cf2c5a5fac564eee9ea4fb927 (diff) | |
download | binaryen-c36c6fa9e42f4e917864312780ba95fb996eda79.tar.gz binaryen-c36c6fa9e42f4e917864312780ba95fb996eda79.tar.bz2 binaryen-c36c6fa9e42f4e917864312780ba95fb996eda79.zip |
[Wasm GC] rtt.fresh_sub (#3936)
This is the same as rtt.sub, but creates a "new" rtt each time. See
https://docs.google.com/document/d/1DklC3qVuOdLHSXB5UXghM_syCh-4cMinQ50ICiXnK3Q/edit#
The old Literal implementation of rtts becomes a little more complex here,
as it was designed for the original spec where only structure matters. It may
be worth a complete redesign there, but for now as the spec is in flux I think
the approach here is good enough.
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index a4df4ed16..7625d1f2a 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -6419,12 +6419,16 @@ bool WasmBinaryBuilder::maybeVisitRttCanon(Expression*& out, uint32_t code) { } bool WasmBinaryBuilder::maybeVisitRttSub(Expression*& out, uint32_t code) { - if (code != BinaryConsts::RttSub) { + if (code != BinaryConsts::RttSub && code != BinaryConsts::RttFreshSub) { return false; } auto targetHeapType = getIndexedHeapType(); auto* parent = popNonVoidExpression(); - out = Builder(wasm).makeRttSub(targetHeapType, parent); + if (code == BinaryConsts::RttSub) { + out = Builder(wasm).makeRttSub(targetHeapType, parent); + } else { + out = Builder(wasm).makeRttFreshSub(targetHeapType, parent); + } return true; } |