-
Notifications
You must be signed in to change notification settings - Fork 160
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
Wrap MastForest in Program and Library in Arc #1465
Merged
Merged
Conversation
This file contains 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
plafer
reviewed
Aug 26, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Left a few nits
plafer
approved these changes
Aug 26, 2024
plafer
force-pushed
the
bobbin-arc-mast
branch
from
August 27, 2024 19:41
574dbcc
to
296e75e
Compare
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 wraps
MastForest
fields inProgram
andLibrary
structs inArc
. This way, cloning these objects becomes a relatively cheap operation.Additionally, this PR contains the following changes/refactorings:
Program
is registered as a root in theMastForest
. This was already happening - but now we have an explicit check for this.External
node to theMastForest
. This makesLibrary
andProgram
structs a bit more consistent and also removes a somewhat un-intuitive situations where if a library had only re-exported procedures, itsMastForest
would be completely empty. Since now there is an easy way to track re-exported procedures in theMastForest
itself, the distinction between local and re-exported procedures was removed from theLibrary
struct (but I added a method that allows checking if a given export is a re-export).MastForestBuilder
, we now insertProcedure
structs for re-exported procedures too. This allowed removingprocedure_hashes
map and unify the way we treat local and re-exported procedures.There is one thing we can improve in the future: if we re-export a procedure from the library and a procedure with the same digest is locally defined, we may end up with some unreachable nodes in the MAST forest. This is technically not a bug - but it does create bloat in the MAST forest. In general, I think if a library has a locally-defined procedure and also re-exports a procedure with the same root, the re-exported procedure should take precedence.
This PR closes #1430. As suggested by @bitwalker, I did not to add
Version
to theLibrary
. We should probably either removeVersion
entirely or move it tomiden-core
. But I left this for future PRs.