ObjFW  Check-in [6d2f81aea9]

Overview
Comment:OFInvocation: Support for invoking on x86_64/ELF
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6d2f81aea9ee5629e166eadd422258bb43111bc25ac74a65666621086cc27f03
User & Date: js on 2017-09-16 19:11:45
Other Links: manifest | tags
Context
2017-09-16
20:05
invoke-x86_64.m: Fix compilation with GCC check-in: 2379608969 user: js tags: trunk
19:11
OFInvocation: Support for invoking on x86_64/ELF check-in: 6d2f81aea9 user: js tags: trunk
2017-09-15
00:03
invoke-x86_64.m: Add support for __int128 check-in: 1b96a21136 user: js tags: trunk
Changes

Modified src/OFInvocation.h from [c3fa8975c2] to [123d15423c].

18
19
20
21
22
23
24






25
26
27
28
29
30
31

OF_ASSUME_NONNULL_BEGIN

#ifdef OF_APPLE_RUNTIME
# ifdef OF_X86_64
#  define OF_INVOCATION_CAN_INVOKE
# endif






#endif

@class OFMethodSignature;
@class OFMutableArray OF_GENERIC(ObjectType);
@class OFMutableData;

/*!







>
>
>
>
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

OF_ASSUME_NONNULL_BEGIN

#ifdef OF_APPLE_RUNTIME
# ifdef OF_X86_64
#  define OF_INVOCATION_CAN_INVOKE
# endif
#else
# ifdef OF_ELF
#  ifdef OF_X86_64
#   define OF_INVOCATION_CAN_INVOKE
#  endif
# endif
#endif

@class OFMethodSignature;
@class OFMutableArray OF_GENERIC(ObjectType);
@class OFMutableData;

/*!

Modified src/invocation/Makefile from [4d35605397] to [a7afc8dd3a].

1
2
3
4
5
6
7
8
9
10
11
12
include ../../extra.mk

STATIC_PIC_LIB_NOINST = ${INVOCATION_LIB_A}
STATIC_LIB_NOINST = ${INVOCATION_A}

SRCS = call.S	\
       invoke.m

include ../../buildsys.mk

ASFLAGS += -I../.. -I..
OBJCFLAGS += -I../.. -I.. -I../exceptions











|
1
2
3
4
5
6
7
8
9
10
11
12
include ../../extra.mk

STATIC_PIC_LIB_NOINST = ${INVOCATION_LIB_A}
STATIC_LIB_NOINST = ${INVOCATION_A}

SRCS = call.S	\
       invoke.m

include ../../buildsys.mk

ASFLAGS += -I../.. -I..
OBJCFLAGS += -I../.. -I.. -I../exceptions -I../runtime

Added src/invocation/call-x86_64-elf.S version [fa9ea51b67].



























































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
 *   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.
 */

#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:
	movq	%rax, -16(%rbp)
	movq	-8(%rbp), %rdi

	leaq	240(%rdi), %rdx
	movq	232(%rdi), %rcx

	testq	$1, %rcx
	jnz	.fix_align

.fill_stack:
	testq	%rcx, %rcx
	jz	.stack_filled

	decq	%rcx
	movq	(%rdx,%rcx,8), %r11
	pushq	%r11

	jmp	.fill_stack

.stack_filled:
	movb	224(%rdi), %al

	movdqa	176(%rdi), %xmm7
	movdqa	160(%rdi), %xmm6
	movdqa	144(%rdi), %xmm5
	movdqa	128(%rdi), %xmm4
	movdqa	112(%rdi), %xmm3
	movdqa	96(%rdi), %xmm2
	movdqa	80(%rdi), %xmm1
	movdqa	64(%rdi), %xmm0

	movq	40(%rdi), %r9
	movq	32(%rdi), %r8
	movq	24(%rdi), %rcx
	movq	16(%rdi), %rdx
	movq	8(%rdi), %rsi
	movq	0(%rdi), %rdi

	movq	-16(%rbp), %r11

	cmpb	$3, 225(%rdi)
	je	.jmp_r11
	cmpb	$4, 225(%rdi)
	je	.jmp_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)

	cmpb	$2, 225(%rdi)
	je	.pop_long_double

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

	ret

.fix_align:
	xorq	%r11, %r11
	pushq	%r11
	jmp	.fill_stack

.lookup_stret:
	movq	16(%rdi), %rsi
	movq	8(%rdi), %rdi
	call	objc_msg_lookup_stret@PLT

	jmp	.after_lookup

.jmp_r11:
	jmp	*%r11

.pop_long_double:
	fstpt	192(%rdi)
	jmp	.return

#ifdef OF_LINUX
.section .note.GNU-stack, "", %progbits
#endif

Modified src/invocation/call.S from [0651a365e6] to [44a882cf2f].

15
16
17
18
19
20
21
22
23
24






25
 */

#include "config.h"

#include "platform.h"

#ifdef OF_APPLE_RUNTIME
# if defined(OF_X86_64)
#  include "apple-call-x86_64.S"
# endif






#endif







|


>
>
>
>
>
>

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 */

#include "config.h"

#include "platform.h"

#ifdef OF_APPLE_RUNTIME
# ifdef OF_X86_64
#  include "apple-call-x86_64.S"
# endif
#else
# ifdef OF_ELF
#  ifdef OF_X86_64
#   include "call-x86_64-elf.S"
#  endif
# endif
#endif

Modified src/invocation/invoke.m from [7c6eaecd2d] to [5796bdfcc8].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 * file.
 */

#include "config.h"

#include "platform.h"

#ifdef OF_X86_64
# ifdef OF_APPLE_RUNTIME
#  include "invoke-x86_64.m"
# endif
#else
/* To not have an empty translation unit otherwise */
int of_invocation_cannot_invoke;
#endif







<
|
|
<




14
15
16
17
18
19
20

21
22

23
24
25
26
 * file.
 */

#include "config.h"

#include "platform.h"


#if defined(OF_X86_64) && (defined(OF_APPLE_RUNTIME) || defined(OF_ELF))
# include "invoke-x86_64.m"

#else
/* To not have an empty translation unit otherwise */
int of_invocation_cannot_invoke;
#endif