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

feat(ssa_refactor)!: Add Slices #1728

Merged
merged 60 commits into from
Jul 7, 2023
Merged

feat(ssa_refactor)!: Add Slices #1728

merged 60 commits into from
Jul 7, 2023

Conversation

vezenovm
Copy link
Contributor

@vezenovm vezenovm commented Jun 16, 2023

Description

Problem*

Resolves #582 and #1736

Works towards resolving issue #1556. This comment has more information on how we will add slices and Vectors into Noir: #1556 (comment).

Summary*

This PR adds syntax to enable slices (arrays without a known size during compilation). A slice's size is implicitly tracked during SSA and is represented as an array under the hood. Array syntax will remain the same but any types such as [Field] will be replaced by the new slices. Support is only included in the new SSA pass, thus some tech debt was included to conditionally handle slice vs. array compilation in the frontend.

Documentation

  • This PR requires documentation updates when merged.

    • I will submit a noir-lang/docs PR.
    • I will request for and support Dev Rel's help in documenting this PR.

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@vezenovm vezenovm changed the title feat: Add Slices to frontend feat(ssa_refactor): Add Slices to frontend Jun 16, 2023
@vezenovm vezenovm changed the title feat(ssa_refactor): Add Slices to frontend feat(ssa_refactor): Add Slices Jun 16, 2023
@vezenovm vezenovm marked this pull request as ready for review June 16, 2023 12:58
@vezenovm vezenovm requested review from jfecher and kevaundray June 16, 2023 13:03
@vezenovm vezenovm changed the title feat(ssa_refactor): Add Slices feat(ssa_refactor)!: Add Slices Jun 16, 2023
Copy link
Contributor

@jfecher jfecher left a comment

Choose a reason for hiding this comment

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

Generally this looks very good. I do have some mostly frontend-related suggestions.

  1. I see why we need this enable_slices flag. I was contemplating asking for a different syntax for slices until the new ssa becomes the default so that they can be separated from the previous deprecated slice syntax. I think now though we should just make an issue for removing enable_slices (or one for removing the old ssa ir and mention to remove enable_slices as well) and call it a day.
  2. Can we remove Type::Vec as well? It is unused and we have different plans for implementing Vecs now so they won't need to be a primitive type anymore.

crates/nargo_cli/src/cli/check_cmd.rs Outdated Show resolved Hide resolved
crates/noirc_driver/src/lib.rs Outdated Show resolved Hide resolved
crates/noirc_evaluator/src/ssa_refactor/acir_gen/mod.rs Outdated Show resolved Hide resolved
crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs Outdated Show resolved Hide resolved
crates/noirc_frontend/src/hir_def/types.rs Outdated Show resolved Hide resolved
crates/noirc_frontend/src/monomorphization/mod.rs Outdated Show resolved Hide resolved
crates/noirc_frontend/src/monomorphization/mod.rs Outdated Show resolved Hide resolved
Co-authored-by: jfecher <jake@aztecprotocol.com>
@vezenovm vezenovm requested a review from jfecher July 6, 2023 12:29
jfecher
jfecher previously approved these changes Jul 6, 2023
Copy link
Contributor

@jfecher jfecher left a comment

Choose a reason for hiding this comment

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

👍

@vezenovm vezenovm mentioned this pull request Jul 7, 2023
5 tasks
Copy link
Contributor

@jfecher jfecher left a comment

Choose a reason for hiding this comment

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

👍

@jfecher jfecher enabled auto-merge July 7, 2023 12:21
@jfecher jfecher added this pull request to the merge queue Jul 7, 2023
Merged via the queue into master with commit 4bee979 Jul 7, 2023
@jfecher jfecher deleted the mv/slices-2 branch July 7, 2023 12:45
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.

Tracking Issue : Rework the way arrays are done in SSA
7 participants