diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2021-04-29 00:58:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-29 07:58:07 +0000 |
commit | 2785d936639c62d08eb836a775838a37033127b4 (patch) | |
tree | d10ec96842d160a1f0a4ee0b4cb1700e28be9fe5 /test/example/cpp-unit.cpp | |
parent | 8266211ec8dac694a14081cf03248f4c1ac5e016 (diff) | |
download | binaryen-2785d936639c62d08eb836a775838a37033127b4.tar.gz binaryen-2785d936639c62d08eb836a775838a37033127b4.tar.bz2 binaryen-2785d936639c62d08eb836a775838a37033127b4.zip |
Generic type traversal and fix a LUB bug (#3844)
Fixes #3843.
The issue was that during LUB type building, Hopcroft's algorithm was only
running on the temporary HeapTypes in the TypeBuilder and not considering the
globally canonical HeapTypes that were reachable from the temporary HeapTypes.
That meant that temporary HeapTypes that referred to and were equirecursively
equivalent to the globally canonical types were not properly minimized and could
not be matched to the corresponding globally canonical HeapTypes.
The fix is to run Hopcroft's algorithm on the complete HeapType graph, not just
the root HeapTypes. Since there were already multiple implementations of type
graph traversal, this PR consolidates them into a generic type traversal
utility. Although this creates more boilerplate, it also reduces code
duplication and will be easier to maintain and reuse.
Now that Hopcroft's algorithm partitions can contain globally canonical
HeapTypes, this PR also updates the `translateToTypes` step of shape
canonicalization to reuse the globally canonical types unchanged, since they
must already be minimal. Without this change, `translateToTypes` could end up
incorrectly inserting temporary HeapTypes into the globally canonical type
graph. Unfortunately, this change complicates the interface presented by
`ShapeCanonicalizer` because it no longer owns the HeapTypeInfos backing all of
the minimized types. Fixing this is left as future work.
Diffstat (limited to 'test/example/cpp-unit.cpp')
0 files changed, 0 insertions, 0 deletions