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
1 change: 1 addition & 0 deletions changelog.d/8493-raw-handle-iter-methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix(lint): `array/iter_methods.rs` is back within its raw-handle ceiling (#8493). #8482 added four `get_raw_const_ptr` reads for the join helpers' post-collection receiver reload, taking the module to 6 bare reads against a ceiling of 2 and the workspace to 982 against a baseline of 978 — which turned `lint` red on `main` and, because `lint` is part of `pr-gate`, blocked every open PR. `normalize_array_receiver` only does tag-stripping and a header probe, so the scoped `with_const_ptr` form the ratchet recommends applies directly and preserves the rooting the fix added.
17 changes: 4 additions & 13 deletions crates/perry-runtime/src/array/iter_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1086,15 +1086,12 @@ fn join_exotic_element(arr: *const ArrayHeader, index: u32) -> (Option<u64>, *co
let arr_handle = scope.root_raw_const_ptr(arr);
let present = arr_handle.with_const_ptr(|arr| crate::array::array_spec_has_index(arr, index));
if !present {
return (
None,
normalize_array_receiver(arr_handle.get_raw_const_ptr::<ArrayHeader>()),
);
return (None, arr_handle.with_const_ptr(normalize_array_receiver));
}
let value = arr_handle.with_const_ptr(|arr| crate::array::array_spec_get(arr, index));
(
Some(value.to_bits()),
normalize_array_receiver(arr_handle.get_raw_const_ptr::<ArrayHeader>()),
arr_handle.with_const_ptr(normalize_array_receiver),
)
}

Expand All @@ -1110,10 +1107,7 @@ fn join_element_to_string(
let arr_handle = scope.root_raw_const_ptr(arr);
let element_handle = scope.root_nanbox_u64(element_bits);
let string = crate::value::js_jsvalue_to_string(element_handle.get_nanbox_f64());
(
string,
normalize_array_receiver(arr_handle.get_raw_const_ptr::<ArrayHeader>()),
)
(string, arr_handle.with_const_ptr(normalize_array_receiver))
}

#[cold]
Expand All @@ -1127,10 +1121,7 @@ fn join_bigint_to_string(
let element_handle = scope.root_nanbox_u64(element_bits);
let value = crate::value::JSValue::from_bits(element_handle.get_nanbox_u64());
let string = crate::bigint::js_bigint_to_string(value.as_bigint_ptr());
(
string,
normalize_array_receiver(arr_handle.get_raw_const_ptr::<ArrayHeader>()),
)
(string, arr_handle.with_const_ptr(normalize_array_receiver))
}

/// join - Join array elements into a string with a separator
Expand Down
Loading