Add a first-class way of accessing caller's exports#1290
Merged
Conversation
Member
|
Gah it looks like the subscribe-to-label action also needs to run on a cron schedule for pull requests: https://github.com/bytecodealliance/wasmtime/pull/1290/checks?check_run_id=501503929#step:2:25 |
3914410 to
bb021dd
Compare
bb021dd to
f9c96f0
Compare
Subscribe to Label ActionThis issue or pull request has been labeled: "wasi", "wasmtime", "wasmtime:api" Users Subscribed to "wasmtime:api"To subscribe or unsubscribe from this label, edit the |
sunfishcode
reviewed
Mar 18, 2020
This commit is a continuation of bytecodealliance#1237 and updates the API of `Func` to allow defining host functions which have easy access to a caller's memory in particular. The new APIs look like so: * The `Func::wrap*` family of functions was condensed into one `Func::wrap` function. * The ABI layer of conversions in `WasmTy` were removed * An optional `Caller<'_>` argument can be at the front of all host-defined functions now. The old way the wasi bindings looked up memory has been removed and is now replaced with the `Caller` type. The `Caller` type has a `get_export` method on it which allows looking up a caller's export by name, allowing you to get access to the caller's memory easily, and even during instantiation.
f9c96f0 to
063ddb0
Compare
Member
Author
|
Ok, updated! |
sunfishcode
approved these changes
Mar 18, 2020
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 commit is a continuation of #1237 and updates the API of
Functoallow defining host functions which have easy access to a caller's
memory in particular. The new APIs look like so:
Func::wrap*family of functions was condensed into oneFunc::wrapfunction.WasmTywere removedCaller<'_>argument can be at the front of allhost-defined functions now.
The old way the wasi bindings looked up memory has been removed and is
now replaced with the
Callertype. TheCallertype has aget_exportmethod on it which allows looking up a caller's export byname, allowing you to get access to the caller's memory easily, and even
during instantiation.