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
6 changes: 6 additions & 0 deletions changelog.d/6839-native-proof-uint8array-symbol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Tests

- Strengthened native `Uint8Array` codegen coverage so a proven inline byte
read must not call either the legacy byte helper or the JS-value fallback
helper. The disposed-view expectation already present on `main` remains
covered separately.
4 changes: 1 addition & 3 deletions crates/perry-codegen/src/loop_purity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ fn expr_alloc_free(e: &Expr) -> bool {
// Element READS never allocate — they return an existing element / a
// number. Recurse so the object and index are themselves alloc-free.
Expr::IndexGet { object, index } => expr_alloc_free(object) && expr_alloc_free(index),
Expr::BufferIndexGet { buffer, index } => {
expr_alloc_free(buffer) && expr_alloc_free(index)
}
Expr::BufferIndexGet { buffer, index } => expr_alloc_free(buffer) && expr_alloc_free(index),
Expr::Uint8ArrayGet { array, index } => expr_alloc_free(array) && expr_alloc_free(index),
// `arr[i]++` / `--`: read-modify-write of an existing numeric slot, no
// growth, no allocation.
Expand Down
7 changes: 7 additions & 0 deletions crates/perry-codegen/tests/native_proof_buffer_views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,13 @@ fn uint8array_const_local_length_uses_inline_byte_get_set() {
!ir.contains("call i32 @js_uint8array_get"),
"inline Uint8Array get should not call the runtime helper:\n{ir}"
);
// The JS-value getter is the other way this could fall back after
// #6088/#6092; without naming it here the negative assertion above would
// miss a regression that took the slow path.
assert!(
!ir.contains("call double @js_uint8array_index_get_value"),
"inline Uint8Array get should not call the JS-value runtime helper:\n{ir}"
);
}

#[test]
Expand Down
Loading