Skip to content
This repository was archived by the owner on Aug 12, 2026. It is now read-only.

Commit 440e9a0

Browse files
committed
Survey S1's premise before entering it: a JVM can reach a component
0007 is what happens when a stage is entered on an unchecked premise, so entering S1 starts with checking the one 0005 assumes -- a JVM reaching Wasm through FFM and wasmtime. It holds, and the margin is narrower than it looked. Search said the wasmtime C API had no component model support and pointed at an open issue; the issue is closed, and the shared library the flake pins tells the real story: wasmtime 40.0.2 0 exported wasmtime_component_* symbols wasmtime 43.0.1 138 wasmtime 45.0.0 154 wasmtime 47.0.1 154 Counted from the dylibs in the nix store rather than read from release notes -- the survey skill's own warning is that negative claims rot fastest, and this was one. tools.json already requires >=43.0.0, set months ago for WASI 0.3. That is also the first version with a component C API. The coincidence is load-bearing and 0005 now says not to lower it. From the JVM, java.lang.foreign resolves wasmtime_component_new, _linker_new, _linker_instantiate, _instance_get_func and _func_call out of that library on Java 25. So the path exists end to end. What it does not show is a value crossing it, which is S1's first unit rather than a survey probe -- recorded as such. Two things the survey surfaced that S1 has to answer rather than assume: - Locating libwasmtime needed an absolute nix store path, and CLAUDE.md forbids machine-specific paths in committed files. How cljwit.host finds the library is an open design question, not a detail. - Endive -- a Bytecode Alliance-hosted fork of Chicory adding a Cranelift backend -- targets full Component Model support on the JVM with *no native dependency*. It does not have it yet (Cranelift and WasmGC first) and Chicory itself has no component model at all. So the native path is the only one today and a pure-JVM one is plausibly coming, which matters for cljwit.host's deployment story. Re-check at S1's design. wasmtime is now in refs.json (large, opt-in) since its C API is what S1 binds to. Claude-Session: https://claude.ai/code/session_01XF5Hfq4Ca2N2XYEzWQQuHt
1 parent 3004127 commit 440e9a0

3 files changed

Lines changed: 58 additions & 2 deletions

File tree

‎doc/design/0005-implementation-language.md‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,51 @@ expand Clojure source. Any other host reimplements macroexpansion.
5252
requires the compiler to exist before the compiler exists. Revisit once S3
5353
can compile the analyzer.
5454

55+
## The S1 host path, surveyed 2026-07-30
56+
57+
This note assumes a JVM reaching Wasm through FFM and wasmtime. Entering S1
58+
means checking that, because `0007` is what happens when a stage is entered on
59+
an unchecked premise.
60+
61+
**It holds, and the margin is narrower than it looks.** wasmtime's C API gained
62+
the component model between v40 and v43 — measured by counting exported symbols
63+
in the shared library the flake pins, not by reading release notes:
64+
65+
| wasmtime | `wasmtime_component_*` exported |
66+
|---|---|
67+
| 40.0.2 | **0** |
68+
| 43.0.1 | 138 |
69+
| 45.0.0 | 154 |
70+
| 47.0.1 | 154 |
71+
72+
`tools.json` already requires ≥ 43.0.0, set for WASI 0.3 — the same version
73+
that first ships the component C API. That coincidence is load-bearing and
74+
should not be lowered.
75+
76+
From the JVM, `java.lang.foreign.SymbolLookup` on Java 25 resolves
77+
`wasmtime_component_new`, `_linker_new`, `_linker_instantiate`,
78+
`_instance_get_func` and `_func_call` out of that library. So the path exists
79+
end to end; what it does *not* yet show is a value crossing it, which is S1's
80+
first unit rather than a survey probe.
81+
82+
**One constraint surfaced that S1 has to answer:** finding
83+
`libwasmtime.dylib` needed an absolute store path, and `.claude/CLAUDE.md`
84+
forbids machine-specific paths in anything committed. How `cljwit.host` locates
85+
the library — bundled, `pkg-config`, an env var, a documented convention — is
86+
an open S1 design question, not a detail.
87+
88+
**The alternative worth watching: [Endive].** A Bytecode Alliance–hosted fork of
89+
[Chicory] (a pure-Java Wasm runtime) that adds a Cranelift backend and targets
90+
full Component Model support on the JVM **with no native dependency**. It does
91+
not have the component model yet — Cranelift and WasmGC come first — and
92+
Chicory itself lists GC on its 2026 roadmap with no component model at all. So
93+
today the native path is the only one, and a pure-JVM path is plausibly coming.
94+
That matters for `cljwit.host`'s deployment story and should be re-checked at
95+
S1's design, not assumed either way.
96+
97+
[Endive]: https://bytecodealliance.org/articles/endive-and-the-next-chapter-of-webassembly-on-the-jvm
98+
[Chicory]: https://github.com/dylibso/chicory
99+
55100
## Consequences
56101

