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

Add explicit tail calls to Clight and C#minor #422

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xavierleroy
Copy link
Contributor

By popular demand.

The tail call optimization pass performed later in CompCert will not turn a call into a tail call if the function has stack-allocated data, because this might change the semantics.

Having an explicit Stailcall form in Clight makes it possible to force a call in tail position to be a tail call, deallocating stack-allocated data before the call. This is the same reason why we have an Stailcall form in Cminor already.

Cc: @andrew-appel

By popular demand.

The tail call optimization pass performed later in CompCert will not
turn a call into a tail call if the function has stack-allocated data,
because this might change the semantics.

Having an explicit Stailcall form in Clight makes it possible to force
some calls in tail position to be tail calls, deallocating. deallocate
stack-allocated data before the call.  This is the same reason why we
have an Stailcall form in Cminor already.
@andrew-appel
Copy link

I would have thought that ExportClight.ml would also need to be edited, but I don't see that in the list of "files changed."

@xavierleroy
Copy link
Contributor Author

My mistake. Will fix soon.

@xavierleroy
Copy link
Contributor Author

Tentative fix pushed.

@xavierleroy
Copy link
Contributor Author

Ping! Does this PR address the need?

@andrew-appel
Copy link

Yes, I'm pretty sure it does. I don't have time to test it this month. I recommend merge the P.R. Thank you.

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.

None yet

2 participants