Robbepop opened issue #6668:
As can be seen in the docs (https://docs.rs/wasmtime/10.0.1/wasmtime/trait.ResourceLimiter.html) the
ResourceLimiter
provides limits forInstance
,Memory
andTable
instance counts but not forGlobal
andFunc
.This question came up in https://github.com/paritytech/wasmi/pull/737 and we were wondering about the rationals behind this design.
Clarifications would be very welcome. :)
Robbepop edited issue #6668:
As can be seen in the docs (https://docs.rs/wasmtime/10.0.1/wasmtime/trait.ResourceLimiter.html) the
ResourceLimiter
provides limits forInstance
,Memory
andTable
instance counts but not forGlobal
andFunc
.This question came up in https://github.com/paritytech/wasmi/pull/737 and we were wondering about the rationals behind this design.
Clarifications would be very welcome. :)
alexcrichton commented on issue #6668:
I don't think there's a main principle behind this per se, but I can attempt to retcon it a bit by saying that one difference between memories/tables vs funcs/globals is that the former have runtime lengths associated with them where the latter have a static size which doesn't change. Not to say functions/globals couldn't be limited, however.
In Wasmtime at least the number of functions/globals factors into the size of a
VMContext
which is where limits would be placed, but the limit there is somewhat abstract where you'd say, for example, "instances should get at most 1MB of state" but what exactly is in that 1MB is up to Wasmtime (but globals/funcs fit in there and factor into that)
Robbepop commented on issue #6668:
Thank you a lot for providing me with the rationals behind the design @alexcrichton !
Given that Wasmtime has a multitude of users compared to
wasmi
I was wondering why this was not asked before by users. At least for embedded systems werewasmi
is used primarily I see a potential for users who want to limitglobals
andfuncs
as well. However, at the same timewasmi
tries at best effort to stay as close to the Wasmtime API as possible for the benefit of all users only having to learn a single, reasonable API.
Robbepop edited a comment on issue #6668:
Thank you a lot for providing me with the rationals behind the design @alexcrichton !
Given that Wasmtime has a multitude of users compared to
wasmi
I was wondering why this was not asked before by users. At least for embedded systems werewasmi
is used primarily I see a potential for users who want to limitglobals
andfuncs
as well. However, at the same timewasmi
tries at best effort to stay as close to the Wasmtime API as possible for the benefit of all users only having to learn a single, reasonable API.I guess this issue can be closed. If people actually need this they can open another issue with the request.
Robbepop edited a comment on issue #6668:
Thank you a lot for providing me with the rationals behind the design @alexcrichton !
Given that Wasmtime has a multitude of users compared to
wasmi
I was wondering why this was not asked before by users. At least for embedded systems werewasmi
is used primarily I see a potential for users who want to limitglobals
andfuncs
as well. However, at the same timewasmi
tries its best to stay as close to the Wasmtime API as possible for the benefit of all users only having to learn a single, reasonable API.I guess this issue can be closed. If people actually need this they can open another issue with the request.
alexcrichton commented on issue #6668:
Ok, sounds reasonable!
alexcrichton closed issue #6668:
As can be seen in the docs (https://docs.rs/wasmtime/10.0.1/wasmtime/trait.ResourceLimiter.html) the
ResourceLimiter
provides limits forInstance
,Memory
andTable
instance counts but not forGlobal
andFunc
.This question came up in https://github.com/paritytech/wasmi/pull/737 and we were wondering about the rationals behind this design.
Clarifications would be very welcome. :)
Last updated: Dec 23 2024 at 12:05 UTC