Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a first-class way of accessing caller's exports #1290

Merged
merged 3 commits into from
Mar 18, 2020

Conversation

alexcrichton
Copy link
Member

This commit is a continuation of #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.

@alexcrichton alexcrichton added wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime Issues about wasmtime that don't fall into another label labels Mar 11, 2020
@fitzgen
Copy link
Member

fitzgen commented Mar 11, 2020

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

@github-actions
Copy link

Subscribe to Label Action

This 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 .github/subscribe-to-label.json configuration file.

Learn more.

@bytecodealliance bytecodealliance deleted a comment from github-actions bot Mar 13, 2020
@bytecodealliance bytecodealliance deleted a comment from github-actions bot Mar 13, 2020
@github-actions github-actions bot added the wasmtime:docs Issues related to Wasmtime's documentation label Mar 13, 2020
crates/api/src/func.rs Show resolved Hide resolved
crates/api/src/func.rs Outdated Show resolved Hide resolved
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.
@alexcrichton
Copy link
Member Author

Ok, updated!

@alexcrichton alexcrichton merged commit f63c3c8 into bytecodealliance:master Mar 18, 2020
@alexcrichton alexcrichton deleted the rewrite-func branch March 18, 2020 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasi Issues pertaining to WASI wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:docs Issues related to Wasmtime's documentation wasmtime Issues about wasmtime that don't fall into another label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants