Skip to content

Change Arc to use compare_exchange instead of compare_and_swap #32643

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

Merged
merged 1 commit into from
Apr 1, 2016

Conversation

Amanieu
Copy link
Member

@Amanieu Amanieu commented Mar 31, 2016

This should slightly improve code generation on architectures with a weak memory model like ARM.

@rust-highfive
Copy link
Contributor

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

@bors: r+ 9a28d4e

Nice!

@bors
Copy link
Collaborator

bors commented Apr 1, 2016

⌛ Testing commit 9a28d4e with merge b0d3170...

bors added a commit that referenced this pull request Apr 1, 2016
Change Arc to use compare_exchange instead of compare_and_swap

This should slightly improve code generation on architectures with a weak memory model like ARM.
@alexcrichton
Copy link
Member

Looks like the slaves disappeared for whatever mysterious reason they do so, but otherwise all tests passed, so merging manually.

@alexcrichton alexcrichton merged commit 9a28d4e into rust-lang:master Apr 1, 2016

loop {
// check if the weak counter is currently "locked"; if so, spin.
if cur == usize::MAX {
Copy link

Choose a reason for hiding this comment

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

If cur is ever usize::MAX, won't this just keep spinning forever and never reload the value of cur?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, good point, I'll make a PR to fix that.

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.

5 participants