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

IR generation for storage accesses #959

Merged
merged 3 commits into from
Mar 18, 2022

Conversation

mohammadfawaz
Copy link
Contributor

@mohammadfawaz mohammadfawaz commented Mar 17, 2022

Part 2 of the storage change.

This PR does two things;

  • Creates the necessary data structures for accessing or reassigning a storage field. For now, this only covers storage fields that are of primitive types or some nested struct type.
  • Uses the data structures above to emit IR.
  • I don't have tests here but I spot tested this. Sway -> IR tests will be added once the full changes are in.

Credit to @sezna for starting this work in #646. Many pieces of this code were borrowed from that PR.

@mohammadfawaz mohammadfawaz self-assigned this Mar 17, 2022
@mohammadfawaz mohammadfawaz added enhancement New feature or request compiler General compiler. Should eventually become more specific as the issue is triaged labels Mar 17, 2022
Copy link
Contributor

@otrho otrho left a comment

Choose a reason for hiding this comment

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

Do you have any unit tests, especially .sw -> .ir?

*ptr.get_type(context),
&ast_reassignment.lhs[1..]
.iter()
.map(|x| x.name.clone())
Copy link
Contributor

Choose a reason for hiding this comment

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

Man, I have refactored all the struct stuff in my current working branch... some of this is going to be a pain to merge. 😬

generational-arena = "0.2"
bigint = "4.3.3"
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you deliberately add these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oups - I needed that for something else and I don't anymore. I'll take it out.

sway-core/Cargo.toml Outdated Show resolved Hide resolved
@mohammadfawaz mohammadfawaz force-pushed the mohammadfawaz/generate_ir_for_storage branch from e806310 to 4a16e0e Compare March 18, 2022 00:21
@mohammadfawaz mohammadfawaz merged commit d58e591 into master Mar 18, 2022
@mohammadfawaz mohammadfawaz deleted the mohammadfawaz/generate_ir_for_storage branch March 18, 2022 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler General compiler. Should eventually become more specific as the issue is triaged enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants