c-api: wasmtime_store_limiter #5761
Conversation
Subscribe to Label Actioncc @peterhuene DetailsThis issue or pull request has been labeled: "wasmtime:c-api"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
| * for a Store. Instantiation will fail with an error if this limit is exceeded. | ||
| * This value defaults to 10,000. | ||
| * | ||
| * Use `0` for the parameters that should be kept on default values. |
There was a problem hiding this comment.
I think there's a case to be made for allowing precisely 0 of the above items, so could this instead perhaps use a negative value to indicate "use the default"?
There was a problem hiding this comment.
I was thinking about this as well, but in that case we would need to use different types then usize and u32. What do you suggest using instead of these?
There was a problem hiding this comment.
For some of these values the range of 0..i32::MAX is sufficient (or even isize::MAX). Otherwise though you could also add a dedicated struct with getters/setters where not calling a setter is equivalent to "none" or something like that. I don't know the best way to handle optional parameters in C myself.
There was a problem hiding this comment.
struct is not perfect, you'd end up with same problems, even if you use pointers on integers.. because then (afaik) you wouldn't be able to distinguish 0 and NULL.
Let's go with -1 as indication "to leave default" and i64 for all types. That way we keep the max ranges same and we will have a way to use 0 as a correct value.
alexcrichton
left a comment
There was a problem hiding this comment.
Sounds reasonable to me!
This was not yet discussed, but as of now, there's no way how to use StoreLimits from the C API. This PR adds
wasmtime_store_limiterthat allows setting supported limits for the Store.Not sure who to assign for this PR, judging from the past PRs for c-api @alexcrichton maybe?