From b27054adaf3fd0e141bbdf4c6c54b7483a3c3b62 Mon Sep 17 00:00:00 2001 From: Devin Nakamura Date: Thu, 27 Feb 2020 18:28:16 -0500 Subject: [PATCH 01/12] CMake: Refactor platform specific config Separate config out into os/arch/toolchain specific files. Remove options that we inherit from omr already (eg -fno-strict-aliasing, -qalias=noansi) Signed-off-by: Devin Nakamura --- runtime/cmake/caches/aix_ppc-64.cmake | 1 + .../cmake/caches/linux_ppc-64_le_gcc.cmake | 1 + runtime/cmake/platform.cmake | 55 +++---------------- runtime/cmake/platform/arch/power.cmake | 25 +++++++++ runtime/cmake/platform/os/aix.cmake | 24 ++++++++ runtime/cmake/platform/os/win.cmake | 34 ++++++++++++ runtime/cmake/platform/toolcfg/gnu.cmake | 39 +++++++++++++ runtime/cmake/platform/toolcfg/xlc.cmake | 31 +++++++++++ 8 files changed, 163 insertions(+), 47 deletions(-) create mode 100644 runtime/cmake/platform/arch/power.cmake create mode 100644 runtime/cmake/platform/os/aix.cmake create mode 100644 runtime/cmake/platform/os/win.cmake create mode 100644 runtime/cmake/platform/toolcfg/gnu.cmake create mode 100644 runtime/cmake/platform/toolcfg/xlc.cmake diff --git a/runtime/cmake/caches/aix_ppc-64.cmake b/runtime/cmake/caches/aix_ppc-64.cmake index 313fea30cb0..dee2ecc265e 100644 --- a/runtime/cmake/caches/aix_ppc-64.cmake +++ b/runtime/cmake/caches/aix_ppc-64.cmake @@ -29,6 +29,7 @@ set(J9VM_ENV_SHARED_LIBS_CALLEE_GLOBAL_TABLE_SETUP OFF CACHE BOOL "") set(J9VM_ENV_SHARED_LIBS_USE_GLOBAL_TABLE ON CACHE BOOL "") set(OMR_GC_TLH_PREFETCH_FTA OFF CACHE BOOL "") +set(J9VM_JIT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "") set(J9VM_PORT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "") set(J9VM_MODULE_CODEGEN_PPC ON CACHE BOOL "") set(J9VM_GC_IDLE_HEAP_MANAGER OFF CACHE BOOL "") diff --git a/runtime/cmake/caches/linux_ppc-64_le_gcc.cmake b/runtime/cmake/caches/linux_ppc-64_le_gcc.cmake index d6c3d6fb5eb..ef190d27e49 100644 --- a/runtime/cmake/caches/linux_ppc-64_le_gcc.cmake +++ b/runtime/cmake/caches/linux_ppc-64_le_gcc.cmake @@ -31,6 +31,7 @@ set(J9VM_ENV_USE_GCC ON CACHE BOOL "") set(OMR_GC_IDLE_HEAP_MANAGER OFF CACHE BOOL "") set(OMR_GC_TLH_PREFETCH_FTA OFF CACHE BOOL "") +set(J9VM_JIT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "") set(J9VM_PORT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "") set(J9VM_MODULE_CODEGEN_PPC ON CACHE BOOL "") set(J9VM_MODULE_THRTRACE ON CACHE BOOL "") diff --git a/runtime/cmake/platform.cmake b/runtime/cmake/platform.cmake index 31fa69a42cc..f3e79e8a32a 100644 --- a/runtime/cmake/platform.cmake +++ b/runtime/cmake/platform.cmake @@ -1,5 +1,5 @@ ################################################################################ -# Copyright (c) 2017, 2019 IBM Corp. and others +# Copyright (c) 2017, 2020 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,57 +20,18 @@ # 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 ################################################################################ +# Get OMR's platform config include(OmrPlatform) -# Note: we need to inject WIN32 et al, as OMR no longer uses them -if(OMR_OS_WINDOWS) - list(APPEND OMR_PLATFORM_DEFINITIONS - -DWIN32 - -D_WIN32 - ) - if(OMR_ENV_DATA64) - list(APPEND OMR_PLATFORM_DEFINITIONS - -DWIN64 - -D_WIN64 - ) - endif() -endif() -omr_platform_global_setup() -if(OMR_TOOLCONFIG STREQUAL "gnu") - set(CMAKE_CXX_FLAGS " -g -fno-rtti -fno-exceptions ${CMAKE_CXX_FLAGS}") - set(CMAKE_C_FLAGS "-g ${CMAKE_C_FLAGS}") - - # Raise an error if a shared library has any unresolved symbols. - # This flag isn't supported on OSX, but it has this behaviour by default - if(NOT OMR_OS_OSX) - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,defs ${CMAKE_SHARED_LINKER_FLAGS}") - endif() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -O3 -fno-strict-aliasing") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -O3 -fno-strict-aliasing -fno-exceptions -fno-rtti -fno-threadsafe-statics") -elseif(OMR_TOOLCONFIG STREQUAL "xlc") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -qalias=noansi") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -qalias=noansi -qnortti -qnoeh -qsuppress=1540-1087:1540-1088:1540-1090") - set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -qpic=large") -endif() +# Add our own platform specific config if we have any +include("${CMAKE_CURRENT_LIST_DIR}/platform/os/${OMR_HOST_OS}.cmake" OPTIONAL) +include("${CMAKE_CURRENT_LIST_DIR}/platform/arch/${OMR_HOST_ARCH}.cmake" OPTIONAL) +include("${CMAKE_CURRENT_LIST_DIR}/platform/toolcfg/${OMR_TOOLCONFIG}.cmake" OPTIONAL) -if(OMR_ARCH_POWER) - #TODO do based on toolchain stuff - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - add_definitions(-DOMR_ENV_GCC) - endif() - #TODO this is a hack - set(J9VM_JIT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "") - set(J9VM_PORT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "") -endif() -if(OMR_OS_AIX) - # Override cmake default of ".a" for shared libs on aix - set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") -endif() +# Apply the combined platform config +omr_platform_global_setup() if(NOT OMR_OS_OSX) add_definitions(-DIPv6_FUNCTION_SUPPORT) endif() - -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1") diff --git a/runtime/cmake/platform/arch/power.cmake b/runtime/cmake/platform/arch/power.cmake new file mode 100644 index 00000000000..86ecafeb101 --- /dev/null +++ b/runtime/cmake/platform/arch/power.cmake @@ -0,0 +1,25 @@ +################################################################################ +# Copyright (c) 2020, 2020 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 https://www.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 +################################################################################ + +if(OMR_TOOLCONFIG STREQUAL "GNU") + add_definitions(-DOMR_ENV_GCC) +endif() diff --git a/runtime/cmake/platform/os/aix.cmake b/runtime/cmake/platform/os/aix.cmake new file mode 100644 index 00000000000..21fafee99aa --- /dev/null +++ b/runtime/cmake/platform/os/aix.cmake @@ -0,0 +1,24 @@ +################################################################################ +# Copyright (c) 2020, 2020 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 https://www.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 +################################################################################ + +# Override cmake default of ".a" for shared libs on aix +set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") diff --git a/runtime/cmake/platform/os/win.cmake b/runtime/cmake/platform/os/win.cmake new file mode 100644 index 00000000000..c0db6e61d4b --- /dev/null +++ b/runtime/cmake/platform/os/win.cmake @@ -0,0 +1,34 @@ +################################################################################ +# Copyright (c) 2020, 2020 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 https://www.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 +################################################################################ + +# Note: we need to inject WIN32 et al, as OMR no longer uses them + +list(APPEND OMR_PLATFORM_DEFINITIONS + -DWIN32 + -D_WIN32 +) +if(OMR_ENV_DATA64) + list(APPEND OMR_PLATFORM_DEFINITIONS + -DWIN64 + -D_WIN64 + ) +endif() diff --git a/runtime/cmake/platform/toolcfg/gnu.cmake b/runtime/cmake/platform/toolcfg/gnu.cmake new file mode 100644 index 00000000000..ae10fb3fd90 --- /dev/null +++ b/runtime/cmake/platform/toolcfg/gnu.cmake @@ -0,0 +1,39 @@ +################################################################################ +# Copyright (c) 2020, 2020 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 https://www.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 +################################################################################ + +list(APPEND OMR_PLATFORM_COMPILE_OPTIONS -O3 -g) + +# Add these +list(APPEND OMR_PLATFORM_CXX_COMPILE_OPTIONS -fno-threadsafe-statics) + +# OMR_PLATFORM_CXX_COMPILE_OPTIONS gets applied to the jit (which needs exceptions), +# so we put these in the CMAKE_CXX_FLAGS instead +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti") + +# Raise an error if a shared library has any unresolved symbols. +# This flag isn't supported on OSX, but it has this behaviour by default +if(NOT OMR_OS_OSX) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,defs ${CMAKE_SHARED_LINKER_FLAGS}") +endif() + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1") diff --git a/runtime/cmake/platform/toolcfg/xlc.cmake b/runtime/cmake/platform/toolcfg/xlc.cmake new file mode 100644 index 00000000000..d5b7e87414d --- /dev/null +++ b/runtime/cmake/platform/toolcfg/xlc.cmake @@ -0,0 +1,31 @@ +################################################################################ +# Copyright (c) 2020, 2020 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 https://www.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 +################################################################################ + +list(APPEND OMR_PLATFORM_COMPILE_OPTIONS -O3) + +list(APPEND OMR_PLATFORM_CXX_COMPILE_OPTIONS -qsuppress=1540-1087:1540-1088:1540-1090) + +# OMR_PLATFORM_CXX_COMPILE_OPTIONS gets applied to the jit (which needs exceptions), +# so we put these in the CMAKE_CXX_FLAGS instead +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qnortti -qnoeh") + +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -qpic=large") From ccc10127e138ac370217b8a577b2769bb32a98f3 Mon Sep 17 00:00:00 2001 From: Renfei Wang Date: Tue, 31 Mar 2020 15:31:38 -0400 Subject: [PATCH 02/12] Change build condition for ProxyFieldAccess tests - compile tests for JCL_VERSION=latest JDK_IMPL=ibm [ci skip] Signed-off-by: Renfei Wang --- test/functional/cmdLineTests/build.xml | 20 ++++--------------- .../cmdLineTests/proxyFieldAccess/build.xml | 9 +++++++-- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/test/functional/cmdLineTests/build.xml b/test/functional/cmdLineTests/build.xml index 112adf19f66..27583a1538f 100644 --- a/test/functional/cmdLineTests/build.xml +++ b/test/functional/cmdLineTests/build.xml @@ -1,7 +1,7 @@