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
Some GADT matches cause closure allocation with ocamlc -g #7345
Comments
Comment author: @xavierleroy Just from reading the description of this PR, not going back to the code:
|
Comment author: @xavierleroy Playing some more with the repro case:
type t = A of {x: int} in your example and the intermediate closure goes away.
type t = A of {x: int} | B you get lambda code of the form
even if -g is not given. That makes sense because f must take one argument, check that it is indeed an A, then return a function taking the second parameter. Taking the two parameters at once then doing the matching on the first would be semantically incorrect. With a GADT, the "B -> raise Match_failure" branch is eliminated, I don't know where, but the debug event was already inserted. For the time being I'm pushing this to 4.06. But I suggest to close this PR as not worth fixing. |
Comment author: @xavierleroy This issue won't be looked at in time for 4.06. I move it to "later" as I doubt anyone really cares about it. |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
This was fixed in 4.06.0. (I think by #1195) |
Original bug ID: 7345
Reporter: @mshinwell
Status: acknowledged (set by @mshinwell on 2016-09-08T11:07:36Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.04.0 +dev / +beta1 / +beta2
Target version: later
Category: back end (clambda to assembly)
Related to: #7384
Monitored by: @hcarty
Bug description
It looks like let bindings introduced to alias function parameters holding constructed values of inline record type cause debugging events to be inserted that subsequently cause closure allocation. The allocations happen because the code for combining closures in Simplif (see simplif.ml:464) won't apply owing to the intervening events.
This doesn't happen from 4.04 onwards with native code after the changes to remove debugging events in that context. It still happens with bytecode, however.
For the example below:
Steps to reproduce
Compile and run the following using ocamlc (not ocamlopt).
The answer should be zero, but it prints four.
The text was updated successfully, but these errors were encountered: