-
Notifications
You must be signed in to change notification settings - Fork 720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable -Winvalid-offsetof in J9Options, kca_offsets_generator, J9ValueProfiler #18313
Conversation
Julian @zl-wang, may I ask you to review this change? |
it sounds strange to me that you are using GCC on AIX as the build compiler (?). or, you actually meant ppc64le? |
That does sound strange now that I think of it, but this is indeed AIX, and I tried both Either way, I see now how it would be important to include both of those directives like in omr #6077. I never actually tried running a build with both (because it seemed like we only need to disable the warning on AIX), so I'll give that a try and see what happens. |
ccaa82b
to
00ce5ab
Compare
After running a build I can confirm that guarding the uses of #if defined(LINUX)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#elif defined(OSX)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#elif defined(AIXPPC) || defined(J9ZOS390)
#pragma report(disable, "CCN6281")
#endif
fprintf( file, "#define BODYINFO_HOTNESS (%" OMR_PRIuSIZE ")\n", offsetof(TR_PersistentJittedBodyInfo,_hotness) );
fprintf( file, "#define PERSISTENTINFO_CHTABLE (%" OMR_PRIuSIZE ")\n", offsetof(TR::PersistentInfo,_persistentCHTable) );
fprintf( file, "#define PERSISTENTCLASS_VISITED (%" OMR_PRIuSIZE ")\n", offsetof(TR_PersistentClassInfo,_visitedStatus) );
#if defined(LINUX)
#pragma GCC diagnostic pop
#elif defined(OSX)
#pragma clang diagnostic pop
#elif defined(AIXPPC) || defined(J9ZOS390)
#pragma report(enable, "CCN6281")
#endif does not stop the warnings from appearing (see this internal build, all 11 instances of I'm assuming there's an issue with the
while the warning messages I've been getting cite the updated definition involving non-standard-layout classes:
Is it possible that this new warning needs to be referenced or disabled differently? |
it might be too optimistic to assume same CCN# across p and z. i will try to get the xlC/AIX message file ... that allows you to search for CCN# by a particular message. I assumed you are using xlC16 on AIX. |
cppckern.txt |
Thanks! Interestingly, there were two matches with slightly different verbiage, and like you assumed, neither have the same CCN# as the message in the z/OS documentation.
I'll try disabling these CCN#s instead and see if that works. |
you can certainly find out which CCN# to apply by looking at the generated warning message |
b2c3ff2
to
6070e12
Compare
It seems like neither CCN287 nor CCN1281 worked, as another internal build still has the warnings present despite these new guards: #if defined(LINUX)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#elif defined(OSX)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#elif defined(J9ZOS390)
#pragma report(disable, "CCN6281")
#elif defined(AIXPPC)
#pragma report(disable, "CCN1281")
#pragma report(disable, "CCN287")
#endif
fprintf( file, "#define BODYINFO_HOTNESS (%" OMR_PRIuSIZE ")\n", offsetof(TR_PersistentJittedBodyInfo,_hotness) );
fprintf( file, "#define PERSISTENTINFO_CHTABLE (%" OMR_PRIuSIZE ")\n", offsetof(TR::PersistentInfo,_persistentCHTable) );
fprintf( file, "#define PERSISTENTCLASS_VISITED (%" OMR_PRIuSIZE ")\n", offsetof(TR_PersistentClassInfo,_visitedStatus) );
#if defined(LINUX)
#pragma GCC diagnostic pop
#elif defined(OSX)
#pragma clang diagnostic pop
#elif defined(J9ZOS390)
#pragma report(enable, "CCN6281")
#elif defined(AIXPPC)
#pragma report(enable, "CCN1281")
#pragma report(enable, "CCN287")
#endif Is there anything else we can try? |
what exactly is the warning message? does it match with either of the CCNs in file? more fundamentally, are you using xlC16 on AIX? |
We are using xlC16 on AIX:
We get the following warning message:
which does not match any of the CCNs in the file. Here are all of the CCNs in the file that mention "offsetof":
CCN287 and CCN1281 come close, but they reference "POD" classes, while the warning message we see in the build references "standard layout" classes. Before C++11, You can actually see the old warning message in this issue from 2019:
where you can see the message matches CCN1281 from the file, and even has the number 1281 in the prefix to the message. The issue doesn't state what platform this warning is coming from, but we can assume it's AIX from the consistency with the CCN file. To make things even more confusing, in this even older issue from 2017, we see the same "standard layout type" warning on x86:
I'm not sure why this build, which is clearly using xlC 16 on AIX, would have GCC-style warnings. It's not just this one either, because if you look at a random nightly AIX build there are over 1000 instances of "[-W" in the build log. But there are also xlC style warnings, as there are 51 instances of "(W)" in that same build log. |
GCC-style warning ... I guessed it is due to using Clang front-end (indicated in your first line). |
could you try these out?
|
6070e12
to
68bc1a6
Compare
That worked! The warnings are gone. |
68bc1a6
to
2d8c3ac
Compare
@zl-wang Should we move forward with the clang directives? |
we knew, starting java15, we used xlC16. But older jdk builds used xlC13 (I believed). xlC13 was not clang based. the same sources were used in the different builds. so, addressing every build is your goal, or only java15-and-later? or, you need to apply version-specific pragma. |
aix on jdk8 uses xlc 13, 11+ uses xlc 16. |
That's good to know. Taking a look at a recent jdk8 AIX nightly build we do see the xlC style warnings:
We do need to make this change for every build, so we will need to apply the version-specific pragma. How do we do that? |
The best way is to test for different compilers using the macros they provide. |
do similarly as linux/macOS/AIX. just for xlC, that is. |
2d8c3ac
to
69080b6
Compare
#elif defined(OSX) || (defined(AIXPPC) && JAVA_SPEC_VERSION >= 11) | ||
#pragma clang diagnostic push | ||
#pragma clang diagnostic ignored "-Winvalid-offsetof" | ||
#elif defined(AIXPPC) && JAVA_SPEC_VERSION < 11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linux BE build appeared missing (as mentioned by Peter).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does BE mean? How is it different from regular plinux builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BE means Big Endian. We also have plinux Little Endian builds.
OpenJ9 only builds LE, IBM has both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks not right. Linux BE build used the same (or similar) compiler as AIX java8 (instead of java11+).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should test the compiler levels and not java levels, as we should be free to change which compilers are used to compile the different versions without having to modify the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed. you might be able to do that by testing predefined relevant macros existing or not, e.g. xlc and clang etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I think I did the control flow logic right this time, I'll run a build and see if the warnings go away
bb03f8e
to
be0a6d3
Compare
#if defined(USE_CLANG) | ||
#pragma clang diagnostic push | ||
#pragma clang diagnostic ignored "-Winvalid-offsetof" | ||
#elif defined(TR_TARGET_POWER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plinux LE uses gcc
be0a6d3
to
06fdf70
Compare
@@ -57,7 +57,32 @@ | |||
#include "j9jitnls.h" | |||
#endif | |||
|
|||
#if defined(COMPILER_GCC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found these COMPILER_XXX
macros in omr/compiler/env/defines.h. Aside from USE_CLANG
I couldn't find any other macros that would let us check which compiler we're using in OpenJ9. I was having a hard time figuring out if we've imported these macros across OpenJ9, but I don't think so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compilers themselves provide macros. For example https://www.ibm.com/docs/ru/xl-c-and-cpp-linux/16.1.0?topic=macros-identify-xl-cc-compiler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, my mistake. I added those along with similar macros for clang and gcc.
662e7bd
to
b842e49
Compare
I ran a build to see if the AIX warnings would go away. They're gone on Java 11+ (clang frontend), but they're still present on Java 8:
The |
b842e49
to
0e884bc
Compare
In order to allow OMR_WARNINGS_AS_ERRORS to be enabled across the JIT, disable -Winvalid-offsetof on gcc and clang builds while work is done to refactor relevant classes to be standard-layout type so offsetof can be used Signed-off-by: Dylan Tuttle <jdylantuttle@gmail.com>
0e884bc
to
d0811d4
Compare
Recently, the version of xlC that is used to compile JDK 8 on AIX was updated to 16.1, which (obviously among other things) replaces the old front end with a Clang-based one. The PR in which the change was made can be found here. The reason this is relevant here is twofold:
Therefore, disabling this warning would allow us to enable @pshipton @zl-wang As the two people who were helping me out with this last year, could I get another round of review when you have a chance? Since it's been a while, we're disabling this warning instead of fixing it because it was decided that a fix would require a somewhat significant refactoring of multiple classes. In the meantime, it is worthwhile to disable this warning while work is done to perform the refactoring so that we can turn on |
Note IBM Java 8 still uses xlc 13.1, pls ensure this build isn't broken by this change. |
I see. I suppose I should retract some of the sweeping statements I made in my previous comment. That means a separate effort still needs to be applied to remove those xlC warnings so we can enable I do think it would be worthwhile to disable this warning and turn on warnings as errors on non-xlC Power builds in the meantime. It would add another safety rail against bugs to all of our other Power builds sooner, rather than risking more being introduced while work is done to fix the warnings for IBM Java 8 on AIX. I could open an issue for xlC specific warnings so progress on that could be tracked seperately. |
somehow need to make sure, if they stay at xlc13.1, don't upgrade up to xlc13.1.5 (my impression) where it regressed the performance (significantly). |
jenkins compile aix jdk8,jdk21 |
#if defined(__clang__) | ||
#pragma clang diagnostic push | ||
#pragma clang diagnostic ignored "-Winvalid-offsetof" | ||
#elif defined(__GNUC__) || defined(__GNUG__) | ||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Winvalid-offsetof" | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to me that the changes to this file will have any effect. The warnings need to be suppressed where SET_OPTION_BIT()
is used, not where it is defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The -Winvalid-offsetof
warnings are seen in the last nightly build https://openj9-jenkins.osuosl.org/job/Build_JDK21_ppc64_aix_Nightly/347
but not the PR build https://openj9-jenkins.osuosl.org/job/Build_JDK21_ppc64_aix_Personal/255
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what Keith is talking about, because it doesn't look like this specific SET_OPTION_BIT()
warning appears in the nightly build. I guess something must have happened since I was originally fixing this warning last year, and recently since I only checked to see if it still got rid of the warnings, I missed that one of them doesn't do anything anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no warnings in the nightly that mention SET_OPTION_BIT
, so I think that part of the change could be reverted.
In order to allow
OMR_WARNINGS_AS_ERRORS
to be enabled across the JIT, disable-Winvalid-offsetof
while work is done to refactor relevant classes to be standard-layout type so offsetof can be used without crashing the build on AIX.