Idea from [~kbarrett]:
JDK-8357579 added static asserts for trailing paddings for ResolvedFieldEntry and ResolvedMethodEntry.
A non-standard method for detecting both kinds of padding is to ask the compiler to tell us about it, by enabling certain warnings around the class definition.
Visual Studio: C4820
gcc/clang: -Wpadded
So something like this:
PRAGMA_DIAG_PUSH
#if defined(TARGET_COMPILER_visCPP)
_Pragma("warning(enable : 4820)")
#elif defined(TARGET_COMPILER_gcc)
_Pragma("GCC diagnostic warning -Wpadded")
#endif
... class definition ...
PRAGMA_DIAG_POP
Maybe add PRAGMA_ENABLE_MSVC_WARNING and PRAGMA_ENABLE_GCC_WARNING to make this code a bit cleaner.
A non-standard method for detecting both kinds of padding is to ask the compiler to tell us about it, by enabling certain warnings around the class definition.
Visual Studio: C4820
gcc/clang: -Wpadded
So something like this:
PRAGMA_DIAG_PUSH
#if defined(TARGET_COMPILER_visCPP)
_Pragma("warning(enable : 4820)")
#elif defined(TARGET_COMPILER_gcc)
_Pragma("GCC diagnostic warning -Wpadded")
#endif
... class definition ...
PRAGMA_DIAG_POP
Maybe add PRAGMA_ENABLE_MSVC_WARNING and PRAGMA_ENABLE_GCC_WARNING to make this code a bit cleaner.