feat: add a 'records' example, and some required instructions#171
Open
arcjet-rei wants to merge 8 commits intomainfrom
Open
feat: add a 'records' example, and some required instructions#171arcjet-rei wants to merge 8 commits intomainfrom
arcjet-rei wants to merge 8 commits intomainfrom
Conversation
Prior to this commit there was ostensibly no support for 'record' WIT types, but there wasn't actually much required for them to work. This commit adds an example for use in the test harness and the required instructions to load/store integer record fields. Relates to #4.
Co-authored-by: blaine-arcjet <146491715+blaine-arcjet@users.noreply.github.com>
In the import direction, function params are already uint32, so using api.EncodeU32/api.DecodeU32 is a wasteful roundtrip. Use simple uint32() casts for imports and the API functions for exports where CallWasm operates on uint64 values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update examples/records wit-bindgen to 0.53.1 and wit-component to 0.245.1 to match other examples - Regenerate CLI test snapshots to reflect the EncodeU32/DecodeU32 codegen changes for export functions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…romU64 Replace api.EncodeU32/api.DecodeU32/int64() with simple uint32()/uint64() identity casts. The Encode/Decode helpers round-trip through uint64, which causes Go compile errors when the result is assigned to a uint32 variable (e.g. VariantLower slots) or when int64 is assigned to uint64. The canonical ABI reinterpretation instructions are no-ops at the bit level, so identity casts are correct — wazero only inspects the lower 32 bits for i32 values. Adds regression tests for the variant-payload case that triggered the original compile errors, and TODOs for E2E variant tests once variant type definition generation is implemented. Co-Authored-By: Claude Opus 4.6 <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.
Picking up from @sd2k's PR #116 and making a number of additional
fixes, rebased onto the tip of main.
@sd2k's original PR message follows:
Prior to this commit there was ostensibly no support for 'record' WIT
types, but there wasn't actually much required for them to work. This
commit adds an example for use in the test harness and the required
instructions to load/store integer record fields.
Relates to #4