Differences From Artifact [677b6f2060]:
- File
src/runtime/property.m
— part of check-in
[417b213d41]
at
2012-07-16 23:49:50
on branch trunk
— Add OF_ENSURE.
This is to be used when the condition includes a statement that needs to
be executed, as with assert, this would not be executed anymore when
NDEBUG is defined. (user: js, size: 3284) [annotate] [blame] [check-ins using]
To Artifact [0d8c0c46ef]:
- File src/runtime/property.m — part of check-in [c34d45798b] at 2012-08-04 08:29:06 on branch trunk — Replace a few init methods with constructors. (user: js, size: 3374) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | * file. */ #include "config.h" #include <string.h> #import "OFObject.h" #import "macros.h" #ifdef OF_THREADS # import "threading.h" # define NUM_SPINLOCKS 8 /* needs to be a power of 2 */ # define SPINLOCK_HASH(p) ((unsigned)((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1)) static of_spinlock_t spinlocks[NUM_SPINLOCKS]; #endif | > > > | > | < < < | < > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | * file. */ #include "config.h" #include <string.h> #import "runtime.h" #import "runtime-private.h" #import "OFObject.h" #import "macros.h" #ifdef OF_THREADS # import "threading.h" # define NUM_SPINLOCKS 8 /* needs to be a power of 2 */ # define SPINLOCK_HASH(p) ((unsigned)((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1)) static of_spinlock_t spinlocks[NUM_SPINLOCKS]; #endif #ifdef OF_THREADS static void __attribute__((constructor)) init(void) { size_t i; for (i = 0; i < NUM_SPINLOCKS; i++) if (!of_spinlock_new(&spinlocks[i])) OBJC_ERROR("Failed to initialize spinlocks!") } #endif id objc_getProperty(id self, SEL _cmd, ptrdiff_t offset, BOOL atomic) { if (atomic) { id *ptr = (id*)(void*)((char*)self + offset); #ifdef OF_THREADS |
︙ | ︙ |