From ba7e98cecc2f876d20ecebca1e972ccccdefed22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Sun, 27 Sep 2026 14:17:30 +0200 Subject: [PATCH 1/2] wasm32: RAW_ADDRESS_LIMIT is a u64, so the accessor-pair word check compiles on 32-bit usize 1 << 48 overflows a 32-bit usize, which failed the wasm32-wasip2 build of perry-runtime (E0080). The limit bounds a u64 NaN-box word, so compare in u64; on 64-bit hosts the behaviour is unchanged. --- crates/perry-runtime/src/object/accessor_pair.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/perry-runtime/src/object/accessor_pair.rs b/crates/perry-runtime/src/object/accessor_pair.rs index 9330a1ef12b..3eff999d99d 100644 --- a/crates/perry-runtime/src/object/accessor_pair.rs +++ b/crates/perry-runtime/src/object/accessor_pair.rs @@ -60,12 +60,12 @@ pub(crate) struct Accessor { /// Largest code address a raw word can hold: below it no NaN-box tag bit is /// set, so the word is a Number to the collector. -const RAW_ADDRESS_LIMIT: usize = 1 << 48; +const RAW_ADDRESS_LIMIT: u64 = 1 << 48; #[inline] fn raw_word(raw: usize) -> u64 { - debug_assert!(raw < RAW_ADDRESS_LIMIT); - if raw < RAW_ADDRESS_LIMIT { + debug_assert!((raw as u64) < RAW_ADDRESS_LIMIT); + if (raw as u64) < RAW_ADDRESS_LIMIT { raw as u64 } else { 0 @@ -74,7 +74,7 @@ fn raw_word(raw: usize) -> u64 { #[inline] fn raw_of(word: u64) -> usize { - if (word as usize) < RAW_ADDRESS_LIMIT { + if word < RAW_ADDRESS_LIMIT { word as usize } else { 0 From 86fdcc20ad9cb6fde5d714094b6c1a8cfb5d4e32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Sun, 27 Sep 2026 19:01:38 +0200 Subject: [PATCH 2/2] changelog: wasm32 accessor-pair limit (#11562) --- changelog.d/11562-wasm32-accessor-pair-limit.md | 1 + 1 file changed, 1 insertion(+) create mode 100755 changelog.d/11562-wasm32-accessor-pair-limit.md diff --git a/changelog.d/11562-wasm32-accessor-pair-limit.md b/changelog.d/11562-wasm32-accessor-pair-limit.md new file mode 100755 index 00000000000..b1f0a596ad3 --- /dev/null +++ b/changelog.d/11562-wasm32-accessor-pair-limit.md @@ -0,0 +1 @@ +- **perry-runtime**: `accessor_pair.rs`'s `RAW_ADDRESS_LIMIT` (`1 << 48`) is a `u64` instead of a `usize`, so perry-runtime builds for `wasm32-wasip2` again (the constant overflowed a 32-bit `usize`, E0080). No change on 64-bit hosts.