Skip to content

Commit

Permalink
Use portable-atomic instead of atomic-polyfill (google#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 authored Apr 25, 2023
1 parent a40871d commit 1fc54ee
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 276 deletions.
2 changes: 1 addition & 1 deletion crates/interpreter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Minor

- Use `atomic-polyfill` to support RV32IMC
- Use `portable-atomic` to support RV32IMC

### Patch

Expand Down
23 changes: 7 additions & 16 deletions crates/interpreter/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ keywords = ["embedded", "framework", "no-std", "wasm"]
categories = ["embedded", "no-std", "wasm"]

[dependencies]
atomic-polyfill = "1.0.2"
libm = { version = "0.2.6", optional = true }
lru = { version = "0.10.0", optional = true }
num_enum = { version = "0.6.0", default-features = false }
paste = "1.0.12"
portable-atomic = { version = "1.2.0", default-features = false }

[dev-dependencies]
lazy_static = "1.4.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/interpreter/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use atomic_polyfill::{AtomicUsize, Ordering};
use portable_atomic::{AtomicUsize, Ordering};

/// Returns numbers from 1 to u32::MAX (inclusive).
pub struct UniqueId {
Expand Down
14 changes: 14 additions & 0 deletions crates/interpreter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@
//! }
//! # }
//! ```
//!
//! # Atomic support
//!
//! This crate uses atomic operations and relies on the `portable-atomic` crate to support
//! architectures without atomic operations. Depending on your architecture, you may need one of the
//! following:
//!
//! - Enable the `portable-atomic/critical-section` feature (possibly adding a direct dependency on
//! `portable-atomic`).
//!
//! - Set the `--cfg=portable_atomic_unsafe_assume_single_core` rustc flag.
//!
//! You can find more information in the `portable-atomic`
//! [documentation](https://docs.rs/portable-atomic/latest/portable_atomic).
#![cfg_attr(not(feature = "debug"), no_std)]
#![cfg_attr(not(feature = "toctou"), feature(slice_split_at_unchecked))]
Expand Down
214 changes: 0 additions & 214 deletions crates/interpreter/src/runtime.rs

This file was deleted.

5 changes: 4 additions & 1 deletion crates/interpreter/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ set -ex

cargo check
cargo check --target=thumbv7em-none-eabi
cargo check --target=riscv32imc-unknown-none-elf
cargo check --target=riscv32imc-unknown-none-elf \
--features=portable-atomic/critical-section
RUSTFLAGS=--cfg=portable_atomic_unsafe_assume_single_core \
cargo check --target=riscv32imc-unknown-none-elf
cargo fmt -- --check
cargo clippy -- --deny=warnings
[ -e ../../third_party/WebAssembly/spec/.git ] || git submodule update --init
Expand Down
23 changes: 7 additions & 16 deletions crates/runner-host/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1fc54ee

Please sign in to comment.