From 3df44ef76ffc7d3c9932eb24e9e1e1d71f02c069 Mon Sep 17 00:00:00 2001 From: Eugene Rozenfeld Date: Tue, 15 Dec 2015 17:40:43 -0800 Subject: Enable checked builds of CoreCLR. In checked builds coreclr, mscorlib, and the test are built optimized but assertion checking is on. This adds additional coverage (the jit is optimizing and assertion checking is on), speeds up testing compared to debug, and allows testing JIT stress modes. This doesn't affect CoreFX. Several tests are currently failing in checked configuration due to newly discovered bugs (JIT asserts). We didn't see these asserts in debug mode because by default JIT is in minopt mode; we didn't see these bugs in release mode because assertion checking is off. I will file the bugs once checked build changes are in. --- src/mscorlib/mscorlib.csproj | 3 ++- src/pal/tools/clang-compiler-override.txt | 5 ++++- src/pal/tools/gen-buildsys-clang.sh | 4 ++-- src/pal/tools/windows-compiler-override.txt | 7 ++++--- src/vm/CMakeLists.txt | 10 ++++++++++ src/vm/gchelpers.cpp | 2 +- 6 files changed, 23 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mscorlib/mscorlib.csproj b/src/mscorlib/mscorlib.csproj index a41f7b079e..423a4e48f8 100644 --- a/src/mscorlib/mscorlib.csproj +++ b/src/mscorlib/mscorlib.csproj @@ -66,7 +66,7 @@ - + true full DBG;_DEBUG;_LOGGING;DEBUG;TRACE;$(DefineConstants) @@ -125,6 +125,7 @@ <_BuildType Condition="'$(Configuration)' == 'Debug'">chk + <_BuildType Condition="'$(Configuration)' == 'Checked'">chk <_BuildType Condition="'$(Configuration)' == 'Release'">ret diff --git a/src/pal/tools/clang-compiler-override.txt b/src/pal/tools/clang-compiler-override.txt index 7d99902be5..349bd07209 100644 --- a/src/pal/tools/clang-compiler-override.txt +++ b/src/pal/tools/clang-compiler-override.txt @@ -1,14 +1,17 @@ SET (CMAKE_C_FLAGS_INIT "-Wall -std=c11") SET (CMAKE_C_FLAGS_DEBUG_INIT "-g -O0") +SET (CMAKE_C_FLAGS_CHECKED_INIT "-g -O1") SET (CMAKE_C_FLAGS_RELEASE_INIT "-O3") SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") SET (CMAKE_CXX_FLAGS_INIT "-Wall -Wno-null-conversion -std=c++11") SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g -O0") +SET (CMAKE_CXX_FLAGS_CHECKED_INIT "-g -O1") SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3") SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") -SET (CLR_DEFINES_DEBUG_INIT DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1 WRITE_BARRIER_CHECK=1) +SET (CLR_DEFINES_DEBUG_INIT DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1) +SET (CLR_DEFINES_CHECKED_INIT DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1) SET (CLR_DEFINES_RELEASE_INIT NDEBUG URTBLDENV_FRIENDLY=Retail) SET (CLR_DEFINES_RELWITHDEBINFO_INIT NDEBUG URTBLDENV_FRIENDLY=Retail) diff --git a/src/pal/tools/gen-buildsys-clang.sh b/src/pal/tools/gen-buildsys-clang.sh index 31e83ef029..8bb93f5990 100755 --- a/src/pal/tools/gen-buildsys-clang.sh +++ b/src/pal/tools/gen-buildsys-clang.sh @@ -43,8 +43,8 @@ generator="Unix Makefiles" for i in "${@:5}"; do upperI="$(echo $i | awk '{print toupper($0)}')" case $upperI in - # Possible build types are DEBUG, RELEASE, RELWITHDEBINFO, MINSIZEREL. - DEBUG | RELEASE | RELWITHDEBINFO | MINSIZEREL) + # Possible build types are DEBUG, CHECKED, RELEASE, RELWITHDEBINFO, MINSIZEREL. + DEBUG | CHECKED | RELEASE | RELWITHDEBINFO | MINSIZEREL) buildtype=$upperI ;; COVERAGE) diff --git a/src/pal/tools/windows-compiler-override.txt b/src/pal/tools/windows-compiler-override.txt index 071f3043e2..f76601bc49 100644 --- a/src/pal/tools/windows-compiler-override.txt +++ b/src/pal/tools/windows-compiler-override.txt @@ -1,16 +1,17 @@ SET (CMAKE_C_FLAGS_INIT "/Wall /FC") SET (CMAKE_C_FLAGS_DEBUG_INIT "/Od /Zi") +SET (CMAKE_C_FLAGS_CHECKED_INIT "/O1 /Zi") SET (CMAKE_C_FLAGS_RELEASE_INIT "/Ox") SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/O2 /Zi") SET (CMAKE_CXX_FLAGS_INIT "/Wall /FC") SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/Od /Zi") +SET (CMAKE_CXX_FLAGS_CHECKED_INIT "/O1 /Zi") SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/Ox") SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/O2 /Zi") -SET (CLR_DEFINES_DEBUG_INIT DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1 WRITE_BARRIER_CHECK=1) +SET (CLR_DEFINES_DEBUG_INIT DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1) +SET (CLR_DEFINES_CHECKED_INIT DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1) SET (CLR_DEFINES_RELEASE_INIT NDEBUG URTBLDENV_FRIENDLY=Retail) SET (CLR_DEFINES_RELWITHDEBINFO_INIT NDEBUG URTBLDENV_FRIENDLY=Retail) SET (CMAKE_INSTALL_PREFIX $ENV{__CMakeBinDir}) - - diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt index 9e9dd68a07..e6238ed56f 100644 --- a/src/vm/CMakeLists.txt +++ b/src/vm/CMakeLists.txt @@ -39,6 +39,16 @@ add_definitions(-D_UNICODE) # Add the Merge flag here is needed add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) +if(CMAKE_CONFIGURATION_TYPES) # multi-configuration generator? + foreach (Config DEBUG CHECKED) + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$:WRITE_BARRIER_CHECK=1>) + endforeach (Config) +else() + if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED) + add_definitions(-DWRITE_BARRIER_CHECK=1) + endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED) +endif(CMAKE_CONFIGURATION_TYPES) + if(CLR_CMAKE_PLATFORM_UNIX) add_compile_options(-fPIC) endif(CLR_CMAKE_PLATFORM_UNIX) diff --git a/src/vm/gchelpers.cpp b/src/vm/gchelpers.cpp index d7a1cacefe..8f9315a12c 100644 --- a/src/vm/gchelpers.cpp +++ b/src/vm/gchelpers.cpp @@ -1314,7 +1314,7 @@ void ErectWriteBarrierForMT(MethodTable **dst, MethodTable *ref) *dst = ref; -#ifdef _DEBUG +#ifdef WRITE_BARRIER_CHECK updateGCShadow((Object **)dst, (Object *)ref); // support debugging write barrier, updateGCShadow only cares that these are pointers #endif -- cgit v1.2.3