RFR: 8306901: Macro offset_of confuses Eclipse CDT

Thomas Stuefe stuefe at openjdk.org
Thu Apr 27 08:01:02 UTC 2023


On Thu, 27 Apr 2023 07:42:02 GMT, Richard Reingruber <rrich at openjdk.org> wrote:

> Hi Thomas,
> 
> > Looks good. Thanks for fixing this, I had noticed this in CDT myself.
> 
> thanks for the review!
> 
> > I never looked closely at this macro though. I wish we could just use offsetof.
> 
> Indeed.
> 
> > Also I wonder whether the ATTRIBUTE_ALIGNED(16) would be more correctly `alignas(klass)` but that is pre-existing.
> 
> Probably :) At least it would be cleaner in my eyes than the hard coded 16. With this pr I'd like to address just the CDT issue though.
> 

I believe the trick may not work if the type were artificially aligned to something larger than16, e.g. struct XX alignas(64). I guess that depends on what the compiler does when casting a pointer with a smaller alignment to something with a larger alignemnt.

> Thanks, Richard.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/13668#issuecomment-1525024724


More information about the hotspot-dev mailing list