-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Canonicalize types earlier in validation (#1299)
* Canonicalize types earlier in validation This commit refactors the internals of validation to centralize canonicalization in one location. This means that stages such as operator validation no longer need to perform canonicalization. Additionally types are always stored in their canonical forms. The refactoring here is done when a `RecGroup` is inserted into a `TypeList`. The rec-group-local offsets are used to intern the group but when actually adding to a `TypeList` all rec-group-local offsets are updated to an ID-based form. This is then plumbed in many other locations as well by changing many `t: ValType` validators to `t: &mut ValType` to internally canonicalize. This is originally motivated by trying to update Wasmtime to the latest `wasmparser` but many APIs which previously returned `&FuncType` for example returned `FuncType` instead due to the canonicalization-on-the-fly. This change means that the old `&FuncType`-style APIs can return because types are always canonicalized at-rest. This change additionally changes the behavior of one test. It was previously considered valid and is now considered valid. I've confirmed that `wasm-opt` considers the test invalid, so I've updated the test to `assert_invalid` instead. * Fix test compile * Remove unused arguments * Review comments
- Loading branch information
1 parent
acee342
commit 230ce7f
Showing
14 changed files
with
429 additions
and
585 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.