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
Arrays in noir have value semantics. When passed to a function, they should have no observable change after the function call, even if the function being called internally mutates the array that it was passed as a parameter. Currently however, arrays are essentially passed as reference in the SSA IR and any mutations would be observable.
Happy Case
We should copy each array before passing them to any function call.
This could create many excess instructions even if a function only needs to mutate a single element of the array. If these cannot be avoided, we should create an issue to optimize this in the future to avoid these unnecessary instructions by e.g. analyzing which indices are mutated by the called function before copying the array. This would let us copy only the necessary indices.
Alternatives Considered
No response
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
Arrays in noir have value semantics. When passed to a function, they should have no observable change after the function call, even if the function being called internally mutates the array that it was passed as a parameter. Currently however, arrays are essentially passed as reference in the SSA IR and any mutations would be observable.
Happy Case
We should copy each array before passing them to any function call.
This could create many excess instructions even if a function only needs to mutate a single element of the array. If these cannot be avoided, we should create an issue to optimize this in the future to avoid these unnecessary instructions by e.g. analyzing which indices are mutated by the called function before copying the array. This would let us copy only the necessary indices.
Alternatives Considered
No response
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: