RE: Atomic increment/decrement

"Robert Buck" <[email protected]> Thu, 18 Nov 2004 15:57:16 -0500
Newsgroups gmane.comp.lib.icu.general
Message-ID <EFEB6396440FB440ADD8A753B5530B9C0600FFFC@MESSAGE-AH.ad.mathworks.com>
 

>-----Original Message-----
>From: [email protected] 
>[mailto:[email protected]] On Behalf Of 
>Deborah Goldsmith
>Sent: Thursday, November 18, 2004 3:15 PM
>To: [email protected]
>Cc: George Rhoten; icu list
>Subject: Re: Atomic increment/decrement
>Actually, these functions are part of a small set that are 
>implemented via something in Darwin called the "comm page"; 
>the functions that live there can have CPU-model-dependent 
>implementations (e.g. one for G3/750, one for G4/7447A, one 
>for G4/7457, and so on). So copying them inline won't work (or 
>I'd have to worry about CPU model errata, etc.).
>
>Also, while Mac OS X runs only on PowerPC family processors, 
>Darwin runs on both PowerPC and Intel. ICU is integrated at 
>the Darwin level and it's a hard requirement that it work on 
>Intel in Darwin.

I think this can be done using inlined assembly. For instance, take a
look at how this is done in Linux. In fact, taking a look at the inline
assembly they have in Linux, which had been copyrighted by IBM by the
way, the inline assembly for both ppc and ppc64 are identical. I think
with a little preprocessor magic, you could provide support for GCC
inline assy on both Intel and PPC fairly easily. Who knows, you may be
able to even convince IBM to release the inline assembly to ICU under
the X license.

Here are the IBM people who authored the inline assembly I refer to:

 * Copyright (C) 2001 Paul Mackerras <[email protected]>, IBM
 * Copyright (C) 2001 Anton Blanchard <[email protected]>, IBM

--Bob