Commit 150e87c
committed
v2: dead-strip unused functions in arm64 linker, reduce binary from 9.4MB to 5.85MB
- Add linker-level dead function stripping: BFS reachability from roots
(_main, __v_init_consts_*), compact text section, fix up relocations
and symbol addresses
- Add should_skip_store optimization: skip redundant store-then-load when
value is consumed by the immediately next instruction (arithmetic, cmp,
store, load, GEP, trunc, zext), with operand[1] forwarding via x10
- SP-relative addressing during sp_adjusted periods (sp_adjust_amt tracking)
- Merge fn_starts/fn_ends/fn_names/fn_sym_ids and stats in parallel workers
- should_skip_store: skip store-to-stack when value is consumed by the
next instruction (arith, cmp, store, load, GEP, trunc, zext); includes
operand[1] forwarding to x10 for binary ops. Eliminates 57K/211K stores
- Remove redundant canonicalize_narrow_int_result after cache hits (value
already canonicalized before store). Saves ~58K SXTW/AND instructions
- Non-invalidating last_store cache: value stays in register after
consumption, enabling multi-use of same cached value
- SP-relative addressing during sp_adjusted periods via sp_adjust_amt
tracking, avoiding 2-3 instruction FP-relative fallback1 parent a011c78 commit 150e87c
8 files changed
Lines changed: 738 additions & 148 deletions
File tree
- vlib/v2
- builder
- gen
- arm64
- cleanc
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
837 | 837 | | |
838 | 838 | | |
839 | 839 | | |
840 | | - | |
| 840 | + | |
841 | 841 | | |
842 | 842 | | |
843 | 843 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
241 | 271 | | |
242 | 272 | | |
243 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
76 | 71 | | |
77 | 72 | | |
78 | 73 | | |
| |||
0 commit comments