ObjFW  Check-in [119b311a62]

Overview
Comment:forwardingTargetForSelector: for PowerPC 64/ELF v2
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 119b311a6261bfa7a253ced0844f164cda4c9e3b133e66f66c7bf44e692034cc
User & Date: js on 2024-08-19 21:42:08
Other Links: manifest | tags
References
2024-08-19
21:45 Ticket [769aec5298] Write assembly for forwardingTargetForSelector: on PowerPC 64 status still Open with 3 other changes artifact: 9d47a6451f user: js
Context
2024-08-19
22:04
OFSCTPSocket: Initialize flags for sctp_recvv to 0 check-in: 12289e98ac user: js tags: trunk
21:42
forwardingTargetForSelector: for PowerPC 64/ELF v2 check-in: 119b311a62 user: js tags: trunk
19:29
ofdns: Default to AAAA and A, not ALL check-in: 474dc73a94 user: js tags: trunk
Changes

Added src/forwarding/forwarding-powerpc64-elf.S version [3dd02eb036].

























































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
/*
 * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
 *
 * All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3.0 only,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * version 3.0 for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3.0 along with this program. If not, see
 * <https://www.gnu.org/licenses/>.
 */

#include "config.h"

#include "platform.h"

.abiversion 2

.globl OFForward
.globl OFForward_stret

.section .text
OFForward:
	.cfi_startproc
	addis	%r2, %r12, .TOC.-OFForward@ha
	addi	%r2, %r2, .TOC.-OFForward@l
.localentry OFForward, .-OFForward
	mflr	%r0
	std	%r0, 16(%r1)
	stdu	%r1, -160(%r1)
	.cfi_def_cfa_offset 160
	.cfi_offset lr, 16
	std	%r2, 24(%r1)

	/* Save all arguments */
	std	%r3, 32(%r1)
	std	%r4, 40(%r1)
	std	%r5, 48(%r1)
	std	%r6, 56(%r1)
	std	%r7, 64(%r1)
	std	%r8, 72(%r1)
	std	%r9, 80(%r1)
	std	%r10, 88(%r1)

	/* Save all floating point arguments */
	stfd	%f1, 96(%r1)
	stfd	%f2, 104(%r1)
	stfd	%f3, 112(%r1)
	stfd	%f4, 120(%r1)
	stfd	%f5, 128(%r1)
	stfd	%f6, 136(%r1)
	stfd	%f7, 144(%r1)
	stfd	%f8, 152(%r1)

	bl	object_getClass
	nop

	addis	%r4, %r2, .Lsel_forwardingTargetForSelector_@toc@ha
	addi	%r4, %r4, .Lsel_forwardingTargetForSelector_@toc@l
	bl	class_respondsToSelector
	nop

	cmpdi	%r3, 0
	beq-	0f

	ld	%r3, 32(%r1)
	addis	%r4, %r2, .Lsel_forwardingTargetForSelector_@toc@ha
	addi	%r4, %r4, .Lsel_forwardingTargetForSelector_@toc@l
	bl	objc_msg_lookup
	nop
	mr	%r12, %r3

	ld	%r3, 32(%r1)
	addis	%r4, %r2, .Lsel_forwardingTargetForSelector_@toc@ha
	addi	%r4, %r4, .Lsel_forwardingTargetForSelector_@toc@l
	ld	%r5, 40(%r1)
	mtctr	%r12
	bctrl
	ld	%r2, 24(%r1)

	cmpdi	%r3, 0
	beq-	0f
	ld	%r4, 32(%r1)
	cmpw	%r3, %r4
	beq-	0f

	std	%r3, 32(%r1)

	ld	%r4, 40(%r1)
	bl	objc_msg_lookup
	nop
	mr	%r12, %r3

	/* Restore all arguments */
	ld	%r3, 32(%r1)
	ld	%r4, 40(%r1)
	ld	%r5, 48(%r1)
	ld	%r6, 56(%r1)
	ld	%r7, 64(%r1)
	ld	%r8, 72(%r1)
	ld	%r9, 80(%r1)
	ld	%r10, 88(%r1)

	/* Restore all floating point arguments */
	lfd	%f1, 96(%r1)
	lfd	%f2, 104(%r1)
	lfd	%f3, 112(%r1)
	lfd	%f4, 120(%r1)
	lfd	%f5, 128(%r1)
	lfd	%f6, 136(%r1)
	lfd	%f7, 144(%r1)
	lfd	%f8, 152(%r1)

	addi	%r1, %r1, 160
	ld	%r0, 16(%r1)
	mtlr	%r0

	mtctr	%r12
	bctr

