-
Notifications
You must be signed in to change notification settings - Fork 6
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
Interrupt enable/disable should be using compiler_fence
.
#11
Comments
IIUC, inline assembly with neither Line 13 in 4ee7a8b
Line 32 in 4ee7a8b
Line 9 in 4ee7a8b
Line 17 in 4ee7a8b
|
@taiki-e Okay, good to know (thank you for the link as well). Also, from what I understand since I wrote the issue, inline However, |
EDIT2: I seem to have misunderstood your comment: #11 (comment) |
Oh, considering that LLVM has InaccessibleMemOnly (ReadNone + SideEffect), my understanding here is wrong. (Is it actually because it is volatile?) |
To be clear I don't/didn't actually know what LLVM guarantees for inline assembly, I couldn't find any ordering interactions being described but I wouldn't be surprised to hear that (without |
Yes, volatile ("Do not optimize away. Do not reorder with other volatile code.") was what I had in mind. I don't see why |
volatile seems to guarantee that
As for |
I was confused because in a previous comment you said:
Even with your correction in the next comment, I interpreted your comment to mean: "Right now, LLVM will treat inline asm as volatile as long as you don't use The above shouldn't affect this crate.
Additionally, as established writing |
Sorry, I thought your comment ("inline asm! won't ever be optimized ..." in #11 (comment)) was not discussing "can asm be removed", but rather regarding "does it allow reordering preceding and subsequent memory accesses" (which is a requirement for using it as a compiler fence). If I read it as a discussion of the former, my comments are indeed very confusing. |
For example, in
cortex_m
:compiler_fence
does not currently work properly for the msp430 backend. Thank you @eddyb for pointing this out to me.barrier
andnop
are also likely affected;barrier
needs a fence to prevent reordering, and both functions assume that Rust will not optimize out inline ASM (which I'm not sure is true).The text was updated successfully, but these errors were encountered: