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
I'm trying to use libclang to auto-generate struct layouts for use with coffi. As a sanity check, I wanted to make sure that the size of a struct reported by clang matched mem/size-of. It generally does, but I noticed there's a size difference when a struct includes pointers.
It doesn't seem like there's anything wrong with the implementation. The byteAlignment of ValueLayout/ADDRESS is 1. I'm not really sure whether I'm using clang wrong or if there's something else going on. Either way, I thought I'd report it in case there is some improvement to be made.
The text was updated successfully, but these errors were encountered:
Ah, yeah, this was an issue I observed before that I've determined a fix for but it appears I applied it inconsistently. All the value layouts in the JVM-side default to an alignment of 1, which is incorrect, and I corrected this for primitive numbers, but it appears I forgot to do the same for pointers. I believe that the array in your second example should be fixed if I fix the alignment of pointers, but I'll check up on that as well.
I'm trying to use libclang to auto-generate struct layouts for use with coffi. As a sanity check, I wanted to make sure that the size of a struct reported by clang matched
mem/size-of
. It generally does, but I noticed there's a size difference when a struct includes pointers.For example:
The above gives a size of 16, but the same struct definition in coffi gives 9:
It doesn't seem like there's anything wrong with the implementation. The byteAlignment of
ValueLayout/ADDRESS
is 1. I'm not really sure whether I'm using clang wrong or if there's something else going on. Either way, I thought I'd report it in case there is some improvement to be made.The text was updated successfully, but these errors were encountered: