-
Notifications
You must be signed in to change notification settings - Fork 873
Parsing and emitting of exact types #7342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. | ||
|
|
||
| ;; RUN: wasm-opt %s -all -o %t.text.wast -g -S | ||
| ;; RUN: wasm-as %s -all -g -o %t.wasm | ||
| ;; RUN: wasm-dis %t.wasm -all -o %t.bin.wast | ||
| ;; RUN: wasm-as %s -all -o %t.nodebug.wasm | ||
| ;; RUN: wasm-dis %t.nodebug.wasm -all -o %t.bin.nodebug.wast | ||
| ;; RUN: cat %t.text.wast | filecheck %s --check-prefix=CHECK-TEXT | ||
| ;; RUN: cat %t.bin.wast | filecheck %s --check-prefix=CHECK-BIN | ||
| ;; RUN: cat %t.bin.nodebug.wast | filecheck %s --check-prefix=CHECK-BIN-NODEBUG | ||
|
|
||
| ;; Also check that if we emit a binary without custom descriptors enabled, the | ||
| ;; types are generalized to be inexact. | ||
|
|
||
| ;; RUN: wasm-opt %s -all --disable-custom-descriptors -g -o - | wasm-opt -all -S -o - \ | ||
| ;; RUN: | filecheck %s --check-prefix=NO-EXACT | ||
|
|
||
| (module | ||
| ;; CHECK-TEXT: (type $foo (struct (field (exact anyref)) (field (ref exact any)) (field (ref null exact $foo)) (field (ref exact $foo)))) | ||
| ;; CHECK-BIN: (type $foo (struct (field (exact anyref)) (field (ref exact any)) (field (ref null exact $foo)) (field (ref exact $foo)))) | ||
| ;; NO-EXACT: (type $foo (struct (field anyref) (field (ref any)) (field (ref null $foo)) (field (ref $foo)))) | ||
| (type $foo (struct (field (exact anyref) (ref exact any) (ref null exact $foo) (ref exact $foo)))) | ||
|
|
||
|
|
||
| ;; CHECK-TEXT: (import "" "g1" (global $g1 (exact anyref))) | ||
| ;; CHECK-BIN: (import "" "g1" (global $g1 (exact anyref))) | ||
| ;; NO-EXACT: (import "" "g1" (global $g1 anyref)) | ||
| (import "" "g1" (global $g1 (exact anyref))) | ||
|
|
||
| ;; CHECK-TEXT: (import "" "g2" (global $g2 (ref exact any))) | ||
| ;; CHECK-BIN: (import "" "g2" (global $g2 (ref exact any))) | ||
| ;; NO-EXACT: (import "" "g2" (global $g2 (ref any))) | ||
| (import "" "g2" (global $g2 (ref exact any))) | ||
|
|
||
| ;; CHECK-TEXT: (import "" "g3" (global $g3 (ref null exact $foo))) | ||
| ;; CHECK-BIN: (import "" "g3" (global $g3 (ref null exact $foo))) | ||
| ;; NO-EXACT: (import "" "g3" (global $g3 (ref null $foo))) | ||
| (import "" "g3" (global $g3 (ref null exact $foo))) | ||
|
|
||
| ;; CHECK-TEXT: (import "" "g4" (global $g4 (ref exact $foo))) | ||
| ;; CHECK-BIN: (import "" "g4" (global $g4 (ref exact $foo))) | ||
| ;; NO-EXACT: (import "" "g4" (global $g4 (ref $foo))) | ||
| (import "" "g4" (global $g4 (ref exact $foo))) | ||
| ) | ||
| ;; CHECK-BIN-NODEBUG: (type $0 (struct (field (exact anyref)) (field (ref exact any)) (field (ref null exact $0)) (field (ref exact $0)))) | ||
|
|
||
| ;; CHECK-BIN-NODEBUG: (import "" "g1" (global $gimport$0 (exact anyref))) | ||
|
|
||
| ;; CHECK-BIN-NODEBUG: (import "" "g2" (global $gimport$1 (ref exact any))) | ||
|
|
||
| ;; CHECK-BIN-NODEBUG: (import "" "g3" (global $gimport$2 (ref null exact $0))) | ||
|
|
||
| ;; CHECK-BIN-NODEBUG: (import "" "g4" (global $gimport$3 (ref exact $0))) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where below do we need this line for? (1579 makes sense to me, but 1580 I don't see yet)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(lgtm % this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it's not necessary in the current code, but if we refactored the code below to check equality with specific reference types, for example, it would be important that we ignore exactness from this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, I guess it's safer for the future.