This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: eval.c
- To: Jost Boekemeier <jostobfe at calvados dot zrz dot TU-Berlin dot DE>
- Subject: Re: eval.c
- From: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Date: Tue, 18 Apr 2000 20:14:04 +0200 (MEST)
- cc: Guile Mailing List <guile at sourceware dot cygnus dot com>
Thanks for the answer.
On 18 Apr 2000, Jost Boekemeier wrote:
> Dirk Herrmann <dirk@ida.ing.tu-bs.de> writes:
>
> > Hi!
> >
> > in eval.c there is a cell 'undef_cell' defined:
> > static scm_cell undef_cell = { SCM_UNDEFINED, SCM_UNDEFINED };
> >
> > The problem is: what happens, if this cell is not aligned on a 64-Bit
> > boundary?
>
> Hä? What do you mean?
Every cell that you get via SCM_NEWCELL is guaranteed to be on a 8 byte
boundary. This guarantee is the reason, why SCM_NIMP works the way it is
implemented: x & 7 == 0 --> non immediate, x is a pointer to a cell.
In this case, the static variable scm_cell is placed in memory at an
arbitrary address at the will of the compiler, which will on most
architectures be 4-byte aligned, but not necessarily 8-byte
aligned. Thus, it can happen that the address of this pseudo cell is
something, for which SCM_NIMP might _not_ be fulfilled. Thus, if somebody
was to play around with that cell, like making a SCM value of the cell
address, an invalid SCM variable may be the result.
> > The only access is:
> > return SCM_CDRLOC (&undef_cell);
>
> Yep. It is used in the macro expander.
>
>
> > * Question: Is it really necessary to have a _cell_ here? It seems that
> > only the cdr is needed, and that it even doesn't matter if it really is a
> > valid cdr, i.e. at at valid cdr heap address. If so, I suggest to simply
> > use a single SCM variable, and call that undef_object.
>
>
> Take a look at `macroexp'.
Thanks for the hint. I will try to figure it out.
Best regards
Dirk Herrmann