Stream: git-wasmtime

Topic: wasmtime / Issue #2282 add new_with_user_state


view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2020 at 13:17):

github-actions[bot] commented on Issue #2282:

Subscribe to Label Action

cc @peterhuene

<details>
This issue or pull request has been labeled: "wasmtime:api"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2020 at 21:13):

alexcrichton commented on Issue #2282:

Thanks for the PR! Can you describe in a bit more detail how you see this being used though? As-is this seems like it's only useful in that you can get a destructor called when the instance itself is deallocated, but I'm not sure if that's the intention or if there's another use case you'd like to unlock. (I'm also not entirely sure how that ability would be used itself)

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2020 at 23:56):

zhiqiangxu commented on Issue #2282:

Thanks for the PR! Can you describe in a bit more detail how you see this being used though? As-is this seems like it's only useful in that you can get a destructor called when the instance itself is deallocated, but I'm not sure if that's the intention or if there's another use case you'd like to unlock. (I'm also not entirely sure how that ability would be used itself)

This is useful if you want to add extra logic such as gas limit for blockchain, the limit can be stored in user state, and checked in FunctionEnvironment::before_translate_operator。I will try to submit code for customize that in another PR.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2020 at 23:58):

zhiqiangxu edited a comment on Issue #2282:

Thanks for the PR! Can you describe in a bit more detail how you see this being used though? As-is this seems like it's only useful in that you can get a destructor called when the instance itself is deallocated, but I'm not sure if that's the intention or if there's another use case you'd like to unlock. (I'm also not entirely sure how that ability would be used itself)

This is useful if you want to add extra logic such as gas limit for blockchain, the limit can be stored in user state, and checked in FunctionEnvironment::before_translate_operator(extra built in function is required to do that).I will try to submit code for customize that in another PR.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2020 at 17:26):

alexcrichton commented on Issue #2282:

Hm ok, although the wasmtime crate is not intended to be used where you're also using lots of cranelift internals. At that point it may be best to add a first-class feature to Wasmtime.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2020 at 17:35):

zhiqiangxu commented on Issue #2282:

I see. Gas limiting is a fundamental feature for blockchain,so such feature will be very handy for whoever implements vm layer based on wasmtime.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2020 at 18:29):

alexcrichton commented on Issue #2282:

Oh sure yeah I don't mean to imply that we're not interested in this feature, just that this probably isn't the best way to implement it in Wasmtime.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2020 at 00:41):

zhiqiangxu commented on Issue #2282:

What way do you recommend ? I don’t mind if there is a better solution:)

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2020 at 21:27):

alexcrichton commented on Issue #2282:

This sort of limiting execution seems like it would probably be implemented similar to how timeouts are implemented right now, which is to say that there's a configuration option in Config which allows you to tweak an object from Store. The configuration option would then get plumbed through to the codegen backend to affect the generated code.


Last updated: Dec 23 2024 at 12:05 UTC