-
Notifications
You must be signed in to change notification settings - Fork 396
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
Initial changes for Open XL z/os support #7320
base: master
Are you sure you want to change the base?
Conversation
thread/common/thrprof.c
Outdated
uintptr_t *tempHandle; | ||
tempHandle = (uintptr_t *)&(thread->handle.__[0]); | ||
#if defined(__GNUC__) | ||
tempHandle = (uintptr_t *)&(thread->handle.__); | ||
#else | ||
tempHandle = (uintptr_t *)&(thread->handle.__[0]); | ||
#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.
This should use the same pattern as in #7323.
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.
So I am seeing https://github.com/Deigue/omr/blob/4401fae20ac9db1255fafb68333e322297d43620/include_core/thrtypes.h#L57 , handle
is of type OSTHREAD
OSTHREAD tempHandle = thread->handle;
return (uint_ptr)* <cast> tempHandle
But what would the cast look like? Where can I find OSTHREAD
to see what exactly __ is pulling out and how to cast it properly? "handle" also seemed like too broad a search/grep for /usr/include
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.
Something like this is what I meant:
OSTHREAD tempHandle = thread->handle;
return (uintptr_t)*(unsigned long long *)&tempHandle;
For z/OS, OSTHREAD
is defined in include_core/unix/thrdsup.h
:
typedef pthread_t OSTHREAD;
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.
Thanks, confirmed it works and everything compiles, and changed accordingly.
jenkins build all |
java 21 jenkins passed
|
566b966
to
f06239c
Compare
j21 jenkins verify Verified new changes compiling with XLC as well, after checking locally working with Open XL. Removing draft and changing to ready for review ... |
#if !defined(__GNUC__) | ||
#define __THROW | ||
#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.
This is within an extern "C"
block, so none of the uses of __THROW
below seem appropriate.
The macro definition, and its uses here and in omrsig.cpp
should just be removed.
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 is extern "C" only if __cplusplus
is defined right?
And if that is the case, the it is safe to remove the define instances below entirely?
L35: #define __THROW
Snippet L35:37
#if defined(OSX)
#define __THROW
#endif /* defined(OSX) */
And what does that mean for these below where __THROW is being used, does the "__THROW" part need to be removed specifically from every line? https://github.com/eclipse/omr/blob/c256823419b4579cf64f94072337fa108f1761f9/include_core/omrsig.h#L104-L115
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 definitions of __THROW
should be removed as well as all uses.
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.
thanks Ill remove these, and from omrsig.cpp
as well, will need somebody to help me run/issue a jenkins build for macos/windows as well, to verify that it doesnt impact and is all good.
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 get these errors when removing the specifications:
/omr/omrsigcompat/omrsig.cpp:241:1: error: 'signal' is missing exception specification 'throw()'
241 | signal(int signum, sighandler_t handler)
| ^
| throw()
This being shown for all 5 functions defined in omrsig.cpp with __THROW
(probably more errors if not just zos, as some might be not defined on zos)
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.
These are declared within an extern "C" { }
block; C functions don't (can't) have throw()
specifications.
If you preprocess omrsig.cpp
, do you see an ealier declaration of these functions?
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 definition of the signal handler in omrsig.cpp
should be qualified with extern "C"
. One might expect that it would be sufficient that the declaration appears within the extern "C"
block beginning on line 45, but apparently not: That is something we should bring to the attention of the compiler team.
The suppression of warnings on Windows suggest to me that the declaration of signal
is wrong there as well.
@@ -25,6 +25,7 @@ | |||
|
|||
#include "omrcomp.h" | |||
|
|||
struct OMRPortLibrary; |
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.
A blank line after this one would be welcome.
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.
Done
omrsigcompat/makefile
Outdated
@@ -24,7 +24,7 @@ top_srcdir := .. | |||
include $(top_srcdir)/omrmakefiles/configure.mk | |||
|
|||
MODULE_NAME := omrsig | |||
ARTIFACT_TYPE := c_shared | |||
ARTIFACT_TYPE := cxx_shared |
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.
This has nothing to do with OpenXL; it's just an error that could be corrected separately.
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.
removed from this PR.
@@ -1663,7 +1663,7 @@ omrshmem_openSharedMemory (OMRPortLibrary *portLibrary, intptr_t fd, const char | |||
goto failDontUnlink; | |||
} | |||
} else { | |||
#if defined(__GNUC__) || defined(AIXPPC) | |||
#if (defined(__GNUC__) || defined(AIXPPC)) && !defined(J9ZOS390) |
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.
Suggest reordering the #if
branches so it's clear which one is intended for z/OS, or #define KEY
appropriately for each platform/compiler and then use KEY
instead of key
, _key
or __key
.
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.
can you detail that a bit, looking at the logic again, since I have excluded via !defined(J9ZOS390)
, it should mean that z/OS does not use any of the child if
branches underlying within the parent if
clause right?
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 now that none of the branches would apply for z/OS: is that the right behavior?
If so, I suggest we reorder the code to put the z/OS path first, and this in the #else
block:
#if defined(OMRZOS390)
// existing lines 1686-1709
#elif defined(__GNUC__) || defined(AIXPPC)
// existing lines 1667-1683
#endif /* defined(OMRZOS390) */
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.
yup, and that does look cleaner.
But what is the difference (if any) between OMRZOS390
and J9ZOS390
... because if it seems there is diff, then I will still need it as follows:
#if defined(OMRZOS390)
// existing lines 1686-1709
#elif (defined(__GNUC__) || defined(AIXPPC)) && !defined(J9ZOS390)
// existing lines 1667-1683
#endif /* defined(OMRZOS390) */
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 think OMRZOS390
is the preferred flag to test in new code, J9ZOS390
is a name that originated in OpenJ9. They're both still used and I think they're equivalent, but OMR is supposed to be a base for OpenJ9, not dependent on anything from OpenJ9 (including naming conventions).
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.
Seems the build is failing after reorganizing this and omrshsem_deprecated.c
cd .../omr/build/port && /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/ibm-clang64 -D__STDC_LIMIT_MACROS -D_ALL_SOURCE -D_OPEN_THREADS=3 -D_XOPEN_SOURCE=600 -DJ9ZOS390 -DJ9ZOS39064 -DLONGLONG -DOMR_EBCDIC -DOMRPORT_LIBRARY_DEFINE -DSUPPORTS_THREAD_LOCAL -DZOS -I...(all includes here) -fstrict-aliasing -mzos-target=ZOSV2R4 -m64 -march=arch10 -fvisibility=default -o CMakeFiles/omrport_obj.dir/unix/omrshmem.c.o -c /.../omr/port/unix/omrshmem.c
The full command follows the above format, and J9Z0S390
is defined, but looks like OMRZOS390
is not ... so I might need to switch it to J9ZOS390
. Doing this seems to highlight a bigger issue, that OMRZOS390
clauses aren't being used for the file, so all the conditionals that are expected to be entered arent, and thus causes compilation problems.
Looks like from what I can see it was not set for xlc
all along either, unless Im missing somewhere in code where its 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.
I don't see OMRZOS390
defined anywhere (despite tests in this file and in omrsharedhelper.h
).
Unless someone can point to where OMRZOS390
is defined, this should use J9ZOS390
.
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, thats what I was mentioning in my prior comment. As such, in the current state of the PR I am still utilizing J9ZOS390
in this file.
Unless you are saying replace all the mentions in this file, that I would have to change and I suspect I will be running into other problems.
@@ -1060,7 +1060,7 @@ omrshsem_openSemaphore(struct OMRPortLibrary *portLibrary, intptr_t fd, char *ba | |||
goto failDontUnlink; | |||
} | |||
} else { | |||
#if defined(__GNUC__) || defined(AIXPPC) || defined(OMRZTPF) | |||
#if (defined(__GNUC__) || defined(AIXPPC) || defined(J9ZTPF)) && !defined(J9ZOS390) |
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.
Same comment regarding KEY
here.
port/zos390/omrgetthent.h
Outdated
@@ -28,7 +28,7 @@ | |||
#define PGTHA_ACCESS_CURRENT 1 | |||
#define PGTHA_FLAG_PROCESS_DATA 0x80 | |||
|
|||
#pragma pack(packed) | |||
#pragma pack(push, 1) |
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.
Does this mean the same for both xlc and OpenXL?
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.
yes they should be functionally the same.
https://www.ibm.com/docs/en/zos/2.4.0?topic=descriptions-pragma-pack
also have confirmed internally with Sean from the open-xl/cpp team
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.
Have changed this to #pragma pack(1)
after having confirmed the packed struct sizes between XLC and Open XL and confirming the functionality is identical with Sean. He suggested to use this notation instead.
Also verified both XLC and Open XL compilers all omr tests are passing with this.
port/zos390/omrintrospect.h
Outdated
#if defined(OMR_ENV_DATA64) | ||
#else |
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.
Just say #if !defined(OMR_ENV_DATA64)
and add the missing #endif
comment.
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.
looks like I have your feedback in the other PR: #7321
Might just remove this file from this PR, as that one seems to handle more updated/latest code for omrintrospect.h
typedef _Packed struct J9RIT { | ||
typedef struct __attribute__((packed)) J9RIT { |
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.
Again, do xlc and OpenXL attach the same meaning to this?
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.
They do have the same meaning as per discussing internally with Sean from the cpp team. I did inquire if we have any published/public documentation for this, but I dont think they have a dedicated page regarding this particular suggestion/tweak.
However digging a bit and searching for it, there is a small mention of it on this page: https://www.ibm.com/docs/en/open-xl-c-cpp-zos/2.1?topic=guide-binary-compatibility
To quote part of our discussions:
The problem with _Packed is that it is C only and the usual change to attribute((packed)) for C++ doesn't have the same semantics.
typedef struct S _Packed {
char c;
int i;
} S;
S s1;
struct S s2;
In this example s1 and s2 have different sizes and types. The _Packed keyword applies to the declarator (eg. typedef name S) on the struct definition. The _Packed keyword creates a hidden duplicate version of the struct.
Avoid the keyword even in XL.
50f0e24
to
d8bb359
Compare
d8bb359
to
5136e6b
Compare
Includes all the initial work done a while ago made in order to support compiling with Open XL in context of z/OS. Signed-off-by: Gaurav Chaudhari <[email protected]>
5136e6b
to
c0d5ea3
Compare
@keithc-ca This one is also ready. I have added comments for prior questions above. Wanted to make sure this is approved from your perspective before Babneet can kick off the jenkins builds and start the process for merging the changes. |
#if !defined(__GNUC__) | ||
#define __THROW | ||
#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.
The definition of the signal handler in omrsig.cpp
should be qualified with extern "C"
. One might expect that it would be sufficient that the declaration appears within the extern "C"
block beginning on line 45, but apparently not: That is something we should bring to the attention of the compiler team.
The suppression of warnings on Windows suggest to me that the declaration of signal
is wrong there as well.
@@ -1663,7 +1663,7 @@ omrshmem_openSharedMemory (OMRPortLibrary *portLibrary, intptr_t fd, const char | |||
goto failDontUnlink; | |||
} | |||
} else { | |||
#if defined(__GNUC__) || defined(AIXPPC) | |||
#if (defined(__GNUC__) || defined(AIXPPC)) && !defined(J9ZOS390) |
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 don't see OMRZOS390
defined anywhere (despite tests in this file and in omrsharedhelper.h
).
Unless someone can point to where OMRZOS390
is defined, this should use J9ZOS390
.
Includes all the initial work done a while ago made in order to support compiling with Open XL in context of z/OS.
(This is one part of the multiple changes added for supporting Open XL compilation on OMR)