ObjFW  Check-in [1786dab1c0]

Overview
Comment:forwardingTargetForSelector: for MIPS64-N64/ELF
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1786dab1c015b347efe398227fc6a2e674c355a4fbdc91e331db7bbe1c4d389c
User & Date: js on 2024-05-27 22:11:27
Other Links: manifest | tags
References
2024-05-27
22:13 Fixed ticket [473a26192c]: Write assembly for forwardingTargetForSelector: on MIPS64/N64 ABI plus 5 other changes artifact: 1c6fb4a689 user: js
Context
2024-05-27
23:25
Add forwardingTargetForSelector: for RISC-V 64/ELF check-in: 76c7c09f34 user: js tags: trunk
22:11
forwardingTargetForSelector: for MIPS64-N64/ELF check-in: 1786dab1c0 user: js tags: trunk
2024-05-24
22:26
lookup-asm-riscv64-elf.S: Fix PIC check-in: add1755e4e user: js tags: trunk
Changes

Modified PLATFORMS.md from [abe894f229] to [6d9e9cf463].

265
266
267
268
269
270
271

272
273
274
275
276
277
278
for the following platforms (except resolveClassMethod: and
resolveInstanceMethod:, which are always available):

  * AMD64 (SysV/ELF, Apple/Mach-O, Mach-O, Win64/PE)
  * ARM (EABI/ELF, Apple/Mach-O)
  * ARM64 (ARM64/ELF, Apple/Mach-O)
  * MIPS (O32/ELF, EABI/ELF)

  * PowerPC (SysV/ELF, EABI/ELF, Apple/Mach-O)
  * SPARC (SysV/ELF)
  * SPARC64 (SysV/ELF)
  * x86 (SysV/ELF, Apple/Mach-O, Win32/PE)

Apple/Mach-O means both, the Apple ABI and runtime, while Mach-O means the
ObjFW runtime on Mach-O.







>







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
for the following platforms (except resolveClassMethod: and
resolveInstanceMethod:, which are always available):

  * AMD64 (SysV/ELF, Apple/Mach-O, Mach-O, Win64/PE)
  * ARM (EABI/ELF, Apple/Mach-O)
  * ARM64 (ARM64/ELF, Apple/Mach-O)
  * MIPS (O32/ELF, EABI/ELF)
  * MIPS64 (N64/ELF)
  * PowerPC (SysV/ELF, EABI/ELF, Apple/Mach-O)
  * SPARC (SysV/ELF)
  * SPARC64 (SysV/ELF)
  * x86 (SysV/ELF, Apple/Mach-O, Win32/PE)

Apple/Mach-O means both, the Apple ABI and runtime, while Mach-O means the
ObjFW runtime on Mach-O.

Added src/forwarding/forwarding-mips64-n64-elf.S version [83efc62004].

















































































































































































































































































































































































































































































































































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

.globl OFForward
.globl OFForward_stret

.section .text
OFForward:
	daddiu	$sp, $sp, -128
	sd	$ra, 0($sp)
	sd	$gp, 8($sp)

	lui	$gp, %hi(%neg(%gp_rel(OFForward)))
	daddiu	$gp, $gp, %lo(%neg(%gp_rel(OFForward)))
	daddu	$gp, $gp, $t9

	sd	$a0, 16($sp)
	sd	$a1, 24($sp)
	sd	$a2, 32($sp)
	sd	$a3, 40($sp)
	sd	$a4, 48($sp)
	sd	$a5, 56($sp)
	sd	$a6, 64($sp)
	sd	$a7, 72($sp)

	/*
	 * f12 and f13 are never used as the first two arguments are always
	 * self and _cmd.
	 */
	sdc1	$f14, 80($sp)
	sdc1	$f15, 88($sp)
	sdc1	$f16, 96($sp)
	sdc1	$f17, 104($sp)
	sdc1	$f18, 112($sp)
	sdc1	$f19, 120($sp)

	ld	$t9, %call16(object_getClass)($gp)
	jalr	$t9

	move	$a0, $v0
	ld	$a1, %got_disp(.Lsel_forwardingTargetForSelector_)($gp)
	ld	$t9, %call16(class_respondsToSelector)($gp)
	jalr	$t9
	beqz	$v0, 0f

	ld	$a0, 16($sp)
	ld	$a1, %got_disp(.Lsel_forwardingTargetForSelector_)($gp)
	ld	$t9, %call16(objc_msg_lookup)($gp)
	jalr	$t9

	ld	$a0, 16($sp)
	ld	$a1, %got_disp(.Lsel_forwardingTargetForSelector_)($gp)
	ld	$a2, 24($sp)
	move	$t9, $v0
	jalr	$t9

	beqz	$v0, 0f
	ld	$a0, 16($sp)
	beq	$v0, $a0, 0f

	sd	$v0, 16($sp)

	move	$a0, $v0
	ld	$a1, 24($sp)
	ld	$t9, %call16(objc_msg_lookup)($gp)
	jalr	$t9

	ldc1	$f19, 120($sp)
	ldc1	$f18, 112($sp)
	ldc1	$f17, 104($sp)
	ldc1	$f16, 96($sp)
	ldc1	$f15, 88($sp)
	ldc1	$f14, 80($sp)

	ld	$a7, 72($sp)
	ld	$a6, 64($sp)
	ld	$a5, 56($sp)
	ld	$a4, 48($sp)
	ld	$a3, 40($sp)
	ld	$a2, 32($sp)
	ld	$a1, 24($sp)
	ld	$a0, 16($sp)

	ld	$gp, 8($sp)
	ld	$ra, 0($sp)
	daddiu	$sp, $sp, 128

	move	$t9, $v0
	jr	$t9

