Overview
Comment: | atomic.h: Fix OSAtomic on PPC64 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
2b00b3cec81a27d324551733ab3d66c5 |
User & Date: | js on 2014-02-21 17:16:44 |
Other Links: | manifest | tags |
Context
2014-02-21
| ||
17:17 | Cast return of sizeof() to socklen_t check-in: 3fa37632f9 user: js tags: trunk | |
17:16 | atomic.h: Fix OSAtomic on PPC64 check-in: 2b00b3cec8 user: js tags: trunk | |
01:03 | objfw-compile: Allow -m* check-in: ab64692609 user: js tags: trunk | |
Changes
Modified configure.ac from [bfa3ebaa09] to [ee8a5fe8bc].
︙ | ︙ | |||
567 568 569 570 571 572 573 | AC_MSG_RESULT(no) ]) AC_CHECK_HEADER(libkern/OSAtomic.h, [ test x"$atomic_ops" = x"none" && atomic_ops="libkern/OSAtomic.h" AC_DEFINE(OF_HAVE_OSATOMIC, 1, [Whether we have libkern/OSAtomic.h]) | < < < < | 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | AC_MSG_RESULT(no) ]) AC_CHECK_HEADER(libkern/OSAtomic.h, [ test x"$atomic_ops" = x"none" && atomic_ops="libkern/OSAtomic.h" AC_DEFINE(OF_HAVE_OSATOMIC, 1, [Whether we have libkern/OSAtomic.h]) ]) ], [ dnl We can only have one thread - therefore everything is atomic atomic_ops="not needed" ]) AC_MSG_CHECKING(for atomic operations) |
︙ | ︙ |
Modified src/atomic.h from [5741f77007] to [a649199f5c].
︙ | ︙ | |||
55 56 57 58 59 60 61 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) | < | < < < < < < | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicAdd32Barrier(i, p); #else # error of_atomic_add_int not implemented! #endif } static OF_INLINE int32_t of_atomic_add_32(volatile int32_t *p, int32_t i) |
︙ | ︙ | |||
120 121 122 123 124 125 126 | : "r"(i), "m"(*p) ); return (void*)i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, (void*)i); #elif defined(OF_HAVE_OSATOMIC) | < < | < | > > < < | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | : "r"(i), "m"(*p) ); return (void*)i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, (void*)i); #elif defined(OF_HAVE_OSATOMIC) # ifdef __LP64__ return (void*)OSAtomicAdd64Barrier(i, (int64_t*)p); # else return (void*)OSAtomicAdd32Barrier(i, (int32_t*)p); # endif #else # error of_atomic_add_ptr not implemented! #endif } static OF_INLINE int of_atomic_sub_int(volatile int *p, int i) |
︙ | ︙ | |||
166 167 168 169 170 171 172 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) | < | < < < < < < | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicAdd32Barrier(-i, p); #else # error of_atomic_sub_int not implemented! #endif } static OF_INLINE int32_t of_atomic_sub_32(volatile int32_t *p, int32_t i) |
︙ | ︙ | |||
234 235 236 237 238 239 240 | : "r"(i), "m"(*p) ); return (void*)i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, (void*)i); #elif defined(OF_HAVE_OSATOMIC) | < < | < | > > < < | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | : "r"(i), "m"(*p) ); return (void*)i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, (void*)i); #elif defined(OF_HAVE_OSATOMIC) # ifdef __LP64__ return (void*)OSAtomicAdd64Barrier(-i, (int64_t*)p); # else return (void*)OSAtomicAdd32Barrier(-i, (int32_t*)p); # endif #else # error of_atomic_sub_ptr not implemented! #endif } static OF_INLINE int of_atomic_inc_int(volatile int *p) |
︙ | ︙ | |||
284 285 286 287 288 289 290 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, 1); #elif defined(OF_HAVE_OSATOMIC) | < | < < < < < < | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, 1); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicIncrement32Barrier(p); #else # error of_atomic_inc_int not implemented! #endif } static OF_INLINE int32_t of_atomic_inc_32(volatile int32_t *p) |
︙ | ︙ | |||
362 363 364 365 366 367 368 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, 1); #elif defined(OF_HAVE_OSATOMIC) | < | < < < < < < | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, 1); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicDecrement32Barrier(p); #else # error of_atomic_dec_int not implemented! #endif } static OF_INLINE int32_t of_atomic_dec_32(volatile int32_t *p) |
︙ | ︙ | |||
444 445 446 447 448 449 450 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_or_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) | < | < < < < < < | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_or_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicOr32Barrier(i, p); #else # error of_atomic_or_int not implemented! #endif } static OF_INLINE uint32_t of_atomic_or_32(volatile uint32_t *p, uint32_t i) |
︙ | ︙ | |||
527 528 529 530 531 532 533 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_and_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) | < | < < < < < < | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_and_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicAnd32Barrier(i, p); #else # error of_atomic_and_int not implemented! #endif } static OF_INLINE uint32_t of_atomic_and_32(volatile uint32_t *p, uint32_t i) |
︙ | ︙ | |||
610 611 612 613 614 615 616 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_xor_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) | < | < < < < < < | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | else abort(); return i; #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_xor_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicXor32Barrier(i, p); #else # error of_atomic_xor_int not implemented! #endif } static OF_INLINE uint32_t of_atomic_xor_32(volatile uint32_t *p, uint32_t i) |
︙ | ︙ |