-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add time quota in checking global objects #24706
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
base: main
Are you sure you want to change the base?
Conversation
ccbd61b to
227ac2b
Compare
| init(tpl, obj, classSym) | ||
| catch case _: OutOfQuotaException => | ||
| if !BestEffort then | ||
| report.warning("Giving up checking initializatino of " + classSym + " due to exhausted budget", classSym.sourcePos) |
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.
Should we turn on this warning for best-effort mode?
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.
Discussed this in meeting and it's agreed useful to display the warning in both modes: end users can learn from the warning that their initialization code is too complex.
|
It's interesting to see that the changes do not impact the test cases. With the assumption that most real-world cases are simple, we expect the changes to NOT impact most use cases, but only defend against edge cases. |
olhotak
left a comment
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.
Otherwise LGTM.
Co-authored-by: Ondřej Lhoták <[email protected]>
Make global object checker default to best-effort mode
In both modes, there will be a worst-case performance guarantee based on a quota on the number of method calls in initializing a global object.