https://github.com/pulseengine/meld
Meld — Static WebAssembly component fusion. Part of the PulseEngine toolchain.
https://github.com/pulseengine/meld
component-model formal-verification fusion pulseengine rust webassembly
Last synced: about 2 months ago
JSON representation
Meld — Static WebAssembly component fusion. Part of the PulseEngine toolchain.
- Host: GitHub
- URL: https://github.com/pulseengine/meld
- Owner: pulseengine
- License: apache-2.0
- Created: 2026-02-04T04:09:56.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-04-27T19:45:48.000Z (about 2 months ago)
- Last Synced: 2026-04-27T21:22:40.404Z (about 2 months ago)
- Topics: component-model, formal-verification, fusion, pulseengine, rust, webassembly
- Language: Rust
- Size: 80.3 MB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# Meld
Static WebAssembly component fusion
[](https://github.com/pulseengine/meld/actions/workflows/ci.yml)





Meld
·
Loom
·
Synth
·
Kiln
·
Sigil
Meld fuses. Loom weaves. Synth transpiles. Kiln fires. Sigil seals.
Meld statically fuses multiple WebAssembly components into a single core module, eliminating the need for runtime linking. Import resolution, index-space merging, and canonical ABI adapter generation happen at build time. Every transformation carries mechanized proofs covering parsing, resolution, merging, and adapter correctness.
Unlike composition tools that produce linked-but-separate component graphs, Meld produces a single monolithic module suitable for whole-program optimization by Loom and native transpilation by Synth.
## Quick Start
```bash
# From source (Cargo)
cargo install --path meld-cli
# From source (Bazel)
bazel build //meld-cli:meld
# Fuse two components
meld fuse component_a.wasm component_b.wasm -o fused.wasm
```
### Full Pipeline
```bash
# 1. Build components
cargo component build --release
# 2. Fuse into single module
meld fuse composed.wasm -o fused.wasm
# 3. Optimize with Loom
loom optimize fused.wasm -o optimized.wasm
# 4. Run
wasmtime run optimized.wasm
```
### Bazel Integration
```starlark
load("@meld//rules:meld.bzl", "meld_fuse")
meld_fuse(
name = "my_app",
components = [
":component_a",
":component_b",
],
)
```
## How It Works
1. **Parse** — Extract core modules and type information from components
2. **Resolve** — Build import/export graph, identify cross-component calls
3. **Merge** — Combine function/memory/table/global index spaces
4. **Adapt** — Generate Canonical ABI trampolines for cross-component calls
5. **Encode** — Output single core WebAssembly module
### Adapter Generation
Cross-component calls may require adapters that handle string transcoding (UTF-8, UTF-16, Latin-1), memory copying between component memories, list/array serialization, and resource handle transfer. Meld generates these adapters using techniques inspired by Wasmtime's FACT (Fused Adapter Compiler of Trampolines).
## Memory Strategies
### Multi-Memory (Default)
Each component retains its own linear memory. Cross-component calls use adapters that allocate in the callee's memory via `cabi_realloc` and copy data with `memory.copy`. Requires multi-memory support (WebAssembly Core Spec 3.0).
```bash
meld fuse a.wasm b.wasm -o fused.wasm
```
### Shared Memory (Legacy)
All components share a single linear memory. Simpler but one component's `memory.grow` corrupts every other component's address space.
```bash
meld fuse --memory shared a.wasm b.wasm -o fused.wasm
```
## Supply Chain Security
Meld integrates with [Sigil](https://github.com/pulseengine/sigil) for supply chain attestation. Each fusion operation records input component hashes, tool version and configuration, and transformation metadata. The attestation is embedded in the output module's custom section.
## Formal Verification
Meld's core transformations are formally verified using Rocq. The proofs establish that fusion preserves program semantics — the fused module behaves identically to the original composed components.
Key verified properties:
- **Merge correctness** — Index remapping preserves function/memory/table references
- **Resolve correctness** — Topological sort produces valid instantiation order; cycle detection terminates
- **Adapter correctness** — Generated trampolines preserve call semantics
- **Forward simulation** — Fused module simulates the original component graph step-by-step
Proofs are built via Bazel using [`rules_rocq_rust`](https://github.com/pulseengine/rules_rocq_rust):
```bash
bazel build //proofs/transformations/merge:merge_spec
bazel build //proofs/spec:fusion_spec
```
See [`proofs/`](proofs/) for the full proof tree and [`PROOF_GUIDE.md`](proofs/PROOF_GUIDE.md) for an introduction.
> [!NOTE]
> **Cross-cutting verification** — Rocq mechanized proofs, Kani bounded model checking, Z3 SMT verification, and Verus Rust verification are used across the PulseEngine toolchain. Sigil attestation chains bind it all together.
## Limitations
- **Resources** — Resource handle transfer across components is limited
- **Async** — Async component functions not yet supported
- **String transcoding** — UTF-8/UTF-16 and Latin-1/UTF-8 are implemented; UTF-8/Latin-1 is not yet supported
## Development
```bash
cargo build # Build
cargo test # Test
bazel build //... # Bazel build
RUST_LOG=debug cargo run -- fuse a.wasm b.wasm -o out.wasm
```
## License
Apache-2.0
---
Part of PulseEngine — formally verified WebAssembly toolchain for safety-critical systems