0:
	ld	%r3, 32(%r1)
	ld	%r4, 40(%r1)

	bl	OFMethodNotFound
	nop

	addi	%r1, %r1, 160
	lwz	%r0, 16(%r1)
	mtlr	%r0

	blr
	.cfi_endproc
.type OFForward, @function
.size OFForward, .-OFForward

OFForward_stret:
	.cfi_startproc
	addis	%r2, %r12, .TOC.-OFForward_stret@ha
	addi	%r2, %r2, .TOC.-OFForward_stret@l
.localentry OFForward_stret, .-OFForward_stret
	mflr	%r0
	std	%r0, 16(%r1)
	stdu	%r1, -160(%r1)
	.cfi_def_cfa_offset 160
	.cfi_offset lr, 16
	std	%r2, 24(%r1)

	/* Save all arguments */
	std	%r3, 32(%r1)
	std	%r4, 40(%r1)
	std	%r5, 48(%r1)
	std	%r6, 56(%r1)
	std	%r7, 64(%r1)
	std	%r8, 72(%r1)
	std	%r9, 80(%r1)
	std	%r10, 88(%r1)

	/* Save all floating point arguments */
	stfd	%f1, 96(%r1)
	stfd	%f2, 104(%r1)
	stfd	%f3, 112(%r1)
	stfd	%f4, 120(%r1)
	stfd	%f5, 128(%r1)
	stfd	%f6, 136(%r1)
	stfd	%f7, 144(%r1)
	stfd	%f8, 152(%r1)

	mr	%r3, %r4
	bl	object_getClass
	nop

	addis	%r4, %r2, .Lsel_forwardingTargetForSelector_@toc@ha
	addi	%r4, %r4, .Lsel_forwardingTargetForSelector_@toc@l
	bl	class_respondsToSelector
	nop

	cmpdi	%r3, 0
	beq-	0f

	ld	%r3, 40(%r1)
	addis	%r4, %r2, .Lsel_forwardingTargetForSelector_@toc@ha
	addi	%r4, %r4, .Lsel_forwardingTargetForSelector_@toc@l
	bl	objc_msg_lookup
	nop
	mr	%r12, %r3

	ld	%r3, 40(%r1)
	addis	%r4, %r2, .Lsel_forwardingTargetForSelector_@toc@ha
	addi	%r4, %r4, .Lsel_forwardingTargetForSelector_@toc@l
	ld	%r5, 48(%r1)
	mtctr	%r12
	bctrl
	ld	%r2, 24(%r1)

	cmpdi	%r3, 0
	beq-	0f
	ld	%r4, 40(%r1)
	cmpw	%r3, %r4
	beq-	0f

	std	%r3, 40(%r1)

	ld	%r4, 48(%r1)
	bl	objc_msg_lookup_stret
	nop
	mr	%r12, %r3

	/* Restore all arguments */
	ld	%r3, 32(%r1)
	ld	%r4, 40(%r1)
	ld	%r5, 48(%r1)
	ld	%r6, 56(%r1)
	ld	%r7, 64(%r1)
	ld	%r8, 72(%r1)
	ld	%r9, 80(%r1)
	ld	%r10, 88(%r1)

	/* Restore all floating point arguments */
	lfd	%f1, 96(%r1)
	lfd	%f2, 104(%r1)
	lfd	%f3, 112(%r1)
	lfd	%f4, 120(%r1)
	lfd	%f5, 128(%r1)
	lfd	%f6, 136(%r1)
	lfd	%f7, 144(%r1)
	lfd	%f8, 152(%r1)

	addi	%r1, %r1, 160
	ld	%r0, 16(%r1)
	mtlr	%r0

	mtctr	%r12
	bctr

0:
	ld	%r3, 32(%r1)
	ld	%r4, 40(%r1)
	ld	%r5, 48(%r1)

	bl	OFMethodNotFound_stret
	nop

	addi	%r1, %r1, 160
	lwz	%r0, 16(%r1)
	mtlr	%r0

	blr
	.cfi_endproc
.type OFForward_stret, @function
.size OFForward_stret, .-OFForward_stret

