Overview
Comment: | Add forwardingTargetForSelector: for AMD64/ELF.
Currently, no methods returning structs are supported, see the comment |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5a6cc94418ebec9def834401dfc54a5f |
User & Date: | js on 2013-03-16 10:13:47 |
Other Links: | manifest | tags |
Context
2013-03-17
| ||
15:23 | Add -[OFHTTPRequestReply string]. check-in: 0a1b06a6bf user: js tags: trunk | |
2013-03-16
| ||
10:13 | Add forwardingTargetForSelector: for AMD64/ELF. check-in: 5a6cc94418 user: js tags: trunk | |
2013-03-15
| ||
17:04 | OFHTTPClient: Implement "Connection: keep-alive". check-in: c195c1f098 user: js tags: trunk | |
Changes
Modified configure.ac from [1c32db1157] to [11985b8c37].
︙ | ︙ | |||
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | #if defined(__amd64__) || defined(__x86_64__) # ifdef __ELF__ yes # endif #endif ], [ AC_SUBST(LOOKUP_S, lookup-amd64-elf.S) AC_DEFINE(OF_ASM_LOOKUP, 1, [Whether to use assembly for lookup]) ], [ AC_EGREP_CPP(yes, [ #if defined(__i386__) && defined(__ELF__) yes #endif ], [ AC_SUBST(LOOKUP_S, lookup-x86-elf.S) | > > > | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | #if defined(__amd64__) || defined(__x86_64__) # ifdef __ELF__ yes # endif #endif ], [ AC_SUBST(LOOKUP_S, lookup-amd64-elf.S) AC_SUBST(FORWARDING_S, forwarding-amd64-elf.S) AC_DEFINE(OF_ASM_LOOKUP, 1, [Whether to use assembly for lookup]) AC_DEFINE(OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR, 1, [Whether we have forwardingTargetForSelector:]) ], [ AC_EGREP_CPP(yes, [ #if defined(__i386__) && defined(__ELF__) yes #endif ], [ AC_SUBST(LOOKUP_S, lookup-x86-elf.S) |
︙ | ︙ | |||
267 268 269 270 271 272 273 | AC_CHECK_LIB(objc, objc_msgSend, [ LIBS="-lobjc $LIBS" ], [ AC_MSG_ERROR([libobjc not found!]) ]) | > > > | > > | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | AC_CHECK_LIB(objc, objc_msgSend, [ LIBS="-lobjc $LIBS" ], [ AC_MSG_ERROR([libobjc not found!]) ]) dnl We should check for PPC64, as this currently does not dnl support forwardingTargetForSelector: as there is no test dnl machine available. AC_SUBST(FORWARDING_S, "apple-forwarding.S") AC_DEFINE(OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR, 1, [Whether we have forwardingTargetForSelector:]) ;; esac AC_CHECK_FUNC(objc_constructInstance, [], [ AC_SUBST(INSTANCE_M, "instance.m") ]) |
︙ | ︙ |
Modified extra.mk.in from [156a88b3a2] to [ee1481108e].
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | AUTORELEASE_M = @AUTORELEASE_M@ BIN_PREFIX = @BIN_PREFIX@ BRIDGE = @BRIDGE@ EXCEPTIONS_A = @EXCEPTIONS_A@ EXCEPTIONS_EXCEPTIONS_A = @EXCEPTIONS_EXCEPTIONS_A@ EXCEPTIONS_EXCEPTIONS_LIB_A = @EXCEPTIONS_EXCEPTIONS_LIB_A@ EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@ FOUNDATION_COMPAT_M = @FOUNDATION_COMPAT_M@ INSTANCE_M = @INSTANCE_M@ LOOKUP_S = @LOOKUP_S@ OFBLOCKTESTS_M = @OFBLOCKTESTS_M@ OFSTREAMOBSERVER_KQUEUE_M = @OFSTREAMOBSERVER_KQUEUE_M@ OFSTREAMOBSERVER_POLL_M = @OFSTREAMOBSERVER_POLL_M@ OFSTREAMOBSERVER_SELECT_M = @OFSTREAMOBSERVER_SELECT_M@ | > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | AUTORELEASE_M = @AUTORELEASE_M@ BIN_PREFIX = @BIN_PREFIX@ BRIDGE = @BRIDGE@ EXCEPTIONS_A = @EXCEPTIONS_A@ EXCEPTIONS_EXCEPTIONS_A = @EXCEPTIONS_EXCEPTIONS_A@ EXCEPTIONS_EXCEPTIONS_LIB_A = @EXCEPTIONS_EXCEPTIONS_LIB_A@ EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@ FORWARDING_S = @FORWARDING_S@ FOUNDATION_COMPAT_M = @FOUNDATION_COMPAT_M@ INSTANCE_M = @INSTANCE_M@ LOOKUP_S = @LOOKUP_S@ OFBLOCKTESTS_M = @OFBLOCKTESTS_M@ OFSTREAMOBSERVER_KQUEUE_M = @OFSTREAMOBSERVER_KQUEUE_M@ OFSTREAMOBSERVER_POLL_M = @OFSTREAMOBSERVER_POLL_M@ OFSTREAMOBSERVER_SELECT_M = @OFSTREAMOBSERVER_SELECT_M@ |
︙ | ︙ |
Modified src/Makefile from [4e8a943706] to [ba9ed93830].
︙ | ︙ | |||
112 113 114 115 116 117 118 | OFMutableString_UTF8.m \ OFSet_hashtable.m \ ${OFSTREAMOBSERVER_KQUEUE_M} \ ${OFSTREAMOBSERVER_POLL_M} \ ${OFSTREAMOBSERVER_SELECT_M} \ OFString_UTF8.m \ OFTCPSocket+SOCKS5.m \ | < > | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | OFMutableString_UTF8.m \ OFSet_hashtable.m \ ${OFSTREAMOBSERVER_KQUEUE_M} \ ${OFSTREAMOBSERVER_POLL_M} \ ${OFSTREAMOBSERVER_SELECT_M} \ OFString_UTF8.m \ OFTCPSocket+SOCKS5.m \ ${ASPRINTF_M} \ ${FORWARDING_S} \ ${FOUNDATION_COMPAT_M} \ iso_8859_15.m \ windows_1252.m OBJS_EXTRA = ${EXCEPTIONS_EXCEPTIONS_A} ${RUNTIME_RUNTIME_A} LIB_OBJS_EXTRA = ${EXCEPTIONS_EXCEPTIONS_LIB_A} ${RUNTIME_RUNTIME_LIB_A} |
︙ | ︙ |
Modified src/OFObject.m from [2d5ba7013a] to [6922597523].
︙ | ︙ | |||
59 60 61 62 63 64 65 | #import "instance.h" #if defined(OF_HAVE_ATOMIC_OPS) # import "atomic.h" #elif defined(OF_HAVE_THREADS) # import "threading.h" #endif | | > > > > > > > > > > | 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 | #import "instance.h" #if defined(OF_HAVE_ATOMIC_OPS) # import "atomic.h" #elif defined(OF_HAVE_THREADS) # import "threading.h" #endif #if defined(OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR) extern id of_forward(id, SEL, ...); # ifdef OF_APPLE_RUNTIME /* * Forwarding for methods returning structs only works with the Apple ABI, as * with the GNU ABI, there is no way of knowing if a struct is returned and if * so how. * As forwardingTargetForSelector: only works for architectures for which * assembly has been written anyway, it makes sense to switch to * objc_msgSend(_{st,fp}ret) for those architectures to solve this problem. */ extern struct stret of_forward_stret(id, SEL, ...); # endif #endif struct pre_ivar { int32_t retainCount; struct pre_mem *firstMem, *lastMem; #if !defined(OF_HAVE_ATOMIC_OPS) && defined(OF_HAVE_THREADS) of_spinlock_t retainCountSpinlock; |
︙ | ︙ | |||
156 157 158 159 160 161 162 163 164 165 166 167 168 169 | sel_getName(sel)); abort(); } return objc_msg_lookup(obj, sel); } } of_method_not_found(obj, sel); return NULL; } #endif #ifndef HAVE_OBJC_ENUMERATIONMUTATION | > > > > > > > > > > | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | sel_getName(sel)); abort(); } return objc_msg_lookup(obj, sel); } } #ifdef OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR if (class_respondsToSelector(object_getClass(obj), @selector(forwardingTargetForSelector:))) { id target = [obj forwardingTargetForSelector: sel]; if (target != nil && target != obj) return (IMP)of_forward; } #endif of_method_not_found(obj, sel); return NULL; } #endif #ifndef HAVE_OBJC_ENUMERATIONMUTATION |
︙ | ︙ |
Added src/forwarding-amd64-elf.S version [d81347873d].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* * 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. */ .globl of_forward .section .text of_forward: pushq %rbp movq %rsp, %rbp /* Save all arguments */ subq $0xC0, %rsp /* 16-byte alignment */ movq %rax, 0xA8(%rsp) movq %rdi, 0xA0(%rsp) movq %rsi, 0x98(%rsp) movq %rdx, 0x90(%rsp) movq %rcx, 0x88(%rsp) movq %r8, 0x80(%rsp) movq %r9, 0x78(%rsp) movd %xmm0, 0x70(%rsp) movd %xmm1, 0x60(%rsp) movd %xmm2, 0x50(%rsp) movd %xmm3, 0x40(%rsp) movd %xmm4, 0x30(%rsp) movd %xmm5, 0x20(%rsp) movd %xmm6, 0x10(%rsp) movd %xmm7, (%rsp) leaq sel_forwardingTargetForSelector_(%rip), %rsi call objc_msg_lookup@PLT movq 0xA0(%rsp), %rdi leaq sel_forwardingTargetForSelector_(%rip), %rsi movq 0x98(%rsp), %rdx call *%rax movq %rax, 0xA0(%rsp) movq %rax, %rdi movq 0x98(%rsp), %rsi call objc_msg_lookup@PLT movq %rax, %r11 /* Restore all arguments */ movd (%rsp), %xmm7 movd 0x10(%rsp), %xmm6 movd 0x20(%rsp), %xmm5 movd 0x30(%rsp), %xmm4 movd 0x40(%rsp), %xmm3 movd 0x50(%rsp), %xmm2 movd 0x60(%rsp), %xmm1 movd 0x70(%rsp), %xmm0 movq 0x78(%rsp), %r9 movq 0x80(%rsp), %r8 movq 0x88(%rsp), %rcx movq 0x90(%rsp), %rdx movq 0x98(%rsp), %rsi movq 0xA0(%rsp), %rdi movq 0xA8(%rsp), %rax movq %rbp, %rsp popq %rbp jmp *%r11 init: leaq module(%rip), %rdi call __objc_exec_class@PLT ret .section .init_array .quad init .section .rodata str_forwardingTargetForSelector_: .asciz "forwardingTargetForSelector:" .section .data sel_forwardingTargetForSelector_: .quad str_forwardingTargetForSelector_, 0 .quad 0, 0 symtab: .quad 0, sel_forwardingTargetForSelector_ .short 0, 0 .long 0 .quad 0 module: .quad 8, 32, 0, symtab .type of_forward, %function .size of_forward, init-of_forward #ifdef __linux__ .section .note.GNU-stack, "", %progbits #endif |
Modified src/objfw-defs.h.in from [8a8805198b] to [f518fd1de0].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #undef OF_APPLE_RUNTIME #undef OF_BIG_ENDIAN #undef OF_FLOAT_BIG_ENDIAN #undef OF_HAVE_ASPRINTF #undef OF_HAVE_ATOMIC_OPS #undef OF_HAVE_COMPILER_TLS #undef OF_HAVE_GCC_ATOMIC_OPS #undef OF_HAVE_OSATOMIC #undef OF_HAVE_OSATOMIC_64 #undef OF_HAVE_PTHREADS #undef OF_HAVE_PLUGINS #undef OF_HAVE_PTHREAD_SPINLOCKS #undef OF_HAVE_RECURSIVE_PTHREAD_MUTEXES #undef OF_HAVE_SCHED_YIELD #undef OF_HAVE_THREADS #undef OF_OBJFW_RUNTIME #undef SIZE_MAX | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #undef OF_APPLE_RUNTIME #undef OF_BIG_ENDIAN #undef OF_FLOAT_BIG_ENDIAN #undef OF_HAVE_ASPRINTF #undef OF_HAVE_ATOMIC_OPS #undef OF_HAVE_COMPILER_TLS #undef OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR #undef OF_HAVE_GCC_ATOMIC_OPS #undef OF_HAVE_OSATOMIC #undef OF_HAVE_OSATOMIC_64 #undef OF_HAVE_PTHREADS #undef OF_HAVE_PLUGINS #undef OF_HAVE_PTHREAD_SPINLOCKS #undef OF_HAVE_RECURSIVE_PTHREAD_MUTEXES #undef OF_HAVE_SCHED_YIELD #undef OF_HAVE_THREADS #undef OF_OBJFW_RUNTIME #undef SIZE_MAX |
Modified src/runtime/lookup-amd64-elf.S from [6c8a793449] to [8fd99fa5f3].
︙ | ︙ | |||
36 37 38 39 40 41 42 | movq (%r8,%rax,8), %r8 #endif movq (%r8,%rcx,8), %r8 movq (%r8,%rdx,8), %rax testq %rax, %rax | | < < < < | | | | 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 | movq (%r8,%rax,8), %r8 #endif movq (%r8,%rcx,8), %r8 movq (%r8,%rdx,8), %rax testq %rax, %rax jz objc_not_found_handler@PLT ret objc_msg_lookup_super: movq (%rdi), %rax testq %rax, %rax jz ret_nil movq 8(%rdi), %r8 movq 64(%r8), %r8 movq %rdi, %rax jmp lookup ret_nil: leaq nil_method(%rip), %rax ret nil_method: movq %rdi, %rax ret .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 |
Modified src/runtime/lookup-ppc-elf.S from [7c38dd494b] to [728d9ac121].
︙ | ︙ | |||
77 78 79 80 81 82 83 | li %r3, 0 blr get_pc: mflr %r3 blr | | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | li %r3, 0 blr get_pc: mflr %r3 blr .type objc_msg_lookup, %function .type objc_msg_lookup_super, %function .size objc_msg_lookup, forward-objc_msg_lookup .size objc_msg_lookup_super, ret_nil-objc_msg_lookup_super #ifdef __linux__ .section .note.GNU-stack, "", %progbits #endif |
Modified src/runtime/lookup-x86-elf.S from [f919315140] to [fdf247a310].
︙ | ︙ | |||
70 71 72 73 74 75 76 | movl 4(%esp), %eax ret get_eip: movl (%esp), %eax ret | | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | movl 4(%esp), %eax ret get_eip: movl (%esp), %eax ret .type objc_msg_lookup, %function .type objc_msg_lookup_super, %function .size objc_msg_lookup, forward-objc_msg_lookup .size objc_msg_lookup_super, ret_nil-objc_msg_lookup_super #ifdef __linux__ .section .note.GNU-stack, "", %progbits #endif |