From 3a87ebe9f23763cf8146e7447343d44d071f6da0 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 22 Aug 2022 09:32:14 -0700 Subject: GUFA: Mutable exported globals are roots (#4935) Such globals can be written to from the outside, so we cannot infer anything about their contents. Fixes #4932 --- src/ir/possible-contents.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/ir/possible-contents.cpp') diff --git a/src/ir/possible-contents.cpp b/src/ir/possible-contents.cpp index d9c608bda..f1302b3dd 100644 --- a/src/ir/possible-contents.cpp +++ b/src/ir/possible-contents.cpp @@ -1234,6 +1234,13 @@ Flower::Flower(Module& wasm) : wasm(wasm) { } } } + } else if (ex->kind == ExternalKind::Global) { + // Exported mutable globals are roots, since the outside may write any + // value to them. + auto name = ex->value; + if (wasm.getGlobal(name)->mutable_) { + roots[GlobalLocation{name}] = PossibleContents::many(); + } } } -- cgit v1.2.3