From 0b0e20f9802afa2f74a896853b4c1be4d3f49f1e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 24 Mar 2021 10:54:49 -0700 Subject: [Wasm GC] Handle non-nullable locals in Flatten pass (#3720) That pass adds lots of new locals, and we need to handle non-nullable ones. --- test/passes/flatten_all-features.txt | 17 +++++++++++++++++ test/passes/flatten_all-features.wast | 10 ++++++++++ 2 files changed, 27 insertions(+) (limited to 'test') diff --git a/test/passes/flatten_all-features.txt b/test/passes/flatten_all-features.txt index efcce6797..99c8cb4bb 100644 --- a/test/passes/flatten_all-features.txt +++ b/test/passes/flatten_all-features.txt @@ -2443,3 +2443,20 @@ (unreachable) ) ) +(module + (type $none_=>_none (func)) + (type $none_=>_funcref (func (result funcref))) + (func $0 (result funcref) + (local $0 (ref null $none_=>_none)) + (local.set $0 + (ref.as_non_null + (ref.null $none_=>_none) + ) + ) + (return + (ref.as_non_null + (local.get $0) + ) + ) + ) +) diff --git a/test/passes/flatten_all-features.wast b/test/passes/flatten_all-features.wast index 14da24a74..874e91572 100644 --- a/test/passes/flatten_all-features.wast +++ b/test/passes/flatten_all-features.wast @@ -1055,3 +1055,13 @@ ) ) ) +;; non-nullable temp vars we add must be handled properly, as non-nullable +;; locals are not allowed +(module + (type $none_=>_none (func)) + (func $0 (result funcref) + (ref.as_non_null + (ref.null $none_=>_none) + ) + ) +) -- cgit v1.2.3