0:
	ld	$t9, %call16(OFMethodNotFound)($gp)

	ld	$a1, 24($sp)
	ld	$a0, 16($sp)

	ld	$gp, 8($sp)
	ld	$ra, 0($sp)
	daddiu	$sp, $sp, 128

	jr	$t9
.type OFForward, @function
.size OFForward, .-OFForward

OFForward_stret:
	daddiu	$sp, $sp, -128
	sd	$ra, 0($sp)
	sd	$gp, 8($sp)

	lui	$gp, %hi(%neg(%gp_rel(OFForward_stret)))
	daddiu	$gp, $gp, %lo(%neg(%gp_rel(OFForward_stret)))
	daddu	$gp, $gp, $t9

	sd	$a0, 16($sp)
	sd	$a1, 24($sp)
	sd	$a2, 32($sp)
	sd	$a3, 40($sp)
	sd	$a4, 48($sp)
	sd	$a5, 56($sp)
	sd	$a6, 64($sp)
	sd	$a7, 72($sp)

	/*
	 * f12 and f13 are never used as the first two arguments are always
	 * self and _cmd.
	 */
	sdc1	$f14, 80($sp)
	sdc1	$f15, 88($sp)
	sdc1	$f16, 96($sp)
	sdc1	$f17, 104($sp)
	sdc1	$f18, 112($sp)
	sdc1	$f19, 120($sp)

	move	$a0, $a1
	ld	$t9, %call16(object_getClass)($gp)
	jalr	$t9

	move	$a0, $v0
	ld	$a1, %got_disp(.Lsel_forwardingTargetForSelector_)($gp)
	ld	$t9, %call16(class_respondsToSelector)($gp)
	jalr	$t9
	beqz	$v0, 0f

	ld	$a0, 24($sp)
	ld	$a1, %got_disp(.Lsel_forwardingTargetForSelector_)($gp)
	ld	$t9, %call16(objc_msg_lookup)($gp)
	jalr	$t9

	ld	$a0, 24($sp)
	ld	$a1, %got_disp(.Lsel_forwardingTargetForSelector_)($gp)
	ld	$a2, 32($sp)
	move	$t9, $v0
	jalr	$t9

	beqz	$v0, 0f
	ld	$a0, 24($sp)
	beq	$v0, $a0, 0f

	sd	$v0, 24($sp)

	move	$a0, $v0
	ld	$a1, 32($sp)
	ld	$t9, %call16(objc_msg_lookup_stret)($gp)
	jalr	$t9

	ldc1	$f19, 120($sp)
	ldc1	$f18, 112($sp)
	ldc1	$f17, 104($sp)
	ldc1	$f16, 96($sp)
	ldc1	$f15, 88($sp)
	ldc1	$f14, 80($sp)

	ld	$a7, 72($sp)
	ld	$a6, 64($sp)
	ld	$a5, 56($sp)
	ld	$a4, 48($sp)
	ld	$a3, 40($sp)
	ld	$a2, 32($sp)
	ld	$a1, 24($sp)
	ld	$a0, 16($sp)

	ld	$gp, 8($sp)
	ld	$ra, 0($sp)
	daddiu	$sp, $sp, 128

	move	$t9, $v0
	jr	$t9

0:
	ld	$t9, %call16(OFMethodNotFound_stret)($gp)

	ld	$a2, 32($sp)
	ld	$a1, 24($sp)
	ld	$a0, 16($sp)

	ld	$gp, 8($sp)
	ld	$ra, 0($sp)
	daddiu	$sp, $sp, 128

	jr	$t9
.type OFForward_stret, @function
.size OFForward_stret, .-OFForward_stret

.Linit:
	daddiu	$sp, $sp, -16
	sd	$ra, 0($sp)
	sd	$gp, 8($sp)

	lui	$gp, %hi(%neg(%gp_rel(.Linit)))
	daddiu	$gp, $gp, %lo(%neg(%gp_rel(.Linit)))
	daddu	$gp, $gp, $t9

	ld	$a0, %got_disp(.Lmodule)($gp)
	ld	$t9, %call16(__objc_exec_class)($gp)
	jalr	$t9

	ld	$gp, 8($sp)
	ld	$ra, 0($sp)
	daddiu	$sp, $sp, 16

	jr	$ra

.section .init_array, "aw"
	.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 [90b59c1fef] to [ff97db8f90].

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_MIPS)
#   include "forwarding-mips-elf.S"
#  elif defined(OF_SPARC64)
#   include "forwarding-sparc64-elf.S"
#  elif defined(OF_SPARC)
#   include "forwarding-sparc-elf.S"
#  endif







>
>







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_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)
#   include "forwarding-sparc-elf.S"
#  endif

Modified src/macros.h from [3c8f4714cc] to [829cf14e23].

346
347
348
349
350
351
352

353
354
355
356
357
358
359
360
#  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_MIPS) || defined(OF_SPARC64) || defined(OF_SPARC)
#   define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR
#   if __OBJFW_RUNTIME_ABI__ >= 800
#    define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET
#   endif
#  endif
# elif defined(OF_MACH_O)
#  if defined(OF_AMD64)







>
|







346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
#  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)
#   define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR
#   if __OBJFW_RUNTIME_ABI__ >= 800
#    define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET
#   endif
#  endif
# elif defined(OF_MACH_O)
#  if defined(OF_AMD64)