Skip to content

Conversation

@tlively
Copy link
Member

@tlively tlively commented Apr 23, 2025

Treat exactness as part of the heap type and prefer to refine it over
refining nullability. This is a somewhat arbitrary choice, and as shown
by the tests, it is possible to construct a situation in which
preferring to refine nullability would be preferable.

tlively added 2 commits April 23, 2025 14:43
Split the automatically generated optimize-instructions-all-casts.wast
into two tests: one that tests casts to exact types and another that
tests casts to inexact types. For the test file that does not cast to
exact types, additionally test with custom descriptors disabled to
ensure that the results validate.
Treat exactness as part of the heap type and prefer to refine it over
refining nullability. This is a somewhat arbitrary choice, and as shown
by the tests, it is possible to construct a situation in which
preferring to refine nullability would be preferable.
@tlively tlively requested a review from kripken April 23, 2025 22:40

(module
;; CHECK: (type $super (sub (struct)))
(type $super (sub (struct)))
Copy link
Member

Choose a reason for hiding this comment

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

As there is no sub, perhaps this could be called struct?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll use $foo since it doesn't matter that it's a struct in particular, either.

;; hoist it to eliminate the cast.
(ref.cast (ref $super)
(local.tee 1
(local.get 0)
Copy link
Member

Choose a reason for hiding this comment

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

Might be clearer to use var names here. And if the param name were $exact (to contrast with the local $inexact or just $struct) then readability would be even better imo

Base automatically changed from split-all-casts to main April 23, 2025 23:00
@tlively tlively merged commit ce2abc2 into main Apr 24, 2025
14 checks passed
@tlively tlively deleted the exact-fallthrough branch April 24, 2025 01:48
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.

3 participants