[#25936] [Bug:1.9] [rubygems] $LOAD_PATH includes bin directory — Nobuyoshi Nakada <nobu@...>

Hi,

10 messages 2009/10/05

[#25943] Disabling tainting — Tony Arcieri <tony@...>

Would it make sense to have a flag passed to the interpreter on startup that

16 messages 2009/10/05

[#26028] [Bug #2189] Math.atanh(1) & Math.atanh(-1) should not raise an error — Marc-Andre Lafortune <redmine@...>

Bug #2189: Math.atanh(1) & Math.atanh(-1) should not raise an error

14 messages 2009/10/10

[#26222] [Bug #2250] IO::for_fd() objects' finalization dangerously closes underlying fds — Mike Pomraning <redmine@...>

Bug #2250: IO::for_fd() objects' finalization dangerously closes underlying fds

11 messages 2009/10/22

[#26244] [Bug #2258] Kernel#require inside rb_require() inside rb_protect() inside SysV context fails — Suraj Kurapati <redmine@...>

Bug #2258: Kernel#require inside rb_require() inside rb_protect() inside SysV context fails

24 messages 2009/10/22

[#26361] [Feature #2294] [PATCH] ruby_bind_stack() to embed Ruby in coroutine — Suraj Kurapati <redmine@...>

Feature #2294: [PATCH] ruby_bind_stack() to embed Ruby in coroutine

42 messages 2009/10/27

[#26371] [Bug #2295] segmentation faults — tomer doron <redmine@...>

Bug #2295: segmentation faults

16 messages 2009/10/27

[ruby-core:26144] Re: A challenge: Enumerator#next in JRuby

From: Charles Oliver Nutter <headius@...>
Date: 2009-10-17 20:31:57 UTC
List: ruby-core #26144
On Sat, Sep 26, 2009 at 6:38 AM, Tanaka Akira <akr@fsij.org> wrote:
> In general, internal iterator is easier to implement. =C2=A0This
> is why Ruby uses internal iterator long time. =C2=A0Although
> Fiber based external iterator is slower than ideal, it makes
> many internal iterators usable as external iterator without
> effort.

An update on this!

I have posted more information in JRuby's bug here:
http://jira.codehaus.org/browse/JRUBY-3964

At the moment, we have been unable to find a way to make "nexting"
threads work properly without a hard reference to the original
Enumerator, which means the Enumerator lives forever. I have described
a possible solution in the bug, but we have not implemented it yet.

I also asked JVM experts about this, and there is no way in any JVM to
mark a thread as non-rooting. The good reason for this is that it
could cause objects the thread references to suddenly GC while the
thread is executing, which would be catastrophic.

I also described in the bug why even the best solution for JRuby may
be unsatisfactory. It is looking likely at this point that we may
support only core-class enumerables and enumerables that implement
Akira's protocol in JRuby 1.4, since we can't ship a version that
spins up immortal threads for every Enumerator#next.

I am also starting to suspect that a protocol like Akira's may be the
*ONLY* way to reliably implement external enumeration on runtimes that
don't provide coroutines and that do not allow non-rooting threads. I
also suspect there may be object reference issues even on MRI, since
marking a thread as non-rooting is a very coarse-grained solution,
especially if objects are created only in the enumerating thread/fiber
and you want them to stay alive.

Bottom line once again: It may not be possible to support
Enumerator#next without requiring a lightweight enumerator protocol in
JRuby.

- Charlie

In This Thread