diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2021-02-24 18:57:30 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-24 18:57:30 -0800 |
commit | d1d631d5f354ef3470c15003118d1c750b557fe2 (patch) | |
tree | c7bff357069abbebd516425ba347c968469dac9e /src/parsing.h | |
parent | 95ccf32f3e74bf52d9db161cffc27637f3957820 (diff) | |
download | binaryen-d1d631d5f354ef3470c15003118d1c750b557fe2.tar.gz binaryen-d1d631d5f354ef3470c15003118d1c750b557fe2.tar.bz2 binaryen-d1d631d5f354ef3470c15003118d1c750b557fe2.zip |
Support building recursive types (#3602)
Updates TypeBuilder to support recursive types. Recursive types are particularly
problematic because under the current scheme it is necessary to canonicalize the
uses of a type's immediate children before canonicalizing the type itself to
avoid leaking non-canonical, temporary types out of the TypeBuilder and into the
global type stores. In the case of recursive types, it is not possible to do
this because of their cyclic nature. In principle this could be overcome by
hashing recursive types based on their structure rather than their contents, but
that would be complicated. Instead, this PR takes the shortcut of not
canonicalizing self-referential HeapTypes at all, but rather moving them out of the
TypeBuilder and into the global type store without changing their addresses or
needing to update any of their use sites. This breaks all cycles and makes it
possible to canonicalize the other types correctly.
Note that this PR only adds support for building recursive types. Doing almost
anything with the types, such as printing, comparing, or emitting them will
certainly lead to infinite recursions. A follow up PR will update all these
operations to work correctly with recursive types.
Diffstat (limited to 'src/parsing.h')
0 files changed, 0 insertions, 0 deletions