Skip to content

chore(ssa refactor): Implement first-class functions#1238

Merged
jfecher merged 4 commits intomasterfrom
jf/ssa-first-class-functions
Apr 27, 2023
Merged

chore(ssa refactor): Implement first-class functions#1238
jfecher merged 4 commits intomasterfrom
jf/ssa-first-class-functions

Conversation

@jfecher
Copy link
Copy Markdown
Contributor

@jfecher jfecher commented Apr 27, 2023

Related issue(s)

Resolves #

Description

Summary of changes

The IR previously required Instruction::Call { function: FunctionId, ... } which was incompatible with first-class functions, so I've updated it to take a ValueId instead. There is a new Value::Function variant now to store functions, and the DFG will ensure there is always only 1 ValueId for a given FunctionId (within the current function at least).

Also in this PR: SecondaryMap was removed. I found I kept getting stumbled trying to write SecondaryMap<FunctionId, ValueId> instead of SecondaryMap<Function, ValueId>. Since FunctionMap<K, V> is just an alias for FunctionMap<Id<K>, V> I've just removed it in favor of HashMap which means there are fewer concepts to learn.

Dependency additions / changes

Test additions / changes

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

@jfecher jfecher requested a review from kevaundray April 27, 2023 14:51
Comment thread crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs Outdated
@jfecher jfecher enabled auto-merge April 27, 2023 18:20
@jfecher jfecher added this pull request to the merge queue Apr 27, 2023
Merged via the queue into master with commit 606b7d0 Apr 27, 2023
@jfecher jfecher deleted the jf/ssa-first-class-functions branch April 27, 2023 19:11
TomAFrench added a commit that referenced this pull request Apr 29, 2023
* master: (223 commits)
  chore(noir): Release 0.5.0 (#1202)
  chore(ci): Utilize new workflow to build binaries (#1250)
  chore(ssa refactor): Fix loading from mutable parameters (#1248)
  fix(wasm): add std after dependencies (#1245)
  chore(ssa refactor): Fix no returns & duplicate main (#1243)
  chore(ssa refactor): Implement intrinsics (#1241)
  chore(ssa refactor): Implement first-class functions (#1238)
  chore: address clippy warnings (#1239)
  chore(ssa refactor): Implement function calls (#1235)
  chore(ssa refactor): Implement mutable and immutable variables (#1234)
  chore(ssa refactor): Fix recursive printing of blocks (#1230)
  feat(noir): added assert keyword (#1227)
  chore(ssa refactor): Implement ssa-gen for indexing, cast, constrain, if, unary (#1225)
  feat(noir): added `distinct` keyword (#1219)
  chore(nargo): update panic message to suggest searching for similar issues (#1224)
  chore(ssa refactor): Update how instruction result types are retrieved (#1222)
  chore(ssa refactor): Implement ssa-gen for binary, block, tuple, extract-tuple-field, and semi expressions (#1217)
  chore: add RUST_BACKTRACE environment variable to nix config (#1216)
  chore(ssa): Add intial control flow graph  (#1200)
  chore(ssa refactor): Handle codegen for literals (#1209)
  ...
TomAFrench added a commit that referenced this pull request May 2, 2023
* master: (63 commits)
  feat(nargo): Remove usage of `CompiledProgram` in CLI code and use separate ABI/bytecode (#1269)
  feat: add integration tests for bitshift operators (#1272)
  chore: Replace explicit if-elses with `FieldElement::from<bool>()` for boolean fields (#1266)
  chore(noir): constrain expr; -> assert(expr); (#1276)
  chore: fix clippy warning (#1270)
  chore(ssa refactor): Add all remaining doc comments to ssa generation pass (#1256)
  chore(noir): Release 0.5.1 (#1264)
  fix: Add Poseidon examples into integration tests (#1257)
  chore(nargo): replace `aztec_backend` with `acvm-backend-barretenberg` (#1226)
  chore(noir): Release 0.5.0 (#1202)
  chore(ci): Utilize new workflow to build binaries (#1250)
  chore(ssa refactor): Fix loading from mutable parameters (#1248)
  fix(wasm): add std after dependencies (#1245)
  chore(ssa refactor): Fix no returns & duplicate main (#1243)
  chore(ssa refactor): Implement intrinsics (#1241)
  chore(ssa refactor): Implement first-class functions (#1238)
  chore: address clippy warnings (#1239)
  chore(ssa refactor): Implement function calls (#1235)
  chore(ssa refactor): Implement mutable and immutable variables (#1234)
  chore(ssa refactor): Fix recursive printing of blocks (#1230)
  ...
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