On 11/12/2014 10:18 PM, Iain Sandoe wrote: > * config/darwin/host-config.h New. > * config/darwin/lock.c New. > * configure.tgt (DEFAULT_X86_CPU): New, (target): New entry for darwin.
Looks pretty good. > +# ifndef USE_ATOMIC > +# define USE_ATOMIC 1 > +# endif Why would USE_ATOMIC be defined previously? > +inline static void LockUnlock(uint32_t *l) { > + __atomic_store_4((_Atomic(uint32_t)*)l, 0, __ATOMIC_RELEASE); > +} Gnu coding style, please. All through the file here. > +# define LOCK_SIZE sizeof(uint32_t) > +# define NLOCKS (PAGE_SIZE / LOCK_SIZE) > +static uint32_t locks[NLOCKS]; Um, surely not LOCK_SIZE, but CACHELINE_SIZE. It's the granularity of the target region that's at issue, not the size of the lock itself. > +#if USE_ATOMIC > + LockLock (&locks[addr_hash (ptr, 1)]); > +#else > + OSSpinLockLock(&locks[addr_hash (ptr, 1)]); > +#endif Better to #define LockLock OSSpinLockLock within the area above, so as to avoid the ifdefs here. r~