Skip to content

feat(ssa): Higher order functions in arrays #8674

Merged
jfecher merged 5 commits intomv/apply-func-dynmaic-inputfrom
mv/lambda-from-array-2
May 23, 2025
Merged

feat(ssa): Higher order functions in arrays #8674
jfecher merged 5 commits intomv/apply-func-dynmaic-inputfrom
mv/lambda-from-array-2

Conversation

@vezenovm
Copy link
Contributor

Description

Problem*

Resolves #5503

I am marking this as resolved even though this snippet will still panic:

fn main() {
    let lambdas: [fn(()) -> (); 0] = [];
    lambdas[0](());
}

However, it now has a new panic from the one in the issue, and I will push a follow-up that removes this new panic.

All the other code in the issue works as expected after this PR.

This PR builds upon #8672

Summary*

  1. We were not tracking functions stored within arrays in remove_unreachable. This had to be updated as otherwise by the time we got to defunctionalize the function being called would no longer exist.
  2. We had to find functions used as values now only in Call/Store but also MakeArray
  3. We had to replace first class functions inside of the make array instruction type and change them to fields.

Additional Context

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist*

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

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: e15bdd7 Previous: eb3eef9 Ratio
test_report_zkpassport_noir_rsa_ 3 s 2 s 1.50

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Execution Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: e15bdd7 Previous: eb3eef9 Ratio
semaphore-depth-10 0.027 s 0.02 s 1.35

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

@jfecher jfecher merged commit 8274228 into mv/apply-func-dynmaic-input May 23, 2025
114 checks passed
@jfecher jfecher deleted the mv/lambda-from-array-2 branch May 23, 2025 22:00
@Savio-Sou Savio-Sou linked an issue May 26, 2025 that may be closed by this pull request
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.

Calling lambda or function from array or slice panics

2 participants