-
Notifications
You must be signed in to change notification settings - Fork 415
Remove isdigit macro redefs, replace with OMR_ISDIGIT #7711
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
Conversation
|
@keithc-ca I unintentionally closed #7413 due to a force push earlier. Don't think I could reopen that, so I created this with the cleaned up suggestions. I verified the advice by the cpp-team and made the replacements across omr and openj9, and also tested with both XLC and Open XL compilation and confirmed that this builds with the jdk21 zos with no issues for both. The corresponding changes for OpenJ9 are here: eclipse-openj9/openj9#21555 @babsingh Tagging for review/additional feedback, updates from #7413 |
compiler/control/OMROptions.cpp
Outdated
| { | ||
| int64_t current = 0; | ||
| while (isdigit(*option)) | ||
| while (__isdigit_a(*option)) |
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 think it's reasonable to define _AE_BIMODAL on all platforms, nor is it reasonable to assume that __isdigit_a() exists on all platforms.
I suggest we should introduce helper macros (e.g. omr_isdigit()) which would be suitably defined for each platform and uses of isdigit() would be replaced by uses of omr_isdigit(). The same approach should be applied for toupper(), tolower(), 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.
Sounds good, I can define that in util/a2e/headers/ctype.h I guess.
Is there a __tolower_a() and __toupper_a() similarly available as well? Not able to find documentation around it.
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.
No. omr_isdigit() would be defined in some OMR header file (perhaps after including ctype.h).
compiler/control/OMROptions.cpp
Outdated
| { | ||
| count[i] = atoi(s); | ||
| while(isdigit(s[0])) | ||
| while(OMR_ISDIGIT(s[0])) |
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.
While you're here, please add the missing space after while; see also lines 4421, 4444 and changes in other files.
| #include <sstream> | ||
| #endif /* defined(J9ZOS390) */ | ||
|
|
||
| #include <sstream> |
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 was previously not included on z/OS: Have you verified that it is now safe to 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.
In the before code, I am seeing #include <sstream> in the J9ZOS390 clause already, inbetween the undef and defines.
That being said, it seems to be safe to include so far while compiling as well.
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.
Sorry, I misread the change. You are correct, sstream was included on all platforms before and should continue to be.
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.
Including ctype.h perhaps should be unconditional:
#include "ddr/config.hpp"
#include <ctype.h>
#include <sstream>Likewise in ddr/std/string.hpp and ddr/std/unordered_map.hpp.
include_core/omrcomp.h
Outdated
| #ifndef OMRCOMP_H | ||
| #define OMRCOMP_H | ||
|
|
||
| #define _AE_BIMODAL |
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 this should be conditional:
#if defined(J9ZOS390)
#define _AE_BIMODAL
#endif /* defined(J9ZOS390) */|
The summary and description should be updated to reflect the new plan. |
68797ef to
3f88031
Compare
|
After having implemented the feedback, with the latest combination of changes from this and eclipse-openj9/openj9#21555 I am seeing the below errors: From this it looks like |
No, that doesn't sound right: That should be contained to the header file that defines |
|
Strange ... I am trying to remove the If that doesn't work either, then not sure why EDIT: Also trying to include <ctype.h> within |
|
I was able to fix all the compilation problems now, with your recommended suggestions intact. I was getting the errors from #7711 (comment) for every single file after moving the Ensuring the |
| #include <sstream> | ||
| #endif /* defined(J9ZOS390) */ | ||
|
|
||
| #include <sstream> |
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.
Including ctype.h perhaps should be unconditional:
#include "ddr/config.hpp"
#include <ctype.h>
#include <sstream>Likewise in ddr/std/string.hpp and ddr/std/unordered_map.hpp.
fvtest/omrGtestGlue/omrTest.h
Outdated
| * So we explicitly include <ctype.h> and undefine the macros for gtest, after gtest we then define back the macros. | ||
| */ |
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 include of ctype.h should also be unconditional, and the stale comment (lines 35-38) removed.
| #define isalnum(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISALNUM_ASCII) : 0) | ||
| #define isalpha(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISALPHA_ASCII) : 0) | ||
| #define iscntrl(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISCNTRL_ASCII) : 0) | ||
| #define isdigit(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISDIGIT_ASCII) : 0) |
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 conditional definition of _AE_BIMODAL should go near the beginning of this file with a surrounding ifdef:
#if !defined(OMR_CTYPE_H)
#define OMR_CTYPE_H
#if defined(J9ZOS390)
#define _AE_BIMODAL
#endif /* defined(J9ZOS390) */
// etc.
#endif /* !defined(OMR_CTYPE_H) */|
@keithc-ca I made some partial changes, to try and confirm the For reference the full command and errors below: cd /jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/build/zos-s390x-server-release/vm/runtime/compiler && /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/ibm-clang++64 -D__STDC_LIMIT_MACROS -D_ALL_SOURCE -D_OPEN_THREADS=3 -D_XOPEN_SOURCE=600 -Dj9jit_EXPORTS -DBITVECTOR_BIT_NUMBERING_MSB -DBITVECTOR_64BIT -DBUILD_Z_RUNTIME_INSTRUMENTATION -DCOMPRESS_AOT_DATA -DIBM_ATOE -DIPv6_FUNCTION_SUPPORT -DJ9_PROJECT_SPECIFIC -DJ9VM_TIERED_CODE_CACHE -DJ9ZOS390 -DJ9ZOS39064 -DLONGLONG -DMAXMOVE -DOPENJ9_BUILD -DSUPPORTS_THREAD_LOCAL -DTR_HOST_S390 -DTR_HOST_64BIT -DTR_TARGET_S390 -DTR_TARGET_64BIT -DZOS -fstrict-aliasing -mzos-target=ZOSV2R4 -m64 -O3 -fstack-protector -march=arch10 -std=gnu++14 -fasm -fno-rtti -DYYLMAX=1000 -Wuninitialized -mnocsect -fvisibility=default -fexec-charset=ISO8859-1 -isystem /jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/cmake/modules/platform/os/../../../../util/a2e/headers -I/usr/lpp/hzc/include -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/openj9/runtime/compiler/z -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/openj9/runtime/compiler -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler/z -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/thread -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/gc/include -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/openj9/runtime/compiler/.. -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/openj9/runtime/codert_vm -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/openj9/runtime/gc_include -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/openj9/runtime/gc_glue_java -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/openj9/runtime/jit_vm -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/openj9/runtime/nls -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/openj9/runtime/oti -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/openj9/runtime/include -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/openj9/runtime/util -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/build/zos-s390x-server-release/vm/runtime -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/build/zos-s390x-server-release/vm/runtime/oti -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/build/zos-s390x-server-release/vm/runtime/omr -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/build/zos-s390x-server-release/vm/runtime/compiler -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/closedj9/runtime/compiler -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/include_core -I/usr/include -I/usr/lpp/cbclib/include -I/include_core -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/closedj9/runtime/include -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/build/zos-s390x-server-release/vm/runtime/include -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/build/zos-s390x-server-release/vm -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/build/zos-s390x-server-release/vm/runtime/nls -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/util/hashtable/. -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/build/zos-s390x-server-release/vm/runtime/util -I/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/openj9/runtime/util/. -o CMakeFiles/j9jit.dir/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler/control/OMROptions.cpp.o -c /jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler/control/OMROptions.cpp//errors:
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler/control/OMROptions.cpp:1379:14: error: use of undeclared identifier '__isdigit_a'
1379 | while (OMR_ISDIGIT(*option))
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/include_core/omrcomp.h:617:24: note: expanded from macro 'OMR_ISDIGIT'
617 | #define OMR_ISDIGIT(x) __isdigit_a(x)
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler/control/OMROptions.cpp:3429:20: error: use of undeclared identifier '__isdigit_a'
3429 | while (OMR_ISDIGIT(*options))
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/include_core/omrcomp.h:617:24: note: expanded from macro 'OMR_ISDIGIT'
617 | #define OMR_ISDIGIT(x) __isdigit_a(x)
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler/control/OMROptions.cpp:3446:23: error: use of undeclared identifier '__isdigit_a'
3446 | while (OMR_ISDIGIT(*options))
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/include_core/omrcomp.h:617:24: note: expanded from macro 'OMR_ISDIGIT'
617 | #define OMR_ISDIGIT(x) __isdigit_a(x)
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler/control/OMROptions.cpp:4393:14: error: use of undeclared identifier '__isdigit_a'
4393 | if (OMR_ISDIGIT(s[0]))
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/include_core/omrcomp.h:617:24: note: expanded from macro 'OMR_ISDIGIT'
617 | #define OMR_ISDIGIT(x) __isdigit_a(x)
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler/control/OMROptions.cpp:4396:20: error: use of undeclared identifier '__isdigit_a'
4396 | while (OMR_ISDIGIT(s[0]))
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/include_core/omrcomp.h:617:24: note: expanded from macro 'OMR_ISDIGIT'
617 | #define OMR_ISDIGIT(x) __isdigit_a(x)
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler/control/OMROptions.cpp:4418:14: error: use of undeclared identifier '__isdigit_a'
4418 | if (OMR_ISDIGIT(s[0]))
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/include_core/omrcomp.h:617:24: note: expanded from macro 'OMR_ISDIGIT'
617 | #define OMR_ISDIGIT(x) __isdigit_a(x)
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler/control/OMROptions.cpp:4421:20: error: use of undeclared identifier '__isdigit_a'
4421 | while (OMR_ISDIGIT(s[0]))
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/include_core/omrcomp.h:617:24: note: expanded from macro 'OMR_ISDIGIT'
617 | #define OMR_ISDIGIT(x) __isdigit_a(x)
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler/control/OMROptions.cpp:4441:14: error: use of undeclared identifier '__isdigit_a'
4441 | if (OMR_ISDIGIT(s[0]))
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/include_core/omrcomp.h:617:24: note: expanded from macro 'OMR_ISDIGIT'
617 | #define OMR_ISDIGIT(x) __isdigit_a(x)
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/compiler/control/OMROptions.cpp:4444:20: error: use of undeclared identifier '__isdigit_a'
4444 | while (OMR_ISDIGIT(s[0]))
| ^
/jit/team/gauravc/repos/openj9-openjdk-jdk21-zos/omr/include_core/omrcomp.h:617:24: note: expanded from macro 'OMR_ISDIGIT'
617 | #define OMR_ISDIGIT(x) __isdigit_a(x)
I tried moving around the define of I am having difficulty finding out why |
a018747 to
c66161e
Compare
|
Made the changes to address the above feedback. Tested with the commandline approach using |
| ############################################################################# | ||
|
|
||
| list(APPEND OMR_PLATFORM_DEFINITIONS | ||
| -D_AE_BIMODAL |
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.
Should this be contributed by openxl.cmake instead? Or will this work with xlc as well?
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 works with xlc as well. I checked this with the compiler team and had to make sure it compiles with both using AE_BIMODAL , because after removing the redefinitions from ctype.h , it broke the xlc builds as well. So adding it here was intentional.
fvtest/omrGtestGlue/omrTest.h
Outdated
| static int iconv_init_static_variable = iconv_initialization(); | ||
| #endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ | ||
|
|
||
|
|
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.
Please also delete this blank line (we don't need more than one blank line in a row).
util/a2e/headers/ctype.h
Outdated
| #if defined(J9ZOS390) | ||
| #define _AE_BIMODAL | ||
| #endif /* 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.
This is at best redundant (it should be defined by the make system) or may be viewed by the compiler as a redefinition (error).
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.
Mistake from my side, should have removed it earlier.
|
@keithc-ca Both this and eclipse-openj9/openj9#21555 are ready for review, with latest feedback in place/tested. |
|
jenkins build all |
|
@Deigue Can you look at the failures in the zOS PR build? |
|
failures look like infra issues ... restarting PR builds jenkins build zos,riscv |
|
I am seeing that bunch of the console output messages earlier were indicative of |
|
jenkins build zos(compile:'VERBOSE=1') |
|
@babsingh Is there a reason why locally I am only seeing 15 tests with While in the verbose console log these is 28 tests? Is this dependant on the way cmake configures the build at the start? Looks like the OMROptions.cpp command/compilation looks ok, so there is something else may be the problem? I can see both |
There may be conditional restrictions based on the setup and environment. These can usually be identified by reviewing the test source code and build configuration files. |
Unsure since they are JIT failures. @0xdaryl Is there a JIT member who can help @Deigue investigate these failures? |
|
I was chatting with @Spencer-Comin for some guidance on this, However this has got my build to fail/error before the Attached linker errors associated with local build: The full commands look the same. I do have |
No, these errors also exist in OMR - see CompileMethod.cpp. |
Changes here remove the redefinition of isdigit() in the a2e ctype.h headers. In order to fully make this work functionally, the references/usages of isdigit() are replaced with OMR_ISDIGIT to properly recognize ascii digit literals. This is done by conditionally using __isdigit_a() on z/OS platforms. Signed-off-by: Gaurav Chaudhari <gaurav.chaudhari@ibm.com>
|
jenkins build zos(compile:'VERBOSE=1') |
|
Are we good for merging the pair of PR's now, as the builds have passed? The only change was made to I added the The extension repos compilation along with OMR/OpenJ9 remains to be fine. |
|
jenkins build all |
Changes here remove the redefinition of isdigit() in
the a2e ctype.h headers. In order to fully make this
work functionally, the references/usages of isdigit()
are replaced with OMR_ISDIGIT to properly recognize
ascii digit literals. This is done by conditionally
using __isdigit_a() on z/OS platforms.
This is the cleaned-up changes from #7413 (for historical related comments)