ObjFW  Check-in [f133454532]

Overview
Comment:invocation: Add a shared header for some defines
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f133454532f0125c23813af72994a578b7ead3a6d7415e4d0f1fefff232cfc65
User & Date: js on 2018-11-26 22:08:02
Other Links: manifest | tags
Context
2018-12-01
19:33
ObjFW.h: Fix unicode.h import check-in: f1e2e08017 user: js tags: trunk
2018-11-26
22:08
invocation: Add a shared header for some defines check-in: f133454532 user: js tags: trunk
22:04
OFInvocation: Fix void return check-in: 7c1614461e user: js tags: trunk
Changes

Modified src/invocation/apple-call-x86_64.S from [c0c1c10b97] to [6e72953138].

13
14
15
16
17
18
19


20
21
22
23
24
25
26
 * 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 _of_invocation_call

.section __TEXT, __text, regular, pure_instructions
_of_invocation_call:
	pushq	%rbp
	movq	%rsp, %rbp








>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 * 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"

#include "invoke-x86_64.h"

.globl _of_invocation_call

.section __TEXT, __text, regular, pure_instructions
_of_invocation_call:
	pushq	%rbp
	movq	%rsp, %rbp

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
	movq	24(%rdi), %rcx
	movq	16(%rdi), %rdx
	movq	8(%rdi), %rsi

	movb	225(%rdi), %r11b
	movq	0(%rdi), %rdi

	cmpb	$1, %r11b
	je	Lcall_send_stret

	cmpb	$4, %r11b
	je	_objc_msgSend

	cmpb	$5, %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)

	movb	225(%rdi), %r11b

	cmpb	$2, %r11b
	je	Lpop_long_double

	cmpb	$3, %r11b
	je	Lpop_complex_long_double

Lreturn:
	movq	%rbp, %rsp
	popq	%rbp

	ret







|


|


|













|


|







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
	movq	24(%rdi), %rcx
	movq	16(%rdi), %rdx
	movq	8(%rdi), %rsi

	movb	225(%rdi), %r11b
	movq	0(%rdi), %rdi

	cmpb	$RETURN_TYPE_STRET, %r11b
	je	Lcall_send_stret

	cmpb	$RETURN_TYPE_JMP, %r11b
	je	_objc_msgSend

	cmpb	$RETURN_TYPE_JMP_STRET, %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)

	movb	225(%rdi), %r11b

	cmpb	$RETURN_TYPE_X87, %r11b
	je	Lpop_long_double

	cmpb	$RETURN_TYPE_COMPLEX_X87, %r11b
	je	Lpop_complex_long_double

Lreturn:
	movq	%rbp, %rsp
	popq	%rbp

	ret

Modified src/invocation/call-x86_64-elf.S from [32ee4dd9cc] to [cde094b517].

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
 * 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 of_invocation_call

.section .text
of_invocation_call:
	pushq	%rbp
	movq	%rsp, %rbp

	subq	$16, %rsp
	andq	$-16, %rsp
	movq	%rdi, -8(%rbp)

	movb	225(%rdi), %r11b
	cmpb	$1, %r11b
	je	.lookup_stret
	cmpb	$4, %r11b
	je	.lookup_stret

	movq	8(%rdi), %rsi
	movq	0(%rdi), %rdi
	call	objc_msg_lookup@PLT

.after_lookup:







>
>












|

|







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
 * 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"

#include "invoke-x86_64.h"

.globl of_invocation_call

.section .text
of_invocation_call:
	pushq	%rbp
	movq	%rsp, %rbp

	subq	$16, %rsp
	andq	$-16, %rsp
	movq	%rdi, -8(%rbp)

	movb	225(%rdi), %r11b
	cmpb	$RETURN_TYPE_STRET, %r11b
	je	.lookup_stret
	cmpb	$RETURN_TYPE_JMP_STRET, %r11b
	je	.lookup_stret

	movq	8(%rdi), %rsi
	movq	0(%rdi), %rdi
	call	objc_msg_lookup@PLT

.after_lookup:
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
106
107
108
109
	movq	24(%rdi), %rcx
	movq	16(%rdi), %rdx
	movq	8(%rdi), %rsi

	movb	225(%rdi), %r11b
	movq	0(%rdi), %rdi

	cmpb	$4, %r11b
	je	.jmp_into_method
	cmpb	$5, %r11b
	je	.jmp_into_method

	movq	-16(%rbp), %r11
	call	*%r11

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

	movb	225(%rdi), %r11b

	cmpb	$2, %r11b
	je	.pop_long_double

	cmpb	$3, %r11b
	je	.pop_complex_long_double

.return:
	movq	%rbp, %rsp
	popq	%rbp

	ret







|

|














|


|







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
106
107
108
109
110
111
	movq	24(%rdi), %rcx
	movq	16(%rdi), %rdx
	movq	8(%rdi), %rsi

	movb	225(%rdi), %r11b
	movq	0(%rdi), %rdi

	cmpb	$RETURN_TYPE_JMP, %r11b
	je	.jmp_into_method
	cmpb	$RETURN_TYPE_JMP_STRET, %r11b
	je	.jmp_into_method

	movq	-16(%rbp), %r11
	call	*%r11

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

	movb	225(%rdi), %r11b

	cmpb	$RETURN_TYPE_X87, %r11b
	je	.pop_long_double

	cmpb	$RETURN_TYPE_COMPLEX_X87, %r11b
	je	.pop_complex_long_double

.return:
	movq	%rbp, %rsp
	popq	%rbp

	ret

Added src/invocation/invoke-x86_64.h version [b39b3ed2c7].















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
 *               2018
 *   Jonathan Schleifer <js@heap.zone>
 *
 * 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.
 */

#define RETURN_TYPE_NORMAL	0
#define RETURN_TYPE_STRET	1
#define RETURN_TYPE_X87		2
#define RETURN_TYPE_COMPLEX_X87	3
#define RETURN_TYPE_JMP		4
#define RETURN_TYPE_JMP_STRET	5

Modified src/invocation/invoke-x86_64.m from [d401c0dd7a] to [85bd746449].

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

#import "OFInvocation.h"
#import "OFMethodSignature.h"

#import "OFInvalidFormatException.h"
#import "OFOutOfMemoryException.h"



#import "macros.h"

#define NUM_GPR_IN 6
#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_COMPLEX_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 numSSEUsed;
	uint8_t returnType;
	uint64_t stackSize;







>
>







<
<
<
<
<
<
<
<
<







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38









39
40
41
42
43
44
45

#import "OFInvocation.h"
#import "OFMethodSignature.h"

#import "OFInvalidFormatException.h"
#import "OFOutOfMemoryException.h"

#import "invoke-x86_64.h"

#import "macros.h"

#define NUM_GPR_IN 6
#define NUM_GPR_OUT 2
#define NUM_SSE_IN 8
#define NUM_X87_OUT 2










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 numSSEUsed;
	uint8_t returnType;
	uint64_t stackSize;