[Stackless] For interested - an interlacing compiler for C that allows continuations

Christian Tismer tismer at tismer.com
Sat Sep 7 20:05:55 CEST 2002


Paul Sheer wrote:
> I am busy creating a C compiler that takes normal
> C code and compiles into code that supports
> continuations.
> 
> The output code is strict ANSI C and does not contain
> machine dependent instructions.
> 
> Below is a proposal submitted for another purpose
> (it is quite formal).
> 
> I thought the stackless list may be interested.
> I am quite a way into the compiler now. I have
> only to do "switch" statements "for" loops and
> "do..while" loops. "if" and "while" statements
> are done. the rest of the C language is also done.

I have no idea whether this would suffice as a thesis.
There has been some work, before. For example, the C--
language from Simon Peyton-Jones is a portable assembly
language with C like syntax, which does support
continuations to some extent. It does not support
"full" continuations like I did with the old Stackless,
but short-lived, "one-shot" continuations. That's
basically what Stackless uses today, too. Less powerful
but enough.
I never used C--,although I tried. There were some
barriers getting all the environment they need, and
they use ML which I don't understand.

Having a simple, one-shot continuation supporting
C compiler would be great. Having it spitting out
ANSI C code would even be better!
I'd love to evict my assembly stuff, since it has
several drawbacks:
- it makes thread pickling near to impossible
- it gives bad performance on machines with large
   register sets.

The latter is really bad. No real problem on Intel,
but Spark really suffers, since all register
predictions are falsified and the compiler cannot
optimize the switching.

How far do you think: Would it be possible to pour
Python through the compiler, with all of its
recursiveness and all the method hooks in type
objects, and the compiler would produce efficient
code?
I think the answer is yes, silly question.
Just remove the stack.

I've been thinking of this for quite some time.
Changing the C code to become non-recursive was
no real option. But letting a compiler do that
for us sounds phantastic!

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/


_______________________________________________
Stackless mailing list
Stackless at www.tismer.com
http://www.tismer.com/mailman/listinfo/stackless



More information about the Stackless mailing list