Comment: | Rework forwarding API and ABI.
It matches the Apple API and ABI now and the forwarding handler itself This moves handling of +[resolve{Class,Instance}Method:] to the runtime Also fixes a potential stack problem in the forwarding for MIPS. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0c332aa2d2fbd36a76322a7e3e302280 |
User & Date: | js on 2013-12-27 02:07:14 |
Other Links: | manifest | tags |
2013-12-30
| ||
13:47 | Don't enter tests/plugin twice. check-in: 72c41bbf69 user: js tags: trunk | |
2013-12-27
| ||
02:07 | Rework forwarding API and ABI. check-in: 0c332aa2d2 user: js tags: trunk | |
2013-12-25
| ||
14:34 | PLATFORMS.md: Add a section about forwarding. check-in: 5f2b90222e user: js tags: trunk | |
Modified src/OFObject.m from [e741aba66a] to [a55f4922cc].
︙ | |||
61 62 63 64 65 66 67 | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | - - + + | # import "threading.h" #endif #if defined(OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR) extern id of_forward(id, SEL, ...); extern struct stret of_forward_stret(id, SEL, ...); #else |
︙ | |||
133 134 135 136 137 138 139 | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | - - - - - - - - - - - - - - - - + - - - - - + - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | /* * Just in case doesNotRecognizeSelector: returned, even though it must * never return. */ abort(); } |
︙ | |||
275 276 277 278 279 280 281 | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | - - - - - - | @implementation OFObject + (void)load { #if !defined(OF_APPLE_RUNTIME) || defined(__OBJC2__) objc_setUncaughtExceptionHandler(uncaughtExceptionHandler); #endif |
︙ |
Modified src/forwarding/apple-forwarding-arm.S from [71a0f74942] to [a9ffa0e379].
︙ | |||
28 29 30 31 32 33 34 | 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 | - + + + + + - - - + - - + + - - + - + - + + + + + - - - + - - + + - - + - + - - - + | .section __DATA, __objc_imageinfo, regular, no_dead_strip .long 0, 0 .section __TEXT, __text, regular, pure_instructions .arm .align 2 _of_forward: |
Modified src/forwarding/apple-forwarding-arm64.S from [bd6425afa7] to [8cba7c9e68].
︙ | |||
52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | + | adrp x19, L_sel_forwardingTargetForSelector_@PAGE add x19, x19, L_sel_forwardingTargetForSelector_@PAGEOFF ldr x19, [x19] mov x1, x19 bl _class_respondsToSelector cbz x0, fail ldp x0, x2, [sp] mov x1, x19 bl _objc_msgSend cbz x0, fail |
︙ |
Modified src/forwarding/apple-forwarding-i386.S from [8a15676211] to [d1c0103e06].
︙ | |||
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 | 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 | + + - | movl %esp, %ebp pushl %ebx subl $20, %esp call get_eip .L0: movl 8(%ebp), %eax movl %eax, (%esp) call _object_getClass movl %eax, (%esp) movl L_sel_forwardingTargetForSelector_-.L0(%ebx), %eax movl %eax, 4(%esp) call _class_respondsToSelector testl %eax, %eax jz fail movl 8(%ebp), %eax movl %eax, (%esp) movl L_sel_forwardingTargetForSelector_-.L0(%ebx), %eax movl %eax, 4(%esp) movl 12(%ebp), %eax movl %eax, 8(%esp) call _objc_msgSend testl %eax, %eax jz fail |
︙ | |||
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 | 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 | + + - - - - - - - + | movl %esp, %ebp pushl %ebx subl $20, %esp call get_eip .L1: movl 12(%ebp), %eax movl %eax, (%esp) call _object_getClass movl %eax, (%esp) movl L_sel_forwardingTargetForSelector_-.L1(%ebx), %eax movl %eax, 4(%esp) call _class_respondsToSelector testl %eax, %eax jz fail_stret movl 12(%ebp), %eax movl %eax, (%esp) movl L_sel_forwardingTargetForSelector_-.L1(%ebx), %eax movl %eax, 4(%esp) movl 16(%ebp), %eax movl %eax, 8(%esp) call _objc_msgSend testl %eax, %eax jz fail_stret |
Modified src/forwarding/apple-forwarding-ppc.S from [a34378a6db] to [744faa6cfb].
︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 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 | + + - | bl _object_getClass bl L0 L0: mflr r13 addis r13, r13, ha16(L_sel_forwardingTargetForSelector_-L0) lwz r13, lo16(L_sel_forwardingTargetForSelector_-L0)(r13) mr r4, r13 bl _class_respondsToSelector cmpwi r3, 0 beq- fail lwz r3, 216(r1) mr r4, r13 lwz r5, 220(r1) bl _objc_msgSend cmpwi r3, 0 beq- fail |
︙ | |||
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | 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 | + + - | bl _object_getClass bl L1 L1: mflr r13 addis r13, r13, ha16(L_sel_forwardingTargetForSelector_-L1) lwz r13, lo16(L_sel_forwardingTargetForSelector_-L1)(r13) mr r4, r13 bl _class_respondsToSelector cmpwi r3, 0 beq- fail_stret lwz r3, 212(r1) mr r4, r13 lwz r5, 216(r1) bl _objc_msgSend cmpwi r3, 0 beq- fail_stret |
︙ | |||
221 222 223 224 225 226 227 | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | - - + + + - + | addi r1, r1, 184 lwz r0, 8(r1) mtlr r0 b _objc_msgSend_stret fail_stret: |
Modified src/forwarding/apple-forwarding-x86_64.S from [b4c76d8ed5] to [541a8f5d95].
︙ | |||
52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 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 | + - - + - - + + + | movdqa %xmm7, -0xC0(%rbp) call _object_getClass movq %rax, %rdi movq L_sel_forwardingTargetForSelector_(%rip), %rsi call _class_respondsToSelector testq %rax, %rax jz fail movq -0x10(%rbp), %rdi movq L_sel_forwardingTargetForSelector_(%rip), %rsi movq -0x18(%rbp), %rdx call _objc_msgSend |
︙ | |||
132 133 134 135 136 137 138 | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | - - + - - + + + | testq %rax, %rax jz fail_stret movq -0x18(%rbp), %rdi movq L_sel_forwardingTargetForSelector_(%rip), %rsi movq -0x20(%rbp), %rdx call _objc_msgSend |
︙ | |||
162 163 164 165 166 167 168 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | + - - + + - + | movq %rbp, %rsp popq %rbp jmp _objc_msgSend_stret fail_stret: movq -0x10(%rbp), %rdi |
Modified src/forwarding/forwarding-amd64-elf.S from [6c6e2ed7b7] to [55f7a74c19].
︙ | |||
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 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 | + + + + + + + + + + + + + + + + + | movdqa %xmm2, -0x70(%rbp) movdqa %xmm3, -0x80(%rbp) movdqa %xmm4, -0x90(%rbp) movdqa %xmm5, -0xA0(%rbp) movdqa %xmm6, -0xB0(%rbp) movdqa %xmm7, -0xC0(%rbp) call object_getClass@PLT movq %rax, %rdi leaq sel_forwardingTargetForSelector_(%rip), %rsi call class_respondsToSelector@PLT testq %rax, %rax jz fail movq -0x10(%rbp), %rdi leaq sel_forwardingTargetForSelector_(%rip), %rsi call objc_msg_lookup@PLT movq -0x10(%rbp), %rdi leaq sel_forwardingTargetForSelector_(%rip), %rsi movq -0x18(%rbp), %rdx call *%rax testq %rax, %rax jz fail cmpq -0x10(%rbp), %rax je fail movq %rax, -0x10(%rbp) movq %rax, %rdi movq -0x18(%rbp), %rsi call objc_msg_lookup@PLT movq %rax, %r11 |
︙ | |||
70 71 72 73 74 75 76 77 78 79 80 81 82 83 | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | + + + + + + + + + | movq -0x10(%rbp), %rdi movq -0x8(%rbp), %rax movq %rbp, %rsp popq %rbp jmpq *%r11 fail: movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movq %rbp, %rsp popq %rbp jmp of_method_not_found@PLT .type of_forward, %function .size of_forward, .-of_forward of_forward_stret: pushq %rbp movq %rsp, %rbp |
︙ | |||
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | 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 | + + + + + + + + + + + + + + + + + | movdqa %xmm3, -0x80(%rbp) movdqa %xmm4, -0x90(%rbp) movdqa %xmm5, -0xA0(%rbp) movdqa %xmm6, -0xB0(%rbp) movdqa %xmm7, -0xC0(%rbp) movq %rsi, %rdi call object_getClass@PLT movq %rax, %rdi leaq sel_forwardingTargetForSelector_(%rip), %rsi call class_respondsToSelector@PLT testq %rax, %rax jz fail_stret movq -0x18(%rbp), %rdi leaq sel_forwardingTargetForSelector_(%rip), %rsi call objc_msg_lookup@PLT movq -0x18(%rbp), %rdi leaq sel_forwardingTargetForSelector_(%rip), %rsi movq -0x20(%rbp), %rdx call *%rax testq %rax, %rax jz fail_stret cmpq -0x18(%rbp), %rax je fail_stret movq %rax, -0x18(%rbp) movq %rax, %rdi movq -0x20(%rbp), %rsi call objc_msg_lookup_stret@PLT movq %rax, %r11 |
︙ | |||
130 131 132 133 134 135 136 137 138 139 140 141 142 143 | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | + + + + + + + + + + | movq -0x10(%rbp), %rdi movq -0x8(%rbp), %rax movq %rbp, %rsp popq %rbp jmpq *%r11 fail_stret: movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x20(%rbp), %rdx movq %rbp, %rsp popq %rbp jmp of_method_not_found_stret@PLT .type of_forward_stret, %function .size of_forward_stret, .-of_forward_stret init: leaq module(%rip), %rdi jmp __objc_exec_class@PLT |
︙ |
Modified src/forwarding/forwarding-arm-elf.S from [78ba43410f] to [81907b6d08].
︙ | |||
15 16 17 18 19 20 21 | 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 | - + - + - - + + + + + + + + + + + + - + + + + + + + - + + + + + + - + - - + - - + + + + + + + + + + + + + - + + + + + + + - + + + + + + | */ .globl of_forward .globl of_forward_stret .section .text of_forward: |
︙ |
Modified src/forwarding/forwarding-mips-elf.S from [ee8ef78a0b] to [685a078982].
︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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 | + + + + + + + + + + + + + + + + + + - + - - - - - - + + + + + + + + - - - - + + + + - - - - - - - - + + + + + + + + + - + - + - - - - - - + + + + + + + + + + + + + + - - - + + - - - - - - - + + - - - - - + + + + + + - + - + - - - - - + - - - - - - - - - + + + + + + + + - - - - + + + + - - - - - + + + + + + + + - + - - - - + + + + + + + + + + + + + - + - - - - - - + + + + + + + + - - - - + + + + - - - - - - - - + + + + + + + + - + - + - + - - - - - - + + + + + + + + + + + + + + + - - - + + - - - - - - - + + - - - - - + + + + + + - + - + - - - - - + - - - - - - - - - + + + + + + + + - - - - + + + + - - - - - + + + + + + + + - + - - - - + + + + + + + + + + + + + + | * 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 .globl of_forward_stret #ifdef __PIC__ .macro j_pic symbol lw $t9, %call16(\symbol)($gp) jr $t9 .endm .macro jal_pic symbol lw $t9, %call16(\symbol)($gp) jalr $t9 .endm #else .macro j_pic symbol j \symbol .endm .macro jal_pic symbol jal \symbol .endm #endif .section .text of_forward: #ifdef __PIC__ lui $gp, %hi(_gp_disp) addiu $gp, $gp, %lo(_gp_disp) addu $gp, $gp, $t9 #endif |
︙ |
Modified src/forwarding/forwarding-ppc-elf.S from [8b57a5618e] to [09cadab137].
︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 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 | + + + + + + + + + + + + + + + + + | stfd %f3, 56(%r1) stfd %f4, 64(%r1) stfd %f5, 72(%r1) stfd %f6, 80(%r1) stfd %f7, 88(%r1) stfd %f8, 96(%r1) bl object_getClass@plt lis %r4, sel_forwardingTargetForSelector_@ha la %r4, sel_forwardingTargetForSelector_@l(%r4) bl class_respondsToSelector@plt cmpwi %r3, 0 beq- fail lwz %r3, 8(%r1) lis %r4, sel_forwardingTargetForSelector_@ha la %r4, sel_forwardingTargetForSelector_@l(%r4) bl objc_msg_lookup@plt mtctr %r3 lwz %r3, 8(%r1) lis %r4, sel_forwardingTargetForSelector_@ha la %r4, sel_forwardingTargetForSelector_@l(%r4) lwz %r5, 12(%r1) bctrl cmpwi %r3, 0 beq- fail lwz %r4, 8(%r1) cmpw %r3, %r4 beq- fail stw %r3, 8(%r1) lwz %r4, 12(%r1) bl objc_msg_lookup@plt mtctr %r3 /* Restore all arguments */ |
︙ | |||
79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | + + + + + + + + + + | lfd %f7, 88(%r1) lfd %f8, 96(%r1) lwz %r0, 116(%r1) mtlr %r0 addi %r1, %r1, 112 bctr fail: lwz %r3, 8(%r1) lwz %r4, 12(%r1) lwz %r0, 116(%r1) mtlr %r0 addi %r1, %r1, 112 b of_method_not_found@plt .type of_forward, %function .size of_forward, .-of_forward of_forward_stret: stwu %r1, -112(%r1) mflr %r0 stw %r0, 116(%r1) |
︙ | |||
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | 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 | + + + + + + + + + + + + + + + + + | stfd %f4, 64(%r1) stfd %f5, 72(%r1) stfd %f6, 80(%r1) stfd %f7, 88(%r1) stfd %f8, 96(%r1) mr %r3, %r4 bl object_getClass@plt lis %r4, sel_forwardingTargetForSelector_@ha la %r4, sel_forwardingTargetForSelector_@l(%r4) bl class_respondsToSelector@plt cmpwi %r3, 0 beq- fail_stret lwz %r3, 12(%r1) lis %r4, sel_forwardingTargetForSelector_@ha la %r4, sel_forwardingTargetForSelector_@l(%r4) bl objc_msg_lookup@plt mtctr %r3 lwz %r3, 12(%r1) lis %r4, sel_forwardingTargetForSelector_@ha la %r4, sel_forwardingTargetForSelector_@l(%r4) lwz %r5, 16(%r1) bctrl cmpwi %r3, 0 beq- fail_stret lwz %r4, 12(%r1) cmpw %r3, %r4 beq- fail_stret stw %r3, 12(%r1) lwz %r4, 16(%r1) bl objc_msg_lookup_stret@plt mtctr %r3 /* Restore all arguments */ |
︙ | |||
148 149 150 151 152 153 154 155 156 157 158 159 160 161 | 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 | + + + + + + + + + + + | lfd %f7, 88(%r1) lfd %f8, 96(%r1) lwz %r0, 116(%r1) mtlr %r0 addi %r1, %r1, 112 bctr fail_stret: lwz %r3, 8(%r1) lwz %r4, 12(%r1) lwz %r5, 16(%r1) lwz %r0, 116(%r1) mtlr %r0 addi %r1, %r1, 112 b of_method_not_found_stret@plt .type of_forward_stret, %function .size of_forward_stret, .-of_forward_stret init: lis %r3, module@ha la %r3, module@l(%r3) b __objc_exec_class@plt |
︙ |
Modified src/forwarding/forwarding-x86-elf.S from [79691a7caf] to [0ee5fb8e08].
︙ | |||
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 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | movl %esp, %ebp pushl %ebx subl $20, %esp call get_eip .L0: movl 8(%ebp), %eax movl %eax, (%esp) leal object_getClass-.L0(%ebx), %eax call *%eax movl %eax, (%esp) leal sel_forwardingTargetForSelector_-.L0(%ebx), %eax movl %eax, 4(%esp) leal class_respondsToSelector-.L0(%ebx), %eax call *%eax testl %eax, %eax jz fail movl 8(%ebp), %eax movl %eax, (%esp) leal sel_forwardingTargetForSelector_-.L0(%ebx), %eax movl %eax, 4(%esp) leal objc_msg_lookup-.L0(%ebx), %eax call *%eax movl 8(%ebp), %edx movl %edx, (%esp) leal sel_forwardingTargetForSelector_-.L0(%ebx), %edx movl %edx, 4(%esp) movl 12(%ebp), %edx movl %edx, 8(%esp) call *%eax testl %eax, %eax jz fail cmpl 8(%ebp), %eax je fail movl %eax, 8(%ebp) movl %eax, (%esp) movl 12(%ebp), %eax movl %eax, 4(%esp) leal objc_msg_lookup-.L0(%ebx), %eax call *%eax addl $20, %esp popl %ebx popl %ebp jmp *%eax fail: leal of_method_not_found-.L0(%ebx), %eax addl $20, %esp popl %ebx popl %ebp jmp *%eax .type of_forward, %function .size of_forward, .-of_forward of_forward_stret: pushl %ebp movl %esp, %ebp pushl %ebx subl $20, %esp call get_eip .L1: movl 12(%ebp), %eax movl %eax, (%esp) leal object_getClass-.L1(%ebx), %eax call *%eax movl %eax, (%esp) leal sel_forwardingTargetForSelector_-.L1(%ebx), %eax movl %eax, 4(%esp) leal class_respondsToSelector-.L1(%ebx), %eax call *%eax testl %eax, %eax jz fail_stret movl 12(%ebp), %eax movl %eax, (%esp) leal sel_forwardingTargetForSelector_-.L1(%ebx), %eax movl %eax, 4(%esp) leal objc_msg_lookup-.L1(%ebx), %eax call *%eax movl 12(%ebp), %edx movl %edx, (%esp) leal sel_forwardingTargetForSelector_-.L1(%ebx), %edx movl %edx, 4(%esp) movl 16(%ebp), %edx movl %edx, 8(%esp) call *%eax testl %eax, %eax jz fail_stret cmpl 12(%ebp), %eax je fail_stret movl %eax, 12(%ebp) movl %eax, (%esp) movl 16(%ebp), %eax movl %eax, 4(%esp) leal objc_msg_lookup_stret-.L1(%ebx), %eax call *%eax addl $20, %esp popl %ebx popl %ebp jmp *%eax fail_stret: leal of_method_not_found_stret-.L1(%ebx), %eax addl $20, %esp popl %ebx popl %ebp jmp *%eax .type of_forward_stret, %function .size of_forward_stret, .-of_forward_stret |
︙ |
Modified src/forwarding/forwarding-x86-win32.S from [972226c4ef] to [8abd7a71aa].
︙ | |||
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 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | movl %esp, %ebp pushl %ebx subl $20, %esp call get_eip .L0: movl 8(%ebp), %eax movl %eax, (%esp) leal _object_getClass-.L0(%ebx), %eax call *%eax movl %eax, (%esp) leal sel_forwardingTargetForSelector_-.L0(%ebx), %eax movl %eax, 4(%esp) leal _class_respondsToSelector-.L0(%ebx), %eax call *%eax testl %eax, %eax jz fail movl 8(%ebp), %eax movl %eax, (%esp) leal sel_forwardingTargetForSelector_-.L0(%ebx), %eax movl %eax, 4(%esp) leal _objc_msg_lookup-.L0(%ebx), %eax call *%eax movl 8(%ebp), %edx movl %edx, (%esp) leal sel_forwardingTargetForSelector_-.L0(%ebx), %edx movl %edx, 4(%esp) movl 12(%ebp), %edx movl %edx, 8(%esp) call *%eax testl %eax, %eax jz fail cmpl 8(%ebp), %eax je fail movl %eax, 8(%ebp) movl %eax, (%esp) movl 12(%ebp), %eax movl %eax, 4(%esp) leal _objc_msg_lookup-.L0(%ebx), %eax call *%eax addl $20, %esp popl %ebx popl %ebp jmp *%eax fail: leal _of_method_not_found-.L0(%ebx), %eax addl $20, %esp popl %ebx popl %ebp jmp *%eax _of_forward_stret: pushl %ebp movl %esp, %ebp pushl %ebx subl $20, %esp call get_eip .L1: movl 12(%ebp), %eax movl %eax, (%esp) leal _object_getClass-.L1(%ebx), %eax call *%eax movl %eax, (%esp) leal sel_forwardingTargetForSelector_-.L1(%ebx), %eax movl %eax, 4(%esp) leal _class_respondsToSelector-.L1(%ebx), %eax call *%eax testl %eax, %eax jz fail_stret movl 12(%ebp), %eax movl %eax, (%esp) leal sel_forwardingTargetForSelector_-.L1(%ebx), %eax movl %eax, 4(%esp) leal _objc_msg_lookup-.L1(%ebx), %eax call *%eax movl 12(%ebp), %edx movl %edx, (%esp) leal sel_forwardingTargetForSelector_-.L1(%ebx), %edx movl %edx, 4(%esp) movl 16(%ebp), %edx movl %edx, 8(%esp) call *%eax testl %eax, %eax jz fail_stret cmpl 12(%ebp), %eax je fail_stret movl %eax, 12(%ebp) movl %eax, (%esp) movl 16(%ebp), %eax movl %eax, 4(%esp) leal _objc_msg_lookup_stret-.L1(%ebx), %eax call *%eax addl $20, %esp popl %ebx popl %ebp jmp *%eax fail_stret: leal _of_method_not_found_stret-.L1(%ebx), %eax addl $20, %esp popl %ebx popl %ebp jmp *%eax init: |
︙ |
Modified src/runtime/lookup-asm/lookup-asm-amd64-elf.S from [0076c67932] to [6dd8fa4deb].
︙ | |||
18 19 20 21 22 23 24 | 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 | - + - + - - + + | .globl objc_msg_lookup .globl objc_msg_lookup_stret .globl objc_msg_lookup_super .globl objc_msg_lookup_super_stret .section .text |
︙ |
Modified src/runtime/lookup-asm/lookup-asm-amd64-macho.S from [9f2fcb9422] to [9d19d61727].
︙ | |||
56 57 58 59 60 61 62 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | - - + + | movq 8(%rdi), %r8 movq 64(%r8), %r8 movq %rdi, %rax jmp Lmain$1 .endmacro |
Modified src/runtime/lookup-asm/lookup-asm-arm-elf.S from [79afacfbeb] to [3a32fa73f7].
︙ | |||
18 19 20 21 22 23 24 | 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 | - + - + | .globl objc_msg_lookup .globl objc_msg_lookup_stret .globl objc_msg_lookup_super .globl objc_msg_lookup_super_stret .section .text |
︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | - - + + | ldr r2, [r2, #32] b .main_\lookup .type \name, %function .size \name, .-\name .endm |
︙ |
Modified src/runtime/lookup-asm/lookup-asm-mips-elf.S from [48cdec849d] to [45689ef5fd].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + | .globl objc_msg_lookup .globl objc_msg_lookup_stret .globl objc_msg_lookup_super .globl objc_msg_lookup_super_stret .section .text |
︙ | |||
60 61 62 63 64 65 66 | 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 | - + - + | lw $t0, 0($t0) addu $t0, $t0, $t3 lw $t0, 0($t0) #ifdef __PIC__ beqz $t0, .forward_\name #else |
︙ | |||
109 110 111 112 113 114 115 | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - - + + | la $v0, nil_method #endif j $ra .type \name, %function .size \name, .-\name .endm |
Modified src/runtime/lookup-asm/lookup-asm-ppc-elf.S from [43dfa59b3f] to [69f3a9eceb].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + | .globl objc_msg_lookup .globl objc_msg_lookup_stret .globl objc_msg_lookup_super .globl objc_msg_lookup_super_stret .section .text |
︙ | |||
52 53 54 55 56 57 58 | 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 | - + - - + + | cmpwi %r5, 0 beq- .forward_\name mr %r3, %r5 blr .forward_\name: |
︙ |
Modified src/runtime/lookup-asm/lookup-asm-x86-elf.S from [537ccf37ee] to [ea4c3fd137].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + | .globl objc_msg_lookup .globl objc_msg_lookup_stret .globl objc_msg_lookup_super .globl objc_msg_lookup_super_stret .section .text |
︙ | |||
47 48 49 50 51 52 53 | 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 | - + - - + + | jz .forward_\name ret .forward_\name: call get_eip .forward_L0_\name: |
︙ |
Modified src/runtime/lookup-asm/lookup-asm-x86-win32.S from [33d9469129] to [a61203a836].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + | .globl _objc_msg_lookup .globl _objc_msg_lookup_stret .globl _objc_msg_lookup_super .globl _objc_msg_lookup_super_stret .section .text |
︙ | |||
47 48 49 50 51 52 53 | 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 | - + - - + + | jz .forward_\name ret .forward_\name: call get_eip .forward_L0_\name: |
︙ |
Modified src/runtime/lookup.m from [1c3a42c0f8] to [5baad6528e].
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | - - + + - + - | #include <stdio.h> #include <stdlib.h> #import "runtime.h" #import "runtime-private.h" #import "macros.h" |
︙ | |||
50 51 52 53 54 55 56 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + + + + + + + + - + - + - + - + - + - + - + - + | * The reason for this is that a call to super is not possible * before a message to the class has been sent and it thus has * been initialized together with its superclasses. */ return lookup(obj, sel); } /* Try resolveClassMethod:/resolveInstanceMethod: */ if (class_isMetaClass(object_getClass(obj))) { Class cls = object_getClass(obj); if (class_respondsToSelector(cls, @selector(resolveClassMethod:)) && [obj resolveClassMethod: sel]) { if (!class_respondsToSelector(cls, sel)) OBJC_ERROR("[%s resolveClassMethod: %s] " "returned true without adding the method!", class_getName(obj), sel_getName(sel)); return lookup(obj, sel); } } else { Class cls = object_getClass(obj); Class metacls = object_getClass(cls); if (class_respondsToSelector(metacls, @selector(resolveInstanceMethod:)) && [cls resolveInstanceMethod: sel]) { if (!class_respondsToSelector(cls, sel)) OBJC_ERROR("[%s resolveInstanceMethod: %s] " "returned true without adding the method!", class_getName(object_getClass(obj)), sel_getName(sel)); return lookup(obj, sel); } } |
Modified src/runtime/runtime.h from [bd61ad8aad] to [86f17c06b0].
︙ | |||
204 205 206 207 208 209 210 | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | - + - | extern const char* object_getClassName(id); extern const char* protocol_getName(Protocol*); extern bool protocol_isEqual(Protocol*, Protocol*); extern bool protocol_conformsToProtocol(Protocol*, Protocol*); extern void objc_exit(void); extern objc_uncaught_exception_handler objc_setUncaughtExceptionHandler( objc_uncaught_exception_handler); |
︙ |
Modified tests/ForwardingTests.m from [9c077ad9ee] to [aba6c5c543].
︙ | |||
43 44 45 46 47 48 49 | 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 | - - - - + + + + - - + + + + | @interface ForwardingTest: OFObject @end @interface ForwardingTest (Test) + (void)test; - (void)test; |
︙ | |||
112 113 114 115 116 117 118 | 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 | + + - + + + + + + + - - - - + + + + - + - + - + - + - + | if (sel_isEqual(selector, @selector(forwardingTargetTest::::)) || sel_isEqual(selector, @selector(forwardingTargetVarArgTest:)) || sel_isEqual(selector, @selector(forwardingTargetFPRetTest)) || sel_isEqual(selector, @selector(forwardingTargetStRetTest))) return (id)((char*)target + (ptrdiff_t)add); if (sel_isEqual(selector, @selector(forwardingTargetNilTest)) || sel_isEqual(selector, @selector(forwardingTargetNilStRetTest))) |
︙ | |||
193 194 195 196 197 198 199 | 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 | - - + + - + - + - - + + + + - - + + + + + + | #ifdef OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR target = [[[ForwardingTarget alloc] init] autorelease]; TEST(@"-[forwardingTargetForSelector:]", [t forwardingTargetTest: 0xDEADBEEF : -1 : 1.25 |