Open
Conversation
Add cross-memory copy for string/list INPUT params in the async callback adapter. When the call crosses a memory boundary, the adapter allocates in callee memory via cabi_realloc and copies string data from caller memory before calling [async-lift]. Text functions still fail because the text_processor uses intra- component forwarding functions (call_indirect through fixup table) that route to canonical task.return. These forwarding functions bypass our shim. Fix requires the component wrapper to provide shim functions instead of canonical task.return for shimmed imports. 73/73 P2 runtime tests pass. P3 compute functions correct. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Export task.return shims from fused module ($task_return_shim_N) - Component wrapper aliases shim exports instead of using canonical task.return for shimmed imports (fixes intra-component forwarding) - Fix component_realloc_index to prefer module 0's realloc Text functions: shim routing works (no more "invalid task.return signature") but param copy uses wrong pointer_pair_positions for mixed-type params (copies shift instead of text_ptr). Needs the sync adapter's position mapping logic. 73/73 P2 tests pass. P3 compute functions correct. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Export task.return shims ($task_return_shim_N) from fused module - Component wrapper aliases shim exports instead of canonical task.return - Add string param cross-memory copy (caller→callee via cabi_realloc) - Fix component_realloc_index to prefer module 0 - Debug logging for param copy positions Text functions: shim routing works but pointer_pair_positions has wrong offsets for mixed-type params (e.g., caesar(u32, string) reports position [0] instead of [1]). Needs resolver-level fix for async adapter param flattening. 73/73 P2 tests pass. P3 compute functions correct. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Compute pointer pair positions from CALLER's flat param types
instead of the CALLEE's component type order. The caller's locals
are in canon-lower order which may differ from the callee's
component type param order.
Results:
caesar 3 "hello" → runs without crash (param copy works!)
but result not printed (string result delivery incomplete)
analyze "hello world" → partial output with garbage pointers
(complex record type not fully handled)
prime/fibonacci/factorial/collatz → all correct
73/73 P2 tests pass.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reverting the forwarding function body replacement approach — the forwarding functions have different types than the shims (dispatch type (i32,i32) vs actual task.return type). The wrapper-level shim routing handles the import table correctly. The forwarding function's call_indirect table[N] resolves to the import function, which the wrapper provides as the shim export. The types match for (i32,i32) → () shims (string results). Caesar runs without crash but produces empty output — the shim globals may not be receiving values. Needs deeper table/import tracing. 73/73 P2 tests pass. Compute functions correct. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Patch element segments to replace task.return import references with shim function references. This ensures call_indirect through element-segment-initialized tables calls the shim instead of the stub import. Root cause identified for remaining string function issue: the forwarding function's table index (i32.const 2) uses ORIGINAL component import numbering, but the element segment uses MERGED import numbering. Position 2 in the merged element segment is 'analyze', not 'caesar-cipher' as the forwarding function expects. This is a merger-level table index remapping issue. 73/73 P2 tests pass. Compute functions correct. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to PR #95. Fixes task.return shim routing for the component wrapper and adds infrastructure for string param cross-memory copy.
Changes
$task_return_shim_N)task.returnfor shimmed imports (fixes intra-component forwarding through indirect table)cabi_realloc+memory.copycomponent_realloc_indexto prefer module 0's reallocStatus
P3 compute functions (prime, fibonacci, factorial, collatz) produce correct results on stock wasmtime. String-returning functions need a resolver-level fix for
pointer_pair_positionsoffset mapping with mixed-type params.73/73 P2 runtime tests pass.
🤖 Generated with Claude Code