[plt-scheme] compiler/zo-parse questions

From: Casey Klein (clklein at eecs.northwestern.edu)
Date: Thu Apr 15 16:13:10 EDT 2010

On Thu, Apr 15, 2010 at 2:42 PM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> You might want to read Casey's master's paper for some of this detail
> (there should be a journal paper at some point that expands on this
> too). It explains the mzscheme machine in more detail.
> On Thu, Apr 15, 2010 at 2:37 PM, Danny Yoo <dyoo at cs.wpi.edu> wrote:
>> I'm working on a project involving compiler/zo-parse,
>>    http://docs.plt-scheme.org/mzc/decompile.html
>> I'm trying to understand what max-let-depth is used for; it exists
>> under the toplevel, module, and lambda forms.  How does the mzscheme
>> runtime use this value?
> The max-let-depth has to be a number larger than the amount of stack
> that the machine needs to push to evaluate that function (or module
> body, etc) or else the machine will crash (since it believes the
> number). The byte code verifier ensures the number is correct before
> running the bytecode.

As you might expect, max-let-depth doesn't include the space consumed
by the functions that the expression calls.

>> There's also a curious note for several of the forms with the
>> following structure:
>>    After <X> is evaluated, the stack is restored to its depth from
>> before evaluating <X>.
>> I don't understand this yet.  I suspect that, under some
>> implementations, a frame is pushed onto the stack to make it possible
>> to capture the current continuation, and the note is saying what
>> requirements are necessary to preserve tail calls.  Is that the way to
>> interpret the comment?
> Sorry, I'm not sure about this one, but I agree it does sound like
> something to do with tail calls.

It's just saying that the stack is popped after evaluating a non-tail
expression. Take the `let-one' form for example. Evaluating the rhs
sub-expression may push values on the stack, but those values are
popped before control reaches the body sub-expression.

Posted on the users mailing list.