ObjFW  Check-in [a4f1bd6c08]

Overview
Comment:Check for ASM lookup at compile time.

Checking at configure time can potentially break universal builds.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a4f1bd6c086bc3def6f0fee2d35f2be18fbb01fdc82c27a2d4d18f57642209e1
User & Date: js on 2013-07-08 15:43:56
Other Links: manifest | tags
Context
2013-07-08
16:00
Add a define to indicate forwarding stret is safe. check-in: b63feee32d user: js tags: trunk
15:43
Check for ASM lookup at compile time. check-in: a4f1bd6c08 user: js tags: trunk
15:30
Check for forwarding at compile time. check-in: bbabe17c4f user: js tags: trunk
Changes

Modified configure.ac from [c60772ba54] to [ee43b4e13c].

228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
		fi
		if test x"$enable_static" = x"yes" \
		    -o x"$enable_shared" = x"no"; then
			AC_SUBST(RUNTIME_A, "runtime.a")
			AC_SUBST(RUNTIME_RUNTIME_A, "runtime/runtime.a")
		fi

		AC_EGREP_CPP(yes, [
			#if defined(__amd64__) || defined(__x86_64__)
			# ifdef __ELF__
			yes
			# endif
			#endif
		], [
			AC_SUBST(LOOKUP_S, lookup-amd64-elf.S)
			AC_DEFINE(OF_ASM_LOOKUP, 1,
				[Whether to use assembly for lookup])
		], [
			AC_EGREP_CPP(yes, [
				#if defined(__i386__) && defined(__ELF__)
				yes
				#endif
			], [
				AC_SUBST(LOOKUP_S, lookup-x86-elf.S)
				AC_DEFINE(OF_ASM_LOOKUP, 1,
					[Whether to use assembly for lookup])
			])
		])

		AC_EGREP_CPP(yes, [
			#if defined(__amd64__) || defined(__x86_64__)
			# ifdef __MACH__
			yes
			# endif
			#endif
		], [
			AC_SUBST(LOOKUP_S, lookup-amd64-macho.S)
			AC_DEFINE(OF_ASM_LOOKUP, 1,
				[Whether to use assembly for lookup])
		])

		AC_EGREP_CPP(yes, [
			#if defined(__ppc__) || defined(__PPC__)
			# ifdef __ELF__
			yes
			# endif
			#endif
		], [
			AC_SUBST(LOOKUP_S, lookup-ppc-elf.S)
			AC_DEFINE(OF_ASM_LOOKUP, 1,
				[Whether to use assembly for lookup])
		])

		AC_EGREP_CPP(yes, [
			#if defined(__arm__) || defined(__ARM__)
			# ifdef __ELF__
			yes
			# endif
			#endif
		], [
			AC_SUBST(LOOKUP_S, lookup-arm-elf.S)
			AC_DEFINE(OF_ASM_LOOKUP, 1,
				[Whether to use assembly for lookup])
		])

		AC_EGREP_CPP(yes, [
			#if defined(__mips) && __mips < 64 && defined(__ELF__)
			# if defined(_MIPSEL) || defined(_MIPSEB)
			yes
			# endif
			#endif
		], [
			AC_SUBST(LOOKUP_S, lookup-mips-elf.S)
			AC_DEFINE(OF_ASM_LOOKUP, 1,
				[Whether to use assembly for lookup])
		])

		AS_IF([test x"$enable_seluid24" = x"yes"], [
			AC_DEFINE(OF_SELUID24, 1,
				[Whether to use 24 bit selector UIDs])
		])

		AC_MSG_CHECKING(for exception type)
		AC_TRY_COMPILE([







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







228
229
230
231
232
233
234






































































235
236
237
238
239
240
241
		fi
		if test x"$enable_static" = x"yes" \
		    -o x"$enable_shared" = x"no"; then
			AC_SUBST(RUNTIME_A, "runtime.a")
			AC_SUBST(RUNTIME_RUNTIME_A, "runtime/runtime.a")
		fi







































































		AS_IF([test x"$enable_seluid24" = x"yes"], [
			AC_DEFINE(OF_SELUID24, 1,
				[Whether to use 24 bit selector UIDs])
		])

		AC_MSG_CHECKING(for exception type)
		AC_TRY_COMPILE([

Modified extra.mk.in from [c7fdab5546] to [6e5450bfa8].

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
EXCEPTIONS_A = @EXCEPTIONS_A@
EXCEPTIONS_EXCEPTIONS_A = @EXCEPTIONS_EXCEPTIONS_A@
EXCEPTIONS_EXCEPTIONS_LIB_A = @EXCEPTIONS_EXCEPTIONS_LIB_A@
EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@
FOUNDATION_COMPAT_M = @FOUNDATION_COMPAT_M@
INSTANCE_M = @INSTANCE_M@
LIBOBJFW_DEP = @LIBOBJFW_DEP@
LOOKUP_S = @LOOKUP_S@
MAP_LDFLAGS = @MAP_LDFLAGS@
OFBLOCKTESTS_M = @OFBLOCKTESTS_M@
OFHTTPCLIENTTESTS_M = @OFHTTPCLIENTTESTS_M@
OFPROCESS_M = @OFPROCESS_M@
OFSTREAMOBSERVER_KQUEUE_M = @OFSTREAMOBSERVER_KQUEUE_M@
OFSTREAMOBSERVER_POLL_M = @OFSTREAMOBSERVER_POLL_M@
OFSTREAMOBSERVER_SELECT_M = @OFSTREAMOBSERVER_SELECT_M@







<







16
17
18
19
20
21
22

23
24
25
26
27
28
29
EXCEPTIONS_A = @EXCEPTIONS_A@
EXCEPTIONS_EXCEPTIONS_A = @EXCEPTIONS_EXCEPTIONS_A@
EXCEPTIONS_EXCEPTIONS_LIB_A = @EXCEPTIONS_EXCEPTIONS_LIB_A@
EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@
FOUNDATION_COMPAT_M = @FOUNDATION_COMPAT_M@
INSTANCE_M = @INSTANCE_M@
LIBOBJFW_DEP = @LIBOBJFW_DEP@

MAP_LDFLAGS = @MAP_LDFLAGS@
OFBLOCKTESTS_M = @OFBLOCKTESTS_M@
OFHTTPCLIENTTESTS_M = @OFHTTPCLIENTTESTS_M@
OFPROCESS_M = @OFPROCESS_M@
OFSTREAMOBSERVER_KQUEUE_M = @OFSTREAMOBSERVER_KQUEUE_M@
OFSTREAMOBSERVER_POLL_M = @OFSTREAMOBSERVER_POLL_M@
OFSTREAMOBSERVER_SELECT_M = @OFSTREAMOBSERVER_SELECT_M@

Modified src/runtime/Makefile from [a83e963f98] to [d1091e58a3].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
include ../../extra.mk

STATIC_PIC_LIB_NOINST = ${RUNTIME_LIB_A}
STATIC_LIB_NOINST = ${RUNTIME_A}

SRCS = arc.m			\
       category.m		\
       class.m			\
       exception.m		\
       hashtable.m		\
       init.m			\
       lookup.m			\
       ${LOOKUP_S}		\
       property.m		\
       protocol.m		\
       selector.m		\
       sparsearray.m		\
       static-instances.m	\
       synchronized.m		\
       ${USE_SRCS_THREADS}












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
include ../../extra.mk

STATIC_PIC_LIB_NOINST = ${RUNTIME_LIB_A}
STATIC_LIB_NOINST = ${RUNTIME_A}

SRCS = arc.m			\
       category.m		\
       class.m			\
       exception.m		\
       hashtable.m		\
       init.m			\
       lookup.m			\
       lookup-asm.S		\
       property.m		\
       protocol.m		\
       selector.m		\
       sparsearray.m		\
       static-instances.m	\
       synchronized.m		\
       ${USE_SRCS_THREADS}

Added src/runtime/lookup-asm.S version [73b288d188].







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#if defined(__ELF__)
# if defined(__amd64__) || defined(__x86_64__)
#  include "lookup-amd64-elf.S"
# elif defined(__i386__)
#  include "lookup-x86-elf.S"
# elif defined(__ppc__) || defined(__PPC__)
#  include "lookup-ppc-elf.S"
# elif defined(__arm__) || defined(__ARM__)
#  include "lookup-arm-elf.S"
# elif defined(__mips) && __mips < 64
#  include "lookup-mips-elf.S"
# endif
#elif defined(__MACH__)
# if defined(__amd64__) || defined(__x86_64__)
#  include "lookup-amd64-macho.S"
# endif
#endif

Modified src/runtime/runtime-private.h from [291ac1241b] to [630ce5911a].

169
170
171
172
173
174
175













176
177
178
179
180
181
182
183
#else
	uint8_t i = idx >> 8;
	uint8_t j = idx;

	return (void*)s->buckets[i]->buckets[j];
#endif
}














#define OBJC_ERROR(...)							\
	{								\
		fprintf(stderr, "[objc @ " __FILE__ ":%d] ", __LINE__);	\
		fprintf(stderr, __VA_ARGS__);				\
		fputs("\n", stderr);					\
		abort();						\
	}







>
>
>
>
>
>
>
>
>
>
>
>
>








169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#else
	uint8_t i = idx >> 8;
	uint8_t j = idx;

	return (void*)s->buckets[i]->buckets[j];
#endif
}

#if defined(__ELF__)
# if defined(__amd64__) || defined(__x86_64__) || defined(__i386__) || \
    defined(__ppc__) || defined(__PPC__) || defined(__arm__) || defined(__ARM__)
#  define OF_ASM_LOOKUP
# elif defined(__mips) && __mips < 64
#  define OF_ASM_LOOKUP
# endif
#elif defined(__MACH__)
# if defined(__amd64__) || defined(__x86_64__)
#  define OF_ASM_LOOKUP
# endif
#endif

#define OBJC_ERROR(...)							\
	{								\
		fprintf(stderr, "[objc @ " __FILE__ ":%d] ", __LINE__);	\
		fprintf(stderr, __VA_ARGS__);				\
		fputs("\n", stderr);					\
		abort();						\
	}