Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: taiki-e/portable-atomic
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7618d4acdfba66decf78bdb7693ab3d2743c9872
Choose a base ref
..
head repository: taiki-e/portable-atomic
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c7c78fed314312a4d9a9f0ae09867510f5c0a9a1
Choose a head ref
17 changes: 16 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ env:
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: '10'

test_task:
aarch64_linux_task:
name: test (aarch64-unknown-linux-gnu)
env:
TARGET: aarch64-unknown-linux-gnu
@@ -28,6 +28,21 @@ test_task:
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO=fat cargo -Z build-std test -vv --workspace --exclude bench --all-features --release --tests --target $TARGET
# TODO: lse2 is not available on Graviton2 (armv8.2-a)

aarch64_macos_task:
name: test (aarch64-apple-darwin)
env:
TARGET: aarch64-apple-darwin
macos_instance:
image: ghcr.io/cirruslabs/macos-monterey-xcode:latest
setup_script:
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly --component rust-src
test_script:
- source $HOME/.cargo/env
- cargo test -vv --workspace --exclude bench --all-features
- cargo test -vv --workspace --exclude bench --all-features --release
# Use -Z build-std because the prebuilt libtest seems to be incompatible with LTO, causing miscompilation: https://gist.github.com/taiki-e/9713f8e02e8f9f852ccee8d6f089ec24
- CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO=fat cargo -Z build-std test -vv --workspace --exclude bench --all-features --release --tests --target $TARGET

valgrind_task:
name: valgrind (aarch64-unknown-linux-gnu)
env:
1 change: 1 addition & 0 deletions .github/bors.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
status = [
"ci",
"test (aarch64-unknown-linux-gnu)",
"test (aarch64-apple-darwin)",
"valgrind (aarch64-unknown-linux-gnu)",
]
59 changes: 39 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -47,6 +47,9 @@ jobs:
target: aarch64-unknown-linux-gnu
- rust: nightly
target: aarch64-unknown-linux-gnu
- rust: nightly
target: aarch64_be-unknown-linux-gnu
os: ubuntu-18.04
- rust: nightly
target: arm-unknown-linux-gnueabi
- rust: nightly
@@ -76,6 +79,8 @@ jobs:
os: ubuntu-18.04
- rust: nightly
target: powerpc64le-unknown-linux-gnu
- rust: nightly
target: riscv32gc-unknown-linux-gnu
- rust: nightly
target: riscv64gc-unknown-linux-gnu
- rust: nightly
@@ -90,7 +95,7 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@v1
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{ matrix.rust }}
components: rust-src
@@ -104,27 +109,32 @@ jobs:
if: matrix.target != ''
- run: |
echo "RUSTFLAGS=${RUSTFLAGS} --cfg qemu" >>"${GITHUB_ENV}"
if: startsWith(matrix.target, 'powerpc64')
if: matrix.target != '' && !startsWith(matrix.target, 'i686') && !startsWith(matrix.target, 'x86_64')
- run: |
echo "TARGET=--target=${{ matrix.target }}" >>"${GITHUB_ENV}"
if: matrix.target != ''
- run: cargo test -vv --workspace --exclude bench --all-features $DOCTEST_XCOMPILE
- run: cargo test -vv --workspace --exclude bench --all-features --release $DOCTEST_XCOMPILE
- run: cargo test -vv --workspace --exclude bench --all-features --release $DOCTEST_XCOMPILE
- run: cargo test -vv --workspace --exclude bench --all-features $TARGET $BUILD_STD $DOCTEST_XCOMPILE
- run: cargo test -vv --workspace --exclude bench --all-features --release $TARGET $BUILD_STD $DOCTEST_XCOMPILE
# LTO + doctests is very slow on some platforms
- run: cargo test -vv --workspace --exclude bench --all-features --release $TARGET $BUILD_STD $DOCTEST_XCOMPILE --tests
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: fat

