Repository navigation
Conversation
Imports were rejected as function values because they are marked as exported and use a different ABI. Wrap them in a Go ABI function that calls the import instead. Other exported functions are still rejected.
The GC does not move objects, so Pin only needs to keep the object alive until Unpin. The pins are kept in a global map. Generated bindings embed a Pinner in the object they pin, so storing the pins in the Pinner itself would let the GC free the object while only the host holds it.
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.
This PR depends on #5782 (LLVM 23) and #5507 (wasi-libc upgrade) and should not merge before them.
It makes the Go bindings from
wit-bindgen gobuild and run with TinyGo. Two changes are needed.compiler: allow
//go:wasmimportfunctions as function valuesImports are marked as exported and use a different ABI, so using one as a function value was rejected. The generated bindings do this for stream and future vtables. An import used as a value is now wrapped in a Go ABI function that calls the import. Other exported functions are still rejected.
runtime: add Pinner
runtime.Pinnerdid not exist. The generated code pins memory it hands to the host so the GC does not free it betweencabi_realloccalls. The GC does not move objects, so Pin only has to keep the object alive until Unpin. Pins are kept in a global map because the generated resource types embed a Pinner in the object they pin, and the host holds only an integer handle.Not in this PR
go.bytecodealliance.org/pkgneeds a separate change so thatcabi_reallocdoes not calladapter_monotonic_clock_set_pausedunder TinyGo. That call re-enters the WASI adapter while it is still allocating its own state.There will be further patches coming on this branch with wasip3 support.