You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We added support for merging slices in this PR (#2347). Since the original work there has been a few follow-up PRs as slices have shown to require more compiler logic than originally anticipated (#2599).
Merging of slice values during flattening needs to be updated once more to support nested slices. The current implementation fetches the length of a slice using a method in the value merger called get_slice_length. This method currently bases the array length off the entire length of the Value::Array in SSA. This is not indicative of the user facing length as nested arrays/slices are flattening in SSA and the length should be array.len() / element_size rather than simply array.len().
This has been fine for the time being as we only supported dynamically indexing slices with internal types whose size is known at compile time (such as numbers and arrays). As we move to being able to dynamically index nested slices flattening needs to be updated.
Happy Case
Flattening nested slices should maintain the internal structure of a nested slice similar to how it is done in this PR (#3187).
The ArrayGet instruction needs to be appropriately handled which means we need to be able to determine the internal nested slice size of the array a given slice is being fetched from.
Alternatives Considered
We could possibly handle this entirely in ACIR gen, but this would add more opcodes and reduce the ability to handle constant indices which will be generated during flattening. It would be best to match up the flattening structure of slices with that of the type structure that arrays follow.
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered:
Problem
We added support for merging slices in this PR (#2347). Since the original work there has been a few follow-up PRs as slices have shown to require more compiler logic than originally anticipated (#2599).
Merging of slice values during flattening needs to be updated once more to support nested slices. The current implementation fetches the length of a slice using a method in the value merger called
get_slice_length
. This method currently bases the array length off the entire length of the Value::Array in SSA. This is not indicative of the user facing length as nested arrays/slices are flattening in SSA and the length should bearray.len() / element_size
rather than simplyarray.len()
.This has been fine for the time being as we only supported dynamically indexing slices with internal types whose size is known at compile time (such as numbers and arrays). As we move to being able to dynamically index nested slices flattening needs to be updated.
Happy Case
Flattening nested slices should maintain the internal structure of a nested slice similar to how it is done in this PR (#3187).
The ArrayGet instruction needs to be appropriately handled which means we need to be able to determine the internal nested slice size of the array a given slice is being fetched from.
Alternatives Considered
We could possibly handle this entirely in ACIR gen, but this would add more opcodes and reduce the ability to handle constant indices which will be generated during flattening. It would be best to match up the flattening structure of slices with that of the type structure that arrays follow.
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: