Stream: git-wasmtime

Topic: wasmtime / PR #3352 Add `Store::consume_fuel` to manually...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 15 2021 at 15:03):

alexcrichton opened PR #3352 from consume-fuel to main:

This can be useful for host functions that want to consume fuel to
reflect their relative cost. Additionally it's a relatively easy
addition to have and someone's asking for it!

Closes #3315

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Sep 15 2021 at 16:13):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 15 2021 at 16:13):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 15 2021 at 16:13):

fitzgen created PR review comment:

Maybe saturating arithmetic is the right thing to do here instead of returning an error? Unsure.

I guess we could punt that saturate-or-not decision to the embedder since they can check fuel_consumed and compare it to the fuel added to clamp the amount of fuel to consume when calling this method. Might make sense to have a fuel_remaining method so they don't have to remember how much fuel was added and do that comparison themselves.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 15 2021 at 18:09):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 15 2021 at 18:09):

alexcrichton created PR review comment:

I figure this is something we'll probably tweak over time yeah. The precise interfaces here aren't exhasutively considered and bike-shedded, rather they're mostly just situation-solving feature requests as we get them. For now I figured you could get fuel_remaining with consume_fuel(0), but we can always add another path if necessary in the future too.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 15 2021 at 18:10):

alexcrichton merged PR #3352.


Last updated: Nov 22 2024 at 17:03 UTC