logo       

Re: Compile Ruby Code?: msg#00067

lang.jruby.user

Subject: Re: Compile Ruby Code?

On 2/23/06, Yemi D. Bedu <yemi@xxxxxxxxxxxx> wrote:
> Hello,
> I was thinking about the method-dispatch thing before regarding
> compilation in ruby and jruby. On the jruby side, a custom java Dispatch
> class could be setup that housed an ArrayList of method defines per
> method. It would be bloated but allow for initial methods to be defined
...
This is essentially how it works now, with a map of names to method
impls. At invoke time, the method impl is looked up in the current
Object's class, superclasses, and containing scopes, and then invoked
against the object with the appropriate parameters. This is unlikely
to change much, though a faster and more elegant search heuristic
would be warranted here.

>
> The callcc stuff will just take tedious time to change over. The
> threading issue is similar and I really like the idea of a pool of
> threads handling initial threading of a particular scope call in jruby.
> I'll have to read the earlier points of why we are at the bottle neck of
> actually having it in place. I would sacrifice ultimate speed for a
> better than single thread yet highly stable solution. Thank you. Good
> day.

The current plan for making green threading and callcc work correctly
is a trampoline-style interpreter. Basically, after every interpreter
operation, control is returned to a single entity that represents the
green thread. The thread handles propagating exception calls,
returning values, and invoking methods. Above the green thread will
sit a thread scheduler and n native threads. As native threads are
available, and on an appropriate schedule based on green thread
priorities, the native threads will call something like "go()" on the
green threads. Each step will be an operation, be it a method
invocation or a step through the AST. This will allow a few native
threads to run multiple green threads and will also allow for callcc
to save current execution context and return to it as needed.

--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ jruby.sourceforge.net
Application Architect @ www.ventera.com


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise