GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add a pass to relax nullabilities of definitions · Issue #9352 · WebAssembly/binaryen

Add a pass to relax nullabilities of definitions #9352

New issue
Copy link
New issue
Copy link
Open
Open
Add a pass to relax nullabilities of definitions#9352
Copy link
Assignees
stevenfontanella
Labels
enhancement

Description

@stevenfontanella
stevenfontanella
opened on Nov 5, 2026
Issue body actions

As a form of generalization, we can make all definitions nullable (e.g. globals, locals, function params, struct fields, arrays, tags), and insert ref.as_non_null as needed for cases that can't be relaxed (e.g. imported/exported functions, public structs). This transformation is valid since it only introduces ref.as_non_nulls that are no-ops.

The benefits of this are:

  • When --traps-never-happen is enabled, it allows us to remove the majority of ref.as_non_null instructions with --strip-refining-casts
  • It exposes more opportunities for locals to share a declaration group
  • It also exposes more opportunities for type merging by causing more function and struct types to be identical

TypeGeneralizing (which is WIP) may also relax nullability, however it would never 'overgeneralize' and allow something to be nullable that would require inserting ref.as_non_null. So this pass may still be useful even alongside TypeGeneralizing.

In a prototype of this pass, I found that this pass reduces the size of a Google Wasm binary by ~3 percent (both in gzipped and uncompressed size).


Implementation plan:

  • RelaxNullability for locals and params (Add RelaxNullability pass #9349)
  • Relax function bodies when params can't otherwise be relaxed (e.g. exported functions or referenced functions that may escape) (Relax function locals when a function's signature can't be changed #9380)
  • Relax private struct/array fields
  • Relax private functions even if they may be called indirectly
  • Handle multi-value returns
  • Double-check if relaxing return values is worth it

Activity

  1. stevenfontanella
    self-assigned this
    on Nov 5, 2026
  2. tlively
    added
    enhancement
    on Nov 8, 2026
  3. stevenfontanella
    added 3 commits that reference this issue on Nov 11, 2026

    Add RelaxNullability pass (#9349)

    3232a5d

    Fuzz relax nullability pass (#9353)

    0c9067a

    Relax function locals when a function's signature can't be changed (#…

    d39a969
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @stevenfontanella
    stevenfontanella

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.