This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Commit c45076b
committed
[[ Bug 20644 ]] Fix calls to struct-returning obj-c methods
Sometimes structs are returned from Objective-C methods in
registers instead of using the address provided as a parameter. In
the latter case `objc_msgSend_stret` should be used instead of
`objc_msgSend`. The rules for when this happens are architecture and
struct-size dependent and FFI calls will crash if the wrong form
is used. This patch updates the code to use `objc_msgSend_stret`
just in case the method returns a struct and
- on arm64, the struct size > 64 bytes
- on arm, the struct size > 4 bytes
- on x86_64, the struct size > 16 bytes
- on i386, the struct size > 8 bytes or a power of 2.1 parent a615a61 commit c45076b
File tree
3 files changed
+46
-5
lines changed- docs/notes
- libscript/src
- tests/lcb/vm
3 files changed
+46
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
272 | 276 | | |
273 | 277 | | |
274 | 278 | | |
| |||
289 | 293 | | |
290 | 294 | | |
291 | 295 | | |
| 296 | + | |
292 | 297 | | |
293 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
294 | 303 | | |
295 | | - | |
| 304 | + | |
| 305 | + | |
296 | 306 | | |
297 | 307 | | |
298 | 308 | | |
299 | 309 | | |
300 | | - | |
| 310 | + | |
| 311 | + | |
301 | 312 | | |
302 | 313 | | |
303 | 314 | | |
304 | 315 | | |
305 | 316 | | |
306 | 317 | | |
307 | | - | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
308 | 321 | | |
309 | 322 | | |
310 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 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 | + | |
124 | 151 | | |
0 commit comments