Mon Jan 25 07:49:14 CET 2010

Dybvig-style VM

See presentation in [1].

It seems easier to use a full bootstrap from scheme to do development
and testing comfortably in PLT Scheme.

Write a VM + compiler in scheme.
Write a bootstrap / JIT compiler for the VM in scheme -> C/LLVM/ASM.


   + a single stack for static and dynamic chains makes function calls
     and variable references cheap.

   - boxes for assignment
   - display closures (flat closures) to eliminate environment 
   - stack copying for continuations

Question: how does ANF relate to this?

At first sight, ANF seems to work well for a stack-oriented approach,
as it gives an elegant way to preserve proper tail calls.

  * Une does not need to worry about proper calls when evaluating
    expressions, as they are never in tail position.

  * The tail call in a let expression can clean up the lexical
    environment after collecting arguments to a function but before
    performing the call, as all closures that use these variables use
    heap-allocated copies.

I think I'm starting to see it.  Primitive forms will be `let1'
(aggregated into `let*', and representing `begin2'), `if', variable
reference (either from the stack or from a display closure), primitive
application and closure application.

[1] http://icfp06.cs.uchicago.edu/dybvig-talk.pdf