ObjFW  Check-in [d3ce57addf]

Overview
Comment:Convert lookup-amd64-elf.S to AT&T syntax.

Clang has an integrated assembler now which only accepts AT&T syntax.

lookup-x86-elf.S to follow.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | runtime
Files: files | file ages | folders
SHA3-256: d3ce57addff050fd02bcad139b39b82047055a61e74dd4f070325468fd57d0d0
User & Date: js on 2012-04-06 13:43:59
Other Links: branch diff | manifest | tags
Context
2012-04-06
14:07
Convert lookup-x86-elf.S to AT&T syntax. check-in: acc809db12 user: js tags: runtime
13:43
Convert lookup-amd64-elf.S to AT&T syntax. check-in: d3ce57addf user: js tags: runtime
12:14
Make objc_msg_lookup_super public. check-in: 10b3fbc5fc user: js tags: runtime
Changes

Modified src/runtime/lookup-amd64-elf.S from [1fd16b224f] to [dde3e76344].

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
 * 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.
 */

#if defined(__x86_64__) && defined(__ELF__)

.intel_syntax noprefix
.globl objc_msg_lookup
.globl objc_msg_lookup_super

.section .text
objc_msg_lookup:
	test	rdi, rdi
	jz	ret_nil

	mov	r8, [rdi]
	mov	r8, [r8+64]

lookup:
	mov	rax, [rsi]
	movzx	ecx, ah
	movzx	edx, al
	shr	eax, 16

	mov	r8, [r8+rax*8]
	mov	r8, [r8+rcx*8]
	mov	rax, [r8+rdx*8]

	test	rax, rax
	jz	forward

	ret

forward:
	mov	rax, qword ptr objc_forward_handler@GOTPCREL[rip]
	jmp	[rax]

objc_msg_lookup_super:
	mov	rax, [rdi]
	test	rax, rax
	jz	ret_nil

	mov	r8, [rdi+8]
	mov	r8, [r8+64]
	mov	rdi, rax
	jmp	lookup

ret_nil:
	lea	rax, nil_method[rip]
	ret

nil_method:
	mov	rax, rdi
	ret

.type objc_msg_lookup, @function
.type objc_msg_lookup_super, @function
.size objc_msg_lookup, forward-objc_msg_lookup
.size objc_msg_lookup_super, ret_nil-objc_msg_lookup_super

#endif







<





|


|
|


|
|
|
|

|
|
|

|





|
|


|
|


|
|
|



|



|








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
 * 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.
 */

#if defined(__x86_64__) && defined(__ELF__)


.globl objc_msg_lookup
.globl objc_msg_lookup_super

.section .text
objc_msg_lookup:
	testq	%rdi, %rdi
	jz	ret_nil

	movq	(%rdi), %r8
	movq	64(%r8), %r8

lookup:
	movq	(%rsi), %rax
	movzbl	%ah, %ecx
	movzbl	%al, %edx
	shrl	$16, %eax

	movq	(%r8,%rax,8), %r8
	movq	(%r8,%rcx,8), %r8
	movq	(%r8,%rdx,8), %rax

	testq	%rax, %rax
	jz	forward

	ret

forward:
	mov	objc_forward_handler@GOTPCREL(%rip), %rax
	jmp	*%rax

objc_msg_lookup_super:
	movq	(%rdi), %rax
	testq	%rax, %rax
	jz	ret_nil

	movq	8(%rdi), %r8
	movq	64(%r8), %r8
	movq	%rdi, %rax
	jmp	lookup

ret_nil:
	leaq	nil_method(%rip), %rax
	ret

nil_method:
	movq	%rdi, %rax
	ret

.type objc_msg_lookup, @function
.type objc_msg_lookup_super, @function
.size objc_msg_lookup, forward-objc_msg_lookup
.size objc_msg_lookup_super, ret_nil-objc_msg_lookup_super

#endif