Commit 85fda9d
ARM64: Prevent STP fusion for conditional code emitted by TBAR.
Thanks to Peter Cawley.
(cherry picked from commit 7cc53f0)
Assume we have a trace for the several `setmetatable()` calls to the
same table. This trace contains the following IR:
| 0011 p64 FREF 0003 tab.meta
| ...
| 0018 x0 > tab TNEW 0 0
| 0019 tab TBAR 0003
| 0020 tab FSTORE 0011 0018
The expected mcode to be emitted for the last two IRs is the following:
| 55626cffb0 ldrb w30, [x19, 8] ; tab->marked
| 55626cffb4 tst w30, 0x4 ; Is black?
| 55626cffb8 beq 0x626cffd0 ; Skip marking.
| 55626cffbc ldr x27, [x20, 128]
| 55626cffc0 and w30, w30, 0xfffffffb
| 55626cffc4 str x19, [x20, 128]
| 55626cffcc strb w30, [x19, 8] ; tab->marked
| 55626cffc8 str x27, [x19, 24] ; tab->gclist
| 55626cffd0 str x0, [x19, 32] ; tab->metatable
But the last 2 instructions are fused into the following `stp`:
| 55581dffd0 stp x27, x0, [x19, 48]
Hence, the GC propagation frontier back is done partially, since
`str x27, [x19, 24]` is not skipped despite TBAR semantics. This leads
to the incorrect value in the `gclist` and the segmentation fault during
its traversal on GC step.
This patch prevents this fusion via switching instruction for
`tab->gclist` and `tab->marked` storing.
Sergey Kaplun:
* added the description and the test for the problem
Part of tarantool/tarantool#11691
Reviewed-by: Sergey Bronnikov <[email protected]>
Signed-off-by: Sergey Kaplun <[email protected]>
(cherry picked from commit 9149be3)1 parent b11bb2b commit 85fda9d
File tree
2 files changed
+81
-1
lines changed- src
- test/tarantool-tests
2 files changed
+81
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1271 | 1271 | | |
1272 | 1272 | | |
1273 | 1273 | | |
1274 | | - | |
1275 | 1274 | | |
| 1275 | + | |
| 1276 | + | |
1276 | 1277 | | |
1277 | 1278 | | |
1278 | 1279 | | |
| |||
Lines changed: 79 additions & 0 deletions
| 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 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
0 commit comments