At first, a question must be made, which is "why do I need to get rid
of the C stack"? The answer resides in the Perl 6 feature set, more
than anything else. My inspiration on this is the stackless python
project (which was not adopted by the mainstream python) because it
makes the support for continuations and co-routines much easier. It
would be possible to implement it using the C stack, but this would
require mixing the manipulation of the C stack with the manipulation
of the Perl 6 stack, which may be very complex. Let's think about the
gather/take operators. They may be called from a very deep level of
the stack. Mixing that with interpreted code and the C stack would be
very much complex.
The solution would be to simply remove the C stack from the
story. This would make a single frame stack to exist, and considering
it's separated from the C stack, it's more easily manipulated. But how
to implement a simple stackless C code that supports that? The
solution is actually quite simple and is completely inspired in the
stackless project. The key thing is, instead of calling a function,
you just prepare it by sending it to the interpreter. The "machine"
runs by iterating the messages and calling them. The
difference here is that: if this call would call another message,
instead of calling it directly, it push the call to the stack and
returns immediatly. The "machine" would again pop from the stack and
now it would call the deeper method, having the Perl stack complete
but without feeding the C stack.