|Implementation of true closures email@example.com (Rohit Lodha) (2005-02-03)|
|Re: Implementation of true closures firstname.lastname@example.org (2005-02-06)|
|Re: Implementation of true closures email@example.com (Eliot Miranda) (2005-02-06)|
|Re: Implementation of true closures firstname.lastname@example.org (Basile Starynkevitch \[news\]) (2005-02-06)|
|From:||Eliot Miranda <email@example.com>|
|Date:||6 Feb 2005 15:00:59 -0500|
Rohit Lodha wrote:
> Ruby has true closures and I am trying to implement a Virtual Machine
> for it. I have 2 options for effective implementation.
> 1) Using frame on the heap instead of the stack.
> 2) Using setjmp/longjmp and saving state across procedure calls.
> If anybody has a previous experience on any of the above techiques or
> perhaps many others, please share your experiences.
This workshop paper
describes my implementation for Smalltalk, which is an optimization of
the Deutsch Schiffman mechanism for Smalltalk-80. This uses a
compilation model typical of lisp implementations where closed-over
temporary variables accessed from multiple scopes are held in a
garbage-collected array on the heap, one per dynamic scope). But
notional heap contexts are in fact mapped to stack frames, so that one
has a virtual heap-resident object-per-frame call stack and heap objects
are only created when stack frames are accessed as such e.g. by a debugger.
Eliot Miranda Smalltalk - Scene not herd
Return to the
Search the comp.compilers archives again.