Commit 944302d
authored
add
The `__atomic` convention promises that a foreign function will not
call back into Scheme, such as through a foreign callable, before it
returns. That promise enables a more direct call to the foreign
function. For example, on my machine, calling
```
(foreign-procedure __atomic "(cs)s_errno" () int))
```
takes about 80% the time of calling
```
(foreign-procedure "(cs)s_errno" () int))
```
When a foreign function has arguments or results that are represented
as flonums, using `__atomic` allows the call to be exposed enough in
intermediate compiler passes so that it can partitcapte in
flonum-unboxing optimizations. In principle, unboxing optimizations
could also apply to non-`__atomic` foreign functions, but the current
calling convention for Scheme functions and the protocol between
Scheme code and the kernel (especially the garbage collector) make
that difficult. Further improvements there are possible, but functions
that fit the `__atomic` constraint can be handled relatively easily.
Probably `__atomic` is wanted for the best performance, anyway, when
unboxing is relevant.
Meanwhile, various problems were interfering with flonum unboxing
around `ftype-ref` and `ftype-set!` on `double` and `float` fields,
and those problems are now fixed.
Closes #921 and uses parts of the example there by @williewillus in
tests.__atomic foreign convention and improve related flonum unboxing (#976)1 parent 5aed282 commit 944302d
File tree
23 files changed
+432
-170
lines changed- boot/pb
- csug
- c
- mats
- release_notes
- s
23 files changed
+432
-170
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
1015 | 1015 | | |
1016 | 1016 | | |
1017 | 1017 | | |
1018 | | - | |
| 1018 | + | |
1019 | 1019 | | |
1020 | 1020 | | |
1021 | 1021 | | |
| |||
Binary file not shown.
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
680 | 680 | | |
681 | 681 | | |
682 | 682 | | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
683 | 686 | | |
684 | 687 | | |
685 | 688 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
| 223 | + | |
| 224 | + | |
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
| |||
285 | 286 | | |
286 | 287 | | |
287 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
288 | 294 | | |
289 | 295 | | |
290 | 296 | | |
| |||
1171 | 1177 | | |
1172 | 1178 | | |
1173 | 1179 | | |
1174 | | - | |
| 1180 | + | |
1175 | 1181 | | |
1176 | 1182 | | |
1177 | 1183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1147 | 1147 | | |
1148 | 1148 | | |
1149 | 1149 | | |
1150 | | - | |
| 1150 | + | |
1151 | 1151 | | |
1152 | 1152 | | |
1153 | 1153 | | |
1154 | 1154 | | |
1155 | 1155 | | |
1156 | 1156 | | |
1157 | | - | |
| 1157 | + | |
1158 | 1158 | | |
1159 | 1159 | | |
1160 | 1160 | | |
1161 | 1161 | | |
1162 | 1162 | | |
1163 | | - | |
| 1163 | + | |
1164 | 1164 | | |
1165 | 1165 | | |
1166 | | - | |
| 1166 | + | |
| 1167 | + | |
1167 | 1168 | | |
1168 | 1169 | | |
1169 | 1170 | | |
| |||
1239 | 1240 | | |
1240 | 1241 | | |
1241 | 1242 | | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
1242 | 1250 | | |
1243 | 1251 | | |
1244 | 1252 | | |
| |||
1275 | 1283 | | |
1276 | 1284 | | |
1277 | 1285 | | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
1278 | 1325 | | |
1279 | 1326 | | |
1280 | 1327 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
| |||
322 | 324 | | |
323 | 325 | | |
324 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
325 | 330 | | |
326 | 331 | | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
327 | 336 | | |
328 | 337 | | |
329 | 338 | | |
330 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
331 | 344 | | |
332 | 345 | | |
333 | 346 | | |
| |||
348 | 361 | | |
349 | 362 | | |
350 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
351 | 383 | | |
352 | 384 | | |
353 | 385 | | |
| |||
372 | 404 | | |
373 | 405 | | |
374 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
375 | 410 | | |
376 | 411 | | |
377 | 412 | | |
| |||
395 | 430 | | |
396 | 431 | | |
397 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
398 | 438 | | |
399 | 439 | | |
400 | 440 | | |
| |||
404 | 444 | | |
405 | 445 | | |
406 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
407 | 453 | | |
408 | 454 | | |
409 | 455 | | |
| |||
436 | 482 | | |
437 | 483 | | |
438 | 484 | | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
439 | 491 | | |
440 | 492 | | |
441 | 493 | | |
| |||
444 | 496 | | |
445 | 497 | | |
446 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
447 | 503 | | |
448 | 504 | | |
449 | 505 | | |
| |||
460 | 516 | | |
461 | 517 | | |
462 | 518 | | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
463 | 523 | | |
464 | 524 | | |
465 | 525 | | |
| |||
475 | 535 | | |
476 | 536 | | |
477 | 537 | | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
478 | 546 | | |
479 | 547 | | |
480 | 548 | | |
481 | 549 | | |
482 | 550 | | |
483 | 551 | | |
484 | 552 | | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
485 | 560 | | |
486 | 561 | | |
487 | 562 | | |
| |||
2720 | 2795 | | |
2721 | 2796 | | |
2722 | 2797 | | |
2723 | | - | |
| 2798 | + | |
2724 | 2799 | | |
2725 | 2800 | | |
2726 | 2801 | | |
| |||
2732 | 2807 | | |
2733 | 2808 | | |
2734 | 2809 | | |
| 2810 | + | |
2735 | 2811 | | |
2736 | 2812 | | |
2737 | 2813 | | |
| |||
2750 | 2826 | | |
2751 | 2827 | | |
2752 | 2828 | | |
| 2829 | + | |
2753 | 2830 | | |
2754 | 2831 | | |
2755 | 2832 | | |
| |||
0 commit comments