Robbepop opened issue #6668:
As can be seen in the docs (https://docs.rs/wasmtime/10.0.1/wasmtime/trait.ResourceLimiter.html) the
ResourceLimiterprovides limits forInstance,MemoryandTableinstance counts but not forGlobalandFunc.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
ResourceLimiterprovides limits forInstance,MemoryandTableinstance counts but not forGlobalandFunc.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
VMContextwhich 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
wasmiI was wondering why this was not asked before by users. At least for embedded systems werewasmiis used primarily I see a potential for users who want to limitglobalsandfuncsas well. However, at the same timewasmitries 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
wasmiI was wondering why this was not asked before by users. At least for embedded systems werewasmiis used primarily I see a potential for users who want to limitglobalsandfuncsas well. However, at the same timewasmitries 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
wasmiI was wondering why this was not asked before by users. At least for embedded systems werewasmiis used primarily I see a potential for users who want to limitglobalsandfuncsas well. However, at the same timewasmitries 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
ResourceLimiterprovides limits forInstance,MemoryandTableinstance counts but not forGlobalandFunc.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 06 2025 at 06:05 UTC