summaryrefslogtreecommitdiff
path: root/src/js/binaryen.js-extern-post.js
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2021-02-24 18:57:30 -0800
committerGitHub <noreply@github.com>2021-02-24 18:57:30 -0800
commitd1d631d5f354ef3470c15003118d1c750b557fe2 (patch)
treec7bff357069abbebd516425ba347c968469dac9e /src/js/binaryen.js-extern-post.js
parent95ccf32f3e74bf52d9db161cffc27637f3957820 (diff)
downloadbinaryen-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/js/binaryen.js-extern-post.js')
0 files changed, 0 insertions, 0 deletions