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

Treemorph dirty clean #593

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

lixitrixi
Copy link
Contributor

@lixitrixi lixitrixi commented Jan 17, 2025

Since we can't depend on the user-given structure to hold dirty/clean data, I use a wrapper struct Skel which holds some metadata and maps directly onto the original structure via pointers. A custom Uniplate implementation may be necessary to maintain the one-to-one mapping upon reconstruction with Uniplate contexts.

...some way of associating engine metadata with positions in the tree has to be created. This store must be updated when subtrees are inserted, and must be fully accessible during tree traversal to facilitate dirty-clean optimisation (to not needlessly traverse into clean subtrees).

The first approach explored here, using a "skeleton" tree structure which contains references to the user defined tree's nodes and shares its shape, makes reconstructing the tree difficult due to ownership rules.

The current approach is to use a zipper type similar to that released with Uniplate v0.2.0, which updates an index into a contiguous list of metadata values as it moves around the tree.

Based on #586.

the main engine has been updated to make use of Uniplate's wonderful "contexts" method to abstract over and optimise the actual tree traversal.
@lixitrixi lixitrixi self-assigned this Jan 17, 2025
@lixitrixi
Copy link
Contributor Author

lixitrixi commented Jan 28, 2025

@ozgurakgun I think I'll table this PR for now and focus on clarifying the API and docs. Definitely necessary if this will be worked on this semester!

When do you think tree-morph can move to a separate repo, if at all?

@ozgurakgun
Copy link
Contributor

documentation will help, yes please.

we can move to a separate repo, that's not a problem, but I think we should wait until we are happy with it as the default rewriter for oxide? any reason to do this quickly that I am missing?

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