unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "Mikael Djurfeldt" <mikael@djurfeldt.com>
To: hanwen@xs4all.nl
Cc: guile-devel@gnu.org
Subject: Re: Goops & Valgrind
Date: Tue, 19 Aug 2008 13:53:51 +0200	[thread overview]
Message-ID: <66e540fe0808190453s568802b3x9dbe1808407a47fd@mail.gmail.com> (raw)
In-Reply-To: <g85nrb$ic3$1@ger.gmane.org>

2008/8/16 Han-Wen Nienhuys <hanwen@xs4all.nl>:
> 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.




  parent reply	other threads:[~2008-08-19 11:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-16  5:15 Goops & Valgrind Han-Wen Nienhuys
2008-08-18 15:50 ` Ludovic Courtès
2008-08-19  8:58   ` Han-Wen Nienhuys
2008-08-18 18:58 ` Andy Wingo
2008-08-22 19:00   ` Ludovic Courtès
2008-09-11 21:06   ` Neil Jerram
2008-09-12 19:22     ` Andy Wingo
2008-09-14 12:06       ` Neil Jerram
2008-09-14 17:03         ` Neil Jerram
2009-01-04 12:29         ` Andy Wingo
2009-01-04 21:01           ` Neil Jerram
2009-01-04 23:36             ` Neil Jerram
2008-09-16  7:25     ` Mikael Djurfeldt
2008-09-16  9:29       ` Neil Jerram
2008-08-19 11:53 ` Mikael Djurfeldt [this message]
2008-08-19 15:19   ` Han-Wen Nienhuys

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=66e540fe0808190453s568802b3x9dbe1808407a47fd@mail.gmail.com \
    --to=mikael@djurfeldt.com \
    --cc=guile-devel@gnu.org \
    --cc=hanwen@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).