Skip to content
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

chore(ssa refactor): Add DenseMap and SparseMap types #1184

Merged
merged 7 commits into from
Apr 20, 2023

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Apr 19, 2023

Description

Refactors a common pattern of having:

  • HashMap<MyStructId, MyStruct> into a SparseMap<MyStruct>
  • Vec<MyStruct> which also returns and is acccessed by unique Ids into a DenseMap<MyStruct>.
  • Instead of having a different type for each Id type, there is now a single Id<T>. So for example a ValueId is now a Id<Value> or a "Id that can be used to retrieve a Value." Type aliases are provided to keep the familiar ValueId name though.

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Documentation needs

  • This PR requires documentation updates when merged.

Additional context

This is a PR for the SSA Refactoring only, it shouldn't cause any observable changes and only touches the ssa-refactor folder.

@jfecher jfecher requested a review from kevaundray April 19, 2023 21:03
@jfecher
Copy link
Contributor Author

jfecher commented Apr 19, 2023

I figure I'll break the SSA changes into small PRs like this one when possible since the inevitable ssa-gen pass will be a larger PR.

Copy link
Contributor

@kevaundray kevaundray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments -- removing the cast instruction seems unrelated to this PR though

@kevaundray
Copy link
Contributor

Related to #1118

kevaundray
kevaundray previously approved these changes Apr 20, 2023
@kevaundray kevaundray added this pull request to the merge queue Apr 20, 2023
Merged via the queue into master with commit e1ba4f8 Apr 20, 2023
@kevaundray kevaundray deleted the jf/ssa-refactor branch April 20, 2023 14:41
TomAFrench added a commit that referenced this pull request Apr 24, 2023
* master:
  chore: update flake version to match current release (#1204)
  feat!: Switch to aztec_backend that uses upstream BB & UltraPlonk (#1114)
  chore(ssa refactor): Add Context structs and start ssa gen pass (#1196)
  chore(ssa): Replace JmpIf with BrIf (#1193)
  chore(noir): Release 0.4.1 (#1164)
  chore(ssa refactor): Add DenseMap and SparseMap types (#1184)
  feat: bump noir-source-resolver version (#1182)
  chore(deps): bump h2 from 0.3.16 to 0.3.18 (#1186)
  fix(nargo): restore `nargo codegen-verifier` functionality (#1185)
  chore: simplify setup code in `noir_integration` test (#1180)
  feat: Add Poseidon-BN254 hash functions (#1176)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants