[CustomDescriptors] Ensure a non-nullable type for ref.cast_desc_eq on null - #8975
Open
kripken wants to merge 2 commits into
Open
[CustomDescriptors] Ensure a non-nullable type for ref.cast_desc_eq on null#8975kripken wants to merge 2 commits into
kripken wants to merge 2 commits into
Conversation
tlively
reviewed
Aug 7, 2026
tlively
left a comment
Member
There was a problem hiding this comment.
Should update the title to say br_on_cast_desc_eq rather than ref.cast_desc_eq.
Comment on lines
+9
to
+15
| (type $0 (sub (descriptor $2) (struct))) | ||
| ;; CHECK: (type $1 (sub $0 (descriptor $3) (struct))) | ||
| (type $1 (sub $0 (descriptor $3) (struct))) | ||
| ;; CHECK: (type $2 (sub (describes $0) (struct))) | ||
| (type $2 (sub (describes $0) (struct))) | ||
| ;; CHECK: (type $3 (sub $2 (describes $1) (struct (field i32)))) | ||
| (type $3 (sub $2 (describes $1) (struct (field i32)))) |
Member
There was a problem hiding this comment.
Can we use any in the test instead of defining any types?
Comment on lines
+64
to
+69
| (local.set $2 | ||
| (br_on_cast_desc_eq $block (ref null $1) (ref null $1) | ||
| (ref.null $1) | ||
| (local.get $1) | ||
| ) | ||
| ) |
Member
There was a problem hiding this comment.
The test says we can refine local $2 and therefore the br_on_cast_desc_eq must be refinalized to the correct type. But isn't that backward and self-justifying? Without the change to finalization, we should not be trying to refine local $2 in the first place. If this refinement is a new optimization, that's one thing, but I don't see how the change can be a correct bug fix.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If the desc is null, the cast is not even executed, making it unreachable.
We typed it as nullable if the ref was (in the code path
type = ref->type;),but emiting an uninhabitable type is more precise, and also avoids a fuzz
bug (see new test) where refinalize actually un-refined a type: it turned it
from non-nullable to nullable.