Re: Implementation of true closures

Eliot Miranda <>
6 Feb 2005 15:00:59 -0500

          From comp.compilers

Related articles
Implementation of true closures (Rohit Lodha) (2005-02-03)
Re: Implementation of true closures (2005-02-06)
Re: Implementation of true closures (Eliot Miranda) (2005-02-06)
Re: Implementation of true closures (Basile Starynkevitch \[news\]) (2005-02-06)
| List of all articles for this month |

From: Eliot Miranda <>
Newsgroups: comp.compilers
Date: 6 Feb 2005 15:00:59 -0500
Organization: SBC
References: 05-02-021
Keywords: VM
Posted-Date: 06 Feb 2005 15:00:59 EST

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

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.