-
Notifications
You must be signed in to change notification settings - Fork 252
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): Make abi generation completely deterministic in the function signature #1426
Conversation
Since the |
Converting to Draft as this is not high priority and we can come back to it once we implement the distinct keyword |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To fix this implementation you would have to do something akin to reserving witness indices for the result, and then coming back to convert the corresponding values later.
|
||
for instruction_id in entry_block.instructions() { | ||
self.convert_ssa_instruction(*instruction_id, dfg); | ||
} | ||
|
||
self.convert_ssa_return(entry_block.terminator().unwrap(), dfg); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving convert_ssa_return
to before all the instructions have been converted causes this to crash, because it will attempt to fetch instruction results before they have been defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We call convert_ssa_value
in the convert_ssa_return
so it should create the AcirVar if it does not exist. This is needed for things like when you just return a constant which would not have been defined before in the program and therefore not cached
@joss-aztec Lets come back to this once distinct is implemented |
I don't see how we can have both:
Number 2. requires knowledge of the ACIR in order to determine whether we can tell if two witnesses are equal at compile-time. Are we then throwing this away in general rather than having the |
@kevaundray are we ok to close this? |
Description
Related to #1425 -- This means that Abi generation is completely determinsitic in the function signature. Instead of the return witnesses depending on the body of main.
Problem*
Resolves
Summary*
This PR sets out to
Example
Before:
After:
Documentation
This PR requires documentation updates when merged.
Additional Context
PR Checklist*
cargo fmt
on default settings.