perf(ast): mark AstKind::address as #[inline]#20586
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
Marks AstKind::address as #[inline] and simplifies AstKind codegen based on the invariant that AstKind variants only wrap structs (not enums), keeping address retrieval essentially a no-op/pointer read.
Changes:
- Add
#[inline]toGetAddress for AstKind::address(both generator + generated output). - Remove defunct enum-handling branches in
AstKindgenerator when buildinghas_kind/address match arms. - Add brief documentation clarifying why
AstKind::addressis a single-instruction operation.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tasks/ast_tools/src/generators/ast_kind.rs | Simplifies address match-arm generation and annotates AstKind::address with #[inline] + docs. |
| crates/oxc_ast/src/generated/ast_kind.rs | Regenerates AstKind output with the new #[inline] + docs on address(). |
9eaf443 to
c9edd39
Compare
d7bf984 to
79deba6
Compare
Merge activity
|
Similar to #20585. As `AstKind`'s variants are all structs (no enums any more), and all structs have an `AstKind`, `AstKind::address` method boils down to a no-op. So mark it `#[inline]`. Also remove some defunct code from `AstKind` codegen which was handling when an `AstKind` refers to an enum. This circumstance is no longer possible, so remove this code.
c9edd39 to
3420abb
Compare
79deba6 to
89946e1
Compare
Similar to oxc-project#20585. As `AstKind`'s variants are all structs (no enums any more), and all structs have an `AstKind`, `AstKind::address` method boils down to a no-op. So mark it `#[inline]`. Also remove some defunct code from `AstKind` codegen which was handling when an `AstKind` refers to an enum. This circumstance is no longer possible, so remove this code.

Similar to #20585. As
AstKind's variants are all structs (no enums any more), and all structs have anAstKind,AstKind::addressmethod boils down to a no-op. So mark it#[inline].Also remove some defunct code from
AstKindcodegen which was handling when anAstKindrefers to an enum. This circumstance is no longer possible, so remove this code.