Skip to content

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.

2 participants