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/tools/wasm-reduce.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/tools/wasm-reduce.cpp') diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp index 274b6de29..6adb1e174 100644 --- a/src/tools/wasm-reduce.cpp +++ b/src/tools/wasm-reduce.cpp @@ -592,7 +592,9 @@ struct Reducer fixed = builder->makeUnary(TruncSFloat64ToInt32, child); break; case v128: + case funcref: case anyref: + case nullref: case exnref: continue; // not implemented yet case none: @@ -615,7 +617,9 @@ struct Reducer fixed = builder->makeUnary(TruncSFloat64ToInt64, child); break; case v128: + case funcref: case anyref: + case nullref: case exnref: continue; // not implemented yet case none: @@ -638,7 +642,9 @@ struct Reducer fixed = builder->makeUnary(DemoteFloat64, child); break; case v128: + case funcref: case anyref: + case nullref: case exnref: continue; // not implemented yet case none: @@ -661,7 +667,9 @@ struct Reducer case f64: WASM_UNREACHABLE("unexpected type"); case v128: + case funcref: case anyref: + case nullref: case exnref: continue; // not implemented yet case none: @@ -671,7 +679,9 @@ struct Reducer break; } case v128: + case funcref: case anyref: + case nullref: case exnref: continue; // not implemented yet case none: @@ -999,6 +1009,10 @@ struct Reducer return false; } // try to replace with a trivial value + if (curr->type.isRef()) { + RefNull* n = builder->makeRefNull(); + return tryToReplaceCurrent(n); + } Const* c = builder->makeConst(Literal(int32_t(0))); if (tryToReplaceCurrent(c)) { return true; -- cgit v1.2.3