Skip to content

Commit baba54d

Browse files
committed
perf(edit): inline native preparation and saved-scope retirement
Keep the enlarged storage-only specpdl loop within its two bounded slow unwinder sites instead of moving its call overhead to an intermediate helper. Inline the single-caller quiet-hook and mark preparation checks, and the live-range refresh used at three callback boundaries, exposing native success paths without extra call and result dispatch. Matched ThinLTO profiles identified the outlined helper groups. Preserve watcher signals, Flow propagation, live-range remeasurement and saved-entry rooting; retain the existing normal and cold slow-unwinder boundaries.
1 parent 030153c commit baba54d

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

  • crates/neovm-core/src/emacs_core

‎crates/neovm-core/src/emacs_core/editing/editfns/mod.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl LiveChangeRange {
415415
}
416416

417417
/// Re-measure only when callback Lisp could have invalidated the bytes.
418-
#[inline]
418+
#[inline(always)]
419419
fn refresh(&mut self, ctx: &crate::emacs_core::eval::Context) -> TextEditRange {
420420
if let Some(before) = self.before_callbacks.take() {
421421
let buffer = ctx.buffers.current_buffer_id();
@@ -642,6 +642,7 @@ fn prepare_buffer_change(
642642
/// signal_before_change), but its bind is a C specpdl push; ours was ~590 Ir
643643
/// of bind+unbind per modification, and with nothing to run under it the
644644
/// binding is unobservable.
645+
#[inline(always)]
645646
fn before_change_hooks_quiet(
646647
ctx: &crate::emacs_core::eval::Context,
647648
current_id: crate::buffer::BufferId,
@@ -762,6 +763,7 @@ pub(crate) fn signal_before_property_change(
762763
.map(|_| ())
763764
}
764765

766+
#[inline(always)]
765767
fn deactivate_mark_after_preparing_change(
766768
ctx: &mut crate::emacs_core::eval::Context,
767769
) -> Result<(), Flow> {

‎crates/neovm-core/src/emacs_core/runtime/eval/apply.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ impl Context {
15151515
self.unbind_suffix_to(count, result)
15161516
}
15171517

1518-
#[inline]
1518+
#[inline(always)]
15191519
fn unbind_suffix_to(&mut self, count: usize, result: EvalResult) -> EvalResult {
15201520
self.pop_simple_specpdl_suffix(count);
15211521
if self.specpdl.len() > count {
@@ -1549,6 +1549,7 @@ impl Context {
15491549
/// is a store; `drain_unwind_to` is the path that roots them. The symbol's shape is read when the entry is popped, not
15501550
/// when it was pushed: a watcher added or a local made inside the `let`
15511551
/// body sends that entry to the general path, as in GNU.
1552+
#[inline(always)]
15521553
pub(crate) fn pop_simple_specpdl_suffix(&mut self, count: usize) {
15531554
use crate::emacs_core::symbol::{SymbolRedirect, SymbolTrappedWrite};
15541555
while self.specpdl.len() > count {

0 commit comments

Comments
 (0)