This is an alternative to #2651 and #2663.
The idea stays similar: we want to stop demoting direct calls in cases where we already know the right function to call but have lost the approximation on the closure for some reason (typically a missing cmx).
But we still need to be careful with code that has never been simplified: this code could be slow, so we don't want to call it if there is an alternative (i.e. going through an indirect call), and keeping it alive would require us to compute things like free names and slot offset constraints that we normally only compute when simplifying. The bugs that caused us to revert #2663 shows that we currently don't compute enough information in Closure_conversion: we do have the constraints on slot offsets generated by the sets of closures in non-simplified code, but we don't see the slot projections so we might incorrectly treat some value slots as unused.
While fixing this issue is possible (by storing more information in the slot_offsets structure), this PR goes in the other direction, making sure that we don't call non-simplified code.
This is an alternative to #2651 and #2663. The idea stays similar: we want to stop demoting direct calls in cases where we already know the right function to call but have lost the approximation on the closure for some reason (typically a missing cmx). But we still need to be careful with code that has never been simplified: this code could be slow, so we don't want to call it if there is an alternative (i.e. going through an indirect call), and keeping it alive would require us to compute things like free names and slot offset constraints that we normally only compute when simplifying. The bugs that caused us to revert #2663 shows that we currently don't compute enough information in Closure_conversion: we do have the constraints on slot offsets generated by the sets of closures in non-simplified code, but we don't see the slot projections so we might incorrectly treat some value slots as unused. While fixing this issue is possible (by storing more information in the slot_offsets structure), this PR goes in the other direction, making sure that we don't call non-simplified code.