Skip to content
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

Merged
merged 1 commit into from
Jan 1, 2014
Merged

Implement volatile_load and volatile_store intrinsics #11173

merged 1 commit into from
Jan 1, 2014

Conversation

whitequark
Copy link
Member

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.

@@ -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()); }
Copy link
Member Author

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.

@whitequark
Copy link
Member Author

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 {
Copy link
Member

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}.

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

bors added a commit that referenced this pull request Dec 31, 2013
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.
@bors bors closed this Jan 1, 2014
@bors bors merged commit f98f83a into rust-lang:master Jan 1, 2014
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 31, 2023
…=Manishearth

Don't lint `needless_return` in fns across a macro boundary

Fixes rust-lang#11167

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No way to emit volatile loads/stores
5 participants