# +cmpxchg16b
- run: cargo test -vv --workspace --exclude bench --all-features $DOCTEST_XCOMPILE
- run: cargo test -vv --workspace --exclude bench --all-features $TARGET $BUILD_STD $DOCTEST_XCOMPILE
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
if: matrix.target == '' || startsWith(matrix.target, 'x86_64')
- run: cargo test -vv --workspace --exclude bench --all-features --release $DOCTEST_XCOMPILE
- run: cargo test -vv --workspace --exclude bench --all-features --release $TARGET $BUILD_STD $DOCTEST_XCOMPILE
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
if: matrix.target == '' || startsWith(matrix.target, 'x86_64')
- run: cargo test -vv --workspace --exclude bench --all-features --release $DOCTEST_XCOMPILE
# LTO + doctests is very slow on some platforms
- run: cargo test -vv --workspace --exclude bench --all-features --release $TARGET $BUILD_STD $DOCTEST_XCOMPILE --tests
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: fat
@@ -133,17 +143,18 @@ jobs:
if: matrix.target == '' || startsWith(matrix.target, 'x86_64')

# +lse
- run: cargo test -vv --workspace --exclude bench --all-features $DOCTEST_XCOMPILE
- run: cargo test -vv --workspace --exclude bench --all-features $TARGET $BUILD_STD $DOCTEST_XCOMPILE
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+lse
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+lse
if: startsWith(matrix.target, 'aarch64')
- run: cargo test -vv --workspace --exclude bench --all-features --release $DOCTEST_XCOMPILE
- run: cargo test -vv --workspace --exclude bench --all-features --release $TARGET $BUILD_STD $DOCTEST_XCOMPILE
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+lse
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+lse
if: startsWith(matrix.target, 'aarch64')
- run: cargo test -vv --workspace --exclude bench --all-features --release $DOCTEST_XCOMPILE
# LTO + doctests is very slow on some platforms
- run: cargo test -vv --workspace --exclude bench --all-features --release $TARGET $BUILD_STD $DOCTEST_XCOMPILE --tests
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: fat
@@ -153,22 +164,26 @@ jobs:
# TODO: it seems qemu-user has not yet properly implemented FEAT_LSE2: https://github.com/taiki-e/portable-atomic/pull/11#issuecomment-1114044327

# pwr8
- run: cargo test -vv --workspace --exclude bench --all-features $DOCTEST_XCOMPILE
- run: cargo test -vv --workspace --exclude bench --all-features $TARGET $BUILD_STD $DOCTEST_XCOMPILE
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-cpu=pwr8
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-cpu=pwr8
if: startsWith(matrix.target, 'powerpc64-')
- run: cargo test -vv --workspace --exclude bench --all-features --release $DOCTEST_XCOMPILE
- run: cargo test -vv --workspace --exclude bench --all-features --release $TARGET $BUILD_STD $DOCTEST_XCOMPILE
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-cpu=pwr8
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-cpu=pwr8
if: startsWith(matrix.target, 'powerpc64-')
- run: cargo test -vv --workspace --exclude bench --all-features --release $DOCTEST_XCOMPILE
# LTO + doctests is very slow on some platforms
- run: cargo test -vv --workspace --exclude bench --all-features --release $TARGET $BUILD_STD $DOCTEST_XCOMPILE --tests
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: fat
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-cpu=pwr8
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-cpu=pwr8
if: startsWith(matrix.target, 'powerpc64-')

- run: cargo minimal-versions build -vvv --workspace --all-features --ignore-private
- run: cargo minimal-versions build -vvv --workspace --all-features --ignore-private $TARGET $BUILD_STD
if: startsWith(matrix.rust, 'nightly')

