[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: struct displacements
From: |
Ludovic Courtès |
Subject: |
Re: struct displacements |
Date: |
Tue, 26 Jan 2010 00:10:27 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Hey,
Andy Wingo <address@hidden> writes:
> On Mon 25 Jan 2010 14:44, address@hidden (Ludovic Courtès) writes:
>
>> Andy Wingo <address@hidden> 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.
OK, done:
http://git.sv.gnu.org/cgit/guile.git/commit/?id=227eff6a77dd58d64775fe91ae0f1596bfe3371b
Thanks,
Ludo'.