Skip to content
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

restore (debug-level 2) behavior, but reduce its guarantees #834

Merged
merged 1 commit into from
May 25, 2024

Conversation

mflatt
Copy link
Contributor

@mflatt mflatt commented May 21, 2024

When debug-level is 2 or more, optimization is supposed to refrain from moving a call to an error function into tail position of the enclosing function. (That's a stronger guarantee than the usual one of not moving an expression into tail position if there's potentially a way to detect the movement through continuation marks.) An earlier commit 6a73b9e strengthened movement of error calls in a way that did not preserve this (debug-level 2) constraint, so this commit primarily adjusts those changes. Also, the earlier commit 19af32e allowed the compiler to move an error call out of tail position, and that transformation is now suppressed when debug-level is 2 or more.

These changes are meant to help with debugging, but they're not enough to implement the previously specified behavior of debug-level. It turns out that Chez Scheme v9.x didn't implement the specified behavior, either, because it would convert (let ([x (error ...)]) x) to just (error ...), for example. The old specification seems too strong, and so part of the revision here is to change the specificaton to be encouraging a particular interaction of errors and continuaton-inspection results, but not guaranteeing it. Meanwhile, when well-defined reflection on continuations is needed, continuation marks provide that functionality.

When `debug-level` is 2 or more, optimization is supposed to refrain
from moving a call to an error function into tail position of the
enclosing function. (That's a stronger guarantee than the usual one of
not moving an expression into tail position if there's potentially a
way to detect the movement through continuation marks.) An earlier
commit 6a73b9e strengthened movement of error calls in a way that
did not preserve this `(debug-level 2)` constraint, so this commit
primarily adjusts those changes. Also, the earlier commit 19af32e
allowed the compiler to move an error call out of tail position, and
that transformation is now suppressed when `debug-level` is 2 or more.

These changes are meant to help with debugging, but they're not enough
to implement the previously specified behavior of `debug-level`. It
turns out that Chez Scheme v9.x didn't implement the specified
behavior, either, because it would convert `(let ([x (error ...)]) x)`
to just `(error ...)`, for example. The old specification seems too
strong, and so part of the revision here is to change the specificaton
to be encouraging a particular interaction of errors and
continuaton-inspection results, but not guaranteeing it. Meanwhile,
when well-defined reflection on continuations is needed, continuation
marks provide that functionality.
@mflatt mflatt merged commit fa451a1 into cisco:main May 25, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants