8000 Flambda2: Store kind on variables by lthls · Pull Request #4243 · oxcaml/oxcaml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Flambda2: Store kind on variables #4243

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

lthls
Copy link
Contributor
@lthls lthls commented Jun 30, 2025

This PR updates the data associated to each Flambda2 variable to also include the kind (but not the subkind).
The rationale for this PR is that several parts of Flambda2 need to know the kinds of the variables (or simples), and tracking this independently requires some work (typically, the typing env stores the kind for every variable).
This is particularly problematic in the case where a cmx might be missing: currently we can load a cmx containing occurrences of a variable coming from another compilation unit, whose cmx is now unavailable, and in this case we cannot know the kind of the variable (at least not directly). This happens in practice with the new n-way join, and #4212 is a workaround for this issue.
With this PR, the variable would have its kind stored in all cmx files where it occurs, so even with a missing cmx we would be able to access the kind.
Currently the PR doesn't change the existing code to make use of the stored kinds, but a follow-up PR could clean the typing environment to avoid storing kinds completely.

@lthls lthls added the flambda2 Prerequisite for, or part of, flambda2 label Jun 30, 2025
@lthls lthls force-pushed the kinds-on-vars branch 2 times, most recently from 12c32a5 to 9fd472e Compare July 1, 2025 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flambda2 Prerequisite for, or part of, flambda2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0