From 6566329fecd36c8cd8e2ab29f89dafde0d2e9304 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 17 Oct 2024 12:49:43 -0700 Subject: [EH][GC] Send a non-nullable exnref from TryTable (#7013) When EH+GC are enabled then wasm has non-nullable types, and the sent exnref should be non-nullable. In BinaryenIR we use the non- nullable type all the time, which we also do for function references and other things; we lower it if GC is not enabled to a nullable type for the binary format (see `WasmBinaryWriter::writeType`, to which comments were added in this PR). That is, this PR makes us handle exnref the same as those other types. A new test verifies that behavior. Various existing tests are updated because ReFinalize will now use the more refined type, so this is an optimization. It is also a bugfix as in #6987 we started to emit the refined form in the fuzzer, and this PR makes us handle it properly in validation and ReFinalization. --- src/wasm/wasm-validator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wasm/wasm-validator.cpp') diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index a86187fa7..0184e3284 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2658,7 +2658,7 @@ void FunctionValidator::visitTryTable(TryTable* curr) { "the number of catch tags and sent types do not match"); const char* invalidSentTypeMsg = "invalid catch sent type information"; - Type exnref = Type(HeapType::exn, Nullable); + Type exnref = Type(HeapType::exn, NonNullable); for (Index i = 0; i < curr->catchTags.size(); i++) { auto sentType = curr->sentTypes[i]; size_t tagTypeSize; -- cgit v1.2.3