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:
- peterhuene: wasmtime:api
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
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)
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.
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.
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.
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.
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.
zhiqiangxu commented on Issue #2282:
What way do you recommend ? I don’t mind if there is a better solution:)
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 fromStore
. The configuration option would then get plumbed through to the codegen backend to affect the generated code.
Last updated: Nov 22 2024 at 16:03 UTC