guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Goops & Valgrind


From: Mikael Djurfeldt
Subject: Re: Goops & Valgrind
Date: Tue, 19 Aug 2008 13:53:51 +0200

2008/8/16 Han-Wen Nienhuys <address@hidden>:
> Running the test suite through valgrind, I get some fishy errors.
>
> Can someone shed a light on this?  The culprit seems to be
>
> #define SCM_NUMBER_OF_SLOTS(x) \
>  ((SCM_STRUCT_DATA (x)[scm_struct_i_n_words]) - scm_struct_n_extra_words)
>
> where scm_struct_i_n_words is -2

This is severely bitrotted code.  There are at least three errors
associated with this:

1. scm_struct_i_n_words is an offset in a vtable (a GOOPS class is a
vtable), but %fast-slot-ref passes an instance

2. The value at this location apparently now is the number of slots
with nonnegative index (contrary to what is said by some comment in
the code), so scm_struct_n_extra_words should not be subtracted

3. It's not sensible to access slots this way (as in
%fast-slot-ref/set!) since different kinds of slots have different
representations of their data.  However, when working with the MOP (as
active-slot.scm does) some kind of more direct or raw  access to the
slots may be required.

Unfortunately, I don't have time to fix this.  I suggest that some
Guile developer removes %fast-slot-ref/set! and supplies some other
(more clean) way of supporting the code in active-slot.scm.  Also,
make sure to check that these primitives are not used anywhere else.

I apologize if I'm the reason for parts or all of this mess.

Best regards,
Mikael D.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]