Commit cab32ae
committed
Follow-on after #21653.
That PR revealed that some AST enums don't have all their variants boxed. Where all variants are boxed, `node_id` methods should boil down to a single instruction, so we mark the method `#[inline(always)]`.
`node_id` method will also boil down to a single instruction where all variants are _not_ boxed, so add `#[inline(always)]` to them too. It's only where there's a mix of boxed and unboxed where the method will retain branching logic and be larger.
Probably compiler will inline these methods anyway, but the attributes are a useful signal as to where we can improve the AST - all enums should consistently box _all_ their variants, or none of them.
1 parent 5c93af8 commit cab32ae
2 files changed
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3992 | 3992 | | |
3993 | 3993 | | |
3994 | 3994 | | |
| 3995 | + | |
| 3996 | + | |
3995 | 3997 | | |
3996 | 3998 | | |
3997 | 3999 | | |
| |||
4058 | 4060 | | |
4059 | 4061 | | |
4060 | 4062 | | |
| 4063 | + | |
| 4064 | + | |
4061 | 4065 | | |
4062 | 4066 | | |
4063 | 4067 | | |
| |||
4366 | 4370 | | |
4367 | 4371 | | |
4368 | 4372 | | |
| 4373 | + | |
| 4374 | + | |
4369 | 4375 | | |
4370 | 4376 | | |
4371 | 4377 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
| 155 | + | |
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
| 161 | + | |
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
| |||
167 | 169 | | |
168 | 170 | | |
169 | 171 | | |
170 | | - | |
171 | | - | |
| 172 | + | |
| 173 | + | |
172 | 174 | | |
173 | | - | |
| 175 | + | |
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
| |||
0 commit comments