Stream: git-wasmtime

Topic: wasmtime / PR #9525 Expose `get_module_export` from `Caller`


view this post on Zulip Wasmtime GitHub notifications bot (Oct 30 2024 at 17:58):

richardpringle opened PR #9525 from richardpringle:main to bytecodealliance:main:

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

Not necessarily trying to get this merged, just using it as an example for my comment here

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2024 at 18:50):

alexcrichton commented on PR #9525:

What I might recommend for your use case is to store a TypedFunc<P, R> within the T of your Store<T>. That'd probably start as Option<TypedFunc<...>> and be None on store construction. After instantiation you'd load the function, set it in the store, and then all your host functions have access to that allocation function.

Alternatively if you want the absolute fastest route what I think you'd do is:

That front-loads as much as possible at the cost of safety, so I'd recommend using .get_typed_func if possible after the initial instantiation of the module.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2024 at 18:51):

alexcrichton commented on PR #9525:

(although if you'd like adding the API like in this PR I also think is reasonable!)

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2024 at 20:33):

richardpringle updated PR #9525.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2024 at 20:35):

richardpringle has marked PR #9525 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2024 at 20:35):

richardpringle requested alexcrichton for a review on PR #9525.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2024 at 20:35):

richardpringle requested wasmtime-core-reviewers for a review on PR #9525.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2024 at 20:38):

richardpringle submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2024 at 20:38):

richardpringle created PR review comment:

Docs are effectively a copy/paste of Instance::get_module_export. Happy to take recommendations or if you want to make a suggestion, I will definitely accept it. I think see [Instance::get_module_export] for details would probably also be fine so long as it's clear that the caller has access to the instance (wasn't clear to me without looking at the code).

view this post on Zulip Wasmtime GitHub notifications bot (Nov 01 2024 at 01:27):

alexcrichton submitted PR review:

Looks good to me! Mind adding a small smoke test too?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 01 2024 at 17:37):

richardpringle updated PR #9525.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 01 2024 at 17:38):

richardpringle commented on PR #9525:

Looks good to me! Mind adding a small smoke test too?

@alexcrichton not sure if this is what you meant by a smoke test, but it works as one, haha :sweat_smile: .

view this post on Zulip Wasmtime GitHub notifications bot (Nov 01 2024 at 18:37):

richardpringle updated PR #9525.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 01 2024 at 18:37):

richardpringle requested alexcrichton for a review on PR #9525.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 02 2024 at 04:23):

alexcrichton submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Nov 02 2024 at 04:39):

alexcrichton merged PR #9525.


Last updated: Dec 23 2024 at 12:05 UTC