feat: per-component handle table allocation and function generation#79
Merged
feat: per-component handle table allocation and function generation#79
Conversation
, #71) Implement the first three tasks of epic #69: 1. Identify re-exporter components in the resolver by scanning adapter sites for callee_defines_resource=false operations. 2. Allocate handle table space in the merger: for each re-exporter, grow its memory by 1 page and place a 256-entry i32 handle table at the start of the new page. Add a mutable global for the next-allocation pointer (starts at base+4 to avoid handle=0). 3. Generate three wasm functions per re-exporter: - ht_new: store rep at next_ptr, return aligned handle, advance by 4 - ht_rep: i32.load rep from handle address - ht_drop: i32.store 0 at handle address (mark as freed) All functions use the correct multi-memory index for load/store. Handle addresses are always 4-byte aligned, satisfying wit-bindgen's ResourceTable alignment check (value & 3 == 0). Part of #69. 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
callee_defines_resource=falseht_new(store rep, return aligned handle),ht_rep(load rep),ht_drop(zero out entry)ResourceTablealignment checkImplements tasks 1-3 of epic #69. Functions are generated but not yet wired — tasks 4-6 (routing, adapter fixes, graph propagation) will follow.
Part of #69, closes #70, closes #71.
Test plan
MemArgsupport🤖 Generated with Claude Code