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

Add serialization capabilities to RequiredResources #1893

merged 7 commits into from Jul 9, 2021


Copy link

@danobi danobi commented Jun 22, 2021

This PR enables RequiredResources to be serialized to disk and
then 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: .

cereal was chosen over libnop b/c cereal seems more widely
used and popular and is also packaged in more distros.

  • Language changes are updated in docs/
  • User-visible and non-trivial changes updated in
  • The new behaviour is covered by tests

@danobi danobi force-pushed the serialize branch 4 times, most recently from 6400379 to 4da5515 Compare June 22, 2021 17:38
@fbs fbs added the version-freeze This PR should not be merged as it shouldn't be included in the upcoming release. label Jun 22, 2021
@danobi danobi marked this pull request as ready for review June 22, 2021 18:31 Outdated Show resolved Hide resolved
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).
@danobi danobi removed the version-freeze This PR should not be merged as it shouldn't be included in the upcoming release. label Jul 8, 2021
cereal cannot serialize raw pointers (see 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.
Copy link

@fbs fbs left a 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

@danobi danobi merged commit 15e5a05 into iovisor:master Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants