-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
impl Valuable for atomic types (#31)
This implements Valuable for the following types. - AtomicBool - AtomicI8 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicIsize - AtomicU8 - AtomicU16 - AtomicU32 - AtomicU64 - AtomicUsize In some targets, atomic u64/i64 is not available or atomic is not available at all, so this detects those targets by using the same way as #12.
- Loading branch information
Showing
8 changed files
with
201 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
|
||
# Update the list of targets that do not support atomic/CAS operations. | ||
# | ||
# Usage: | ||
# ./ci/no_atomic.sh | ||
|
||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
cd "$(cd "$(dirname "$0")" && pwd)"/.. | ||
|
||
file="valuable/no_atomic.rs" | ||
|
||
{ | ||
echo "// This file is @generated by $(basename "$0")." | ||
echo "// It is not intended for manual editing." | ||
echo "" | ||
} >"$file" | ||
|
||
echo "const NO_ATOMIC_CAS: &[&str] = &[" >>"$file" | ||
for target in $(rustc --print target-list); do | ||
res=$(rustc --print target-spec-json -Z unstable-options --target "$target" \ | ||
| jq -r "select(.\"atomic-cas\" == false)") | ||
[[ -z "$res" ]] || echo " \"$target\"," >>"$file" | ||
done | ||
echo "];" >>"$file" | ||
|
||
echo "const NO_ATOMIC_64: &[&str] = &[" >>"$file" | ||
for target in $(rustc --print target-list); do | ||
res=$(rustc --print target-spec-json -Z unstable-options --target "$target" \ | ||
| jq -r "select(.\"max-atomic-width\" == 32)") | ||
[[ -z "$res" ]] || echo " \"$target\"," >>"$file" | ||
done | ||
# It is not clear exactly what `"max-atomic-width" == null` means, but they | ||
# actually seem to have the same max-atomic-width as the target-pointer-width. | ||
# The targets currently included in this group are "mipsel-sony-psp", | ||
# "thumbv4t-none-eabi", "thumbv6m-none-eabi", all of which are | ||
# `"target-pointer-width" == "32"`, so assuming them `"max-atomic-width" == 32` | ||
# for now. | ||
for target in $(rustc --print target-list); do | ||
res=$(rustc --print target-spec-json -Z unstable-options --target "$target" \ | ||
| jq -r "select(.\"max-atomic-width\" == null)") | ||
[[ -z "$res" ]] || echo " \"$target\"," >>"$file" | ||
done | ||
echo "];" >>"$file" | ||
|
||
# There is no `"max-atomic-width" == 16` or `"max-atomic-width" == 8` targets. | ||
|
||
# `"max-atomic-width" == 0` means that atomic is not supported at all. | ||
echo "const NO_ATOMIC: &[&str] = &[" >>"$file" | ||
for target in $(rustc --print target-list); do | ||
res=$(rustc --print target-spec-json -Z unstable-options --target "$target" \ | ||
| jq -r "select(.\"max-atomic-width\" == 0)") | ||
[[ -z "$res" ]] || echo " \"$target\"," >>"$file" | ||
done | ||
echo "];" >>"$file" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// This file is @generated by no_atomic.sh. | ||
// It is not intended for manual editing. | ||
|
||
const NO_ATOMIC_CAS: &[&str] = &[ | ||
"avr-unknown-gnu-atmega328", | ||
"msp430-none-elf", | ||
"riscv32i-unknown-none-elf", | ||
"riscv32imc-unknown-none-elf", | ||
"thumbv4t-none-eabi", | ||
"thumbv6m-none-eabi", | ||
]; | ||
const NO_ATOMIC_64: &[&str] = &[ | ||
"arm-linux-androideabi", | ||
"armebv7r-none-eabi", | ||
"armebv7r-none-eabihf", | ||
"armv4t-unknown-linux-gnueabi", | ||
"armv5te-unknown-linux-gnueabi", | ||
"armv5te-unknown-linux-musleabi", | ||
"armv5te-unknown-linux-uclibceabi", | ||
"armv7r-none-eabi", | ||
"armv7r-none-eabihf", | ||
"hexagon-unknown-linux-musl", | ||
"mips-unknown-linux-gnu", | ||
"mips-unknown-linux-musl", | ||
"mips-unknown-linux-uclibc", | ||
"mipsel-unknown-linux-gnu", | ||
"mipsel-unknown-linux-musl", | ||
"mipsel-unknown-linux-uclibc", | ||
"mipsel-unknown-none", | ||
"mipsisa32r6-unknown-linux-gnu", | ||
"mipsisa32r6el-unknown-linux-gnu", | ||
"powerpc-unknown-linux-gnu", | ||
"powerpc-unknown-linux-gnuspe", | ||
"powerpc-unknown-linux-musl", | ||
"powerpc-unknown-netbsd", | ||
"powerpc-unknown-openbsd", | ||
"powerpc-wrs-vxworks", | ||
"powerpc-wrs-vxworks-spe", | ||
"riscv32gc-unknown-linux-gnu", | ||
"riscv32gc-unknown-linux-musl", | ||
"riscv32imac-unknown-none-elf", | ||
"thumbv7em-none-eabi", | ||
"thumbv7em-none-eabihf", | ||
"thumbv7m-none-eabi", | ||
"thumbv8m.base-none-eabi", | ||
"thumbv8m.main-none-eabi", | ||
"thumbv8m.main-none-eabihf", | ||
"mipsel-sony-psp", | ||
"thumbv4t-none-eabi", | ||
"thumbv6m-none-eabi", | ||
]; | ||
const NO_ATOMIC: &[&str] = &[ | ||
"avr-unknown-gnu-atmega328", | ||
"msp430-none-elf", | ||
"riscv32i-unknown-none-elf", | ||
"riscv32imc-unknown-none-elf", | ||
]; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters