From 3094a0fe4b2247111b5048336d97659e43f978da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Sat, 22 Aug 2026 04:41:06 +0200 Subject: [PATCH] fix(gc): convert ic_miss.rs's raw-handle reads to the scoping combinators The raw-handle ratchet is red on main: ic_miss.rs carries 12 bare reads in a module with no ceiling (937 vs baseline 925). They arrived with #8560 and were green when that PR was validated -- the baseline was 974 then, and #8559's cleanup subsequently lowered it to 925. All twelve are argument-position reads feeding non-allocating calls, which is exactly what with_{mut,const}_ptr is for per rule 1 of raw_handle_debt_files.txt, so they convert rather than needing a ceiling entry. --- changelog.d/8570-ic-miss-raw-handles.md | 6 +++ .../src/object/field_get_set/ic_miss.rs | 38 ++++++++----------- 2 files changed, 21 insertions(+), 23 deletions(-) create mode 100644 changelog.d/8570-ic-miss-raw-handles.md diff --git a/changelog.d/8570-ic-miss-raw-handles.md b/changelog.d/8570-ic-miss-raw-handles.md new file mode 100644 index 0000000000..7cd709c17a --- /dev/null +++ b/changelog.d/8570-ic-miss-raw-handles.md @@ -0,0 +1,6 @@ +### Fixed + +- Convert `ic_miss.rs`'s twelve bare raw-handle reads to `with_{mut,const}_ptr`. + #8560 added them inside `c3c_pic_tests`; they passed the ratchet at the time + because the baseline was still 974, and became a violation once #8559's regex + capture cleanup lowered it to 925. diff --git a/crates/perry-runtime/src/object/field_get_set/ic_miss.rs b/crates/perry-runtime/src/object/field_get_set/ic_miss.rs index 62430aee9d..211aad442a 100644 --- a/crates/perry-runtime/src/object/field_get_set/ic_miss.rs +++ b/crates/perry-runtime/src/object/field_get_set/ic_miss.rs @@ -1300,7 +1300,7 @@ mod c3c_pic_tests { let unrelated = crate::object::js_object_alloc(0, 1); let unrelated = scope.root_raw_mut_ptr(unrelated); crate::object::set_accessor_descriptor( - unrelated.get_raw_mut_ptr::() as usize, + unrelated.with_mut_ptr(|o: *mut crate::object::ObjectHeader| o as usize), "pic_unrelated_accessor".to_string(), crate::object::AccessorDescriptor::default(), ); @@ -1314,19 +1314,15 @@ mod c3c_pic_tests { let key_bytes = b"pic_plain_data"; let key = crate::string::js_string_from_bytes(key_bytes.as_ptr(), key_bytes.len() as u32); let key = scope.root_string_ptr(key); - crate::object::js_object_set_field_by_name( - obj.get_raw_mut_ptr(), - key.get_raw_const_ptr(), - 42.0, - ); + obj.with_mut_ptr(|o| { + key.with_const_ptr(|k| { + crate::object::js_object_set_field_by_name(o, k, 42.0) + }) + }); let mut cache = [0i64; super::PIC_CACHE_WORDS]; assert_eq!( - super::js_object_get_field_ic_miss( - obj.get_raw_mut_ptr(), - key.get_raw_const_ptr(), - &mut cache, - ), + obj.with_mut_ptr(|o| key.with_const_ptr(|k| super::js_object_get_field_ic_miss(o, k, &mut cache))), 42.0 ); assert_ne!( @@ -1348,25 +1344,21 @@ mod c3c_pic_tests { let key_bytes = b"pic_guarded_data"; let key = crate::string::js_string_from_bytes(key_bytes.as_ptr(), key_bytes.len() as u32); let key = scope.root_string_ptr(key); - crate::object::js_object_set_field_by_name( - obj.get_raw_mut_ptr(), - key.get_raw_const_ptr(), - 17.0, - ); + obj.with_mut_ptr(|o| { + key.with_const_ptr(|k| { + crate::object::js_object_set_field_by_name(o, k, 17.0) + }) + }); crate::object::set_accessor_descriptor( - obj.get_raw_mut_ptr::() as usize, + obj.with_mut_ptr(|o: *mut crate::object::ObjectHeader| o as usize), "pic_guarded_data".to_string(), crate::object::AccessorDescriptor::default(), ); let mut cache = [0i64; super::PIC_CACHE_WORDS]; - let via_pic = super::js_object_get_field_ic_miss( - obj.get_raw_mut_ptr(), - key.get_raw_const_ptr(), - &mut cache, - ); + let via_pic = obj.with_mut_ptr(|o| key.with_const_ptr(|k| super::js_object_get_field_ic_miss(o, k, &mut cache))); let via_ladder = - super::js_object_get_field_by_name_f64(obj.get_raw_mut_ptr(), key.get_raw_const_ptr()); + obj.with_mut_ptr(|o| key.with_const_ptr(|k| super::js_object_get_field_by_name_f64(o, k))); assert_eq!( via_pic.to_bits(), via_ladder.to_bits(),