[Top][All Lists]

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

A different stack discipline

From: Mikael Djurfeldt
Subject: A different stack discipline
Date: Wed, 31 Oct 2018 21:55:06 +0100

I've looked a little at the Guile vm and compiler.

What a beautiful work! It also has very nicely written documentation. Very impressive!

Here's an idea/question:

SICP describes a register machine with a stack discipline which is different from most machine models in that it doesn't have a call instruction which pushes the PC onto the stack and a return instruction which pops it. Instead it has a continue register: When calling a subroutine, you load the continue register with the continuation of the subroutine (as described here: ). A subroutine ends with a branch to its continuation (stored in the continue register).

It seems to me that this 1. is natural to scheme since tail recursion doesn't need to be handled differently than ordinary calls, 2. that it fits the Guile compiler nicely with its CPS soup and 3. that it possibly could save vm instructions and stack space.

Could it be a good idea to switch over to the SICP stack discipline in the vm?

Best regards,
Mikael D.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]