Skip to content

Hotfix avoid deref in refs - #654

Merged
jberthold merged 4 commits into
masterfrom
HOTFIX-avoid-deref-in-refs
Aug 18, 2025
Merged

jberthold merged 4 commits into
masterfrom
HOTFIX-avoid-deref-in-refs

Conversation

@jberthold

Copy link
Copy Markdown
Collaborator

Before creating a reference or pointer, the pointee is evaluated using #traverseProjection and then the projections are reconstructed. This shortens out all Deref projections, avoiding the problem of creating a reference with offset -1 (which can only happen when the returned value refers to another local reference or pointer and is dereferenced immediately).

@Stevengre

Copy link
Copy Markdown
Contributor

I've been thinking about whether changing from a function to a rewriting rule is really necessary. It feels like interim_simplification is maybe the more crucial part here? Naturally, if the intermediate steps can't be produced by rewriting, then interim_simplification won't be able to do anything. I'm just wondering if we need to double-check this.

@jberthold
jberthold marked this pull request as ready for review August 18, 2025 09:06
@jberthold

Copy link
Copy Markdown
Collaborator Author

I've been thinking about whether changing from a function to a rewriting rule is really necessary. It feels like interim_simplification is maybe the more crucial part here? Naturally, if the intermediate steps can't be produced by rewriting, then interim_simplification won't be able to do anything. I'm just wondering if we need to double-check this.

Re-tested it to be sure, and indeed the symbolic-args-fail test starts to become slow when mkRef and mkPtr are functions, even with --interim-simplification 50.

@Stevengre Stevengre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@jberthold
jberthold merged commit 6d853fa into master Aug 18, 2025
5 checks passed
@jberthold
jberthold deleted the HOTFIX-avoid-deref-in-refs branch August 18, 2025 23:15
jberthold added a commit that referenced this pull request Sep 5, 2025
Before creating a reference or pointer, the pointee is evaluated using
`#traverseProjection` and then the projections are reconstructed. This
shortens out all `Deref` projections, avoiding the problem of creating a
reference with offset `-1` (which can only happen when the returned
value refers to another local reference or pointer and is dereferenced
immediately).
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