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

AstGen: avoid intermediate loads during field/array access #19347

Closed
wants to merge 5 commits into from

Conversation

Vexu
Copy link
Member

@Vexu Vexu commented Mar 18, 2024

There should probably be a check that the access chain ends in a symbol since other cases could still use the _val versions?

Closes #15685
Closes #15280
Closes #12963

@mlugg
Copy link
Member

mlugg commented Mar 18, 2024

The AstGen change here causes "local variable is never mutated" errors to not be emitted when they should, because that error is based on when a local variable is never accessed with a ref result location. I'll let you decide how best to handle this - perhaps you could introduce a .pseudo_ref result location which acts like .ref but exists only as an optimization so doesn't mark a local variable as mutated.

@Vexu Vexu force-pushed the field-access branch 3 times, most recently from aa57661 to b97ae63 Compare March 19, 2024 19:00
@Rexicon226
Copy link
Contributor

b97ae63 should be documented in langref?

Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

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

This change needs to come with benchmarks, an analysis of the differences in ZIR, and an overview explanation.

@Vexu
Copy link
Member Author

Vexu commented Mar 22, 2024

b97ae63 should be documented in langref?

It should but note that it is just implementing #4765 in a slightly different situation (&array_ptr.ptr).

@Vexu
Copy link
Member Author

Vexu commented Mar 23, 2024

I can't think of a way to get this to work right now and the latent bugs its uncovering aren't making it any easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants