-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Stabilize the integer_atomics
feature: Atomic{I,U}{8,16,32,64}
#56753
Comments
@rfcbot fcp merge Proposing a formal stabilization here, lots of words are above! |
Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged teams: Concerns:
Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
@rfcbot concern target_has_atomic Why not stabilize this |
I'm not currently proposing it for two main reasons, the first being that it can always be stabilized later and it's more conservative to start out without it. Other than that though I'd like to try to see what the experience is without these cfgs and how bad it is to be portable across these platforms. I'm not sure that it's a great name for a cfg anyway because it doesn't cover thumv6m's case of "they exist but have few methods". |
I'm not too happy with Maybe we could defer stabilizing atomics on platforms like thumbv6m that only have partial support? |
cc #54250 |
I don't think we should stabilize Really, stabilizing these atomics is also a decision that T-Lang should be in on since from what I can tell the abstract machine is affected; but given that we already have similar operations for |
I think it's fine if we stabilize without |
ping @sfackler, @Kimundi, @SimonSapin, it'd be great to make some progress on this! |
@rfcbot resolve target_has_atomic |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
I've posted a stabilization PR at #57425 for when FCP is done |
The final comment period, with a disposition to merge, as per the review above, is now complete. |
This commit stabilizes the `Atomic{I,U}{8,16,32,64}` APIs in the `std::sync::atomic` and `core::sync::atomic` modules. Proposed in rust-lang#56753 and tracked in rust-lang#32976 this feature has been unstable for quite some time and is hopefully ready to go over the finish line now! The API is being stabilized as-is. The API of `AtomicU8` and friends mirrors that of `AtomicUsize`. A list of changes made here are: * A portability documentation section has been added to describe the current state of affairs. * Emulation of smaller-size atomics with larger-size atomics has been documented. * As an added bonus, `ATOMIC_*_INIT` is now scheduled for deprecation across the board in 1.34.0 now that `const` functions can be invoked in statics. Note that the 128-bit atomic types are omitted from this stabilization explicitly. They have far less platform support than the other atomic types, and will likely require further discussion about their best location. Closes rust-lang#32976 Closes rust-lang#56753
…fackler std: Stabilize fixed-width integer atomics This commit stabilizes the `Atomic{I,U}{8,16,32,64}` APIs in the `std::sync::atomic` and `core::sync::atomic` modules. Proposed in rust-lang#56753 and tracked in rust-lang#32976 this feature has been unstable for quite some time and is hopefully ready to go over the finish line now! The API is being stabilized as-is. The API of `AtomicU8` and friends mirrors that of `AtomicUsize`. A list of changes made here are: * A portability documentation section has been added to describe the current state of affairs. * Emulation of smaller-size atomics with larger-size atomics has been documented. * As an added bonus, `ATOMIC_*_INIT` is now scheduled for deprecation across the board in 1.34.0 now that `const` functions can be invoked in statics. Note that the 128-bit atomic types are omitted from this stabilization explicitly. They have far less platform support than the other atomic types, and will likely require further discussion about their best location. Closes rust-lang#32976 Closes rust-lang#56753
…fackler std: Stabilize fixed-width integer atomics This commit stabilizes the `Atomic{I,U}{8,16,32,64}` APIs in the `std::sync::atomic` and `core::sync::atomic` modules. Proposed in rust-lang#56753 and tracked in rust-lang#32976 this feature has been unstable for quite some time and is hopefully ready to go over the finish line now! The API is being stabilized as-is. The API of `AtomicU8` and friends mirrors that of `AtomicUsize`. A list of changes made here are: * A portability documentation section has been added to describe the current state of affairs. * Emulation of smaller-size atomics with larger-size atomics has been documented. * As an added bonus, `ATOMIC_*_INIT` is now scheduled for deprecation across the board in 1.34.0 now that `const` functions can be invoked in statics. Note that the 128-bit atomic types are omitted from this stabilization explicitly. They have far less platform support than the other atomic types, and will likely require further discussion about their best location. Closes rust-lang#32976 Closes rust-lang#56753
std: Stabilize fixed-width integer atomics This commit stabilizes the `Atomic{I,U}{8,16,32,64}` APIs in the `std::sync::atomic` and `core::sync::atomic` modules. Proposed in #56753 and tracked in #32976 this feature has been unstable for quite some time and is hopefully ready to go over the finish line now! The API is being stabilized as-is. The API of `AtomicU8` and friends mirrors that of `AtomicUsize`. A list of changes made here are: * A portability documentation section has been added to describe the current state of affairs. * Emulation of smaller-size atomics with larger-size atomics has been documented. * As an added bonus, `ATOMIC_*_INIT` is now scheduled for deprecation across the board in 1.34.0 now that `const` functions can be invoked in statics. Note that the 128-bit atomic types are omitted from this stabilization explicitly. They have far less platform support than the other atomic types, and will likely require further discussion about their best location. Closes #32976 Closes #56753
FWIW, there is a simple way to perform 64-bit atomics on 32-bit PowerPC using the FPU, it's being used in OpenJDK: http://hg.openjdk.java.net/jdk/jdk/file/cbde3b803d93/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp#l39 (with separate code for powerpc and powerpcspe). No idea how one would implement this kind of inline assembly in Rust though ;). |
The compiler, like any program using unstable Rust syntax, can invoke an LLVM-ish inline assembler. |
RFC: rust-lang/rfcs#1543
Tracking issue: #32976
Documentation: https://doc.rust-lang.org/nightly/std/sync/atomic/
This issue is a proposal to stabilize the
integer_atomics
feature as-is on nightly, modulo some documentation updates. Specifically, for each atomic type, this is proposed:Portability
One of the main points on the RFC and tracking issue is the portability of these types. @alexcrichton has compiled this table of known platform support, and the conclusions we've drawn with the libs team are:
AtomicUsize
type is already "sketchily" supported. It's not present on armv5te (non-linux) and has a stripped down API on thumv6mIt's proposed in this stabilization that we stabilize all APIs as-is, knowing that these apis are in a "portable location" yet are not as maximally portable as, say,
Add for u8
. It's intended that platforms which don't support these types simply won't provide the types, as they do today. For example armv5te will continue to have none of these types. (for those following these issues, **it's not proposed thattarget_has_atomic
is stabilized as part of this proposal).While this is a departure from the norms of the rest of the standard library, it's hopefully the most pragmatic decision here.
What about u128?
Some very recent (aka 20 minutes before this issue was opened) shows that
AtomicU128
can be supported on x86_64 with the LLVMcx16
feature activated and aarch64 platforms. All other platforms look to require intrinsics one way or another. This proposal doesn't propose stabilizing these just yet, but the thinking is that a stable/safestd::arch::aarch64::AtomicU128
could be provided while a stable/unsafestd::arch::x86_64::AtomicU128
could be provided documenting the requirement of the target feature (exact name of the target feature TBD)TODO checklist before stabilization:
The text was updated successfully, but these errors were encountered: