Static check for noalloc: ignore allocations post-dominated by a raise#863
Static check for noalloc: ignore allocations post-dominated by a raise#863gretay-js wants to merge 11 commits intooxcaml:mainfrom
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-withand some other cases, so might not be able to prove everything that the user expects.