WitBindgen.jl - Julia Bridge for WASI/WASM

Bringing first class WASI component interoperability to Julia through compiler level WIT binding generation.

Description

Overview

WitBindgen.jl brings first-class WIT (WebAssembly Interface Types) and WASI Component Model support to Julia. The project enables Julia programs to both consume and export WIT-defined interfaces, allowing safe, structured interoperability with WebAssembly components.

The primary technical challenge addressed by this project is correct interoperability between:

  • Julia’s precise, moving, generational garbage collector

  • WebAssembly GC (currently experimental and non-moving)

This project does not disable Julia’s GC, does not fall back to raw pointers, and does not pin memory permanently. Instead, it introduces a structured runtime bridge that composes both collectors safely.


Problem Statement

WebAssembly is evolving into a typed component ecosystem through WIT interface definitions, the WASI Component Model, and the introduction of WASM GC for managed objects. Together, these enable structured, language-agnostic interoperability between runtimes.

Julia does not currently integrate with this ecosystem. There is no native WIT parsing or binding generation, no ABI-compliant lowering for the WASI Component Model, and no safe interoperability layer for WASM GC. The most significant barrier among these is garbage collection interoperability.

Julia uses a precise, moving, generational, compacting garbage collector. WASM GC, in its current proposal, is non-moving and assumes stable object identity. These fundamentally different assumptions create a deep runtime conflict.

The incompatibilities arise from three critical facts:

  • Julia moves objects during compaction.

  • WASM expects object references to remain stable.

  • Neither garbage collector has visibility into the other’s root set.

As soon as objects cross the runtime boundary, correctness becomes fragile. A moved object can invalidate external references, while missing root registration can cause premature collection.

Most language implementations avoid solving this directly. They disable compaction, pin memory permanently, or expose raw pointers at the boundary. For example, OCaml targeting WASM GC commonly relies on raw pointer exposure instead of preserving full moving-GC semantics. These approaches reduce performance, weaken safety guarantees, or introduce long-term memory inefficiencies.

The core systems problem is therefore not just interface generation or ABI compliance. It is this:

How can two independent garbage collectors interoperate across a runtime boundary while preserving object identity, safety, and performance?


Solution

WitBindgen.jl solves the full stack problem:

  1. WIT parsing and IR generation

  2. Binding generation for Julia

  3. ABI compliant lowering to WASI Component Model

  4. Cross GC runtime bridge using root stable indirection

The garbage collector interoperability layer is the core innovation.


Impact

Enables:

  • Julia in WASI component ecosystems

  • Safe polyglot WebAssembly systems

  • Julia-based edge compute modules

  • Research in multi GC composition

  • Infrastructure level FOSS advancement

This is not an application-layer tool.

It extends Julia’s runtime and compiler stack to participate fully in the WebAssembly Component Model while solving one of the hardest systems problems: cross-garbage-collector interoperability.

Issues & Pull Requests Thread
No issues or pull requests added.