-
Notifications
You must be signed in to change notification settings - Fork 3
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
Release a new version #7
Comments
Indeed this was fixed by #6. I agree a new version should be released, but I believe this crate should be deprecated in favor of using portable atomic, which is a proper superset of this crate's functionality. I have personally migrated my MSP430 code to that crate. Keeping open until I have the bandwidth to update CHANGELOG, make a deprecation msg, and do a release. |
My problem with |
Then for now, I am willing to not deprecate the crate until The main thing is I don't think I want to maintain two copies of the inline assembly ( |
It's not that big of a deal (I already figured out a workaround in my own code), so no need to delay deprecation. |
According to these lines |
Unfortunately, the inline ASM atomic implementations don't return the modified argument (except for It's not actually possible to load the old value in memory into a register and then update the memory in a single instruction on MSP430. And if done in multiple instructions, an interrupt could happen between the load of the old value and the update to the new one. If the value in memory was modified within an interrupt, the thread trying to do the atomic update will have loaded and returned an "outdated" rather than "the actual value before the atomic update occurred". With this constraint, only msp430 loads and stores are truly atomic (and not susceptible to the multi core problem on ARM). So, AFAICT, the disable-interrupt method, except for loads and stores, is the correct thing to do for truly atomic operations. Realizing this was one of the main reasons I wanted to deprecate msp430-atomic. |
I'm only interested in atomically modifying register values in PACs, in which case I don't care about the previous value in-memory. This makes the |
I have no plans to provide an unsafe trait like
As cr1901 said,
As a side note, if MSP430 atomics are implemented in LLVM, LLVM can understand whether the return value is used or not, so they can generate code similar to |
Generic atomic type would be pretty useful for me, but it's not critical. My main problem is that I don't need |
This is interesting, but I don't like it applies to msp430, as msp430 doesn't have an equivalent to |
@YuhanLiin In any case, if @taiki-e doesn't want to add the |
@YuhanLiin @taiki-e I have updated this crate's |
Looks pretty good |
Looks good to me!
I'm fine with adding them. |
Cool, thanks for the feedback both of you! I will release after I sleep.
If @YuhanLiin is fine with that, we can deprecate this crate once |
I'm good with that |
I apologize for taking so long; releasing this crate |
47: Add add/sub/and/or/xor methods that do not return previous value r=taiki-e a=taiki-e This adds `Atomic{I,U}*::{add,sub,and,or,xor}` and `AtomicBool::{and,or,xor}` methods. They are equivalent to the corresponding `fetch_*` methods, but do not return the previous value. They are intended for optimization on platforms that implement atomics using inline assembly, such as the MSP430. Currently, optimizations by these methods (add,sub,and,or,xor) are only guaranteed for MSP430; on x86, LLVM can optimize in most cases, so cases, where this would improve things, should be rare. See pftbest/msp430-atomic#7 for the context. cc `@cr1901` `@YuhanLiin` Co-authored-by: Taiki Endo <[email protected]>
40: interrupt: Optimize restore on AVR and MSP430 r=taiki-e a=taiki-e As we have already been doing for pre-v6 ARM, avoid unneeded branch and mask. https://github.com/taiki-e/portable-atomic/blob/d4b27473dd7d62a6d5a453e78b1629a1ce24d086/src/imp/interrupt/armv4t.rs#L31-L40 47: Add add/sub/and/or/xor methods that do not return previous value r=taiki-e a=taiki-e This adds `Atomic{I,U}*::{add,sub,and,or,xor}` and `AtomicBool::{and,or,xor}` methods. They are equivalent to the corresponding `fetch_*` methods, but do not return the previous value. They are intended for optimization on platforms that implement atomics using inline assembly, such as the MSP430. Currently, optimizations by these methods (add,sub,and,or,xor) are only guaranteed for MSP430; on x86, LLVM can optimize in most cases, so cases, where this would improve things, should be rare. See pftbest/msp430-atomic#7 for the context. cc `@cr1901` `@YuhanLiin` Co-authored-by: Taiki Endo <[email protected]>
A new release has been made (finally), along with pointing to |
The most recently released version of this crate,
0.1.4
, does not build on non-MSP430 targets on the latest nightly. This issue is caused by the atomic intrinsics changing in the latest nightly. Master does not have this issue, so it should be released.The text was updated successfully, but these errors were encountered: