-
Notifications
You must be signed in to change notification settings - Fork 745
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
[Strings] Work around ref.cast not working on string views, and add fuzzing #6549
Conversation
heapType == HeapType::stringview_iter) { | ||
// We cannot cast string views to/from anything, so the input must also | ||
// be a view. | ||
assert(curr->ref->type.getHeapType() == heapType); |
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.
I don't think this will handle casts to bottom correctly. If a string view is cast to (ref none)
, we should just emit (unreachable)
because that cast cannot possibly succeed. If a string view is cast to (ref null none)
, I haven't thought of anything better than emitting (ref.is_null) (if (result nullref) (then (ref.null none)) (else (unreachable))
.
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.
This isn't comprehensive atm, I guess, yeah, but it should handle all the things the fuzzer and the optimizer emit. I'm not sure if it's worth handling more things.
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 this isn't the only problem we have in principle that we don't run into in practice. And hopefully we will be able to remove the view types soon either way.
As suggested in #6434 (comment) , lower
ref.cast
of string viewsto
ref.as_non_null
in binary writing. It is a simple hack that avoids theproblem of V8 not allowing them to be cast.
Add fuzzing support for the last three core string operations, after which
that problem becomes very frequent.
Also add yet another
makeTrappingRefUse
that was missing in thatfuzzer code.