From: Andy Wingo <wingo@pobox.com>
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: struct displacements
Date: Mon, 25 Jan 2010 15:55:27 +0100 [thread overview]
Message-ID: <m3k4v61bfk.fsf@pobox.com> (raw)
In-Reply-To: <87ljfms3hm.fsf@gnu.org> ("Ludovic Courtès"'s message of "Mon, 25 Jan 2010 14:44:53 +0100")
Hi Ludo' :)
On Mon 25 Jan 2010 14:44, ludo@gnu.org (Ludovic Courtès) writes:
> Andy Wingo <wingo@pobox.com> writes:
>
>> - GC_REGISTER_DISPLACEMENT (2*sizeof(scm_t_bits)); /* for the self data pointer */
>> - GC_REGISTER_DISPLACEMENT (2*sizeof(scm_t_bits)
>> - + scm_tc3_struct); /* for the vtable data pointer */
>> + /* The first word of a struct is equal to `SCM_STRUCT_DATA (vtable) +
>> + scm_tc3_struct', and `SCM_STRUCT_DATA (vtable)' is 2 words after VTABLE by
>> + default. */
>> + GC_REGISTER_DISPLACEMENT (2 * sizeof (scm_t_bits) + scm_tc3_struct);
>>
>> I'm pretty sure the first case is still needed, for instance
>> reallocation. It is, as the comment indicates, "for the self data
>> pointer" -- the second word of the object, which normally points to the
>> third word of the object, but for reallocated instances points to the
>> third word of *another* object.
>
> As an excuse, the comment was a bit too terse for me to understand, but
> I get your point now. However, it’s still unclear to me how an ‘s’
> field can point to something else than “self”.
Hm, I think you're right; the wording was not only terse but misleading.
It is "for the data pointer, which might point to another object's
data", or something like that. Nothing to do with `s' fields.
>> See my article on redefining classes for more info.
>
> By ‘self’ here, did you mean what’s known as ‘data’ on the diagrams at
> <http://wingolog.org/archives/2009/11/09/class-redefinition-in-guile>?
Yes indeed.
> PS: It would be really cool if this blog post were part of the “Data
> Representation” node of the manual. :-)
Heh, yeah. That whole chapter needs revision...
Andy
--
http://wingolog.org/
next prev parent reply other threads:[~2010-01-25 14:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-25 0:33 struct displacements Andy Wingo
2010-01-25 13:44 ` Ludovic Courtès
2010-01-25 14:55 ` Andy Wingo [this message]
2010-01-25 23:10 ` Ludovic Courtès
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=m3k4v61bfk.fsf@pobox.com \
--to=wingo@pobox.com \
--cc=guile-devel@gnu.org \
--cc=ludo@gnu.org \
/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).