ObjFW  Check-in [d6e5e6beb3]

Overview
Comment:apple-call-x86_64.S: Add support for stret and jmp

Jumping is useful in case of forwarding, so that the return value does
not need to be put back into an OFInvocation and then from an
OFInvocation back into registers.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d6e5e6beb3dc94a2d1f6691b416e99711b23d8398f1f41a4597f83d82c829cac
User & Date: js on 2017-09-14 21:51:51
Other Links: manifest | tags
Context
2017-09-15
00:03
invoke-x86_64.m: Add support for __int128 check-in: 1b96a21136 user: js tags: trunk
2017-09-14
21:51
apple-call-x86_64.S: Add support for stret and jmp check-in: d6e5e6beb3 user: js tags: trunk
2017-09-12
23:49
invoke-x86_64.m: Minor refactor check-in: 8417c40405 user: js tags: trunk
Changes

Modified src/invocation/apple-call-x86_64.S from [4e9c1edaaf] to [387ccf9ff7].

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
87
88
89
	movq	40(%rdi), %r9
	movq	32(%rdi), %r8
	movq	24(%rdi), %rcx
	movq	16(%rdi), %rdx
	movq	8(%rdi), %rsi
	movq	0(%rdi), %rdi












	call	_objc_msgSend


	movq	-8(%rbp), %rdi
	movq	%rax, 48(%rdi)
	movq	%rdx, 56(%rdi)
	movdqa	%xmm0, 64(%rdi)
	movdqa	%xmm1, 80(%rdi)

	cmpb	$2, 225(%rdi)
	je	Lpop_long_double

Lreturn:
	movq	%rbp, %rsp
	popq	%rbp

	ret

Lfix_align:
	xorq	%r11, %r11
	pushq	%r11
	jmp	Lfill_stack





Lpop_long_double:
	fstpt	192(%rdi)
	jmp	Lreturn







>
>
>
>
>
>
>
>
>
>
>


>



















>
>
>
>




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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
	movq	40(%rdi), %r9
	movq	32(%rdi), %r8
	movq	24(%rdi), %rcx
	movq	16(%rdi), %rdx
	movq	8(%rdi), %rsi
	movq	0(%rdi), %rdi

	movb	225(%rdi), %r11b

	cmpb	$1, %r11b
	je	Lcall_send_stret

	cmpb	$3, %r11b
	je	_objc_msgSend

	cmpb	$4, %r11b
	je	_objc_msgSend_stret

	call	_objc_msgSend

Lafter_send:
	movq	-8(%rbp), %rdi
	movq	%rax, 48(%rdi)
	movq	%rdx, 56(%rdi)
	movdqa	%xmm0, 64(%rdi)
	movdqa	%xmm1, 80(%rdi)

	cmpb	$2, 225(%rdi)
	je	Lpop_long_double

Lreturn:
	movq	%rbp, %rsp
	popq	%rbp

	ret

Lfix_align:
	xorq	%r11, %r11
	pushq	%r11
	jmp	Lfill_stack

Lcall_send_stret:
	call	_objc_msgSend_stret
	jmp	Lafter_send

Lpop_long_double:
	fstpt	192(%rdi)
	jmp	Lreturn

Modified src/invocation/invoke-x86_64.m from [7689390f4e] to [8ed55a5c76].

30
31
32
33
34
35
36
37


38
39
40
41
42
43
44
#define NUM_GPR_OUT 2
#define NUM_SSE_IN 8
#define NUM_X87_OUT 2

enum {
	RETURN_TYPE_NORMAL,
	RETURN_TYPE_STRUCT,
	RETURN_TYPE_X87


};

struct call_context {
	uint64_t gpr[NUM_GPR_IN + NUM_GPR_OUT];
	__m128 sse[NUM_SSE_IN];
	long double x87[NUM_X87_OUT];
	uint8_t num_sse_used;







|
>
>







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#define NUM_GPR_OUT 2
#define NUM_SSE_IN 8
#define NUM_X87_OUT 2

enum {
	RETURN_TYPE_NORMAL,
	RETURN_TYPE_STRUCT,
	RETURN_TYPE_X87,
	RETURN_TYPE_JMP,
	RETURN_TYPE_JMP_STRET
};

struct call_context {
	uint64_t gpr[NUM_GPR_IN + NUM_GPR_OUT];
	__m128 sse[NUM_SSE_IN];
	long double x87[NUM_X87_OUT];
	uint8_t num_sse_used;