.Linit:
	addis	%r2, %r12, .TOC.-.Linit@ha
	addi	%r2, %r2, .TOC.-.Linit@l
.localentry .Linit, .-.Linit
	mflr	%r0
	std	%r0, 16(%r1)
	stdu	%r1, -32(%r1)

	addis	%r3, %r2, .Lmodule@toc@ha
	addi	%r3, %r3, .Lmodule@toc@l
	bl	__objc_exec_class
	nop

	addi	%r1, %r1, 32
	ld	%r0, 16(%r1)

	mtlr	%r0
	blr

.section .ctors, "aw", @progbits
	.quad .Linit

.section .rodata
.Lstr_forwardingTargetForSelector_:
	.asciz "forwardingTargetForSelector:"

.section .data
.Lsel_forwardingTargetForSelector_:
	.quad .Lstr_forwardingTargetForSelector_, 0
	.quad 0, 0
.Lsymtab:
	.quad 0, .Lsel_forwardingTargetForSelector_
	.short 0, 0
	.long 0
	.quad 0
.Lmodule:
	.quad 8, 32, 0, .Lsymtab

#if defined(OF_LINUX) || defined(OF_HAIKU) || defined(OF_HURD)
.section .note.GNU-stack, "", @progbits
#endif

Modified src/forwarding/forwarding.S from [ab4fbfbdfb] to [e8275219ea].

41
42
43
44
45
46
47


48
49
50
51
52
53
54
#   include "forwarding-x86-elf.S"
#  elif defined(OF_ARM64)
#   include "forwarding-arm64-elf.S"
#  elif defined(OF_ARM)
#   include "forwarding-arm-elf.S"
#  elif defined(OF_POWERPC)
#   include "forwarding-powerpc-elf.S"


#  elif defined(OF_MIPS64_N64)
#   include "forwarding-mips64-n64-elf.S"
#  elif defined(OF_MIPS)
#   include "forwarding-mips-elf.S"
#  elif defined(OF_SPARC64)
#   include "forwarding-sparc64-elf.S"
#  elif defined(OF_SPARC)







>
>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#   include "forwarding-x86-elf.S"
#  elif defined(OF_ARM64)
#   include "forwarding-arm64-elf.S"
#  elif defined(OF_ARM)
#   include "forwarding-arm-elf.S"
#  elif defined(OF_POWERPC)
#   include "forwarding-powerpc-elf.S"
#  elif defined(OF_POWERPC64) && defined(_CALL_ELF) && _CALL_ELF == 2
#   include "forwarding-powerpc64-elf.S"
#  elif defined(OF_MIPS64_N64)
#   include "forwarding-mips64-n64-elf.S"
#  elif defined(OF_MIPS)
#   include "forwarding-mips-elf.S"
#  elif defined(OF_SPARC64)
#   include "forwarding-sparc64-elf.S"
#  elif defined(OF_SPARC)

Modified src/macros.h from [e8d271f2ea] to [135cc5084f].

345
346
347
348
349
350
351
352

353
354
355
356
357
358
359
    defined(OF_ARM) || defined(OF_POWERPC)
#  define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR
#  define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET
# endif
#else
# if defined(OF_ELF)
#  if defined(OF_AMD64) || defined(OF_X86) || \
    defined(OF_ARM64) || defined(OF_ARM) || defined(OF_POWERPC) || \

    defined(OF_MIPS64_N64) || defined(OF_MIPS) || \
    defined(OF_SPARC64) || defined(OF_SPARC) || \
    defined(OF_RISCV64) || defined(OF_LOONGARCH64)
#   define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR
#   if __OBJFW_RUNTIME_ABI__ >= 800
#    define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET
#   endif







|
>







345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
    defined(OF_ARM) || defined(OF_POWERPC)
#  define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR
#  define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET
# endif
#else
# if defined(OF_ELF)
#  if defined(OF_AMD64) || defined(OF_X86) || \
    defined(OF_ARM64) || defined(OF_ARM) || \
    defined(OF_POWERPC) || defined(OF_POWERPC64) || \
    defined(OF_MIPS64_N64) || defined(OF_MIPS) || \
    defined(OF_SPARC64) || defined(OF_SPARC) || \
    defined(OF_RISCV64) || defined(OF_LOONGARCH64)
#   define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR
#   if __OBJFW_RUNTIME_ABI__ >= 800
#    define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET
#   endif