This repository was archived by the owner on Aug 12, 2026. It is now read-only.
Repository navigation
Commit 99fa006
committed
Host-defined resources work: the destructor returns an error, not void
bb spike-hres
run(42) = 42 dropped: [[1 42]] table now: {}
A guest mints a host resource, reads it back through a borrow, and drops it;
the host's destructor fires with the right rep. Every wasi:io interface has
this shape.
The bug was one line of a typedef:
typedef wasmtime_error_t *(*wasmtime_component_resource_destructor_t)(
void *, wasmtime_context_t *, uint32_t);
I declared the upcall void. wasmtime then read a garbage register as an error
pointer and crashed walking its source chain -- *after* the destructor had
already run correctly, which is why every probe printed success and the crash
looked like it was about ownership of the `any`. Two predictions were falsified
on the way there, both about ownership: removing the mint-side host_delete
changed nothing, and a null destructor is not allowed at all.
My earlier survey printed exactly the line that names the return type and I
read only the parameters, because the return type was on the line above and my
grep window cut it. That is the third time today the same shape has cost
something -- reading a truncated view and treating it as the whole -- after two
greps whose [a-z_] class silently excluded digits.
definterface also needs the return type spelled: a ^void method against a
Void/TYPE MethodType fails findVirtual outright, which is the friendly version
of the same mistake.
So every shape S1's stop condition names has now been reached at least once.
What is left is the cljwit.host API for host resources: a resource is a type,
not a function, so the iface#func map has nowhere to put it.
Claude-Session: https://claude.ai/code/session_01XF5Hfq4Ca2N2XYEzWQQuHt1 parent eef1bf1 commit 99fa006
3 files changed
Lines changed: 44 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
130 | 140 | | |
131 | 141 | | |
132 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
11 | 10 | | |
12 | | - | |
| 11 | + | |
13 | 12 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
30 | 18 | | |
31 | 19 | | |
32 | 20 | | |
| |||
52 | 40 | | |
53 | 41 | | |
54 | 42 | | |
55 | | - | |
56 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
57 | 48 | | |
58 | 49 | | |
59 | 50 | | |
| |||
143 | 134 | | |
144 | 135 | | |
145 | 136 | | |
146 | | - | |
| 137 | + | |
147 | 138 | | |
148 | 139 | | |
149 | 140 | | |
| |||
165 | 156 | | |
166 | 157 | | |
167 | 158 | | |
168 | | - | |
| 159 | + | |
169 | 160 | | |
170 | | - | |
| 161 | + | |
171 | 162 | | |
172 | 163 | | |
173 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
186 | 191 | | |
187 | 192 | | |
188 | 193 | | |
| |||
0 commit comments