Add support for global metadata#67
Conversation
|
The |
jplehr
left a comment
There was a problem hiding this comment.
I think the changes are a good direction, but I disagree that this is file format v4.
This is a breaking change.
So, I would prefer to bump the version to v5 instead. What does a versioned file format help us, if we can have two files in a particular format version that are incompatible with each other / the reader that says "I can handle this version of the file format"?
| MetadataMixin(MetadataMixin&&) noexcept = default; | ||
| MetadataMixin& operator=(MetadataMixin&&) noexcept = default; | ||
|
|
||
| ~MetadataMixin() = default; |
There was a problem hiding this comment.
I left it non-virtual on purpose, because the mixin class is not supposed to be used for dynamic polymorphism.
I.e. you would never call something like:
MetadataMixin* base = new Callgraph();
delete base;
|
It is indeed a breaking change to the file format. Still, I would be fine with just calling this v4, as v4 has not been part of a release (or even the master branch), yet. I guess it comes down to the question whether we consider a file format to be final just because it has been merged into Anyhow, I'm fine with calling it v5 if that's what we agree on. |
|
Since people are also working on If implementation burden is the problem, then we should fix that instead of having incompatible versions of the same version. |
|
I disagree with this somewhat strongly. One reason I didn't add this to the initial V4 PR is that I didn't want to put even more stuff into this one patch. |
76b4946 to
63c74c4
Compare
|
The reasoning for it being that in a perfect world, a user hands a file to the library and the library knows how to parse it. That is not the case with such changes, because now it depends on the point in time you built the library. I completely understand the question about why have a The motivation with the file format versions was initially more along the lines of something rather internal. So, we can bump the file format version as often as we want. This may / will lead to jumps in the file format version between releases, e.g., going from 3 to 6 or whatever. This is motivated with some painful experiences in "the early days" where things simply broke because of the evolving format and one could no longer reproduce / use the tools. In any case, if the motivation of the file format version being something rather internal is perceived as wrong and it should instead be something that is only meaningful in releases, then OK. I won't oppose that direction. |
|
We agreed in an offline discussion that going forward, the file format will only be considered "fix" in release versions. |
This patch adds support for attaching global metadata to a call graph.
This is metadata that doesn't belong to one specific node, but to the graph as a whole.
The implementation requires some slight changes to the v4 file format. Despite this, @pearzt and I came to the conclusion that it is preferable to not increase the format minor version, since v4 has not had an official release.
Inside the graph lib, metadata management is now implemented in a mixin class that is used by both the
CgNodeandCallgraphclasses.As an initial use case, I extended the
getMain()utility function to first query for anentryFunctionmetadata entry.If such metadata is available, the explicitly provided node is used instead of trying to find the main function by name.
This is particularly useful for Fortran, since there is no notion of a special
mainfunction.The following is an example call graph using the new
entryFunctionmetadata:Alongside the implementation, this patch includes both unit and integration tests.