Skip to content

Refactor projection calculations #570

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

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Refactor projection calculations #570

wants to merge 7 commits into from

Conversation

ehildenb
Copy link
Member

@ehildenb ehildenb commented May 7, 2025

This PR attempts to make projection calculations a bit simpler to follow by factoring them out into a helper function. A very systematic approach is taken, and may be easier to review commit-by-commit:

  • First, the logic that was in K rules is turned into functions, by threading through the <stack> and <locals> contents as explicit arguments for a new function makeProjectedUpdates.
  • Next, uneeded state is removed from this function, including the new value to write (which is held in the outer KItem constructor).
  • Finally, we make calculating projections actually not check mutabilitiy at all. We still retain the mutability check when writing to the actual slot, but for calculating the projection/context I figure we don't need to write to any of the slots, so mutability doesn't matter. If we can come up with a test that would fail because of this, then we can revisit this change. But as far as I can tell, #buildUpdate checks the mutability of the locations we're writing to anyway.

@ehildenb ehildenb self-assigned this May 7, 2025
@ehildenb ehildenb force-pushed the projected-update branch from 0b8aa08 to b7fe669 Compare May 10, 2025 14:46
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