Skip to content
Merged
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
3 changes: 3 additions & 0 deletions changelog.d/8864-release-r19-blockers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Fixed

- Kept non-callable value-call errors catchable across the checked-unbox runtime boundary, refreshed the native-value-profile parity expectation for its intentional POD-copy coverage, and removed a duplicate stdin listener match arm that made current `main` fail the warnings gate.
15 changes: 12 additions & 3 deletions crates/perry-runtime/src/closure/unbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ use super::dispatch::throw_not_callable;
/// available. A callable value (closure, bound method/function, native
/// handle) is always `POINTER_TAG`; numbers, strings, bigints, booleans,
/// null and undefined are not, and throw here.
///
/// `C-unwind` is required because `throw_not_callable` can raise a Perry
/// exception through the system unwinder to generated code's landing pad.
/// A plain `extern "C"` boundary turns that catchable throw into
/// `panic_cannot_unwind` and aborts the process.
#[no_mangle]
pub extern "C" fn js_closure_unbox_callee_checked(callee: f64) -> i64 {
pub extern "C-unwind" fn js_closure_unbox_callee_checked(callee: f64) -> i64 {
let bits = callee.to_bits();
if bits & crate::value::TAG_MASK != crate::value::POINTER_TAG {
throw_not_callable();
Expand All @@ -48,7 +53,7 @@ pub extern "C" fn js_closure_unbox_callee_checked(callee: f64) -> i64 {
/// `this` (plain functions, arrows), so receiverless shapes and the common
/// own-method call (baked `this` == receiver) keep their exact behavior.
#[no_mangle]
pub extern "C" fn js_closure_unbox_callee_checked_rebind(callee: f64, receiver: f64) -> i64 {
pub extern "C-unwind" fn js_closure_unbox_callee_checked_rebind(callee: f64, receiver: f64) -> i64 {
let bits = callee.to_bits();
if bits & crate::value::TAG_MASK != crate::value::POINTER_TAG {
throw_not_callable();
Expand All @@ -60,5 +65,9 @@ pub extern "C" fn js_closure_unbox_callee_checked_rebind(callee: f64, receiver:
/// Keepalive: generated code is the only caller (#6475).
#[cfg(feature = "keepalive-anchors")]
#[used]
static KEEP_JS_CLOSURE_UNBOX_CALLEE_CHECKED_REBIND: extern "C" fn(f64, f64) -> i64 =
static KEEP_JS_CLOSURE_UNBOX_CALLEE_CHECKED_REBIND: extern "C-unwind" fn(f64, f64) -> i64 =
js_closure_unbox_callee_checked_rebind;

// Compile-time ABI guards for both throw-capable generated-code boundaries.
const _: extern "C-unwind" fn(f64) -> i64 = js_closure_unbox_callee_checked;
const _: extern "C-unwind" fn(f64, f64) -> i64 = js_closure_unbox_callee_checked_rebind;
6 changes: 0 additions & 6 deletions crates/perry-stdlib/src/readline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1699,12 +1699,6 @@ pub extern "C" fn js_readline_stdin_remove_listener(
v.retain(|registered| *registered != callback);
}
}
"end" | "close" => CLOSE_CALLBACK.with(|cb| {
let mut cb = cb.borrow_mut();
if *cb == Some(callback) {
*cb = None;
}
}),
_ => {}
}
js_nanbox_pointer(STDIN_READLINE_HANDLE)
Expand Down
2 changes: 1 addition & 1 deletion test-parity/expected/test_parity_native_value_profile.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
size=24,align=8,sequence=8,length=1,flags=4294967295,sequenceValue=9007199254740991,gainRounded=true,tiny=2:1:255:255:7,narrow=16:2:4:8:-128:65535:-32768:-9007199254740991:-5:65535:-1024:-42,header=7:42:true,rejectedFraction=true,rejectedType=true,rejectedOctet=true,rejectedSignedByte=true,rejectedHalfWord=true,rejectedSignedHalfWord=true,rejectedSignedSize=true
size=24,align=8,sequence=8,length=1,flags=4294967295,sequenceValue=9007199254740991,gainRounded=true,tiny=2:1:255:255:7,narrow=16:2:4:8:-128:65535:-32768:-9007199254740991:-5:65535:-1024:-42,header=7:42:true,podCopy=7:9:513:-8,rejectedFraction=true,rejectedType=true,rejectedOctet=true,rejectedSignedByte=true,rejectedHalfWord=true,rejectedSignedHalfWord=true,rejectedSignedSize=true