-
-
Notifications
You must be signed in to change notification settings - Fork 111
Load string indices with inline asm to save space. #879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thanks for this PR - it looks neat. Once we've resolve the question about hex-encoding symbols, I would support merging this. |
(This isn't a breaking change, we just want cargo server-checks to stop complaining about a PR that was committed some time ago) |
great news: llvm/llvm-project#159420 fixes using quotes in I assume it'll land in Rust 1.91. What do we do?
|
MSRV moving is hard when we have customers on long term support toolchains. A build.rs version switch, or a feature flag, would be fine. I wonder if this is related to the quote escaping issue in LLVM 21. |
Implemented a version switch. I wouldn't do a feature flag, it's not very discoverable and it's nice you get the optimization without having to opt-in. We'll have to wait until the llvm fix lands in nightly/beta to merge this.
yep! basically:
|
This looks good to me and I'm inclined to merge, but I'd like to do some code size and compile time comparisons first. |
.github/workflows/ci.yml
Outdated
- stable | ||
- "1.81" # host MSRV | ||
- nightly-2025-08-05 # some tests use unstable features, but avoid LLVM21 due to https://github.com/rust-lang/rust/issues/146065 | ||
- nightly-2025-09-25 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to revert this back to just nightly
, so we catch any future nightly issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh nice, I just assumed it was pinned before the regression. Changed.
Requires #878 becausenot anymore yayasm!(... sym ..)
breaks if the symbol name has quote characters.Defmt string indices are 16 bits, which can be loaded with a single
movw
.However, the compiler doesn't know that, so it generates
movw+movt
orldr rX, [pc, #offs]
because it sees we're loading an address of a symbol, which could be any 32bit value.
This wastes space, so we load the value with asm manually to avoid this.