[ntuple] Add alignment calculation in RClassField::Attach method - #17854
[ntuple] Add alignment calculation in RClassField::Attach method#17854Aditya-138-12 wants to merge 1 commit into
Conversation
1. Get the TypeName of the class 2. Loop over all the data members, and find maximum alignment requirement 3. Update the maximum alignment considering both the class members and child fields 4. This takes into account the transient members along with the persistent members.
hahnjo
left a comment
There was a problem hiding this comment.
Hi @Aditya-138-12, thanks for the PR! Some thoughts:
RClassField::Attachis called for every (persistent) member, which means the added code is executed multiple times. The result is probably still correct, but this can get expensive for very big classes with many members.- Using
TDataMember::GetUnitSize()returns the size of the member, not its alignment. That works ok for fundamental types, but if the member is itself an object, it will lead to severe overalignment.
I think the proper way to fix this problem is exposing alignment information from ROOT Meta. And once we have that, I think we should not try to determine the alignment ourselves but call a (to-be-implemented) TClass::GetAlignment directly.
|
Hi @hahnjo, |
In addition it might not even be possible via the
You can give it a try, just be aware that ROOT Meta and |
|
Hi @hahnjo, |
This Pull request:
Add alignment calculation in RClassField::Attach method
Changes or fixes:
Now this
Return this
value size: 12, alignment: 4Checklist:
This PR fixes #16765