This repository was archived by the owner on Aug 12, 2026. It is now read-only.
Commit cf43be4
committed
Echo a string across the boundary, and drop the third cost estimate
status.md said the aggregate half of 0012's test needed a
wit-bindgen-generated guest, since string and friends require linear
memory and cabi_realloc. Checked the premise before building on it.
It is wrong. An *echo* copies nothing: the host has already lowered the
string into the guest's memory, so echoing it means handing back the same
(ptr, len). The whole guest is 25 lines of WAT -- a bump-allocator
cabi_realloc, an exported memory, and a function that stores the pair and
returns its address. wasm-tools component new does the rest.
wasmtime run --invoke 'echo-string("hello")' -> "hello"
So the test now covers string too: 46 assertions, empty strings,
multi-byte UTF-8, an embedded NUL, a 1000-character string, and L6's
unpaired surrogate -- which does not survive, though not for the reason
0012 gave (UTF-8 encoding substitutes rather than failing, so it comes
back changed rather than being rejected).
**This note has now over-costed its own test three times**: "thousands of
lines of canonical ABI", then "needs a wit-bindgen guest", then 25 lines
of WAT. Over-estimating the cost of the check is how it kept talking
itself out of running it, and that is recorded in 0012 rather than
quietly fixed.
Renamed scalar_roundtrip_test to roundtrip_test, since it is no longer
scalars. Remaining: record, list, variant, option, result -- each needs
its own ABI shape in the guest and nothing this repo lacks.
Claude-Session: https://claude.ai/code/session_01XF5Hfq4Ca2N2XYEzWQQuHt1 parent 1ba8376 commit cf43be4
3 files changed
Lines changed: 73 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
5 | 28 | | |
6 | 29 | | |
7 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
13 | 18 | | |
Lines changed: 45 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| |||
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
37 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
| |||
132 | 141 | | |
133 | 142 | | |
134 | 143 | | |
135 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
136 | 150 | | |
137 | 151 | | |
138 | 152 | | |
| |||
141 | 155 | | |
142 | 156 | | |
143 | 157 | | |
144 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
145 | 164 | | |
146 | 165 | | |
147 | 166 | | |
| |||
150 | 169 | | |
151 | 170 | | |
152 | 171 | | |
153 | | - | |
| 172 | + | |
154 | 173 | | |
155 | 174 | | |
156 | 175 | | |
| |||
204 | 223 | | |
205 | 224 | | |
206 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
207 | 241 | | |
208 | 242 | | |
209 | 243 | | |
| |||
0 commit comments