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

Add note about in-memory representation of atomic types #253

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Feb 9, 2022

std's atomic types have the same in-memory representation as the underlying type.

https://doc.rust-lang.org/nightly/core/sync/atomic/struct.AtomicUsize.html

This type has the same in-memory representation as the underlying integer type, usize.

loom's atomic types have a different in-memory representation than the underlying type. (it is an index in the store)

bors bot added a commit to crossbeam-rs/crossbeam that referenced this pull request Feb 9, 2022
787: Do not provide AtomicCell when cfg(crossbeam_loom) is enabled r=taiki-e a=taiki-e

We cannot provide AtomicCell under `cfg(crossbeam_loom)` because loom's atomic types have a different in-memory representation than the underlying type. (tokio-rs/loom#253)

https://github.com/crossbeam-rs/crossbeam/blob/bd83e1f2328e90298fc8a2f535a25d94ece09152/crossbeam-utils/src/atomic/atomic_cell.rs#L35-L42

fyi `@jonhoo` 

Co-authored-by: Taiki Endo <[email protected]>
@taiki-e taiki-e merged commit 3a92448 into master Feb 9, 2022
@taiki-e taiki-e deleted the taiki-e/doc-atomic branch February 9, 2022 16:37
hawkw added a commit that referenced this pull request May 10, 2022
# 0.5.5 (May 10, 2022)

### Added

- sync: Add `Arc::from_std` without `T: Sized` bound (#226)
- sync: Implement `Debug` for `AtomicPtr` for all `T` (#255)
- logs: Add location tracking for threads and atomic operations (#258)
- logs: Add additional location tracking to `Arc`, `alloc`, and `mpsc`
  (#265)
- logs: Improve `tracing` configuration for `LOOM_LOG` (#266)
- logs: Add a span for the current model's iteration (#267)

### Documented

- Add note about in-memory representation of atomic types (#253)
- Document `LOOM_LOG` syntax (#257)

### Fixed

- Fix double panic when exceeding the branch limit in `Drop` (#245)
- cell: Allow using `{Mut,Const}Ptr::{deref,with}` when the pointee is
  `!Sized` (#247)
- thread: Fix semantics of `thread::park` after `Thread::unpark` (#250)
@hawkw hawkw mentioned this pull request May 10, 2022
hawkw added a commit that referenced this pull request May 13, 2022
# 0.5.5 (May 10, 2022)

### Added

- sync: Add `Arc::from_std` without `T: Sized` bound (#226)
- sync: Implement `Debug` for `AtomicPtr` for all `T` (#255)
- logs: Add location tracking for threads and atomic operations (#258)
- logs: Add additional location tracking to `Arc`, `alloc`, and `mpsc`
  (#265)
- logs: Improve `tracing` configuration for `LOOM_LOG` (#266)
- logs: Add a span for the current model's iteration (#267)

### Documented

- Add note about in-memory representation of atomic types (#253)
- Document `LOOM_LOG` syntax (#257)

### Fixed

- Fix double panic when exceeding the branch limit in `Drop` (#245)
- cell: Allow using `{Mut,Const}Ptr::{deref,with}` when the pointee is
  `!Sized` (#247)
- thread: Fix semantics of `thread::park` after `Thread::unpark` (#250)
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.

2 participants