-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Implement volatile_load and volatile_store intrinsics #11173
Conversation
@@ -349,6 +349,13 @@ pub fn Load(cx: &Block, PointerVal: ValueRef) -> ValueRef { | |||
} | |||
} | |||
|
|||
pub fn VolatileLoad(cx: &Block, PointerVal: ValueRef) -> ValueRef { | |||
unsafe { | |||
if cx.unreachable.get() { return llvm::LLVMGetUndef(Type::nil().to_ref()); } |
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.
Is returning undef of type nil here actually safe? It seems to be, but I don't understand the details of this operation nor any way to exercise this code path.
Updated, tests now check for presence of volatile instructions in bitcode. I think the PR can be merged now. /cc @thestinger |
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
mod rusti { |
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 this would be better as use std::unstable::intrinsics::{volatile_load, volatile_store}
.
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.
That's what the other intrinsic tests used. I'll fix.
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.
Fixed.
This PR adds `std::unsafe::intrinsics::{volatile_load,volatile_store}`, which map to LLVM's `load volatile` and `store volatile` operations correspondingly. This would fix #11172. I have addressed several uncertainties with this PR in the line comments.
…=Manishearth Don't lint `needless_return` in fns across a macro boundary Fixes rust-lang#11167 changelog: none
This PR adds
std::unsafe::intrinsics::{volatile_load,volatile_store}
, which map to LLVM'sload volatile
andstore volatile
operations correspondingly.This would fix #11172.
I have addressed several uncertainties with this PR in the line comments.