-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add serialization capabilities to RequiredResources
#1893
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
danobi
force-pushed
the
serialize
branch
4 times, most recently
from
June 22, 2021 17:38
6400379
to
4da5515
Compare
fbs
reviewed
Jul 1, 2021
cereal ( https://uscilab.github.io/cereal/ ) was chosen because of its active community, battle-tested-ness, and the fact that it's packaged on every distro known to package bpftrace (I think).
cereal cannot serialize raw pointers (see https://uscilab.github.io/cereal/pointers.html). As a compromise, use an std::weak_ptr instead of a raw pointer. std::weak_ptr has similar semantics to a raw pointer.
This commit adds `RequiredResources` serialization support. In other words, we add routines to allow `RequiredResources` to be stored to disk and reloaded back into memory. This is a crucial building block for AOT support as we will need to be able to transport script metadata around. Note that the serialization changes are a bit invasive and will require constant vigilance in the event that any new fields are added. cereal's type system should be able to catch any renaming or type changes, albeit with a rather cryptic compile error.
fbs
approved these changes
Jul 9, 2021
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.
Looks good, will be interesting to see the final aot construct
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 enables
RequiredResources
to be serialized to disk andthen later deserialized back into memory.
Maintaining serialization/deserialization is a tad invasive and it will
require constant vigilance when new fields are added. Fortunately,
it's not too many types and other types of changes (renames, type
changes) should be caught by the compiler. Hopefully it's not too
much of a bother.
Note that this change also adds a new required dependency:
libcereal. Most distros have it packaged: https://pkgs.org/search/?q=cereal .
cereal was chosen over libnop b/c cereal seems more widely
used and popular and is also packaged in more distros.
Checklist
docs/reference_guide.md
CHANGELOG.md