[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


   From: Abrey Jaffer
   In Steel's 1978 Thesis on the Rabbit (optimizing) compiler, he uses
   continuation-passing-style lambda as the compiler's intermediate form.
   Although call-with-current-continuation was not part of Scheme at that
   time it clearly would have been trivially handled by the compiler.

   From: Jeff Dalton
   ... there must be more recent compilers that take the Rabbit approach
   of converting to continuation-passing style, and they will handle
   CALL/CC directly.

Using a continuation-passing style intermediate language does not
necessarily make handling CALL/CC any easier.  When compiling
a language without CALL/CC the compiler can generate code that
pushes and pops continuations using a stack.  The form of the
intermediate language is unimportant.  Yes, if the intermediate
language is in continuation-passing style, CALL/CC can easily
be represented in that language, but if the compiler assumes
that continuations are not first class it will no longer work.

The Orbit compiler (references on request) uses a continuation-
passing-style intermediate language and allocates continuations
on a stack.  CALL/CC was later added by writing an assembler
routine that copied the stack into the heap at runtime.
Implementing CALL/CC using the `trivial' method would have
required rewriting much of the compiler.

If continuations are allocated in a heap, CALL/CC is easy.  If they
are made on a stack, CALL/CC requires more work.  The intermediate
language of the compiler is not really an issue.

By the way, there have been some advances in Scheme compilers since
1978.  Rabbit is not an `optimizing' compiler in the same sense that
Gambit (for example) is.
                               -Richard Kelsey