Re: Tail-Call Elimination Use-Cases

"cr88192" <cr88192@hotmail.com>
24 Jul 2002 01:47:14 -0400

          From comp.compilers

Related articles
Tail-Call Elimination Use-Cases baueran@in.tum.de (Andreas Bauer) (2002-07-21)
Re: Tail-Call Elimination Use-Cases cr88192@hotmail.com (cr88192) (2002-07-24)
Re: Tail-Call Elimination Use-Cases neelk@alum.mit.edu (Neelakantan Krishnaswami) (2002-07-24)
Re: Tail-Call Elimination Use-Cases wilson@redhat.com (Jim Wilson) (2002-07-24)
Re: Tail-Call Elimination Use-Cases felixundduni@freenet.de (felix) (2002-07-24)
Re: Tail-Call Elimination Use-Cases baueran@in.tum.de (Andreas Bauer) (2002-07-25)
Re: Tail-Call Elimination Use-Cases baueran@in.tum.de (Andreas Bauer) (2002-07-25)
Re: Tail-Call Elimination Use-Cases David.Mosberger@acm.org (David Mosberger-Tang) (2002-07-31)
| List of all articles for this month |

From: "cr88192" <cr88192@hotmail.com>
Newsgroups: comp.compilers
Date: 24 Jul 2002 01:47:14 -0400
Organization: Posted via Supernews, http://www.supernews.com
References: 02-07-066
Keywords: optimize
Posted-Date: 24 Jul 2002 01:47:14 EDT

I think it might be useful however I would consider the practical
effect to be limited (with the exception of code that actually uses
tail calls very often).


I think a general way of which this could be done is: strip off old
call frame and store it somewhere, remove caller args (only includes
base args, extended args are unsafe), add on new args and replace call
frame, then jump to new function.


A problem araises in the fact that the stack will not be in the
expected location for the caller to clean up correctly, so it would be
necessary for the callee to adjust the stack on return to be in the
expected location. a solution could be to have the real return value
as a "hidden" argument, and to replace the call frame return value
with a "cleanup" stub, which would adjust the stack by the desired
amount and jump to the "real" return location. all this is horribly
hackish though thus maybe it might be useful to vary the calling
convention slightly for "optimized" code.


--
<cr88192@hotmail.spam.com>
<http://bgb1.hypermart.net/>


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.