Skip to content

TypeRefiningGUFA: Avoid bottom continuation casts#8513

Merged
kripken merged 4 commits intoWebAssembly:mainfrom
kripken:trg.fix
Mar 24, 2026
Merged

TypeRefiningGUFA: Avoid bottom continuation casts#8513
kripken merged 4 commits intoWebAssembly:mainfrom
kripken:trg.fix

Conversation

@kripken
Copy link
Copy Markdown
Member

@kripken kripken commented Mar 23, 2026

The pass already checked isContinuation and did not refine a field to
such a type, if we know we need a cast to fix things up (we can't do it
in such cases, as the type can't be cast). However, we did not handle
a cast to the bottom type nullcontref.

Avoid a cast there by emitting a null. That is, before we did

(ref.cast nullcontref
  VALUE
)

and now we do

(block
  (drop (VALUE))
  (ref.null)
)

The null has the right type for where we are writing.

For a non-nullable bottom type, emit an unreachable.

As a drive by, remove

updater.runOnModuleCode(getPassRunner(), &wasm);

That code cannot work in module code anyhow (it emits casts,
blocks, drops, etc.).

@kripken kripken requested a review from tlively March 23, 2026 23:45
@kripken kripken requested a review from a team as a code owner March 23, 2026 23:45
@kripken
Copy link
Copy Markdown
Member Author

kripken commented Mar 23, 2026

Diff on tests is smaller without whitespace.

@kripken kripken merged commit 2165afc into WebAssembly:main Mar 24, 2026
16 checks passed
@kripken kripken deleted the trg.fix branch March 24, 2026 18:11
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