diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2021-03-23 20:44:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-23 20:44:42 -0700 |
commit | 6aa04fa17a5bf820c8bc3a7801ede7f57a9138e7 (patch) | |
tree | aa9856d3c2ca2ce3a20bdb97b69066e05520ade3 /src/ir/literal-utils.h | |
parent | f2abcbc8d1659d3e6506b1d4128646b892ebc218 (diff) | |
download | binaryen-6aa04fa17a5bf820c8bc3a7801ede7f57a9138e7.tar.gz binaryen-6aa04fa17a5bf820c8bc3a7801ede7f57a9138e7.tar.bz2 binaryen-6aa04fa17a5bf820c8bc3a7801ede7f57a9138e7.zip |
Equirecursive type canonicalization (#3717)
* Equirecursive type canonicalization
Use Hopcroft's DFA minimization algorithm to properly canonicalize and
deduplicate recursive types. Type canonicalization has two stages:
1. Shape canonicalization
- The top-level structure of HeapTypes is used to split the declared HeapTypes
into their initial partitions.
- Hopcroft's algorithm refines the partitions such that all pairs of
distinguishable types end up in different partitions.
- A fresh HeapTypeInfo is created for each final partition. Each new
HeapTypeInfo is linked to other new HeapTypeInfos to create a minimal type
definition graph that defines the same types as the original graph.
2. Global canonicalization
- Each new minimal HeapTypeInfo that does not have the same finite
shape as an existing globally canonical HeapTypeInfo is moved to the
global heap type store to become the new canonical HeapTypeInfo.
- Each temporary Type referenced by the newly canonical HeapTypeInfos is
replaced in-place with the equivalent canonical Type to avoid leaking
temporary Types into the global stores.
Diffstat (limited to 'src/ir/literal-utils.h')
0 files changed, 0 insertions, 0 deletions