Previously, the traversal stack held (node, children queued) pairs.
When visiting a node without it's children queued, we would queue them
all. They take a lot of memory!
Now, the stack holds children iterators.
Also: this patch fixes many bugs introduced by the prior one.
A basic implementation of committed witnesses & volatile RAM extraction in the Z# front-end.
The passes in question are still a bit brittle, so I left them behind a flag.
* Configuration system. Kill DFL_T
* add circ::cfg::CircCfg that holds cfg info
* it's constructible from circ_opt::CircOpt
* implements clap::Args, so you can set it from your compiler's
CLI/envvars
* defined in external crate to keep clap out of our main build
* organized by circ module, but not feature gated
* no point: the build wouldn't meaningfully change
* includes a way to set the default field
* added circ::cfg::set and circ::cfg::cfg
* also circ::cfg::set_default and circ::cfg::set_cfg
* access a sync::once_cell, static configuration
* killed DFL_T
* workflows
* unit-tested component probably need to not read circ::cfg::cfg.
* compilers need to call circ::cfg::set or circ::cfg::set_default.
* rm dead features
The ZoKrates front-end now represents ZoK arrays as IR arrays, and ZoK structures as (type-tagged) IR tuples.
During this change, I discovered that IR support for eliminating tuples and arrays was not complete.
Thus the change list is:
The ZoK front-end uses IR arrays and tuples
Improve IR passes for array and tuple elimination
Enforce cargo fmt in CI
Bugfix: handle ZoK accessors in L-values in the correct order
Bugfix: add array evaluation to the IR
This PR does not:
implement an array flattening pass
implement permutation-based memory-checking
Benefits:
The ZoK->R1CS compiler is now ~5.88x faster (as defined by the time it takes to run the tests in master's scripts/zokrates_test.zsh script: this goes from 8.59s to 1.46s)
For benchmarks with multi-dimensional arrays, the ZoK->R1CS compiler can now compile them with reasonable speed. Before it it would time out on even tiny examples.
The ZoK->R1CS compiler will be able to benefit from future memory-checking improvements
IR support for arrays and tuples is complete now, making those parts of the IR more accessible to future front-ends.
alex-ozdemir added 21 commits 11 days ago