mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
refactor(lexer): mark is_trivia_byte with cpu_versions (#28675)
Part of effort to move to runtime CPU feature detection. Step G9 gave `is_trivia_byte` a CPU type parameter. Mark it with `#[apply(cpu_versions)]` too. It's `#[inline]`, so it now gets entry points with `#[target_feature]`, which rustc's MIR inliner doesn't inline. LLVM inlines them everywhere instead. `is_trivia_byte` is never called out of line. Codegen: changes in all 3 builds, in 3 functions which call `is_trivia_byte`. The plain x86_64 build's generic code goes from 36,546 instructions to 36,514, and its AVX2 copies from 24,763 to 24,733. - `Walk::step` (Level 3): aarch64 1,470 -> 1,402 instructions, x86_64 1,313 -> 1,295, x86_64 with AVX2 1,303 -> 1,287. It now calls `Walk::push` out of line at one call site, where it inlined it at all of them before. - `type_args_at`: aarch64 1,730 -> 1,702, x86_64 1,724 -> 1,710 (generic copy), x86_64 with AVX2 1,705 -> 1,691 (generic copy). It calls the same functions as before. - The AVX2 copy of `gt_run_split` in the x86_64 build, which inlines the AVX2 copy of `type_args_at`: 2,379 -> 2,349.
This commit is contained in:
1 parent
fee0877e44
commit
7de8fc0372
1 file changed
+1
@@ -425,6 +425,7 @@ pub const TRIVIA_MIN: u8 = tk!(LineComment);
|
||||
pub const TRIVIA_MAX: u8 = tk!(LineTerminator);
|
||||
|
||||
/// [`TokenKind::is_trivia`] on a raw kind byte, for the pipeline's `u8` lanes.
|
||||
#[apply(cpu_versions)]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub const fn is_trivia_byte(kind: u8, _cpu: impl Cpu) -> bool {
|
||||
|
||||
Reference in new issue
Block a user