-
Notifications
You must be signed in to change notification settings - Fork 72
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
irq: Optimize interrupt save/restore #104
Conversation
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.
Thanks for this PR! I like the change, this definitely goes in the right direction. See comments below.
c73c856
to
99c4605
Compare
I resolved all review findings. I'll rebase this again after #106 has been resolved an pulled. |
fe5e137
to
d9fdc24
Compare
Rebased on top of latest |
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.
Hey, sorry for letting this wait for so long... Thanks again for the changeset, this change is great and I really like your latest version. I have a few comments left, see below. Again, sorry for the delay.
Cargo.toml
Outdated
@@ -62,8 +62,13 @@ docsrs = ["rt", "atmega328p", "atmega32u4", "atmega2560", "attiny85", "atmega480 | |||
bare-metal = "0.2.5" | |||
vcell = "0.1.2" | |||
cfg-if = "0.1.10" | |||
ufmt = "0.1.0" |
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 think we should make ufmt
an optional dependency.
ufmt = "0.1.0" | |
ufmt = { version = "0.1.0", optional = true } |
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 made ufmt optional.
I called the feature udebug
, because that's really what it enables. Makes it more transparent to the user what's being enabled.
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.
Not sure about the feature name... But I'll check what others in the ecosystem are doing and will adjust accordingly after merging.
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.
Finding good names. The biggest problem in software development :)
Thanks for merging.
Avoid unnecessary mask and branch instructions
Thanks again for your review. |
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.
Hey, thank you so much!
We have recently (Rahix#104) dropped support for compilers that don't support edition 2021.
Got the notification for your commit above this comment. I want to break a new release soon, with all your changes, but then I'll wait a bit, still? |
We have recently (Rahix#104) dropped support for compilers that don't support edition 2021.
Oh, I think any name is fine. Please pick the name you feel is best. Be it |
We have recently (#104) dropped support for compilers that don't support edition 2021. Make this explicit by enforcing edition 2021 in Cargo.toml.
Here you go: https://github.com/Rahix/avr-device/releases/tag/v0.4.0 :) |
Avoid unnecessary mask and branch instructions.
The basic reasoning behind this is that all other flags in the
SREG
can be clobbered without ill effects. Therestore()
function is an optimization fence and the compiler is not allowed to make assumptions about memory orSREG
state after execution.This avoids an
and
and abreq
instruction or similar in every critical section.This is an API breakage that requires an incompatible version bump.
Question: Should we return a struct instead of u8? That would give us the opportunity to change semantics without breaking API in the future.
I hope I got the
llvm_asm!
part ofrestore()
right. I didn't test it. What about removing allllvm_asm!
?