ObjFW  Check-in [9c630f8f86]

Overview
Comment:Add MIPS/ELF assembly lookup implementation.

Only tested on the PSP so far.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9c630f8f86cd2ec802cc5231ba203630378c5d1e017583c814dc64e1df7ca034
User & Date: js on 2013-07-06 00:21:44
Other Links: manifest | tags
Context
2013-07-06
12:50
MIPS lookup: Let the assembler insert the nops. check-in: 8f346088f4 user: js tags: trunk
00:21
Add MIPS/ELF assembly lookup implementation. check-in: 9c630f8f86 user: js tags: trunk
2013-07-05
20:02
Warn if atomic ops AND spinlocks are missing. check-in: 2db4aee23f user: js tags: trunk
Changes

Modified configure.ac from [2ac906deae] to [6f64066a18].

285
286
287
288
289
290
291












292
293
294
295
296
297
298
			#if defined(__arm__) || defined(__ARM__)
			# ifdef __ELF__
			yes
			# endif
			#endif
		], [
			AC_SUBST(LOOKUP_S, lookup-arm-elf.S)












			AC_DEFINE(OF_ASM_LOOKUP, 1,
				[Whether to use assembly for lookup])
		])

		AS_IF([test x"$enable_seluid24" = x"yes"], [
			AC_DEFINE(OF_SELUID24, 1,
				[Whether to use 24 bit selector UIDs])







>
>
>
>
>
>
>
>
>
>
>
>







285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
			#if defined(__arm__) || defined(__ARM__)
			# ifdef __ELF__
			yes
			# endif
			#endif
		], [
			AC_SUBST(LOOKUP_S, lookup-arm-elf.S)
			AC_DEFINE(OF_ASM_LOOKUP, 1,
				[Whether to use assembly for lookup])
		])

		AC_EGREP_CPP(yes, [
			#if defined(__mips) && __mips < 64 && defined(__ELF__)
			# if defined(_MIPSEL) || defined(_MIPSEB)
			yes
			# endif
			#endif
		], [
			AC_SUBST(LOOKUP_S, lookup-mips-elf.S)
			AC_DEFINE(OF_ASM_LOOKUP, 1,
				[Whether to use assembly for lookup])
		])

		AS_IF([test x"$enable_seluid24" = x"yes"], [
			AC_DEFINE(OF_SELUID24, 1,
				[Whether to use 24 bit selector UIDs])

Added src/runtime/lookup-mips-elf.S version [7067db37e0].





































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * 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 objc_msg_lookup
.globl objc_msg_lookup_super

.section .text
objc_msg_lookup:
	beqz	$a0, ret_nil
	nop

	lw	$t0, 0($a0)
	lw	$t0, 32($t0)

lookup:
#if defined(_MIPSEL)
# ifdef OF_SELUID24
	lbu	$t1, 2($a1)
# endif
	lbu	$t2, 1($a1)
	lbu	$t3, 0($a1)
#elif defined(_MIPSEB)
# ifdef OF_SELUID24
	lbu	$t1, 1($a1)
# endif
	lbu	$t2, 2($a1)
	lbu	$t3, 3($a1)
#else
# error Neither _MIPSEL nor _MIPSEB defined!
#endif

#ifdef OF_SELUID24
	sll	$t1, $t1, 2
#endif
	sll	$t2, $t2, 2
	sll	$t3, $t3, 2

#ifdef OF_SELUID24
	addu	$t0, $t0, $t1
	lw	$t0, 0($t0)
#endif
	addu	$t0, $t0, $t2
	lw	$t0, 0($t0)
	addu	$t0, $t0, $t3
	lw	$t0, 0($t0)

	beqz	$t0, objc_not_found_handler
	nop

	move	$v0, $t0
	j	$ra
	nop

objc_msg_lookup_super:
	lw	$t0, 0($a0)
	beqz	$t0, ret_nil
	nop

	lw	$t0, 4($a0)
	lw	$t0, 32($t0)

	b	lookup
	nop

ret_nil:
	lui	$v0, %hi(nil_method)
	addiu	$v0, %lo(nil_method)
	j	$ra
	nop

nil_method:
	addu	$v0, $zero, $zero
	j	$ra
	nop

.type objc_msg_lookup, %function
.type objc_msg_lookup_super, %function
.size objc_msg_lookup, objc_msg_lookup_super-objc_msg_lookup
.size objc_msg_lookup_super, ret_nil-objc_msg_lookup_super

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