[#13842] Better introspection for Frames, Thread, and enhancing binding. — "Rocky Bernstein" <rocky.bernstein@...>
The below is a little long. So here's a summary.
Rocky Bernstein wrote:
Ryan Davis wrote:
Ryan Davis wrote:
[#13851] Array#flatten works quadratic time on length of resulting array. It could be linear — "Voroztsov Artem" <artem.voroztsov@...>
I encountered problem with Array#flatten slowness (it can be much
Voroztsov Artem wrote:
2007/12/3, Charles Oliver Nutter <charles.nutter@sun.com>:
2007/12/3, Voroztsov Artem <artem.voroztsov@gmail.com>:
Hi,
Hi,
2007/12/4, Nobuyoshi Nakada <nobu@ruby-lang.org>:
Hi,
Hi,
[#13854] A little concern about m17n — Daniel DeLorme <dan-ml@...42.com>
I know it's kinda late to make any changes to the 1.9 roadmap, so I'm
[#13885] Idea: always yield current thread to Thread.new — "Berger, Daniel" <Daniel.Berger@...>
Hi,
[#13887] Can we foresee any big changes for Ruby in year 2008? — "Song Ma" <songmash@...>
Hi,
[#13889] Continuations on dead threads crash 1.8.6 and 1.6.8 — Brent Roman <brent@...>
[#13893] How to have fine grain control over GL in C extensions — hemant <gethemant@...>
Hi,
On Dec 6, 2007 6:35 PM, hemant <gethemant@gmail.com> wrote:
[#13897] issue with Date class freeze — "Christopher Gill" <gilltots@...>
Hello all,
[#13903] Clarification of retry change — Charles Oliver Nutter <charles.nutter@...>
Matz confirmed that retry-outside-rescue will no longer work, but I
Hi,
SASADA Koichi wrote:
On Dec 7, 2007 12:48 AM, Charles Oliver Nutter <charles.nutter@sun.com> wrote:
Brian Mitchell wrote:
[#13908] What's the status of compiler/compiling on windows? — Gonzalo Garramu <ggarra@...>
Hi,
Nobuyoshi Nakada wrote:
T24gRGVjIDcsIDIwMDcgODoyMSBBTSwgR29uemFsbyBHYXJyYW11w7FvIDxnZ2FycmFAYWR2YW5j
Hi Luis
On Dec 12, 2007 4:05 PM, Joe Swatosh <joe.swatosh@gmail.com> wrote:
> This was discussed in other thread in ruby-talk, but just to summarize:
Hi,
On Dec 12, 2007 5:00 PM, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:
On Dec 12, 2007 1:55 PM, Austin Ziegler <halostatue@gmail.com> wrote:
[#13916] Changes in C API of Ruby 1.9 — hemant <gethemant@...>
Hi,
> -----Original Message-----
[#13961] Error while bulding Ruby 1.9 from snapshot 2007/12/09 — Wolfgang Nádasi-Donner <ed.odanow@...>
[#13969] redefineable not operator — David Flanagan <david@...>
Matz,
David Flanagan wrote:
Hi,
Yukihiro Matsumoto wrote:
Hi,
Yukihiro Matsumoto wrote:
murphy wrote:
Hi,
[#13989] Compliment to rb_thread_blocking_region() ? — "Tony Arcieri" <tony@...>
The rb_thread_blocking_region() appears to allow releasing the GIL and
On Tue, 11 Dec 2007 06:41:56 +0900, "Tony Arcieri" <tony@clickcaster.com> wrote:
On Dec 10, 2007 3:49 PM, MenTaLguY <mental@rydia.net> wrote:
[#13997] Output of "ruby --help" looks not correct for Ruby 1.9 — Wolfgang Nádasi-Donner <ed.odanow@...>
Good morning!
[#13998] Array#pack and String#unpack documentation — "Gary Wright" <radar2002@...>
In working with Array#pack and String#unpack today, I found
Hi,
On Dec 11, 2007, at 9:10 AM, Yukihiro Matsumoto wrote:
[#14042] Fix e2mmap.rb for 1.9 — Eric Hodel <drbrain@...7.net>
E2MM.Raise complains about $! being read-only now, and E2MM is used by
On Dec 12, 2007, at 16:19 PM, Dave Thomas wrote:
Dave Thomas wrote:
Hello Dave,
[#14083] multibyte characters in curses — "Michal Suchanek" <hramrach@...>
Hello,
[#14086] attr_accessor for question methods (?) — Trans <transfire@...>
Like to make a small suggestion for 1.9. It would be great if we could
[#14102] Small (hopefully) problem with RDoc (Ruby 1.9) — Wolfgang Nádasi-Donner <ed.odanow@...>
Good morning!
I made some tests, unfortunately the debugger crashed, so I
[#14111] What does volatile assignment of *pos in rb_thread_s_new() do? — Brent Roman <brent@...>
[#14118] Enumerable#uniq, anybody? — Martin Duerst <duerst@...>
I have just tried to use zip followed by uniq in a 1.9 context.
[#14123] Some Ruby 1.9 loose ends to tie up — David Flanagan <david@...>
Matz,
Hi,
Yukihiro Matsumoto wrote:
Hi,
SASADA Koichi wrote:
[#14126] Curious warning with IO.popen on Windows — "Berger, Daniel" <Daniel.Berger@...>
Hi all,
[#14130] Another last-minute Ruby 1.9 question — David Flanagan <david@...>
Here's another last-minute question, probably for Matz or Nobu...
[#14139] String#% bug on Windows? — "Berger, Daniel" <Daniel.Berger@...>
Hi all,
[#14140] rest argument able to duplicate/replace local argument bug? — Thomas Enebo <Thomas.Enebo@...>
This is a bug right?
[#14147] named captures assigning to local variables — David Flanagan <david@...>
I've just been browsing ruby-dev. For an english speaker, it is kind of
In article <47686B87.7050609@davidflanagan.com>,
Thank you for the clarification, akr. I'm embarassed to say that it didn't
If I may, have a proposal. My apologies if this has already been
David Flanagan wrote:
In article <476A087E.3070000@davidflanagan.com>,
How about making the return value an array of the captured strings, or nil
In article <S2445477AbXLTQsI/20071220164808Z+24367@swip003.ftl.affinity.com>,
Tanaka Akira wrote:
Attached is a variation on my patch that makes it return $~ instead of
Hi --
David A. Black wrote:
[#14149] Experimental PATCH to improve thread performance — Brent Roman <brent@...>
The attached patch against Ruby 1.8.6-p110 improves the performance of
Brent Roman wrote:
Brent Roman wrote:
On Sat, Dec 22, 2007 at 11:07:25PM +0900, Charles Oliver Nutter wrote:
Sylvain Joyeux wrote:
> The rule of thumb is basically this: don't allow changing the path of a
Sylvain Joyeux wrote:
On Thu, Dec 27, 2007 at 01:57:22AM +0900, Charles Oliver Nutter wrote:
Sylvain Joyeux wrote:
Brent Roman wrote:
Brent Roman wrote:
Brent Roman wrote:
Brent Roman wrote:
[#14175] xmlrpc/client ssl client auth — Jeremy Thurgood <jerith@...>
Good day,
[#14186] Rake 0.8.0 added to Ruby — Jim Weirich <jim.weirich@...>
Just a heads up here. I've added Rake (version 0.8.0 ... the latest)
Jim Weirich wrote:
Jim Weirich wrote:
On Dec 21, 2007 10:24 AM, Gonzalo Garramu=F1o <ggarra@advancedsl.com.ar> wr=
Jim Weirich wrote:
On Dec 21, 2007 12:28 PM, Dave Thomas <dave@pragprog.com> wrote:
On Dec 21, 2007 9:06 PM, Rick DeNatale <rick.denatale@gmail.com> wrote:
[#14203] Re: Problem with case statements — hemant kumar <gethemant@...>
[#14224] Status of two issues — Trans <transfire@...>
Will the #autoload require issue be addressed?
Hi,
[#14237] io.c patch for two encodings in file mode — David Flanagan <david@...>
The attached patch adds support for filemodes like "r:utf-8:iso-8859-15"
[#14251] Semantics of caller (was Re: Some Ruby 1.9 loose ends to tie up) — "Rocky Bernstein" <rocky.bernstein@...>
On Dec 21, 2007 8:56 PM, Charles Oliver Nutter <charles.nutter@sun.com>
Rocky Bernstein wrote:
[#14280] Block-local variables - obsolete? — murphy <murphy@...>
hello!
Only block parameters are now always local to the block; variables
Charles Oliver Nutter wrote:
[#14286] Why is Array not Comparable — Martin Duerst <duerst@...>
I just bumped into this:
At 10:40 07/12/23, Rick DeNatale wrote:
[#14303] IRHG - GC Memory Fragmentation? — Charles Thornton <ceo@...>
While working on Chapter 05 and referencing various works
Ryan Davis wrote:
Ryan Davis wrote:
[#14335] Many external symbols _without_ prefix in libruby object file — Tadashi Saito <shiba@...2.accsnet.ne.jp>
Hi all,
[#14364] RDoc: [FATAL] failed to allocate memory — Martin Duerst <duerst@...>
With revision 14590, I suddenly get an error when I do "make install"
On Dec 24, 2007 9:51 AM, Martin Duerst <duerst@it.aoyama.ac.jp> wrote:
[#14367] replace csv.rb with fastercsv.rb — "NAKAMURA, Hiroshi" <nakahiro@...>
-----BEGIN PGP SIGNED MESSAGE-----
On Dec 24, 2007, at 3:34 AM, NAKAMURA, Hiroshi wrote:
On Dec 24, 2007, at 1:16 PM, James Gray wrote:
James Gray wrote:
[#14378] module_eval change between ruby1.8 & ruby 1.9. Is it intentional ? — Frederick Cheung <frederick.cheung@...>
Hi,
[#14389] pre-release note for the christmas release. — Yukihiro Matsumoto <matz@...>
Hi,
[#14398] Timeout.timeout expires early - breaks RubyGems — Eric Hodel <drbrain@...7.net>
Sometimes Timeout.timeout expires early. I see this with `gem
On Dec 24, 2007, at 16:36 PM, Eric Hodel wrote:
On Dec 24, 2007, at 17:14 PM, Eric Hodel wrote:
[#14418] Base64 not there makes Rails 2.0.2 fail to load in 1.9.0 — Richard Kilmer <rich@...>
Just re-built latest svn of 1.9.0 and base64.rb is removed. Its
On Dec 25, 2007, at 07:03 AM, Richard Kilmer wrote:
Eric Hodel wrote:
On Dec 25, 2007, at 13:35 PM, Dave Thomas wrote:
On Dec 26, 2007, at 06:16 AM, Dave Thomas wrote:
Richard Kilmer wrote:
Charles Oliver Nutter wrote:
On Dec 26, 2007 1:01 AM, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:
hemant wrote:
M. Edward (Ed) Borasky wrote:
Gonzalo Garramu wrote:
M. Edward (Ed) Borasky wrote:
[#14440] Odd situation with mingw, readline and readline tests. — "Luis Lavena" <luislavena@...>
Hello again,
[#14497] Status of Event Driven Network Programming Libraries in 1.9 — hemant <gethemant@...>
Hi,
[#14501] Should Ruby1.9 default program suffix be changed? — "Rick DeNatale" <rick.denatale@...>
Having seen several posts on various ruby related forum from folks who
Rick DeNatale wrote:
Dave Thomas schrieb:
On Dec 27, 2007 8:37 PM, Dave Thomas <dave@pragprog.com> wrote:
[#14517] Invalid use of mktime() in Ruby 1.8/1.9 results in incorrect Time objects — Dirkjan Bussink <d.bussink@...>
Hello,
In article <7CE19CBC-71C5-48FE-A2E7-4FCE489A7090@gmail.com>,
In article <A389041B-BC9F-409F-80B4-09971F62B7DE@gmail.com>,
In article <945DBEDA-10F1-40D0-AF7E-CF82EFF627AC@gmail.com>,
[#14524] Zlib::Inflate changes to net/http.rb — Filipe Lautert <filipe@...>
[#14549] multibyte strings & bucket-of-bytes efficiency under 1.9.0 — khaines@...
Like everyone else, I've been testing my stuff under 1.9.0. In general,
Brent Roman wrote:
In article <14544702.post@talk.nabble.com>,
Hello Akira,
In article <6.0.0.20.2.20071231173234.0a28c170@localhost>,
At 01:54 08/01/02, Austin Ziegler wrote:
On Jan 3, 2008 1:04 AM, Martin Duerst <duerst@it.aoyama.ac.jp> wrote:
After reading this thread, and looking at the the title, let me make
On Thu, 3 Jan 2008, Rick DeNatale wrote:
[#14550] Ruby 1.9 and Unicode — Sam Ruby <rubys@...>
I've tried porting a few small codebases, and a few experiments, and
Sam Ruby wrote:
David Flanagan wrote:
> As well an explanation of the differences between the following two
[#14555] module_eval oddness on 1.9 — Frederick Cheung <frederick.cheung@...>
[#14564] locale in ruby — "Michal Suchanek" <hramrach@...>
Hello
At 07:55 07/12/30, Michal Suchanek wrote:
In article <6.0.0.20.2.20071231200106.0b1bfb00@localhost>,
At 14:17 08/01/01, Tanaka Akira wrote:
[#14568] Layout of includes in ruby 1.9 — Gonzalo Garramu <ggarra@...>
On Dec 29, 2007 2:39 AM, Gonzalo Garramu=F1o <ggarra@advancedsl.com.ar> wro=
Hello,
U.Nakamura wrote:
>>>>> "G" == Gonzalo Garramu=F1o?= <ISO-8859-1> writes:
ts wrote:
>>>>> "G" == Gonzalo Garramu=F1o?= <ISO-8859-1> writes:
ts wrote:
[#14569] Wide strings to ruby strings — Gonzalo Garramu <ggarra@...>
On Dec 29, 2007 2:58 AM, Gonzalo Garramu=F1o <ggarra@advancedsl.com.ar> wro=
Austin Ziegler wrote:
[#14602] RCR allow indexing last n items — "Michal Suchanek" <hramrach@...>
Hello
Hi --
On 30/12/2007, David A. Black <dblack@rubypal.com> wrote:
Hi --
On 31/12/2007, David A. Black <dblack@rubypal.com> wrote:
Hi --
On 31/12/2007, David A. Black <dblack@rubypal.com> wrote:
Hi --
[#14621] Module.new(&block) in Ruby 1.9 — murphy <murphy@...>
Hello!
This looks like a related bug with passing block arguments to
Cheah Chu Yeow wrote:
Hi,
>>>>> "S" == SASADA Koichi <ko1@atdot.net> writes:
Hi,
Hi,
Jeremy Kemper wrote:
On Tue, Apr 01, 2008 at 05:43:34PM +0900, ts wrote:
Sylvain Joyeux wrote:
About bug [#19304]
Sylvain Joyeux wrote:
> > Finally, I'm not sure my last mail actually reached the list. Guy: I
[#14639] Rexml and Ruby 1.9 — Sam Ruby <rubys@...>
Ticket: http://www.germane-software.com/projects/rexml/ticket/131
Experimental PATCH to improve thread performance
The attached patch against Ruby 1.8.6-p110 improves the performance of
multi-threaded applications, especially those that create helper threads
when the parent thread is deeply nested in its call stack.
Totally Bogus Benchmark script #1:
----------------------------
$depth = 0
def outer name
if ($depth+=1) < 2000
outer name
else
250.times {
Thread.new do
inner :inner, name, Thread.current
end.join
}
end
end
def inner innerName, outerName, parent
Thread.new do
parent.join
k = Proc.new {|n0, n1| q = n0.to_s << n1.to_s }
k[innerName, outerName]
end
end
outer :outer
---------------------
Equally Bogus Benchmark Script #2:
----------------------------
$depth = 0
def outer name
ball = Thread.current
inner = Thread.new Thread.current do | outer |
loop {
Thread.stop until (Thread.critical=true; ball == inner)
(ball=outer).run
}
end
2000.times {|i|
Thread.stop until (Thread.critical=true; ball == Thread.current)
(ball=inner).run
}
end
def recurse someArg
if ($depth+=1) < 2000
recurse 3.14159
else
outer :outer
end
end
recurse "top"
-------------------------------
On my 1.5 Ghz Centrino laptop, benchmark #1 executes about twice as fast
after the attached patch is applied. Benchmark #2 shows a 30% improvement.
Admittedly these benchmarks were contrived, as all benchmarks are,
to demonstrate situations where this patch would yield the greatest
performance
improvement. However, I don't believe there is any Ruby script that will
execute measurably slower or take more memory after this patch is applied.
(Yes, I'm challenging someone to prove me wrong there :-)
Unpatched, 'C' Ruby allows each thread's backtrace to chain up into the
frames of its parent, frozen at the time the child was first created.
This means that context switches require copying not only the active
thread's
frames, but all of the parent's as well. Further, creating new Proc
object's
in the child thread requires that "framedup()" copy the parent's frames as
well as the child's. Moreover, the frozen parent's stack keeps the garbage
collector from releasing objects referenced there, even after those
references are no longer present in the active parent thread as it
continues to execute (or dies).
This patch works by isolating each thread's stack from that of its parent.
There is still just one stack, but when a new thread is created, its current
"ruby_frame" is linked directly back to Ruby's "top_frame". Thus, each
thread
behaves as through it was started with its own empty stack. When a context
switch is performed, only the slice of the stack that is accessible by
the active
thread need by copied from the heap. Whenever it is necessary
to duplicate the active thread's frames, only those are copied, not the
parent's
as well. This saves both time and space. The only "cost" is an additional
pointer in the (already large) "struct thread"
If all this seems a bit too good to be true, it just might be.
I've tested the patch against our multi-threaded "killer" app that
managed to crash all unpatched versions of Ruby 1.6.8, 1.8.x, 1.9 and JRuby.
If you've got a multi-threaded test or application, I invite you to
try it against this patch. Feedback would be very much appreciated.
Yes, there are a couple side effects:
1) ruby backtraces from child threads will now end at the thread's
creation.
Frames from other thread's will no longer be included in any backtrace.
I strongly suspect that Ruby 1.9, JRuby and other "native threaded"
Ruby implementations will behave this way as well.
(Can anyone confirm this?)
2) The 'C'-level stack will become corrupt as slices of it get copied
into and out of the heap. If you are using a 'C'-level debugger, its
backtrace command will get confused after it ascends the stack
into frames above those of the current Ruby thread.
Background:
I noticed this monolithic stack copying behavior while debugging a
couple segfault causing bugs I'd found in ruby 1.8.6 and 1.6.8.
These resulted in some instances when a child thread
outlived its parents. (See my recent post: Continuations on dead
threads ...)
In 1.6.8, the situation is worse. Without the appropriate version of
this patch,
the "newest" 1.6.8 snapshot will very occasionally crash running these
benchmarks.
The good news is that benchmark #1 runs 5 times faster after 1.6.8 is
patched :-)
Benchmark #2 runs twice as fast. If anyone, aside from me, is still
interested
in Ruby v1.6.8, just let me know. I'll be happy to post a patch for it.
- brent
Attachments (1)
Index: intern.h
===================================================================
RCS file: /home/cvs/ESP/gen2/software/ruby/ruby-1.8.6-mbari/intern.h,v
retrieving revision 1.1
diff -u -r1.1 intern.h
--- intern.h 18 Dec 2007 01:10:32 -0000 1.1
+++ intern.h 19 Dec 2007 00:17:06 -0000
@@ -238,7 +238,7 @@
/* gc.c */
NORETURN(void rb_memerror __((void)));
int ruby_stack_check _((void));
-int ruby_stack_length _((VALUE**));
+int ruby_stack_length _((VALUE *,VALUE**));
char *rb_source_filename _((const char*));
void rb_gc_mark_locations _((VALUE*, VALUE*));
void rb_mark_tbl _((struct st_table*));
Index: node.h
===================================================================
RCS file: /home/cvs/ESP/gen2/software/ruby/ruby-1.8.6-mbari/node.h,v
retrieving revision 1.1
diff -u -r1.1 node.h
--- node.h 18 Dec 2007 02:18:44 -0000 1.1
+++ node.h 19 Dec 2007 00:17:07 -0000
@@ -408,10 +408,8 @@
VALUE result;
- long stk_len;
- long stk_max;
- VALUE *stk_ptr;
- VALUE *stk_pos;
+ long stk_len, stk_max;
+ VALUE *stk_ptr, *stk_pos, *stk_start;
#ifdef __ia64
long bstr_len;
long bstr_max;
Index: gc.c
===================================================================
RCS file: /home/cvs/ESP/gen2/software/ruby/ruby-1.8.6-mbari/gc.c,v
retrieving revision 1.1
diff -u -r1.1 gc.c
--- gc.c 10 Nov 2007 01:08:15 -0000 1.1
+++ gc.c 19 Dec 2007 00:16:27 -0000
@@ -450,14 +500,14 @@
# define STACK_END (stack_end)
#endif
#if defined(sparc) || defined(__sparc__)
-# define STACK_LENGTH (rb_gc_stack_start - STACK_END + 0x80)
+# define STACK_LENGTH(start) ((start) - STACK_END + 0x80)
#elif STACK_GROW_DIRECTION < 0
-# define STACK_LENGTH (rb_gc_stack_start - STACK_END)
+# define STACK_LENGTH(start) ((start) - STACK_END)
#elif STACK_GROW_DIRECTION > 0
-# define STACK_LENGTH (STACK_END - rb_gc_stack_start + 1)
+# define STACK_LENGTH (STACK_END - (start) + 1)
#else
-# define STACK_LENGTH ((STACK_END < rb_gc_stack_start) ? rb_gc_stack_start - STACK_END\
- : STACK_END - rb_gc_stack_start + 1)
+# define STACK_LENGTH ((STACK_END < (start)) ? \
+ (start) - STACK_END : STACK_END - (start) + 1)
#endif
#if STACK_GROW_DIRECTION > 0
# define STACK_UPPER(x, a, b) a
@@ -481,17 +531,17 @@
#define GC_WATER_MARK 512
#define CHECK_STACK(ret) do {\
- SET_STACK_END;\
- (ret) = (STACK_LENGTH > STACK_LEVEL_MAX + GC_WATER_MARK);\
+ SET_STACK_END;\
+ (ret) = (STACK_LENGTH(rb_gc_stack_start) > STACK_LEVEL_MAX + GC_WATER_MARK);\
} while (0)
int
-ruby_stack_length(p)
- VALUE **p;
+ruby_stack_length(start, base)
+ VALUE *start, **base;
{
SET_STACK_END;
- if (p) *p = STACK_UPPER(STACK_END, rb_gc_stack_start, STACK_END);
- return STACK_LENGTH;
+ if (base) *base = STACK_UPPER(STACK_END, start, STACK_END);
+ return STACK_LENGTH(start);
}
int
@@ -1321,7 +1365,7 @@
garbage_collect()
{
struct gc_list *list;
- struct FRAME * volatile frame; /* gcc 2.7.2.3 -O2 bug?? */
+ struct FRAME *frame;
jmp_buf save_regs_gc_mark;
SET_STACK_END;
Index: eval.c
===================================================================
RCS file: /home/cvs/ESP/gen2/software/ruby/ruby-1.8.6-mbari/eval.c,v
retrieving revision 1.2
diff -u -r1.2 eval.c
--- eval.c 2007-09-22 17:01:50.000000000 -0700
+++ ../ruby-1.8.6-mbari/eval.c 2007-12-18 00:18:24.000000000 -0800
@@ -6509,6 +6509,7 @@
scope_dup(ruby_scope);
for (tag=prot_tag; tag; tag=tag->prev) {
+ if (tag->tag == PROT_THREAD) break;
scope_dup(tag->scope);
}
for (vars = ruby_dyna_vars; vars; vars = vars->next) {
@@ -10216,13 +10324,10 @@
rb_thread_save_context(th)
rb_thread_t th;
{
- VALUE *pos;
int len;
static VALUE tval;
- len = ruby_stack_length(&pos);
- th->stk_len = 0;
- th->stk_pos = pos;
+ len = ruby_stack_length(th->stk_start,&th->stk_pos);
if (len > th->stk_max) {
VALUE *ptr = realloc(th->stk_ptr, sizeof(VALUE) * len);
if (!ptr) rb_memerror();
@@ -11721,6 +11826,7 @@
th->result = 0;\
th->flags = 0;\
\
+ th->stk_start = rb_gc_stack_start;\
th->stk_ptr = 0;\
th->stk_len = 0;\
th->stk_max = 0;\
@@ -11932,6 +12038,15 @@
"can't start a new thread (frozen ThreadGroup)");
}
+ th->stk_start = /* establish start of new thread's stack */
+#if STACK_GROW_DIRECTION > 0
+ (VALUE *)ruby_frame;
+#elif STACK_GROW_DIRECTION < 0
+ (VALUE *)(ruby_frame+1);
+#else
+ (VALUE *)(ruby_frame+((VALUE *)(&arg)<rb_gc_stack_start))
+#endif
+
if (!thread_init) {
thread_init = 1;
#if defined(HAVE_SETITIMER) || defined(_THREAD_SAFE)
@@ -11977,6 +12092,8 @@
PUSH_TAG(PROT_THREAD);
if ((state = EXEC_TAG()) == 0) {
if (THREAD_SAVE_CONTEXT(th) == 0) {
+ ruby_frame->prev = top_frame; /* hide parent thread's frames */
+ ruby_frame->tmp = 0; /* <-- not sure whether this is necessary */
curr_thread = th;
th->result = (*fn)(arg, th);
}
@@ -12090,7 +12207,7 @@
rb_thread_t th = rb_thread_alloc(klass);
volatile VALUE *pos;
- pos = th->stk_pos;
+ pos = th->stk_pos; //brent@mbari.org wants to know what this assignment does?
rb_obj_call_init(th->thread, argc, argv);
if (th->stk_pos == 0) {
rb_raise(rb_eThreadError, "uninitialized thread - check `%s#initialize'",