ObjFW  Check-in [995af4a904]

Overview
Comment:Add ARM64/Win64 assembly lookup implementation
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 995af4a904dba54f9111a92527809cc3f4e5f2d86ecffe3291563c22f393dc53
User & Date: js on 2024-08-30 18:58:26
Other Links: manifest | tags
References
2024-08-30
19:52 Fixed ticket [16ba848e08]: Write assembly for dispatch on Windows/ARM64 plus 4 other changes artifact: 1ef1f6872b user: js
Context
2024-08-30
19:41
Add forwardingTargetForSelector: for ARM64/Win64 check-in: 55450a564e user: js tags: trunk
18:58
Add ARM64/Win64 assembly lookup implementation check-in: 995af4a904 user: js tags: trunk
2024-08-26
22:25
GitHub Actions: Add DJGPP check-in: 9aa3bdbab2 user: js tags: trunk
Changes

Added src/runtime/lookup-asm/lookup-asm-arm64-win64.S version [35ee87be91].

































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/*
 * 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 objc_msg_lookup
.globl objc_msg_lookup_stret
.globl objc_msg_lookup_super
.globl objc_msg_lookup_super_stret

.section .text
.macro GENERATE_LOOKUP name notFound
\name:
#ifdef HAVE_BTI
	bti	c
#endif

	cbz	x0, .LreturnNilMethod

	tbnz	x0, #0, .LtaggedPointer_\name

	ldr	x2, [x0]
	ldr	x2, [x2, #56]

.Lmain_\name:
#ifdef OF_SELUID24
	ldrb	w3, [x1, #2]
	ldr	x2, [x2, x3, lsl #3]
#endif
	ldrb	w3, [x1, #1]
	ldr	x2, [x2, x3, lsl #3]
	ldrb	w3, [x1]
	ldr	x2, [x2, x3, lsl #3]

	cbz	x2, \notFound

	mov	x0, x2
	ret

.LtaggedPointer_\name:
	adrp	x2, objc_taggedPointerSecret
	ldr	x2, [x2, :lo12:objc_taggedPointerSecret]
	eor	x0, x0, x2
	and	x0, x0, #0xE
	lsl	x0, x0, #2

	adrp	x2, objc_taggedPointerClasses
	add	x2, x2, :lo12:objc_taggedPointerClasses
	ldr	x2, [x2, x0]
	ldr	x2, [x2, #56]

	b	.Lmain_\name
.def \name
.scl 2
.type 32
.endef
.endm

.macro GENERATE_LOOKUP_SUPER name lookup
\name:
#ifdef HAVE_BTI
	bti	c
#endif

	mov	x2, x0
	ldr	x0, [x0]
	cbz	x0, .LreturnNilMethod

	ldr	x2, [x2, #8]
	ldr	x2, [x2, #56]

	b	.Lmain_\lookup
.def \name
.scl 2
.type 32
.endef
.endm

GENERATE_LOOKUP objc_msg_lookup objc_methodNotFound
GENERATE_LOOKUP objc_msg_lookup_stret objc_methodNotFound_stret
GENERATE_LOOKUP_SUPER objc_msg_lookup_super objc_msg_lookup
GENERATE_LOOKUP_SUPER objc_msg_lookup_super_stret objc_msg_lookup_stret

.LreturnNilMethod:
	adr	x0, .LnilMethod
	ret

.LnilMethod:
#ifdef HAVE_BTI
	bti	c
#endif

	mov	x0, #0
	ret

Modified src/runtime/lookup-asm/lookup-asm.S from [afae4eb55f] to [01bccf0b57].

52
53
54
55
56
57
58


59
60
#  include "lookup-asm-amd64-macho.S"
# endif
#elif defined(OF_WINDOWS)
# if defined(OF_AMD64)
#  include "lookup-asm-amd64-win64.S"
# elif defined(OF_X86)
#  include "lookup-asm-x86-win32.S"


# endif
#endif







>
>


52
53
54
55
56
57
58
59
60
61
62
#  include "lookup-asm-amd64-macho.S"
# endif
#elif defined(OF_WINDOWS)
# if defined(OF_AMD64)
#  include "lookup-asm-amd64-win64.S"
# elif defined(OF_X86)
#  include "lookup-asm-x86-win32.S"
# elif defined(OF_ARM64)
#  include "lookup-asm-arm64-win64.S"
# endif
#endif

Modified src/runtime/private.h from [cceb11309c] to [a04a7cf235].

318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
#  define OF_ASM_LOOKUP
# endif
#elif defined(OF_MACH_O)
# if defined(OF_AMD64)
#  define OF_ASM_LOOKUP
# endif
#elif defined(OF_WINDOWS)
# if defined(OF_AMD64) || defined(OF_X86)
#  define OF_ASM_LOOKUP
# endif
#endif

@interface DummyObject
{
	Class _Nonnull isa;







|







318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
#  define OF_ASM_LOOKUP
# endif
#elif defined(OF_MACH_O)
# if defined(OF_AMD64)
#  define OF_ASM_LOOKUP
# endif
#elif defined(OF_WINDOWS)
# if defined(OF_AMD64) || defined(OF_X86) || defined(OF_ARM64)
#  define OF_ASM_LOOKUP
# endif
#endif

@interface DummyObject
{
	Class _Nonnull isa;