Skip to content

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

Merged
alexcrichton merged 3 commits into
bytecodealliance:masterfrom
alexcrichton:rewrite-func
Mar 18, 2020
Merged

Add a first-class way of accessing caller's exports#1290
alexcrichton merged 3 commits into
bytecodealliance:masterfrom
alexcrichton:rewrite-func

Conversation

@alexcrichton
Copy link
Copy Markdown
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
Copy Markdown
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 github-actions Bot added the wasi Issues pertaining to WASI label Mar 11, 2020
@github-actions
Copy link
Copy Markdown

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
Comment thread crates/api/src/func.rs
Comment thread crates/api/src/func.rs Outdated
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
Copy Markdown
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.

3 participants