refactor(lexer): #[inline(never)] on disambiguate level 3 entry points (#28612)

Part of effort to move to runtime CPU feature detection.

Mark `after`, `before` and `angles_before` in `disambiguate::context::scan` as `#[inline(never)]`. They are the entry points to disambiguate level 3, which will be compiled only once, not separately for each CPU feature set. So they must not be inlined into the separate copies of their callers.

This changes codegen on aarch64, x86_64, and x86_64 with AVX2. `before` and `angles_before` were previously inlined into `jsx_over_generic` and `gt_run_split`, along with `local_walk`. Now they're separate functions. `after` was already out of line. No other functions are affected.
This commit is contained in:
overlookmotel committed 2026-11-01 21:38:48 +00:00
1 parent f4cb7fb2dc
commit b7a2f9c318
1 file changed
+3
@@ -72,6 +72,7 @@ fn local_walk<R>(
}
/// Context at the token starting at `pos` (not through it).
#[inline(never)]
pub fn before(tokens: &Tokens, walks: &mut Walks, pos: usize) -> Site {
if let Some(s) = local_walk(tokens, walks, pos, pos, Walk::site) {
return s;
@@ -80,6 +81,7 @@ pub fn before(tokens: &Tokens, walks: &mut Walks, pos: usize) -> Site {
}
/// Open < lists a > run at pos would close.
#[inline(never)]
pub fn angles_before(tokens: &Tokens, walks: &mut Walks, pos: usize) -> usize {
if let Some(n) = local_walk(tokens, walks, pos, pos, Walk::open_angles) {
return n;
@@ -88,6 +90,7 @@ pub fn angles_before(tokens: &Tokens, walks: &mut Walks, pos: usize) -> usize {
}
/// What the significant token at `pos` leaves behind.
#[inline(never)]
pub fn after(tokens: &Tokens, walks: &mut Walks, pos: usize) -> After {
// The scan takes in the token, skipping a closer's group whole; a word here is never an anchor.
let from = if tokens.base_kind(pos) == tk!(Ident) { pos } else { pos + 1 };