Scheme front end for egcs.
Sun Apr 5 14:00:00 GMT 1998
I too am planning to compile Scheme using gcc. However, I am planning
a two-stage approach:
1) Compile Scheme to Java bytecodes using Kawa.
See http://www.cygnus.com/~bothner/kawa.html .
2) Compile Java bytecodes to native codes using jc1.
See http://www.cygnus.com/product/javalang/ .
Currently, Kawa does not handle full tail-call-elimination and
continuations. Using jc1 to compile the bytecodes does not change
that. There are two approaches I am considering:
a) Have Kawa generate explicit "activation frame" objects. I won't go
into details, but there is a well-known technique (used in RScheme, for
example) to simulate full tail-call-elimination and continuations
in a language/environment without them. I have been working on such
a design for Kawa, and I think it can be made reasonably effcicient.
This has the advantage that proper tail-calls are handled in all
b) Extend Gcc to support a modified calling convention, as you discuss.
Have Kawa emit an annotation (attribute) requesting tail-call
elimination. Modify jc1 to use the new calling convention when it sees
that attribute. This will probably provide better efficiency, but has
the disadvantage that you only get proper tail-calls on extended Java
The ideal solution supports both. Kawa can take a flag specifying how
it should handle tail-calls, and the user (or a Makefile) can select
the appropriate strategy depending on the environment. (My preliminary
design allows mixing the two Kawa calling conventions at the same time.)
Cygnus Solutions email@example.com http://www.cygnus.com/~bothner
More information about the Gcc