-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
c-api: wasmtime_store_limiter #5761
Conversation
Subscribe to Label Actioncc @peterhuene
This 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_limiter
that 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?