diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2022-07-26 13:53:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-26 13:53:03 -0700 |
commit | f7203a02ae85fff2075ead73246c15ab1dbe8640 (patch) | |
tree | 68ab65a6fccaa1f6c1f4730dfa90c4f375d1a5ee /src/passes/SignatureRefining.cpp | |
parent | 4387c730386a462b043aa3ca8a7b01e17e44a88b (diff) | |
download | binaryen-f7203a02ae85fff2075ead73246c15ab1dbe8640.tar.gz binaryen-f7203a02ae85fff2075ead73246c15ab1dbe8640.tar.bz2 binaryen-f7203a02ae85fff2075ead73246c15ab1dbe8640.zip |
Make `GlobalTypeRewriter` work for isorecursive types (#4829)
There are two new potential problems that `GlobalTypeRewriter` can run into when
working with isorecursive types instead of nominal types. First, the refined
types may have replaced generic references with references to specific other
types, potentially creating new recursions and making the existing recursion
groups insufficient. Second, distinct types may be refined to structurally
identical types and those distinct input types may map the same output type,
potentially changing cast behavior.
Both of these problems are solved by putting all the new types in a single large
recursion group.
We do not currently account for the fact that types may be used in the external
interface of the module, but when we do, externalized types will be excluded
from optimizations and will not be affected by the creation of this single large
rec group.
Fixes #4816.
Diffstat (limited to 'src/passes/SignatureRefining.cpp')
-rw-r--r-- | src/passes/SignatureRefining.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/passes/SignatureRefining.cpp b/src/passes/SignatureRefining.cpp index 8a8c45872..11df83f4d 100644 --- a/src/passes/SignatureRefining.cpp +++ b/src/passes/SignatureRefining.cpp @@ -51,8 +51,9 @@ struct SignatureRefining : public Pass { if (!module->features.hasGC()) { return; } - if (getTypeSystem() != TypeSystem::Nominal) { - Fatal() << "SignatureRefining requires nominal typing"; + if (getTypeSystem() != TypeSystem::Nominal && + getTypeSystem() != TypeSystem::Isorecursive) { + Fatal() << "SignatureRefining requires nominal/hybrid typing"; } if (!module->tables.empty()) { |