Index: src/OFBlock.m ================================================================== --- src/OFBlock.m +++ src/OFBlock.m @@ -179,21 +179,15 @@ if (block->isa == (Class)&_NSConcreteMallocBlock) { #if defined(OF_ATOMIC_OPS) of_atomic_inc_int(&block->flags); #else -# ifdef OF_THREADS unsigned hash = SPINLOCK_HASH(block); assert(of_spinlock_lock(&spinlocks[hash])); -# endif - block->flags++; - -# ifdef OF_THREADS assert(of_spinlock_unlock(&spinlocks[hash])); -# endif #endif } return block; } @@ -212,30 +206,22 @@ block->descriptor->dispose_helper(block); free(block); } #else -# ifdef OF_THREADS unsigned hash = SPINLOCK_HASH(block); assert(of_spinlock_lock(&spinlocks[hash])); -# endif - if ((--block->flags & OF_BLOCK_REFCOUNT_MASK) == 0) { -# ifdef OF_THREADS assert(of_spinlock_unlock(&spinlocks[hash])); -# endif if (block->flags & OF_BLOCK_HAS_COPY_DISPOSE) block->descriptor->dispose_helper(block); free(block); } - -# ifdef OF_THREADS assert(of_spinlock_unlock(&spinlocks[hash])); -# endif #endif } void _Block_object_assign(void *dst_, const void *src_, const int flags_) @@ -333,11 +319,11 @@ free(tmp); objc_registerClassPair((Class)&_NSConcreteMallocBlock); } #endif -#if !defined(OF_ATOMIC_OPS) && defined(OF_THREADS) +#if !defined(OF_ATOMIC_OPS) + (void)initialize { size_t i; for (i = 0; i < NUM_SPINLOCKS; i++) Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -58,11 +58,11 @@ struct pre_ivar { void **memchunks; size_t memchunks_size; int32_t retain_count; -#if !defined(OF_ATOMIC_OPS) && defined(OF_THREADS) +#if !defined(OF_ATOMIC_OPS) of_spinlock_t retain_spinlock; #endif }; /* Hopefully no arch needs more than 16 bytes padding */ @@ -146,11 +146,11 @@ ((struct pre_ivar*)instance)->memchunks = NULL; ((struct pre_ivar*)instance)->memchunks_size = 0; ((struct pre_ivar*)instance)->retain_count = 1; -#if !defined(OF_ATOMIC_OPS) && defined(OF_THREADS) +#if !defined(OF_ATOMIC_OPS) if (!of_spinlock_new(&((struct pre_ivar*)instance)->retain_spinlock)) { free(instance); @throw [OFInitializationFailedException newWithClass: self]; } #endif @@ -663,16 +663,14 @@ - retain { #if defined(OF_ATOMIC_OPS) of_atomic_inc_32(&PRE_IVAR->retain_count); -#elif defined(OF_THREADS) +#else assert(of_spinlock_lock(&PRE_IVAR->retain_spinlock)); PRE_IVAR->retain_count++; assert(of_spinlock_unlock(&PRE_IVAR->retain_spinlock)); -#else - PRE_IVAR->retain_count++; #endif return self; } @@ -685,22 +683,19 @@ - (void)release { #if defined(OF_ATOMIC_OPS) if (of_atomic_dec_32(&PRE_IVAR->retain_count) <= 0) [self dealloc]; -#elif defined(OF_THREADS) +#else size_t c; assert(of_spinlock_lock(&PRE_IVAR->retain_spinlock)); c = --PRE_IVAR->retain_count; assert(of_spinlock_unlock(&PRE_IVAR->retain_spinlock)); if (!c) [self dealloc]; -#else - if (--PRE_IVAR->retain_count <= 0) - [self dealloc]; #endif } - autorelease {