You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a GC-allocated or GC-friendly class has alignment greater than 8, the gc_descriptor rule that says that every word must be mentioned in the descriptor() function causes problems, because there may be words before fields and at the end of the record that aren't namable.
Currently, the workaround is to add extra explicit padding fields, as in
structalignas(16) big {
size_t low = 0;
size_t high = 0;
};
structalsoBig : gc_allocated {
size_t _pad;
big _big;
bool _b = false;
size_t _pad2;
};
Ideally, we could come up with a way to have the checking logic pay attention to the alignment of the field types and figure out when there is necessarily padding. As a short-term solution, we could add a couple more macros to allow the descriptor to be specified as something like
staticconstauto &descriptor() {
using this_type = alsoBig;
static gc_descriptor d =
GC_DESC(this_type)
.pad(1)
.templateWITH_FIELD(&this_type::_big)
.templateWITH_FIELD(&this_type::_b)
.pad(1)
;
return d;
}
with the notion being that n words of padding are marked before the next mentioned field or, if there is no following field, at the end of the object.
The text was updated successfully, but these errors were encountered:
[imported from HPE issue 322]
When a GC-allocated or GC-friendly class has alignment greater than 8, the
gc_descriptor
rule that says that every word must be mentioned in thedescriptor()
function causes problems, because there may be words before fields and at the end of the record that aren't namable.Currently, the workaround is to add extra explicit padding fields, as in
Ideally, we could come up with a way to have the checking logic pay attention to the alignment of the field types and figure out when there is necessarily padding. As a short-term solution, we could add a couple more macros to allow the descriptor to be specified as something like
with the notion being that
n
words of padding are marked before the next mentioned field or, if there is no following field, at the end of the object.The text was updated successfully, but these errors were encountered: