ObjFW  Check-in [26f6bd3396]

Overview
Comment:configure: Fix warning about missing spinlocks.

Also includes a few style improvements for runtime.h.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 26f6bd3396bdbe608582e2d5387fb05ce6d85f1038d87d9979af55589e1cec1a
User & Date: js on 2013-07-23 20:46:18
Other Links: manifest | tags
Context
2013-07-23
22:48
Allow classes in collections requiring OFCopying. check-in: 7992490163 user: js tags: trunk
20:46
configure: Fix warning about missing spinlocks. check-in: 26f6bd3396 user: js tags: trunk
2013-07-15
21:04
exception.m: Fix wrong type size. check-in: 51beeb9808 user: js tags: trunk
Changes

Modified configure.ac from [d327b0c044] to [58bf1c6235].

458
459
460
461
462
463
464

465
466
467
468
469
470
471
				    PTHREAD_MUTEX_RECURSIVE);
			], [
				AC_DEFINE(OF_HAVE_RECURSIVE_PTHREAD_MUTEXES, 1,
					[If pthread mutexes can be recursive])
			])

			AC_CHECK_FUNC(pthread_spin_lock, [

				AC_DEFINE(OF_HAVE_PTHREAD_SPINLOCKS, 1,
					[Whether we have pthread spinlocks])
			])

			AC_CHECK_FUNC(sched_yield, [
				AC_DEFINE(OF_HAVE_SCHED_YIELD, 1,
					[Whether we have sched_yield()])







>







458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
				    PTHREAD_MUTEX_RECURSIVE);
			], [
				AC_DEFINE(OF_HAVE_RECURSIVE_PTHREAD_MUTEXES, 1,
					[If pthread mutexes can be recursive])
			])

			AC_CHECK_FUNC(pthread_spin_lock, [
				have_spinlocks="yes"
				AC_DEFINE(OF_HAVE_PTHREAD_SPINLOCKS, 1,
					[Whether we have pthread spinlocks])
			])

			AC_CHECK_FUNC(sched_yield, [
				AC_DEFINE(OF_HAVE_SCHED_YIELD, 1,
					[Whether we have sched_yield()])
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
	printf "  ** To get optimal performance and be able to use all "
	echo "features, you should "
	echo "  ** install Clang >= 3.2."
	echo
])

AS_IF([test x"$enable_threads" != x"no" -a x"$atomic_ops" = x"none" \
    -a x"ac_cv_func_pthread_spin_lock" != x"yes"], [
	echo
	printf "  ** Warning: You have enabled threads, but neither atomic "
	echo "operations nor"
	printf "  ** spinlocks are available. Expect *very* poor performance, "
	echo "as a mutex will"
	printf "  ** be locked for every retain and release! If you don't "
	echo "need threads, try"
	echo "  ** --disable-threads to work around this problem."
	echo
])







|










865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
	printf "  ** To get optimal performance and be able to use all "
	echo "features, you should "
	echo "  ** install Clang >= 3.2."
	echo
])

AS_IF([test x"$enable_threads" != x"no" -a x"$atomic_ops" = x"none" \
    -a x"$have_spinlocks" != x"yes"], [
	echo
	printf "  ** Warning: You have enabled threads, but neither atomic "
	echo "operations nor"
	printf "  ** spinlocks are available. Expect *very* poor performance, "
	echo "as a mutex will"
	printf "  ** be locked for every retain and release! If you don't "
	echo "need threads, try"
	echo "  ** --disable-threads to work around this problem."
	echo
])

Modified src/runtime/runtime.h from [32f939b80e] to [d76a124e2f].

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

#if __has_feature(objc_arc)
# define OBJC_UNSAFE_UNRETAINED __unsafe_unretained
#else
# define OBJC_UNSAFE_UNRETAINED
#endif

typedef struct objc_class *Class;
typedef struct objc_object *id;
typedef const struct objc_selector *SEL;
typedef signed char BOOL;
typedef id (*IMP)(id, SEL, ...);

struct objc_class {
	Class isa;
	Class superclass;
	const char *name;







|
|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

#if __has_feature(objc_arc)
# define OBJC_UNSAFE_UNRETAINED __unsafe_unretained
#else
# define OBJC_UNSAFE_UNRETAINED
#endif

typedef struct objc_class* Class;
typedef struct objc_object* id;
typedef const struct objc_selector* SEL;
typedef signed char BOOL;
typedef id (*IMP)(id, SEL, ...);

struct objc_class {
	Class isa;
	Class superclass;
	const char *name;
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
	struct objc_protocol_list *protocols;
	void *gc_object_type;
	unsigned long abi_version;
	void *ivar_offsets;
	struct objc_property_list *properties;
};

enum objc_abi_class_info {
	OBJC_CLASS_INFO_CLASS	    = 0x001,
	OBJC_CLASS_INFO_METACLASS   = 0x002,
	OBJC_CLASS_INFO_NEW_ABI	    = 0x010,
	OBJC_CLASS_INFO_SETUP	    = 0x100,
	OBJC_CLASS_INFO_LOADED	    = 0x200,
	OBJC_CLASS_INFO_DTABLE	    = 0x400,
	OBJC_CLASS_INFO_INITIALIZED = 0x800







|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
	struct objc_protocol_list *protocols;
	void *gc_object_type;
	unsigned long abi_version;
	void *ivar_offsets;
	struct objc_property_list *properties;
};

enum objc_class_info {
	OBJC_CLASS_INFO_CLASS	    = 0x001,
	OBJC_CLASS_INFO_METACLASS   = 0x002,
	OBJC_CLASS_INFO_NEW_ABI	    = 0x010,
	OBJC_CLASS_INFO_SETUP	    = 0x100,
	OBJC_CLASS_INFO_LOADED	    = 0x200,
	OBJC_CLASS_INFO_DTABLE	    = 0x400,
	OBJC_CLASS_INFO_INITIALIZED = 0x800