Add Component function calls and runtime values - #290
Draft
JDLondon7 wants to merge 3 commits into
Draft
Conversation
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.
Failing test
upstream/mainexposes component loading and instantiation, but it has no API to retrieve or invoke an exported component function and no runtime component value representation. The added tests call an exported function repeatedly withlist<u8>values and exercise owned primitive and composite values.General correction
ComponentInstance.GetFuncand synchronousComponentFunc.Callbindings.ComponentValrepresentation for primitives, lists, records, tuples, variants, options, results, enums, and flags.ComponentFuncTypeexplicit close/finalizer behavior consistent with the existing bindings.This draft intentionally does not add
ComponentValTypecomposite wrappers. That work is already under review in #283. It tracks the M1 work in #280 and can be rebased as the existing type series lands.Validation
With the v47.0.0 release artifacts restored as ignored build inputs:
Both commands pass on Windows amd64; lint reports
0 issues.Compatibility and security impact
The API is additive and synchronous. It wraps the existing Wasmtime C component API and does not change core-module behavior. Returned values are cloned before the C-owned result vector is deleted, avoiding borrowed pointers escaping into Go.
Documentation
Public types and methods include Go documentation. The tests demonstrate call and ownership behavior.
Downstream removal condition
Downstream users can remove equivalent local bindings after an upstream release contains these APIs and their component call/value fixtures pass unchanged.
This change contains no TradePit product concepts or private data.