Re: Implementation of true closures

"Basile Starynkevitch \[news\]" <>
6 Feb 2005 15:01:30 -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: "Basile Starynkevitch \[news\]" <>
Newsgroups: comp.compilers
Date: 6 Feb 2005 15:01:30 -0500
Organization: - Ours
References: 05-02-021
Keywords: VM
Posted-Date: 06 Feb 2005 15:01:30 EST

On 2005-02-04, 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.

IIRC, there are VM efforts for Ruby, like
and PArrot. also see

> 1) Using frame on the heap instead of the stack.

This actually has 2 variants (depending on what you call "the stack" -
I assume it is here the C machine call stack): 1 Allocate each Ruby
frame individually on the heap, in a continuation passing style (See
Appel's book "compiling with continuations" for mre). But this means a
big allocation rate, and requires a good garbage collector. 2 Allocate
each Ruby frame in a Ruby stack (which itself may -or not- be an
object in the ruby heap).

> 2) Using setjmp/longjmp and saving state across procedure calls.

    This is what Ruby is doing now (see file ruby/eval.c)

email: basile<at>starynkevitch<dot>net
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Fa´encerie, 92340 Bourg La Reine, France

Post a followup to this message

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