-
Notifications
You must be signed in to change notification settings - Fork 85
Generalize Uniqueness Analysis to arbitrary semirings #3280
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
anfelor
wants to merge
35
commits into
ocaml-flambda:main
Choose a base branch
from
anfelor:overwriting-typing-refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Basic overwriting syntax * Update line numbers in expect tests after cherry-pick * Implement suggestions * Update tests * Implement suggestions * Remove nested quotes * Revert "Remove nested quotes" This reverts commit 72eaa04.
* Propagate unique_barrier through typing/ (broken commit since lambda/ untouched) * Map unique_barrier to Reads_vary * Propagate unique_barrier into matching.ml * Add pat_unique_barrier to chamelon * Add pat_unique_barrier to chamelon (2) * Fix formatting * Refactor * Use Uniqueness.lr, without a ref. * Update comment in typing/uniqueness_analysis.ml as suggested by @goldfirere Co-authored-by: Richard Eisenberg <rae@richarde.dev> * Address review comments * Enable unique barrier for exception patterns * Address comments * Implement suggestion * Add tests * Add comment to pat_unique_barrier --------- Co-authored-by: Richard Eisenberg <reisenberg@janestreet.com> Co-authored-by: Richard Eisenberg <rae@richarde.dev>
* Tests for overwriting * Remove old tests for unique overwrites and fix typos * Add overwriting tests back * Add tests for lifting out constants * Update tests * Use extension universe alpha * Test all cases for gc soundness bug * Review feedback: add more CRs and clarify overwriting_map.ml * Review feedback: Add allocation counter to rbtree * Review feedback: also test mixed blocks and unboxed float blocks in the lift constants test * Review feedback: as discussed in meeting * Review feedback
Co-authored-by: Richard Eisenberg <rae@richarde.dev>
Co-authored-by: Richard Eisenberg <rae@richarde.dev>
Co-authored-by: Richard Eisenberg <rae@richarde.dev>
Sadly this doesn't actually work in the debugger.
…ng tags (to be reverted)
…plit the usages of patterns and expressions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains a proposed refactoring of
uniqueness_analysis.ml
. I have added it at @riaqn's request so that we don't lose track of this code. Ignore most of the diff: all the relevant changes are touniqueness_analysis.ml
in commits 255f533 and 4d69a80.The refactoring reimagines the uniqueness analysis as a data flow analysis over arbitrary semirings. That makes it potentially much more useful in the future as any data that attaches to memory locations and is semiring-shaped can be collected in this analysis. Here is an overview over the changes:
Usage_tree
,Usage_forest
andPaths
. Instead, these are now generic datastructures that can hold arbitrary elements. I push them to the top of the file since the concept of "memory location mapped to data" can be understood without thinking about usages at all.access_order
to errors for better error messages, but other than that, the only change is that I makeUsage
a promotable semiring.Tag
,Learned_tags
andOverwrites
which are related to the overwriting extension and can be ignored. These are promotable semirings as well.PF.t
which is a forest semiring that contains usages and learned tags, while expressions yield aUF.t
which is a forest semiring that contains usages and overwrites.This makes it type-safe to combine learned tags with overwrites (split_pf
,learn_tags
).