Commit 6812609
committed
Fix getIP on aarch64: SP-relative saved-IP slot [SP,#8]
Save JIT return address to [SP, #8] before each BL/BLR instruction,
and read it back in getIP() at frame_base - frame_size - kPointerSize.
Falls back to saved LR at [FP+8] when slot reads zero (no call yet).
Root causes fixed:
1. Double-counting: old FP-relative STR offset added kPointerSize on top
of stack_frame_size which already includes kStackAlign, writing below SP.
2. Register clobbering: translateCall isReg case could have call target in
x12/x13 which saveReturnAddress overwrote. Now moves target to x16 first.
3. ptr_resolve scratch: large frame offsets triggered ptr_resolve paths
using x13 as scratch, clobbering the call target. SP-relative [SP,#8]
uses simple immediate addressing with no scratch register.
Validated: 15/15 CPU modules pass (default + PYTHONJITLISTALL=1),
8/8 GPU modules pass with zero regressions, GPU JIT smoke test pass
(add/matmul/relu on NVIDIA GB200).1 parent 74111fa commit 6812609
4 files changed
Lines changed: 38 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1937 | 1937 | | |
1938 | 1938 | | |
1939 | 1939 | | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
1940 | 1944 | | |
1941 | | - | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
1942 | 1952 | | |
1943 | 1953 | | |
| 1954 | + | |
| 1955 | + | |
1944 | 1956 | | |
1945 | 1957 | | |
1946 | 1958 | | |
1947 | 1959 | | |
1948 | 1960 | | |
1949 | 1961 | | |
| 1962 | + | |
| 1963 | + | |
1950 | 1964 | | |
1951 | 1965 | | |
1952 | 1966 | | |
1953 | 1967 | | |
| 1968 | + | |
1954 | 1969 | | |
1955 | 1970 | | |
1956 | 1971 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1457 | 1457 | | |
1458 | 1458 | | |
1459 | 1459 | | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
1460 | 1463 | | |
1461 | 1464 | | |
1462 | 1465 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | 34 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 35 | + | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
| |||
54 | 51 | | |
55 | 52 | | |
56 | 53 | | |
57 | | - | |
| 54 | + | |
58 | 55 | | |
59 | 56 | | |
60 | | - | |
61 | 57 | | |
62 | | - | |
63 | | - | |
64 | | - | |
| 58 | + | |
65 | 59 | | |
66 | 60 | | |
67 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
131 | 127 | | |
132 | 128 | | |
133 | | - | |
| 129 | + | |
134 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| |||
444 | 445 | | |
445 | 446 | | |
446 | 447 | | |
| 448 | + | |
447 | 449 | | |
448 | 450 | | |
449 | 451 | | |
| |||
0 commit comments