This repository was archived by the owner on Aug 12, 2026. It is now read-only.
Repository navigation
Commit 120311e
committed
String results from host imports, and the measurement that justifies malloc
0017 C says wasmtime takes ownership of what an import callback writes and
frees it, so a string result cannot come from a java.lang.foreign.Arena. That
came from the review; this commit verifies it, and the shape of the failure is
the finding:
arena pointer, one call -> "ababab", rc=0
arena pointer, 2000 calls -> Abort trap: 6, rc=134
One call succeeds. A test that called once would have licensed the corruption
and reported a green gate, which is why the test loops 500 times.
So the import direction gets libc's malloc -- the only allocator this library
binds, and only here. dev/resources/imps.{wit,wat} is a guest whose import
returns a string and whose export relays it, so both directions of a string
cross in one call.
Two of the assertions I wrote first were nonsense and the suite caught them:
the host function returns n copies of "ab", so expecting "日本語" from it, and
expecting 500 distinct results from 500 identical calls, were both my errors
rather than the code's.
Aggregate results -- list, record, option, variant -- need the same allocator
change threaded through lower-fn and are still refused at instantiate with the
kind named.
101 assertions.
Claude-Session: https://claude.ai/code/session_01XF5Hfq4Ca2N2XYEzWQQuHt1 parent 0d0c736 commit 120311e
5 files changed
Lines changed: 81 additions & 5 deletions
File tree
- dev/resources
- doc/design
- src/cljwit
- test/cljwit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
158 | 165 | | |
159 | 166 | | |
160 | 167 | | |
| |||
549 | 556 | | |
550 | 557 | | |
551 | 558 | | |
552 | | - | |
| 559 | + | |
553 | 560 | | |
554 | 561 | | |
555 | 562 | | |
556 | 563 | | |
557 | 564 | | |
558 | 565 | | |
559 | | - | |
560 | | - | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
561 | 586 | | |
562 | 587 | | |
563 | 588 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
0 commit comments