guile-devel
[Top][All Lists]
Advanced

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

Re: [BDW-GC] Static cell/string/symbol allocation


From: Ken Raeburn
Subject: Re: [BDW-GC] Static cell/string/symbol allocation
Date: Tue, 13 Jan 2009 15:57:04 -0500

On Jan 12, 2009, at 19:04, Ludovic Courtès wrote:
union {
 scm_t_cell cell[2];
 double d_for_alignment;
 long long ll_for_alignment;
}

The issue with this is that there's nothing telling us how compilers
should behave when encountering this.  Even if the underlying hardware
has a preferred alignment for these types, the compiler doesn't have to honor it (on some RISC architectures the alignment can be mandated, and
failing to honor them would lead to SIGBUS).  So that appears to be
quite unreliable.

That's true, there's no guarantee at all. Though I do think Guile is probably making a bunch of other assumptions about what the compiler or OS will do, especially when it comes to garbage collection, equality checks, stuff like that. There's a difference between what's guaranteed by the language specs and what's reliable in the types of platforms we'd care about. For many of them, I think the above will cause the desired alignment; I don't know about all of them.

... with code that just keeps using dynamic allocation when
`SCM_ALIGNED' is undefined.

That works too. The compilers and platforms of greatest interest for the biggest part of the user community (GCC and Visual Studio, and then...what else?) are likely to provide some facility for this, so the performance gain probably only fails to be realized for a small part of the audience.

Ken



reply via email to

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