[#3419] Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...>

Hello list,

19 messages 2004/09/17
[#3422] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3423] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 12:01, ts wrote:

[#3424] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3425] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 12:37, ts wrote:

[#3426] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3428] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 13:05, ts wrote:

[#3429] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

Re: [PATCH] dir.c --- Dir.chdir error handling

From: ts <decoux@...>
Date: 2004-09-16 08:59:30 UTC
List: ruby-core #3416
>>>>> "Y" == Yukihiro Matsumoto <matz@ruby-lang.org> writes:

 There are 2 problems

Y> Anyway, if assignment to tmp solves the potential problems, I'd happy
Y> to change.  Your code has two changes from gc.c:

 first I'm stupid

 The assignment with `tmp' work if it's written like this

    static void
    mark_locations_array(x, n)
        register VALUE *x;
        register long n;
    {
        VALUE tmp;

        while (n--) {
	    tmp = *x;
            if (is_pointer_to_heap((void *)*x)) {
                rb_gc_mark(tmp);
            }
            x++;
        }
    }

 To give you an example

 * 1.8.0 with the old mark_locations_array() give (without `tmp')

.L166:
	subl	$12, %esp
	pushl	(%edi)
	call	rb_gc_mark

 it retrieve the content of %edi (this is this content which was modified) 

  * 1.8.0 with `tmp' give

.L166:
	subl	$12, %esp
	pushl	%ecx
.LCFI105:
	call	rb_gc_mark

 it re-use %ecx


Y>   * assignment to tmp from *x
Y>   * call rb_gc_mark() instead of gc_mark()

 The patch that you have written, for 1.8.1,  is *THE RIGHT* way to do. 
 I can, if you want, give the complete example to show :

   1) the patch with `tmp' just hide the problem

   2) the right patch is to call MARK_FRAME_ADJ() because it has

         VALUE *start = ADJ(frame->argv);


 My example was just to show that you can make a small modification in a
 function (like add tmp), which give you the illusion that you correct a
 bug when in reality it just hide the problem. The problem in this case was
 with frame->argv


Guy Decoux

In This Thread