This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: V3 PATCH: __cxa_guard_acquire




--On Tuesday, November 26, 2002 12:03:20 AM -0800 Richard Henderson <rth@redhat.com> wrote:

On Mon, Nov 25, 2002 at 08:24:58PM -0800, Mark Mitchell wrote:
Yes, it really wants a 64-bit type.  It wants 8 bits for a flag, and
7 other bytes for use as appropriate on the particular OS; the idea
is that you might hide a mutex in those other 7 bytes.  You wouldn't
want to shrink this to 4 bytes on a 32-bit architecture; you want
4 bytes that you can use as the mutex.
If you want to be sure of a mutex, you have to do more.
PA-RISC, for instance, requires that it's mutexes be
16 *byte* aligned.
Right. The idea was that in that case you'd put an index of some sort
into the spare seven bytes; perhaps a pointer to the mutex in that case.
(HPUX even needs some wider mutexes on IPF, if I recall correctly.)

The 64-bit choice was what people thought made sense; it's big enough
to be useful on lots of platforms. If we don't do that, we have to
actually define this for each platform, which is, if nothing else,
a lot of thought for a very minor issue, since 64 bits is always
going to be enough to encode at least an index that refers to the
mutex you want.

A way to get a 64-bit type that is more reliable than "__attribute__((mode(__DI__)))" is probably the right thing. Otherwise,
we should probably just use "long long". (Is that not 64 bits on any
of our major platforms?)

Matt, Jason, and Nathan might have opinions, or better recollections
of the ABI committee's thoughts.

--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]