Skip to content
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

Heap2Local: Properly handle failing array casts #6772

Merged
merged 6 commits into from
Jul 18, 2024

Conversation

kripken
Copy link
Member

@kripken kripken commented Jul 18, 2024

Followup to #6727 which added support for failing casts in Struct2Local, but it
turns out that it required Array2Struct changes as well. Specifically, when we
turn an array into a struct then casts can look like they behave differently
(what used to be an array input, becomes a struct), so like with RefTest that we
already handled, check if the cast succeeds in the original form and handle
that.

Found by the fuzzer.

@kripken kripken requested a review from tlively July 18, 2024 17:55
@@ -1050,6 +1062,30 @@ struct Array2Struct : PostWalker<Array2Struct> {
builder.makeConst(Literal(result))));
}

void visitRefCast(RefCast* curr) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the comment saying "this is not a problem for ref.cast" above need to be edited?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixed.

The cast does go away when we optimize, but now that we allow casts to fail, we do need to know if it fails or not...

@kripken kripken merged commit a8066e6 into WebAssembly:main Jul 18, 2024
13 checks passed
@kripken kripken deleted the heap2local.array.cast.struct branch July 18, 2024 21:46
@gkdn gkdn mentioned this pull request Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants