Open jeehoonkang opened 5 years ago
Since MSRV = 1.36 now, we can use AtomicU64
now: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU64.html
Note that some 32-bit architectures do not support AtomicU64
: https://github.com/tokio-rs/tokio/pull/1421#issuecomment-527911780
Very sad. Do you think it's worth it to use AtomicU64 for those platforms that support it? My opinion is yes, because, e.g., major 32-bit architectures support AtomicU64.
I think it's good to use it when AtomicU64
is available, but we have to decide what to do if AtomicU64
is not available.
We can probably use AtomicCell<u64>
for this, but performance may be degraded on platforms that AtomicU64
is not available.
Note that there are already issues with building this crate on 32-bit powerpc:
error[E0432]: unresolved imports `core::sync::atomic::AtomicI64`, `core::sync::atomic::AtomicU64`
--> /wrkdirs/usr/ports/benchmarks/inferno/work/inferno-0.10.6/cargo-crates/crossbeam-utils-0.8.5/src/lib.rs:79:49
|
79 | pub(crate) use core::sync::atomic::{AtomicI64, AtomicU64};
| ^^^^^^^^^ ^^^^^^^^^ no `AtomicU64` in `sync::atomic`
| |
| no `AtomicI64` in `sync::atomic`
|
help: a similar name exists in the module
|
79 | pub(crate) use core::sync::atomic::{AtomicI8, AtomicU64};
| ^^^^^^^^
help: a similar name exists in the module
|
79 | pub(crate) use core::sync::atomic::{AtomicI64, AtomicU8};
| ^^^^^^^^
error[E0412]: cannot find type `AtomicU64` in module `core::sync::atomic`
--> /wrkdirs/usr/ports/benchmarks/inferno/work/inferno-0.10.6/cargo-crates/crossbeam-utils-0.8.5/src/atomic/consume.rs:78:14
|
78 | impl_atomic!(AtomicU64, u64);
| ^^^^^^^^^ help: a struct with a similar name exists: `AtomicU16`
error[E0412]: cannot find type `AtomicI64` in module `core::sync::atomic`
--> /wrkdirs/usr/ports/benchmarks/inferno/work/inferno-0.10.6/cargo-crates/crossbeam-utils-0.8.5/src/atomic/consume.rs:80:14
|
80 | impl_atomic!(AtomicI64, i64);
| ^^^^^^^^^ help: a struct with a similar name exists: `AtomicI16`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0412, E0432.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `crossbeam-utils`
@pkubaj Hmm... that's odd. https://github.com/crossbeam-rs/crossbeam/pull/698 was supposed to have taken care of those problems.
Which build system did you use? And did you receive any warnings during the build?
Thanks for the link. I'm building on FreeBSD (so using powerpc-unknown-freebsd target, which is not yet upstreamed). This is why it fails - powerpc-unknown-freebsd is not in the pre-generated no_atomic.rs. After adding it, build passes.
For now, I patched it in our ports tree. I guess we must send our powerpc port to upstream.
@stjepang said: