Skip to content

Commit 8e352c8

Browse files
committed
perf: add #[inline] or #[inline(always)] to functions related to SysTick handling
1 parent e897ba5 commit 8e352c8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/r3_port_arm_m/src/systick_tickful/cfg.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ macro_rules! use_systick_tickful {
8181
const MAX_TICK_COUNT: UTicks = u32::MAX;
8282
const MAX_TIMEOUT: UTicks = u32::MAX;
8383

84+
#[inline(always)]
8485
unsafe fn tick_count() -> UTicks {
8586
// Safety: CPU Lock active
8687
unsafe { TIMER_STATE.tick_count() }
@@ -89,6 +90,7 @@ macro_rules! use_systick_tickful {
8990

9091
// Safety: Only `use_systick_tickful!` is allowed to `impl` this
9192
unsafe impl imp::SysTickTickfulInstance for $Traits {
93+
#[inline(always)]
9294
unsafe fn handle_tick() {
9395
// Safety: Interrupt context, CPU Lock inactive
9496
unsafe { TIMER_STATE.handle_tick::<Self>() };

src/r3_port_arm_m/src/systick_tickful/imp.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ where
4848
StaticInterruptHandler::define()
4949
.line(INTERRUPT_SYSTICK)
5050
.start(
51-
#[inline]
51+
#[inline(always)]
5252
|| unsafe { Traits::handle_tick() },
5353
)
5454
.finish(b);
@@ -95,7 +95,7 @@ impl<TickfulState: TickfulStateTrait> StateCore<TickfulState> {
9595
/// # Safety
9696
///
9797
/// Interrupt context, CPU Lock inactive
98-
#[inline]
98+
#[inline(always)]
9999
pub unsafe fn handle_tick<Traits: SysTickTickfulInstance>(&self) {
100100
<System<Traits> as raw::KernelBase>::raw_acquire_cpu_lock().unwrap();
101101

@@ -116,6 +116,7 @@ impl<TickfulState: TickfulStateTrait> StateCore<TickfulState> {
116116
/// # Safety
117117
///
118118
/// CPU Lock active
119+
#[inline]
119120
pub unsafe fn tick_count(&self) -> UTicks {
120121
// Safety: CPU Lock protects it from concurrent access
121122
let inner = unsafe { &mut *self.inner.get() };

0 commit comments

Comments
 (0)