-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix remaining issues in Brillig's copy on write arrays #3593
Conversation
Testing this on
|
Interesting, the
Edit: This was on linux. On mac it looks like it panics in both debug and release. |
30218fd
to
af6b221
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me!
* Add element type to Type::Reference * Add inc_rc instruction * Add inc_rc instructions to ssa programs * Implement inc_rc in brillig * Implement copy on write optimization in brillig * Refactor sections * Fix initial reference count * Add reference count to extract_registers * Remove dbg panic * Cleanup branch_instruction * Start refactor to store rc in the first element of the array * Add reference type to tests * revert: set brillig gen to master * wip: refactor brillig variable vs registerormemory * feat: cow optimization * test: restore slice tests * refactor: typed references * test: working on fixing entry point tests * test: fix entry point tests * test: fix dfg test * fix: remove safety check and address todos * docs: variable naming and comments * chore: formatting * revert: cargo lock * fix: Fix remaining issues in Brillig's copy on write arrays (#3593) * Remove todo by going with new approach to Rc * Very important commit: fix typo * fix: make toBits accept arrays and add test * fix: always codegen inc_rc * IncrementRC has no side effects? * Special case inc_rc instead * IncRc is actually an even more special case of DIE. Also mark Value::Params as used * Remove abbreviation --------- Co-authored-by: sirasistant <sirasistant@gmail.com> --------- Co-authored-by: Jake Fecher <jfecher11@gmail.com> Co-authored-by: Jake Fecher <jake@aztecprotocol.com>
Description
Problem*
Fixes remaining
todo
and some panics in #3522Summary*
I'm not sure if unpacking the entire slice recursively to complete the
todo!()
is even possible so I tried a different (hopefully sound) approach of incrementing the Rc for sub-arrays on eachArrayGet
and when constructing the array. I've also disabled theIncrementRc
instruction when not in Brillig code since it is unneeded.Additional Context
I'm targetting @sirasistant's PR so that it is easier to see the changes I made to it. If all is well, we can merge this PR and then his afterward to get the feature in.
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.