build:
@@ -187,7 +202,7 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@v1
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{ matrix.rust }}
components: rust-src
@@ -265,8 +280,9 @@ jobs:
- run: |
cargo -Z build-std test -vv --workspace --exclude bench --all-features --release --target "$(rustc -Vv | grep host | sed 's/host: //')"
if: matrix.sanitizer != 'memory' # https://github.com/google/sanitizers/issues/558
# LTO + doctests is very slow on some platforms
- run: |
cargo -Z build-std test -vv --workspace --exclude bench --all-features --release --target "$(rustc -Vv | grep host | sed 's/host: //')"
cargo -Z build-std test -vv --workspace --exclude bench --all-features --release --target "$(rustc -Vv | grep host | sed 's/host: //')" --tests
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: fat
@@ -283,8 +299,9 @@ jobs:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
if: matrix.sanitizer != 'memory' # https://github.com/google/sanitizers/issues/558
# LTO + doctests is very slow on some platforms
- run: |
cargo -Z build-std test -vv --workspace --exclude bench --all-features --release --target "$(rustc -Vv | grep host | sed 's/host: //')"
cargo -Z build-std test -vv --workspace --exclude bench --all-features --release --target "$(rustc -Vv | grep host | sed 's/host: //')" --tests
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: fat
@@ -313,7 +330,8 @@ jobs:
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} --cfg valgrind
RUSTFLAGS: ${{ env.RUSTFLAGS }} --cfg valgrind
- run: cargo test -vv --workspace --exclude bench --all-features --release -Z doctest-xcompile
# LTO + doctests is very slow on some platforms
- run: cargo test -vv --workspace --exclude bench --all-features --release -Z doctest-xcompile --tests
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: fat
@@ -328,7 +346,8 @@ jobs:
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b --cfg valgrind
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b --cfg valgrind
- run: cargo test -vv --workspace --exclude bench --all-features --release -Z doctest-xcompile
# LTO + doctests is very slow on some platforms
- run: cargo test -vv --workspace --exclude bench --all-features --release -Z doctest-xcompile --tests
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: fat
48 changes: 47 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -10,8 +10,45 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com

## [Unreleased]

## [0.3.8] - 2022-08-02

- Make aarch64 and s390x 128-bit atomics compatible with Miri and ThreadSanitizer.

## [0.3.7] - 2022-07-31

- Provide stable equivalent of [`#![feature(strict_provenance_atomic_ptr)]`](https://github.com/rust-lang/rust/issues/99108). ([#23](https://github.com/taiki-e/portable-atomic/pull/23))

- `AtomicPtr::fetch_ptr_{add,sub}`
- `AtomicPtr::fetch_byte_{add,sub}`
- `AtomicPtr::fetch_{or,and,xor}`

These APIs are compatible with strict-provenance on `cfg(miri)`. Otherwise, they are compatible with permissive-provenance.
Once `#![feature(strict_provenance_atomic_ptr)]` is stabilized, these APIs will be strict-provenance compatible in all cases from the version in which it is stabilized.

- Provide stable equivalent of [`#![feature(atomic_bool_fetch_not)]`](https://github.com/rust-lang/rust/issues/98485). ([#24](https://github.com/taiki-e/portable-atomic/pull/24))

- `AtomicBool::fetch_not`

- Optimize x86_64 128-bit RMWs. ([#22](https://github.com/taiki-e/portable-atomic/pull/22))

- Optimize x86_64 outline-atomics.

- Optimize inline assemblies on ARM and AArch64.

- Revert [thumbv6m atomic load/store changes made in 0.3.5](https://github.com/taiki-e/portable-atomic/pull/18). This is because [rust-lang/rust#99595](https://github.com/rust-lang/rust/pull/99595) has been reverted, so this is no longer needed.

## [0.3.6] - 2022-07-26

- Fix build failure due to the existence of the `specs` directory.

- Documentation improvements.

- Optimize inline assemblies on x86_64, riscv, and msp430.

## [0.3.5] - 2022-07-23

**Note:** This release has been yanked due to a bug fixed in 0.3.6.

- Provide thumbv6m atomic load/store which is planned to be removed from the standard library in [rust-lang/rust#99595](https://github.com/rust-lang/rust/pull/99595). ([#18](https://github.com/taiki-e/portable-atomic/pull/18))

## [0.3.4] - 2022-06-25
@@ -72,19 +109,28 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com

## [0.1.2] - 2022-02-26

**Note:** This release has been yanked due to a bug fixed in 0.1.3.

- Add `parking_lot` feature to use parking_lot in global locks of fallback implementation.

- Fix bug in cmpxchg16b support. ([#5](https://github.com/taiki-e/portable-atomic/pull/5))

## [0.1.1] - 2022-02-25

**Note:** This release has been yanked due to a bug fixed in 0.1.3.

- Fix doc cfg on `Atomic{I,U}128`.

## [0.1.0] - 2022-02-24

**Note:** This release has been yanked due to a bug fixed in 0.1.3.

Initial release

[Unreleased]: https://github.com/taiki-e/portable-atomic/compare/v0.3.5...HEAD
[Unreleased]: https://github.com/taiki-e/portable-atomic/compare/v0.3.8...HEAD
[0.3.8]: https://github.com/taiki-e/portable-atomic/compare/v0.3.7...v0.3.8
[0.3.7]: https://github.com/taiki-e/portable-atomic/compare/v0.3.6...v0.3.7
[0.3.6]: https://github.com/taiki-e/portable-atomic/compare/v0.3.5...v0.3.6
[0.3.5]: https://github.com/taiki-e/portable-atomic/compare/v0.3.4...v0.3.5
[0.3.4]: https://github.com/taiki-e/portable-atomic/compare/v0.3.3...v0.3.4
[0.3.3]: https://github.com/taiki-e/portable-atomic/compare/v0.3.2...v0.3.3
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "portable-atomic"
version = "0.3.5" #publish:version
version = "0.3.8" #publish:version
edition = "2018"
rust-version = "1.34"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/taiki-e/portable-atomic"
keywords = ["atomic"]
categories = ["concurrency", "data-structures", "embedded", "hardware-support", "no-std"]
exclude = ["/.*", "/tools"]
exclude = ["/.*", "/tools", "/target-specs"]
description = """
Portable atomic types including support for 128-bit atomics, atomic float, generic atomic type, etc.
"""
@@ -77,11 +77,12 @@ serde = { version = "1.0.103", optional = true, default-features = false }
[dev-dependencies]
crossbeam-utils = "0.8"
fastrand = "1"
macrotest = { git = "https://github.com/taiki-e/macrotest.git", rev = "779cfa5" } # https://github.com/eupn/macrotest/pull/69
macrotest = "1.0.9"
paste = "1"
quickcheck = { default-features = false, git = "https://github.com/taiki-e/quickcheck.git", branch = "dev" } # https://github.com/BurntSushi/quickcheck/pull/304 + https://github.com/BurntSushi/quickcheck/pull/282 + lower MSRV
rustversion = "1"
serde = { version = "1", features = ["derive"] }
serde_test = "1"
sptr = "0.3"
static_assertions = "1"
trybuild = "1"
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -13,8 +13,10 @@ Portable atomic types including support for 128-bit atomics, atomic float, gener
- Provide `AtomicI128` and `AtomicU128`.
- Provide `AtomicF32` and `AtomicF64`. (optional)
- Provide generic `Atomic<T>` type. (optional)
- Provide atomic load/store for targets where atomic is not available at all in the standard library. (thumbv6m, riscv without A-extension, msp430, avr)
- Provide atomic load/store for targets where atomic is not available at all in the standard library. (riscv without A-extension, msp430, avr)
- Provide atomic CAS for targets where atomic CAS is not available in the standard library. (thumbv6m, riscv without A-extension, msp430, avr) (optional, [single-core only](#optional-cfg))
- Provide stable equivalents of the standard library atomic types' unstable APIs, such as [`AtomicPtr::fetch_*`](https://github.com/rust-lang/rust/issues/99108), [`AtomicBool::fetch_not`](https://github.com/rust-lang/rust/issues/98485).
- Make features that require newer compilers, such as [fetch_max](https://doc.rust-lang.org/std/sync/atomic/struct.AtomicUsize.html#method.fetch_max), [fetch_min](https://doc.rust-lang.org/std/sync/atomic/struct.AtomicUsize.html#method.fetch_min), [fetch_update](https://doc.rust-lang.org/std/sync/atomic/struct.AtomicPtr.html#method.fetch_update), and [stronger CAS failure ordering](https://github.com/rust-lang/rust/pull/98383) available on Rust 1.34+.

## 128-bit atomics support

@@ -72,6 +74,9 @@ See [this list](https://github.com/taiki-e/portable-atomic/issues/10#issuecommen
- **`serde`**<br>
Implement `serde::{Serialize,Deserialize}` for atomic types.

Note:
- The MSRV when this feature enables depends on the MSRV of [serde].

## Optional cfg

- **`--cfg portable_atomic_unsafe_assume_single_core`**<br>
Loading