[gclist] tail-calls in C/C++
Eric Jeschke
jeschke@cs.indiana.edu
Thu, 8 Aug 1996 15:27:17 EST
Regarding tail-call optomization and non-local jumps:
I have found in my own efforts at symbolic language implementation that
C is simply not a decent target language, primarily because it lacks
efficient non-local jumps and explicit guaranteed register naming.
On the other hand, most of us need external linkage to existing C/C++
libraries.
If gcc provided efficient non-local jumps it would probably be the
most general, albeit low-level, acceptable target.
My own feeling is that what would be ideal is a highly portable hardware
abstraction layer that included a HAL to native assembler. This assembler
would support a host function call as a pseudo-instruction, guaranteed
to Do the Right Thing with the stack frame.
Of course this does not optomize C tail calls, but would allow a
language implementor the full power of assembly to do tail call and
other optomizations for their own language, while retaining full
interoperability with C and wide portability by virtue of the HAL.
A standard function call and object interface for the HAL would allow
language interoperability between disparate symbolic surface languages.
Please note that I am NOT talking about a portable common virtual machine
for symbolic languages; there are a number of such projects. I am talking
about a very low-level abstraction of hardware, suitable for implementing
even C.
'gas' provides a common syntax, but makes no attempt to abstract the host
architecture. If someone could implement the HAL and target 'gas' and
'gcc' to the HAL, it would open up a lot of very interesting possibilities.
--
Dr. Eric Jeschke | Visiting Research Associate
jeschke@cs.indiana.edu | Indiana University
| Computer Science Department
http://www.cs.indiana.edu/hyplan/jeschke