-
Notifications
You must be signed in to change notification settings - Fork 793
Do not emit recursion groups without GC enabled #4738
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,20 @@ | ||||||
;; Write the module with --nominal but without GC | ||||||
;; RUN: wasm-opt %s --nominal --disable-gc -g -o %t.wasm | ||||||
|
||||||
;; We should not get any recursion groups even though we used --nominal. We use | ||||||
;; --hybrid -all here to make sure that any rec groups from the binary will | ||||||
;; actually show up in the output and cause the test to fail. | ||||||
;; RUN: wasm-opt %t.wasm --hybrid -all -S -o - | filecheck %s | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think it's better to test non-hybrid, and without There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, but it errors if rec groups are present but gc is disabled - that's the original error that led to this PR? I just want to make sure we have testing for that specifically. How about testing both paths? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIUC, It's wasm2c that errors in the presence of recursion groups, not binaryen. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Binaryen errors too: (module
(func $foo)
)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I added another run line that tests that we don't get a failure loading the module with the default flags. |
||||||
|
||||||
;; Also check that we don't get a failure with the default configuration. | ||||||
;; RUN: wasm-opt %t.wasm | ||||||
|
||||||
;; CHECK-NOT: rec | ||||||
|
||||||
(module | ||||||
(type $foo (func)) | ||||||
(type $bar (func)) | ||||||
|
||||||
(func $f1 (type $foo)) | ||||||
(func $f2 (type $bar)) | ||||||
) |
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.
Don't you need to do something to avoid new line 265 from being reached? Or is that handled by
getRecGroup
always returning the same?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.
For
--nominal
, it all works out because the rec groups all have size 1. For--hybrid
it all works because the MVP function types will also have rec group size 1, unless the input had rec groups. I don't think we have any validation that rec groups are only allowed when GC is enabled, but that seems like a separate problem.