rust-embedded / rust-embedded/critical-section

Critical section acquire and release functions cannot be inlined without LTO

Open
#59 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
173
Forks
27
PR merge metrics
No merged PRs in 30d

Description

It seems that without LTO, any critical section acquire and release functions are compiled as calls to _critical_section_1_0_acquire and _critical_section_1_0_release and never inlined. This is rather unfortunate, since these are often very small functions that would benefit quite a bit from inlining.

With LTO these calls do get inlined, but I'm not sure how much depending on LTO for inlining hinders optimization, given that most optimization passes run before LTO.

I'm not sure if anything can be done about this, but I wanted to at least post the issue so there is a public note of this limitation somewhere (as far as I know this is currently not documented anywhere).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the critical-section acquire and release functions and the generated calls to _critical_section_1_0_acquire and _critical_section_1_0_release in builds with and without LTO. Determine whether the limitation can be addressed; otherwise document the limitation and its optimization implications.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, performance
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.