Re: Implementation of true closures

"Basile Starynkevitch \[news\]" <basile-news@starynkevitch.net>
6 Feb 2005 15:01:30 -0500

          From comp.compilers

Related articles
Implementation of true closures rohitlodha@gmail.com (Rohit Lodha) (2005-02-03)
Re: Implementation of true closures anton@mips.complang.tuwien.ac.at (2005-02-06)
Re: Implementation of true closures eliotm@pacbell.net (Eliot Miranda) (2005-02-06)
Re: Implementation of true closures basile-news@starynkevitch.net (Basile Starynkevitch \[news\]) (2005-02-06)
| List of all articles for this month |
From: "Basile Starynkevitch \[news\]" <basile-news@starynkevitch.net>
Newsgroups: comp.compilers
Date: 6 Feb 2005 15:01:30 -0500
Organization: http://starynkevitch.net - Ours
References: 05-02-021
Keywords: VM
Posted-Date: 06 Feb 2005 15:01:30 EST

On 2005-02-04, Rohit Lodha <rohitlodha@gmail.com> 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
http://www.nongnu.org/carbone/
http://rubyforge.org/projects/bytecoderuby/ http://www.atdot.net/yarv/
and PArrot. also see
http://www.rubygarden.org/ruby?VirtualMachineOptions


> 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)


--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
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.