[#1551] Hashes as keys — "Nathaniel Talbott" <nathaniel@...>

I was just playing around with Hash#hash and discovered that you can't use a

13 messages 2003/09/23

Re: [BUG] Additional info regarding ruby-talk:66239

From: ts <decoux@...>
Date: 2003-09-03 12:30:14 UTC
List: ruby-core #1503
 [[ followup in ruby-core ]]

 Well, the old problem

>>>>> "t" == ts  <decoux@moulon.inra.fr> writes:
t> Not really sure, but seems to be a bug in gcc : someone can test it with
t> another compiler ?

t>  An example to see the problem (ruby-1.8.0, gcc 3.2 Redhat 8)

[...]

t> svg% cat b.rb
t> #!/usr/bin/ruby
t> thread_block= Proc.new do
t>    1.upto(20000) do
t>       a = {1=>12}
t>    end
t>   Thread.new &thread_block
t> end

t> 1.upto(120) do |i|
t>    Thread.new &thread_block
t> end
t> p "END"
t> Thread.stop
t> svg% 

 in eval.c (thread_mark) there is

    frame = th->frame;
    while (frame && frame != top_frame) {
	frame = ADJ(frame);
	rb_gc_mark_frame(frame);
	if (frame->tmp) {
	    struct FRAME *tmp = frame->tmp;

	    while (tmp && tmp != top_frame) {
		tmp = ADJ(tmp);
		rb_gc_mark_frame(tmp);
		tmp = tmp->prev;
	    }
	}
	frame = frame->prev;
    }

 If I've well understood ADJ(frame) is used to adjust the value of frame if
 it's in the copied stack, no ?

 Now rb_gc_mark_frame(frame) will mark frame->argv, but if frame->argv is
 also in the copied stack, ruby must mark ADJ(frame->argv) rather than
 frame->argv, no ?


Guy Decoux




In This Thread

Prev Next