WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@liufengyun
Copy link
Contributor

@liufengyun liufengyun commented Dec 8, 2025

Make global object checker default to best-effort mode

  • In best-effort mode, the checker tries to be fast, useful and unobtrusive.
  • In the aggressive mode, the checker tries to be sound by spending more check time and produce more verbose warnings.

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.

@liufengyun liufengyun marked this pull request as ready for review December 16, 2025 07:29
init(tpl, obj, classSym)
catch case _: OutOfQuotaException =>
if !BestEffort then
report.warning("Giving up checking initializatino of " + classSym + " due to exhausted budget", classSym.sourcePos)
Copy link
Contributor Author

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?

Copy link
Contributor Author

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.

@liufengyun
Copy link
Contributor Author

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 defend against edge cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants