-
Notifications
You must be signed in to change notification settings - Fork 89
Static check for noalloc: ignore allocations post-dominated by a raise #863
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
Conversation
Same as [@noalloc_strict] except that it allows allocations postdominated by a raise. In other words, when a function returns normally, it is guaranteed not to allocate (i.e., allocations are allowed upon exceptional return). Enabled by the existing -alloc-check compiler flag.
otherwise all [raise] are compiled to [raise_notrace]
9472279
to
b5be835
Compare
Rebased on top of #870 to rename the attributes. This PR is now using To distinguish the two, we could use I've also updated the PR to check allocation paths on paths leading to |
fixes flambda2 test failure
The handling of try-with is not right, thanks @poechsel for this example:
the non-strict check passes, but the intended meaning here is for a check to fail because there is allocation on the “normal” return of this expression. Thanks @lpw25 for this definition. To implemented it not overly conservatively I think we can use the result of the strict check for the body of the try. I am making this PR into a Draft for now. |
Can we close this one since #1157 has been opened ? |
superseded by #1157 |
Adapted from another part of #707.
This PR adds attributes
[@noalloc_exn ]
and[@noalloc_exn assume]
which are similar to[@noalloc]
and[@noalloc assume]
, respectively, added in #825, except the allow allocation and indirect calls post-dominated by araise
.The way we currently determine post-dominators is conservative around
try-with
and some other cases, so might not be able to prove everything that the user expects.