diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2022-06-28 21:11:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-28 21:11:31 -0700 |
commit | 9dbe45780d8c78dbb49c208fe4505cd1624a98ac (patch) | |
tree | 041feff94f8df88b1798b0ee8dd2e3d282a98cfd /src/passes/GlobalRefining.cpp | |
parent | 7b7e2c56b7df43c7c6d99ef44dc4fff3b2e142bc (diff) | |
download | binaryen-9dbe45780d8c78dbb49c208fe4505cd1624a98ac.tar.gz binaryen-9dbe45780d8c78dbb49c208fe4505cd1624a98ac.tar.bz2 binaryen-9dbe45780d8c78dbb49c208fe4505cd1624a98ac.zip |
Disallow --nominal with GC (#4758)
Nominal types don't make much sense without GC, and in particular trying to emit
them with typed function references but not GC enabled can result in invalid
binaries because nominal types do not respect the type ordering constraints
required by the typed function references proposal. Making this change was
mostly straightforward, but required fixing the fuzzer to use --nominal only
when GC is enabled and required exiting early from nominal-only optimizations
when GC was not enabled.
Fixes #4756.
Diffstat (limited to 'src/passes/GlobalRefining.cpp')
-rw-r--r-- | src/passes/GlobalRefining.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/passes/GlobalRefining.cpp b/src/passes/GlobalRefining.cpp index e43f8ef59..6f2f19842 100644 --- a/src/passes/GlobalRefining.cpp +++ b/src/passes/GlobalRefining.cpp @@ -32,6 +32,9 @@ namespace { struct GlobalRefining : public Pass { void run(PassRunner* runner, Module* module) override { + if (!module->features.hasGC()) { + return; + } if (getTypeSystem() != TypeSystem::Nominal) { Fatal() << "GlobalRefining requires nominal typing"; } |