Improve consistency of backtraces between flambda and non-flambda modes#739
Improve consistency of backtraces between flambda and non-flambda modes#739mshinwell wants to merge 5 commits intoocaml:4.04from
Conversation
|
I found that having the whole life of an expression is quite an useful tool when looking at -dflambda (and probably for gdb too). Would you consider it right to always call |
|
@chambart Seems like a good idea, I tried to implement it. Please have another look. |
| else (item_from_location loc) :: t | ||
|
|
||
| let mark_as_tail_call t = | ||
| List.map (fun item -> { item with dinfo_is_tail_call = true; }) t |
There was a problem hiding this comment.
Shouldn't this mark only the top location (which is the original location of the apply expression) as tail rather than all ?
|
The This is probably clearer with an example: If inlining For some more complex situations, |
|
@chambart Thanks for spending time on this. I spoke to @let-def this morning having considered your comments. I'm concerned that we're not actually going to be able to pin down a reasonable semantics for this and that in fact it may, on balance, not be worth adding this extra code to the compiler at all. (Factors such as optimisations within Flambda turning non-tail calls into tail calls, the various tricky things about inlining as @chambart mentions, the fact that we don't know until well into the backend whether a particular call will actually be tail or not, etc.) I don't think we should add this code if it's going to be fragile and/or hard to understand, which I am now suspecting it might be. Instead, we should discourage the matching in tests on explicit backtraces in almost all cases, on the basis of it being a quality of implementation feature rather than a prescribed language semantics. |
|
I think we decided not to proceed with this. |
Make ephemerons immutable.
Co-authored-by: Cuihtlauac ALVARADO <cuihtmlauac@tarides.com>
Backtraces on 4.04 are currently rather inconsistent between flambda and non-flambda modes. This causes a significant amount of trouble when using expect-tests or similar to check the output of programs.
It is proposed (after discussion with @let-def who wrote the inlined frames support) in this pull request to do the following:
This probably won't remove all of the inconsistencies, but should bring things significantly closer together than they are now.
This is work in progress, although should be finished soon. @let-def is going to contribute the equivalent code for
Closure.