162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
#endif
static struct {
Class isa;
} alloc_failed_exception;
#ifndef OF_HAVE_ATOMIC_OPS
# define NUM_SPINLOCKS 8 /* needs to be a power of 2 */
# define SPINLOCK_HASH(p) ((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1)
static OFSpinlock blockSpinlocks[NUM_SPINLOCKS];
static OFSpinlock byrefSpinlocks[NUM_SPINLOCKS];
#endif
void *
_Block_copy(const void *block_)
{
struct Block *block = (struct Block *)block_;
|
|
|
|
|
|
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
#endif
static struct {
Class isa;
} alloc_failed_exception;
#ifndef OF_HAVE_ATOMIC_OPS
# define numSpinlocks 8 /* needs to be a power of 2 */
# define SPINLOCK_HASH(p) ((uintptr_t)p >> 4) & (numSpinlocks - 1)
static OFSpinlock blockSpinlocks[numSpinlocks];
static OFSpinlock byrefSpinlocks[numSpinlocks];
#endif
void *
_Block_copy(const void *block_)
{
struct Block *block = (struct Block *)block_;
|
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
|
}
}
@implementation OFBlock
+ (void)load
{
#ifndef OF_HAVE_ATOMIC_OPS
for (size_t i = 0; i < NUM_SPINLOCKS; i++)
if (OFSpinlockNew(&blockSpinlocks[i]) != 0 ||
OFSpinlockNew(&byrefSpinlocks[i]) != 0)
@throw [OFInitializationFailedException
exceptionWithClass: self];
#endif
#ifdef OF_APPLE_RUNTIME
|
|
|
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
|
}
}
@implementation OFBlock
+ (void)load
{
#ifndef OF_HAVE_ATOMIC_OPS
for (size_t i = 0; i < numSpinlocks; i++)
if (OFSpinlockNew(&blockSpinlocks[i]) != 0 ||
OFSpinlockNew(&byrefSpinlocks[i]) != 0)
@throw [OFInitializationFailedException
exceptionWithClass: self];
#endif
#ifdef OF_APPLE_RUNTIME
|