Commit f7b17f0
committed
Track more than one location per variable in stackmaps.
Stackmaps only track one location per live variable, e.g. in a register,
on the stack, etc. However, when deoptimising to native stack frames
values may exist in multiple locations, e.g. in a register as well as on
the stack or in two registers.
The main reason for this, at least from observation, are spills before
function calls. For example, if a value is held in $rdi and that
register needs to be freed up to execute a call, the register allocator
may spill it to a register or onto the stack. After the call is done the
value is reloaded. A simple optimisation is to cache the spills so the
value can be reloaded throughout a function without having to respill it
every time. Depending on where the stackmap call is located we can only
see the restored register but not the spill. During deoptimisation we
then only populate the tracked register with the right value. When the
program then decides to restore the register again (e.g. because it has
executed another call) loading it from the stack won't recover the value
since we haven't pushed it during optimisation.
This commit adds an analysis to the compiler chain that attempts to find
additional locations for live variables and encode them in stackmaps. It
does so but traversing the control flow of a function and creating a
mapping on any register moves, stack stores or reloads. For simplicity
(and so we don't need to change the stackmap format) we assume that only
one such additional location may exist (which may very well turn out to
be wrong in the future).
These changes enable us to run much further in some of the lua tests,
though there are still some bugs to be fixed.1 parent b2c5bcf commit f7b17f0
File tree
6 files changed
+164
-11
lines changed- llvm
- include/llvm/CodeGen
- lib
- CodeGen
- Support
- Target/X86
6 files changed
+164
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
319 | | - | |
| 319 | + | |
| 320 | + | |
320 | 321 | | |
321 | 322 | | |
322 | 323 | | |
| |||
343 | 344 | | |
344 | 345 | | |
345 | 346 | | |
| 347 | + | |
346 | 348 | | |
347 | 349 | | |
348 | 350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
222 | | - | |
| 223 | + | |
| 224 | + | |
223 | 225 | | |
224 | 226 | | |
225 | 227 | | |
| |||
282 | 284 | | |
283 | 285 | | |
284 | 286 | | |
285 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
286 | 308 | | |
287 | 309 | | |
288 | 310 | | |
| |||
520 | 542 | | |
521 | 543 | | |
522 | 544 | | |
| 545 | + | |
523 | 546 | | |
524 | 547 | | |
525 | 548 | | |
| |||
529 | 552 | | |
530 | 553 | | |
531 | 554 | | |
532 | | - | |
| 555 | + | |
533 | 556 | | |
534 | 557 | | |
535 | 558 | | |
| |||
538 | 561 | | |
539 | 562 | | |
540 | 563 | | |
541 | | - | |
| 564 | + | |
542 | 565 | | |
543 | 566 | | |
544 | 567 | | |
| |||
611 | 634 | | |
612 | 635 | | |
613 | 636 | | |
614 | | - | |
| 637 | + | |
615 | 638 | | |
616 | 639 | | |
617 | 640 | | |
618 | 641 | | |
619 | 642 | | |
620 | 643 | | |
621 | | - | |
| 644 | + | |
622 | 645 | | |
623 | 646 | | |
624 | 647 | | |
| |||
627 | 650 | | |
628 | 651 | | |
629 | 652 | | |
630 | | - | |
| 653 | + | |
631 | 654 | | |
632 | 655 | | |
633 | 656 | | |
| |||
648 | 671 | | |
649 | 672 | | |
650 | 673 | | |
651 | | - | |
| 674 | + | |
652 | 675 | | |
653 | 676 | | |
654 | 677 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
55 | 56 | | |
56 | 57 | | |
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 | + | |
58 | 169 | | |
59 | 170 | | |
60 | 171 | | |
| |||
82 | 193 | | |
83 | 194 | | |
84 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
85 | 205 | | |
86 | 206 | | |
87 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1502 | 1502 | | |
1503 | 1503 | | |
1504 | 1504 | | |
1505 | | - | |
| 1505 | + | |
1506 | 1506 | | |
1507 | 1507 | | |
1508 | 1508 | | |
| |||
0 commit comments