ObjFW  Check-in [932bc09a31]

Overview
Comment:atomic.h: Work around a bug in GCC's inline asm.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 932bc09a315368709b3cf0f81af2d19bcf5aefb00c9cb2d1632d0e406d5a606d
User & Date: js on 2012-07-10 22:39:51
Other Links: manifest | tags
Context
2012-07-11
08:30
exception.m: Fix a missing free. check-in: cc68082389 user: js tags: trunk
2012-07-10
22:39
atomic.h: Work around a bug in GCC's inline asm. check-in: 932bc09a31 user: js tags: trunk
22:01
New platforms list. check-in: 1d67417011 user: js tags: trunk
Changes

Modified PLATFORMS.md from [2ef92fe7db] to [83bcf0c182].

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19











-
+







Platforms
=========

ObjFW is known to work on the following platforms, but should run on many
others as well.


Linux
-----

 * Architectures: x86, x86_64
 * Compilers: Clang 3.1, GCC 4.7.1
 * Compilers: Clang 3.0-3.1, GCC 4.7.1
 * Runtimes: ObjFW


MacOS X
-------

  * OS versions: 10.7

Modified src/atomic.h from [fe9035342d] to [cfff404a91].

637
638
639
640
641
642
643
644

645
646
647
648
649
650
651
637
638
639
640
641
642
643

644
645
646
647
648
649
650
651







-
+








	__asm__ (
	    "xorl	%0, %0\n\t"
	    "lock\n\t"
	    "cmpxchg	%2, %3\n\t"
	    "sete	%b0\n\t"
	    "movzbl	%b0, %0"
	    : "=&r"(r)
	    : "=&d"(r)	/* use d instead of r due to gcc bug */
	    : "a"(o), "r"(n), "m"(*p)
	);

	return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
	return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
668
669
670
671
672
673
674
675

676
677
678
679
680
681
682
668
669
670
671
672
673
674

675
676
677
678
679
680
681
682







-
+








	__asm__ (
	    "xorl	%0, %0\n\t"
	    "lock\n\t"
	    "cmpxchg	%2, %3\n\t"
	    "sete	%b0\n\t"
	    "movzbl	%b0, %0"
	    : "=&r"(r)
	    : "=&d"(r)	/* use d instead of r due to gcc bug */
	    : "a"(o), "r"(n), "m"(*p)
	);

	return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
	return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
699
700
701
702
703
704
705
706

707
708
709
710
711
712
713
714
715
716
699
700
701
702
703
704
705

706
707
708
709
710
711
712
713
714
715
716







-
+











	__asm__ (
	    "xorl	%0, %0\n\t"
	    "lock\n\t"
	    "cmpxchg	%2, %3\n\t"
	    "sete	%b0\n\t"
	    "movzbl	%b0, %0"
	    : "=&r"(r)
	    : "=&d"(r)	/* use d instead of r due to gcc bug */
	    : "a"(o), "r"(n), "m"(*p)
	);

	return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
	return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
	return OSAtomicCompareAndSwapPtrBarrier(o, n, p);
#endif
}