diff --git a/CMakeLists.txt b/CMakeLists.txt index f55087a9197..b9e2dee30e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,24 @@ target_include_directories(omr_base $ ) +if(OMR_OS_ZOS) + if(OMR_USE_NATIVE_ENCODING) + target_link_libraries(omr_base INTERFACE omr_ebcdic) + target_compile_definitions(omr_base + INTERFACE + -DOMR_EBCDIC + ) + install(TARGETS omr_ebcdic + EXPORT OmrTargets + ) + else() + target_link_libraries(omr_base INTERFACE omr_ascii) + install(TARGETS omr_ascii + EXPORT OmrTargets + ) + endif() +endif() + install( TARGETS omr_base EXPORT OmrTargets diff --git a/buildenv/jenkins/jobs/pull-requests/PullRequest-zos_390-64 b/buildenv/jenkins/jobs/pull-requests/PullRequest-zos_390-64 index 4755841c997..fbab78b5793 100644 --- a/buildenv/jenkins/jobs/pull-requests/PullRequest-zos_390-64 +++ b/buildenv/jenkins/jobs/pull-requests/PullRequest-zos_390-64 @@ -14,41 +14,23 @@ pipeline { stage('Build') { steps { timestamps { - //echo 'Output CCACHE stats before running and clear them' - //echo '''ccache -s -z''' - - echo 'Configure...' - sh'''make -f run_configure.mk OMRGLUE=./example/glue SPEC=zos_390-64''' - - echo 'Convert HDF files to EBCDIC' - //sh'''for file in `find . -name '*.hdf'`;do;mv "$file" "$file.iso88591";iconv -f ISO8859-1 -t IBM-1047 "$file.iso88591" >"$file" && chtag -tc IBM-1047 "$file";done''' - //sh'''for file in `find . -name '*.hdf'`;do; chtag -p "$file" | grep -q "ISO8859-1"; if [[ $? == 0 ]]; then; mv "$file" "$file.iso88591";iconv -f ISO8859-1 -t IBM-1047 "$file.iso88591" >"$file" && chtag -tc IBM-1047 "$file"; fi; done''' - sh'''for file in `find . -name '*.hdf'`;do; chtag -p "$file" | grep -q "ISO8859-1"; if [ $? -eq 0 ]; then; mv "$file" "$file.iso88591";iconv -f ISO8859-1 -t IBM-1047 "$file.iso88591" >"$file" && chtag -tc IBM-1047 "$file"; fi; done''' - - echo 'Convert TDF files to EBCDIC' - //sh'''for file in `find . -name '*.tdf'`;do;mv "$file" "$file.iso88591";iconv -f ISO8859-1 -t IBM-1047 "$file.iso88591" >"$file" && chtag -tc IBM-1047 "$file";done''' - //sh'''for file in `find . -name '*.tdf'`;do; chtag -p "$file" | grep -q "ISO8859-1"; if [[ $? == 0 ]]; then; mv "$file" "$file.iso88591";iconv -f ISO8859-1 -t IBM-1047 "$file.iso88591" >"$file" && chtag -tc IBM-1047 "$file"; fi; done - sh'''for file in `find . -name '*.tdf'`;do; chtag -p "$file" | grep -q "ISO8859-1"; if [ $? -eq 0 ]; then; mv "$file" "$file.iso88591";iconv -f ISO8859-1 -t IBM-1047 "$file.iso88591" >"$file" && chtag -tc IBM-1047 "$file"; fi; done''' - - echo 'Compile...' - sh'''make -j4''' - - //echo 'Output CCACHE stats after running' - //echo '''ccache -s''' + dir('build') { + echo 'Configure...' + sh '''cmake -Wdev -C../cmake/caches/Travis.cmake -DCMAKE_C_COMPILER=/bin/c89 -DCMAKE_CXX_COMPILER=/bin/xlc -DOMR_DDR=0 -DOMR_THR_FORK_SUPPORT=0 ..''' + + echo 'Compile...' + sh '''make -j4''' + } } } } stage('Test') { steps { timestamps { - echo "Sanity Test..." - - // Workaround: Convert XML files to EBCDIC - //sh'''for file in `find . -name '*.xml'`;do;mv "$file" "$file.iso88591";iconv -f ISO8859-1 -t IBM-1047 "$file.iso88591" >"$file" && chtag -tc IBM-1047 "$file";done''' - sh'''for file in `find . -name '*.xml'`;do; chtag -p "$file" | grep -q "ISO8859-1"; if [ $? -eq 0 ]; then; mv "$file" "$file.iso88591";iconv -f ISO8859-1 -t IBM-1047 "$file.iso88591" >"$file" && chtag -tc IBM-1047 "$file"; fi; done''' - - // Perform a subset of the testing until while we resolve the issues with the other tests - sh'''set; make -f fvtest/omrtest.mk -j1 SPEC=zos_390-64 omr_algotest omr_vmtest omr_utiltest omr_sigtest omr_rastest''' + dir('build') { + echo "Sanity Test..." + sh'''./omralgotest -avltest:fvtest/algotest/avltest.lst && ./omrvmtest && ./omrutiltest && ./omrsigtest && ./omrrastest && ./omrsubscribertest && ./omrtraceoptiontest''' + } } } } diff --git a/cmake/config.cmake b/cmake/config.cmake index 39a16333512..b29a7e67e66 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -48,6 +48,9 @@ set(OMR_TEST_COMPILER OFF CACHE BOOL "Enable building the test compiler") set(OMR_GC ON CACHE BOOL "Enable the GC") set(OMR_GC_TEST ${OMR_GC} CACHE BOOL "Enable the GC tests.") +set(OMR_USE_NATIVE_ENCODING ON CACHE BOOL + "Indicates that runtime components should use the systems native encoding (currently only defined for z/OS)" +) ## OMR_COMPILER is required for OMR_JITBUILDER and OMR_TEST_COMPILER if(NOT OMR_COMPILER) if(OMR_JITBUILDER) @@ -82,6 +85,10 @@ set(OMR_TOOLS_IMPORTFILE "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Point it to the ImportTools.cmake file of a native build" ) +set(OMR_TOOLS_USE_NATIVE_ENCODING ON CACHE BOOL + "Indicates if omr tooling should use system native character encoding (currently only defined for z/OS)" +) + ### ### Library names ### diff --git a/cmake/modules/FindLEX.cmake b/cmake/modules/FindLEX.cmake new file mode 100644 index 00000000000..b6747602e16 --- /dev/null +++ b/cmake/modules/FindLEX.cmake @@ -0,0 +1,80 @@ +############################################################################### +# Copyright (c) 2019, 2019 IBM Corp. and others +# +# This program and the accompanying materials are made available under +# the terms of the Eclipse Public License 2.0 which accompanies this +# distribution and is available at http://eclipse.org/legal/epl-2.0 +# or the Apache License, Version 2.0 which accompanies this distribution +# and is available at https://www.apache.org/licenses/LICENSE-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License, v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception [1] and GNU General Public +# License, version 2 with the OpenJDK Assembly Exception [2]. +# +# [1] https://www.gnu.org/software/classpath/license.html +# [2] http://openjdk.java.net/legal/assembly-exception.html +# +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception +############################################################################# + +find_program(LEX_EXECUTABLE NAMES lex DOC "Path to the lex executable") +mark_as_advanced(LEX_EXECUTABLE) + +if(LEX_EXECUTABLE) + macro(LEX_TARGET Name Input Output) + set(LEX_TARGET_outputs "${Output}") + set(LEX_EXECUTABLE_opts "") + set(LEX_TARGET_PARAM_OPTIONS) + set(LEX_TARGET_PARAM_ONE_VALUE_KEYWORDS + COMPILE_FLAGS + ) + set(LEX_TARGET_PARAM_MULTI_VALUE_KEYWORDS) + + cmake_parse_arguments( + LEX_TARGET_ARG + "${LEX_TARGET_PARAM_OPTIONS}" + "${LEX_TARGET_PARAM_ONE_VALUE_KEYWORDS}" + "${LEX_TARGET_MULTI_VALUE_KEYWORDS}" + ${ARGN} + ) + + set(LEX_TARGET_usage "LEX_TARGET( [COMPILE_FLAGS ]") + + if(NOT "${LEX_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "") + message(SEND_ERROR ${LEX_TARGET_usage}) + else() + if(NOT "${LEX_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "") + set(LEX_EXECUTABLE_opts "${LEX_TARGET_ARG_COMPILE_FLAGS}") + separate_arguments(LEX_EXECUTABLE_opts) + endif() + + add_custom_command(OUTPUT ${LEX_TARGET_outputs} + COMMAND ${LEX_EXECUTABLE} ${LEX_EXECUTABLE_opts} -o${Output} ${Input} + VERBATIM + DEPENDS ${Input} + COMMENT "[LEX][${Name}] Building scanner with LEX ${LEX_VERSION}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + + set(LEX_${Name}_DEFINED TRUE) + set(LEX_${Name}_OUTPUTS ${Output}) + set(LEX_${Name}_INPUT ${Input}) + set(LEX_${Name}_COMPILE_FLAGS ${LEX_EXECUTABLE_opts}) + endif() + endmacro() + + macro(ADD_LEX_YACC_DEPENDENCY LEXTarget YACCTarget) + if(NOT LEX_${LEXTarget}_OUTPUTS) + message(SEND_ERROR "LEX target `${LEXTarget}' does not exist.") + endif() + + if(NOT YACC_${YACCTarget}_OUTPUT_HEADER) + message(SEND_ERROR "YACC target `${YACCTarget}' does not exist.") + endif() + + set_source_files_properties(${LEX_${LEXTarget}_OUTPUTS} + PROPERTIES OBJECT_DEPENDS ${YACC_${YACCTarget}_OUTPUT_HEADER}) + endmacro() +endif() diff --git a/cmake/modules/FindYACC.cmake b/cmake/modules/FindYACC.cmake new file mode 100644 index 00000000000..4605af47836 --- /dev/null +++ b/cmake/modules/FindYACC.cmake @@ -0,0 +1,93 @@ +############################################################################### +# Copyright (c) 2019, 2019 IBM Corp. and others +# +# This program and the accompanying materials are made available under +# the terms of the Eclipse Public License 2.0 which accompanies this +# distribution and is available at http://eclipse.org/legal/epl-2.0 +# or the Apache License, Version 2.0 which accompanies this distribution +# and is available at https://www.apache.org/licenses/LICENSE-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License, v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception [1] and GNU General Public +# License, version 2 with the OpenJDK Assembly Exception [2]. +# +# [1] https://www.gnu.org/software/classpath/license.html +# [2] http://openjdk.java.net/legal/assembly-exception.html +# +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception +############################################################################# + +find_program(YACC_EXECUTABLE NAMES yacc DOC "Path to the YACC executable") +mark_as_advanced(YACC_EXECUTABLE) + +if(YACC_EXECUTABLE) + macro(YACC_TARGET_option_extraopts Options) + set(YACC_TARGET_cmdopt "") + set(YACC_TARGET_extraopts "${Options}") + separate_arguments(YACC_TARGET_extraopts) + list(APPEND YACC_TARGET_cmdopt ${YACC_TARGET_extraopts}) + endmacro() + + macro(YACC_TARGET_option_defines YACCOutput Header) + if("${Header}" STREQUAL "") + string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${YACCOutput}") + string(REPLACE "c" "h" _fileext ${_fileext}) + string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" YACC_TARGET_output_header "${YACCOutput}") + list(APPEND YACC_TARGET_cmdopt "-d") + else() + set(YACC_TARGET_output_header "${Header}") + + if(OMR_HOST_OS STREQUAL "zos") + list(APPEND YACC_TARGET_cmdopt "-D${YACC_TARGET_output_header}") + else() + list(APPEND YACC_TARGET_cmdopt "--defines=${YACC_TARGET_output_header}") + endif() + endif() + endmacro() + + macro(YACC_TARGET Name YACCInput YACCOutput) + set(YACC_TARGET_outputs "${YACCOutput}") + set(YACC_TARGET_extraoutputs "") + set(YACC_TARGET_PARAM_OPTIONS) + set(YACC_TARGET_PARAM_ONE_VALUE_KEYWORDS + COMPILE_FLAGS + DEFINES_FILE + ) + + cmake_parse_arguments( + YACC_TARGET_ARG + "${YACC_TARGET_PARAM_OPTIONS}" + "${YACC_TARGET_PARAM_ONE_VALUE_KEYWORDS}" + "${LEX_TARGET_MULTI_VALUE_KEYWORDS}" + ${ARGN} + ) + + set(YACC_TARGET_usage "YACC_TARGET( [COMPILE_FLAGS ] [DEFINES_FILE ]") + + if(NOT "${YACC_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "") + message(SEND_ERROR ${YACC_TARGET_usage}) + else() + YACC_TARGET_option_extraopts("${YACC_TARGET_ARG_COMPILE_FLAGS}") + YACC_TARGET_option_defines("${YACCOutput}" "${YACC_TARGET_ARG_DEFINES_FILE}") + + list(APPEND YACC_TARGET_outputs "${YACC_TARGET_output_header}") + + add_custom_command(OUTPUT ${YACC_TARGET_outputs} + COMMAND ${YACC_EXECUTABLE} ${YACC_TARGET_cmdopt} -o ${YACCOutput} ${YACCInput} + VERBATIM + DEPENDS ${YACCInput} + COMMENT "[YACC][${Name}] Building parser with YACC" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + + set(YACC_${Name}_DEFINED TRUE) + set(YACC_${Name}_INPUT ${YACCInput}) + set(YACC_${Name}_OUTPUTS ${YACC_TARGET_outputs} ${YACC_TARGET_extraoutputs}) + set(YACC_${Name}_COMPILE_FLAGS ${YACC_TARGET_cmdopt}) + set(YACC_${Name}_OUTPUT_SOURCE "${YACCOutput}") + set(YACC_${Name}_OUTPUT_HEADER "${YACC_TARGET_output_header}") + endif() + endmacro() +endif() diff --git a/cmake/modules/OmrDetectSystemInformation.cmake b/cmake/modules/OmrDetectSystemInformation.cmake index b6802b19234..b2eebac3acc 100644 --- a/cmake/modules/OmrDetectSystemInformation.cmake +++ b/cmake/modules/OmrDetectSystemInformation.cmake @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2017, 2018 IBM Corp. and others +# Copyright (c) 2017, 2019 IBM Corp. and others # # This program and the accompanying materials are made available under # the terms of the Eclipse Public License 2.0 which accompanies this @@ -182,7 +182,7 @@ macro(omr_detect_system_information) # Just use GNU config set(_OMR_TOOLCONFIG "gnu") endif() - elseif(CMAKE_C_COMPILER_ID STREQUAL "XL") + elseif(CMAKE_C_COMPILER_ID STREQUAL "XL" OR CMAKE_C_COMPILER_ID STREQUAL "zOS") set(_OMR_TOOLCONFIG "xlc") else() message(FATAL_ERROR "OMR: Unknown compiler ID: '${CMAKE_CXX_COMPILER_ID}'") diff --git a/cmake/modules/platform/arch/s390.cmake b/cmake/modules/platform/arch/s390.cmake index 25f05184359..cae75c0ec6a 100644 --- a/cmake/modules/platform/arch/s390.cmake +++ b/cmake/modules/platform/arch/s390.cmake @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2017, 2018 IBM Corp. and others +# Copyright (c) 2017, 2019 IBM Corp. and others # # This program and the accompanying materials are made available under # the terms of the Eclipse Public License 2.0 which accompanies this @@ -19,10 +19,6 @@ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception ############################################################################### -list(APPEND OMR_PLATFORM_DEFINITIONS - -DJ9VM_TIERED_CODE_CACHE -) - # Testarossa build variables. Longer term the distinction between TR and the rest # of the OMR code should be heavily reduced. In the mean time, we keep # the distinction diff --git a/cmake/modules/platform/os/zos.cmake b/cmake/modules/platform/os/zos.cmake index 22e975b0f3b..147f27ad239 100644 --- a/cmake/modules/platform/os/zos.cmake +++ b/cmake/modules/platform/os/zos.cmake @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2017, 2017 IBM Corp. and others +# Copyright (c) 2017, 2019 IBM Corp. and others # # This program and the accompanying materials are made available under # the terms of the Eclipse Public License 2.0 which accompanies this @@ -20,12 +20,15 @@ ############################################################################# list(APPEND OMR_PLATFORM_DEFINITIONS - -DJ9ZOS390 - -DLONGLONG -D_ALL_SOURCE - -D_XOPEN_SOURCE_EXTENDED - -DIBM_ATOE + -D_OPEN_THREADS=2 -D_POSIX_SOURCE + -D_XOPEN_SOURCE_EXTENDED + -D_ISOC99_SOURCE + -DLONGLONG + -DJ9ZOS390 + -DSUPPORTS_THREAD_LOCAL + -DZOS ) list(APPEND OMR_PLATFORM_INCLUDE_DIRECTORIES @@ -34,52 +37,14 @@ list(APPEND OMR_PLATFORM_INCLUDE_DIRECTORIES /usr/include ) -list(APPEND OMR_PLATFORM_COMPILE_OPTIONS - "\"-Wc,xplink\"" # link with xplink calling convention - "\"-Wc,convlit(ISO8859-1)\"" # convert all string literals to a codepage - "\"-Wc,rostring\"" # place string literals in read only storage - "\"-Wc,FLOAT(IEEE,FOLD,AFP)\"" # Use IEEE (instead of IBM Hex Format) style floats - "\"-Wc,enum(4)\"" # Specifies how many bytes of storage enums occupy - "\"-Wa,goff\"" # Assemble into GOFF object files - "\"-Wc,NOANSIALIAS\"" # Do not generate ALIAS binger control statements - "\"-Wc,TARGET(zOSV1R13)\"" # Generate code for the target operating system -) - -list(APPEND OMR_PLATFORM_C_COMPILE_OPTIONS - "\"-Wc,ARCH(7)\"" - "\"-Wc,langlvl(extc99)\"" - "\"-qnosearch\"" -) - -list(APPEND OMR_PLATFORM_CXX_COMPILE_OPTIONS - "\"-Wc,ARCH(7)\"" - "\"-Wc,langlvl(extended)\"" - "\"-qnosearch\"" -) - -list(APPEND OMR_PLATFORM_SHARED_COMPILE_OPTIONS - "\"-Wc,DLL\"" - "\"-Wc,EXPORTALL\"" -) - -list(APPEND OMR_PLATFORM_SHARED_LINKER_OPTIONS - "\"-Wl,xplink\"" - "\"-Wl,dll\"" -) +# Create helper targets for specifying ascii/ebcdic options +add_library(omr_ascii INTERFACE) +target_compile_definitions(omr_ascii INTERFACE -DIBM_ATOE) +target_compile_options(omr_ascii INTERFACE "-Wc,convlit(ISO8859-1)") +target_link_libraries(omr_ascii INTERFACE j9a2e) -if(OMR_ENV_DATA64) - list(APPEND OMR_PLATFORM_DEFINITIONS - -DJ9ZOS39064 - ) - list(APPEND OMR_PLATFORM_COMPILE_OPTIONS - \"-Wc,lp64\" - \"-Wa,SYSPARM(BIT64)\" - ) -else() - list(APPEND OMR_PLATFORM_DEFINITIONS - -D_LARGE_FILES - ) -endif() +add_library(omr_ebcdic INTERFACE) +target_compile_definitions(omr_ebcdic INTERFACE -DOMR_EBCDIC) macro(omr_os_global_setup) diff --git a/cmake/modules/platform/toolcfg/xlc.cmake b/cmake/modules/platform/toolcfg/xlc.cmake index 6b704a691d7..f20d8f2abfc 100644 --- a/cmake/modules/platform/toolcfg/xlc.cmake +++ b/cmake/modules/platform/toolcfg/xlc.cmake @@ -19,32 +19,53 @@ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception ############################################################################### -set(OMR_WARNING_AS_ERROR_FLAG -qhalt=w) +if(OMR_HOST_ARCH STREQUAL "ppc") + set(OMR_WARNING_AS_ERROR_FLAG -qhalt=w) -#There is no enhanced warning for XLC right now -set(OMR_ENHANCED_WARNING_FLAG ) + # There is no enhanced warning for XLC right now + set(OMR_ENHANCED_WARNING_FLAG ) -list(APPEND OMR_PLATFORM_COMPILE_OPTIONS - -qalias=noansi - -qxflag=LTOL:LTOL0 -) - -list(APPEND OMR_PLATFORM_CXX_COMPILE_OPTIONS -qlanglvl=extended0x) - -if(OMR_ENV_DATA64) list(APPEND OMR_PLATFORM_COMPILE_OPTIONS - -q64 + -qalias=noansi + -qxflag=LTOL:LTOL0 ) -else() - #-qarch should be there for 32 and 64 C/CXX flags but the C compiler is used for the assembler and it has trouble with some assembly files if it is specified - list(APPEND OMR_PLATFORM_COMPILE_OPTIONS - -q32 - -qarch=ppc + + list(APPEND OMR_PLATFORM_CXX_COMPILE_OPTIONS -qlanglvl=extended0x) + + if(OMR_ENV_DATA64) + list(APPEND OMR_PLATFORM_COMPILE_OPTIONS + -q64 + ) + else() + # -qarch should be there for 32 and 64 C/CXX flags but the C compiler is used for the assembler and it has trouble with some assembly files if it is specified + list(APPEND OMR_PLATFORM_COMPILE_OPTIONS + -q32 + -qarch=ppc + ) + endif() + + # Testarossa build variables. Longer term the distinction between TR and the rest + # of the OMR code should be heavily reduced. In the mean time, we keep + # the distinction + + # TR_COMPILE_OPTIONS are variables appended to CMAKE_{C,CXX}_FLAGS, and so + # apply to both C and C++ compilations. + list(APPEND TR_COMPILE_OPTIONS + -qarch=pwr7 + -qtls + -qnotempinc + -qenum=small + -qmbcs + -qfuncsect + -qsuppress=1540-1087:1540-1088:1540-1090:1540-029:1500-029 + -qdebug=nscrep ) -endif() + # Configure the platform dependent library for multithreading + set(OMR_PLATFORM_THREAD_LIBRARY -lpthread) +endif() -if(OMR_HOST_OS STREQUAL "aix") +if(OMR_OS_AIX) list(APPEND OMR_PLATFORM_COMPILE_OPTIONS -qlanglvl=extended -qinfo=pro @@ -62,31 +83,105 @@ if(OMR_HOST_OS STREQUAL "aix") set(CMAKE_C_ARCHIVE_FINISH " -X64 ") endif() -elseif(OMR_HOST_OS STREQUAL "linux") +elseif(OMR_OS_LINUX) list(APPEND OMR_PLATFORM_COMPILE_OPTIONS -qxflag=selinux ) -endif() +elseif(OMR_OS_ZOS) + # TODO: This should technically be -qhalt=w however c89 compiler used to compile the C sources does not like this + # flag. We'll need to investigate whether we actually need c89 for C sources or if we can use xlc and what to do + # with this flag. For now I'm leaving it as empty. + set(OMR_WARNING_AS_ERROR_FLAG ) + + # There is no enhanced warning for XLC right now + set(OMR_ENHANCED_WARNING_FLAG ) + + list(APPEND OMR_PLATFORM_COMPILE_OPTIONS + "\"-Wc,xplink\"" # link with xplink calling convention + "\"-Wc,rostring\"" # place string literals in read only storage + "\"-Wc,FLOAT(IEEE,FOLD,AFP)\"" # Use IEEE (instead of IBM Hex Format) style floats + "\"-Wc,enum(4)\"" # Specifies how many bytes of storage enums occupy + "\"-Wa,goff\"" # Assemble into GOFF object files + "\"-Wc,NOANSIALIAS\"" # Do not generate ALIAS binder control statements + "\"-Wc,TARGET(zOSV1R13)\"" # Generate code for the target operating system + ) + + list(APPEND OMR_PLATFORM_C_COMPILE_OPTIONS + "\"-Wc,ARCH(7)\"" + "\"-Wc,TUNE(10)\"" + "\"-Wc,langlvl(extc99)\"" + ) + + list(APPEND OMR_PLATFORM_CXX_COMPILE_OPTIONS + -+ # Compiles any file as a C++ language file + "\"-Wc,ARCH(7)\"" + "\"-Wc,TUNE(10)\"" + "\"-Wc,langlvl(extended)\"" + -qlanglvl=extended0x + ) + + list(APPEND OMR_PLATFORM_SHARED_COMPILE_OPTIONS + -Wc,DLL + -Wc,EXPORTALL + ) + + list(APPEND OMR_PLATFORM_SHARED_LINKER_OPTIONS + -Wl,xplink + -Wl,dll + ) + + if(OMR_ENV_DATA64) + list(APPEND OMR_PLATFORM_DEFINITIONS + -DJ9ZOS39064 + ) + + list(APPEND OMR_PLATFORM_COMPILE_OPTIONS + -Wc,lp64 + "\"-Wa,SYSPARM(BIT64)\"" + ) + + list(APPEND OMR_PLATFORM_SHARED_LINKER_OPTIONS + -Wl,lp64 + ) + else() + list(APPEND OMR_PLATFORM_DEFINITIONS + -D_LARGE_FILES + ) + endif() -# Testarossa build variables. Longer term the distinction between TR and the rest -# of the OMR code should be heavily reduced. In the mean time, we keep -# the distinction - -# TR_COMPILE_OPTIONS are variables appended to CMAKE_{C,CXX}_FLAGS, and so -# apply to both C and C++ compilations. -list(APPEND TR_COMPILE_OPTIONS - -qarch=pwr7 - -qtls - -qnotempinc - -qenum=small - -qmbcs - -qfuncsect - -qsuppress=1540-1087:1540-1088:1540-1090:1540-029:1500-029 - -qdebug=nscrep -) + # Testarossa build variables. Longer term the distinction between TR and the rest + # of the OMR code should be heavily reduced. In the mean time, we keep + # the distinction + + # TR_COMPILE_OPTIONS are variables appended to CMAKE_{C,CXX}_FLAGS, and so + # apply to both C and C++ compilations. + list(APPEND TR_COMPILE_OPTIONS + -DYYLMAX=1000 + -Wa,asa + ) + + list(APPEND TR_CXX_COMPILE_OPTIONS + -Wc,EXH + -qhaltonmsg=CCN6102 + -qnocsect + ) + + # Configure the platform dependent library for multithreading + set(OMR_PLATFORM_THREAD_LIBRARY "") + + function(_omr_toolchain_process_exports TARGET_NAME) + # We only need to do something if we are dealing with a shared library + get_target_property(target_type ${TARGET_NAME} TYPE) + if(NOT target_type STREQUAL "SHARED_LIBRARY") + return() + endif() + + target_compile_options(${TARGET_NAME} + PRIVATE + -Wc,DLL,EXPORTALL + ) + endfunction() +endif() set(SPP_CMD ${CMAKE_C_COMPILER}) set(SPP_FLAGS -E -P) - -# Configure the platform dependent library for multithreading -set(OMR_PLATFORM_THREAD_LIBRARY -lpthread) diff --git a/compiler/env/FEBase_t.hpp b/compiler/env/FEBase_t.hpp index c61380585a8..1a38e06942f 100644 --- a/compiler/env/FEBase_t.hpp +++ b/compiler/env/FEBase_t.hpp @@ -39,7 +39,7 @@ namespace TR // We should be relying on the port library to allocate memory, but this connection // has not yet been made, so as a quick workaround for platforms like OS X <= 10.9, // where MAP_ANONYMOUS is not defined, is to map MAP_ANON to MAP_ANONYMOUS ourselves -#if !defined(OMR_OS_WINDOWS) +#if defined(__APPLE__) #if !defined(MAP_ANONYMOUS) #define NO_MAP_ANONYMOUS #if defined(MAP_ANON) @@ -48,7 +48,7 @@ namespace TR #error unexpectedly, no MAP_ANONYMOUS or MAP_ANON definition #endif #endif -#endif /* OMR_OS_WINDOWS */ +#endif /* defined(__APPLE__) */ template uint8_t * @@ -65,6 +65,13 @@ FEBase::allocateRelocationData(TR::Compilation* comp, uint32_t size) size, MEM_COMMIT, PAGE_READWRITE)); +// TODO: Why is there no OMR_OS_ZOS? Or any other OS for that matter? +#elif defined(J9ZOS390) + // TODO: This is an absolute hack to get z/OS JITBuilder building and even remotely close to working. We really + // ought to be using the port library to allocate such memory. This was the quickest "workaround" I could think + // of to just get us off the ground. + return reinterpret_cast( + malloc(size)); #else return reinterpret_cast( mmap(0, diff --git a/compiler/ilgen/OMRMethodBuilder.cpp b/compiler/ilgen/OMRMethodBuilder.cpp index e7cb364c4fe..24ff0e26772 100644 --- a/compiler/ilgen/OMRMethodBuilder.cpp +++ b/compiler/ilgen/OMRMethodBuilder.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2018 IBM Corp. and others + * Copyright (c) 2016, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -620,7 +620,7 @@ OMR::MethodBuilder::getParameterTypes() TR_ASSERT_FATAL(symNamesIterator != _symbolNameFromSlot.end(), "No symbol found in slot %d", p); const char *name = symNamesIterator->second; - std::map::iterator symTypesIterator = _symbolTypes.find(name); + auto symTypesIterator = _symbolTypes.find(name); TR_ASSERT_FATAL(symTypesIterator != _symbolTypes.end(), "No matching symbol type for parameter '%s'", name); paramTypesArray[p] = symTypesIterator->second; } diff --git a/compiler/ilgen/StatementNames.hpp b/compiler/ilgen/StatementNames.hpp index ace26aba7bd..c26acc52239 100644 --- a/compiler/ilgen/StatementNames.hpp +++ b/compiler/ilgen/StatementNames.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2018 IBM Corp. and others + * Copyright (c) 2018, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -22,7 +22,7 @@ #ifndef OMR_STATEMENTNAMES_INCL #define OMR_STATEMENTNAMES_INCL -#include +#include namespace OMR { diff --git a/compiler/infra/OMRMonitor.hpp b/compiler/infra/OMRMonitor.hpp index ca13ddf1401..5321f662fc5 100644 --- a/compiler/infra/OMRMonitor.hpp +++ b/compiler/infra/OMRMonitor.hpp @@ -58,7 +58,12 @@ class Monitor char const *getName(); bool init(char *name); +#if defined(J9ZOS390) + // xlc cannot handle private delete operator + public: +#else private: +#endif void *operator new(size_t size); void operator delete(void *p); diff --git a/compiler/z/codegen/OMRInstOpCodeProperties.hpp b/compiler/z/codegen/OMRInstOpCodeProperties.hpp index 5f3c4184f66..50e517e5bc3 100644 --- a/compiler/z/codegen/OMRInstOpCodeProperties.hpp +++ b/compiler/z/codegen/OMRInstOpCodeProperties.hpp @@ -1033,7 +1033,7 @@ /* .description = */ "BRANCH ON CONDITION", /* .opcode[0] = */ 0x47, /* .opcode[1] = */ 0x00, - /* .format = */ RXb_FORMAT, + /* .format = */ RXa_FORMAT, /* .minimumALS = */ CPU::Architecture::z900, /* .properties = */ S390OpProp_BranchOp | S390OpProp_ReadsCC | diff --git a/ddr/include/ddr/config.hpp b/ddr/include/ddr/config.hpp index f12d72c1825..dde39b9efeb 100644 --- a/ddr/include/ddr/config.hpp +++ b/ddr/include/ddr/config.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2018 IBM Corp. and others + * Copyright (c) 2015, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -29,14 +29,20 @@ #if defined(J9ZOS390) /* We need to define these for the limit macros to get defined in z/OS */ +#if !defined(_ISOC99_SOURCE) #define _ISOC99_SOURCE 1 +#endif +#if !defined(__STDC_LIMIT_MACROS) #define __STDC_LIMIT_MACROS 1 +#endif #endif /* defined(J9ZOS390) */ /* C++ TR1 support */ #if defined(AIXPPC) || defined(J9ZOS390) +#if !defined(__IBMCPP_TR1__) #define __IBMCPP_TR1__ 1 +#endif #define OMR_HAVE_TR1 1 #else #define OMR_HAVE_CXX11 1 diff --git a/fvtest/compilertest/build/toolcfg/gnu/common.mk b/fvtest/compilertest/build/toolcfg/gnu/common.mk index 35ee744e100..7c01d44f0dc 100644 --- a/fvtest/compilertest/build/toolcfg/gnu/common.mk +++ b/fvtest/compilertest/build/toolcfg/gnu/common.mk @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2016, 2018 IBM Corp. and others +# Copyright (c) 2016, 2019 IBM Corp. and others # # This program and the accompanying materials are made available under # the terms of the Eclipse Public License 2.0 which accompanies this @@ -142,15 +142,13 @@ ifeq ($(HOST_ARCH),p) endif ifeq ($(HOST_ARCH),z) - ifeq ($(HOST_BITS),32) - CX_DEFINES+=J9VM_TIERED_CODE_CACHE MAXMOVE S390 FULL_ANSI - CX_FLAGS+=-m31 -fPIC -fno-strict-aliasing -mtune=z10 -march=z9-109 -mzarch - CX_FLAGS_DEBUG+=-gdwarf-2 - endif - ifeq ($(HOST_BITS),64) - CX_DEFINES+=S390 S39064 FULL_ANSI MAXMOVE J9VM_TIERED_CODE_CACHE + CX_DEFINES+=S390 FULL_ANSI S39064 CX_FLAGS+=-fPIC -fno-strict-aliasing -mtune=z10 -march=z9-109 -mzarch + else + CX_DEFINES+=S390 FULL_ANSI + CX_FLAGS+=-m31 -fPIC -fno-strict-aliasing -mtune=z10 -march=z9-109 -mzarch + CX_FLAGS_DEBUG+=-gdwarf-2 endif endif @@ -321,7 +319,7 @@ ifeq ($(HOST_ARCH),z) M4_CMD?=$(M4_PATH) M4_INCLUDES=$(PRODUCT_INCLUDES) - M4_DEFINES+=$(HOST_DEFINES) $(TARGET_DEFINES) J9VM_TIERED_CODE_CACHE + M4_DEFINES+=$(HOST_DEFINES) $(TARGET_DEFINES) M4_DEFINES+=$(M4_DEFINES_EXTRA) M4_FLAGS+=$(M4_FLAGS_EXTRA) diff --git a/fvtest/compilertest/runtime/TestCodeCacheManager.cpp b/fvtest/compilertest/runtime/TestCodeCacheManager.cpp index 9314c576cff..50c941cc81e 100644 --- a/fvtest/compilertest/runtime/TestCodeCacheManager.cpp +++ b/fvtest/compilertest/runtime/TestCodeCacheManager.cpp @@ -67,6 +67,12 @@ TestCompiler::CodeCacheManager::allocateCodeCacheSegment(size_t segmentSize, codeCacheSizeToAllocate, MEM_COMMIT, PAGE_EXECUTE_READWRITE)); +#elif defined(J9ZOS390) + // TODO: This is an absolute hack to get z/OS JITBuilder building and even remotely close to working. We really + // ought to be using the port library to allocate such memory. This was the quickest "workaround" I could think + // of to just get us off the ground. + auto memorySlab = reinterpret_cast( + malloc(codeCacheSizeToAllocate)); #else auto memorySlab = reinterpret_cast( mmap(NULL, diff --git a/fvtest/compilertest/tests/LimitFileTest.cpp b/fvtest/compilertest/tests/LimitFileTest.cpp index 4e822119f06..665f33e6576 100644 --- a/fvtest/compilertest/tests/LimitFileTest.cpp +++ b/fvtest/compilertest/tests/LimitFileTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2018 IBM Corp. and others + * Copyright (c) 2016, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -19,6 +19,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception *******************************************************************************/ +#if defined(GTEST_HAS_DEATH_TEST) #include "tests/LimitFileTest.hpp" #include @@ -250,8 +251,10 @@ TEST_F(LimitFileTest, UseLimitFileRangeTest) int iNegLine; createAndCheckVLog(limitFile, NULL, &iNegLine); - // Note VC++ 2010 doesn't support std::to_string(int). - std::string iNegLineStr = std::to_string(static_cast(iNegLine)); + std::ostringstream ss; + ss << static_cast(iNegLine); + + std::string iNegLineStr = ss.str(); std::string limitArg = std::string("(") + limitFile + "," + iNegLineStr + "," + iNegLineStr + ")"; createVLog(vlog, limitArg.c_str()); @@ -270,9 +273,14 @@ TEST_F(LimitFileTest, UseLimitFileBoundTest) createAndCheckVLog(limitFile, NULL, &iNegLine); iNegLine++; // Start at line after iNeg. - std::string limitArg = std::string("(") + limitFile + "," + std::to_string(static_cast(iNegLine)) + ")"; + + std::ostringstream ss; + ss << static_cast(iNegLine); + + std::string limitArg = std::string("(") + limitFile + "," + ss.str() + ")"; createVLog(vlog, limitArg.c_str()); checkVLogForMethod(vlog, "iNeg", NULL); } } +#endif /* defined(GTEST_HAS_DEATH_TEST) */ diff --git a/fvtest/compilertest/tests/LogFileTest.cpp b/fvtest/compilertest/tests/LogFileTest.cpp index d6eedff6e03..d14994b470a 100644 --- a/fvtest/compilertest/tests/LogFileTest.cpp +++ b/fvtest/compilertest/tests/LogFileTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2018 IBM Corp. and others + * Copyright (c) 2016, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -19,6 +19,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception *******************************************************************************/ +#if defined(GTEST_HAS_DEATH_TEST) #include "tests/LogFileTest.hpp" #include @@ -74,7 +75,7 @@ TestCompiler::LogFileTest::fileExists(std::string name) bool TestCompiler::LogFileTest::fileIsNotEmpty(std::string logFile) { - std::ifstream logFileStream(logFile); + std::ifstream logFileStream(logFile.c_str()); return logFileStream.peek() != std::ifstream::traits_type::eof(); } @@ -88,7 +89,7 @@ TestCompiler::LogFileTest::fileIsNotEmpty(std::string logFile) */ std::map -TestCompiler::LogFileTest::buildKeywordMap(std::initializer_list inputs) +TestCompiler::LogFileTest::buildKeywordMap(std::vector inputs) { std::map keywords; for (auto w = inputs.begin(); w != inputs.end(); w++) @@ -247,16 +248,20 @@ TEST_F(LogFileTest, EmptyTFLogTest) TEST_F(LogFileTest, KeywordsLogTest) { std::map> logFileChecks; + /* Additional pairs of log types and keywords to look for can be added to logFileChecks like this. A failure is asserted if any of the keywords cannot be found in the associated log type. */ + const char* keywordsTraceFull[] = { "", "BBStart", "BBEnd", "> - ("traceFull", buildKeywordMap({"", "BBStart", "BBEnd", "(keywordsTraceFull, keywordsTraceFull + sizeof(keywordsTraceFull) / sizeof(const char*))))); + const char* keywordsTraceCG[] = { "> - ("traceCG", buildKeywordMap({"(keywordsTraceCG, keywordsTraceCG + sizeof(keywordsTraceCG) / sizeof(const char*))))); runKeywordTests(logFileChecks); } } +#endif /* defined(GTEST_HAS_DEATH_TEST) */ diff --git a/fvtest/compilertest/tests/LogFileTest.hpp b/fvtest/compilertest/tests/LogFileTest.hpp index 125e1608723..3a74e81f03a 100644 --- a/fvtest/compilertest/tests/LogFileTest.hpp +++ b/fvtest/compilertest/tests/LogFileTest.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2016 IBM Corp. and others + * Copyright (c) 2016, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -38,7 +38,7 @@ class LogFileTest : public ::testing::Test void checkLogForKeywords(std::map keywords, const char *logFile); void runKeywordTests(std::map> logFileChecks); bool fileIsNotEmpty(std::string logFile); - std::map buildKeywordMap(std::initializer_list inputs); + std::map buildKeywordMap(std::vector inputs); private: std::vector _logFiles; diff --git a/fvtest/compilertest/tests/OpCodesTest.hpp b/fvtest/compilertest/tests/OpCodesTest.hpp index 7c59a08da64..b9cba1f8118 100644 --- a/fvtest/compilertest/tests/OpCodesTest.hpp +++ b/fvtest/compilertest/tests/OpCodesTest.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corp. and others + * Copyright (c) 2000, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -45,6 +45,12 @@ #include "tests/injectors/TernaryOpIlInjector.hpp" #include "tests/injectors/UnaryOpIlInjector.hpp" +#if defined(J9ZOS390) +namespace std +{ + using ::isnan; +} +#endif namespace TR { class ResolvedMethod; } diff --git a/fvtest/compilertest/tests/OptionSetTest.cpp b/fvtest/compilertest/tests/OptionSetTest.cpp index 75f4173b66b..039b3cc19aa 100644 --- a/fvtest/compilertest/tests/OptionSetTest.cpp +++ b/fvtest/compilertest/tests/OptionSetTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2016 IBM Corp. and others + * Copyright (c) 2016, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -19,6 +19,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception *******************************************************************************/ +#if defined(GTEST_HAS_DEATH_TEST) #include "tests/OptionSetTest.hpp" #include @@ -162,3 +163,4 @@ TEST_F(OptionSetTest, WithDefault) } } +#endif /* defined(GTEST_HAS_DEATH_TEST) */ diff --git a/fvtest/compilertest/tests/OptionSetTest.hpp b/fvtest/compilertest/tests/OptionSetTest.hpp index 52c3426954b..b25c121e020 100644 --- a/fvtest/compilertest/tests/OptionSetTest.hpp +++ b/fvtest/compilertest/tests/OptionSetTest.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2016 IBM Corp. and others + * Copyright (c) 2016, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -29,7 +29,7 @@ namespace TestCompiler { -typedef std::map MethodSets; +typedef std::map MethodSets; class OptionSetTest : public LimitFileTest { diff --git a/fvtest/compilertriltest/ArithmeticTest.cpp b/fvtest/compilertriltest/ArithmeticTest.cpp index 8afcd11e6f8..2e57ab5c2a9 100644 --- a/fvtest/compilertriltest/ArithmeticTest.cpp +++ b/fvtest/compilertriltest/ArithmeticTest.cpp @@ -25,6 +25,13 @@ #include +#if defined(J9ZOS390) +namespace std +{ + using ::isnan; +} +#endif + int32_t iadd(int32_t l, int32_t r) { return l+r; } @@ -109,7 +116,7 @@ TEST_P(Int32Arithmetic, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -136,7 +143,7 @@ TEST_P(Int32Arithmetic, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -167,7 +174,7 @@ TEST_P(UInt32Arithmetic, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -198,7 +205,7 @@ TEST_P(UInt32Arithmetic, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -225,7 +232,7 @@ TEST_P(Int64Arithmetic, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -252,7 +259,7 @@ TEST_P(Int64Arithmetic, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -283,7 +290,7 @@ TEST_P(UInt64Arithmetic, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -314,7 +321,7 @@ TEST_P(UInt64Arithmetic, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -325,17 +332,17 @@ TEST_P(UInt64Arithmetic, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(ArithmeticTest, Int32Arithmetic, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("iadd", iadd), - std::make_tuple("isub", isub), - std::make_tuple("imul", imul), - std::make_tuple("imulh", imulh) ))); + std::make_tuple("iadd", iadd), + std::make_tuple("isub", isub), + std::make_tuple("imul", imul), + std::make_tuple("imulh", imulh)))); INSTANTIATE_TEST_CASE_P(ArithmeticTest, Int64Arithmetic, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("ladd", ladd), - std::make_tuple("lsub", lsub), - std::make_tuple("lmul", lmul) ))); + std::make_tuple("ladd", ladd), + std::make_tuple("lsub", lsub), + std::make_tuple("lmul", lmul)))); /** * @brief Filter function for *div opcodes @@ -363,15 +370,15 @@ INSTANTIATE_TEST_CASE_P(DivArithmeticTest, Int32Arithmetic, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_value_pairs(), div_filter )), ::testing::Values( - std::make_tuple("idiv", idiv), - std::make_tuple("irem", irem) ))); + std::make_tuple("idiv", idiv), + std::make_tuple("irem", irem)))); INSTANTIATE_TEST_CASE_P(DivArithmeticTest, Int64Arithmetic, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_value_pairs(), div_filter )), ::testing::Values( - std::make_tuple("ldiv", _ldiv), - std::make_tuple("lrem", lrem) ))); + std::make_tuple("ldiv", _ldiv), + std::make_tuple("lrem", lrem)))); /** * @brief Filter function for *udiv opcodes @@ -391,14 +398,14 @@ INSTANTIATE_TEST_CASE_P(DivArithmeticTest, UInt32Arithmetic, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_value_pairs(), udiv_filter )), ::testing::Values( - std::make_tuple("iudiv", iudiv), - std::make_tuple("iurem", iurem) ))); + std::make_tuple("iudiv", iudiv), + std::make_tuple("iurem", iurem)))); INSTANTIATE_TEST_CASE_P(DivArithmeticTest, UInt64Arithmetic, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_value_pairs(), udiv_filter )), ::testing::Values( - std::make_tuple("ludiv", ludiv) ))); + std::make_tuple("ludiv", ludiv)))); template bool smallFp_filter(std::tuple a) @@ -446,7 +453,7 @@ TEST_P(FloatArithmetic, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -477,7 +484,7 @@ TEST_P(FloatArithmetic, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -495,10 +502,10 @@ INSTANTIATE_TEST_CASE_P(ArithmeticTest, FloatArithmetic, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_value_pairs(), smallFp_filter)), ::testing::Values( - std::make_tuple("fadd", static_cast(fadd)), - std::make_tuple("fsub", static_cast(fsub)), - std::make_tuple("fmul", static_cast(fmul)), - std::make_tuple("fdiv", static_cast(fdiv)) + std::make_tuple("fadd", static_cast(fadd)), + std::make_tuple("fsub", static_cast(fsub)), + std::make_tuple("fmul", static_cast(fmul)), + std::make_tuple("fdiv", static_cast(fdiv)) ))); double dadd(double l, double r) { @@ -538,7 +545,7 @@ TEST_P(DoubleArithmetic, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -569,7 +576,7 @@ TEST_P(DoubleArithmetic, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -587,10 +594,10 @@ INSTANTIATE_TEST_CASE_P(ArithmeticTest, DoubleArithmetic, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_value_pairs(), smallFp_filter)), ::testing::Values( - std::make_tuple("dadd", dadd), - std::make_tuple("dsub", dsub), - std::make_tuple("dmul", dmul), - std::make_tuple("ddiv", ddiv) + std::make_tuple("dadd", dadd), + std::make_tuple("dsub", dsub), + std::make_tuple("dmul", dmul), + std::make_tuple("ddiv", ddiv) ))); template @@ -623,7 +630,7 @@ TEST_P(FloatUnaryArithmetic, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -653,7 +660,7 @@ TEST_P(FloatUnaryArithmetic, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -671,8 +678,8 @@ INSTANTIATE_TEST_CASE_P(ArithmeticTest, FloatUnaryArithmetic, ::testing::Combine ::testing::ValuesIn( TRTest::filter(TRTest::const_values(), smallFp_unary_filter)), ::testing::Values( - std::make_tuple("fabs", static_cast(std::abs)), - std::make_tuple("fneg", fneg) + std::make_tuple("fabs", static_cast(std::abs)), + std::make_tuple("fneg", fneg) ))); double dneg(double x) { @@ -698,7 +705,7 @@ TEST_P(DoubleUnaryArithmetic, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -728,7 +735,7 @@ TEST_P(DoubleUnaryArithmetic, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -746,6 +753,6 @@ INSTANTIATE_TEST_CASE_P(ArithmeticTest, DoubleUnaryArithmetic, ::testing::Combin ::testing::ValuesIn( TRTest::filter(TRTest::const_values(), smallFp_unary_filter)), ::testing::Values( - std::make_tuple("dabs", static_cast(std::abs)), - std::make_tuple("dneg", dneg) + std::make_tuple("dabs", static_cast(std::abs)), + std::make_tuple("dneg", dneg) ))); diff --git a/fvtest/compilertriltest/BitPermuteTest.cpp b/fvtest/compilertriltest/BitPermuteTest.cpp index 713f937444b..d074683bd9a 100644 --- a/fvtest/compilertriltest/BitPermuteTest.cpp +++ b/fvtest/compilertriltest/BitPermuteTest.cpp @@ -158,7 +158,7 @@ TEST_P(lBitPermuteTest, ConstAddressLengthTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -189,7 +189,7 @@ TEST_P(lBitPermuteTest, ConstAddressTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -219,7 +219,7 @@ TEST_P(lBitPermuteTest, NoConstTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -257,7 +257,7 @@ TEST_P(iBitPermuteTest, ConstAddressLengthTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -292,7 +292,7 @@ TEST_P(iBitPermuteTest, ConstAddressTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -326,7 +326,7 @@ TEST_P(iBitPermuteTest, NoConstTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -368,7 +368,7 @@ TEST_P(sBitPermuteTest, ConstAddressLengthTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -407,7 +407,7 @@ TEST_P(sBitPermuteTest, ConstAddressTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -445,7 +445,7 @@ TEST_P(sBitPermuteTest, NoConstTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -487,7 +487,7 @@ TEST_P(bBitPermuteTest, ConstAddressLengthTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -526,7 +526,7 @@ TEST_P(bBitPermuteTest, ConstAddressTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -564,7 +564,7 @@ TEST_P(bBitPermuteTest, NoConstTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; diff --git a/fvtest/compilertriltest/CMakeLists.txt b/fvtest/compilertriltest/CMakeLists.txt index 1573dbb0eb9..293a61acac0 100644 --- a/fvtest/compilertriltest/CMakeLists.txt +++ b/fvtest/compilertriltest/CMakeLists.txt @@ -55,6 +55,10 @@ target_link_libraries(comptest tril ) +if(OMR_HOST_OS STREQUAL "zos") + target_link_libraries(comptest j9a2e) +endif() + set_property(TARGET comptest PROPERTY FOLDER fvtest) add_test( diff --git a/fvtest/compilertriltest/CallTest.cpp b/fvtest/compilertriltest/CallTest.cpp index 1326e39cf20..5e8e0e79483 100644 --- a/fvtest/compilertriltest/CallTest.cpp +++ b/fvtest/compilertriltest/CallTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2018 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -38,7 +38,7 @@ TEST_F(CallTest, icallOracle) { // do not have trampoline support, and so this call may be out of // range for some architectures. #ifdef TR_TARGET_X86 - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; auto entry_point = compiler.getEntryPoint(); diff --git a/fvtest/compilertriltest/CompareTest.cpp b/fvtest/compilertriltest/CompareTest.cpp index 198ad8547a4..ac05ce7dd99 100644 --- a/fvtest/compilertriltest/CompareTest.cpp +++ b/fvtest/compilertriltest/CompareTest.cpp @@ -66,7 +66,7 @@ TEST_P(Int32Compare, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -92,7 +92,7 @@ TEST_P(Int32Compare, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -105,12 +105,13 @@ TEST_P(Int32Compare, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(CompareTest, Int32Compare, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("icmpeq", icmpeq), - std::make_tuple("icmpne", icmpne), - std::make_tuple("icmpgt", icmpgt), - std::make_tuple("icmpge", icmpge), - std::make_tuple("icmplt", icmplt), - std::make_tuple("icmple", icmple) ))); + std::make_tuple("icmpeq", icmpeq), + std::make_tuple("icmpne", icmpne), + std::make_tuple("icmpgt", icmpgt), + std::make_tuple("icmpge", icmpge), + std::make_tuple("icmplt", icmplt), + std::make_tuple("icmple", icmple) + ))); int32_t iucmpeq(uint32_t l, uint32_t r) { return (l == r) ? 1 : 0; @@ -154,7 +155,7 @@ TEST_P(UInt32Compare, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -180,7 +181,7 @@ TEST_P(UInt32Compare, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -193,12 +194,13 @@ TEST_P(UInt32Compare, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(CompareTest, UInt32Compare, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("iucmpeq", iucmpeq), - std::make_tuple("iucmpne", iucmpne), - std::make_tuple("iucmpgt", iucmpgt), - std::make_tuple("iucmpge", iucmpge), - std::make_tuple("iucmplt", iucmplt), - std::make_tuple("iucmple", iucmple) ))); + std::make_tuple("iucmpeq", iucmpeq), + std::make_tuple("iucmpne", iucmpne), + std::make_tuple("iucmpgt", iucmpgt), + std::make_tuple("iucmpge", iucmpge), + std::make_tuple("iucmplt", iucmplt), + std::make_tuple("iucmple", iucmple) + ))); int32_t lcmpeq(int64_t l, int64_t r) { return (l == r) ? 1 : 0; @@ -246,7 +248,7 @@ TEST_P(Int64Compare, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -272,7 +274,7 @@ TEST_P(Int64Compare, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -285,14 +287,14 @@ TEST_P(Int64Compare, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(CompareTest, Int64Compare, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("lcmpeq", lcmpeq), - std::make_tuple("lcmpne", lcmpne), - std::make_tuple("lcmpgt", lcmpgt), - std::make_tuple("lcmpge", lcmpge), - std::make_tuple("lcmplt", lcmplt), - std::make_tuple("lcmple", lcmple), - std::make_tuple("lcmp", lcmp) - ))); + std::make_tuple("lcmpeq", lcmpeq), + std::make_tuple("lcmpne", lcmpne), + std::make_tuple("lcmpgt", lcmpgt), + std::make_tuple("lcmpge", lcmpge), + std::make_tuple("lcmplt", lcmplt), + std::make_tuple("lcmple", lcmple), + std::make_tuple("lcmp", lcmp) + ))); int32_t lucmpeq(uint64_t l, uint64_t r) { return (l == r) ? 1 : 0; @@ -336,7 +338,7 @@ TEST_P(UInt64Compare, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -362,7 +364,7 @@ TEST_P(UInt64Compare, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -375,12 +377,13 @@ TEST_P(UInt64Compare, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(CompareTest, UInt64Compare, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("lucmpeq", lucmpeq), - std::make_tuple("lucmpne", lucmpne), - std::make_tuple("lucmpgt", lucmpgt), - std::make_tuple("lucmpge", lucmpge), - std::make_tuple("lucmplt", lucmplt), - std::make_tuple("lucmple", lucmple) ))); + std::make_tuple("lucmpeq", lucmpeq), + std::make_tuple("lucmpne", lucmpne), + std::make_tuple("lucmpgt", lucmpgt), + std::make_tuple("lucmpge", lucmpge), + std::make_tuple("lucmplt", lucmplt), + std::make_tuple("lucmple", lucmple) + ))); static const int32_t IFCMP_TRUE_NUM = 123; static const int32_t IFCMP_FALSE_NUM = -456; @@ -429,7 +432,7 @@ TEST_P(Int32IfCompare, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -457,7 +460,7 @@ TEST_P(Int32IfCompare, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -470,12 +473,12 @@ TEST_P(Int32IfCompare, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(CompareTest, Int32IfCompare, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("ificmpeq", ificmpeq), - std::make_tuple("ificmpne", ificmpne), - std::make_tuple("ificmplt", ificmplt), - std::make_tuple("ificmple", ificmple), - std::make_tuple("ificmpge", ificmpge), - std::make_tuple("ificmpgt", ificmpgt) + std::make_tuple("ificmpeq", ificmpeq), + std::make_tuple("ificmpne", ificmpne), + std::make_tuple("ificmplt", ificmplt), + std::make_tuple("ificmple", ificmple), + std::make_tuple("ificmpge", ificmpge), + std::make_tuple("ificmpgt", ificmpgt) ))); int32_t ifiucmpeq(uint32_t l, uint32_t r) { @@ -522,7 +525,7 @@ TEST_P(UInt32IfCompare, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -550,7 +553,7 @@ TEST_P(UInt32IfCompare, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -563,12 +566,12 @@ TEST_P(UInt32IfCompare, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(CompareTest, UInt32IfCompare, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("ifiucmpeq", ifiucmpeq), - std::make_tuple("ifiucmpne", ifiucmpne), - std::make_tuple("ifiucmplt", ifiucmplt), - std::make_tuple("ifiucmple", ifiucmple), - std::make_tuple("ifiucmpge", ifiucmpge), - std::make_tuple("ifiucmpgt", ifiucmpgt) + std::make_tuple("ifiucmpeq", ifiucmpeq), + std::make_tuple("ifiucmpne", ifiucmpne), + std::make_tuple("ifiucmplt", ifiucmplt), + std::make_tuple("ifiucmple", ifiucmple), + std::make_tuple("ifiucmpge", ifiucmpge), + std::make_tuple("ifiucmpgt", ifiucmpgt) ))); int32_t iflcmpeq(int64_t l, int64_t r) { @@ -615,7 +618,7 @@ TEST_P(Int64IfCompare, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -643,7 +646,7 @@ TEST_P(Int64IfCompare, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -656,12 +659,12 @@ TEST_P(Int64IfCompare, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(CompareTest, Int64IfCompare, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("iflcmpeq", iflcmpeq), - std::make_tuple("iflcmpne", iflcmpne), - std::make_tuple("iflcmplt", iflcmplt), - std::make_tuple("iflcmple", iflcmple), - std::make_tuple("iflcmpge", iflcmpge), - std::make_tuple("iflcmpgt", iflcmpgt) + std::make_tuple("iflcmpeq", iflcmpeq), + std::make_tuple("iflcmpne", iflcmpne), + std::make_tuple("iflcmplt", iflcmplt), + std::make_tuple("iflcmple", iflcmple), + std::make_tuple("iflcmpge", iflcmpge), + std::make_tuple("iflcmpgt", iflcmpgt) ))); int32_t iflucmpeq(uint64_t l, uint64_t r) { @@ -708,7 +711,7 @@ TEST_P(UInt64IfCompare, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -736,7 +739,7 @@ TEST_P(UInt64IfCompare, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -749,12 +752,12 @@ TEST_P(UInt64IfCompare, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(CompareTest, UInt64IfCompare, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("iflucmpeq", iflucmpeq), - std::make_tuple("iflucmpne", iflucmpne), - std::make_tuple("iflucmplt", iflucmplt), - std::make_tuple("iflucmple", iflucmple), - std::make_tuple("iflucmpge", iflucmpge), - std::make_tuple("iflucmpgt", iflucmpgt) + std::make_tuple("iflucmpeq", iflucmpeq), + std::make_tuple("iflucmpne", iflucmpne), + std::make_tuple("iflucmplt", iflucmplt), + std::make_tuple("iflucmple", iflucmple), + std::make_tuple("iflucmpge", iflucmpge), + std::make_tuple("iflucmpgt", iflucmpgt) ))); template @@ -808,7 +811,7 @@ TEST_P(FloatCompare, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -834,7 +837,7 @@ TEST_P(FloatCompare, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -848,12 +851,12 @@ INSTANTIATE_TEST_CASE_P(CompareTest, FloatCompare, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_value_pairs(), smallFp_filter)), ::testing::Values( - std::make_tuple("fcmpeq", fcmpeq), - std::make_tuple("fcmpne", fcmpne), - std::make_tuple("fcmpgt", fcmpgt), - std::make_tuple("fcmpge", fcmpge), - std::make_tuple("fcmplt", fcmplt), - std::make_tuple("fcmple", fcmple) + std::make_tuple("fcmpeq", fcmpeq), + std::make_tuple("fcmpne", fcmpne), + std::make_tuple("fcmpgt", fcmpgt), + std::make_tuple("fcmpge", fcmpge), + std::make_tuple("fcmplt", fcmplt), + std::make_tuple("fcmple", fcmple) ))); int32_t dcmpeq(double l, double r) { @@ -898,7 +901,7 @@ TEST_P(DoubleCompare, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -924,7 +927,7 @@ TEST_P(DoubleCompare, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -938,12 +941,12 @@ INSTANTIATE_TEST_CASE_P(CompareTest, DoubleCompare, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_value_pairs(), smallFp_filter)), ::testing::Values( - std::make_tuple("dcmpeq", dcmpeq), - std::make_tuple("dcmpne", dcmpne), - std::make_tuple("dcmpgt", dcmpgt), - std::make_tuple("dcmpge", dcmpge), - std::make_tuple("dcmplt", dcmplt), - std::make_tuple("dcmple", dcmple) + std::make_tuple("dcmpeq", dcmpeq), + std::make_tuple("dcmpne", dcmpne), + std::make_tuple("dcmpgt", dcmpgt), + std::make_tuple("dcmpge", dcmpge), + std::make_tuple("dcmplt", dcmplt), + std::make_tuple("dcmple", dcmple) ))); int32_t iffcmpeq(float l, float r) { @@ -990,7 +993,7 @@ TEST_P(FloatIfCompare, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1018,7 +1021,7 @@ TEST_P(FloatIfCompare, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1032,12 +1035,12 @@ INSTANTIATE_TEST_CASE_P(CompareTest, FloatIfCompare, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_value_pairs(), smallFp_filter)), ::testing::Values( - std::make_tuple("iffcmpeq", iffcmpeq), - std::make_tuple("iffcmpne", iffcmpne), - std::make_tuple("iffcmplt", iffcmplt), - std::make_tuple("iffcmple", iffcmple), - std::make_tuple("iffcmpge", iffcmpge), - std::make_tuple("iffcmpgt", iffcmpgt) + std::make_tuple("iffcmpeq", iffcmpeq), + std::make_tuple("iffcmpne", iffcmpne), + std::make_tuple("iffcmplt", iffcmplt), + std::make_tuple("iffcmple", iffcmple), + std::make_tuple("iffcmpge", iffcmpge), + std::make_tuple("iffcmpgt", iffcmpgt) ))); int32_t ifdcmpeq(double l, double r) { @@ -1084,7 +1087,7 @@ TEST_P(DoubleIfCompare, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1112,7 +1115,7 @@ TEST_P(DoubleIfCompare, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1126,10 +1129,10 @@ INSTANTIATE_TEST_CASE_P(CompareTest, DoubleIfCompare, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_value_pairs(), smallFp_filter)), ::testing::Values( - std::make_tuple("ifdcmpeq", ifdcmpeq), - std::make_tuple("ifdcmpne", ifdcmpne), - std::make_tuple("ifdcmplt", ifdcmplt), - std::make_tuple("ifdcmple", ifdcmple), - std::make_tuple("ifdcmpge", ifdcmpge), - std::make_tuple("ifdcmpgt", ifdcmpgt) + std::make_tuple("ifdcmpeq", ifdcmpeq), + std::make_tuple("ifdcmpne", ifdcmpne), + std::make_tuple("ifdcmplt", ifdcmplt), + std::make_tuple("ifdcmple", ifdcmple), + std::make_tuple("ifdcmpge", ifdcmpge), + std::make_tuple("ifdcmpgt", ifdcmpgt) ))); diff --git a/fvtest/compilertriltest/ILValidatorTest.cpp b/fvtest/compilertriltest/ILValidatorTest.cpp index 44f482e7e28..e29763800c5 100644 --- a/fvtest/compilertriltest/ILValidatorTest.cpp +++ b/fvtest/compilertriltest/ILValidatorTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -33,7 +33,7 @@ TEST_P(IllformedTrees, FailCompilation) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(compiler.compile(), COMPILATION_IL_VALIDATION_FAILURE) << "Compilation did not fail due to ill-formed input trees"; @@ -65,7 +65,7 @@ TEST_P(WellformedTrees, CompileOnly) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly"; } @@ -102,7 +102,7 @@ TEST_P(CommoningTest, CommoningUnderSameTree) auto ast = parseString(tril); ASSERT_NOTNULL(ast) << "Parsing failed unexpectedly"; - Tril::DefaultCompiler compiler{ast}; + Tril::DefaultCompiler compiler(ast); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly"; auto entry_point = compiler.getEntryPoint(); @@ -131,7 +131,7 @@ TEST_P(CommoningTest, CommoningWithinBlock) auto ast = parseString(tril); ASSERT_NOTNULL(ast) << "Parsing failed unexpectedly"; - Tril::DefaultCompiler compiler{ast}; + Tril::DefaultCompiler compiler(ast); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly"; auto entry_point = compiler.getEntryPoint(); @@ -166,7 +166,7 @@ TEST_F(InvalidCommoningTest, CommoningAcrossBlock) auto ast = parseString(tril); ASSERT_NOTNULL(ast) << "Parsing failed unexpectedly"; - Tril::DefaultCompiler compiler{ast}; + Tril::DefaultCompiler compiler(ast); ASSERT_EQ(compiler.compile(), COMPILATION_IL_VALIDATION_FAILURE) << "Compilation did not fail due to ill-formed input trees"; diff --git a/fvtest/compilertriltest/IfxcmpgeReductionTest.cpp b/fvtest/compilertriltest/IfxcmpgeReductionTest.cpp index e08ca6c2b4c..9c6a175bca1 100644 --- a/fvtest/compilertriltest/IfxcmpgeReductionTest.cpp +++ b/fvtest/compilertriltest/IfxcmpgeReductionTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -117,7 +117,7 @@ TEST_P(Int8ReductionTest, Reduction) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -161,7 +161,7 @@ TEST_P(UInt8ReductionTest, Reduction) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -205,7 +205,7 @@ TEST_P(Int16ReductionTest, Reduction) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -249,7 +249,7 @@ TEST_P(UInt16ReductionTest, Reduction) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -292,7 +292,7 @@ TEST_P(Int32ReductionTest, Reduction) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -335,7 +335,7 @@ TEST_P(UInt32ReductionTest, Reduction) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -378,7 +378,7 @@ TEST_P(Int64ReductionTest, Reduction) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -421,7 +421,7 @@ TEST_P(UInt64ReductionTest, Reduction) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; diff --git a/fvtest/compilertriltest/JitTest.hpp b/fvtest/compilertriltest/JitTest.hpp index f1fd1ca1205..370788cfd6a 100644 --- a/fvtest/compilertriltest/JitTest.hpp +++ b/fvtest/compilertriltest/JitTest.hpp @@ -250,7 +250,7 @@ class JitOptTest : public JitTest template std::vector> combine(L l, R r) { - auto v = std::vector>{}; + auto v = std::vector>(); v.reserve((l.end() - l.begin())*(r.end() - r.begin())); for (auto i = l.begin(); i != l.end(); ++i) for (auto j = r.begin(); j != r.end(); ++j) @@ -276,9 +276,9 @@ std::vector> combine( * */ template -std::vector> combine(std::initializer_list l, std::initializer_list r) +std::vector> combine(std::vector l, std::vector r) { - auto v = std::vector>{}; + auto v = std::vector>(); v.reserve((l.end() - l.begin())*(r.end() - r.begin())); for (auto i = l.begin(); i != l.end(); ++i) for (auto j = r.begin(); j != r.end(); ++j) diff --git a/fvtest/compilertriltest/JitTestUtilitiesTest.cpp b/fvtest/compilertriltest/JitTestUtilitiesTest.cpp index 7f2f50ab3e9..4cb3478d64f 100644 --- a/fvtest/compilertriltest/JitTestUtilitiesTest.cpp +++ b/fvtest/compilertriltest/JitTestUtilitiesTest.cpp @@ -32,11 +32,6 @@ TEST(PtrTest, AssertNotNullWithNonNullValue) ASSERT_NOTNULL(reinterpret_cast(0x1)) << "This should always pass."; } -TEST(PtrTest, AssertNullWithNonNullValue) - { - EXPECT_FATAL_FAILURE(ASSERT_NULL(reinterpret_cast(0x1)), ""); - } - TEST(PtrTest, AssertNotNullWithNullValue) { EXPECT_FATAL_FAILURE(ASSERT_NOTNULL(NULL), ""); @@ -52,11 +47,6 @@ TEST(PtrTest, ExpectNotNullWithNonNullValue) EXPECT_NOTNULL(reinterpret_cast(0x1)) << "This should always pass."; } -TEST(PtrTest, ExpectNullWithNonNullValue) - { - EXPECT_NONFATAL_FAILURE(EXPECT_NULL(reinterpret_cast(0x1)), ""); - } - TEST(PtrTest, ExpectNotNullWithNullValue) { EXPECT_NONFATAL_FAILURE(EXPECT_NOTNULL(NULL), ""); @@ -66,7 +56,7 @@ TEST(PtrTest, ExpectNotNullWithNullValue) TEST(TRTestCombineVectorTest, CombineEmptyVectorsOfSameType) { using namespace std; - auto v = TRTest::combine(vector{}, vector{}); + auto v = TRTest::combine(vector(), vector()); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_TRUE(v.empty()) << "Combining two empty vectors should always result in another empty vector."; @@ -75,7 +65,7 @@ TEST(TRTestCombineVectorTest, CombineEmptyVectorsOfSameType) TEST(TRTestCombineVectorTest, CombineEmptyVectorsOfDifferentTypes) { using namespace std; - auto v = TRTest::combine(vector{}, vector{}); + auto v = TRTest::combine(vector(), vector()); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_TRUE(v.empty()) << "Combining two empty vectors should always result in another empty vector."; @@ -85,7 +75,7 @@ TEST(TRTestCombineVectorTest, CombineEmptyAndNonEmptyVectorsOfSameType) { using namespace std; int test_array[3] = {1, 2 ,3}; - auto v = TRTest::combine(vector{}, vector (test_array, test_array+3)); + auto v = TRTest::combine(vector(), vector (test_array, test_array + 3)); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_TRUE(v.empty()) << "Combining any vector with an empty vector should always result in another empty vector."; @@ -94,7 +84,8 @@ TEST(TRTestCombineVectorTest, CombineEmptyAndNonEmptyVectorsOfSameType) TEST(TRTestCombineVectorTest, CombineEmptyAndNonEmptyVectorsOfDifferentTypes) { using namespace std; - auto v = TRTest::combine(vector{}, vector{'a', 'b', 'c'}); + char test_array[3] = {'a', 'b', 'c'}; + auto v = TRTest::combine(vector(), vector(test_array, test_array + 3)); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_TRUE(v.empty()) << "Combining any vector with an empty vector should always result in another empty vector."; @@ -104,7 +95,7 @@ TEST(TRTestCombineVectorTest, CombineNonEmptyAndEmptyVectorsOfSameType) { using namespace std; int test_array[] = {1, 2, 3}; - auto v = TRTest::combine(vector (test_array, test_array+3), vector{}); + auto v = TRTest::combine(vector (test_array, test_array + 3), vector()); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_TRUE(v.empty()) << "Combining any vector with an empty vector should always result in another empty vector."; @@ -114,7 +105,7 @@ TEST(TRTestCombineVectorTest, CombineNonEmptyAndEmptyVectorsOfDifferentTypes) { using namespace std; long test_array[] = {1, 2 ,3}; - auto v = TRTest::combine(vector(test_array, test_array+3), vector{}); + auto v = TRTest::combine(vector(test_array, test_array + 3), vector()); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_TRUE(v.empty()) << "Combining any vector with an empty vector should always result in another empty vector."; @@ -139,7 +130,7 @@ TEST(TRTestCombineVectorTest, CombineNonEmptyVectorsOfDifferentTypes) long test_array1[3] = {1, 2, 3}; char test_array2[2] = {'a', 'b'}; auto v1 = vector (test_array1, test_array1 + 3); - auto v2 = vector (test_array1, test_array1 + 3); + auto v2 = vector (test_array2, test_array2 + 2); auto v = TRTest::combine(v1, v2); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_EQ(v1.size() * v2.size(), v.size()) @@ -149,7 +140,9 @@ TEST(TRTestCombineVectorTest, CombineNonEmptyVectorsOfDifferentTypes) TEST(TRTestCombineBraceInitTest, CombineEmptyListsOfSameType) { using namespace std; - auto v = TRTest::combine({}, {}); + auto v1 = vector (); + auto v2 = vector (); + auto v = TRTest::combine(v1, v2); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_TRUE(v.empty()) << "Combining two empty lists should always result in an empty vector."; @@ -158,7 +151,9 @@ TEST(TRTestCombineBraceInitTest, CombineEmptyListsOfSameType) TEST(TRTestCombineBraceInitTest, CombineEmptyListsOfDifferentTypes) { using namespace std; - auto v = TRTest::combine({}, {}); + auto v1 = vector (); + auto v2 = vector (); + auto v = TRTest::combine(v1, v2); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_TRUE(v.empty()) << "Combining two empty lists should always result in an empty vector."; @@ -167,7 +162,10 @@ TEST(TRTestCombineBraceInitTest, CombineEmptyListsOfDifferentTypes) TEST(TRTestCombineBraceInitTest, CombineEmptyAndNonEmptyListsOfSameType) { using namespace std; - auto v = TRTest::combine({}, {1, 2, 3}); + int test_array2[3] = {1, 2, 3}; + auto v1 = vector (); + auto v2 = vector (test_array2, test_array2 + 3); + auto v = TRTest::combine(v1, v2); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_TRUE(v.empty()) << "Combining any list with an empty list should always result in another empty vector."; @@ -176,7 +174,10 @@ TEST(TRTestCombineBraceInitTest, CombineEmptyAndNonEmptyListsOfSameType) TEST(TRTestCombineBraceInitTest, CombineEmptyAndNonEmptyListsOfDifferentTypes) { using namespace std; - auto v = TRTest::combine({}, {'a', 'b', 'c'}); + char test_array2[3] = {'a', 'b', 'c'}; + auto v1 = vector (); + auto v2 = vector (test_array2, test_array2 + 3); + auto v = TRTest::combine(v1, v2); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_TRUE(v.empty()) << "Combining any list with an empty list should always result in another empty vector."; @@ -185,7 +186,10 @@ TEST(TRTestCombineBraceInitTest, CombineEmptyAndNonEmptyListsOfDifferentTypes) TEST(TRTestCombineBraceInitTest, CombineNonEmptyAndEmptyListsOfSameType) { using namespace std; - auto v = TRTest::combine({1, 2, 3}, {}); + int test_array1[3] = {1, 2, 3}; + auto v1 = vector (test_array1, test_array1 + 3); + auto v2 = vector (); + auto v = TRTest::combine(v1, v2); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_TRUE(v.empty()) << "Combining any list with an empty list should always result in another empty vector."; @@ -194,7 +198,10 @@ TEST(TRTestCombineBraceInitTest, CombineNonEmptyAndEmptyListsOfSameType) TEST(TRTestCombineBraceInitTest, CombineNonEmptyAndEmptyListsOfDifferentTypes) { using namespace std; - auto v = TRTest::combine({1, 2, 3}, {}); + long test_array1[3] = {1, 2, 3}; + auto v1 = vector (test_array1, test_array1 + 3); + auto v2 = vector (); + auto v = TRTest::combine(v1, v2); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_TRUE(v.empty()) << "Combining any list with an empty list should always result in another empty vector."; @@ -203,7 +210,11 @@ TEST(TRTestCombineBraceInitTest, CombineNonEmptyAndEmptyListsOfDifferentTypes) TEST(TRTestCombineBraceInitTest, CombineNonEmptyListsOfSameType) { using namespace std; - auto v = TRTest::combine({1, 2, 3}, {4, 5}); + int test_array1[] = {1, 2, 3}; + int test_array2[] = {4, 5}; + auto v1 = vector (test_array1, test_array1 + 3); + auto v2 = vector (test_array2, test_array2 + 2); + auto v = TRTest::combine(v1, v2); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_EQ(3*2, v.size()) << "Size of combined lists should be the product of the sizes of the two individual lists."; @@ -212,7 +223,11 @@ TEST(TRTestCombineBraceInitTest, CombineNonEmptyListsOfSameType) TEST(TRTestCombineBraceInitTest, CombineNonEmptyListsOfDifferentTypes) { using namespace std; - auto v = TRTest::combine({1, 2, 3}, {'a', 'b'}); + long test_array1[3] = {1, 2, 3}; + char test_array2[2] = {'a', 'b'}; + auto v1 = vector (test_array1, test_array1 + 3); + auto v2 = vector (test_array2, test_array2 + 2); + auto v = TRTest::combine(v1, v2); ::testing::StaticAssertTypeEq>, decltype (v)>(); ASSERT_EQ(3*2, v.size()) << "Size of combined lists should be the product of the sizes of the two individual lists."; @@ -229,28 +244,30 @@ bool returnTrue(char c) { TEST(TRTestFilter, FilterNothingFromEmptyVector) { - auto v_in = std::vector{}; + auto v_in = std::vector(); auto v_out = TRTest::filter(v_in, returnFalse); // should filter nothing ASSERT_TRUE(v_out.empty()) << "Filtering an empty vector should result in another empty vector."; } TEST(TRTestFilter, FilterEverythingFromEmptyVector) { - auto v_in = std::vector{}; + auto v_in = std::vector(); auto v_out = TRTest::filter(v_in, returnTrue); // should filter everything ASSERT_TRUE(v_out.empty()) << "Filtering an empty vector should result in another empty vector."; } TEST(TRTestFilter, FilterNothingFromVector) { - auto v_in = std::vector{'a', 'b', 'c'}; + char test_array[3] = {'a', 'b', 'c'}; + auto v_in = std::vector(test_array, test_array + 3); auto v_out = TRTest::filter(v_in, returnFalse); // should filter nothing ASSERT_EQ(v_in, v_out) << "Filtering nothing should just return the vector unchanged."; } TEST(TRTestFilter, FilterEverythingFromVector) { - auto v_in = std::vector{'a', 'b', 'c'}; + char test_array[3] = {'a', 'b', 'c'}; + auto v_in = std::vector(test_array, test_array + 3); auto v_out = TRTest::filter(v_in, returnTrue); // should filter everything ASSERT_TRUE(v_out.empty()) << "Filtering everything from vector should result in an empty vector."; } @@ -261,27 +278,30 @@ bool isChar_c(char l) { TEST(TRTestFilter, FilterVectorWithNoOccurrences) { - auto v_in = std::vector{'a', 'b', 'd', 'e'}; + char test_array[4] = {'a', 'b', 'd', 'e'}; + auto v_in = std::vector(test_array, test_array + 4); auto v_out = TRTest::filter(v_in, isChar_c); ASSERT_EQ(v_in, v_out) << "Filtering a vector that doesn't contain elements matching the predicate should just return the same vector."; - ASSERT_EQ(0, std::count_if(v_out.cbegin(), v_out.cend(), isChar_c)) + ASSERT_EQ(0, std::count_if(v_out.begin(), v_out.end(), isChar_c)) << "Filtering should leave no elements matching the filter predicate."; } TEST(TRTestFilter, FilterVectorWithOneOccurrence) { - auto v_in = std::vector{'a', 'b', 'c', 'd', 'e'}; + char test_array[5] = {'a', 'b', 'c', 'd', 'e'}; + auto v_in = std::vector(test_array, test_array + 5); auto v_out = TRTest::filter(v_in, isChar_c); - ASSERT_EQ(0, std::count_if(v_out.cbegin(), v_out.cend(), isChar_c)) + ASSERT_EQ(0, std::count_if(v_out.begin(), v_out.end(), isChar_c)) << "Filtering should leave no elements matching the filter predicate."; } TEST(TRTestFilter, FilterVectorWithManyOccurrences) { - auto v_in = std::vector{'a', 'c', 'b', 'c', 'c', 'd', 'c', 'e', 'c'}; + char test_array[9] = {'a', 'c', 'b', 'c', 'c', 'd', 'c', 'e', 'c'}; + auto v_in = std::vector(test_array, test_array + 9); auto v_out = TRTest::filter(v_in, isChar_c); - ASSERT_EQ(0, std::count_if(v_out.cbegin(), v_out.cend(), isChar_c)) + ASSERT_EQ(0, std::count_if(v_out.begin(), v_out.end(), isChar_c)) << "Filtering should leave no elements matching the filter predicate."; } diff --git a/fvtest/compilertriltest/LinkageTest.cpp b/fvtest/compilertriltest/LinkageTest.cpp index 524e6b8916b..02f41e0d67c 100644 --- a/fvtest/compilertriltest/LinkageTest.cpp +++ b/fvtest/compilertriltest/LinkageTest.cpp @@ -68,7 +68,7 @@ TYPED_TEST(LinkageTest, InvalidLinkageTest) { auto trees = parseString(inputTrees); ASSERT_NOTNULL(trees) << "Trees failed to parse\n" << inputTrees; - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_NE(0, compiler.compile()) << "Compilation succeeded unexpectedly\n" << "Input trees: " << inputTrees; } @@ -93,13 +93,13 @@ TYPED_TEST(LinkageTest, SystemLinkageParameterPassingSingleArg) { ASSERT_NOTNULL(trees) << "Trees failed to parse\n" << inputTrees; - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; auto entry_point = compiler.getEntryPoint(); auto inputs = TRTest::const_values(); - for (auto i = inputs.cbegin(); i != inputs.cend(); ++i) { + for (auto i = inputs.begin(); i != inputs.end(); ++i) { SCOPED_TRACE(*i); EXPECT_EQ(static_cast(*i), entry_point(*i)) << "Input Trees: " << inputTrees; } @@ -143,13 +143,13 @@ TYPED_TEST(LinkageTest, SystemLinkageParameterPassingFourArg) { ASSERT_NOTNULL(trees) << "Trees failed to parse\n" << inputTrees; - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; auto entry_point = compiler.getEntryPoint(); auto inputs = TRTest::const_values(); - for (auto i = inputs.cbegin(); i != inputs.cend(); ++i) { + for (auto i = inputs.begin(); i != inputs.end(); ++i) { SCOPED_TRACE(*i); EXPECT_EQ(static_cast(*i), entry_point(0,0,0, *i)) << "Input Trees: " << inputTrees; } @@ -176,7 +176,7 @@ T (*get_fourth_arg_from_callee())(T,T,T,T) { return NULL; } - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); if (compiler.compile() != 0) { return NULL; } @@ -227,13 +227,13 @@ TYPED_TEST(LinkageTest, SystemLinkageJitedToJitedParameterPassingFourArg) { ASSERT_NOTNULL(trees) << "Trees failed to parse\n" << inputTrees; - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; auto entry_point = compiler.getEntryPoint(); auto inputs = TRTest::const_values(); - for (auto i = inputs.cbegin(); i != inputs.cend(); ++i) { + for (auto i = inputs.begin(); i != inputs.end(); ++i) { SCOPED_TRACE(*i); EXPECT_EQ(static_cast(*i), entry_point(0,0,0, *i)) << "Input Trees: " << inputTrees; } @@ -286,13 +286,13 @@ TYPED_TEST(LinkageTest, SystemLinkageParameterPassingFiveArg) { ASSERT_NOTNULL(trees) << "Trees failed to parse\n" << inputTrees; - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; auto entry_point = compiler.getEntryPoint(); auto inputs = TRTest::const_values(); - for (auto i = inputs.cbegin(); i != inputs.cend(); ++i) { + for (auto i = inputs.begin(); i != inputs.end(); ++i) { SCOPED_TRACE(*i); EXPECT_EQ(static_cast(*i), entry_point(0,0,0,0, *i)) << "Input Trees: " << inputTrees; } @@ -360,7 +360,7 @@ TYPED_TEST(LinkageTest, SystemLinkageParameterPassingFiveArgToStackUser) { ASSERT_NOTNULL(trees) << "Trees failed to parse\n" << inputTrees; - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; auto entry_point = compiler.getEntryPoint(); @@ -402,13 +402,13 @@ TEST_F(LinkageWithMixedTypesTest, SystemLinkageParameterPassingFourArgWithMixedT auto trees = parseString(inputTrees); ASSERT_NOTNULL(trees) << "Trees failed to parse\n" << inputTrees; - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; auto entry_point = compiler.getEntryPoint(); auto inputs = TRTest::const_values(); - for (auto i = inputs.cbegin(); i != inputs.cend(); ++i) { + for (auto i = inputs.begin(); i != inputs.end(); ++i) { SCOPED_TRACE(*i); EXPECT_EQ(*i, entry_point(0.0,0,0.0, *i)) << "Input Trees: " << inputTrees; } @@ -439,13 +439,13 @@ TEST_F(LinkageWithMixedTypesTest, SystemLinkageParameterPassingFiveArgWithMixedT auto trees = parseString(inputTrees); ASSERT_NOTNULL(trees) << "Trees failed to parse\n" << inputTrees; - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; auto entry_point = compiler.getEntryPoint(); auto inputs = TRTest::const_values(); - for (auto i = inputs.cbegin(); i != inputs.cend(); ++i) { + for (auto i = inputs.begin(); i != inputs.end(); ++i) { SCOPED_TRACE(*i); EXPECT_DOUBLE_EQ(*i, entry_point(0.0,0,0.0,0, *i)) << "Input Trees: " << inputTrees; } diff --git a/fvtest/compilertriltest/LogicalTest.cpp b/fvtest/compilertriltest/LogicalTest.cpp index 450b794729a..6623c9ff849 100644 --- a/fvtest/compilertriltest/LogicalTest.cpp +++ b/fvtest/compilertriltest/LogicalTest.cpp @@ -74,7 +74,7 @@ TEST_P(Int32LogicalUnary, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -94,7 +94,7 @@ TEST_P(Int32LogicalUnary, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -105,9 +105,9 @@ TEST_P(Int32LogicalUnary, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(LogicalTest, Int32LogicalUnary, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("ineg", ineg), - std::make_tuple("iabs", iabs) - ))); + std::make_tuple("ineg", ineg), + std::make_tuple("iabs", iabs) + ))); class Int32LogicalBinary : public TRTest::BinaryOpTest {}; @@ -120,7 +120,7 @@ TEST_P(Int32LogicalBinary, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -140,7 +140,7 @@ TEST_P(Int32LogicalBinary, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -151,10 +151,10 @@ TEST_P(Int32LogicalBinary, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(LogicalTest, Int32LogicalBinary, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("ior", ior), - std::make_tuple("iand", iand), - std::make_tuple("ixor", ixor) - ))); + std::make_tuple("ior", ior), + std::make_tuple("iand", iand), + std::make_tuple("ixor", ixor) + ))); class Int64LogicalBinary : public TRTest::BinaryOpTest {}; @@ -174,7 +174,7 @@ TEST_P(Int64LogicalBinary, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -201,7 +201,7 @@ TEST_P(Int64LogicalBinary, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -212,10 +212,10 @@ TEST_P(Int64LogicalBinary, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(LogicalTest, Int64LogicalBinary, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("lor", lor), - std::make_tuple("land", land), - std::make_tuple("lxor", lxor) - ))); + std::make_tuple("lor", lor), + std::make_tuple("land", land), + std::make_tuple("lxor", lxor) + ))); class Int64LogicalUnary : public TRTest::UnaryOpTest {}; @@ -238,7 +238,7 @@ TEST_P(Int64LogicalUnary, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -265,7 +265,7 @@ TEST_P(Int64LogicalUnary, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -276,5 +276,5 @@ TEST_P(Int64LogicalUnary, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(LogicalTest, Int64LogicalUnary, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("lneg", lneg) + std::make_tuple("lneg", lneg) ))); diff --git a/fvtest/compilertriltest/LongAndAsRotateTest.cpp b/fvtest/compilertriltest/LongAndAsRotateTest.cpp index 1db95cdccf3..28f7c4e9d7c 100644 --- a/fvtest/compilertriltest/LongAndAsRotateTest.cpp +++ b/fvtest/compilertriltest/LongAndAsRotateTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -127,7 +127,7 @@ TEST_P(i2lLongAndAsRotateTest, SimpleTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -168,7 +168,7 @@ TEST_P(i2lLongAndAsRotateTest, iConstTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -216,7 +216,7 @@ TEST_P(i2lLongAndAsRotateTest, GreaterThanOneRefCount1) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -276,7 +276,7 @@ TEST_P(i2lLongAndAsRotateTest, GreaterThanOneRefCount2) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -308,7 +308,7 @@ TEST_P(iu2lLongAndAsRotateTest, SimpleTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -349,7 +349,7 @@ TEST_P(iu2lLongAndAsRotateTest, iConstTest) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -396,7 +396,7 @@ TEST_P(iu2lLongAndAsRotateTest, GreaterThanOneRefCount1) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; @@ -455,7 +455,7 @@ TEST_P(iu2lLongAndAsRotateTest, GreaterThanOneRefCount2) ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler {trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\nInput trees: " << inputTrees; diff --git a/fvtest/compilertriltest/MaxMinTest.cpp b/fvtest/compilertriltest/MaxMinTest.cpp index 23f754d66e3..dd2f0dd6848 100644 --- a/fvtest/compilertriltest/MaxMinTest.cpp +++ b/fvtest/compilertriltest/MaxMinTest.cpp @@ -59,7 +59,7 @@ TEST_P(Int32MaxMin, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -84,7 +84,7 @@ TEST_P(Int32MaxMin, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -96,8 +96,8 @@ TEST_P(Int32MaxMin, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(MaxMin, Int32MaxMin, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("imax", imax), - std::make_tuple("imin", imin)))); + std::make_tuple("imax", imax), + std::make_tuple("imin", imin)))); class Int64MaxMin : public TRTest::BinaryOpTest {}; @@ -120,7 +120,7 @@ TEST_P(Int64MaxMin, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -145,7 +145,7 @@ TEST_P(Int64MaxMin, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -157,5 +157,5 @@ TEST_P(Int64MaxMin, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(MaxMin, Int64MaxMin, ::testing::Combine( ::testing::ValuesIn(TRTest::const_value_pairs()), ::testing::Values( - std::make_tuple("lmax", lmax), - std::make_tuple("lmin", lmin)))); + std::make_tuple("lmax", lmax), + std::make_tuple("lmin", lmin)))); diff --git a/fvtest/compilertriltest/MockStrategyTest.cpp b/fvtest/compilertriltest/MockStrategyTest.cpp index f5ce34783f9..91e9edb4b1c 100644 --- a/fvtest/compilertriltest/MockStrategyTest.cpp +++ b/fvtest/compilertriltest/MockStrategyTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -69,7 +69,7 @@ TEST_F(MockStrategyTest, FoldDoesntHappen) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); NoAndIlVerifier verifier; ASSERT_NE(0, compiler.compileWithVerifier(&verifier)) diff --git a/fvtest/compilertriltest/OpCodeTest.hpp b/fvtest/compilertriltest/OpCodeTest.hpp index 818301e83fd..2b80c755bfb 100644 --- a/fvtest/compilertriltest/OpCodeTest.hpp +++ b/fvtest/compilertriltest/OpCodeTest.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2018 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -25,9 +25,7 @@ #include "JitTest.hpp" #include -#include #include -#include #include #include diff --git a/fvtest/compilertriltest/ShiftAndRotateTest.cpp b/fvtest/compilertriltest/ShiftAndRotateTest.cpp index edabba6443d..c9258bfcb90 100644 --- a/fvtest/compilertriltest/ShiftAndRotateTest.cpp +++ b/fvtest/compilertriltest/ShiftAndRotateTest.cpp @@ -101,7 +101,7 @@ TEST_P(Int32ShiftAndRotate, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -118,7 +118,7 @@ TEST_P(Int32ShiftAndRotate, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -128,9 +128,10 @@ TEST_P(Int32ShiftAndRotate, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(ShiftAndRotateTest, Int32ShiftAndRotate, ::testing::Combine( ::testing::ValuesIn(static_cast< std::vector> (*) (void) > (test_input_values)()), - ::testing::Values( std::make_tuple("ishl", static_cast(shift_left)), - std::make_tuple("ishr", static_cast(shift_right)), - std::make_tuple("irol", static_cast(rotate)) ))); + ::testing::Values(std::make_tuple("ishl", static_cast(shift_left)), + std::make_tuple("ishr", static_cast(shift_right)), + std::make_tuple("irol", static_cast(rotate)) + ))); class Int64ShiftAndRotate : public ShiftAndRotateArithmetic {}; @@ -143,7 +144,7 @@ TEST_P(Int64ShiftAndRotate, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -160,7 +161,7 @@ TEST_P(Int64ShiftAndRotate, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -170,9 +171,10 @@ TEST_P(Int64ShiftAndRotate, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(ShiftAndRotateTest, Int64ShiftAndRotate, ::testing::Combine( ::testing::ValuesIn(static_cast< std::vector> (*) (void) > (test_input_values)()), - ::testing::Values( std::make_tuple("lshl", static_cast(shift_left)), - std::make_tuple("lshr", static_cast(shift_right)), - std::make_tuple("lrol", static_cast(rotate)) ))); + ::testing::Values(std::make_tuple("lshl", static_cast(shift_left)), + std::make_tuple("lshr", static_cast(shift_right)), + std::make_tuple("lrol", static_cast(rotate)) + ))); class Int8ShiftAndRotate : public ShiftAndRotateArithmetic {}; @@ -185,7 +187,7 @@ TEST_P(Int8ShiftAndRotate, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -208,7 +210,7 @@ TEST_P(Int8ShiftAndRotate, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -218,8 +220,9 @@ TEST_P(Int8ShiftAndRotate, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(ShiftAndRotateTest, Int8ShiftAndRotate, ::testing::Combine( ::testing::ValuesIn(static_cast< std::vector> (*) (void) > (test_input_values)()), - ::testing::Values( std::make_tuple("bshl", static_cast(shift_left)), - std::make_tuple("bshr", static_cast(shift_right)) ))); + ::testing::Values(std::make_tuple("bshl", static_cast(shift_left)), + std::make_tuple("bshr", static_cast(shift_right)) + ))); class Int16ShiftAndRotate : public ShiftAndRotateArithmetic {}; @@ -232,7 +235,7 @@ TEST_P(Int16ShiftAndRotate, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -254,7 +257,7 @@ TEST_P(Int16ShiftAndRotate, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -265,9 +268,9 @@ TEST_P(Int16ShiftAndRotate, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(ShiftAndRotateTest, Int16ShiftAndRotate, ::testing::Combine( ::testing::ValuesIn(static_cast< std::vector> (*) (void) > (test_input_values)()), - ::testing::Values( std::make_tuple("sshl", static_cast(shift_left)), - std::make_tuple("sshr", static_cast(shift_right)) - ))); + ::testing::Values(std::make_tuple("sshl", static_cast(shift_left)), + std::make_tuple("sshr", static_cast(shift_right)) + ))); class UInt32ShiftAndRotate : public ShiftAndRotateArithmetic {}; @@ -280,7 +283,7 @@ TEST_P(UInt32ShiftAndRotate, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -297,7 +300,7 @@ TEST_P(UInt32ShiftAndRotate, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -306,8 +309,9 @@ TEST_P(UInt32ShiftAndRotate, UsingLoadParam) { } INSTANTIATE_TEST_CASE_P(ShiftAndRotateTest, UInt32ShiftAndRotate, ::testing::Combine( - ::testing::ValuesIn(static_cast< std::vector> (*) (void) > (test_input_values)()), - ::testing::Values( std::make_tuple("iushr", static_cast< uint32_t (*) (uint32_t, int32_t) > (shift_right)) ))); + ::testing::ValuesIn(static_cast< std::vector> (*) (void)>(test_input_values)()), + ::testing::Values(std::make_tuple("iushr", static_cast(shift_right)) + ))); class UInt64ShiftAndRotate : public ShiftAndRotateArithmetic {}; @@ -320,7 +324,7 @@ TEST_P(UInt64ShiftAndRotate, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -337,7 +341,7 @@ TEST_P(UInt64ShiftAndRotate, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -346,8 +350,9 @@ TEST_P(UInt64ShiftAndRotate, UsingLoadParam) { } INSTANTIATE_TEST_CASE_P(ShiftAndRotateTest, UInt64ShiftAndRotate, ::testing::Combine( - ::testing::ValuesIn(static_cast< std::vector> (*) (void) > (test_input_values)()), - ::testing::Values( std::make_tuple("lushr", static_cast< uint64_t (*) (uint64_t, int32_t) > (shift_right)) ))); + ::testing::ValuesIn(static_cast< std::vector> (*) (void)>(test_input_values)()), + ::testing::Values(std::make_tuple("lushr", static_cast(shift_right)) + ))); class UInt8ShiftAndRotate : public ShiftAndRotateArithmetic {}; @@ -360,7 +365,7 @@ TEST_P(UInt8ShiftAndRotate, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -381,7 +386,7 @@ TEST_P(UInt8ShiftAndRotate, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -390,8 +395,9 @@ TEST_P(UInt8ShiftAndRotate, UsingLoadParam) { } INSTANTIATE_TEST_CASE_P(ShiftAndRotateTest, UInt8ShiftAndRotate, ::testing::Combine( - ::testing::ValuesIn( static_cast< std::vector> (*) (void) > (test_input_values)()), - ::testing::Values( std::make_tuple("bushr", static_cast(shift_right)) ))); + ::testing::ValuesIn(static_cast< std::vector> (*) (void) > (test_input_values)()), + ::testing::Values(std::make_tuple("bushr", static_cast(shift_right)) + ))); class UInt16ShiftAndRotate : public ShiftAndRotateArithmetic {}; @@ -404,7 +410,7 @@ TEST_P(UInt16ShiftAndRotate, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -427,7 +433,7 @@ TEST_P(UInt16ShiftAndRotate, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -437,4 +443,5 @@ TEST_P(UInt16ShiftAndRotate, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(ShiftAndRotateTest, UInt16ShiftAndRotate, ::testing::Combine( ::testing::ValuesIn(static_cast< std::vector> (*) (void) >(test_input_values)()), - ::testing::Values( std::make_tuple("sushr", static_cast(shift_right)) ))); + ::testing::Values(std::make_tuple("sushr", static_cast(shift_right)) + ))); diff --git a/fvtest/compilertriltest/SimplifierFoldAbsNegTest.cpp b/fvtest/compilertriltest/SimplifierFoldAbsNegTest.cpp index 412a230fdca..8675b59c409 100644 --- a/fvtest/compilertriltest/SimplifierFoldAbsNegTest.cpp +++ b/fvtest/compilertriltest/SimplifierFoldAbsNegTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2018 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -40,16 +40,35 @@ template <> char* nameForType() { return "Int64" ; } template <> char* nameForType< float>() { return "Float" ; } template <> char* nameForType< double>() { return "Double"; } -std::vector iTestData = { 0, 1, 2, -1, -2, 99999, -99999, std::numeric_limits::max(), std::numeric_limits::min() }; -std::vector lTestData = { 0, 1, 2, -1, -2, 99999, -99999, std::numeric_limits::min(), std::numeric_limits::min() }; -std::vector< float> fTestData = { 0, 1, 2, -1, -2, 3.14F, -3.14F, std::numeric_limits::min(), std::numeric_limits::min() }; -std::vector< double> dTestData = { 0, 1, 2, -1, -2, 3.14, -3.14, std::numeric_limits::min(), std::numeric_limits::min() }; - template std::vector dataForType(); -template <> std::vector dataForType() { return iTestData; } -template <> std::vector dataForType() { return lTestData; } -template <> std::vector< float> dataForType< float>() { return fTestData; } -template <> std::vector< double> dataForType< double>() { return dTestData; } + +template <> std::vector dataForType() + { + static int32_t values[] = { 0, 1, 2, -1, -2, 99999, -99999, std::numeric_limits::max(), std::numeric_limits::min() }; + + return std::vector(values, values + sizeof(values) / sizeof(int32_t)); + } + +template <> std::vector dataForType() + { + static int64_t values[] = { 0, 1, 2, -1, -2, 99999, -99999, std::numeric_limits::max(), std::numeric_limits::min() }; + + return std::vector(values, values + sizeof(values) / sizeof(int64_t)); + } + +template <> std::vector dataForType() + { + static float values[] = { 0, 1, 2, -1, -2, 3.14F, -3.14F, std::numeric_limits::min(), std::numeric_limits::min() }; + + return std::vector(values, values + sizeof(values) / sizeof(float)); + } + +template <> std::vector dataForType() + { + static double values[] = { 0, 1, 2, -1, -2, 3.14F, -3.14F, std::numeric_limits::min(), std::numeric_limits::min() }; + + return std::vector(values, values + sizeof(values) / sizeof(double)); + } class SimplifierFoldAbsNegTestIlVerifierBase : public TR::IlVerifier { @@ -121,7 +140,7 @@ TYPED_TEST(SimplifierFoldAbsNegTest, FoldAbsAbs) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); NoAbsAbsIlVerifier verifier; ASSERT_EQ(0, compiler.compileWithVerifier(&verifier)) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -129,9 +148,11 @@ TYPED_TEST(SimplifierFoldAbsNegTest, FoldAbsAbs) { auto entry_point = compiler.getEntryPoint(); // Invoke the compiled method, and assert the output is correct. - for (auto test : dataForType()) { - EXPECT_EQ(std::abs(test), entry_point(test)); - } + auto values = dataForType(); + for (auto it = values.begin(); it != values.end(); ++it) + { + EXPECT_EQ(std::abs(*it), entry_point(*it)); + } } @@ -162,7 +183,7 @@ TYPED_TEST(SimplifierFoldAbsNegTest, FoldAbsNeg) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); NoAbsNegIlVerifier verifier; ASSERT_EQ(0, compiler.compileWithVerifier(&verifier)) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -170,9 +191,11 @@ TYPED_TEST(SimplifierFoldAbsNegTest, FoldAbsNeg) { auto entry_point = compiler.getEntryPoint(); // Invoke the compiled method, and assert the output is correct. - for (auto test : dataForType()) { - EXPECT_EQ(std::abs(test), entry_point(test)); - } + auto values = dataForType(); + for (auto it = values.begin(); it != values.end(); ++it) + { + EXPECT_EQ(std::abs(*it), entry_point(*it)); + } } @@ -203,7 +226,7 @@ TYPED_TEST(SimplifierFoldAbsNegTest, FoldNegNeg) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); NoNegNegIlVerifier verifier; ASSERT_EQ(0, compiler.compileWithVerifier(&verifier)) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -211,7 +234,9 @@ TYPED_TEST(SimplifierFoldAbsNegTest, FoldNegNeg) { auto entry_point = compiler.getEntryPoint(); // Invoke the compiled method, and assert the output is correct. - for (auto test : dataForType()) { - EXPECT_EQ(test, entry_point(test)); - } + auto values = dataForType(); + for (auto it = values.begin(); it != values.end(); ++it) + { + EXPECT_EQ(*it, entry_point(*it)); + } } diff --git a/fvtest/compilertriltest/SimplifierFoldAndTest.cpp b/fvtest/compilertriltest/SimplifierFoldAndTest.cpp index 75c5fedd7d7..5def5533879 100644 --- a/fvtest/compilertriltest/SimplifierFoldAndTest.cpp +++ b/fvtest/compilertriltest/SimplifierFoldAndTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -70,7 +70,7 @@ TEST_F(SimplifierFoldAndTest, FoldHappens) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); NoAndIlVerifier verifier; ASSERT_EQ(0, compiler.compileWithVerifier(&verifier)) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; diff --git a/fvtest/compilertriltest/TypeConversionTest.cpp b/fvtest/compilertriltest/TypeConversionTest.cpp index fd364838d72..6fef7bccb21 100644 --- a/fvtest/compilertriltest/TypeConversionTest.cpp +++ b/fvtest/compilertriltest/TypeConversionTest.cpp @@ -24,6 +24,13 @@ #include +#if defined(J9ZOS390) +namespace std +{ + using ::isnan; +} +#endif + int32_t b2i(int8_t x) { return static_cast(x); } @@ -81,7 +88,7 @@ TEST_P(Int8ToInt32, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -108,7 +115,7 @@ TEST_P(Int8ToInt32, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -121,7 +128,8 @@ TEST_P(Int8ToInt32, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, Int8ToInt32, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("b2i", b2i) ))); + std::make_tuple("b2i", b2i) + ))); class UInt8ToInt32 : public TRTest::UnaryOpTest {}; @@ -140,7 +148,7 @@ TEST_P(UInt8ToInt32, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -167,7 +175,7 @@ TEST_P(UInt8ToInt32, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -180,7 +188,8 @@ TEST_P(UInt8ToInt32, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, UInt8ToInt32, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("bu2i", bu2i) ))); + std::make_tuple("bu2i", bu2i) + ))); class Int8ToInt64 : public TRTest::UnaryOpTest {}; @@ -199,7 +208,7 @@ TEST_P(Int8ToInt64, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -226,7 +235,7 @@ TEST_P(Int8ToInt64, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -239,7 +248,8 @@ TEST_P(Int8ToInt64, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, Int8ToInt64, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("b2l", b2l) ))); + std::make_tuple("b2l", b2l) + ))); class UInt8ToInt64 : public TRTest::UnaryOpTest {}; @@ -258,7 +268,7 @@ TEST_P(UInt8ToInt64, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -285,7 +295,7 @@ TEST_P(UInt8ToInt64, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -298,7 +308,8 @@ TEST_P(UInt8ToInt64, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, UInt8ToInt64, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("bu2l", bu2l) ))); + std::make_tuple("bu2l", bu2l) + ))); class Int16ToInt32 : public TRTest::UnaryOpTest {}; @@ -317,7 +328,7 @@ TEST_P(Int16ToInt32, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -344,7 +355,7 @@ TEST_P(Int16ToInt32, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -357,7 +368,8 @@ TEST_P(Int16ToInt32, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, Int16ToInt32, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("s2i", s2i) ))); + std::make_tuple("s2i", s2i) + ))); class UInt16ToInt32 : public TRTest::UnaryOpTest {}; @@ -376,7 +388,7 @@ TEST_P(UInt16ToInt32, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -403,7 +415,7 @@ TEST_P(UInt16ToInt32, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -416,7 +428,8 @@ TEST_P(UInt16ToInt32, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, UInt16ToInt32, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("su2i", su2i) ))); + std::make_tuple("su2i", su2i) + ))); class Int16ToInt64 : public TRTest::UnaryOpTest {}; @@ -435,7 +448,7 @@ TEST_P(Int16ToInt64, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -462,7 +475,7 @@ TEST_P(Int16ToInt64, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -475,7 +488,8 @@ TEST_P(Int16ToInt64, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, Int16ToInt64, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("s2l", s2l) ))); + std::make_tuple("s2l", s2l) + ))); class UInt16ToInt64 : public TRTest::UnaryOpTest {}; @@ -494,7 +508,7 @@ TEST_P(UInt16ToInt64, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -521,7 +535,7 @@ TEST_P(UInt16ToInt64, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -534,7 +548,8 @@ TEST_P(UInt16ToInt64, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, UInt16ToInt64, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("su2l", su2l) ))); + std::make_tuple("su2l", su2l) + ))); class Int32ToInt64 : public TRTest::UnaryOpTest {}; @@ -553,7 +568,7 @@ TEST_P(Int32ToInt64, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -576,7 +591,7 @@ TEST_P(Int32ToInt64, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -589,7 +604,8 @@ TEST_P(Int32ToInt64, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, Int32ToInt64, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("i2l", i2l) ))); + std::make_tuple("i2l", i2l) + ))); class UInt32ToInt64 : public TRTest::UnaryOpTest {}; @@ -608,7 +624,7 @@ TEST_P(UInt32ToInt64, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -631,7 +647,7 @@ TEST_P(UInt32ToInt64, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -644,7 +660,8 @@ TEST_P(UInt32ToInt64, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, UInt32ToInt64, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("iu2l", iu2l) ))); + std::make_tuple("iu2l", iu2l) + ))); int32_t l2i(int64_t x) { return static_cast(x); @@ -667,7 +684,7 @@ TEST_P(Int64ToInt32, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -690,7 +707,7 @@ TEST_P(Int64ToInt32, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -703,7 +720,8 @@ TEST_P(Int64ToInt32, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, Int64ToInt32, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("l2i", l2i) ))); + std::make_tuple("l2i", l2i) + ))); #ifndef TR_TARGET_POWER float i2f(int32_t x) { @@ -739,7 +757,7 @@ TEST_P(Int32ToFloat, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -762,7 +780,7 @@ TEST_P(Int32ToFloat, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -775,7 +793,8 @@ TEST_P(Int32ToFloat, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, Int32ToFloat, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("i2f", i2f) ))); + std::make_tuple("i2f", i2f) + ))); class Int64ToFloat : public TRTest::UnaryOpTest {}; @@ -794,7 +813,7 @@ TEST_P(Int64ToFloat, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -817,7 +836,7 @@ TEST_P(Int64ToFloat, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -830,7 +849,8 @@ TEST_P(Int64ToFloat, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, Int64ToFloat, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("l2f", l2f) ))); + std::make_tuple("l2f", l2f) + ))); class Int32ToDouble : public TRTest::UnaryOpTest {}; @@ -849,7 +869,7 @@ TEST_P(Int32ToDouble, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -872,7 +892,7 @@ TEST_P(Int32ToDouble, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -885,7 +905,8 @@ TEST_P(Int32ToDouble, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, Int32ToDouble, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("i2d", i2d) ))); + std::make_tuple("i2d", i2d) + ))); class Int64ToDouble : public TRTest::UnaryOpTest {}; @@ -904,7 +925,7 @@ TEST_P(Int64ToDouble, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -927,7 +948,7 @@ TEST_P(Int64ToDouble, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -940,7 +961,8 @@ TEST_P(Int64ToDouble, UsingLoadParam) { INSTANTIATE_TEST_CASE_P(TypeConversionTest, Int64ToDouble, ::testing::Combine( ::testing::ValuesIn(TRTest::const_values()), ::testing::Values( - std::make_tuple("l2d", l2d) ))); + std::make_tuple("l2d", l2d) + ))); #endif template @@ -990,7 +1012,7 @@ TEST_P(FloatToInt32, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1018,7 +1040,7 @@ TEST_P(FloatToInt32, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1032,7 +1054,8 @@ INSTANTIATE_TEST_CASE_P(TypeConversionTest, FloatToInt32, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_values(), fp_filter)), ::testing::Values( - std::make_tuple("f2i", f2i) ))); + std::make_tuple("f2i", f2i) + ))); class FloatToInt64 : public TRTest::UnaryOpTest {}; @@ -1051,7 +1074,7 @@ TEST_P(FloatToInt64, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1074,7 +1097,7 @@ TEST_P(FloatToInt64, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1088,7 +1111,8 @@ INSTANTIATE_TEST_CASE_P(TypeConversionTest, FloatToInt64, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_values(), fp_filter)), ::testing::Values( - std::make_tuple("f2l", f2l) ))); + std::make_tuple("f2l", f2l) + ))); class DoubleToInt32 : public TRTest::UnaryOpTest {}; @@ -1107,7 +1131,7 @@ TEST_P(DoubleToInt32, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1130,7 +1154,7 @@ TEST_P(DoubleToInt32, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1144,7 +1168,8 @@ INSTANTIATE_TEST_CASE_P(TypeConversionTest, DoubleToInt32, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_values(), fp_filter)), ::testing::Values( - std::make_tuple("d2i", d2i) ))); + std::make_tuple("d2i", d2i) + ))); class DoubleToInt64 : public TRTest::UnaryOpTest {}; @@ -1163,7 +1188,7 @@ TEST_P(DoubleToInt64, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1186,7 +1211,7 @@ TEST_P(DoubleToInt64, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1200,7 +1225,8 @@ INSTANTIATE_TEST_CASE_P(TypeConversionTest, DoubleToInt64, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_values(), fp_filter)), ::testing::Values( - std::make_tuple("d2l", d2l) ))); + std::make_tuple("d2l", d2l) + ))); template bool smallFp_filter(T a) @@ -1234,7 +1260,7 @@ TEST_P(FloatToDouble, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1261,7 +1287,7 @@ TEST_P(FloatToDouble, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1279,7 +1305,8 @@ INSTANTIATE_TEST_CASE_P(TypeConversionTest, FloatToDouble, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_values(), smallFp_filter)), ::testing::Values( - std::make_tuple("f2d", f2d) ))); + std::make_tuple("f2d", f2d) + ))); class DoubleToFloat : public TRTest::UnaryOpTest {}; @@ -1298,7 +1325,7 @@ TEST_P(DoubleToFloat, UsingConst) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1325,7 +1352,7 @@ TEST_P(DoubleToFloat, UsingLoadParam) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; @@ -1343,4 +1370,5 @@ INSTANTIATE_TEST_CASE_P(TypeConversionTest, DoubleToFloat, ::testing::Combine( ::testing::ValuesIn( TRTest::filter(TRTest::const_values(), smallFp_filter)), ::testing::Values( - std::make_tuple("d2f", d2f) ))); + std::make_tuple("d2f", d2f) + ))); diff --git a/fvtest/compilertriltest/VectorTest.cpp b/fvtest/compilertriltest/VectorTest.cpp index 048282b6041..e35e6e8cf54 100644 --- a/fvtest/compilertriltest/VectorTest.cpp +++ b/fvtest/compilertriltest/VectorTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -46,7 +46,7 @@ TEST_F(VectorTest, VDoubleAdd) { // at runtime is currently not possible in tril. So the test is being disabled altogether // on Z for now. #ifndef TR_TARGET_S390 - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees; diff --git a/fvtest/compilertriltest/main.cpp b/fvtest/compilertriltest/main.cpp index d1cc270671c..cbcfcdfaf06 100644 --- a/fvtest/compilertriltest/main.cpp +++ b/fvtest/compilertriltest/main.cpp @@ -19,8 +19,8 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception *******************************************************************************/ -#include "omrTest.h" #include "JitTest.hpp" +#include "omrTest.h" extern "C" { int omr_main_entry(int argc, char **argv, char **envp); diff --git a/fvtest/jitbuildertest/JBTestUtil.hpp b/fvtest/jitbuildertest/JBTestUtil.hpp index f5a34f35f91..22776a639de 100644 --- a/fvtest/jitbuildertest/JBTestUtil.hpp +++ b/fvtest/jitbuildertest/JBTestUtil.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -175,8 +175,9 @@ DefineFile(__FILE__); \ DefineName(#name); \ DefineReturnType(returnType); \ - std::vector > args = {__VA_ARGS__}; \ - for (int i = 0, s = args.size(); i < s; ++i) \ + std::pair argsArray[] = {std::pair("", NULL), __VA_ARGS__}; \ + std::vector > args(argsArray, argsArray + sizeof(argsArray)/sizeof(std::pair)); \ + for (int i = 1, s = args.size(); i < s; ++i) \ { \ DefineParameter(args[i].first, args[i].second); \ } \ @@ -197,7 +198,7 @@ * argument to the macro is the name of the parameter, the second is the the * `OMR::JitBuilder::IlType` instance representing the type of the parameter. */ -#define PARAM(name, type) {name, type} +#define PARAM(name, type) std::pair(name, type) /** * @brief The JitBuilderTest class is a basic test fixture for JitBuilder test cases. diff --git a/fvtest/omrGtestGlue/CMakeLists.txt b/fvtest/omrGtestGlue/CMakeLists.txt index 647be581cfe..bf454151b06 100644 --- a/fvtest/omrGtestGlue/CMakeLists.txt +++ b/fvtest/omrGtestGlue/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2017, 2017 IBM Corp. and others +# Copyright (c) 2017, 2019 IBM Corp. and others # # This program and the accompanying materials are made available under # the terms of the Eclipse Public License 2.0 which accompanies this @@ -31,6 +31,14 @@ target_include_directories(omrGtest ${PROJECT_SOURCE_DIR}/third_party/gtest-1.8.0/include ) +if(OMR_OS_ZOS) + if(OMR_TOOLS_USE_NATIVE_ENCODING) + target_link_libraries(omrGtest PUBLIC omr_ebcdic) + else() + target_link_libraries(omrGtest PUBLIC omr_ascii) + endif() +endif() + add_library(omrGtestGlue INTERFACE) target_include_directories(omrGtestGlue @@ -52,4 +60,18 @@ if(NOT OMR_HOST_OS STREQUAL "win") endif() #target_link_libraries(omrGtest INTERFACE omrGtestGlue) +if(OMR_HOST_OS STREQUAL "zos") + list(APPEND OMR_GTEST_DEFINITIONS + -DGTEST_ENV_HAS_STD_TUPLE_ + -D__IBMCPP_TR1__ + ) +endif() + +target_compile_options(omrGtest + PUBLIC + ${OMR_GTEST_DEFINITIONS} + $<$:${OMR_GTEST_DEFINITIONS}> + $<$:${OMR_GTEST_DEFINITIONS}> +) + set_property(TARGET omrGtest PROPERTY FOLDER fvtest) diff --git a/fvtest/omrGtestGlue/argmain.cpp b/fvtest/omrGtestGlue/argmain.cpp index 3026233c509..e4817a42a13 100644 --- a/fvtest/omrGtestGlue/argmain.cpp +++ b/fvtest/omrGtestGlue/argmain.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2018 IBM Corp. and others + * Copyright (c) 2015, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -34,9 +34,9 @@ #include #include -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) #include "atoe.h" -#endif /* defined(J9ZOS390) */ +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ /* Define a macro for the name of the main function that takes char args */ #if defined(OMR_OS_WINDOWS) @@ -50,7 +50,7 @@ extern "C" int omr_main_entry(int argc, char **argv, char **envp); int CHARMAIN(int argc, char **argv, char **envp) { -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) /* translate argv strings to ascii */ iconv_init(); { @@ -59,7 +59,7 @@ CHARMAIN(int argc, char **argv, char **envp) argv[i] = e2a_string(argv[i]); } } -#endif /* defined(J9ZOS390) */ +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ return omr_main_entry(argc, argv, envp); } diff --git a/fvtest/omrGtestGlue/iconvInitialization.cpp b/fvtest/omrGtestGlue/iconvInitialization.cpp index de4e41a1f1a..46ac04c87fe 100644 --- a/fvtest/omrGtestGlue/iconvInitialization.cpp +++ b/fvtest/omrGtestGlue/iconvInitialization.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2015 IBM Corp. and others + * Copyright (c) 2001, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -19,7 +19,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception *******************************************************************************/ -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) #include "atoe.h" extern "C" int iconv_init(void); @@ -35,4 +35,4 @@ iconv_initialization(void) return 0; } -#endif +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ diff --git a/fvtest/omrGtestGlue/omrGtest.cpp b/fvtest/omrGtestGlue/omrGtest.cpp index c52e35b7222..ca764bee79a 100644 --- a/fvtest/omrGtestGlue/omrGtest.cpp +++ b/fvtest/omrGtestGlue/omrGtest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2015 IBM Corp. and others + * Copyright (c) 2014, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -21,12 +21,12 @@ #include "iconvInitialization.cpp" -#if defined(J9ZOS390) /* Gtest invokes xlocale, which has function definition for tolower and toupper. * This causes compilation issue since the a2e macros (tolower and toupper) automatically replace the function definitions. * So we explicitly include and undefine the macros for gtest, after gtest we then define back the macros. */ #include +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) #undef toupper #undef tolower @@ -37,4 +37,4 @@ #else #include "gtest-all.cc" -#endif +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ diff --git a/fvtest/omrGtestGlue/omrTest.h b/fvtest/omrGtestGlue/omrTest.h index 11e4e217490..82dacb552f4 100644 --- a/fvtest/omrGtestGlue/omrTest.h +++ b/fvtest/omrGtestGlue/omrTest.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2015 IBM Corp. and others + * Copyright (c) 2001, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -22,16 +22,16 @@ #ifndef OMR_TEST_FRAMEWORK_H_ #define OMR_TEST_FRAMEWORK_H_ -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) /* Gtest invokes some functions (e.g., getcwd() ) before main() is invoked. * We need to invoke iconv_init() before gtest to ensure a2e is initialized. */ extern int iconv_initialization(void); static int iconv_init_static_variable = iconv_initialization(); -#endif +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) /* Gtest invokes xlocale, which has function definition for tolower and toupper. * This causes compilation issue since the a2e macros (tolower and toupper) automatically replace the function definitions. * So we explicitly include and undefine the macros for gtest, after gtest we then define back the macros. @@ -47,7 +47,7 @@ static int iconv_init_static_variable = iconv_initialization(); #else #include "gtest/gtest.h" -#endif +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ using namespace testing; diff --git a/fvtest/porttest/omrdumpTest.cpp b/fvtest/porttest/omrdumpTest.cpp index d17d46992ea..84c5448479a 100644 --- a/fvtest/porttest/omrdumpTest.cpp +++ b/fvtest/porttest/omrdumpTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2018 IBM Corp. and others + * Copyright (c) 2001, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -192,11 +192,11 @@ TEST(PortDumpTest, dump_test_create_dump_with_name) reportTestEntry(OMRPORTLIB, testName); -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) coreFileName = atoe_getcwd(buff, EsMaxPath); -#else +#else /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ coreFileName = getcwd(buff, EsMaxPath); -#endif +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ strncat(coreFileName, "/", EsMaxPath); /* make sure the directory ends with a slash */ strncat(coreFileName, testName, EsMaxPath); @@ -240,11 +240,11 @@ TEST(PortDumpTest, dump_test_create_dump_from_signal_handler) simpleHandlerInfo handlerInfo; uint32_t sig_protectFlags; -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) coreFileName = atoe_getcwd(buff, EsMaxPath); -#else +#else /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ coreFileName = getcwd(buff, EsMaxPath); -#endif +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ strncat(coreFileName, "/", EsMaxPath); /* make sure the directory ends with a slash */ strncat(coreFileName, testName, EsMaxPath); diff --git a/fvtest/porttest/omrstrTest.cpp b/fvtest/porttest/omrstrTest.cpp index 429f57021c1..7fb03a70a08 100644 --- a/fvtest/porttest/omrstrTest.cpp +++ b/fvtest/porttest/omrstrTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2018 IBM Corp. and others + * Copyright (c) 1991, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -1458,7 +1458,7 @@ TEST(PortStrTest, str_WinacpToMutf8) reportTestExit(OMRPORTLIB, testName); } -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) /** * Check whether a null/non-null terminated string is properly handled by fstring(). * It calls atoe_vsnprintf() to verify the functionalities. @@ -1569,4 +1569,4 @@ TEST(PortStrTest, str_test_atoe_vsnprintf) portTestEnv->log("\n"); reportTestExit(OMRPORTLIB, testName); } -#endif /* defined(J9ZOS390) */ +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ diff --git a/fvtest/porttest/si.cpp b/fvtest/porttest/si.cpp index f789cd3e72c..866bf8fba83 100644 --- a/fvtest/porttest/si.cpp +++ b/fvtest/porttest/si.cpp @@ -2059,11 +2059,11 @@ TEST(PortSysinfoTest, sysinfo_test_get_cwd3) } else { portTestEnv->log("mkdir %s\n", utf8); } -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) rc = atoe_chdir(utf8); -#else +#else /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ rc = chdir(utf8); -#endif +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ if (0 != rc) { outputErrorMessage(PORTTEST_ERROR_ARGS, "cd %s failed rc: %d\n", utf8, rc); } else { @@ -2087,7 +2087,7 @@ TEST(PortSysinfoTest, sysinfo_test_get_cwd3) #if defined(OMR_OS_WINDOWS) _chdir(orig_cwd); /* we need to exit current directory before deleting it*/ -#elif defined(J9ZOS390) +#elif defined(J9ZOS390) && !defined(OMR_EBCDIC) atoe_chdir(orig_cwd); #else /* defined(OMR_OS_WINDOWS) */ rc = chdir(orig_cwd); diff --git a/fvtest/rastest/CMakeLists.txt b/fvtest/rastest/CMakeLists.txt index e0c24da7fb7..02a611cbc3e 100644 --- a/fvtest/rastest/CMakeLists.txt +++ b/fvtest/rastest/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2017, 2018 IBM Corp. and others +# Copyright (c) 2017, 2019 IBM Corp. and others # # This program and the accompanying materials are made available under # the terms of the Eclipse Public License 2.0 which accompanies this @@ -26,34 +26,62 @@ add_library(bindthreadagent SHARED bindthreadagent.c omragent.def ) + target_link_libraries(bindthreadagent PUBLIC omrtestutil) +omr_add_exports(bindthreadagent + OMRAgent_OnLoad + OMRAgent_OnUnload +) + add_library(memorycategoriesagent SHARED memorycategoriesagent.c omragent.def ) + target_link_libraries(memorycategoriesagent PRIVATE omrtestutil) +omr_add_exports(memorycategoriesagent + OMRAgent_OnLoad + OMRAgent_OnUnload +) + add_library(traceagent SHARED traceagent.c omragent.def ) + target_link_libraries(traceagent PRIVATE omrtestutil) +omr_add_exports(traceagent + OMRAgent_OnLoad + OMRAgent_OnUnload +) + add_library(traceNotStartedAgent SHARED traceNotStartedAgent.c omragent.def ) -target_link_libraries(traceNotStartedAgent PRIVATE omrtestutil) +target_link_libraries(traceNotStartedAgent PRIVATE omrtestutil) +omr_add_exports(traceNotStartedAgent + OMRAgent_OnLoad + OMRAgent_OnUnload +) add_library(cpuLoadAgent SHARED cpuLoadAgent.c omragent.def ) + target_link_libraries(cpuLoadAgent PUBLIC omrtestutil) +omr_add_exports(cpuLoadAgent + OMRAgent_OnLoad + OMRAgent_OnUnload +) + add_library(invalidAgentMissingOnLoad SHARED invalidAgentMissingOnLoad.c invalidAgentMissingOnLoad.def @@ -61,6 +89,10 @@ add_library(invalidAgentMissingOnLoad SHARED target_link_libraries(invalidAgentMissingOnLoad PUBLIC omr_base) +omr_add_exports(invalidAgentMissingOnLoad + OMRAgent_OnUnload +) + add_library(invalidAgentMissingOnUnload SHARED invalidAgentMissingOnUnload.c invalidAgentMissingOnUnload.def @@ -68,6 +100,10 @@ add_library(invalidAgentMissingOnUnload SHARED target_link_libraries(invalidAgentMissingOnUnload PUBLIC omr_base) +omr_add_exports(invalidAgentMissingOnUnload + OMRAgent_OnLoad +) + add_library(invalidAgentReturnError SHARED invalidAgentReturnError.c omragent.def @@ -75,6 +111,11 @@ add_library(invalidAgentReturnError SHARED target_link_libraries(invalidAgentReturnError PUBLIC omr_base) +omr_add_exports(invalidAgentReturnError + OMRAgent_OnLoad + OMRAgent_OnUnload +) + add_library(sampleSubscriber SHARED sampleSubscriber.c omragent.def @@ -82,18 +123,33 @@ add_library(sampleSubscriber SHARED target_link_libraries(sampleSubscriber PUBLIC omr_base) +omr_add_exports(sampleSubscriber + OMRAgent_OnLoad + OMRAgent_OnUnload +) + add_library(subscriberAgent SHARED subscriberAgent.c omragent.def ) target_link_libraries(subscriberAgent PRIVATE omrtestutil) +omr_add_exports(subscriberAgent + OMRAgent_OnLoad + OMRAgent_OnUnload +) + add_library(subscriberAgentWithJ9thread SHARED subscriberAgentWithJ9thread.c omragent.def ) target_link_libraries(subscriberAgentWithJ9thread PRIVATE omrtestutil) +omr_add_exports(subscriberAgentWithJ9thread + OMRAgent_OnLoad + OMRAgent_OnUnload +) + add_library(traceOptionAgent SHARED traceOptionAgent.c omragent.def @@ -104,6 +160,11 @@ target_link_libraries(traceOptionAgent omr_base ) +omr_add_exports(traceOptionAgent + OMRAgent_OnLoad + OMRAgent_OnUnload +) + add_executable(omrrastest agentNegativeTest.cpp agentTest.cpp diff --git a/fvtest/tril/examples/incordec/main.cpp b/fvtest/tril/examples/incordec/main.cpp index 09eb5f0bd6e..adf23fa8023 100644 --- a/fvtest/tril/examples/incordec/main.cpp +++ b/fvtest/tril/examples/incordec/main.cpp @@ -41,7 +41,7 @@ int main(int argc, char const * const * const argv) { printTrees(stdout, trees, 0); // assume that the file contians a single method and compile it - Tril::DefaultCompiler incordecCompiler{trees}; + Tril::DefaultCompiler incordecCompiler(trees); assert(incordecCompiler.compile() == 0); auto incordec = incordecCompiler.getEntryPoint(); diff --git a/fvtest/tril/examples/mandelbrot/main.cpp b/fvtest/tril/examples/mandelbrot/main.cpp index 8c634d5eb48..d923e916f56 100644 --- a/fvtest/tril/examples/mandelbrot/main.cpp +++ b/fvtest/tril/examples/mandelbrot/main.cpp @@ -23,6 +23,7 @@ #include "Jit.hpp" #include +#include #include typedef void (MandelbrotFunction) (int32_t, int32_t, int32_t*); @@ -41,13 +42,15 @@ int main(int argc, char const * const * const argv) { printTrees(stdout, trees, 0); // assume that the file contians a single method and compile it - Tril::DefaultCompiler mandelbrotCompiler{trees}; + Tril::DefaultCompiler mandelbrotCompiler(trees); assert(mandelbrotCompiler.compile() == 0); auto mandelbrot = mandelbrotCompiler.getEntryPoint(); const auto size = 80; // number of rows/columns in the output table const auto iterations = 1000; // number of iterations to be performed - int32_t table[size][size] = {{0}}; // the output table + int32_t table[size][size]; // the output table + + std::memset(table, 0, sizeof(table)); mandelbrot(iterations, size, &table[0][0]); diff --git a/fvtest/tril/test/ASTTest.cpp b/fvtest/tril/test/ASTTest.cpp index 5a06ab69b48..f3db41c9401 100644 --- a/fvtest/tril/test/ASTTest.cpp +++ b/fvtest/tril/test/ASTTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -75,7 +75,7 @@ TEST(ASTValueTest, CreateValueList) { v = v->next; ASSERT_EQ(ASTValue::String, v->getType()); ASSERT_STREQ(stringBaseValue, v->getString()); - ASSERT_EQ(NULL, v->next); + ASSERT_EQ(reinterpret_cast(NULL), v->next); } /* @@ -190,7 +190,7 @@ TEST(ASTNodeArgumentTest, CreateNodeArgumentWithJustInt64Value) { ASSERT_STREQ(NULL, arg->getName()); ASSERT_EQ(value, arg->getValue()); - ASSERT_EQ(NULL, arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } TEST(ASTNodeArgumentTest, CreateNodeArgumentWithJustFloat64Value) { @@ -200,7 +200,7 @@ TEST(ASTNodeArgumentTest, CreateNodeArgumentWithJustFloat64Value) { ASSERT_STREQ(NULL, arg->getName()); ASSERT_EQ(value, arg->getValue()); - ASSERT_EQ(NULL, arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } TEST(ASTNodeArgumentTest, CreateNodeArgumentWithJustStringValue) { @@ -210,7 +210,7 @@ TEST(ASTNodeArgumentTest, CreateNodeArgumentWithJustStringValue) { ASSERT_STREQ(NULL, arg->getName()); ASSERT_EQ(value, arg->getValue()); - ASSERT_EQ(NULL, arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } TEST(ASTNodeArgumentTest, CreateNodeArgumentWithNameAndInt64Value) { @@ -221,7 +221,7 @@ TEST(ASTNodeArgumentTest, CreateNodeArgumentWithNameAndInt64Value) { ASSERT_STREQ(argName, arg->getName()); ASSERT_EQ(value, arg->getValue()); - ASSERT_EQ(NULL, arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } TEST(ASTNodeArgumentTest, CreateListFrom2SingleNodeArguments) { @@ -241,7 +241,7 @@ TEST(ASTNodeArgumentTest, CreateListFrom2SingleNodeArguments) { ASSERT_STREQ(argName_1, arg_1->getName()); ASSERT_EQ(value_1, arg_1->getValue()); - ASSERT_EQ(NULL, arg_1->next); + ASSERT_EQ(reinterpret_cast(NULL), arg_1->next); } TEST(ASTNodeArgumentTest, Concatenate2SingleNodeArguments) { @@ -263,7 +263,7 @@ TEST(ASTNodeArgumentTest, Concatenate2SingleNodeArguments) { ASSERT_STREQ(argName_1, arg_1->getName()); ASSERT_EQ(value_1, arg_1->getValue()); - ASSERT_EQ(NULL, arg_1->next); + ASSERT_EQ(reinterpret_cast(NULL), arg_1->next); } TEST(ASTNodeArgumentTest, CreateListFromListOf2AndSingleArgument) { @@ -294,7 +294,7 @@ TEST(ASTNodeArgumentTest, CreateListFromListOf2AndSingleArgument) { ASSERT_STREQ(argName_2, arg_2->getName()); ASSERT_EQ(value_2, arg_2->getValue()); - ASSERT_EQ(NULL, arg_2->next); + ASSERT_EQ(reinterpret_cast(NULL), arg_2->next); } TEST(ASTNodeArgumentTest, CreateListFrom3SingleArguments) { @@ -326,7 +326,7 @@ TEST(ASTNodeArgumentTest, CreateListFrom3SingleArguments) { ASSERT_STREQ(argName_2, arg_2->getName()); ASSERT_EQ(value_2, arg_2->getValue()); - ASSERT_EQ(NULL, arg_2->next); + ASSERT_EQ(reinterpret_cast(NULL), arg_2->next); } TEST(ASTNodeArgumentTest, CompareArgumentsWithSelf) { @@ -390,9 +390,9 @@ TEST(ASTNodeTest, CreateNullNode) { auto node = createNode(NULL, NULL, NULL, NULL); ASSERT_STREQ(NULL, node->getName()); - ASSERT_EQ(NULL, node->getArgs()); - ASSERT_EQ(NULL, node->getChildren()); - ASSERT_EQ(NULL, node->next); + ASSERT_EQ(reinterpret_cast(NULL), node->getArgs()); + ASSERT_EQ(reinterpret_cast(NULL), node->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node->next); } TEST(ASTNodeTest, CreateNodeWithJustName) { @@ -400,9 +400,9 @@ TEST(ASTNodeTest, CreateNodeWithJustName) { auto node = createNode(nodeName, NULL, NULL, NULL); ASSERT_STREQ(nodeName, node->getName()); - ASSERT_EQ(NULL, node->getArgs()); - ASSERT_EQ(NULL, node->getChildren()); - ASSERT_EQ(NULL, node->next); + ASSERT_EQ(reinterpret_cast(NULL), node->getArgs()); + ASSERT_EQ(reinterpret_cast(NULL), node->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node->next); } TEST(ASTNodeTest, CreateNodeWithJust1Argument) { @@ -412,8 +412,8 @@ TEST(ASTNodeTest, CreateNodeWithJust1Argument) { ASSERT_STREQ(NULL, node->getName()); ASSERT_EQ(nodeArg, node->getArgs()); - ASSERT_EQ(NULL, node->getChildren()); - ASSERT_EQ(NULL, node->next); + ASSERT_EQ(reinterpret_cast(NULL), node->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node->next); } ASTNodeArg* getNodeArgList() { @@ -436,8 +436,8 @@ TEST(ASTNodeTest, CreateNodeWithJustArgumentList) { ASSERT_EQ(argList->next, node->getArgs()->next); ASSERT_EQ(argList->next->next, node->getArgs()->next->next); ASSERT_EQ(argList->next->next->next, node->getArgs()->next->next->next); - ASSERT_EQ(NULL, node->getChildren()); - ASSERT_EQ(NULL, node->next); + ASSERT_EQ(reinterpret_cast(NULL), node->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node->next); } TEST(ASTNodeTest, CreateListFrom2SingleNodes) { @@ -452,13 +452,13 @@ TEST(ASTNodeTest, CreateListFrom2SingleNodes) { ASSERT_STREQ(nodeName_0, node_0->getName()); ASSERT_EQ(argList_0, node_0->getArgs()); - ASSERT_EQ(NULL, node_0->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node_0->getChildren()); ASSERT_EQ(node_1, node_0->next); ASSERT_STREQ(nodeName_1, node_1->getName()); ASSERT_EQ(argList_1, node_1->getArgs()); - ASSERT_EQ(NULL, node_1->getChildren()); - ASSERT_EQ(NULL, node_1->next); + ASSERT_EQ(reinterpret_cast(NULL), node_1->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node_1->next); } TEST(ASTNodeTest, Concatenate2SingleNodes) { @@ -471,13 +471,13 @@ TEST(ASTNodeTest, Concatenate2SingleNodes) { ASSERT_STREQ(nodeName_0, node_0->getName()); ASSERT_EQ(argList_0, node_0->getArgs()); - ASSERT_EQ(NULL, node_0->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node_0->getChildren()); ASSERT_EQ(node_1, node_0->next); ASSERT_STREQ(nodeName_1, node_1->getName()); ASSERT_EQ(argList_1, node_1->getArgs()); - ASSERT_EQ(NULL, node_1->getChildren()); - ASSERT_EQ(NULL, node_1->next); + ASSERT_EQ(reinterpret_cast(NULL), node_1->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node_1->next); } TEST(ASTNodeTest, CreateListFromListOf2AndSingleNode) { @@ -496,18 +496,18 @@ TEST(ASTNodeTest, CreateListFromListOf2AndSingleNode) { ASSERT_STREQ(nodeName_0, node_0->getName()); ASSERT_EQ(argList_0, node_0->getArgs()); - ASSERT_EQ(NULL, node_0->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node_0->getChildren()); ASSERT_EQ(node_1, node_0->next); ASSERT_STREQ(nodeName_1, node_1->getName()); ASSERT_EQ(argList_1, node_1->getArgs()); - ASSERT_EQ(NULL, node_1->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node_1->getChildren()); ASSERT_EQ(node_2, node_1->next); ASSERT_STREQ(nodeName_2, node_2->getName()); ASSERT_EQ(argList_2, node_2->getArgs()); - ASSERT_EQ(NULL, node_2->getChildren()); - ASSERT_EQ(NULL, node_2->next); + ASSERT_EQ(reinterpret_cast(NULL), node_2->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node_2->next); } TEST(ASTNodeTest, Concatenate3SingleNodes) { @@ -525,18 +525,18 @@ TEST(ASTNodeTest, Concatenate3SingleNodes) { ASSERT_STREQ(nodeName_0, node_0->getName()); ASSERT_EQ(argList_0, node_0->getArgs()); - ASSERT_EQ(NULL, node_0->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node_0->getChildren()); ASSERT_EQ(node_1, node_0->next); ASSERT_STREQ(nodeName_1, node_1->getName()); ASSERT_EQ(argList_1, node_1->getArgs()); - ASSERT_EQ(NULL, node_1->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node_1->getChildren()); ASSERT_EQ(node_2, node_1->next); ASSERT_STREQ(nodeName_2, node_2->getName()); ASSERT_EQ(argList_2, node_2->getArgs()); - ASSERT_EQ(NULL, node_2->getChildren()); - ASSERT_EQ(NULL, node_2->next); + ASSERT_EQ(reinterpret_cast(NULL), node_2->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), node_2->next); } ASTNodeArg* getMixedArgumentList() { diff --git a/fvtest/tril/test/CompileTest.cpp b/fvtest/tril/test/CompileTest.cpp index 53a95a1e713..f8f5da19e5b 100644 --- a/fvtest/tril/test/CompileTest.cpp +++ b/fvtest/tril/test/CompileTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -34,7 +34,7 @@ TEST_F(CompileTest, Return3) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); ASSERT_EQ(0, compiler.compile()) << "Compilation failed"; @@ -49,8 +49,8 @@ TEST_F(CompileTest, NoCodeGen) { ASSERT_NOTNULL(trees); - Tril::DefaultCompiler compiler{trees}; - TR::NoCodegenVerifier verifier{NULL}; + Tril::DefaultCompiler compiler(trees); + TR::NoCodegenVerifier verifier(NULL); EXPECT_NE(0, compiler.compileWithVerifier(&verifier)) << "Compilation succeeded"; diff --git a/fvtest/tril/test/IlGenTest.cpp b/fvtest/tril/test/IlGenTest.cpp index a79dd980c75..08aa25a3f69 100644 --- a/fvtest/tril/test/IlGenTest.cpp +++ b/fvtest/tril/test/IlGenTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -45,11 +45,11 @@ TEST_F(IlGenTest, Return3) { TR::TypeDictionary types; auto Int32 = types.PrimitiveType(TR::Int32); - TR::IlType* argTypes[] = {Int32}; + TR::IlType* argTypes[] = { Int32 }; - Tril::TRLangBuilder injector{trees, &types}; - TR::ResolvedMethod compilee{__FILE__, LINETOSTR(__LINE__), "Return3InIL", sizeof(argTypes)/sizeof(TR::IlType*), argTypes, Int32, 0, &injector}; - TR::IlGeneratorMethodDetails methodDetails{&compilee}; + Tril::TRLangBuilder injector(trees, &types); + TR::ResolvedMethod compilee(__FILE__, LINETOSTR(__LINE__), "Return3InIL", sizeof(argTypes)/sizeof(TR::IlType*), argTypes, Int32, 0, &injector); + TR::IlGeneratorMethodDetails methodDetails(&compilee); int32_t rc = 0; auto entry_point = compileMethodFromDetails(NULL, methodDetails, warm, rc); diff --git a/fvtest/tril/test/MethodInfoTest.cpp b/fvtest/tril/test/MethodInfoTest.cpp index b48c786389a..aa9684b84c9 100644 --- a/fvtest/tril/test/MethodInfoTest.cpp +++ b/fvtest/tril/test/MethodInfoTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -27,63 +27,63 @@ TEST(MethodInfoTest, EmptyMethod) { auto methodAST = parseString("(method return=\"NoType\")"); - auto methodInfo = Tril::MethodInfo{methodAST}; + auto methodInfo = Tril::MethodInfo(methodAST); ASSERT_EQ("", methodInfo.getName()); ASSERT_EQ(TR::NoType, methodInfo.getReturnType()); ASSERT_EQ(0, methodInfo.getArgCount()); ASSERT_EQ(0, methodInfo.getArgTypes().size()); - ASSERT_NULL(methodInfo.getBodyAST()); + ASSERT_EQ(reinterpret_cast(NULL), methodInfo.getBodyAST()); } TEST(MethodInfoTest, EmptyMethodWithInt16Return) { auto methodAST = parseString("(method return=\"Int16\")"); - auto methodInfo = Tril::MethodInfo{methodAST}; + auto methodInfo = Tril::MethodInfo(methodAST); ASSERT_EQ("", methodInfo.getName()); ASSERT_EQ(TR::Int16, methodInfo.getReturnType()); ASSERT_EQ(0, methodInfo.getArgCount()); ASSERT_EQ(0, methodInfo.getArgTypes().size()); - ASSERT_NULL(methodInfo.getBodyAST()); + ASSERT_EQ(reinterpret_cast(NULL), methodInfo.getBodyAST()); } TEST(MethodInfoTest, EmptyMethodWithDoubleReturn) { auto methodAST = parseString("(method return=\"Double\")"); - auto methodInfo = Tril::MethodInfo{methodAST}; + auto methodInfo = Tril::MethodInfo(methodAST); ASSERT_EQ("", methodInfo.getName()); ASSERT_EQ(TR::Double, methodInfo.getReturnType()); ASSERT_EQ(0, methodInfo.getArgCount()); ASSERT_EQ(0, methodInfo.getArgTypes().size()); - ASSERT_NULL(methodInfo.getBodyAST()); + ASSERT_EQ(reinterpret_cast(NULL), methodInfo.getBodyAST()); } TEST(MethodInfoTest, EmptyMethodWithName) { auto methodAST = parseString("(method name=\"empty\" return=\"NoType\")"); - auto methodInfo = Tril::MethodInfo{methodAST}; + auto methodInfo = Tril::MethodInfo(methodAST); ASSERT_EQ("empty", methodInfo.getName()); ASSERT_EQ(TR::NoType, methodInfo.getReturnType()); ASSERT_EQ(0, methodInfo.getArgCount()); ASSERT_EQ(0, methodInfo.getArgTypes().size()); - ASSERT_NULL(methodInfo.getBodyAST()); + ASSERT_EQ(reinterpret_cast(NULL), methodInfo.getBodyAST()); } TEST(MethodInfoTest, EmptyMethodWithInt32Argument) { auto methodAST = parseString("(method return=\"NoType\" args=[\"Int32\"])"); - auto methodInfo = Tril::MethodInfo{methodAST}; + auto methodInfo = Tril::MethodInfo(methodAST); ASSERT_EQ("", methodInfo.getName()); ASSERT_EQ(TR::NoType, methodInfo.getReturnType()); ASSERT_EQ(1, methodInfo.getArgCount()); ASSERT_EQ(1, methodInfo.getArgTypes().size()); ASSERT_EQ(TR::Int32, methodInfo.getArgTypes().at(0)); - ASSERT_NULL(methodInfo.getBodyAST()); + ASSERT_EQ(reinterpret_cast(NULL), methodInfo.getBodyAST()); } TEST(MethodInfoTest, EmptyMethodWithFloatAndInt32Arguments) { auto methodAST = parseString("(method return=\"NoType\" args=[\"Float\", \"Int32\"])"); - auto methodInfo = Tril::MethodInfo{methodAST}; + auto methodInfo = Tril::MethodInfo(methodAST); ASSERT_EQ("", methodInfo.getName()); ASSERT_EQ(TR::NoType, methodInfo.getReturnType()); @@ -91,12 +91,12 @@ TEST(MethodInfoTest, EmptyMethodWithFloatAndInt32Arguments) { ASSERT_EQ(2, methodInfo.getArgTypes().size()); ASSERT_EQ(TR::Float, methodInfo.getArgTypes().at(0)); ASSERT_EQ(TR::Int32, methodInfo.getArgTypes().at(1)); - ASSERT_NULL(methodInfo.getBodyAST()); + ASSERT_EQ(reinterpret_cast(NULL), methodInfo.getBodyAST()); } TEST(MethodInfoTest, MethodWithBody) { auto methodAST = parseString("(method return=\"NoType\" (block (return)))"); - auto methodInfo = Tril::MethodInfo{methodAST}; + auto methodInfo = Tril::MethodInfo(methodAST); ASSERT_EQ("", methodInfo.getName()); ASSERT_EQ(TR::NoType, methodInfo.getReturnType()); @@ -107,7 +107,7 @@ TEST(MethodInfoTest, MethodWithBody) { TEST(MethodInfoTest, MethodWithBodyInt8ReturnInt32andInt64Args) { auto methodAST = parseString("(method name=\"foo\" return=\"Int8\" args=[\"Int32\", \"Int64\"] (block (breturn (bconst 3))))"); - auto methodInfo = Tril::MethodInfo{methodAST}; + auto methodInfo = Tril::MethodInfo(methodAST); ASSERT_EQ("foo", methodInfo.getName()); ASSERT_EQ(TR::Int8, methodInfo.getReturnType()); diff --git a/fvtest/tril/test/ParserTest.cpp b/fvtest/tril/test/ParserTest.cpp index 8a3c9a3bb4d..33af5b631c4 100644 --- a/fvtest/tril/test/ParserTest.cpp +++ b/fvtest/tril/test/ParserTest.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -36,9 +36,9 @@ TEST_P(SingleNodeWithName, VerifyNode) { ASSERT_NOTNULL(trees); ASSERT_STREQ(GetParam().second, trees->getName()); - ASSERT_NULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getArgs()); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); } INSTANTIATE_TEST_CASE_P( @@ -54,15 +54,15 @@ TEST(ParserTest, TwoNodesWithJustName) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); - ASSERT_NULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->getArgs()); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); ASSERT_NOTNULL(trees->next); trees = trees->next; ASSERT_STREQ("otherNode", trees->getName()); - ASSERT_NULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getArgs()); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); } TEST(ParserTest, SingleNodeWithChild) { @@ -70,15 +70,15 @@ TEST(ParserTest, SingleNodeWithChild) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); - ASSERT_NULL(trees->getArgs()); + ASSERT_EQ(reinterpret_cast(NULL), trees->getArgs()); ASSERT_NOTNULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); trees = trees->getChildren(); ASSERT_STREQ("childNode", trees->getName()); - ASSERT_NULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getArgs()); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); } TEST(ParserTest, NodeWithChildAndSibling) { @@ -86,21 +86,21 @@ TEST(ParserTest, NodeWithChildAndSibling) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); - ASSERT_NULL(trees->getArgs()); + ASSERT_EQ(reinterpret_cast(NULL), trees->getArgs()); ASSERT_NOTNULL(trees->getChildren()); ASSERT_NOTNULL(trees->next); auto child = trees->getChildren(); ASSERT_STREQ("childNode", child->getName()); - ASSERT_NULL(child->getArgs()); - ASSERT_NULL(child->getChildren()); - ASSERT_NULL(child->next); + ASSERT_EQ(reinterpret_cast(NULL), child->getArgs()); + ASSERT_EQ(reinterpret_cast(NULL), child->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), child->next); auto sibling = trees->next; ASSERT_STREQ("siblingNode", sibling->getName()); - ASSERT_NULL(sibling->getArgs()); - ASSERT_NULL(sibling->getChildren()); - ASSERT_NULL(sibling->next); + ASSERT_EQ(reinterpret_cast(NULL), sibling->getArgs()); + ASSERT_EQ(reinterpret_cast(NULL), sibling->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), sibling->next); } typedef std::pair TestParamWithExpectedResultInt; @@ -113,14 +113,14 @@ TEST_P(SingleNodeWithIntArg, VerifyNode) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("", arg->getName()); ASSERT_EQ(ASTValue::Integer, arg->getValue()->getType()); ASSERT_EQ(GetParam().second, arg->getValue()->getInteger()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } INSTANTIATE_TEST_CASE_P( @@ -153,14 +153,14 @@ TEST_P(SingleNodeWithFloatArg, VerifyNode) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("", arg->getName()); ASSERT_EQ(ASTValue::FloatingPoint, arg->getValue()->getType()); ASSERT_EQ(GetParam().second, arg->getValue()->getFloatingPoint()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } INSTANTIATE_TEST_CASE_P( @@ -178,14 +178,14 @@ TEST(ParserTest, SingleNodeWithStringArg) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("", arg->getName()); ASSERT_EQ(ASTValue::String, arg->getValue()->getType()); ASSERT_STREQ("foo", arg->getValue()->getString()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } class SingleNodeWithUnnamedArg : public testing::TestWithParam {}; @@ -196,14 +196,14 @@ TEST_P(SingleNodeWithUnnamedArg, VerifyNode) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("", arg->getName()); ASSERT_EQ(ASTValue::String, arg->getValue()->getType()); ASSERT_STREQ(GetParam().second, arg->getValue()->getString()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } INSTANTIATE_TEST_CASE_P( @@ -220,14 +220,14 @@ TEST(ParserTest, SingleNodeWithNamedArg) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("arg", arg->getName()); ASSERT_EQ(ASTValue::FloatingPoint, arg->getValue()->getType()); ASSERT_EQ(3.14, arg->getValue()->getFloatingPoint()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } TEST(ParserTest, SingleNodeWithNamedIdentifierArg) { @@ -236,14 +236,14 @@ TEST(ParserTest, SingleNodeWithNamedIdentifierArg) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("arg", arg->getName()); ASSERT_EQ(ASTValue::String, arg->getValue()->getType()); ASSERT_STREQ("ID", arg->getValue()->getString()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } TEST(ParserTest, SingleNodeWithNamedCommandArg) { @@ -252,14 +252,14 @@ TEST(ParserTest, SingleNodeWithNamedCommandArg) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("arg", arg->getName()); ASSERT_EQ(ASTValue::String, arg->getValue()->getType()); ASSERT_STREQ("@cmd", arg->getValue()->getString()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } TEST(ParserTest, SingleNodeWithNamedArgAndAnonymousArg) { @@ -268,8 +268,8 @@ TEST(ParserTest, SingleNodeWithNamedArgAndAnonymousArg) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("arg", arg->getName()); @@ -281,7 +281,7 @@ TEST(ParserTest, SingleNodeWithNamedArgAndAnonymousArg) { ASSERT_STREQ("", arg->getName()); ASSERT_EQ(ASTValue::FloatingPoint, arg->getValue()->getType()); ASSERT_EQ(6.33, arg->getValue()->getFloatingPoint()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } TEST(ParserTest, SingleNodeWithNamedListArg) { @@ -290,8 +290,8 @@ TEST(ParserTest, SingleNodeWithNamedListArg) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("arg", arg->getName()); @@ -310,7 +310,7 @@ TEST(ParserTest, SingleNodeWithNamedListArg) { value = value->next; ASSERT_EQ(ASTValue::String, value->getType()); ASSERT_STREQ("foo", value->getString()); - ASSERT_NULL(value->next); + ASSERT_EQ(reinterpret_cast(NULL), value->next); } TEST(ParserTest, SingleNodeWithAnonymousArgAndNamedArg) { @@ -319,8 +319,8 @@ TEST(ParserTest, SingleNodeWithAnonymousArgAndNamedArg) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("", arg->getName()); @@ -332,7 +332,7 @@ TEST(ParserTest, SingleNodeWithAnonymousArgAndNamedArg) { ASSERT_STREQ("arg2", arg->getName()); ASSERT_EQ(ASTValue::Integer, arg->getValue()->getType()); ASSERT_EQ(2, arg->getValue()->getInteger()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } TEST(ParserTest, SingleNodeWithNamedArgAndChild) { @@ -342,19 +342,19 @@ TEST(ParserTest, SingleNodeWithNamedArgAndChild) { ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); ASSERT_NOTNULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("arg", arg->getName()); ASSERT_EQ(ASTValue::Integer, arg->getValue()->getType()); ASSERT_EQ(3, arg->getValue()->getInteger()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); trees = trees->getChildren(); ASSERT_STREQ("childNode", trees->getName()); - ASSERT_NULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getArgs()); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); } TEST(ParserTest, SingleNodeWithAnonymousArgAndChildWithNamedArg) { @@ -364,25 +364,25 @@ TEST(ParserTest, SingleNodeWithAnonymousArgAndChildWithNamedArg) { ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); ASSERT_NOTNULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("", arg->getName()); ASSERT_EQ(ASTValue::String, arg->getValue()->getType()); ASSERT_STREQ("bar", arg->getValue()->getString()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); trees = trees->getChildren(); ASSERT_STREQ("childNode", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); arg = trees->getArgs(); ASSERT_STREQ("arg", arg->getName()); ASSERT_EQ(ASTValue::FloatingPoint, arg->getValue()->getType()); ASSERT_EQ(4.0, arg->getValue()->getFloatingPoint()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } TEST(ParserTest, SingleNodeWithTwoAnonymousArgs) { @@ -391,8 +391,8 @@ TEST(ParserTest, SingleNodeWithTwoAnonymousArgs) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("", arg->getName()); @@ -404,7 +404,7 @@ TEST(ParserTest, SingleNodeWithTwoAnonymousArgs) { ASSERT_STREQ("", arg->getName()); ASSERT_EQ(ASTValue::FloatingPoint, arg->getValue()->getType()); ASSERT_EQ(3.14159, arg->getValue()->getFloatingPoint()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } TEST(ParserTest, SingleNodeWithTwoNamedArgs) { @@ -413,8 +413,8 @@ TEST(ParserTest, SingleNodeWithTwoNamedArgs) { ASSERT_NOTNULL(trees); ASSERT_STREQ("nodeName", trees->getName()); ASSERT_NOTNULL(trees->getArgs()); - ASSERT_NULL(trees->getChildren()); - ASSERT_NULL(trees->next); + ASSERT_EQ(reinterpret_cast(NULL), trees->getChildren()); + ASSERT_EQ(reinterpret_cast(NULL), trees->next); auto arg = trees->getArgs(); ASSERT_STREQ("pi", arg->getName()); @@ -426,5 +426,5 @@ TEST(ParserTest, SingleNodeWithTwoNamedArgs) { ASSERT_STREQ("e", arg->getName()); ASSERT_EQ(ASTValue::FloatingPoint, arg->getValue()->getType()); ASSERT_EQ(2.71828, arg->getValue()->getFloatingPoint()); - ASSERT_NULL(arg->next); + ASSERT_EQ(reinterpret_cast(NULL), arg->next); } diff --git a/fvtest/tril/tril/CMakeLists.txt b/fvtest/tril/tril/CMakeLists.txt index 232a97c06c2..20143b84391 100644 --- a/fvtest/tril/tril/CMakeLists.txt +++ b/fvtest/tril/tril/CMakeLists.txt @@ -23,18 +23,17 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/modules" ${CMAKE_MODULE_PATH}) include(OmrUtility) +include(FindYACC) +include(FindLEX) -find_package(BISON REQUIRED) -find_package(FLEX REQUIRED) +find_package(YACC REQUIRED) +find_package(LEX REQUIRED) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) set(CMAKE_CXX_EXTENSIONS OFF) -list(APPEND TRIL_FLEX_FLAGS - --yylineno - --header-file=${CMAKE_CURRENT_BINARY_DIR}/tril.scanner.h -) +list(APPEND TRIL_FLEX_FLAGS) # There is no unistd.h on Windows, so if win_flex.exe is in use, # the --wincompat option must be added. @@ -45,17 +44,18 @@ if(OMR_HOST_OS STREQUAL "win") endif() omr_stringify(TRIL_FLEX_OPTIONS ${TRIL_FLEX_FLAGS}) -BISON_TARGET(tril_parser tril.y ${CMAKE_CURRENT_BINARY_DIR}/tril.parser.c) -FLEX_TARGET(tril_scanner tril.l ${CMAKE_CURRENT_BINARY_DIR}/tril.scanner.c +YACC_TARGET(tril_parser tril.y ${CMAKE_CURRENT_BINARY_DIR}/tril.parser.c + DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/tril.parser.h) +LEX_TARGET(tril_scanner tril.l ${CMAKE_CURRENT_BINARY_DIR}/tril.scanner.c COMPILE_FLAGS ${TRIL_FLEX_OPTIONS} ) -ADD_FLEX_BISON_DEPENDENCY(tril_scanner tril_parser) +ADD_LEX_YACC_DEPENDENCY(tril_scanner tril_parser) set(TRIL_BACKEND_LIB testcompiler) add_library(tril STATIC - ${BISON_tril_parser_OUTPUTS} - ${FLEX_tril_scanner_OUTPUTS} + ${YACC_tril_parser_OUTPUTS} + ${LEX_tril_scanner_OUTPUTS} ast.cpp ilgen.cpp simple_compiler.cpp diff --git a/fvtest/tril/tril/ast.cpp b/fvtest/tril/tril/ast.cpp index 39c1071cdfa..1b80bf26574 100644 --- a/fvtest/tril/tril/ast.cpp +++ b/fvtest/tril/tril/ast.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2018 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -25,23 +25,23 @@ #include ASTNode* createNode(const char * name, ASTNodeArg* args, ASTNode* children, ASTNode* next) { - return new ASTNode{name, args, children, next}; + return new ASTNode(name, args, children, next); } ASTNodeArg* createNodeArg(const char * name, ASTValue* value, ASTNodeArg* next) { - return new ASTNodeArg{name, value, next}; + return new ASTNodeArg(name, value, next); } ASTValue* createIntegerValue(uint64_t val) { - return new ASTValue{val}; + return new ASTValue(val); } ASTValue* createFloatingPointValue(double val) { - return new ASTValue{val}; + return new ASTValue(val); } ASTValue* createStrValue(const char* val) { - return new ASTValue{val}; + return new ASTValue(val); } void appendSiblingNode(ASTNode* list, ASTNode* newNode) { diff --git a/fvtest/tril/tril/ast.hpp b/fvtest/tril/tril/ast.hpp index d2d5a1182a9..5582b8803e4 100644 --- a/fvtest/tril/tril/ast.hpp +++ b/fvtest/tril/tril/ast.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2018 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -79,9 +79,9 @@ struct ASTValue { */ // constructors - explicit ASTValue(Integer_t v) : _type{Integer}, next{NULL} { _value.integer = v; } - explicit ASTValue(FloatingPoint_t v) : _type{FloatingPoint}, next{NULL} { _value.floatingPoint = v; } - explicit ASTValue(String_t v) : _type{String}, next{NULL} { _value.str = v; } + explicit ASTValue(Integer_t v) : _type(Integer), next(NULL) { _value.integer = v; } + explicit ASTValue(FloatingPoint_t v) : _type(FloatingPoint), next(NULL) { _value.floatingPoint = v; } + explicit ASTValue(String_t v) : _type(String), next(NULL) { _value.str = v; } /** * @brief Return the contained value as the specified type @@ -218,7 +218,7 @@ struct ASTNodeArg { ASTNodeArg* next; ASTNodeArg(const char* name, ASTValue* value, ASTNodeArg* next = NULL) - : _name{name}, _value{value}, next{next} {} + : _name(name), _value(value), next(next) {} const char* getName() const { return _name; } const ASTValue* getValue() const { return _value; } @@ -245,7 +245,7 @@ struct ASTNode { ASTNode* next; ASTNode(const char* name, ASTNodeArg* args, ASTNode* children, ASTNode* next) - : _name{name}, _args{args}, _children{children}, next{next} {} + : _name(name), _args(args), _children(children), next(next) {} const char* getName() const { return _name; } diff --git a/fvtest/tril/tril/compiler.cpp b/fvtest/tril/tril/compiler.cpp index f181324d71a..c53c061ec97 100644 --- a/fvtest/tril/tril/compiler.cpp +++ b/fvtest/tril/tril/compiler.cpp @@ -47,7 +47,7 @@ int main(int argc, char** argv) if (!isDumper) { initializeJit(); - Tril::DefaultCompiler compiler{trees}; + Tril::DefaultCompiler compiler(trees); if (compiler.compile() != 0) { fprintf(out, "Error compiling trees!"); } diff --git a/fvtest/tril/tril/compiler_util.hpp b/fvtest/tril/tril/compiler_util.hpp index 69fa1e6d1fa..754fe8e3a1e 100644 --- a/fvtest/tril/tril/compiler_util.hpp +++ b/fvtest/tril/tril/compiler_util.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -48,7 +48,7 @@ static TR::DataTypes getTRDataTypes(const std::string& name) { else if (name == "VectorDouble") return TR::VectorDouble; else if (name == "NoType") return TR::NoType; else { - throw std::runtime_error{static_cast(std::string{"Unknown type name: "}.append(name))}; + throw std::runtime_error(static_cast(std::string("Unknown type name: ").append(name))); } } diff --git a/fvtest/tril/tril/ilgen.cpp b/fvtest/tril/tril/ilgen.cpp index ad72b43914d..7a1ef0f1c69 100644 --- a/fvtest/tril/tril/ilgen.cpp +++ b/fvtest/tril/tril/ilgen.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2018 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -27,7 +27,6 @@ #include "il/Node.hpp" #include "il/Node_inlines.hpp" -#include #include #define TraceEnabled (comp()->getOption(TR_TraceILGen)) @@ -38,15 +37,15 @@ */ class OpCodeTable : public TR::ILOpCode { public: - explicit OpCodeTable(TR::ILOpCodes opcode) : TR::ILOpCode{opcode} {} - explicit OpCodeTable(const std::string& name) : TR::ILOpCode{getOpCodeFromName(name)} {} + explicit OpCodeTable(TR::ILOpCodes opcode) : TR::ILOpCode(opcode) {} + explicit OpCodeTable(const std::string& name) : TR::ILOpCode(getOpCodeFromName(name)) {} /** * @brief Given an opcode name, returns the corresponding TR::OpCodes value */ static TR::ILOpCodes getOpCodeFromName(const std::string& name) { auto opcode = _opcodeNameMap.find(name); - if (opcode == _opcodeNameMap.cend()) { + if (opcode == _opcodeNameMap.end()) { for (int i = TR::FirstOMROp; i< TR::NumIlOps; i++) { const auto p_opCode = static_cast(i); const auto& p = TR::ILOpCode::_opCodeProperties[p_opCode]; @@ -63,10 +62,10 @@ class OpCodeTable : public TR::ILOpCode { } private: - static std::unordered_map _opcodeNameMap; + static std::map _opcodeNameMap; }; -std::unordered_map OpCodeTable::_opcodeNameMap; +std::map OpCodeTable::_opcodeNameMap; @@ -119,7 +118,7 @@ TR::Node* Tril::TRLangBuilder::toTRNode(const ASTNode* const tree) { } } - auto opcode = OpCodeTable{tree->getName()}; + auto opcode = OpCodeTable(tree->getName()); TraceIL("Creating %s from ASTNode %p\n", opcode.getName(), tree); if (opcode.isLoadConst()) { @@ -278,9 +277,9 @@ TR::Node* Tril::TRLangBuilder::toTRNode(const ASTNode* const tree) { */ const auto argList = parseArgTypes(tree); - auto argIlTypes = std::vector{argList.size()}; + auto argIlTypes = std::vector(argList.size()); auto output = argIlTypes.begin(); - for (auto iter = argList.cbegin(); iter != argList.cend(); iter++, output++) { + for (auto iter = argList.begin(); iter != argList.end(); iter++, output++) { *output = _types.PrimitiveType(*iter); } @@ -290,7 +289,7 @@ TR::Node* Tril::TRLangBuilder::toTRNode(const ASTNode* const tree) { "line", "name", argIlTypes.size(), - argIlTypes.data(), + &argIlTypes[0], returnIlType, targetAddress, 0); @@ -365,7 +364,7 @@ bool Tril::TRLangBuilder::cfgFor(const ASTNode* const tree) { t = t->next; } - auto opcode = OpCodeTable{tree->getName()}; + auto opcode = OpCodeTable(tree->getName()); if (opcode.isReturn()) { cfg()->addEdge(_currentBlock, cfg()->getEnd()); @@ -461,7 +460,7 @@ bool Tril::TRLangBuilder::injectIL() { // do nothing, no fall-throught block specified } else { - auto destBlock = _blockMap.at(target); + auto destBlock = _blockMap[target]; cfg()->addEdge(_currentBlock, _blocks[destBlock]); TraceIL("Added fallthrough edge from block %d to block %d \"%s\"\n", _currentBlockNumber, destBlock, target.c_str()); } diff --git a/fvtest/tril/tril/ilgen.hpp b/fvtest/tril/tril/ilgen.hpp index 7888b9d528e..0fe2a5480d8 100644 --- a/fvtest/tril/tril/ilgen.hpp +++ b/fvtest/tril/tril/ilgen.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -30,7 +30,6 @@ #include #include #include -#include namespace Tril { diff --git a/fvtest/tril/tril/method_compiler.hpp b/fvtest/tril/tril/method_compiler.hpp index 835dc9ab531..ef859a25877 100644 --- a/fvtest/tril/tril/method_compiler.hpp +++ b/fvtest/tril/tril/method_compiler.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -43,8 +43,8 @@ class MethodCompiler { * @param methodNode is the AST node representing the Tril method to be compiled */ explicit MethodCompiler(const ASTNode* methodNode) - : _method{methodNode}, - _entry_point{NULL} + : _method(methodNode), + _entry_point(NULL) {} virtual ~MethodCompiler() = default; @@ -77,9 +77,11 @@ class MethodCompiler { */ template T getEntryPoint() { +#if !defined(J9ZOS390) static_assert( std::is_pointer::value && std::is_function::type>::value, "Attempted to get entry point using a non-function-pointer type."); +#endif return reinterpret_cast(_entry_point); } diff --git a/fvtest/tril/tril/method_info.hpp b/fvtest/tril/tril/method_info.hpp index f5ef6fe8fb5..fdcb7902522 100644 --- a/fvtest/tril/tril/method_info.hpp +++ b/fvtest/tril/tril/method_info.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -42,7 +42,7 @@ class MethodInfo { * @brief Constructs a MethodInfo object from a Tril AST node * @param methodNode is the Tril AST node */ - explicit MethodInfo(const ASTNode* methodNode) : _methodNode{methodNode} { + explicit MethodInfo(const ASTNode* methodNode) : _methodNode(methodNode) { auto returnTypeArg = _methodNode->getArgByName("return"); _returnType = getTRDataTypes(returnTypeArg->getValue()->getString()); _argTypes = parseArgTypes(_methodNode); diff --git a/fvtest/tril/tril/simple_compiler.cpp b/fvtest/tril/tril/simple_compiler.cpp index 851077f02ac..1e58cb1459c 100644 --- a/fvtest/tril/tril/simple_compiler.cpp +++ b/fvtest/tril/tril/simple_compiler.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -43,21 +43,21 @@ int32_t Tril::SimpleCompiler::compileWithVerifier(TR::IlVerifier* verifier) { // construct an IL generator for the method auto methodInfo = getMethodInfo(); TR::TypeDictionary types; - Tril::TRLangBuilder ilgenerator{methodInfo.getBodyAST(), &types}; + Tril::TRLangBuilder ilgenerator(methodInfo.getBodyAST(), &types); // get a list of the method's argument types and transform it // into a list of `TR::IlType` auto argTypes = methodInfo.getArgTypes(); - auto argIlTypes = std::vector{argTypes.size()}; + auto argIlTypes = std::vector(argTypes.size()); auto it_argIlTypes = argIlTypes.begin(); - for (auto it = argTypes.cbegin(); it != argTypes.cend(); it++) { + for (auto it = argTypes.begin(); it != argTypes.end(); it++) { *it_argIlTypes++ = types.PrimitiveType(*it); } // construct a `TR::ResolvedMethod` instance from the IL generator and use // to compile the method TR::ResolvedMethod resolvedMethod("file", "line", "name", argIlTypes.size(), - argIlTypes.data(), + &argIlTypes[0], types.PrimitiveType(methodInfo.getReturnType()), 0, &ilgenerator); @@ -73,7 +73,23 @@ int32_t Tril::SimpleCompiler::compileWithVerifier(TR::IlVerifier* verifier) { auto entry_point = compileMethodFromDetails(NULL, methodDetails, warm, rc); // if compilation was successful, set the entry point for the compiled body - if (rc == 0) setEntryPoint(entry_point); + if (rc == 0) + { +#if defined(J9ZOS390) + struct FunctionDescriptor + { + uint64_t environment; + void* func; + }; + + FunctionDescriptor* fd = new FunctionDescriptor(); + fd->environment = 0; + fd->func = entry_point; + + entry_point = (uint8_t*) fd; +#endif + setEntryPoint(entry_point); + } // return the return code for the compilation return rc; diff --git a/fvtest/tril/tril/simple_compiler.hpp b/fvtest/tril/tril/simple_compiler.hpp index 6bc20192419..af8298d3a8c 100644 --- a/fvtest/tril/tril/simple_compiler.hpp +++ b/fvtest/tril/tril/simple_compiler.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2017 IBM Corp. and others + * Copyright (c) 2017, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -34,7 +34,7 @@ namespace Tril { class SimpleCompiler : public Tril::MethodCompiler { public: explicit SimpleCompiler(const ASTNode* methodNode) - : MethodCompiler{methodNode} {} + : MethodCompiler(methodNode) {} /** * @brief Compiles the Tril method diff --git a/fvtest/tril/tril/tril.l b/fvtest/tril/tril/tril.l index cf9feb8286c..a2f071efdf5 100644 --- a/fvtest/tril/tril/tril.l +++ b/fvtest/tril/tril/tril.l @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corp. and others + * Copyright (c) 2000, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -24,58 +24,56 @@ #include "ast.h" #include "tril.parser.h" #include - - void yyerror(char *s); %} %% @?[a-zA-Z][a-zA-Z0-9]* { - char* name = (char*)malloc(yyleng*sizeof(char) + 1); - snprintf(name, yyleng + 1, "%s", yytext); - yylval.str = name; - return IDENTIFIER; + char* name = (char*)malloc(yyleng*sizeof(char) + 1); + snprintf(name, yyleng + 1, "%s", yytext); + yylval.str = name; + return IDENTIFIER; }; -[-]?[0-9]+ { - yylval.integer = strtoull(yytext, NULL, 10); - return INTEGER; - }; - -[-]?0x[0-9a-fA-F]+ { - yylval.integer = strtoull(yytext, NULL, 16); - return INTEGER; - } +[-]?[0-9]+ { + yylval.integer = strtoull(yytext, NULL, 10); + return INTEGER; + }; +[-]?0x[0-9a-fA-F]+ { + yylval.integer = strtoull(yytext, NULL, 16); + return INTEGER; + }; -[-]?[0-9]+[.][0-9]+ { - yylval.f64 = strtod(yytext, NULL); - return DOUBLE; - } +[-]?[0-9]+[.][0-9]+ { + yylval.f64 = strtod(yytext, NULL); + return DOUBLE; + }; -;[^\n]* ; /* ignore comment */ +;[^\n]* ; /* ignore comment */ -\"[^"]*\" { - char* val = (char*)malloc(yyleng*sizeof(char) + 1); - snprintf(val, yyleng - 1, "%s", yytext + 1); // remove surrounding " - yylval.str = val; - return STRING; - }; +\"[^"]*\" { + char* val = (char*)malloc(yyleng*sizeof(char) + 1); + snprintf(val, yyleng - 1, "%s", yytext + 1); + yylval.str = val; + return STRING; + }; -[()[\]=,] return *yytext; +[()[\]=,] return *yytext; -[ \t\n] ; /* ignore white space */ +[ \t\n] ; /* ignore white space */ -. fprintf(stderr, "Invalid character '%s'\n", yytext); +. fprintf(stderr, "Invalid character '%s'\n", yytext); %% -void set_input_string(const char* in) { - yy_scan_string(in); +void set_input_file(FILE* in) { + yyin = in; } -void end_lexical_scan(void) { - yy_delete_buffer(YY_CURRENT_BUFFER); +int yyerror(char *s, ...) { + fprintf(stderr, "Tril lexer error on line %d: %s\n", yylineno, s); + return 1; } int yywrap(void) { diff --git a/fvtest/tril/tril/tril.y b/fvtest/tril/tril/tril.y index 8db7c7a3bfb..f99e64eb812 100644 --- a/fvtest/tril/tril/tril.y +++ b/fvtest/tril/tril/tril.y @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corp. and others + * Copyright (c) 2000, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -22,14 +22,8 @@ %{ #include "ast.h" - #include "tril.scanner.h" #include - void yyerror(char *); - int yylex(void); - void set_input_string(const char* in); - void end_lexical_scan(void); - static ASTNode* trees; %} @@ -126,6 +120,7 @@ valueList: appendSiblingValue($1, $3); $$ = $1; } + ; value: INTEGER @@ -151,19 +146,25 @@ value: %% -void yyerror(char *s) { - fprintf(stderr, "line %d: %s\n", yylineno, s); -} - ASTNode* parseFile(FILE* in) { - yyin = in; + set_input_file(in); yyparse(); return trees; } ASTNode* parseString(const char* in) { - set_input_string(in); - yyparse(); - end_lexical_scan(); + FILE* pf = tmpfile(); + if (pf != NULL) { + if(fputs(in, pf) >= 0) { + fflush(pf); + fseek(pf, 0, SEEK_SET); + parseFile(pf); + } else { + fprintf(stderr, "Tril parser error: Could not write to temporary file \n"); + } + } else { + fprintf(stderr, "Tril parser error: Could not create temporary file for writing \n"); + } + fclose(pf); return trees; } diff --git a/jitbuilder/CMakeLists.txt b/jitbuilder/CMakeLists.txt index ab3e3c8caa5..de629dd4ce5 100644 --- a/jitbuilder/CMakeLists.txt +++ b/jitbuilder/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2017, 2018 IBM Corp. and others +# Copyright (c) 2017, 2019 IBM Corp. and others # # This program and the accompanying materials are made available under # the terms of the Eclipse Public License 2.0 which accompanies this @@ -22,7 +22,7 @@ include(OmrCompilerSupport) -find_package(PythonInterp 3.1 REQUIRED) +find_package(PythonInterp REQUIRED) # JitBuilder Files set(JITBUILDER_OBJECTS diff --git a/jitbuilder/build/toolcfg/gnu/common.mk b/jitbuilder/build/toolcfg/gnu/common.mk index a028873ca37..f759f9758f0 100644 --- a/jitbuilder/build/toolcfg/gnu/common.mk +++ b/jitbuilder/build/toolcfg/gnu/common.mk @@ -164,12 +164,12 @@ ifeq ($(PLATFORM),ppc64le-linux64-gcc) endif ifeq ($(PLATFORM),s390-linux-gcc) - CX_DEFINES+=J9VM_TIERED_CODE_CACHE MAXMOVE S390 FULL_ANSI + CX_DEFINES+=S390 FULL_ANSI CX_FLAGS+=-m31 -fPIC -fno-strict-aliasing -mtune=z10 -march=z9-109 -mzarch endif ifeq ($(PLATFORM),s390-linux64-gcc) - CX_DEFINES+=S390 S39064 FULL_ANSI MAXMOVE J9VM_TIERED_CODE_CACHE + CX_DEFINES+=S390 FULL_ANSI S39064 CX_FLAGS+=-fPIC -fno-strict-aliasing -mtune=z10 -march=z9-109 -mzarch endif @@ -280,17 +280,13 @@ ifeq ($(HOST_ARCH),z) M4_INCLUDES=$(PRODUCT_INCLUDES) M4_DEFINES+=$(HOST_DEFINES) $(TARGET_DEFINES) $(M4_DEFINES_EXTRA) - ifeq ($(PLATFORM),s390-linux-gcc) - M4_DEFINES+=J9VM_TIERED_CODE_CACHE - + ifeq ($(PLATFORM),s390-linux-gcc) ifneq (,$(shell grep 'define J9VM_JIT_32BIT_USES64BIT_REGISTERS' $(J9SRC)/include/j9cfg.h)) M4_DEFINES+=J9VM_JIT_32BIT_USES64BIT_REGISTERS endif endif - ifeq ($(PLATFORM),s390-linux64-gcc) - M4_DEFINES+=J9VM_TIERED_CODE_CACHE - + ifeq ($(PLATFORM),s390-linux64-gcc) ifneq (,$(shell grep 'define J9VM_INTERP_COMPRESSED_OBJECT_HEADER' $(J9SRC)/include/j9cfg.h)) M4_DEFINES+=J9VM_INTERP_COMPRESSED_OBJECT_HEADER endif diff --git a/jitbuilder/runtime/JBCodeCacheManager.cpp b/jitbuilder/runtime/JBCodeCacheManager.cpp index a6f6744f7f1..e08df5492c8 100644 --- a/jitbuilder/runtime/JBCodeCacheManager.cpp +++ b/jitbuilder/runtime/JBCodeCacheManager.cpp @@ -62,7 +62,7 @@ JitBuilder::CodeCacheManager::allocateCodeCacheSegment(size_t segmentSize, // We should really rely on the port library to allocate memory, but this connection // has not yet been made, so as a quick workaround for platforms like OS X <= 10.9 // where MAP_ANONYMOUS is not defined, is to map MAP_ANON to MAP_ANONYMOUS ourselves - #if !defined(OMR_OS_WINDOWS) + #if defined(__APPLE__) #if !defined(MAP_ANONYMOUS) #define NO_MAP_ANONYMOUS #if defined(MAP_ANON) @@ -71,7 +71,7 @@ JitBuilder::CodeCacheManager::allocateCodeCacheSegment(size_t segmentSize, #error unexpectedly, no MAP_ANONYMOUS or MAP_ANON definition #endif #endif - #endif /* OMR_OS_WINDOWS */ + #endif /* defined(__APPLE__) */ // ignore preferredStartAddress for now, since it's NULL anyway // goal would be to allocate code cache segments near the JIT library address @@ -86,6 +86,13 @@ JitBuilder::CodeCacheManager::allocateCodeCacheSegment(size_t segmentSize, codeCacheSizeToAllocate, MEM_COMMIT, PAGE_EXECUTE_READWRITE)); +// TODO: Why is there no OMR_OS_ZOS? Or any other OS for that matter? +#elif defined(J9ZOS390) + // TODO: This is an absolute hack to get z/OS JITBuilder building and even remotely close to working. We really + // ought to be using the port library to allocate such memory. This was the quickest "workaround" I could think + // of to just get us off the ground. + auto memorySlab = reinterpret_cast( + malloc(codeCacheSizeToAllocate)); #else auto memorySlab = reinterpret_cast( mmap(NULL, diff --git a/omrmakefiles/rules.linux.mk b/omrmakefiles/rules.linux.mk index ec483db9766..23f5e48586f 100644 --- a/omrmakefiles/rules.linux.mk +++ b/omrmakefiles/rules.linux.mk @@ -241,7 +241,7 @@ else ifeq (s390,$(OMR_HOST_ARCH)) GLOBAL_CFLAGS+=$(J9M31) -fno-strict-aliasing GLOBAL_CXXFLAGS+=$(J9M31) -fno-strict-aliasing - GLOBAL_CPPFLAGS+=-DS390 -D_LONG_LONG -DJ9VM_TIERED_CODE_CACHE + GLOBAL_CPPFLAGS+=-DS390 -D_LONG_LONG ifeq (1,$(OMR_ENV_DATA64)) GLOBAL_CPPFLAGS+=-DS39064 endif diff --git a/omrmakefiles/rules.zos.mk b/omrmakefiles/rules.zos.mk index 95d5a05e84e..2b5f16602d8 100644 --- a/omrmakefiles/rules.zos.mk +++ b/omrmakefiles/rules.zos.mk @@ -66,7 +66,7 @@ GLOBAL_CFLAGS+=$(COPTFLAGS) GLOBAL_CXXFLAGS+=$(COPTFLAGS) # Preprocessor Flags -GLOBAL_CPPFLAGS+=-DJ9ZOS390 -DLONGLONG -DJ9VM_TIERED_CODE_CACHE -D_ALL_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_POSIX_SOURCE +GLOBAL_CPPFLAGS+=-DJ9ZOS390 -DLONGLONG -D_ALL_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_POSIX_SOURCE # Global Flags # xplink Link with the xplink calling convention diff --git a/omrmakefiles/rules.ztpf.mk b/omrmakefiles/rules.ztpf.mk index e79e55f66a9..9cbf59589cd 100644 --- a/omrmakefiles/rules.ztpf.mk +++ b/omrmakefiles/rules.ztpf.mk @@ -96,7 +96,7 @@ endif ifeq (s390,$(OMR_HOST_ARCH)) GLOBAL_CFLAGS+=$(J9M31) -fno-strict-aliasing GLOBAL_CXXFLAGS+=$(J9M31) -fno-strict-aliasing - GLOBAL_CPPFLAGS+=-DS390 -D_LONG_LONG -DJ9VM_TIERED_CODE_CACHE + GLOBAL_CPPFLAGS+=-DS390 -D_LONG_LONG ifeq (1,$(OMR_ENV_DATA64)) GLOBAL_CPPFLAGS+=-DS39064 endif diff --git a/omrsigcompat/CMakeLists.txt b/omrsigcompat/CMakeLists.txt index c210a65bbae..85ebd6072ac 100644 --- a/omrsigcompat/CMakeLists.txt +++ b/omrsigcompat/CMakeLists.txt @@ -86,6 +86,12 @@ if(OMR_HOST_OS MATCHES "linux|osx") endif() if(OMR_HOST_OS STREQUAL "zos") target_link_libraries(omrsig PRIVATE j9a2e) + + add_custom_command(TARGET omrsig + POST_BUILD + COMMAND cp -f libomrsig.x ${CMAKE_BINARY_DIR}/libomrsig.x + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) endif() #TODO ensure we are linking in the same way as source makefile: #MODULE_STATIC_LIBS += omrutil diff --git a/omrtrace/omrtracewrappers.cpp b/omrtrace/omrtracewrappers.cpp index e56ece1d3ec..1ca6f615c2b 100644 --- a/omrtrace/omrtracewrappers.cpp +++ b/omrtrace/omrtracewrappers.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2016 IBM Corp. and others + * Copyright (c) 1991, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -56,7 +56,7 @@ twThreadSelf(void) omr_error_t twE2A(char *str) { -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) long length = (long)strlen(str); if (length > 0) { char *abuf; @@ -66,6 +66,6 @@ twE2A(char *str) free(abuf); } } -#endif /* defined(J9ZOS390) */ +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ return OMR_ERROR_NONE; } diff --git a/port/unix/omrfile.c b/port/unix/omrfile.c index 42d50419f9c..8d8a556dfd6 100644 --- a/port/unix/omrfile.c +++ b/port/unix/omrfile.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2017 IBM Corp. and others + * Copyright (c) 1991, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -345,7 +345,7 @@ omrfile_open(struct OMRPortLibrary *portLibrary, const char *path, int32_t flags } } -#ifdef J9ZOS390 +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) /* On zOS use the non-tagging version of atoe_open for VM generated files that are always platform * encoded (EBCDIC), e.g. javacore dumps. See CMVC 199888 */ @@ -354,9 +354,9 @@ omrfile_open(struct OMRPortLibrary *portLibrary, const char *path, int32_t flags } else { fd = open(path, realFlags, mode); } -#else +#else /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ fd = open(path, realFlags, mode); -#endif +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ if (-1 == fd) { Trc_PRT_file_open_Exception2(path, errno, findError(errno)); diff --git a/port/unix/omrfiletext.c b/port/unix/omrfiletext.c index 76f7762884d..6c8d57146bf 100644 --- a/port/unix/omrfiletext.c +++ b/port/unix/omrfiletext.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2018 IBM Corp. and others + * Copyright (c) 1991, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -404,12 +404,12 @@ file_write_using_iconv(struct OMRPortLibrary *portLibrary, intptr_t fd, const ch char * omrfile_read_text(struct OMRPortLibrary *portLibrary, intptr_t fd, char *buf, intptr_t nbytes) { -#if (defined(J9ZOS390)) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) const char eol = a2e_tab['\n']; char *tempStr = NULL; -#else +#else /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ const static char eol = '\n'; -#endif /* defined(J9ZOS390) */ +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ char temp[64]; char *cursor = buf; BOOLEAN foundEOL = FALSE; @@ -451,7 +451,7 @@ omrfile_read_text(struct OMRPortLibrary *portLibrary, intptr_t fd, char *buf, in } *cursor = '\0'; -#if (defined(J9ZOS390)) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) tempStr = e2a_string(buf); if (NULL == tempStr) { return NULL; @@ -459,7 +459,7 @@ omrfile_read_text(struct OMRPortLibrary *portLibrary, intptr_t fd, char *buf, in memcpy(buf, tempStr, strlen(buf)); free(tempStr); -#endif /* defined(J9ZOS390) */ +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ return buf; } @@ -473,11 +473,11 @@ omrfile_get_text_encoding(struct OMRPortLibrary *portLibrary, char *charsetName, return -1; } -#ifdef J9ZOS390 +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) codepage = etoa_nl_langinfo(CODESET); #else codepage = nl_langinfo(CODESET); -#endif +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ /* nl_langinfo returns "" on failure */ if (codepage[0] == '\0') { diff --git a/port/unix/omrsysinfo.c b/port/unix/omrsysinfo.c index b2f1d7b06d2..df3b90e6954 100644 --- a/port/unix/omrsysinfo.c +++ b/port/unix/omrsysinfo.c @@ -851,7 +851,11 @@ find_executable_name(struct OMRPortLibrary *portLibrary, char **result) } while ((token = w_getpsent(token, &buf, sizeof(buf))) > 0) { if (buf.ps_pid == mypid) { +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) e2aName = e2a_func(buf.ps_pathptr, strlen(buf.ps_pathptr) + 1); +#else /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ + e2aName = buf.ps_pathptr; +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ break; } } @@ -867,7 +871,9 @@ find_executable_name(struct OMRPortLibrary *portLibrary, char **result) if (currentPath) { strcpy(currentPath, e2aName); } +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) free(e2aName); +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ #else char *execName = NULL; diff --git a/port/zos390/omrgetjobname.c b/port/zos390/omrgetjobname.c index bd847bfcd35..d3a65b04acb 100644 --- a/port/zos390/omrgetjobname.c +++ b/port/zos390/omrgetjobname.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2015 IBM Corp. and others + * Copyright (c) 1991, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -52,13 +52,19 @@ omrget_jobname(struct OMRPortLibrary *portLibrary, char *jobname, uintptr_t leng if (tmp_jobname) { memset(tmp_jobname, '\0', J9_MAX_JOBNAME); _JOBNAME(tmp_jobname); /* requires <31bit address */ +#if !defined(OMR_EBCDIC) ascname = e2a_func(tmp_jobname, strlen(tmp_jobname)); +#else /* !defined(OMR_EBCDIC) */ + ascname = tmp_jobname; +#endif /* !defined(OMR_EBCDIC) */ if (ascname) { width = strcspn(ascname, " "); strncpy(jobname, ascname, width); jobname[width] = '\0'; +#if !defined(OMR_EBCDIC) free(ascname); +#endif /* !defined(OMR_EBCDIC) */ } free(tmp_jobname); diff --git a/port/zos390/omrgetuserid.c b/port/zos390/omrgetuserid.c index f207279e0d5..90077bd586a 100644 --- a/port/zos390/omrgetuserid.c +++ b/port/zos390/omrgetuserid.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2015 IBM Corp. and others + * Copyright (c) 1991, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -58,7 +58,11 @@ omrget_userid(char *userid, uintptr_t length) if (tmp_userid) { memset(tmp_userid, '\0', J9_MAX_USERID); _USERID(tmp_userid); /* requires <31bit address */ +#if !defined(OMR_EBCDIC) ascname = e2a_func(tmp_userid, strlen(tmp_userid)); +#else /* !defined(OMR_EBCDIC) */ + ascname = tmp_userid; +#endif /* !defined(OMR_EBCDIC) */ if (ascname) { width = strcspn(ascname, " "); @@ -72,7 +76,9 @@ omrget_userid(char *userid, uintptr_t length) */ result = width; } +#if !defined(OMR_EBCDIC) free(ascname); +#endif /* !defined(OMR_EBCDIC) */ } free(tmp_userid); } diff --git a/port/zos390/omrosdump.c b/port/zos390/omrosdump.c index a5199f16aa9..caa1f3c8e35 100644 --- a/port/zos390/omrosdump.c +++ b/port/zos390/omrosdump.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2015 IBM Corp. and others + * Copyright (c) 1991, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -259,10 +259,14 @@ tdump_wrapper(struct OMRPortLibrary *portLibrary, char *filename, char *dsnName) /* the filename must be entirely uppercase for IEATDUMP requests */ convertToUpper(portLibrary, filename, strlen(filename)); +#if !defined(OMR_EBCDIC) /* Convert filename into EBCDIC... */ dsnName = a2e_func(filename, strlen(filename) + 1); err = tdump(portLibrary, filename, dsnName, &returnCode, &reasonCode); free(dsnName); +#else /* !defined(OMR_EBCDIC) */ + err = tdump(portLibrary, filename, filename, &returnCode, &reasonCode); +#endif /* !defined(OMR_EBCDIC) */ if (0 == err) { retVal = returnCode; @@ -272,10 +276,14 @@ tdump_wrapper(struct OMRPortLibrary *portLibrary, char *filename, char *dsnName) if (filenameSpecified) { portLibrary->nls_printf(portLibrary, J9NLS_WARNING | J9NLS_STDERR, J9NLS_PORT_IEATDUMP_NAME_TOO_LONG); filename[0] = '\0'; +#if !defined(OMR_EBCDIC) /* Convert filename into EBCDIC... */ dsnName = a2e_func(filename, strlen(filename) + 1); retVal = tdump_wrapper(portLibrary, filename, dsnName); free(dsnName); +#else /* !defined(OMR_EBCDIC) */ + retVal = tdump_wrapper(portLibrary, filename, filename); +#endif /* !defined(OMR_EBCDIC) */ } } else if (0x8 == returnCode && 0x26 == reasonCode) { /* Couldn't allocate data set (disk full) */ diff --git a/port/zos390/omrsyslog.c b/port/zos390/omrsyslog.c index 1142600d0b6..2eae700d80f 100644 --- a/port/zos390/omrsyslog.c +++ b/port/zos390/omrsyslog.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2015 IBM Corp. and others + * Copyright (c) 1991, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -95,11 +95,15 @@ writeToZOSLog(const char *message) unsigned int routeCodes[2] = {2, 0}; /* routing code 2 = Operator Information */ unsigned int descCodes[2] = {12, 0}; /* descriptor code 12 = Important Information, no operator action reqd */ +#if !defined(OMR_EBCDIC) /* Convert from the internal ascii format to ebcdic */ ebcdicbuf = a2e_func((char *) message, strlen(message)); if (ebcdicbuf == NULL) { return FALSE; } +#else + ebcdicbuf = message; +#endif /* !defined(OMR_EBCDIC) */ /* Re-implemented using _console2() instead of WTO, to provided proper multi-line messages. See * http://publib.boulder.ibm.com/infocenter/zos/v1r9/index.jsp?topic=/com.ibm.zos.r9.bpxbd00/consol2.htm @@ -117,7 +121,9 @@ writeToZOSLog(const char *message) rc = __console2(&cons, NULL, &modcmd); +#if !defined(OMR_EBCDIC) free(ebcdicbuf); +#endif /* !defined(OMR_EBCDIC) */ if (0 == rc) { return TRUE; diff --git a/port/zos390/omrtty.c b/port/zos390/omrtty.c index 5c9a236e742..def4e07e252 100644 --- a/port/zos390/omrtty.c +++ b/port/zos390/omrtty.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2015 IBM Corp. and others + * Copyright (c) 1991, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -38,8 +38,9 @@ #include #include - +#if !defined(OMR_EBCDIC) #include "atoe.h" +#endif /* !defined(OMR_EBCDIC) */ void WRITE_TTY(int fileno, char *b, int bcount); @@ -47,9 +48,13 @@ void WRITE_TTY(int fileno, char *b, int bcount); void WRITE_TTY(int fileno, char *b, int bcount) { +#if !defined(OMR_EBCDIC) char *s = a2e(b, bcount); write(fileno, s, bcount); free(s); +#else /* !defined(OMR_EBCDIC) */ + write(fileno, b, bcount); +#endif /* !defined(OMR_EBCDIC) */ } @@ -170,7 +175,9 @@ omrtty_printf(struct OMRPortLibrary *portLibrary, const char *format, ...) int32_t omrtty_startup(struct OMRPortLibrary *portLibrary) { +#if !defined(OMR_EBCDIC) iconv_init(); +#endif /* !defined(OMR_EBCDIC) */ return 0; } /** @@ -186,11 +193,13 @@ omrtty_startup(struct OMRPortLibrary *portLibrary) void omrtty_shutdown(struct OMRPortLibrary *portLibrary) { +#if !defined(OMR_EBCDIC) /* corresponding iconv_global_init() is invoked in protectedInitializeJavaVM (setGlobalConvertersAware()) * instead of omrtty_startup because a certain parameter needs to be parsed * before omrtty_startup is called. */ iconv_global_destroy(portLibrary); +#endif /* !defined(OMR_EBCDIC) */ } /** diff --git a/port/zos390/omrzfs.c b/port/zos390/omrzfs.c index 394a53382e7..ddfd7dafe22 100644 --- a/port/zos390/omrzfs.c +++ b/port/zos390/omrzfs.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2015 IBM Corp. and others + * Copyright (c) 1991, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -89,17 +89,27 @@ getZFSClientCacheSize(uint64_t *clientCacheSizePtr) /* Initialize the configuration option fields */ memset(configOptionPtr, 0, sizeof(J9ZFSConfigOption)); +#if !defined(OMR_EBCDIC) cfgoEye = a2e(J9CFGO_EYE, sizeof(configOptionPtr->co_eye)); +#else /* !defined(OMR_EBCDIC) */ + cfgoEye = J9CFGO_EYE; +#endif /* !defined(OMR_EBCDIC) */ if (NULL == cfgoEye) { Trc_PRT_getZFSClientCacheSize_MallocFailure(); return -1; } memcpy(configOptionPtr->co_eye, cfgoEye, sizeof(configOptionPtr->co_eye)); +#if !defined(OMR_EBCDIC) free(cfgoEye); +#endif /* !defined(OMR_EBCDIC) */ configOptionPtr->co_ver = J9CO_VER_INITIAL; configOptionPtr->co_len = (int16_t)sizeof(J9ZFSConfigOption); +#if!defined(OMR_EBCDIC) fsName = a2e(J9ZFSNAME, strlen(J9ZFSNAME)); +#else /* !defined(OMR_EBCDIC) */ + fsName = J9ZFSNAME; +#endif /* !defined(OMR_EBCDIC) */ if (NULL == fsName) { Trc_PRT_getZFSClientCacheSize_MallocFailure(); return -1; @@ -122,7 +132,9 @@ getZFSClientCacheSize(uint64_t *clientCacheSizePtr) &bpxrc, &bpxrs); #endif /* defined(_LP64) */ +#if !defined(OMR_EBCDIC) free(fsName); +#endif /* !defined(OMR_EBCDIC) */ /* Check pfsctl() service return value */ if (0 > bpxrv) { @@ -131,7 +143,11 @@ getZFSClientCacheSize(uint64_t *clientCacheSizePtr) } /* The sizes are suffixed with 'G', 'M' or 'K'. Convert to bytes. */ +#if !defined(OMR_EBCDIC) ascName = e2a_func(configParam.configOption.co_string, strlen(configParam.configOption.co_string)); +#else /* !defined(OMR_EBCDIC) */ + ascName = configParam.configOption.co_string; +#endif /* !defined(OMR_EBCDIC) */ if (NULL == ascName) { Trc_PRT_getZFSClientCacheSize_MallocFailure(); return -1; @@ -144,7 +160,9 @@ getZFSClientCacheSize(uint64_t *clientCacheSizePtr) } else if (('k' == *endPtr) || ('K' == *endPtr)) { clientCacheSize *= J9K_TO_BYTES_CONVERSION_FACTOR; } +#if !defined(OMR_EBCDIC) free(ascName); +#endif /* !defined(OMR_EBCDIC) */ /* Set the returned parameter */ *clientCacheSizePtr = clientCacheSize; @@ -184,18 +202,28 @@ getZFSUserCacheUsed(uint64_t *userCacheUsedPtr) /* Initialize the statistics API query control fields */ memset(statApiPtr, 0, sizeof(J9ZFSStatApi)); +#if !defined(OMR_EBCDIC) saEye = a2e(J9SA_EYE, sizeof(statApiPtr->sa_eye)); +#else /* !defined(OMR_EBCDIC) */ + saEye = J9SA_EYE; +#endif /* !defined(OMR_EBCDIC) */ if (NULL == saEye) { Trc_PRT_getZFSUserCacheUsed_MallocFailure(); return -1; } memcpy(statApiPtr->sa_eye, saEye, sizeof(statApiPtr->sa_eye)); +#if !defined(OMR_EBCDIC) free(saEye); +#endif /* !defined(OMR_EBCDIC) */ statApiPtr->sa_ver = J9SA_VER_INITIAL; statApiPtr->sa_len = (int32_t)sizeof(J9ZFSStatUserCache); - + +#if !defined(OMR_EBCDIC) fsName = a2e(J9ZFSNAME, strlen(J9ZFSNAME)); +#else /* !defined(OMR_EBCDIC) */ + fsName = J9ZFSNAME; +#endif /* !defined(OMR_EBCDIC) */ if (NULL == fsName) { Trc_PRT_getZFSUserCacheUsed_MallocFailure(); return -1; @@ -218,7 +246,9 @@ getZFSUserCacheUsed(uint64_t *userCacheUsedPtr) &bpxrc, &bpxrs); #endif /* defined(_LP64) */ +#if !defined(OMR_EBCDIC) free(fsName); +#endif /* !defined(OMR_EBCDIC) */ /* Check pfsctl() service return value */ if (0 > bpxrv) { @@ -277,17 +307,27 @@ getZFSMetaCacheSize(uint64_t *bufferCacheSizePtr) /* Initialize the statistics API query control fields */ memset(statApiPtr, 0, sizeof(J9ZFSStatApi)); +#if !defined(OMR_EBCDIC) saEye = a2e(J9SA_EYE, sizeof(statApiPtr->sa_eye)); +#else /* !defined(OMR_EBCDIC) */ + saEye = J9SA_EYE; +#endif /* !defined(OMR_EBCDIC) */ if (NULL == saEye) { Trc_PRT_getZFSMetaCacheSize_MallocFailure(); return -1; } memcpy(statApiPtr->sa_eye, saEye, sizeof(statApiPtr->sa_eye)); +#if !defined(OMR_EBCDIC) free(saEye); +#endif /* !defined(OMR_EBCDIC) */ statApiPtr->sa_ver = J9SA_VER_INITIAL; statApiPtr->sa_len = (int32_t)sizeof(J9ZFSAPIMetaStats); +#if !defined(OMR_EBCDIC) fsName = a2e(J9ZFSNAME, strlen(J9ZFSNAME)); +#else /* !defined(OMR_EBCDIC) */ + fsName = J9ZFSNAME; +#endif /* !defined(OMR_EBCDIC) */ if (NULL == fsName) { Trc_PRT_getZFSMetaCacheSize_MallocFailure(); return -1; @@ -310,7 +350,9 @@ getZFSMetaCacheSize(uint64_t *bufferCacheSizePtr) &bpxrc, &bpxrs); #endif /* defined(_LP64) */ +#if !defined(OMR_EBCDIC) free(fsName); +#endif /* !defined(OMR_EBCDIC) */ /* Check pfsctl() service return value */ if (0 > bpxrv) { diff --git a/third_party/gtest-1.8.0/include/gtest/internal/gtest-port.h b/third_party/gtest-1.8.0/include/gtest/internal/gtest-port.h index b35fd7123b3..e773091d517 100644 --- a/third_party/gtest-1.8.0/include/gtest/internal/gtest-port.h +++ b/third_party/gtest-1.8.0/include/gtest/internal/gtest-port.h @@ -689,6 +689,22 @@ struct _RTL_CRITICAL_SECTION; # include "gtest/internal/gtest-tuple.h" // IWYU pragma: export // NOLINT # elif GTEST_ENV_HAS_STD_TUPLE_ # include + +#if defined(J9ZOS390) +// On z/OS tuple is defined in the ::std::tr1 namespace as it is an extension +// class since xlc does not support the full C++11 standard. As such we expose +// the tuple class in the ::std namespace such that code below will work. +namespace std +{ +using ::std::tr1::get; +using ::std::tr1::make_tuple; +using ::std::tr1::tuple; +using ::std::tr1::tuple_element; +using ::std::tr1::tuple_size; +using ::snprintf; +} +#endif + // C++11 puts its tuple into the ::std namespace rather than // ::std::tr1. gtest expects tuple to live in ::std::tr1, so put it there. // This causes undefined behavior, but supported compilers react in @@ -2274,12 +2290,12 @@ inline bool IsXDigit(wchar_t ch) { return ch == low_byte && isxdigit(low_byte) != 0; } -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) /* We need to define tolower and toupper macros for ToLower/ToUpper to use a2e tolower/toupper. */ -#define toupper(c) (islower(c) ? (c & _XUPPER_ASCII) : c) -#define tolower(c) (isupper(c) ? (c | _XLOWER_ASCII) : c) -#endif +#define toupper(c) (islower(c) ? (c & 0xDF) : c) +#define tolower(c) (isupper(c) ? (c | 0xDF) : c) +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ inline char ToLower(char ch) { return static_cast(tolower(static_cast(ch))); @@ -2288,12 +2304,12 @@ inline char ToUpper(char ch) { return static_cast(toupper(static_cast(ch))); } -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) /* We need to undefine the macros in order to avoid function definitions for tolower and toupper in xlocale. */ #undef toupper #undef tolower -#endif +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ inline std::string StripTrailingSpaces(std::string str) { std::string::iterator it = str.end(); diff --git a/third_party/pugixml-1.5/CMakeLists.txt b/third_party/pugixml-1.5/CMakeLists.txt index 0bb6cf9254c..1ce6ec1397c 100644 --- a/third_party/pugixml-1.5/CMakeLists.txt +++ b/third_party/pugixml-1.5/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2017, 2017 IBM Corp. and others +# Copyright (c) 2017, 2019 IBM Corp. and others # # This program and the accompanying materials are made available under # the terms of the Eclipse Public License 2.0 which accompanies this @@ -20,7 +20,7 @@ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception ############################################################################### -add_library(pugixml +add_library(pugixml STATIC pugixml.cpp ) @@ -28,3 +28,11 @@ target_include_directories(pugixml PUBLIC ./ ) + +if(OMR_OS_ZOS) + if(OMR_TOOLS_USE_NATIVE_ENCODING) + target_link_libraries(pugixml PUBLIC omr_ebcdic) + else() + target_link_libraries(pugixml PUBLIC omr_ascii) + endif() +endif() diff --git a/tools/hookgen/CMakeLists.txt b/tools/hookgen/CMakeLists.txt index 69776b7cbab..ed31d5d8bbf 100644 --- a/tools/hookgen/CMakeLists.txt +++ b/tools/hookgen/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2017, 2017 IBM Corp. and others +# Copyright (c) 2017, 2019 IBM Corp. and others # # This program and the accompanying materials are made available under # the terms of the Eclipse Public License 2.0 which accompanies this @@ -26,9 +26,14 @@ add_executable(hookgen main.cpp ) -target_link_libraries(hookgen pugixml) -if(OMR_HOST_OS STREQUAL "zos") - target_link_libraries(hookgen j9a2e) +target_link_libraries(hookgen PUBLIC pugixml) + +if(OMR_OS_ZOS) + if(OMR_TOOLS_USE_NATIVE_ENCODING) + target_link_libraries(hookgen PUBLIC omr_ebcdic) + else() + target_link_libraries(hookgen PUBLIC omr_ascii) + endif() endif() install(TARGETS hookgen diff --git a/tools/tracegen/CMakeLists.txt b/tools/tracegen/CMakeLists.txt index 8df16e8da02..a627b3d4e63 100644 --- a/tools/tracegen/CMakeLists.txt +++ b/tools/tracegen/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2017, 2017 IBM Corp. and others +# Copyright (c) 2017, 2019 IBM Corp. and others # # This program and the accompanying materials are made available under # the terms of the Eclipse Public License 2.0 which accompanies this @@ -49,8 +49,12 @@ target_include_directories(trace ./ ) -if(OMR_HOST_OS STREQUAL "zos") - target_link_libraries(trace j9a2e) +if(OMR_OS_ZOS) + if(OMR_TOOLS_USE_NATIVE_ENCODING) + target_link_libraries(trace PUBLIC omr_ebcdic) + else() + target_link_libraries(trace PUBLIC omr_ascii) + endif() endif() set_target_properties(trace tracegen PROPERTIES FOLDER tools) diff --git a/tools/tracegen/FileUtils.cpp b/tools/tracegen/FileUtils.cpp index faf7b23ad4c..cef94f4da9b 100644 --- a/tools/tracegen/FileUtils.cpp +++ b/tools/tracegen/FileUtils.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2016 IBM Corp. and others + * Copyright (c) 2014, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -21,7 +21,9 @@ *******************************************************************************/ #if defined(J9ZOS390) /* needed to expose snprintf() */ -#define _ISOC99_SOURCE +#if !defined(_ISOC99_SOURCE) +#define _ISOC99_SOURCE 1 +#endif #endif #include diff --git a/tools/tracegen/main.cpp b/tools/tracegen/main.cpp index e2291b0bca9..2deea3b26ed 100644 --- a/tools/tracegen/main.cpp +++ b/tools/tracegen/main.cpp @@ -25,7 +25,7 @@ #if defined(J9ZOS390) && !defined(OMR_EBCDIC) #include "atoe.h" -#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ #include "FileUtils.hpp" #include "Port.hpp" diff --git a/tools/tracemerge/CMakeLists.txt b/tools/tracemerge/CMakeLists.txt index b9e96d3d109..59a540050c3 100644 --- a/tools/tracemerge/CMakeLists.txt +++ b/tools/tracemerge/CMakeLists.txt @@ -35,6 +35,14 @@ target_link_libraries(tracemerge trace # static ) +if(OMR_OS_ZOS) + if(OMR_TOOLS_USE_NATIVE_ENCODING) + target_link_libraries(tracemerge PUBLIC omr_ebcdic) + else() + target_link_libraries(tracemerge PUBLIC omr_ascii) + endif() +endif() + set_property(TARGET tracemerge PROPERTY FOLDER util) install(TARGETS tracemerge diff --git a/tools/tracemerge/main.cpp b/tools/tracemerge/main.cpp index 9d62ec68013..467e3fa4497 100644 --- a/tools/tracemerge/main.cpp +++ b/tools/tracemerge/main.cpp @@ -25,7 +25,7 @@ #if defined(J9ZOS390) && !defined(OMR_EBCDIC) #include "atoe.h" -#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ #include "DATMerge.hpp" #include "FileUtils.hpp" diff --git a/util/a2e/CMakeLists.txt b/util/a2e/CMakeLists.txt index 0c522a5e709..e3465417436 100644 --- a/util/a2e/CMakeLists.txt +++ b/util/a2e/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2017, 2017 IBM Corp. and others +# Copyright (c) 2017, 2019 IBM Corp. and others # # This program and the accompanying materials are made available under # the terms of the Eclipse Public License 2.0 which accompanies this @@ -46,15 +46,26 @@ endif() target_include_directories(j9a2e PUBLIC + $ + $ + PRIVATE . ) add_custom_command(TARGET j9a2e POST_BUILD - COMMAND mv j9a2e.x ${CMAKE_BINARY_DIR}/j9a2e.x + COMMAND cp -f libj9a2e.x ${CMAKE_BINARY_DIR}/libj9a2e.x WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) +install( + TARGETS j9a2e + EXPORT OmrTargets + PUBLIC_HEADER DESTINATION ${OMR_INSTALL_INC_DIR}/ + ARCHIVE DESTINATION ${OMR_INSTALL_ARCHIVE_DIR}/ + LIBRARY DESTINATION ${OMR_INSTALL_LIB_DIR}/ +) + set_property(TARGET j9a2e PROPERTY FOLDER util) target_enable_ddr(j9a2e "${OMR_DDR_SET}") diff --git a/util/main_function/main_function.cpp b/util/main_function/main_function.cpp index e89a53b4f0e..2137a6e55d4 100644 --- a/util/main_function/main_function.cpp +++ b/util/main_function/main_function.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2018 IBM Corp. and others + * Copyright (c) 2015, 2019 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -36,9 +36,9 @@ #include #include -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) #include "atoe.h" -#endif +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ /* Define a macro for the name of the main function that takes char args */ #if defined(OMR_OS_WINDOWS) @@ -52,7 +52,7 @@ extern "C" int omr_main_entry(int argc, char **argv, char **envp); int CHARMAIN(int argc, char **argv, char **envp) { -#if defined(J9ZOS390) +#if defined(J9ZOS390) && !defined(OMR_EBCDIC) /* translate argv strings to ascii */ iconv_init(); { @@ -61,7 +61,7 @@ CHARMAIN(int argc, char **argv, char **envp) argv[i] = e2a_string(argv[i]); } } -#endif /* defined(J9ZOS390) */ +#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */ return omr_main_entry(argc, argv, envp); } diff --git a/util/omrutil/CMakeLists.txt b/util/omrutil/CMakeLists.txt index a20df5a9db8..edea8de3111 100644 --- a/util/omrutil/CMakeLists.txt +++ b/util/omrutil/CMakeLists.txt @@ -27,16 +27,6 @@ omr_assert( include_directories(${CMAKE_CURRENT_BINARY_DIR}) -#TODO port following vpath code: -#ifeq (zos,$(OMR_HOST_OS)) - #OBJECTS += zbarrier$(OBJEXT) - #ifeq (0,$(OMR_ENV_DATA64)) - #vpath zbarrier.s unix/zos/31 - #else - #vpath zbarrier.s unix/zos/64 - #endif -#endif - include(OmrFindFiles) set(OBJECTS "") @@ -65,12 +55,14 @@ if(OMR_ARCH_S390) if(OMR_ENV_DATA64) list(APPEND OBJECTS j9memclrz10_64.s) list(APPEND OBJECTS omrget_userExtendedPrivateAreaMemoryType.s) + list(APPEND OBJECTS zbarrier.s) list(APPEND VPATH unix/zos/64) target_include_directories(omrutil_obj PRIVATE unix/zos/64) else() - list(APPEND OBJECTS omrceetbck.s) list(APPEND OBJECTS j9memclrz10_31.s) + list(APPEND OBJECTS omrceetbck.s) + list(APPEND OBJECTS zbarrier.s) list(APPEND VPATH unix/zos/31) target_include_directories(omrutil_obj PRIVATE unix/zos/31)