-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Don't copy if should_copy
is false
#251
Conversation
Copying the nodes for the parent list is on purpose. (see #239) |
Ah sorry, should've checked the blame. |
Storing enodes outside of the egraph is problematic as enodes are canonicalized (mutated) after each rebuilding phase and equal enodes after canonicalization are deleted from the internal datastructures. Probably you can change your implementation to use semantic analysis values (for eclasses)? |
In my case that's okay since canonicalized enodes are supposed to have the same external data as well.
The reason I didn't go this route from the start is because I also have enodes that are never added to the egraph for which I also want to store this data. But on second thought, it makes more sense to use an eclass analysis and handle these external enodes separately. Thanks for the advice! I still don't really get what can go wrong with the egraph invariants when the copy is omitted, but feel free to close this pr if this is something that definitely shouldn't happen. |
In that discussion it is said that enodes in |
@jumerckx, you might be right that the copy is not necessary. Could you please check whether the unit tests pass with The code is a bit tricky because canonicalization of nodes that contained in |
The tests pass with these flags set to However, I now understand the issue, dictionary keys shouldn't get modified. So this pr would indeed introduce a bug 😅. I believe it might be possible to have a dict-like data structure specifically for vecexprs that doesn't include the eclasses in its hash and instead verifies these on lookup. Thanks a lot for the feedback, learned a lot about Metatheory's internals! |
It's a bit of a mess. I'm currently working on this again in #253 , trying to reduce the number of enode copying. |
No description provided.