Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/release_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ jobs:
ref: ${{ needs.create-nightly-release.outputs.tag_name }}

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: stable
toolchain: nightly
targets: ${{ matrix.target }}

- name: Install Linux dependencies
Expand Down Expand Up @@ -339,9 +339,9 @@ jobs:
ref: ${{ needs.create-nightly-release.outputs.tag_name }}

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: stable
toolchain: nightly

- name: Generate report
run: ./stub-report/generate-report.sh
Expand Down Expand Up @@ -372,9 +372,9 @@ jobs:
ref: ${{ needs.create-nightly-release.outputs.tag_name }}

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: stable
toolchain: nightly
targets: wasm32-unknown-unknown
components: rust-src

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_extension_dockerfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
- uses: actions/checkout@v6

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: stable
toolchain: nightly
targets: wasm32-unknown-unknown
components: rust-src

Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/test_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,17 @@ jobs:
strategy:
fail-fast: false
matrix:
rust_version: [stable]
rust_version: [nightly]
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025, macos-15]
include:
- rust_version: nightly
os: ubuntu-24.04
- rust_version: beta
os: ubuntu-24.04

steps:
- uses: actions/checkout@v6

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{ matrix.rust_version }}

Expand Down Expand Up @@ -127,13 +125,13 @@ jobs:
strategy:
fail-fast: false
matrix:
rust_version: [stable, beta, nightly]
rust_version: [nightly]

steps:
- uses: actions/checkout@v6

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{ matrix.rust_version }}
components: rustfmt, clippy
Expand Down Expand Up @@ -286,7 +284,7 @@ jobs:
- uses: actions/checkout@v6

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@nightly

- name: Check licenses, duplicates, and advisories
uses: EmbarkStudios/cargo-deny-action@v2
Expand All @@ -309,13 +307,11 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust_version: [stable]
rust_version: [nightly]
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025, macos-15]
include:
- rust_version: nightly
os: ubuntu-24.04
- rust_version: beta
os: ubuntu-24.04

steps:
- name: No-op
Expand All @@ -328,7 +324,7 @@ jobs:
runs-on: ubuntu-24.04
strategy:
matrix:
rust_version: [stable, beta, nightly]
rust_version: [nightly]

steps:
- name: No-op
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
cache-dependency-path: web/package-lock.json

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-unknown-unknown

Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
cache-dependency-path: web/package-lock.json

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-unknown-unknown

Expand Down
32 changes: 4 additions & 28 deletions core/src/ecma_conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ pub fn f64_to_wrapping_i32(n: f64) -> i32 {
#[cfg(target_arch = "aarch64")]
{
if std::arch::is_aarch64_feature_detected!("jsconv") {
// SAFETY: `jsconv` feature is checked in both compile time and runtime to be existed, so it's safe to call.
unsafe { f64_to_wrapping_int32_aarch64(n) }
// Converts an `f64` to an `i32` with ECMAScript `ToInt32` wrapping behavior.
// The value will be wrapped in the range [-2^31, 2^31).
// Optimized for aarch64 cpu with the fjcvtzs instruction.
unsafe { std::arch::aarch64::__jcvt(n) }
} else {
f64_to_wrapping_i32_generic(n)
}
Expand All @@ -59,32 +61,6 @@ fn f64_to_wrapping_i32_generic(n: f64) -> i32 {
f64_to_wrapping_u32(n) as i32
}

/// Converts an `f64` to an `i32` with ECMAScript `ToInt32` wrapping behavior.
/// The value will be wrapped in the range [-2^31, 2^31).
/// Optimized for aarch64 cpu with the fjcvtzs instruction.
///
/// # Safety
///
/// The caller must ensure either:
/// - The target platform is aarch64 with `jsconv` feature enabled, or
/// - Runtime feature detection has been performed to verify `jsconv` support
#[allow(unused)]
#[cfg(target_arch = "aarch64")]
#[target_feature(enable = "jsconv")]
unsafe fn f64_to_wrapping_int32_aarch64(number: f64) -> i32 {
let ret: i32;
// SAFETY: fjcvtzs instruction is available under jsconv feature.
unsafe {
std::arch::asm!(
"fjcvtzs {dst:w}, {src:d}",
src = in(vreg) number,
dst = out(reg) ret,
options(nostack, nomem, pure)
);
}
ret
}

/// Implements the IEEE-754 "Round to nearest, ties to even" rounding rule.
/// (e.g., both 1.5 and 2.5 will round to 2).
/// This also clamps out-of-range values and NaN to `i32::MIN`.
Expand Down
3 changes: 3 additions & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
// This lint is good in theory, but in AVMs we often need to do `let x = args.get(0); let y = args.get(1);` etc.
// It'd make those much less readable and consistent.
#![allow(clippy::get_first)]
// This enables the core::arch::aarch64::__jcvt() intrinsic, which is used to convert a f64 into an
// i32 the JavaScript way on ARMv8.3+.
#![feature(stdarch_aarch64_jscvt)]

#[macro_use]
mod display_object;
Expand Down
Loading