Differences From Artifact [ee8ef78a0b]:
- File src/forwarding/forwarding-mips-elf.S — part of check-in [3695e89467] at 2013-12-25 00:01:08 on branch trunk — Make section .ctors "aw". (user: js, size: 5502) [annotate] [blame] [check-ins using]
To Artifact [685a078982]:
- File
src/forwarding/forwarding-mips-elf.S
— part of check-in
[0c332aa2d2]
at
2013-12-27 02:07:14
on branch trunk
— Rework forwarding API and ABI.
It matches the Apple API and ABI now and the forwarding handler itself
determines whether it should forward or not.This moves handling of +[resolve{Class,Instance}Method:] to the runtime
and allows adding new kinds of forwarding without changing the runtime.Also fixes a potential stack problem in the forwarding for MIPS. (user: js, size: 5914) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * 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 .section .text of_forward: #ifdef __PIC__ lui $gp, %hi(_gp_disp) addiu $gp, $gp, %lo(_gp_disp) addu $gp, $gp, $t9 #endif | > > > > > > > > > > > > > > > > > > | < | > > > | | | | | | | | | | | | | | | | > | | | | > | | > > > > | > > > | < | | < < < < < | | < < < < < > > > > > > | | < < < < | < | | | | | | | | | | | | | | | | > > > | | < | > > | > > > > > | > > > | < | > > > | | | | | | | | | | | | | | | | | | | | | > > | | > > > > | > > > | < | | < < < < < | | < < < < < > > > > > > | | < < < < | < | | | | | | | | | | | | | | | | > > > | | < | > > | > > > > > > | > > > | 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 addiu $sp, $sp, -96 /* * O32: The registers for floating point arguments don't need to be * saved, as the ABI specifies that all remaining arguments are passed * in integer registers if the first argument is passed in an integer * register. This is always the case, as the first argument is always * self. */ sw $ra, 16($sp) sw $s0, 20($sp) sw $s1, 24($sp) sw $a0, 28($sp) sw $a1, 32($sp) sw $a2, 36($sp) sw $a3, 40($sp) #ifdef __mips_eabi /* For some reason, $a4-$a8 are not always defined */ sw $8, 44($sp) sw $9, 48($sp) sw $10, 52($sp) sw $11, 56($sp) swc1 $f12, 60($sp) swc1 $f13, 64($sp) swc1 $f14, 68($sp) swc1 $f15, 72($sp) swc1 $f16, 76($sp) swc1 $f17, 80($sp) swc1 $f18, 84($sp) swc1 $f19, 88($sp) #endif move $s0, $gp #ifdef __PIC__ lw $s1, %got(sel_forwardingTargetForSelector_)($gp) #else lui $s1, %hi(sel_forwardingTargetForSelector_) #endif addiu $s1, $s1, %lo(sel_forwardingTargetForSelector_) jal_pic object_getClass move $gp, $s0 move $a0, $v0 move $a1, $s1 jal_pic class_respondsToSelector beqz $v0, fail move $gp, $s0 lw $a0, 28($sp) move $a1, $s1 jal_pic objc_msg_lookup move $gp, $s0 lw $a0, 28($sp) move $a1, $s1 lw $a2, 32($sp) move $t9, $v0 jalr $t9 beqz $v0, fail lw $t0, 28($sp) beq $v0, $t0, fail sw $v0, 28($sp) move $gp, $s0 move $a0, $v0 lw $a1, 32($sp) jal_pic objc_msg_lookup #ifdef __mips_eabi lwc1 $f19, 88($sp) lwc1 $f18, 84($sp) lwc1 $f17, 80($sp) lwc1 $f16, 76($sp) lwc1 $f15, 72($sp) lwc1 $f14, 68($sp) lwc1 $f13, 64($sp) lwc1 $f12, 60($sp) lw $11, 56($sp) lw $10, 52($sp) lw $9, 48($sp) lw $8, 44($sp) #endif lw $a3, 40($sp) lw $a2, 36($sp) lw $a1, 32($sp) lw $a0, 28($sp) lw $s1, 24($sp) lw $s0, 20($sp) lw $ra, 16($sp) addiu $sp, $sp, 96 move $t9, $v0 jr $t9 fail: move $gp, $s0 lw $a1, 32($sp) lw $a0, 28($sp) lw $s1, 24($sp) lw $s0, 20($sp) lw $ra, 16($sp) addiu $sp, $sp, 96 j_pic of_method_not_found .type of_forward, %function .size of_forward, .-of_forward of_forward_stret: #ifdef __PIC__ lui $gp, %hi(_gp_disp) addiu $gp, $gp, %lo(_gp_disp) addu $gp, $gp, $t9 #endif addiu $sp, $sp, -96 /* * O32: The registers for floating point arguments don't need to be * saved, as the ABI specifies that all remaining arguments are passed * in integer registers if the first argument is passed in an integer * register. This is always the case, as the first argument is always * self. */ sw $ra, 16($sp) sw $s0, 20($sp) sw $s1, 24($sp) sw $a0, 28($sp) sw $a1, 32($sp) sw $a2, 36($sp) sw $a3, 40($sp) #ifdef __mips_eabi /* For some reason, $a4-$a8 are not always defined */ sw $8, 44($sp) sw $9, 48($sp) sw $10, 52($sp) sw $11, 56($sp) swc1 $f12, 60($sp) swc1 $f13, 64($sp) swc1 $f14, 68($sp) swc1 $f15, 72($sp) swc1 $f16, 76($sp) swc1 $f17, 80($sp) swc1 $f18, 84($sp) swc1 $f19, 88($sp) #endif move $s0, $gp #ifdef __PIC__ lw $s1, %got(sel_forwardingTargetForSelector_)($gp) #else lui $s1, %hi(sel_forwardingTargetForSelector_) #endif addiu $s1, $s1, %lo(sel_forwardingTargetForSelector_) move $a0, $a1 jal_pic object_getClass move $gp, $s0 move $a0, $v0 move $a1, $s1 jal_pic class_respondsToSelector beqz $v0, fail_stret move $gp, $s0 lw $a0, 32($sp) move $a1, $s1 jal_pic objc_msg_lookup move $gp, $s0 lw $a0, 32($sp) move $a1, $s1 lw $a2, 36($sp) move $t9, $v0 jalr $t9 beqz $v0, fail_stret lw $t0, 32($sp) beq $v0, $t0, fail_stret sw $v0, 32($sp) move $gp, $s0 move $a0, $v0 lw $a1, 36($sp) jal_pic objc_msg_lookup_stret #ifdef __mips_eabi lwc1 $f19, 88($sp) lwc1 $f18, 84($sp) lwc1 $f17, 80($sp) lwc1 $f16, 76($sp) lwc1 $f15, 72($sp) lwc1 $f14, 68($sp) lwc1 $f13, 64($sp) lwc1 $f12, 60($sp) lw $11, 56($sp) lw $10, 52($sp) lw $9, 48($sp) lw $8, 44($sp) #endif lw $a3, 40($sp) lw $a2, 36($sp) lw $a1, 32($sp) lw $a0, 28($sp) lw $s1, 24($sp) lw $s0, 20($sp) lw $ra, 16($sp) addiu $sp, $sp, 96 move $t9, $v0 jr $t9 fail_stret: move $gp, $s0 lw $a2, 36($sp) lw $a1, 32($sp) lw $a0, 28($sp) lw $s1, 24($sp) lw $s0, 20($sp) lw $ra, 16($sp) addiu $sp, $sp, 96 j_pic of_method_not_found_stret .type of_forward_stret, %function .size of_forward_stret, .-of_forward_stret init: #ifdef __PIC__ lui $gp, %hi(_gp_disp) addiu $gp, $gp, %lo(_gp_disp) |
︙ | ︙ |