From bcc76146fed433cbc8ba01a9f568d979c145110b Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Mon, 30 Dec 2019 17:55:20 -0800 Subject: Add support for reference types proposal (#2451) This adds support for the reference type proposal. This includes support for all reference types (`anyref`, `funcref`(=`anyfunc`), and `nullref`) and four new instructions: `ref.null`, `ref.is_null`, `ref.func`, and new typed `select`. This also adds subtype relationship support between reference types. This does not include table instructions yet. This also does not include wasm2js support. Fixes #2444 and fixes #2447. --- src/wasm.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/wasm.h') diff --git a/src/wasm.h b/src/wasm.h index 48adf103b..c4dbd2f3f 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -531,6 +531,9 @@ public: MemoryFillId, PushId, PopId, + RefNullId, + RefIsNullId, + RefFuncId, TryId, ThrowId, RethrowId, @@ -569,6 +572,8 @@ public: const char* getExpressionName(Expression* curr); +Literal getLiteralFromConstExpression(Expression* curr); + typedef ArenaVector ExpressionList; template class SpecificExpression : public Expression { @@ -1008,6 +1013,7 @@ public: Expression* condition; void finalize(); + void finalize(Type type_); }; class Drop : public SpecificExpression { @@ -1070,6 +1076,32 @@ public: Pop(MixedArena& allocator) {} }; +class RefNull : public SpecificExpression { +public: + RefNull() = default; + RefNull(MixedArena& allocator) {} + + void finalize(); +}; + +class RefIsNull : public SpecificExpression { +public: + RefIsNull(MixedArena& allocator) {} + + Expression* value; + + void finalize(); +}; + +class RefFunc : public SpecificExpression { +public: + RefFunc(MixedArena& allocator) {} + + Name func; + + void finalize(); +}; + class Try : public SpecificExpression { public: Try(MixedArena& allocator) {} -- cgit v1.2.3