diff options
author | Alon Zakai <azakai@google.com> | 2021-01-27 17:46:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-27 09:46:31 -0800 |
commit | 2bdc4841b680ee44e132bbb07f5167eaa7226f99 (patch) | |
tree | 170585bbb9c74022201efeeee91962fdb5f0a1f1 /src/wasm.h | |
parent | f82e94363a231bf570fbe3d7dc49259c8668206f (diff) | |
download | binaryen-2bdc4841b680ee44e132bbb07f5167eaa7226f99.tar.gz binaryen-2bdc4841b680ee44e132bbb07f5167eaa7226f99.tar.bz2 binaryen-2bdc4841b680ee44e132bbb07f5167eaa7226f99.zip |
[GC] ref.as_* (#3520)
These are similar to is, but instead of returning an i32 answer, they trap on
an invalid value, and return it otherwise.
These could in theory be in a single RefDoThing, with opcodes for both As
and Is, but as the return values are different, that would be a little odd, and
the name would be less clear.
Diffstat (limited to 'src/wasm.h')
-rw-r--r-- | src/wasm.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/wasm.h b/src/wasm.h index 949ec3b72..094233b5c 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -549,6 +549,12 @@ enum RefIsOp { RefIsI31, }; +enum RefAsOp { + RefAsFunc, + RefAsData, + RefAsI31, +}; + // // Expressions // @@ -639,6 +645,7 @@ public: ArrayGetId, ArraySetId, ArrayLenId, + RefAsId, NumExpressionIds }; Id _id; @@ -1492,6 +1499,17 @@ public: void finalize(); }; +class RefAs : public SpecificExpression<Expression::RefAsId> { +public: + RefAs(MixedArena& allocator) {} + + RefAsOp op; + + Expression* value; + + void finalize(); +}; + // Globals struct Importable { |