ObjFW  Check-in [b527914a91]

Overview
Comment:Add x86/Win32 assembly lookup implementation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b527914a9161ace3530a1f5dd0b45e606da41c7437d75b175e4318d0d102a142
User & Date: js on 2013-12-06 02:35:07
Other Links: manifest | tags
Context
2013-12-06
02:36
Add forwardingTargetForSelector: for x86/Win32. check-in: c0f224df8a user: js tags: trunk
02:35
Add x86/Win32 assembly lookup implementation. check-in: b527914a91 user: js tags: trunk
00:52
Add a fast path for objc_classname_to_class(). check-in: 84a724dd4b user: js tags: trunk
Changes

Modified src/runtime/lookup-asm/lookup-asm-x86-elf.S from [483507fb77] to [537ccf37ee].

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	ret

.forward_\name:
	call	get_eip
.forward_L0_\name:
	addl	$\not_found_handler-.forward_L0_\name, %eax
	jmp	*%eax

.type \name, %function
.size \name, .-\name
.endm

.macro generate_lookup_super name lookup
\name:
	movl	4(%esp), %edx







<







49
50
51
52
53
54
55

56
57
58
59
60
61
62
	ret

.forward_\name:
	call	get_eip
.forward_L0_\name:
	addl	$\not_found_handler-.forward_L0_\name, %eax
	jmp	*%eax

.type \name, %function
.size \name, .-\name
.endm

.macro generate_lookup_super name lookup
\name:
	movl	4(%esp), %edx

Added src/runtime/lookup-asm/lookup-asm-x86-win32.S version [33d9469129].













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 * 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"

.globl _objc_msg_lookup
.globl _objc_msg_lookup_stret
.globl _objc_msg_lookup_super
.globl _objc_msg_lookup_super_stret

.section .text
.macro generate_lookup name not_found_handler
\name:
	movl	4(%esp), %edx
	testl	%edx, %edx
	jz	ret_nil

	movl	(%edx), %edx
	movl	32(%edx), %edx

.main_\name:
	movl	8(%esp), %eax

#ifdef OF_SELUID24
	movzbl	2(%eax), %ecx
	movl	(%edx,%ecx,4), %edx
#endif
	movzbl	1(%eax), %ecx
	movl	(%edx,%ecx,4), %edx
	movzbl	(%eax), %ecx
	movl	(%edx,%ecx,4), %eax

	testl	%eax, %eax
	jz	.forward_\name

	ret

.forward_\name:
	call	get_eip
.forward_L0_\name:
	addl	$\not_found_handler-.forward_L0_\name, %eax
	jmp	*%eax
.endm

.macro generate_lookup_super name lookup
\name:
	movl	4(%esp), %edx
	cmpl	$0, (%edx)
	je	ret_nil

	movl	4(%edx), %edx
	movl	32(%edx), %edx
	jmp	.main_\lookup
.endm

generate_lookup _objc_msg_lookup _objc_not_found_handler
generate_lookup _objc_msg_lookup_stret _objc_not_found_handler_stret
generate_lookup_super _objc_msg_lookup_super _objc_msg_lookup
generate_lookup_super _objc_msg_lookup_super_stret _objc_msg_lookup_stret

ret_nil:
	call	get_eip
.L0:
	addl	$nil_method-.L0, %eax
	ret

nil_method:
	xorl	%eax, %eax
	ret

get_eip:
	movl	(%esp), %eax
	ret

Modified src/runtime/lookup-asm/lookup-asm.S from [4df371ebd5] to [4e0f6bff7b].

29
30
31
32
33
34
35


36
    (defined(__mips_eabi) && _MIPS_SZPTR == 32)
#  include "lookup-asm-mips-elf.S"
# endif
#elif defined(__MACH__)
# if defined(__amd64__) || defined(__x86_64__)
#  include "lookup-asm-amd64-macho.S"
# endif


#endif







>
>

29
30
31
32
33
34
35
36
37
38
    (defined(__mips_eabi) && _MIPS_SZPTR == 32)
#  include "lookup-asm-mips-elf.S"
# endif
#elif defined(__MACH__)
# if defined(__amd64__) || defined(__x86_64__)
#  include "lookup-asm-amd64-macho.S"
# endif
#elif defined(_WIN32) && defined(__i386__)
# include "lookup-asm-x86-win32.S"
#endif

Modified src/runtime/runtime-private.h from [3c88a5e1a9] to [d3d6b58a3c].

183
184
185
186
187
188
189


190
191
192
193
194
195
196
197
198
    (defined(__mips_eabi) && _MIPS_SZPTR == 32)
#  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();						\
	}







>
>









183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
    (defined(__mips_eabi) && _MIPS_SZPTR == 32)
#  define OF_ASM_LOOKUP
# endif
#elif defined(__MACH__)
# if defined(__amd64__) || defined(__x86_64__)
#  define OF_ASM_LOOKUP
# endif
#elif defined(_WIN32) && defined(__i386__)
# define OF_ASM_LOOKUP
#endif

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