57102
- Development requires a JVM; deployment does not. This must be stated plainly

‎doc/status.md‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,27 @@
33
_Short by design, and printed at every session start — so findings live in
44
`doc/design/`, plans in `doc/roadmap.md`, and only the present tense here._
55

6-
**Updated:** 2026-07-29 · **Phase:** feasibility (pre-alpha, no compiler)
6+
**Updated:** 2026-07-30 · **Phase:** S0 closed, entering S1 (pre-alpha, no compiler)
77

88
## Next
99

10+
**S1's premise is checked** (`0005`, surveyed 2026-07-30): wasmtime's C API
11+
gained the component model between v40 and v43 — 0 exported
12+
`wasmtime_component_*` symbols at 40.0.2, 154 at the pinned 47.0.1 — and the
13+
JVM resolves them through `java.lang.foreign` on Java 25. `tools.json`'s ≥43
14+
minimum, set for WASI 0.3, is also the component minimum; do not lower it.
15+
1016
1. **Record a B6 prediction in `doc/design/0002-*` before writing any of it.**
1117
B6 has no row in that table yet, and the table is the discipline.
1218
2. **B6 — the component boundary crossing.** A GC-to-linear-memory copy per
1319
aggregate argument (`doc/design/0007-*`), which is what "a Rust developer
1420
calls a Clojure component" actually costs, and which no S0 benchmark
1521
touches. `doc/roadmap.md` places it at the head of S1.
16-
3. **Firm up V8's crossover**, the one soft figure left. wasmtime's is now
22+
3. **Get a value across the boundary from the JVM.** Symbol resolution proves
23+
reachability, not a working call. This is S1's first real unit, and it will
24+
force the open question `0005` now records: how `cljwit.host` locates
25+
`libwasmtime` without a machine-specific path.
26+
4. **Firm up V8's crossover**, the one soft figure left. wasmtime's is now
1727
nine measured points at 26.6%; V8's interpolates onto a −0.01 ns endpoint
1828
inside its own spread, so the data bounds it only to 70–90%. Points at
1929
k = 7, 8, 10 would settle it.

‎refs.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"zwasm": { "url": "https://github.com/clojurewasm/zwasm", "why": "sibling; a Wasm engine written from scratch, including its JIT notes" },
1515
"clj.wasm": { "url": "https://github.com/kanaka/clj.wasm", "why": "earlier exploration of this exact question" },
1616

17+
"wasmtime": { "url": "https://github.com/bytecodealliance/wasmtime", "large": true, "why": "the C API cljwit.host binds to (crates/c-api), and the reference Component Model implementation" },
1718
"component-model": { "url": "https://github.com/WebAssembly/component-model", "why": "the Canonical ABI we must emit by hand (S4); issue #525 is GC-in-ABI, still a pre-proposal" },
1819
"wit-bindgen": { "url": "https://github.com/bytecodealliance/wit-bindgen", "why": "how every other language binds WIT — no Clojure backend, so this is the shape to match, not to use" },
1920
"dart-sdk": { "url": "https://github.com/dart-lang/sdk", "large": true, "why": "dart2wasm: the closest prior art for lowering a GC'd object model onto WasmGC (pkg/dart2wasm)" },

0 commit comments

Comments
 (0)