Commit 4caeaf6
committed
WIP: Try using preserve_none for setjmp
The `preserve_none` calling convention is a new calling convention in
clang (>= 19) and gcc that preserves a more minimal set of registers
(rsp, rbp on x86_64; lr, fp on aarch64). As a result, if this calling
convention is used with setjmp, those registers do not need to be stored
in the setjmp buffer, allowing us to reduce the size of this buffer and
use fewer instructions to save the buffer. The tradeoff of course is
that these registers may need to be saved anyway, in which case
both the stack usage and the instructions just move to the caller
(which is strictly worse). It is not clear that this is useful for
exceptions (which already have a fair bit of state anyway, so even
in the happy path the savings are not necessarily that big), but
I am thinking about using it for #60281, which has different
characteristics, so this is an easy way to try out whether there
are any unexpected challenges.
Note that preserve_none is a very recent compiler feature, so most
compilers out there do not have it yet. For compatibility, this PR
supports using different jump buffer formats in the runtime and
the generated code.1 parent 6c75e91 commit 4caeaf6
File tree
11 files changed
+288
-26
lines changed- src
11 files changed
+288
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
115 | 123 | | |
116 | 124 | | |
117 | 125 | | |
| |||
229 | 237 | | |
230 | 238 | | |
231 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
232 | 246 | | |
233 | 247 | | |
234 | 248 | | |
| |||
313 | 327 | | |
314 | 328 | | |
315 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
316 | 335 | | |
317 | 336 | | |
318 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1033 | 1033 | | |
1034 | 1034 | | |
1035 | 1035 | | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
1036 | 1044 | | |
1037 | 1045 | | |
1038 | 1046 | | |
| |||
1239 | 1247 | | |
1240 | 1248 | | |
1241 | 1249 | | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
1242 | 1261 | | |
1243 | 1262 | | |
1244 | 1263 | | |
| |||
6151 | 6170 | | |
6152 | 6171 | | |
6153 | 6172 | | |
| 6173 | + | |
| 6174 | + | |
| 6175 | + | |
| 6176 | + | |
6154 | 6177 | | |
6155 | | - | |
| 6178 | + | |
| 6179 | + | |
6156 | 6180 | | |
6157 | 6181 | | |
6158 | 6182 | | |
| |||
9355 | 9379 | | |
9356 | 9380 | | |
9357 | 9381 | | |
| 9382 | + | |
| 9383 | + | |
| 9384 | + | |
| 9385 | + | |
| 9386 | + | |
9358 | 9387 | | |
9359 | | - | |
9360 | | - | |
| 9388 | + | |
| 9389 | + | |
| 9390 | + | |
9361 | 9391 | | |
9362 | 9392 | | |
9363 | | - | |
9364 | 9393 | | |
| 9394 | + | |
| 9395 | + | |
| 9396 | + | |
| 9397 | + | |
| 9398 | + | |
| 9399 | + | |
| 9400 | + | |
| 9401 | + | |
9365 | 9402 | | |
9366 | | - | |
| 9403 | + | |
9367 | 9404 | | |
9368 | | - | |
| 9405 | + | |
| 9406 | + | |
9369 | 9407 | | |
9370 | 9408 | | |
9371 | 9409 | | |
| |||
9994 | 10032 | | |
9995 | 10033 | | |
9996 | 10034 | | |
| 10035 | + | |
| 10036 | + | |
| 10037 | + | |
9997 | 10038 | | |
9998 | 10039 | | |
9999 | 10040 | | |
| |||
10009 | 10050 | | |
10010 | 10051 | | |
10011 | 10052 | | |
| 10053 | + | |
10012 | 10054 | | |
10013 | 10055 | | |
10014 | 10056 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
472 | | - | |
| 472 | + | |
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
509 | | - | |
| 509 | + | |
510 | 510 | | |
511 | 511 | | |
512 | 512 | | |
| |||
545 | 545 | | |
546 | 546 | | |
547 | 547 | | |
548 | | - | |
549 | | - | |
| 548 | + | |
| 549 | + | |
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
555 | 555 | | |
556 | | - | |
557 | | - | |
| 556 | + | |
| 557 | + | |
558 | 558 | | |
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
563 | 563 | | |
564 | | - | |
| 564 | + | |
565 | 565 | | |
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
570 | | - | |
| 570 | + | |
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
| |||
617 | 617 | | |
618 | 618 | | |
619 | 619 | | |
620 | | - | |
621 | | - | |
| 620 | + | |
| 621 | + | |
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| |||
301 | 302 | | |
302 | 303 | | |
303 | 304 | | |
| 305 | + | |
| 306 | + | |
304 | 307 | | |
305 | 308 | | |
306 | 309 | | |
| |||
0 commit comments