From 4d8fa67c01f855da61d83e3a78b1395727f15046 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Mon, 17 Aug 2020 15:21:16 -0700 Subject: [PATCH 1/7] Code changes needed to compile targetting all supported os/arch from WinX64 Fix unix to windows cross target build issues Build rules to build all possible altjits New build subset rules Adjust naming to clrjit_targetos_targetarch_hostarch Fix subsets build so that clr subset compiles properly Swap crossgen2 to use new clrjit dlls - Also add support for building x64 hosted crossgen2 into all non-x64 builds - Allows for running live built crossgen2 during further compilation and test steps Use target defintions and properties to simplify logic Stop using subdirectories for cross targeting jits and such Consolidate all standalone jit building to use the function instead of a separate cmakelists.txt file Fix build break, and apply formatting patch Address code review feedback, and fix pgo build and armel jit build Fix Windows Arm build, and don't compile clrjit as altjit, ever Fix crossgen2 packaging on Unix Code review feedback --- eng/Signing.props | 9 +- eng/Subsets.props | 27 +++++- eng/native/configurecompiler.cmake | 36 ++++--- eng/native/configureplatform.cmake | 4 +- src/coreclr/CMakeLists.txt | 10 +- src/coreclr/build-runtime.cmd | 85 ++++++++++++++-- src/coreclr/build-runtime.sh | 18 ++++ src/coreclr/clrdefinitions.cmake | 63 +++++++++--- src/coreclr/crosscomponents.cmake | 17 +++- src/coreclr/runtime.proj | 4 + src/coreclr/src/CMakeLists.txt | 34 ++++--- .../src/debug/runtimeinfo/CMakeLists.txt | 7 +- src/coreclr/src/dlls/CMakeLists.txt | 6 +- src/coreclr/src/gcdump/gcdump.cpp | 4 +- src/coreclr/src/gcdump/i386/gcdumpx86.cpp | 14 +-- src/coreclr/src/gcinfo/CMakeLists.txt | 78 +++++++++++---- .../src/gcinfo/gcinfo_arm/CMakeLists.txt | 7 -- .../src/gcinfo/gcinfo_arm64/CMakeLists.txt | 7 -- .../src/gcinfo/gcinfo_linuxx86/CMakeLists.txt | 6 -- src/coreclr/src/inc/clr_std/type_traits | 14 +-- src/coreclr/src/inc/clrnt.h | 9 +- src/coreclr/src/inc/corcompile.h | 7 ++ src/coreclr/src/inc/corhlprpriv.h | 2 +- src/coreclr/src/inc/crosscomp.h | 5 +- src/coreclr/src/inc/gcdecoder.cpp | 2 + src/coreclr/src/inc/gcdump.h | 10 +- src/coreclr/src/inc/longfilepathwrappers.h | 4 +- src/coreclr/src/inc/stacktrace.h | 6 +- src/coreclr/src/jit/CMakeLists.txt | 97 +++++++++++++++---- .../src/jit/armelnonjit/CMakeLists.txt | 41 -------- src/coreclr/src/jit/armelnonjit/SOURCES | 9 -- .../src/jit/armelnonjit/armelnonjit.def | 5 - src/coreclr/src/jit/armelnonjit/makefile | 7 -- src/coreclr/src/jit/codegenarm.cpp | 4 +- src/coreclr/src/jit/codegenarmarch.cpp | 2 +- src/coreclr/src/jit/codegenxarch.cpp | 45 +++++---- src/coreclr/src/jit/compiler.cpp | 4 +- src/coreclr/src/jit/ee_il_dll.cpp | 4 +- src/coreclr/src/jit/emit.cpp | 10 +- src/coreclr/src/jit/emit.h | 2 + src/coreclr/src/jit/emitarm.cpp | 2 +- src/coreclr/src/jit/emitxarch.cpp | 12 +-- src/coreclr/src/jit/flowgraph.cpp | 2 +- src/coreclr/src/jit/gcencode.cpp | 4 +- src/coreclr/src/jit/gentree.cpp | 4 +- src/coreclr/src/jit/instr.cpp | 4 +- src/coreclr/src/jit/jitgcinfo.h | 8 +- .../src/jit/linuxnonjit/CMakeLists.txt | 26 ----- src/coreclr/src/jit/protojit/CMakeLists.txt | 12 --- src/coreclr/src/jit/protojit/SOURCES | 10 -- src/coreclr/src/jit/protojit/makefile | 6 -- src/coreclr/src/jit/protojit/protojit.def | 5 - .../src/jit/protononjit/CMakeLists.txt | 39 -------- src/coreclr/src/jit/protononjit/SOURCES | 9 -- src/coreclr/src/jit/protononjit/makefile | 7 -- .../src/jit/protononjit/protononjit.def | 5 - src/coreclr/src/jit/standalone/CMakeLists.txt | 14 --- src/coreclr/src/jit/valuenum.cpp | 2 +- .../Common/JitInterface/JitConfigProvider.cs | 5 +- .../ReadyToRunCodegenCompilationBuilder.cs | 3 + .../src/tools/aot/crossgen2/crossgen2.csproj | 32 ++++-- src/coreclr/src/utilcode/stacktrace.cpp | 8 +- src/coreclr/src/utilcode/stresslog.cpp | 12 +-- src/coreclr/src/vm/CMakeLists.txt | 14 +-- src/coreclr/src/vm/codeman.cpp | 24 ++++- .../Microsoft.NETCore.App.Crossgen2.pkgproj | 9 +- 66 files changed, 576 insertions(+), 427 deletions(-) delete mode 100644 src/coreclr/src/gcinfo/gcinfo_arm/CMakeLists.txt delete mode 100644 src/coreclr/src/gcinfo/gcinfo_arm64/CMakeLists.txt delete mode 100644 src/coreclr/src/gcinfo/gcinfo_linuxx86/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/armelnonjit/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/armelnonjit/SOURCES delete mode 100644 src/coreclr/src/jit/armelnonjit/armelnonjit.def delete mode 100644 src/coreclr/src/jit/armelnonjit/makefile delete mode 100644 src/coreclr/src/jit/linuxnonjit/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/protojit/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/protojit/SOURCES delete mode 100644 src/coreclr/src/jit/protojit/makefile delete mode 100644 src/coreclr/src/jit/protojit/protojit.def delete mode 100644 src/coreclr/src/jit/protononjit/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/protononjit/SOURCES delete mode 100644 src/coreclr/src/jit/protononjit/makefile delete mode 100644 src/coreclr/src/jit/protononjit/protononjit.def delete mode 100644 src/coreclr/src/jit/standalone/CMakeLists.txt diff --git a/eng/Signing.props b/eng/Signing.props index 1ca34c107da6f5..3571b7831b1cdb 100644 --- a/eng/Signing.props +++ b/eng/Signing.props @@ -56,8 +56,13 @@ - - + + + + + + + diff --git a/eng/Subsets.props b/eng/Subsets.props index f7f61f98f6e9bf..0c1a2f5e573c1f 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -54,7 +54,7 @@ - clr.runtime+linuxdac+clr.corelib+clr.nativecorelib+clr.tools+clr.packages + clr.runtime+clr.jit+clr.alljits+linuxdac+clr.corelib+clr.nativecorelib+clr.tools+clr.packages mono.llvm+ $(DefaultMonoSubsets)mono.runtime+mono.corelib+mono.packages @@ -74,12 +74,17 @@ <_subset>+$(_subset.Trim('+'))+ + + + ClrRuntimeSubset=true;ClrJitSubset=true + + @@ -132,16 +137,28 @@ - - + + $(ClrRuntimeBuildSubsets);ClrRuntimeSubset=true;ClrJitSubset=true + + + + $(ClrRuntimeBuildSubsets);ClrJitSubset=true + + + + $(ClrRuntimeBuildSubsets);ClrAllJitsSubset=true;ClrJitSubset=true + + + + - + - + diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index d2cb169cb0e790..1142c27d0be52e 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -201,13 +201,17 @@ endif() # Definitions (for platform) #----------------------------------- if (CLR_CMAKE_HOST_ARCH_AMD64) + set(ARCH_HOST_NAME x64) add_definitions(-DHOST_AMD64) add_definitions(-DHOST_64BIT) elseif (CLR_CMAKE_HOST_ARCH_I386) + set(ARCH_HOST_NAME x86) add_definitions(-DHOST_X86) elseif (CLR_CMAKE_HOST_ARCH_ARM) + set(ARCH_HOST_NAME arm) add_definitions(-DHOST_ARM) elseif (CLR_CMAKE_HOST_ARCH_ARM64) + set(ARCH_HOST_NAME arm64) add_definitions(-DHOST_ARM64) add_definitions(-DHOST_64BIT) else () @@ -262,18 +266,22 @@ endif(CLR_CMAKE_HOST_WIN32) # Architecture specific files folder name if (CLR_CMAKE_TARGET_ARCH_AMD64) set(ARCH_SOURCES_DIR amd64) - add_definitions(-DTARGET_AMD64) - add_definitions(-DTARGET_64BIT) + set(ARCH_TARGET_NAME x64) + add_compile_definitions($<$>>:TARGET_AMD64>) + add_compile_definitions($<$>>:TARGET_64BIT>) elseif (CLR_CMAKE_TARGET_ARCH_ARM64) set(ARCH_SOURCES_DIR arm64) - add_definitions(-DTARGET_ARM64) - add_definitions(-DTARGET_64BIT) + set(ARCH_TARGET_NAME arm64) + add_compile_definitions($<$>>:TARGET_ARM64>) + add_compile_definitions($<$>>:TARGET_64BIT>) elseif (CLR_CMAKE_TARGET_ARCH_ARM) set(ARCH_SOURCES_DIR arm) - add_definitions(-DTARGET_ARM) + set(ARCH_TARGET_NAME arm) + add_compile_definitions($<$>>:TARGET_ARM>) elseif (CLR_CMAKE_TARGET_ARCH_I386) + set(ARCH_TARGET_NAME x86) set(ARCH_SOURCES_DIR i386) - add_definitions(-DTARGET_X86) + add_compile_definitions($<$>>:TARGET_X86>) else () clr_unknown_arch() endif () @@ -374,24 +382,24 @@ if (CLR_CMAKE_HOST_UNIX) endif(CLR_CMAKE_HOST_UNIX) if(CLR_CMAKE_TARGET_UNIX) - add_definitions(-DTARGET_UNIX) + add_compile_definitions($<$>>:TARGET_UNIX>) # Contracts are disabled on UNIX. add_definitions(-DDISABLE_CONTRACTS) if(CLR_CMAKE_TARGET_OSX) - add_definitions(-DTARGET_OSX) + add_compile_definitions($<$>>:TARGET_OSX>) elseif(CLR_CMAKE_TARGET_FREEBSD) - add_definitions(-DTARGET_FREEBSD) + add_compile_definitions($<$>>:TARGET_FREEBSD>) elseif(CLR_CMAKE_TARGET_LINUX) - add_definitions(-DTARGET_LINUX) + add_compile_definitions($<$>>:TARGET_LINUX>) elseif(CLR_CMAKE_TARGET_NETBSD) - add_definitions(-DTARGET_NETBSD) + add_compile_definitions($<$>>:TARGET_NETBSD>) elseif(CLR_CMAKE_TARGET_SUNOS) - add_definitions(-DTARGET_SUNOS) + add_compile_definitions($<$>>:TARGET_SUNOS>) elseif(CLR_CMAKE_TARGET_ANDROID) - add_definitions(-DTARGET_ANDROID) + add_compile_definitions($<$>>:TARGET_ANDROID>) endif() else(CLR_CMAKE_TARGET_UNIX) - add_definitions(-DTARGET_WINDOWS) + add_compile_definitions($<$>>:TARGET_WINDOWS>) endif(CLR_CMAKE_TARGET_UNIX) if(CLR_CMAKE_HOST_UNIX_ARM) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index dbfadfda599146..2bdb1522926548 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -364,8 +364,8 @@ endif(CLR_CMAKE_TARGET_UNIX) # check if host & target os/arch combination are valid if (CLR_CMAKE_TARGET_OS STREQUAL CLR_CMAKE_HOST_OS) if(NOT(CLR_CMAKE_TARGET_ARCH STREQUAL CLR_CMAKE_HOST_ARCH)) - if(NOT((CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM64) OR (CLR_CMAKE_HOST_ARCH_I386 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM))) - message(FATAL_ERROR "Invalid platform and target arch combination") + if(NOT((CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM64) OR (CLR_CMAKE_HOST_ARCH_I386 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_I386))) + message(FATAL_ERROR "Invalid platform and target arch combination TARGET_ARCH=${CLR_CMAKE_TARGET_ARCH} HOST_ARCH=${CLR_CMAKE_HOST_ARCH}") endif() endif() else() diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index b94eb54a671540..e5dbed52b56ccc 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -51,9 +51,9 @@ include(pgosupport.cmake) #------------------------------- # Include libraries native shims #------------------------------- -if(NOT CLR_CROSS_COMPONENTS_BUILD) +if(NOT CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_BUILD_SUBSET_RUNTIME) add_subdirectory(src/libraries-native) -endif(NOT CLR_CROSS_COMPONENTS_BUILD) +endif(NOT CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_BUILD_SUBSET_RUNTIME) #----------------------------------------- # Add Projects @@ -86,7 +86,7 @@ add_subdirectory(src/pal/prebuilt/inc) add_subdirectory(src/debug/debug-pal) -if(CLR_CMAKE_TARGET_WIN32) +if(CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_BUILD_SUBSET_RUNTIME) add_subdirectory(src/gc/sample) endif() @@ -115,7 +115,9 @@ include_directories("../../artifacts/obj/coreclr") if(FEATURE_STANDALONE_GC) add_definitions(-DFEATURE_STANDALONE_GC) - add_subdirectory(src/gc) + if (CLR_CMAKE_BUILD_SUBSET_RUNTIME) + add_subdirectory(src/gc) + endif (CLR_CMAKE_BUILD_SUBSET_RUNTIME) endif(FEATURE_STANDALONE_GC) if (CLR_CMAKE_HOST_UNIX) diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd index 628f4eefbff28d..49e4894c5134a1 100644 --- a/src/coreclr/build-runtime.cmd +++ b/src/coreclr/build-runtime.cmd @@ -83,7 +83,12 @@ set __BuildCrossArchNative=0 set __SkipCrossArchNative=0 set __SkipGenerateVersion=0 set __RestoreOptData=1 +set __BuildJit=1 +set __BuildAllJits=1 +set __BuildRuntime=1 set __CrossArch= +set __CrossArch2= +set __CrossOS=0 set __PgoOptDataPath= set __CMakeArgs= @@ -149,8 +154,8 @@ if [!__PassThroughArgs!]==[] ( set __PassThroughArgs=%__PassThroughArgs% %1 ) -if /i "%1" == "-alpinedac" (set __BuildNative=0&set __BuildCrossArchNative=1&set __CrossArch=x64&set __TargetOS=alpine&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "-linuxdac" (set __BuildNative=0&set __BuildCrossArchNative=1&set __CrossArch=x64&set __TargetOS=Linux&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-alpinedac" (set __BuildNative=0&set __BuildCrossArchNative=1&set __CrossArch=x64&set __CrossOS=1&set __TargetOS=alpine&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-linuxdac" (set __BuildNative=0&set __BuildCrossArchNative=1&set __CrossArch=x64&set __CrossOS=1&set __TargetOS=Linux&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-cmakeargs" (set __CMakeArgs=%2 %__CMakeArgs%&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) if /i "%1" == "-configureonly" (set __ConfigureOnly=1&set __BuildNative=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) @@ -163,6 +168,9 @@ if /i "%1" == "-usenmakemakefiles" (set __NMakeMakefiles=1&set __ConfigureOnly if /i "%1" == "-pgoinstrument" (set __PgoInstrument=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-enforcepgo" (set __EnforcePgo=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-nopgooptimize" (set __PgoOptimize=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-skipjit" (set __BuildJit=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-skipalljits" (set __BuildAllJits=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-skipruntime" (set __BuildRuntime=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) REM TODO these are deprecated remove them eventually REM don't add more, use the - syntax instead @@ -208,10 +216,14 @@ if %__TotalSpecifiedBuildArch% GTR 1 ( ) if %__BuildArchX64%==1 set __BuildArch=x64 -if %__BuildArchX86%==1 set __BuildArch=x86 +if %__BuildArchX86%==1 ( + set __BuildArch=x86 + if /i "%__CrossOS%" NEQ "1" set __CrossArch=x64 +) if %__BuildArchArm%==1 ( set __BuildArch=arm set __CrossArch=x86 + if /i "%__CrossOS%" NEQ "1" set __CrossArch2=x64 ) if %__BuildArchArm64%==1 ( set __BuildArch=arm64 @@ -251,6 +263,9 @@ if %__SkipCrossArchNative% EQU 0 ( if /i "%__BuildArch%"=="arm" ( set __BuildCrossArchNative=1 ) + if /i "%__BuildArch%"=="x86" ( + set __BuildCrossArchNative=1 + ) ) ) @@ -269,9 +284,11 @@ if "%__NMakeMakefiles%"=="1" (set "__IntermediatesDir=%__RootBinDir%\nmakeobj\%_ set "__PackagesBinDir=%__BinDir%\.nuget" set "__CrossComponentBinDir=%__BinDir%" set "__CrossCompIntermediatesDir=%__IntermediatesDir%\crossgen" +set "__CrossComp2IntermediatesDir=%__IntermediatesDir%\crossgen_2" if NOT "%__CrossArch%" == "" set __CrossComponentBinDir=%__CrossComponentBinDir%\%__CrossArch% +if NOT "%__CrossArch2%" == "" set __CrossComponent2BinDir=%__BinDir%\%__CrossArch2% REM Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash set "__CMakeBinDir=%__BinDir%" @@ -400,6 +417,8 @@ if NOT DEFINED PYTHON ( goto ExitWithError ) +set __CMakeClrBuildSubsetArgs="-DCLR_CMAKE_BUILD_SUBSET_JIT=%__BuildJit%" "-DCLR_CMAKE_BUILD_SUBSET_ALLJITS=%__BuildAllJits%" "-DCLR_CMAKE_BUILD_SUBSET_RUNTIME=%__BuildRuntime%" + REM ========================================================================================= REM === REM === Build Cross-Architecture Native Components (if applicable) @@ -425,21 +444,48 @@ if %__BuildCrossArchNative% EQU 1 ( set __CMakeBinDir=%__CrossComponentBinDir% set "__CMakeBinDir=!__CMakeBinDir:\=/!" - set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% + set __ExtraCmakeArgs=%__CMakeClrBuildSubsetArgs% "-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=0" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=0" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossCompIntermediatesDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs! if not !errorlevel! == 0 ( - echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate cross architecture native component build project! + echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate cross architecture native component build project %__CrossArch%! goto ExitWithError ) @if defined _echo @echo on + if NOT "%__CrossArch2%" == "" ( + if not exist "%__CrossComp2IntermediatesDir%" md "%__CrossComp2IntermediatesDir%" + if /i "%__CrossArch2%" == "x86" ( set __VCBuildArch=x86 ) + if /i "%__CrossArch2%" == "x64" ( set __VCBuildArch=x86_amd64 ) + + set __CMakeBinDir=%__CrossComponent2BinDir% + set "__CMakeBinDir=!__CMakeBinDir:\=/!" + set __ExtraCmakeArgs=%__CMakeClrBuildSubsetArgs% "-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=0" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=0" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% + call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossComp2IntermediatesDir%" %__VSVersion% %__CrossArch2% !__ExtraCmakeArgs! + + if not !errorlevel! == 0 ( + echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate cross architecture native component build project %__CrossArch2%! + goto ExitWithError + ) + + set __VCBuildArch=x86_amd64 + if /i "%__CrossArch%" == "x86" ( set __VCBuildArch=x86 ) + @if defined _echo @echo on + ) + :SkipConfigureCrossBuild if not exist "%__CrossCompIntermediatesDir%\CMakeCache.txt" ( - echo %__ErrMsgPrefix%%__MsgPrefix%Error: unable to find generated cross architecture native component build project! + echo %__ErrMsgPrefix%%__MsgPrefix%Error: unable to find generated cross architecture native component build project %__CrossArch%! goto ExitWithError ) + if NOT "%__CrossArch2%" == "" ( + if not exist "%__CrossComp2IntermediatesDir%\CMakeCache.txt" ( + echo %__ErrMsgPrefix%%__MsgPrefix%Error: unable to find generated cross architecture native component build project %__CrossArch2%! + goto ExitWithError + ) + ) + if defined __ConfigureOnly goto SkipCrossCompBuild set __BuildLogRootName=Cross @@ -465,6 +511,30 @@ if %__BuildCrossArchNative% EQU 1 ( goto ExitWithCode ) + if NOT "%__CrossArch2%" == "" ( + set __BuildLogRootName=Cross2 + set "__BuildLog=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.log" + set "__BuildWrn=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.wrn" + set "__BuildErr=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.err" + set "__BinLog=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.binlog" + set "__MsbuildLog=/flp:Verbosity=normal;LogFile=!__BuildLog!" + set "__MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!" + set "__MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!" + set "__MsbuildBinLog=/bl:!__BinLog!" + set "__Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! !__MsbuildBinLog!" + + REM We pass the /m flag directly to MSBuild so that we can get both MSBuild and CL parallelism, which is fastest for our builds. + "%CMakePath%" --build %__CrossComp2IntermediatesDir% --target install --config %__BuildType% -- /nologo /m !__Logging! + + if not !errorlevel! == 0 ( + set __exitCode=!errorlevel! + echo %__ErrMsgPrefix%%__MsgPrefix%Error: cross-arch components build failed. Refer to the build log files for details. + echo !__BuildLog! + echo !__BuildWrn! + echo !__BuildErr! + goto ExitWithCode + ) + ) :SkipCrossCompBuild REM } Scope environment changes end endlocal @@ -508,7 +578,8 @@ if %__BuildNative% EQU 1 ( echo %__MsgPrefix%Regenerating the Visual Studio solution - set __ExtraCmakeArgs="-DCMAKE_SYSTEM_VERSION=10.0" !___CrossBuildDefine! "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% + set __ExtraCmakeArgs=%__CMakeClrBuildSubsetArgs% "-DCMAKE_SYSTEM_VERSION=10.0" !___CrossBuildDefine! "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% + call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__IntermediatesDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs! if not !errorlevel! == 0 ( echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate native component build project! diff --git a/src/coreclr/build-runtime.sh b/src/coreclr/build-runtime.sh index 24bb0067380b54..f4007ebd1a74b4 100755 --- a/src/coreclr/build-runtime.sh +++ b/src/coreclr/build-runtime.sh @@ -22,6 +22,9 @@ usage_list+=("-nopgooptimize: do not use profile guided optimizations.") usage_list+=("-pgoinstrument: generate instrumented code for profile guided optimization enabled binaries.") usage_list+=("-skipcrossarchnative: Skip building cross-architecture native binaries.") usage_list+=("-staticanalyzer: skip native image generation.") +usage_list+=("-skipjit: skip building jit.") +usage_list+=("-skipalljits: skip building crosstargetting jits.") +usage_list+=("-skipruntime: skip building runtime.") setup_dirs_local() { @@ -121,6 +124,17 @@ handle_arguments_local() { __StaticAnalyzer=1 ;; + skipjit|-skipjit) + __BuildJit=0 + ;; + + skipalljits|-skipalljits) + __BuildAllJits=0 + ;; + + skipruntime|-skipruntime) + __BuildRuntime=0 + ;; *) __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" ;; @@ -173,6 +187,9 @@ __UseNinja=0 __VerboseBuild=0 __ValidateCrossArg=1 __CMakeArgs="" +__BuildJit=1 +__BuildAllJits=1 +__BuildRuntime=1 source "$__ProjectRoot"/_build-commons.sh @@ -229,6 +246,7 @@ restore_optdata # Build the coreclr (native) components. __CMakeArgs="-DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_PATH=$__PgoOptDataPath -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize -DCLR_REPO_ROOT_DIR=\"$__RepoRootDir\" $__CMakeArgs" +__CMakeArgs="-DCLR_CMAKE_BUILD_SUBSET_JIT=$__BuildJit -DCLR_CMAKE_BUILD_SUBSET_ALLJITS=$__BuildAllJits -DCLR_CMAKE_BUILD_SUBSET_RUNTIME=$__BuildRuntime $__CMakeArgs" if [[ "$__SkipConfigure" == 0 && "$__CodeCoverage" == 1 ]]; then __CMakeArgs="-DCLR_CMAKE_ENABLE_CODE_COVERAGE=1 $__CMakeArgs" diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake index b717c10d840a40..eafe212786d853 100644 --- a/src/coreclr/clrdefinitions.cmake +++ b/src/coreclr/clrdefinitions.cmake @@ -16,7 +16,7 @@ if (CLR_CMAKE_TARGET_ARCH_ARM64) if (CLR_CMAKE_TARGET_UNIX) add_definitions(-DFEATURE_EMULATE_SINGLESTEP) endif() - add_definitions(-DFEATURE_MULTIREG_RETURN) + add_compile_definitions($<$>>:FEATURE_MULTIREG_RETURN>) elseif (CLR_CMAKE_TARGET_ARCH_ARM) if (CLR_CMAKE_HOST_WIN32 AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD) # Set this to ensure we can use Arm SDK for Desktop binary linkage when doing native (Arm32) build @@ -33,11 +33,12 @@ if (CLR_CMAKE_TARGET_UNIX) endif(CLR_CMAKE_TARGET_OSX) if (CLR_CMAKE_TARGET_ARCH_AMD64) - add_definitions(-DUNIX_AMD64_ABI) + add_compile_definitions($<$>>:UNIX_AMD64_ABI>) + add_compile_definitions($<$>>:FEATURE_MULTIREG_RETURN>) elseif (CLR_CMAKE_TARGET_ARCH_ARM) - add_definitions(-DUNIX_ARM_ABI) + add_compile_definitions($<$>>:UNIX_ARM_ABI>) elseif (CLR_CMAKE_TARGET_ARCH_I386) - add_definitions(-DUNIX_X86_ABI) + add_compile_definitions($<$>>:UNIX_X86_ABI>) endif() endif(CLR_CMAKE_TARGET_UNIX) @@ -145,7 +146,7 @@ endif(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_WIN32) add_definitions(-DFEATURE_MANAGED_ETW_CHANNELS) if(FEATURE_MERGE_JIT_AND_ENGINE) - add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) + add_compile_definitions($<$>>:FEATURE_MERGE_JIT_AND_ENGINE>) endif(FEATURE_MERGE_JIT_AND_ENGINE) add_compile_definitions($<$>>:FEATURE_MULTICOREJIT>) if(CLR_CMAKE_TARGET_UNIX) @@ -199,12 +200,6 @@ if (CLR_CMAKE_TARGET_ARCH_AMD64) # Enable the AMD64 Unix struct passing JIT-EE interface for all AMD64 platforms, to enable altjit. add_definitions(-DUNIX_AMD64_ABI_ITF) endif (CLR_CMAKE_TARGET_ARCH_AMD64) -if(CLR_CMAKE_TARGET_UNIX_AMD64) - add_definitions(-DFEATURE_MULTIREG_RETURN) -endif (CLR_CMAKE_TARGET_UNIX_AMD64) -if(CLR_CMAKE_TARGET_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64) - add_definitions(-DUNIX_AMD64_ABI) -endif(CLR_CMAKE_TARGET_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64) add_definitions(-DFEATURE_USE_ASM_GC_WRITE_BARRIERS) if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64) add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP) @@ -231,5 +226,49 @@ if(CLR_CMAKE_TARGET_OSX) endif(CLR_CMAKE_TARGET_OSX) if (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) - add_definitions(-DFEATURE_EH_FUNCLETS) + add_compile_definitions($<$>>:FEATURE_EH_FUNCLETS>) endif (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) + + +# Use this function to enable building with a specific target OS and architecture set of defines +# This is known to work for the set of defines used by the JIT and gcinfo, it is not likely correct for +# other components of the runtime +function(set_target_definitions_to_custom_os_and_arch) + set(oneValueArgs TARGET OS ARCH) + cmake_parse_arguments(TARGETDETAILS "" "${oneValueArgs}" "" ${ARGN}) + + set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES IGNORE_DEFAULT_TARGET_ARCH TRUE) + set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES IGNORE_DEFAULT_TARGET_OS TRUE) + + if ((TARGETDETAILS_OS STREQUAL "unix")) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_UNIX) + if (TARGETDETAILS_ARCH STREQUAL "x64") + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_AMD64_ABI) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN) + elseif (TARGETDETAILS_ARCH STREQUAL "arm") + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_ARM_ABI) + elseif (TARGETDETAILS_ARCH STREQUAL "x86") + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_X86_ABI) + elseif (TARGETDETAILS_ARCH STREQUAL "arm64") + endif() + else() + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_WINDOWS) + endif((TARGETDETAILS_OS STREQUAL "unix")) + + if (TARGETDETAILS_ARCH STREQUAL "x86") + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_X86) + elseif(TARGETDETAILS_ARCH STREQUAL "x64") + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_AMD64) + elseif(TARGETDETAILS_ARCH STREQUAL "arm64") + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM64) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN) + elseif(TARGETDETAILS_ARCH STREQUAL "arm") + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM) + endif() + + if (NOT (TARGETDETAILS_ARCH STREQUAL "x86") OR (TARGETDETAILS_OS STREQUAL "unix")) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_EH_FUNCLETS) + endif (NOT (TARGETDETAILS_ARCH STREQUAL "x86") OR (TARGETDETAILS_OS STREQUAL "unix")) +endfunction() diff --git a/src/coreclr/crosscomponents.cmake b/src/coreclr/crosscomponents.cmake index 5bb0b5bef5c738..964c9431ce7b5a 100644 --- a/src/coreclr/crosscomponents.cmake +++ b/src/coreclr/crosscomponents.cmake @@ -1,15 +1,26 @@ add_definitions(-DCROSS_COMPILE) -if(CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM) +if(CLR_CMAKE_HOST_ARCH_AMD64 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_I386)) set(FEATURE_CROSSBITNESS 1) -endif(CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM) +endif(CLR_CMAKE_HOST_ARCH_AMD64 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_I386)) if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS) set (CLR_CROSS_COMPONENTS_LIST - crossgen clrjit jitinterface ) + + if(CLR_CMAKE_HOST_LINUX OR NOT FEATURE_CROSSBITNESS) + list (APPEND CLR_CROSS_COMPONENTS_LIST + crossgen + ) + endif() + + if (CLR_CMAKE_TARGET_UNIX) + list (APPEND CLR_CROSS_COMPONENTS_LIST + clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} + ) + endif(CLR_CMAKE_TARGET_UNIX) endif() if(NOT CLR_CMAKE_HOST_LINUX AND NOT FEATURE_CROSSBITNESS) diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index f0da8c09cd0d69..7ea711cf15bdc4 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -21,6 +21,10 @@ <_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and '$(CrossDac)' != ''" Include="-$(CrossDac)dac" /> <_CoreClrBuildArg Condition="'$(OfficialBuildId)' != ''" Include="/p:OfficialBuildId=$(OfficialBuildId)" /> <_CoreClrBuildArg Condition="'$(NoPgoOptimize)' == 'true'" Include="-nopgooptimize" /> + <_CoreClrBuildArg Condition="'$(ClrRuntimeSubset)' != 'true'" Include="-skipruntime" /> + <_CoreClrBuildArg Condition="'$(ClrJitSubset)' != 'true'" Include="-skipjit" /> + <_CoreClrBuildArg Condition="'$(ClrAllJitsSubset)' != 'true'" Include="-skipalljits" /> + <_CoreClrBuildArg Condition="'$(NoPgoOptimize)' == 'true'" Include="-nopgooptimize" /> diff --git a/src/coreclr/src/CMakeLists.txt b/src/coreclr/src/CMakeLists.txt index e269657e5addf4..0866be360fd03f 100644 --- a/src/coreclr/src/CMakeLists.txt +++ b/src/coreclr/src/CMakeLists.txt @@ -61,22 +61,28 @@ endif(CLR_CMAKE_HOST_UNIX) add_subdirectory(utilcode) add_subdirectory(gcinfo) add_subdirectory(jit) -add_subdirectory(vm) -add_subdirectory(md) -add_subdirectory(debug) add_subdirectory(inc) -add_subdirectory(binder) -add_subdirectory(classlibnative) -add_subdirectory(dlls) -add_subdirectory(ToolBox) -add_subdirectory(tools) -add_subdirectory(unwinder) -add_subdirectory(ildasm) -add_subdirectory(ilasm) -add_subdirectory(interop) if(CLR_CMAKE_HOST_UNIX) add_subdirectory(palrt) -elseif(CLR_CMAKE_HOST_WIN32) - add_subdirectory(hosts) endif(CLR_CMAKE_HOST_UNIX) + +add_subdirectory(vm) +if (CLR_CMAKE_BUILD_SUBSET_RUNTIME) + add_subdirectory(md) + add_subdirectory(debug) + add_subdirectory(binder) + add_subdirectory(classlibnative) + add_subdirectory(dlls) + add_subdirectory(ToolBox) + add_subdirectory(tools) + add_subdirectory(unwinder) + add_subdirectory(ildasm) + add_subdirectory(ilasm) + add_subdirectory(interop) + + if(CLR_CMAKE_HOST_WIN32) + add_subdirectory(hosts) + endif(CLR_CMAKE_HOST_WIN32) +endif(CLR_CMAKE_BUILD_SUBSET_RUNTIME) + diff --git a/src/coreclr/src/debug/runtimeinfo/CMakeLists.txt b/src/coreclr/src/debug/runtimeinfo/CMakeLists.txt index 99b8f5edd08453..5f5778d1899edf 100644 --- a/src/coreclr/src/debug/runtimeinfo/CMakeLists.txt +++ b/src/coreclr/src/debug/runtimeinfo/CMakeLists.txt @@ -7,5 +7,8 @@ set(RUNTIMEINFO_SOURCES add_library_clr(runtimeinfo STATIC ${RUNTIMEINFO_SOURCES}) add_dependencies(runtimeinfo coreclr_module_index_header) -add_dependencies(runtimeinfo mscordaccore_module_index_header) -add_dependencies(runtimeinfo mscordbi_module_index_header) + +if (NOT (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_ARM) AND CLR_CMAKE_HOST_ARCH_AMD64)) + add_dependencies(runtimeinfo mscordaccore_module_index_header) + add_dependencies(runtimeinfo mscordbi_module_index_header) +endif() \ No newline at end of file diff --git a/src/coreclr/src/dlls/CMakeLists.txt b/src/coreclr/src/dlls/CMakeLists.txt index 6df11d24cd4efb..6ef420d165f1a7 100644 --- a/src/coreclr/src/dlls/CMakeLists.txt +++ b/src/coreclr/src/dlls/CMakeLists.txt @@ -2,8 +2,10 @@ if(CLR_CMAKE_TARGET_WIN32) add_subdirectory(clretwrc) endif(CLR_CMAKE_TARGET_WIN32) add_subdirectory(dbgshim) -add_subdirectory(mscordbi) -add_subdirectory(mscordac) +if (NOT (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_ARM) AND CLR_CMAKE_HOST_ARCH_AMD64)) + add_subdirectory(mscordbi) + add_subdirectory(mscordac) +endif() add_subdirectory(mscoree) add_subdirectory(mscorpe) add_subdirectory(mscorrc) diff --git a/src/coreclr/src/gcdump/gcdump.cpp b/src/coreclr/src/gcdump/gcdump.cpp index 04faf7819daf65..84cb0beed9ccad 100644 --- a/src/coreclr/src/gcdump/gcdump.cpp +++ b/src/coreclr/src/gcdump/gcdump.cpp @@ -34,7 +34,7 @@ GCDump::GCDump(UINT32 gcInfoVer, bool encBytes, unsigned maxEncBytes, bool dumpC * Display the byte encodings for the given range of the GC tables. */ -PTR_CBYTE GCDump::DumpEncoding(PTR_CBYTE gcInfoBlock, int cDumpBytes) +PTR_CBYTE GCDump::DumpEncoding(PTR_CBYTE gcInfoBlock, size_t cDumpBytes) { _ASSERTE((cDumpBytes >= 0) && (cMaxEncBytes < 256)); @@ -42,7 +42,7 @@ PTR_CBYTE GCDump::DumpEncoding(PTR_CBYTE gcInfoBlock, int cDumpBytes) { PTR_CBYTE pCurPos; unsigned count; - int cBytesLeft; + size_t cBytesLeft; for (count = cMaxEncBytes, cBytesLeft = cDumpBytes, pCurPos = gcInfoBlock; count > 0; diff --git a/src/coreclr/src/gcdump/i386/gcdumpx86.cpp b/src/coreclr/src/gcdump/i386/gcdumpx86.cpp index 0d221e1918db4e..92b64430aece92 100644 --- a/src/coreclr/src/gcdump/i386/gcdumpx86.cpp +++ b/src/coreclr/src/gcdump/i386/gcdumpx86.cpp @@ -61,10 +61,10 @@ const char * CalleeSavedRegName(unsigned reg) /*****************************************************************************/ -unsigned GCDump::DumpInfoHdr (PTR_CBYTE gcInfoBlock, - InfoHdr* header, - unsigned * methodSize, - bool verifyGCTables) +size_t GCDump::DumpInfoHdr (PTR_CBYTE gcInfoBlock, + InfoHdr* header, + unsigned * methodSize, + bool verifyGCTables) { unsigned count; PTR_CBYTE table = gcInfoBlock; @@ -185,11 +185,11 @@ unsigned GCDump::DumpInfoHdr (PTR_CBYTE gcInfoBlock, } { - unsigned cur = 0; - unsigned last = table-bp; + size_t cur = 0; + size_t last = table-bp; while (cur < last) { - unsigned amount = last - cur; + size_t amount = last - cur; if (amount>5) amount = 5; diff --git a/src/coreclr/src/gcinfo/CMakeLists.txt b/src/coreclr/src/gcinfo/CMakeLists.txt index f40ff3deb83a0b..895ad0c0c98eed 100644 --- a/src/coreclr/src/gcinfo/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/CMakeLists.txt @@ -1,22 +1,29 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) -set( GCINFO_SOURCES +set( GCINFO_ALLARCH_SOURCES arraylist.cpp gcinfoencoder.cpp simplerhash.cpp ) +set( GCINFO_I386_SOURCES + ../gcdump/gcdump.cpp + ../gcdump/i386/gcdumpx86.cpp +) + +convert_to_absolute_path(GCINFO_ALLARCH_SOURCES ${GCINFO_ALLARCH_SOURCES}) +convert_to_absolute_path(GCINFO_I386_SOURCES ${GCINFO_I386_SOURCES}) +set( GCINFO_SOURCES + ${GCINFO_ALLARCH_SOURCES} + ) if(CLR_CMAKE_TARGET_ARCH_I386) list(APPEND GCINFO_SOURCES - ../gcdump/gcdump.cpp - ../gcdump/${ARCH_SOURCES_DIR}/gcdumpx86.cpp + ${GCINFO_I386_SOURCES} ) endif(CLR_CMAKE_TARGET_ARCH_I386) -convert_to_absolute_path(GCINFO_SOURCES ${GCINFO_SOURCES}) - add_library_clr(gcinfo_obj OBJECT ${GCINFO_SOURCES} @@ -32,21 +39,54 @@ add_library_clr(gcinfo_crossgen set_target_properties(gcinfo_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) +_install (FILES gcinfoencoder.cpp + DESTINATION gcinfo) -if (CLR_CMAKE_HOST_ARCH_I386) - # On x86, build RyuJIT/ARM32 cross-compiling altjit. - add_subdirectory(gcinfo_arm) -endif () +function(create_gcinfo_lib) -if (CLR_CMAKE_HOST_ARCH_I386 AND CLR_CMAKE_TARGET_WIN32) - # On x86, build Linux x86 cross-compiling altjit. - add_subdirectory(gcinfo_linuxx86) -endif () + set(oneValueArgs TARGET OS ARCH) + cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "" ${ARGN}) -if (CLR_CMAKE_HOST_ARCH_AMD64) - # On amd64, build RyuJIT/ARM64 cross-compiling altjit. - add_subdirectory(gcinfo_arm64) -endif () + set( GCINFO_SOURCES + ${GCINFO_ALLARCH_SOURCES} + ) -_install (FILES gcinfoencoder.cpp - DESTINATION gcinfo) + if(TARGETDETAILS_ARCH STREQUAL "x86") + list(APPEND GCINFO_SOURCES + ${GCINFO_I386_SOURCES} + ) + endif(TARGETDETAILS_ARCH STREQUAL "x86") + + add_library_clr("${TARGETDETAILS_TARGET}" + STATIC + ${GCINFO_SOURCES} + ) + + set_target_definitions_to_custom_os_and_arch(${ARGN}) +endfunction() + +if (CLR_CMAKE_TARGET_UNIX) +set(TARGET_OS_NAME unix) +else() +set(TARGET_OS_NAME win) +endif() + +if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) + if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) + create_gcinfo_lib(TARGET gcinfo_unix_arm64 OS unix ARCH arm64) + create_gcinfo_lib(TARGET gcinfo_unix_x64 OS unix ARCH x64) + create_gcinfo_lib(TARGET gcinfo_win_arm64 OS win ARCH arm64) + create_gcinfo_lib(TARGET gcinfo_win_x64 OS win ARCH x64) + endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) + + create_gcinfo_lib(TARGET gcinfo_unix_arm OS unix ARCH arm) + create_gcinfo_lib(TARGET gcinfo_win_arm OS win ARCH arm) + create_gcinfo_lib(TARGET gcinfo_win_x86 OS win ARCH x86) +else() + create_gcinfo_lib(TARGET gcinfo_${TARGET_OS_NAME}_${ARCH_TARGET_NAME} OS ${TARGET_OS_NAME} ARCH ${ARCH_TARGET_NAME}) + + if (CLR_CMAKE_HOST_ARCH_I386 AND NOT ((TARGET_OS_NAME STREQUAL unix) AND (ARCH_TARGET_NAME STREQUAL "arm"))) + # On x86, build gcinfo for RyuJIT/ARM32 cross-compiling altjit for ARM_SOFTFP (armel). + create_gcinfo_lib(TARGET gcinfo_unix_arm OS unix ARCH arm) + endif() +endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) diff --git a/src/coreclr/src/gcinfo/gcinfo_arm/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_arm/CMakeLists.txt deleted file mode 100644 index 3dd25ee3057c4d..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_arm/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -remove_definitions(-DTARGET_X86) -add_definitions(-DTARGET_ARM) - -add_library_clr(gcinfo_arm - STATIC - ${GCINFO_SOURCES} -) diff --git a/src/coreclr/src/gcinfo/gcinfo_arm64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_arm64/CMakeLists.txt deleted file mode 100644 index 11069b52f2f221..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_arm64/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -remove_definitions(-DTARGET_AMD64) -add_definitions(-DTARGET_ARM64) - -add_library_clr(gcinfo_arm64 - STATIC - ${GCINFO_SOURCES} -) diff --git a/src/coreclr/src/gcinfo/gcinfo_linuxx86/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_linuxx86/CMakeLists.txt deleted file mode 100644 index 149f493e22f6f6..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_linuxx86/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_definitions(-DUNIX_X86_ABI) - -add_library_clr(gcinfo_linuxx86 - STATIC - ${GCINFO_SOURCES} -) diff --git a/src/coreclr/src/inc/clr_std/type_traits b/src/coreclr/src/inc/clr_std/type_traits index 47d4f241639c73..1650b2bc7cbb92 100644 --- a/src/coreclr/src/inc/clr_std/type_traits +++ b/src/coreclr/src/inc/clr_std/type_traits @@ -198,7 +198,7 @@ namespace std typedef unsigned int type; }; -#ifndef TARGET_UNIX +#ifndef HOST_UNIX template<> struct make_unsigned @@ -206,7 +206,7 @@ namespace std typedef unsigned long type; }; -#endif // !TARGET_UNIX +#endif // !HOST_UNIX template<> struct make_unsigned<__int64> @@ -233,7 +233,7 @@ namespace std typedef signed int type; }; -#ifndef TARGET_UNIX +#ifndef HOST_UNIX template<> struct make_signed @@ -241,7 +241,7 @@ namespace std typedef signed long type; }; -#endif // !TARGET_UNIX +#endif // !HOST_UNIX template<> struct make_signed @@ -358,7 +358,7 @@ namespace std // On Unix 'long' is a 64-bit type (same as __int64) and the following two definitions // conflict with _Is_integral and _Is_integral. -#ifndef TARGET_UNIX +#ifndef HOST_UNIX template<> struct _Is_integral : true_type @@ -370,7 +370,7 @@ namespace std : true_type { // determine whether _Ty is integral }; -#endif /* TARGET_UNIX */ +#endif /* HOST_UNIX */ #if _HAS_CHAR16_T_LANGUAGE_SUPPORT template<> @@ -426,7 +426,7 @@ namespace std // In PAL, we define long as int and so this becomes int double, // which is a nonsense -#ifndef TARGET_UNIX +#ifndef HOST_UNIX template<> struct _Is_floating_point : true_type diff --git a/src/coreclr/src/inc/clrnt.h b/src/coreclr/src/inc/clrnt.h index 1a1999938ead52..a833da67bcc9b5 100644 --- a/src/coreclr/src/inc/clrnt.h +++ b/src/coreclr/src/inc/clrnt.h @@ -837,6 +837,7 @@ RtlVirtualUnwind_Unsafe( // // x86 ABI does not define RUNTIME_FUNCTION. Define our own to allow unification between x86 and other platforms. // +#ifdef HOST_X86 typedef struct _RUNTIME_FUNCTION { DWORD BeginAddress; DWORD UnwindData; @@ -845,7 +846,7 @@ typedef struct _RUNTIME_FUNCTION { typedef struct _DISPATCHER_CONTEXT { _EXCEPTION_REGISTRATION_RECORD* RegistrationPointer; } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT; - +#endif // HOST_X86 #endif // !TARGET_UNIX #define RUNTIME_FUNCTION__BeginAddress(prf) (prf)->BeginAddress @@ -872,6 +873,7 @@ RtlpGetFunctionEndAddress ( #define RUNTIME_FUNCTION__GetUnwindInfoAddress(prf) (prf)->UnwindData #define RUNTIME_FUNCTION__SetUnwindInfoAddress(prf, addr) do { (prf)->UnwindData = (addr); } while(0) +#ifdef HOST_X86 EXTERN_C NTSYSAPI PEXCEPTION_ROUTINE @@ -886,6 +888,7 @@ RtlVirtualUnwind ( __out PDWORD EstablisherFrame, __inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers ); +#endif // HOST_X86 #endif // FEATURE_EH_FUNCLETS #endif // TARGET_X86 @@ -933,7 +936,7 @@ typedef struct _UNWIND_INFO { // dummy } UNWIND_INFO, *PUNWIND_INFO; -#if defined(TARGET_UNIX) || defined(HOST_X86) +#if defined(HOST_UNIX) || defined(HOST_X86) EXTERN_C NTSYSAPI @@ -949,7 +952,7 @@ RtlVirtualUnwind ( __out PDWORD EstablisherFrame, __inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers ); -#endif // TARGET_UNIX || HOST_X86 +#endif // HOST_UNIX || HOST_X86 #define UNW_FLAG_NHANDLER 0x0 diff --git a/src/coreclr/src/inc/corcompile.h b/src/coreclr/src/inc/corcompile.h index 82308d7b899acc..38e837a4ad5323 100644 --- a/src/coreclr/src/inc/corcompile.h +++ b/src/coreclr/src/inc/corcompile.h @@ -59,7 +59,14 @@ typedef DPTR(RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION; // Chained unwind info. Used for cold methods. +#ifdef HOST_X86 #define RUNTIME_FUNCTION_INDIRECT 0x80000000 +#else +// If not hosted on X86, undefine RUNTIME_FUNCTION_INDIRECT as it likely isn't correct +#ifdef RUNTIME_FUNCTION_INDIRECT +#undef RUNTIME_FUNCTION_INDIRECT +#endif // RUNTIME_FUNCTION_INDIRECT +#endif // HOST_X86 #endif // TARGET_X86 diff --git a/src/coreclr/src/inc/corhlprpriv.h b/src/coreclr/src/inc/corhlprpriv.h index 056bca27f4429f..03ded5be287621 100644 --- a/src/coreclr/src/inc/corhlprpriv.h +++ b/src/coreclr/src/inc/corhlprpriv.h @@ -13,7 +13,7 @@ #include "corhlpr.h" #include "fstring.h" -#if defined(_MSC_VER) && defined(TARGET_X86) +#if defined(_MSC_VER) && defined(HOST_X86) #pragma optimize("y", on) // If routines don't get inlined, don't pay the EBP frame penalty #endif diff --git a/src/coreclr/src/inc/crosscomp.h b/src/coreclr/src/inc/crosscomp.h index 5b6e932fd24f6f..ce494af3700d16 100644 --- a/src/coreclr/src/inc/crosscomp.h +++ b/src/coreclr/src/inc/crosscomp.h @@ -43,10 +43,12 @@ #define CONTEXT_UNWOUND_TO_CALL 0x20000000 +#if !defined(HOST_ARM64) typedef struct _NEON128 { ULONGLONG Low; LONGLONG High; } NEON128, *PNEON128; +#endif // !defined(HOST_ARM64) typedef struct DECLSPEC_ALIGN(8) _T_CONTEXT { // @@ -152,13 +154,14 @@ typedef struct _T_KNONVOLATILE_CONTEXT_POINTERS { // // Define dynamic function table entry. // - +#if defined(HOST_X86) typedef PT_RUNTIME_FUNCTION (*PGET_RUNTIME_FUNCTION_CALLBACK) ( IN DWORD64 ControlPc, IN PVOID Context ); +#endif // defined(HOST_X86) typedef struct _T_DISPATCHER_CONTEXT { ULONG ControlPc; diff --git a/src/coreclr/src/inc/gcdecoder.cpp b/src/coreclr/src/inc/gcdecoder.cpp index 765cd098aedf3e..8b3d9cabc2825f 100644 --- a/src/coreclr/src/inc/gcdecoder.cpp +++ b/src/coreclr/src/inc/gcdecoder.cpp @@ -87,8 +87,10 @@ size_t FASTCALL decodeSigned(PTR_CBYTE src, int* val) /*****************************************************************************/ #if defined(_MSC_VER) +#ifdef HOST_X86 #pragma optimize("tgy", on) #endif +#endif PTR_CBYTE FASTCALL decodeHeader(PTR_CBYTE table, UINT32 version, InfoHdr* header) { diff --git a/src/coreclr/src/inc/gcdump.h b/src/coreclr/src/inc/gcdump.h index 49bc61e5bff2ff..7c7f559a5ac96b 100644 --- a/src/coreclr/src/inc/gcdump.h +++ b/src/coreclr/src/inc/gcdump.h @@ -44,10 +44,10 @@ class GCDump * Return value : Size in bytes of the header encoding */ - unsigned FASTCALL DumpInfoHdr (PTR_CBYTE gcInfoBlock, - InfoHdr * header, /* OUT */ - unsigned * methodSize, /* OUT */ - bool verifyGCTables = false); + size_t FASTCALL DumpInfoHdr (PTR_CBYTE gcInfoBlock, + InfoHdr * header, /* OUT */ + unsigned * methodSize, /* OUT */ + bool verifyGCTables = false); #endif /*------------------------------------------------------------------------- @@ -90,7 +90,7 @@ class GCDump /* Helper methods */ PTR_CBYTE DumpEncoding(PTR_CBYTE gcInfoBlock, - int cDumpBytes); + size_t cDumpBytes); void DumpOffset (unsigned o); void DumpOffsetEx(unsigned o); diff --git a/src/coreclr/src/inc/longfilepathwrappers.h b/src/coreclr/src/inc/longfilepathwrappers.h index c4c7700d704b36..76aec1a86594a0 100644 --- a/src/coreclr/src/inc/longfilepathwrappers.h +++ b/src/coreclr/src/inc/longfilepathwrappers.h @@ -49,7 +49,7 @@ FindFirstFileExWrapper( _In_ DWORD dwAdditionalFlags ); -#ifndef TARGET_UNIX +#ifndef HOST_UNIX BOOL CopyFileExWrapper( _In_ LPCWSTR lpExistingFileName, @@ -60,7 +60,7 @@ CopyFileExWrapper( _Inout_opt_ LPBOOL pbCancel, _In_ DWORD dwCopyFlags ); -#endif //TARGET_UNIX +#endif //HOST_UNIX BOOL MoveFileExWrapper( diff --git a/src/coreclr/src/inc/stacktrace.h b/src/coreclr/src/inc/stacktrace.h index 65f4d4cc481f17..445937308e19a3 100644 --- a/src/coreclr/src/inc/stacktrace.h +++ b/src/coreclr/src/inc/stacktrace.h @@ -73,7 +73,7 @@ void GetStringFromStackLevels(UINT ifrStart, UINT cfrTotal, __out_ecount(cchMaxA ******************************************************************** robch */ void GetStringFromAddr(DWORD_PTR dwAddr, __out_ecount(cchMaxAssertStackLevelStringLen) LPSTR szString); -#if defined(TARGET_X86) && !defined(TARGET_UNIX) +#if defined(HOST_X86) && !defined(TARGET_UNIX) /**************************************************************************** * ClrCaptureContext * *-------------------* @@ -82,9 +82,9 @@ void GetStringFromAddr(DWORD_PTR dwAddr, __out_ecount(cchMaxAssertStackLevelStri * support this, so we need it for CoreCLR 4, if we require Win2K support ****************************************************************************/ extern "C" void __stdcall ClrCaptureContext(__out PCONTEXT ctx); -#else // TARGET_X86 && !TARGET_UNIX +#else // HOST_X86 && !TARGET_UNIX #define ClrCaptureContext RtlCaptureContext -#endif // TARGET_X86 && !TARGET_UNIX +#endif // HOST_X86 && !TARGET_UNIX #endif diff --git a/src/coreclr/src/jit/CMakeLists.txt b/src/coreclr/src/jit/CMakeLists.txt index 3f695823be4f63..d26d81c4205470 100644 --- a/src/coreclr/src/jit/CMakeLists.txt +++ b/src/coreclr/src/jit/CMakeLists.txt @@ -10,9 +10,54 @@ endif() add_compile_options($<$:-W4>) +function(create_standalone_jit) + + set(oneValueArgs TARGET OS ARCH ADDITIONAL_DESTINATION) + set(options NOALTJIT) + cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "" ${ARGN}) + + set(JIT_ARCH_LINK_LIBRARIES gcinfo_${TARGETDETAILS_OS}_${TARGETDETAILS_ARCH}) + + if(TARGETDETAILS_ARCH STREQUAL "x64") + set(JIT_ARCH_SOURCES ${JIT_AMD64_SOURCES}) + elseif(TARGETDETAILS_ARCH STREQUAL "arm") + set(JIT_ARCH_SOURCES ${JIT_ARM_SOURCES}) + elseif(TARGETDETAILS_ARCH STREQUAL "x86") + set(JIT_ARCH_SOURCES ${JIT_I386_SOURCES}) + elseif(TARGETDETAILS_ARCH STREQUAL "arm64") + set(JIT_ARCH_SOURCES ${JIT_ARM64_SOURCES}) + else() + clr_unknown_arch() + endif() + + if (TARGETDETAILS_ADDITIONAL_DESTINATION STREQUAL "") + add_jit(${TARGETDETAILS_TARGET}) + else() + add_jit(${TARGETDETAILS_TARGET} ADDITIONAL_DESTINATION "${TARGETDETAILS_ADDITIONAL_DESTINATION}") + endif() + + set_target_definitions_to_custom_os_and_arch(${ARGN}) + set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES IGNORE_FEATURE_MERGE_JIT_AND_ENGINE TRUE) + + if (NOT TARGETDETAILS_NOALTJIT) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE ALT_JIT) + endif (NOT TARGETDETAILS_NOALTJIT) + + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_NO_HOST) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE SELF_NO_HOST) + if(FEATURE_READYTORUN) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_READYTORUN_COMPILER) + endif(FEATURE_READYTORUN) + + if ((TARGETDETAILS_ARCH STREQUAL "x64") OR (TARGETDETAILS_ARCH STREQUAL "arm64") OR ((TARGETDETAILS_ARCH STREQUAL "x86") AND NOT (TARGETDETAILS_OS STREQUAL "unix"))) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_SIMD) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_HW_INTRINSICS) + endif () +endfunction() + if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR (CLR_CMAKE_TARGET_ARCH_I386 AND NOT CLR_CMAKE_HOST_UNIX)) - add_definitions(-DFEATURE_SIMD) - add_definitions(-DFEATURE_HW_INTRINSICS) + add_compile_definitions($<$>>:FEATURE_SIMD>) + add_compile_definitions($<$>>:FEATURE_HW_INTRINSICS>) endif () # JIT_BUILD disables certain PAL_TRY debugging features @@ -368,9 +413,6 @@ endif(CLR_CMAKE_HOST_UNIX) # Shared function for generating JIT # optional arguments: ADDITIONAL_DESTINATION path function(add_jit jitName) - if(CLR_CMAKE_TARGET_WIN32) - add_definitions(-DFX_VER_INTERNALNAME_STR=${jitName}.dll) - endif(CLR_CMAKE_TARGET_WIN32) set_source_files_properties(${JIT_EXPORTS_FILE} PROPERTIES GENERATED TRUE) @@ -382,6 +424,10 @@ function(add_jit jitName) ${JIT_DLL_MAIN_FILE} ) + if(CLR_CMAKE_TARGET_WIN32) + target_compile_definitions(${jitName} PRIVATE FX_VER_INTERNALNAME_STR=${jitName}.dll) + endif(CLR_CMAKE_TARGET_WIN32) + target_precompile_header(TARGET ${jitName} HEADER jitpch.h ADDITIONAL_INCLUDE_DIRECTORIES ${JIT_SOURCE_DIR}) add_dependencies(${jitName} jit_exports) @@ -407,22 +453,37 @@ endif (FEATURE_MERGE_JIT_AND_ENGINE) # Creates a static library "clrjit_static" to link into the VM. add_subdirectory(static) -add_subdirectory(standalone) +if (CLR_CMAKE_TARGET_UNIX) +set(TARGET_OS_NAME unix) +else() +set(TARGET_OS_NAME win) +endif() + +create_standalone_jit(TARGET clrjit OS ${TARGET_OS_NAME} ARCH ${ARCH_TARGET_NAME} NOALTJIT ADDITIONAL_DESTINATION sharedFramework) + +# Enable profile guided optimization +add_pgo(clrjit) -if (CLR_CMAKE_HOST_ARCH_I386 OR CLR_CMAKE_HOST_ARCH_AMD64) - # On x86, build RyuJIT/ARM32 cross-compiling altjit. - # On amd64, build RyuJIT/ARM64 cross-compiling altjit. - add_subdirectory(protononjit) -endif () if (CLR_CMAKE_HOST_ARCH_I386) # On x86, build RyuJIT/ARM32 cross-compiling altjit for ARM_SOFTFP (armel). - add_subdirectory(armelnonjit) + create_standalone_jit(TARGET clrjit_unix_armel_${ARCH_HOST_NAME} OS unix ARCH arm) + target_compile_definitions(clrjit_unix_armel_${ARCH_HOST_NAME} PRIVATE ARM_SOFTFP) endif () -if ((CLR_CMAKE_HOST_ARCH_I386 OR CLR_CMAKE_HOST_ARCH_AMD64) AND CLR_CMAKE_TARGET_WIN32) - # On Windows, build altjit that targets the Linux ABI: - # On x86, build Linux/x86 altjit. This enables UNIX_X86_ABI. - # On amd64, build Linux/AMD64 altjit. This enables UNIX_AMD64_ABI. - add_subdirectory(linuxnonjit) -endif () +if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) + if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) + create_standalone_jit(TARGET clrjit_unix_arm64_${ARCH_HOST_NAME} OS unix ARCH arm64) + create_standalone_jit(TARGET clrjit_unix_x64_${ARCH_HOST_NAME} OS unix ARCH x64) + create_standalone_jit(TARGET clrjit_win_arm64_${ARCH_HOST_NAME} OS win ARCH arm64) + create_standalone_jit(TARGET clrjit_win_x64_${ARCH_HOST_NAME} OS win ARCH x64) + endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) + + create_standalone_jit(TARGET clrjit_unix_arm_${ARCH_HOST_NAME} OS unix ARCH arm) + create_standalone_jit(TARGET clrjit_win_arm_${ARCH_HOST_NAME} OS win ARCH arm) + create_standalone_jit(TARGET clrjit_win_x86_${ARCH_HOST_NAME} OS win ARCH x86) +else() + if (CLR_CMAKE_TARGET_UNIX) + create_standalone_jit(TARGET clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} OS unix ARCH ${ARCH_TARGET_NAME}) + endif(CLR_CMAKE_TARGET_UNIX) +endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) \ No newline at end of file diff --git a/src/coreclr/src/jit/armelnonjit/CMakeLists.txt b/src/coreclr/src/jit/armelnonjit/CMakeLists.txt deleted file mode 100644 index 9a9995a7af7240..00000000000000 --- a/src/coreclr/src/jit/armelnonjit/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -project(armelnonjit) - -add_definitions(-DALT_JIT) -add_definitions(-DFEATURE_NO_HOST) -add_definitions(-DSELF_NO_HOST) -remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) - -remove_definitions(-DFEATURE_SIMD) -remove_definitions(-DFEATURE_HW_INTRINSICS) - -if(FEATURE_READYTORUN) - add_definitions(-DFEATURE_READYTORUN_COMPILER) -endif(FEATURE_READYTORUN) - -if (CLR_CMAKE_HOST_ARCH_I386) - remove_definitions(-DTARGET_X86) - add_definitions(-DTARGET_ARM) - add_definitions(-DARM_SOFTFP) - add_definitions(-DFEATURE_EH_FUNCLETS) - set(JIT_ARCH_SOURCES ${JIT_ARM_SOURCES}) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm) -elseif(CLR_CMAKE_HOST_ARCH_AMD64) - remove_definitions(-DTARGET_AMD64) - add_definitions(-DTARGET_ARM64) - set(JIT_ARCH_SOURCES ${JIT_ARM64_SOURCES}) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm64) -else() - clr_unknown_arch() -endif() - -if (NOT CLR_CMAKE_HOST_WIN32) - if (CLR_CMAKE_HOST_ARCH_I386) - remove_definitions(-DUNIX_X86_ABI) - elseif(CLR_CMAKE_HOST_ARCH_AMD64) - remove_definitions(-DUNIX_AMD64_ABI) - else() - clr_unknown_arch() - endif() -endif(NOT CLR_CMAKE_HOST_WIN32) - -add_jit(armelnonjit) diff --git a/src/coreclr/src/jit/armelnonjit/SOURCES b/src/coreclr/src/jit/armelnonjit/SOURCES deleted file mode 100644 index 0949770918033e..00000000000000 --- a/src/coreclr/src/jit/armelnonjit/SOURCES +++ /dev/null @@ -1,9 +0,0 @@ - -# -# DO NOT EDIT THIS FILE!!! Modify the project file in this directory -# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe -# -TARGETTYPE=NOTARGET -CLR_TARGETTYPE=DLL -MSBuildProjectFile=armelnonjit.nativeproj -SOURCES= diff --git a/src/coreclr/src/jit/armelnonjit/armelnonjit.def b/src/coreclr/src/jit/armelnonjit/armelnonjit.def deleted file mode 100644 index 0afb54dca77de3..00000000000000 --- a/src/coreclr/src/jit/armelnonjit/armelnonjit.def +++ /dev/null @@ -1,5 +0,0 @@ -; Licensed to the .NET Foundation under one or more agreements. -; The .NET Foundation licenses this file to you under the MIT license. -EXPORTS - getJit - jitStartup diff --git a/src/coreclr/src/jit/armelnonjit/makefile b/src/coreclr/src/jit/armelnonjit/makefile deleted file mode 100644 index bf27e8c84b0522..00000000000000 --- a/src/coreclr/src/jit/armelnonjit/makefile +++ /dev/null @@ -1,7 +0,0 @@ - -# -# DO NOT EDIT THIS FILE!!! Modify the project file in this directory -# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe -# - -!INCLUDE $(NTMAKEENV)\devdiv.def diff --git a/src/coreclr/src/jit/codegenarm.cpp b/src/coreclr/src/jit/codegenarm.cpp index 2eaa80862396dd..ccfda4a5c29af7 100644 --- a/src/coreclr/src/jit/codegenarm.cpp +++ b/src/coreclr/src/jit/codegenarm.cpp @@ -61,7 +61,7 @@ bool CodeGen::genInstrWithConstant( { case INS_add: case INS_sub: - immFitsInIns = validImmForInstr(ins, imm, flags); + immFitsInIns = validImmForInstr(ins, (target_ssize_t)imm, flags); break; default: @@ -72,7 +72,7 @@ bool CodeGen::genInstrWithConstant( if (immFitsInIns) { // generate a single instruction that encodes the immediate directly - GetEmitter()->emitIns_R_R_I(ins, attr, reg1, reg2, imm); + GetEmitter()->emitIns_R_R_I(ins, attr, reg1, reg2, (target_ssize_t)imm); } else { diff --git a/src/coreclr/src/jit/codegenarmarch.cpp b/src/coreclr/src/jit/codegenarmarch.cpp index c1dcc7319afca8..ef884c5e930f47 100644 --- a/src/coreclr/src/jit/codegenarmarch.cpp +++ b/src/coreclr/src/jit/codegenarmarch.cpp @@ -39,7 +39,7 @@ void CodeGen::genStackPointerConstantAdjustment(ssize_t spDelta) // function that does a probe, which will in turn call this function. assert((target_size_t)(-spDelta) <= compiler->eeGetPageSize()); - inst_RV_IV(INS_sub, REG_SPBASE, -spDelta, EA_PTRSIZE); + inst_RV_IV(INS_sub, REG_SPBASE, (target_ssize_t)-spDelta, EA_PTRSIZE); } //------------------------------------------------------------------------ diff --git a/src/coreclr/src/jit/codegenxarch.cpp b/src/coreclr/src/jit/codegenxarch.cpp index 88c021ac73d016..780e9bb1a633c4 100644 --- a/src/coreclr/src/jit/codegenxarch.cpp +++ b/src/coreclr/src/jit/codegenxarch.cpp @@ -1769,7 +1769,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode) // Have to clear the ShadowSP of the nesting level which encloses the finally. Generates: // mov dword ptr [ebp-0xC], 0 // for some slot of the ShadowSP local var - unsigned finallyNesting; + size_t finallyNesting; finallyNesting = treeNode->AsVal()->gtVal1; noway_assert(treeNode->AsVal()->gtVal1 < compiler->compHndBBtabCount); noway_assert(finallyNesting < compiler->compHndBBtabCount); @@ -1781,9 +1781,10 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode) filterEndOffsetSlotOffs = (unsigned)(compiler->lvaLclSize(compiler->lvaShadowSPslotsVar) - TARGET_POINTER_SIZE); - unsigned curNestingSlotOffs; + size_t curNestingSlotOffs; curNestingSlotOffs = filterEndOffsetSlotOffs - ((finallyNesting + 1) * TARGET_POINTER_SIZE); - GetEmitter()->emitIns_S_I(INS_mov, EA_PTRSIZE, compiler->lvaShadowSPslotsVar, curNestingSlotOffs, 0); + GetEmitter()->emitIns_S_I(INS_mov, EA_PTRSIZE, compiler->lvaShadowSPslotsVar, (unsigned)curNestingSlotOffs, + 0); break; #endif // !FEATURE_EH_FUNCLETS @@ -2106,13 +2107,13 @@ void CodeGen::genStackPointerConstantAdjustment(ssize_t spDelta, regNumber regTm // creating a way to temporarily turn off the emitter's tracking of ESP, maybe marking instrDescs as "don't // track". inst_RV_RV(INS_mov, regTmp, REG_SPBASE, TYP_I_IMPL); - inst_RV_IV(INS_sub, regTmp, -spDelta, EA_PTRSIZE); + inst_RV_IV(INS_sub, regTmp, (target_ssize_t)-spDelta, EA_PTRSIZE); inst_RV_RV(INS_mov, REG_SPBASE, regTmp, TYP_I_IMPL); } else #endif // TARGET_X86 { - inst_RV_IV(INS_sub, REG_SPBASE, -spDelta, EA_PTRSIZE); + inst_RV_IV(INS_sub, REG_SPBASE, (target_ssize_t)-spDelta, EA_PTRSIZE); } } @@ -4156,7 +4157,7 @@ void CodeGen::genCodeForShiftLong(GenTree* tree) assert(shiftBy->isContainedIntOrIImmed()); - unsigned int count = shiftBy->AsIntConCommon()->IconValue(); + unsigned int count = (unsigned int)shiftBy->AsIntConCommon()->IconValue(); regNumber regResult = (oper == GT_LSH_HI) ? regHi : regLo; @@ -5014,7 +5015,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call) #if defined(TARGET_X86) || defined(UNIX_AMD64_ABI) // The call will pop its arguments. // for each putarg_stk: - ssize_t stackArgBytes = 0; + target_ssize_t stackArgBytes = 0; for (GenTreeCall::Use& use : call->Args()) { GenTree* arg = use.GetNode(); @@ -5160,7 +5161,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call) // adjust its stack level accordingly. // If the caller needs to explicitly pop its arguments, we must pass a negative value, and then do the // pop when we're done. - ssize_t argSizeForEmitter = stackArgBytes; + target_ssize_t argSizeForEmitter = stackArgBytes; if (fCallerPop) { argSizeForEmitter = -stackArgBytes; @@ -7518,11 +7519,11 @@ void CodeGen::genPutArgStkFieldList(GenTreePutArgStk* putArgStk) case GT_CNS_INT: if (fieldNode->IsIconHandle()) { - inst_IV_handle(INS_push, fieldNode->AsIntCon()->gtIconVal); + inst_IV_handle(INS_push, (target_ssize_t)fieldNode->AsIntCon()->gtIconVal); } else { - inst_IV(INS_push, fieldNode->AsIntCon()->gtIconVal); + inst_IV(INS_push, (target_ssize_t)fieldNode->AsIntCon()->gtIconVal); } break; default: @@ -7617,11 +7618,11 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* putArgStk) { if (data->IsIconHandle()) { - inst_IV_handle(INS_push, data->AsIntCon()->gtIconVal); + inst_IV_handle(INS_push, (target_ssize_t)data->AsIntCon()->gtIconVal); } else { - inst_IV(INS_push, data->AsIntCon()->gtIconVal); + inst_IV(INS_push, (target_ssize_t)data->AsIntCon()->gtIconVal); } AddStackLevel(argSize); } @@ -8120,13 +8121,13 @@ void* CodeGen::genCreateAndStoreGCInfoJIT32(unsigned codeSize, if (0) { - BYTE* temp = (BYTE*)infoPtr; - unsigned size = compiler->compInfoBlkAddr - temp; - BYTE* ptab = temp + headerSize; + BYTE* temp = (BYTE*)infoPtr; + size_t size = compiler->compInfoBlkAddr - temp; + BYTE* ptab = temp + headerSize; noway_assert(size == headerSize + ptrMapSize); - printf("Method info block - header [%u bytes]:", headerSize); + printf("Method info block - header [%zu bytes]:", headerSize); for (unsigned i = 0; i < size; i++) { @@ -8154,7 +8155,7 @@ void* CodeGen::genCreateAndStoreGCInfoJIT32(unsigned codeSize, if (compiler->opts.dspGCtbls) { const BYTE* base = (BYTE*)infoPtr; - unsigned size; + size_t size; unsigned methodSize; InfoHdr dumpHeader; @@ -8492,11 +8493,12 @@ void CodeGen::genProfilingEnterCallback(regNumber initReg, bool* pInitRegZeroed) // Push the profilerHandle if (compiler->compProfilerMethHndIndirected) { - GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, (ssize_t)compiler->compProfilerMethHnd); + GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, + (target_ssize_t)(size_t)compiler->compProfilerMethHnd); } else { - inst_IV(INS_push, (size_t)compiler->compProfilerMethHnd); + inst_IV(INS_push, (target_ssize_t)(size_t)compiler->compProfilerMethHnd); } // @@ -8577,11 +8579,12 @@ void CodeGen::genProfilingLeaveCallback(unsigned helper) if (compiler->compProfilerMethHndIndirected) { - GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, (ssize_t)compiler->compProfilerMethHnd); + GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, + (target_ssize_t)(ssize_t)compiler->compProfilerMethHnd); } else { - inst_IV(INS_push, (size_t)compiler->compProfilerMethHnd); + inst_IV(INS_push, (target_size_t)(size_t)compiler->compProfilerMethHnd); } genSinglePush(); diff --git a/src/coreclr/src/jit/compiler.cpp b/src/coreclr/src/jit/compiler.cpp index 214fc3a9d5f20a..4211aace8c727b 100644 --- a/src/coreclr/src/jit/compiler.cpp +++ b/src/coreclr/src/jit/compiler.cpp @@ -5304,9 +5304,9 @@ int Compiler::compCompile(CORINFO_MODULE_HANDLE classPtr, compJitFuncInfoFile = _wfopen(compJitFuncInfoFilename, W("a")); if (compJitFuncInfoFile == nullptr) { -#if defined(DEBUG) && !defined(TARGET_UNIX) // no 'perror' in the PAL +#if defined(DEBUG) && !defined(HOST_UNIX) // no 'perror' in the PAL perror("Failed to open JitFuncInfoLogFile"); -#endif // defined(DEBUG) && !defined(TARGET_UNIX) +#endif // defined(DEBUG) && !defined(HOST_UNIX) } } } diff --git a/src/coreclr/src/jit/ee_il_dll.cpp b/src/coreclr/src/jit/ee_il_dll.cpp index bfd80ffb120005..9926c99881713f 100644 --- a/src/coreclr/src/jit/ee_il_dll.cpp +++ b/src/coreclr/src/jit/ee_il_dll.cpp @@ -1317,7 +1317,7 @@ const char* Compiler::eeGetClassName(CORINFO_CLASS_HANDLE clsHnd) const WCHAR* Compiler::eeGetCPString(size_t strHandle) { -#ifdef TARGET_UNIX +#ifdef HOST_UNIX return nullptr; #else char buff[512 + sizeof(CORINFO_String)]; @@ -1341,7 +1341,7 @@ const WCHAR* Compiler::eeGetCPString(size_t strHandle) } return (asString->chars); -#endif // TARGET_UNIX +#endif // HOST_UNIX } #endif // DEBUG diff --git a/src/coreclr/src/jit/emit.cpp b/src/coreclr/src/jit/emit.cpp index 7a957b17f91ed5..8be54f1507b038 100644 --- a/src/coreclr/src/jit/emit.cpp +++ b/src/coreclr/src/jit/emit.cpp @@ -5648,7 +5648,7 @@ void emitter::emitOutputDataSec(dataSecDsc* sec, BYTE* dst) #ifdef TARGET_ARM target = (BYTE*)((size_t)target | 1); // Or in thumb bit #endif - bDst[i] = (target_size_t)target; + bDst[i] = (target_size_t)(size_t)target; if (emitComp->opts.compReloc) { emitRecordRelocation(&(bDst[i]), target, IMAGE_REL_BASED_HIGHLOW); @@ -5779,7 +5779,7 @@ void emitter::emitDispDataSec(dataSecDsc* section) } else { - printf("dd\t%08Xh", reinterpret_cast(emitOffsetToPtr(ig->igOffs))); + printf("dd\t%08Xh", (uint32_t)(size_t)emitOffsetToPtr(ig->igOffs)); } #else // TARGET_64BIT // We have a 64-BIT target @@ -6422,7 +6422,11 @@ unsigned char emitter::emitOutputLong(BYTE* dst, ssize_t val) unsigned char emitter::emitOutputSizeT(BYTE* dst, ssize_t val) { +#if !TARGET_64BIT + MISALIGNED_WR_I4(dst, (int)val); +#else MISALIGNED_WR_ST(dst, val); +#endif #ifdef DEBUG if (emitComp->opts.dspEmit) @@ -6450,6 +6454,7 @@ unsigned char emitter::emitOutputSizeT(BYTE* dst, ssize_t val) // Same as wrapped function. // +#if !defined(HOST_64BIT) #if defined(TARGET_X86) unsigned char emitter::emitOutputByte(BYTE* dst, size_t val) { @@ -6491,6 +6496,7 @@ unsigned char emitter::emitOutputSizeT(BYTE* dst, unsigned __int64 val) return emitOutputSizeT(dst, (ssize_t)val); } #endif // defined(TARGET_X86) +#endif // !defined(HOST_64BIT) /***************************************************************************** * diff --git a/src/coreclr/src/jit/emit.h b/src/coreclr/src/jit/emit.h index e9b428928299a4..2a1473362799cc 100644 --- a/src/coreclr/src/jit/emit.h +++ b/src/coreclr/src/jit/emit.h @@ -1645,6 +1645,7 @@ class emitter unsigned char emitOutputLong(BYTE* dst, ssize_t val); unsigned char emitOutputSizeT(BYTE* dst, ssize_t val); +#if !defined(HOST_64BIT) #if defined(TARGET_X86) unsigned char emitOutputByte(BYTE* dst, size_t val); unsigned char emitOutputWord(BYTE* dst, size_t val); @@ -1656,6 +1657,7 @@ class emitter unsigned char emitOutputLong(BYTE* dst, unsigned __int64 val); unsigned char emitOutputSizeT(BYTE* dst, unsigned __int64 val); #endif // defined(TARGET_X86) +#endif // !defined(HOST_64BIT) size_t emitIssue1Instr(insGroup* ig, instrDesc* id, BYTE** dp); size_t emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp); diff --git a/src/coreclr/src/jit/emitarm.cpp b/src/coreclr/src/jit/emitarm.cpp index cee6fde0729392..3d3168b0c51f2d 100644 --- a/src/coreclr/src/jit/emitarm.cpp +++ b/src/coreclr/src/jit/emitarm.cpp @@ -6111,7 +6111,7 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp) if (!id->idIsReloc()) { assert(sizeof(size_t) == sizeof(target_size_t)); - imm = (target_size_t)addr; + imm = (target_size_t)(size_t)addr; if (ins == INS_movw) { imm &= 0xffff; diff --git a/src/coreclr/src/jit/emitxarch.cpp b/src/coreclr/src/jit/emitxarch.cpp index f21b1170eb83cc..7593b9f6255c60 100644 --- a/src/coreclr/src/jit/emitxarch.cpp +++ b/src/coreclr/src/jit/emitxarch.cpp @@ -3924,7 +3924,7 @@ void emitter::emitIns_R_I(instruction ins, emitAttr attr, regNumber reg, ssize_t sz += emitGetRexPrefixSize(ins); } - id = emitNewInstrSC(attr, val); + id = emitNewInstrSC(attr, (target_ssize_t)val); id->idIns(ins); id->idInsFmt(fmt); id->idReg1(reg); @@ -8263,11 +8263,11 @@ void emitter::emitDispIns( { printf(" %-9s", sstr); } -#ifndef TARGET_UNIX +#ifndef HOST_UNIX if (strnlen_s(sstr, 10) >= 8) -#else // TARGET_UNIX +#else // HOST_UNIX if (strnlen(sstr, 10) >= 8) -#endif // TARGET_UNIX +#endif // HOST_UNIX { printf(" "); } @@ -10928,7 +10928,7 @@ BYTE* emitter::emitOutputCV(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc) noway_assert(id->idIsDspReloc()); dst += emitOutputLong(dst, 0); #else // TARGET_X86 - dst += emitOutputLong(dst, (int)target); + dst += emitOutputLong(dst, (int)(ssize_t)target); #endif // TARGET_X86 if (id->idIsDspReloc()) @@ -12720,7 +12720,7 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp) #ifdef TARGET_AMD64 dst += emitOutputLong(dst, 0); #else - dst += emitOutputLong(dst, (int)addr); + dst += emitOutputLong(dst, (int)(ssize_t)addr); #endif emitRecordRelocation((void*)(dst - sizeof(int)), addr, IMAGE_REL_BASED_DISP32); } diff --git a/src/coreclr/src/jit/flowgraph.cpp b/src/coreclr/src/jit/flowgraph.cpp index 48f3273e38eaaa..c1b6f84c32cb16 100644 --- a/src/coreclr/src/jit/flowgraph.cpp +++ b/src/coreclr/src/jit/flowgraph.cpp @@ -24881,7 +24881,7 @@ PhaseStatus Compiler::fgRemoveEmptyTry() GenTree* expr = stmt->GetRootNode(); if (expr->gtOper == GT_END_LFIN) { - const unsigned nestLevel = expr->AsVal()->gtVal1; + const size_t nestLevel = expr->AsVal()->gtVal1; assert(nestLevel > 0); expr->AsVal()->gtVal1 = nestLevel - 1; } diff --git a/src/coreclr/src/jit/gcencode.cpp b/src/coreclr/src/jit/gcencode.cpp index 81edb0b0d29e13..6cbe702524282d 100644 --- a/src/coreclr/src/jit/gcencode.cpp +++ b/src/coreclr/src/jit/gcencode.cpp @@ -3588,7 +3588,7 @@ const bool verifyGCTables = false; * Dump the info block header. */ -unsigned GCInfo::gcInfoBlockHdrDump(const BYTE* table, InfoHdr* header, unsigned* methodSize) +size_t GCInfo::gcInfoBlockHdrDump(const BYTE* table, InfoHdr* header, unsigned* methodSize) { GCDump gcDump(GCINFO_VERSION); @@ -3600,7 +3600,7 @@ unsigned GCInfo::gcInfoBlockHdrDump(const BYTE* table, InfoHdr* header, unsigned /*****************************************************************************/ -unsigned GCInfo::gcDumpPtrTable(const BYTE* table, const InfoHdr& header, unsigned methodSize) +size_t GCInfo::gcDumpPtrTable(const BYTE* table, const InfoHdr& header, unsigned methodSize) { printf("Pointer table:\n"); diff --git a/src/coreclr/src/jit/gentree.cpp b/src/coreclr/src/jit/gentree.cpp index 3c1c1446e9280a..7c868109febe26 100644 --- a/src/coreclr/src/jit/gentree.cpp +++ b/src/coreclr/src/jit/gentree.cpp @@ -3302,7 +3302,7 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree) // Any constant that requires a reloc must use the movw/movt sequence // GenTreeIntConCommon* con = tree->AsIntConCommon(); - INT32 conVal = con->IconValue(); + target_ssize_t conVal = (target_ssize_t)con->IconValue(); if (con->ImmedValNeedsReloc(this)) { @@ -18464,7 +18464,7 @@ void GenTree::ParseArrayAddressWork(Compiler* comp, assert(!AsOp()->gtOp2->AsIntCon()->ImmedValNeedsReloc(comp)); // TODO-CrossBitness: we wouldn't need the cast below if GenTreeIntCon::gtIconVal had target_ssize_t // type. - target_ssize_t shiftVal = AsOp()->gtOp2->AsIntConCommon()->IconValue(); + target_ssize_t shiftVal = (target_ssize_t)AsOp()->gtOp2->AsIntConCommon()->IconValue(); target_ssize_t subMul = target_ssize_t{1} << shiftVal; AsOp()->gtOp1->ParseArrayAddressWork(comp, inputMul * subMul, pArr, pInxVN, pOffset, pFldSeq); return; diff --git a/src/coreclr/src/jit/instr.cpp b/src/coreclr/src/jit/instr.cpp index d6f4c98f6b9470..5c059f399806b1 100644 --- a/src/coreclr/src/jit/instr.cpp +++ b/src/coreclr/src/jit/instr.cpp @@ -631,9 +631,9 @@ void CodeGen::inst_TT(instruction ins, GenTree* tree, unsigned offs, int shfv, e assert(offs == 0); assert(!shfv); if (tree->IsIconHandle()) - inst_IV_handle(ins, tree->AsIntCon()->gtIconVal); + inst_IV_handle(ins, (target_ssize_t)tree->AsIntCon()->gtIconVal); else - inst_IV(ins, tree->AsIntCon()->gtIconVal); + inst_IV(ins, (target_ssize_t)tree->AsIntCon()->gtIconVal); break; #endif diff --git a/src/coreclr/src/jit/jitgcinfo.h b/src/coreclr/src/jit/jitgcinfo.h index e9ef97c2a17edd..83393bda9bbebb 100644 --- a/src/coreclr/src/jit/jitgcinfo.h +++ b/src/coreclr/src/jit/jitgcinfo.h @@ -377,11 +377,11 @@ class GCInfo void gcFindPtrsInFrame(const void* infoBlock, const void* codeBlock, unsigned offs); #ifdef JIT32_GCENCODER - unsigned gcInfoBlockHdrDump(const BYTE* table, - InfoHdr* header, /* OUT */ - unsigned* methodSize); /* OUT */ + size_t gcInfoBlockHdrDump(const BYTE* table, + InfoHdr* header, /* OUT */ + unsigned* methodSize); /* OUT */ - unsigned gcDumpPtrTable(const BYTE* table, const InfoHdr& header, unsigned methodSize); + size_t gcDumpPtrTable(const BYTE* table, const InfoHdr& header, unsigned methodSize); #endif // JIT32_GCENCODER #endif // DUMP_GC_TABLES diff --git a/src/coreclr/src/jit/linuxnonjit/CMakeLists.txt b/src/coreclr/src/jit/linuxnonjit/CMakeLists.txt deleted file mode 100644 index 951b757a6a7076..00000000000000 --- a/src/coreclr/src/jit/linuxnonjit/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -project(linuxnonjit) - -add_definitions(-DALT_JIT) -add_definitions(-DFEATURE_NO_HOST) -add_definitions(-DSELF_NO_HOST) -remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) - -if(FEATURE_READYTORUN) - add_definitions(-DFEATURE_READYTORUN_COMPILER) -endif(FEATURE_READYTORUN) - -if (CLR_CMAKE_HOST_ARCH_I386) - remove_definitions(-DFEATURE_SIMD) - remove_definitions(-DFEATURE_HW_INTRINSICS) - add_definitions(-DUNIX_X86_ABI) - set(JIT_ARCH_SOURCES ${JIT_I386_SOURCES}) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_linuxx86) -elseif(CLR_CMAKE_HOST_ARCH_AMD64) - add_definitions(-DUNIX_AMD64_ABI) - set(JIT_ARCH_SOURCES ${JIT_AMD64_SOURCES}) - set(JIT_ARCH_LINK_LIBRARIES gcinfo) -else() - clr_unknown_arch() -endif() - -add_jit(linuxnonjit) diff --git a/src/coreclr/src/jit/protojit/CMakeLists.txt b/src/coreclr/src/jit/protojit/CMakeLists.txt deleted file mode 100644 index 981583be888a9c..00000000000000 --- a/src/coreclr/src/jit/protojit/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -project(protojit) - -add_definitions(-DALT_JIT) -add_definitions(-DFEATURE_NO_HOST) -add_definitions(-DSELF_NO_HOST) -remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) - -if(FEATURE_READYTORUN) - add_definitions(-DFEATURE_READYTORUN_COMPILER) -endif(FEATURE_READYTORUN) - -add_jit(protojit) diff --git a/src/coreclr/src/jit/protojit/SOURCES b/src/coreclr/src/jit/protojit/SOURCES deleted file mode 100644 index 42c58f760f0f50..00000000000000 --- a/src/coreclr/src/jit/protojit/SOURCES +++ /dev/null @@ -1,10 +0,0 @@ - -# -# DO NOT EDIT THIS FILE!!! Modify the project file in this directory -# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe -# -TARGETTYPE=NOTARGET -CLR_TARGETTYPE=DLL -MSBuildProjectFile=protojit.nativeproj -SOURCES= - diff --git a/src/coreclr/src/jit/protojit/makefile b/src/coreclr/src/jit/protojit/makefile deleted file mode 100644 index 04c839a2a6684b..00000000000000 --- a/src/coreclr/src/jit/protojit/makefile +++ /dev/null @@ -1,6 +0,0 @@ - -# -# DO NOT EDIT THIS FILE!!! Modify the project file in this directory -# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe -# -!INCLUDE $(NTMAKEENV)\msbuild.def diff --git a/src/coreclr/src/jit/protojit/protojit.def b/src/coreclr/src/jit/protojit/protojit.def deleted file mode 100644 index 0afb54dca77de3..00000000000000 --- a/src/coreclr/src/jit/protojit/protojit.def +++ /dev/null @@ -1,5 +0,0 @@ -; Licensed to the .NET Foundation under one or more agreements. -; The .NET Foundation licenses this file to you under the MIT license. -EXPORTS - getJit - jitStartup diff --git a/src/coreclr/src/jit/protononjit/CMakeLists.txt b/src/coreclr/src/jit/protononjit/CMakeLists.txt deleted file mode 100644 index 45c9a5999b70ad..00000000000000 --- a/src/coreclr/src/jit/protononjit/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -project(protononjit) - -add_definitions(-DALT_JIT) -add_definitions(-DFEATURE_NO_HOST) -add_definitions(-DSELF_NO_HOST) -remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) - -if(FEATURE_READYTORUN) - add_definitions(-DFEATURE_READYTORUN_COMPILER) -endif(FEATURE_READYTORUN) - -if (CLR_CMAKE_HOST_ARCH_I386) - remove_definitions(-DTARGET_X86) - remove_definitions(-DFEATURE_SIMD) - remove_definitions(-DFEATURE_HW_INTRINSICS) - add_definitions(-DTARGET_ARM) - add_definitions(-DFEATURE_EH_FUNCLETS) - set(JIT_ARCH_SOURCES ${JIT_ARM_SOURCES}) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm) -elseif(CLR_CMAKE_HOST_ARCH_AMD64) - remove_definitions(-DTARGET_AMD64) - add_definitions(-DTARGET_ARM64) - set(JIT_ARCH_SOURCES ${JIT_ARM64_SOURCES}) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm64) -else() - clr_unknown_arch() -endif() - -if (NOT CLR_CMAKE_HOST_WIN32) - if (CLR_CMAKE_HOST_ARCH_I386) - remove_definitions(-DUNIX_X86_ABI) - elseif(CLR_CMAKE_HOST_ARCH_AMD64) - remove_definitions(-DUNIX_AMD64_ABI) - else() - clr_unknown_arch() - endif() -endif(NOT CLR_CMAKE_HOST_WIN32) - -add_jit(protononjit) diff --git a/src/coreclr/src/jit/protononjit/SOURCES b/src/coreclr/src/jit/protononjit/SOURCES deleted file mode 100644 index 79189a609762b5..00000000000000 --- a/src/coreclr/src/jit/protononjit/SOURCES +++ /dev/null @@ -1,9 +0,0 @@ - -# -# DO NOT EDIT THIS FILE!!! Modify the project file in this directory -# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe -# -TARGETTYPE=NOTARGET -CLR_TARGETTYPE=DLL -MSBuildProjectFile=protononjit.nativeproj -SOURCES= diff --git a/src/coreclr/src/jit/protononjit/makefile b/src/coreclr/src/jit/protononjit/makefile deleted file mode 100644 index bf27e8c84b0522..00000000000000 --- a/src/coreclr/src/jit/protononjit/makefile +++ /dev/null @@ -1,7 +0,0 @@ - -# -# DO NOT EDIT THIS FILE!!! Modify the project file in this directory -# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe -# - -!INCLUDE $(NTMAKEENV)\devdiv.def diff --git a/src/coreclr/src/jit/protononjit/protononjit.def b/src/coreclr/src/jit/protononjit/protononjit.def deleted file mode 100644 index 0afb54dca77de3..00000000000000 --- a/src/coreclr/src/jit/protononjit/protononjit.def +++ /dev/null @@ -1,5 +0,0 @@ -; Licensed to the .NET Foundation under one or more agreements. -; The .NET Foundation licenses this file to you under the MIT license. -EXPORTS - getJit - jitStartup diff --git a/src/coreclr/src/jit/standalone/CMakeLists.txt b/src/coreclr/src/jit/standalone/CMakeLists.txt deleted file mode 100644 index c37ed9c31b5517..00000000000000 --- a/src/coreclr/src/jit/standalone/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -project(ryujit) - -add_definitions(-DFEATURE_NO_HOST) -add_definitions(-DSELF_NO_HOST) -remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) - -if(FEATURE_READYTORUN) - add_definitions(-DFEATURE_READYTORUN_COMPILER) -endif(FEATURE_READYTORUN) - -add_jit(clrjit ADDITIONAL_DESTINATION sharedFramework) - -# Enable profile guided optimization -add_pgo(clrjit) diff --git a/src/coreclr/src/jit/valuenum.cpp b/src/coreclr/src/jit/valuenum.cpp index fc93bebe885faf..bf0dffa2bc786b 100644 --- a/src/coreclr/src/jit/valuenum.cpp +++ b/src/coreclr/src/jit/valuenum.cpp @@ -6435,7 +6435,7 @@ void Compiler::fgValueNumberTreeConst(GenTree* tree) tree->gtVNPair.SetBoth(vnStore->VNForLongCon(tree->AsIntConCommon()->LngValue())); #else // 32BIT assert(tree->AsIntConCommon()->IconValue() == 0); - tree->gtVNPair.SetBoth(vnStore->VNForIntCon(tree->AsIntConCommon()->IconValue())); + tree->gtVNPair.SetBoth(vnStore->VNForIntCon(int(tree->AsIntConCommon()->IconValue()))); #endif break; #endif // FEATURE_SIMD diff --git a/src/coreclr/src/tools/Common/JitInterface/JitConfigProvider.cs b/src/coreclr/src/tools/Common/JitInterface/JitConfigProvider.cs index 1635c5ab3fd1b1..4d36e34dc20554 100644 --- a/src/coreclr/src/tools/Common/JitInterface/JitConfigProvider.cs +++ b/src/coreclr/src/tools/Common/JitInterface/JitConfigProvider.cs @@ -54,7 +54,7 @@ public static void Initialize( } else { - libHandle = NativeLibrary.Load("clrjit-" + GetTargetSpec(target), assembly, searchPath); + libHandle = NativeLibrary.Load("clrjit_" + GetTargetSpec(target), assembly, searchPath); } } return libHandle; @@ -141,7 +141,8 @@ private static string GetTargetSpec(TargetDetails target) TargetArchitecture.ARM64 => "arm64", _ => throw new NotImplementedException(target.Architecture.ToString()) }; - return targetOSComponent + '-' + targetArchComponent; + + return targetOSComponent + '_' + targetArchComponent + "_" + RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); } #region Unmanaged instance diff --git a/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs b/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs index 61b92c8b8b9e23..bf7f96dcf2c0f2 100644 --- a/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs +++ b/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs @@ -73,6 +73,9 @@ public override CompilationBuilder UseBackendOptions(IEnumerable options builder.Add(new KeyValuePair(name, value)); } + // As we always use an AltJit to compile, tell the jit to always generate code + builder.Add(new KeyValuePair("AltJitNgen", "*")); + _ryujitOptions = builder.ToArray(); return this; diff --git a/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj b/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj index 2de5f56821453f..68836587532ec1 100644 --- a/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj +++ b/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj @@ -5,7 +5,7 @@ Exe $(NetCoreAppCurrent) 8002,NU1701 - x64;x86 + x64;x86;arm64;arm AnyCPU false true @@ -43,10 +43,12 @@ x64 + x64 + x64 unix win - $(TargetOSComponent)-$(TargetArchitecture) + $(TargetOSComponent)_$(TargetArchitecture)_$(BuildArchitecture) lib @@ -64,10 +66,20 @@ Link="%(FileName)%(Extension)" /> + + + + + @@ -75,11 +87,12 @@ $(BinDir)\$(CrossHostArch)\crossgen2 + $(TargetOSComponent)_$(TargetArchitecture)_$(CrossHostArch) + Exclude="$(BinDir)\crossgen2\$(JitInterfaceLibraryName);$(BinDir)\crossgen2\$(LibraryNamePrefix)clrjit_*$(LibraryNameExtension)" /> @@ -91,8 +104,15 @@ /> + diff --git a/src/coreclr/src/utilcode/stacktrace.cpp b/src/coreclr/src/utilcode/stacktrace.cpp index 57b4ee5f282830..9cab6ee2d1f088 100644 --- a/src/coreclr/src/utilcode/stacktrace.cpp +++ b/src/coreclr/src/utilcode/stacktrace.cpp @@ -740,7 +740,7 @@ CONTEXT * pContext // Context to use (or NULL to use current) stkfrm.AddrFrame.Offset = context.Ebp; // Frame Pointer #endif -#ifndef TARGET_X86 +#ifndef HOST_X86 // If we don't have a user-supplied context, then don't skip any frames. // So ignore this function (GetStackBackTrace) // ClrCaptureContext on x86 gives us the ESP/EBP/EIP of its caller's caller @@ -749,7 +749,7 @@ CONTEXT * pContext // Context to use (or NULL to use current) { ifrStart += 1; } -#endif // !TARGET_X86 +#endif // !HOST_X86 for (UINT i = 0; i < ifrStart + cfrTotal; i++) { @@ -948,7 +948,7 @@ void MagicDeinit(void) } } -#if defined(TARGET_X86) +#if defined(HOST_X86) /**************************************************************************** * ClrCaptureContext * *-------------------* @@ -988,4 +988,4 @@ ClrCaptureContext(__out PCONTEXT ctx) ret 4 } } -#endif // _TARGET_X86 +#endif // HOST_X86 diff --git a/src/coreclr/src/utilcode/stresslog.cpp b/src/coreclr/src/utilcode/stresslog.cpp index 27906b5e9bccd2..7d5562bef51f85 100644 --- a/src/coreclr/src/utilcode/stresslog.cpp +++ b/src/coreclr/src/utilcode/stresslog.cpp @@ -24,7 +24,7 @@ thread_local ThreadStressLog* StressLog::t_pCurrentThreadLog; #endif // !STRESS_LOG_READONLY /*********************************************************************************/ -#if defined(TARGET_X86) +#if defined(HOST_X86) /* This is like QueryPerformanceCounter but a lot faster. On machines with variable-speed CPUs (for power management), this is not accurate, but may @@ -39,7 +39,7 @@ __forceinline __declspec(naked) unsigned __int64 getTimeStamp() { }; } -#else // TARGET_X86 +#else // HOST_X86 unsigned __int64 getTimeStamp() { STATIC_CONTRACT_LEAF; @@ -51,9 +51,9 @@ unsigned __int64 getTimeStamp() { return ret.QuadPart; } -#endif // TARGET_X86 +#endif // HOST_X86 -#if defined(TARGET_X86) && !defined(HOST_UNIX) +#if defined(HOST_X86) && !defined(HOST_UNIX) /*********************************************************************************/ /* Get the the frequency cooresponding to 'getTimeStamp'. For x86, this is the @@ -100,7 +100,7 @@ unsigned __int64 getTickFrequency() return hz; } -#else // TARGET_X86 +#else // HOST_X86 /*********************************************************************************/ @@ -115,7 +115,7 @@ unsigned __int64 getTickFrequency() return ret.QuadPart; } -#endif // TARGET_X86 +#endif // HOST_X86 #ifdef STRESS_LOG diff --git a/src/coreclr/src/vm/CMakeLists.txt b/src/coreclr/src/vm/CMakeLists.txt index 0cb75e5629f3c4..45ec235ecec892 100644 --- a/src/coreclr/src/vm/CMakeLists.txt +++ b/src/coreclr/src/vm/CMakeLists.txt @@ -940,12 +940,14 @@ convert_to_absolute_path(VM_SOURCES_WKS_ARCH_ASM ${VM_SOURCES_WKS_ARCH_ASM}) convert_to_absolute_path(VM_SOURCES_DAC ${VM_SOURCES_DAC}) convert_to_absolute_path(VM_SOURCES_WKS_SPECIAL ${VM_SOURCES_WKS_SPECIAL}) -add_library_clr(cee_dac ${VM_SOURCES_DAC}) -add_dependencies(cee_dac eventing_headers) -set_target_properties(cee_dac PROPERTIES DAC_COMPONENT TRUE) -target_precompile_header(TARGET cee_dac HEADER common.h) - -add_subdirectory(wks) +if (CLR_CMAKE_BUILD_SUBSET_RUNTIME) + add_library_clr(cee_dac ${VM_SOURCES_DAC}) + add_dependencies(cee_dac eventing_headers) + set_target_properties(cee_dac PROPERTIES DAC_COMPONENT TRUE) + target_precompile_header(TARGET cee_dac HEADER common.h) + + add_subdirectory(wks) +endif(CLR_CMAKE_BUILD_SUBSET_RUNTIME) if(FEATURE_PERFTRACING) add_subdirectory(eventing) diff --git a/src/coreclr/src/vm/codeman.cpp b/src/coreclr/src/vm/codeman.cpp index 3f48cb00db59b2..dcbb4bdc6e67f9 100644 --- a/src/coreclr/src/vm/codeman.cpp +++ b/src/coreclr/src/vm/codeman.cpp @@ -1529,7 +1529,7 @@ enum JIT_LOAD_JIT_ID { JIT_LOAD_MAIN = 500, // The "main" JIT. Normally, this is named "clrjit.dll". Start at a number that is somewhat uncommon (i.e., not zero or 1) to help distinguish from garbage, in process dumps. // 501 is JIT_LOAD_LEGACY on some platforms; please do not reuse this value. - JIT_LOAD_ALTJIT = 502 // An "altjit". By default, named "protojit.dll". Used both internally, as well as externally for JIT CTP builds. + JIT_LOAD_ALTJIT = 502 // An "altjit". By default, named something like "clrjit___.dll". Used both internally, as well as externally for JIT CTP builds. }; enum JIT_LOAD_STATUS @@ -1767,7 +1767,27 @@ BOOL EEJitManager::LoadJIT() if (altJitName == NULL) { - altJitName = MAKEDLLNAME_W(W("protojit")); +#ifdef TARGET_WINDOWS +#ifdef TARGET_X86 + altJitName = MAKEDLLNAME_W(W("clrjit_win_x86_x86")); +#elif defined(TARGET_AMD64) + altJitName = MAKEDLLNAME_W(W("clrjit_win_x64_x64")); +#elif defined(TARGET_ARM) + altJitName = MAKEDLLNAME_W(W("clrjit_win_arm_arm")); +#elif defined(TARGET_ARM64) + altJitName = MAKEDLLNAME_W(W("clrjit_win_arm64_arm64")); +#endif +#else // TARGET_WINDOWS +#ifdef TARGET_X86 + altJitName = MAKEDLLNAME_W(W("clrjit_unix_x86_x86")); +#elif defined(TARGET_AMD64) + altJitName = MAKEDLLNAME_W(W("clrjit_unix_x64_x64")); +#elif defined(TARGET_ARM) + altJitName = MAKEDLLNAME_W(W("clrjit_unix_arm_arm")); +#elif defined(TARGET_ARM64) + altJitName = MAKEDLLNAME_W(W("clrjit_unix_arm64_arm64")); +#endif +#endif // TARGET_WINDOWS } g_JitLoadData.jld_id = JIT_LOAD_ALTJIT; diff --git a/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj b/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj index 60b592dc672a8c..b46ef6d070970b 100644 --- a/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj +++ b/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj @@ -45,7 +45,6 @@ unix win - $(TargetOSComponent)-$(TargetArchitecture) @@ -55,7 +54,13 @@ - + + + + + + + From 5decfc97b84922591dd7b734915f4b0029b6b4af Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Thu, 27 Aug 2020 16:35:10 -0700 Subject: [PATCH 2/7] Add arm64 crossgen2 cross compilation test to crossgen2 test pipeline Add arm64 crossgen2 cross compilation test to crossgen2 test pipeline Fix yml --- .../templates/runtimes/run-test-job.yml | 12 +++++ .../templates/runtimes/send-to-helix-step.yml | 2 + eng/pipelines/coreclr/crossgen2.yml | 37 +++++++++++++ .../templates/crossgen-comparison-job.yml | 2 - .../coreclr/templates/xplat-pipeline-job.yml | 3 ++ src/coreclr/tests/helixpublishwitharcade.proj | 5 ++ .../tests/src/CLRTest.CrossGen.targets | 54 +++++++++++++++++++ src/coreclr/tests/src/Directory.Build.props | 2 +- src/coreclr/tests/tests.targets | 5 +- 9 files changed, 118 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/common/templates/runtimes/run-test-job.yml b/eng/pipelines/common/templates/runtimes/run-test-job.yml index f5fdcfb895ed25..3d9191fe18956f 100644 --- a/eng/pipelines/common/templates/runtimes/run-test-job.yml +++ b/eng/pipelines/common/templates/runtimes/run-test-job.yml @@ -9,6 +9,7 @@ parameters: readyToRun: false liveLibrariesBuildConfig: '' crossgen2: false + crossgen_crosscomp_verification: false compositeBuildMode: false helixQueues: '' condition: true @@ -264,6 +265,14 @@ jobs: - script: $(Build.SourcesDirectory)/src/coreclr/build-test$(scriptExt) crossgenframeworkonly $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) displayName: Crossgen framework assemblies + # Crossgen and generate sha1 hashes of crossgen'd app binaries + - ${{ if eq(parameters.crossgen_crosscomp_verification, true) }}: + - script: $(coreClrRepoRootDir)tests$(dir)runtest$(scriptExt) crossgenframeworkonly runcrossgen2tests $(buildConfig) $(archType) + displayName: Crossgen test assemblies and generate sha1 hashes into Core_Root + env: + __TestCrossGen2Dll: $(buildProductRootFolderPath)$(dir)x64$(dir)crossgen2$(dir)crossgen2.dll + GenerateSha1Hashes: $(artifactsDirectory)$(dir)tests$(dir)coreclr$(dir)$(targetFlavor)$(dir)Tests$(dir)Core_Root$(dir)BuildLabSha1Hash + # Overwrite coreclr runtime binaries with mono ones - ${{ if eq(parameters.runtimeFlavor, 'mono') }}: - script: $(_msbuildCommand) @@ -300,6 +309,9 @@ jobs: ${{ if ne(parameters.readyToRun, true) }}: helixType: 'test/functional/cli/' + ${{ if eq(parameters.crossgen_crosscomp_verification, true) }}: + compareAgainstSha1Hashes: 'BuildLabSha1Hash' + helixQueues: ${{ parameters.helixQueues }} # This tests whether an array is empty diff --git a/eng/pipelines/common/templates/runtimes/send-to-helix-step.yml b/eng/pipelines/common/templates/runtimes/send-to-helix-step.yml index 975179232eb705..6898a92dfca2f1 100644 --- a/eng/pipelines/common/templates/runtimes/send-to-helix-step.yml +++ b/eng/pipelines/common/templates/runtimes/send-to-helix-step.yml @@ -17,6 +17,7 @@ parameters: timeoutPerTestInMinutes: '' runCrossGen: '' runCrossGen2: '' + compareAgainstSha1Hashes: '' compositeBuildMode: false helixProjectArguments: '' runInUnloadableContext: '' @@ -43,6 +44,7 @@ steps: _HelixType: ${{ parameters.helixType }} _RunCrossGen: ${{ parameters.runCrossGen }} _RunCrossGen2: ${{ parameters.runCrossGen2 }} + _CompareAgainstSha1Hashes: ${{ parameters.compareAgainstSha1Hashes }} _CompositeBuildMode: ${{ parameters.compositeBuildMode }} _RunInUnloadableContext: ${{ parameters.runInUnloadableContext }} _LongRunningGcTests: ${{ parameters.longRunningGcTests }} diff --git a/eng/pipelines/coreclr/crossgen2.yml b/eng/pipelines/coreclr/crossgen2.yml index 6ecdb931150a26..0ba07c66865979 100644 --- a/eng/pipelines/coreclr/crossgen2.yml +++ b/eng/pipelines/coreclr/crossgen2.yml @@ -57,3 +57,40 @@ jobs: crossgen2: true displayNameArgs: R2R_CG2 liveLibrariesBuildConfig: Release + + +# Tests for cross compile correctness, these use a release build +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/build-coreclr-and-libraries-job.yml + buildConfig: release + platforms: + - Windows_NT_arm64 + - CoreClrTestBuildHost # Either OSX_x64 or Linux_x64 + jobParameters: + testGroup: innerloop + +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml + buildConfig: release + platforms: + - CoreClrTestBuildHost # Either OSX_x64 or Linux_x64 + jobParameters: + testGroup: innerloop + liveLibrariesBuildConfig: Release + +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml + helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml + buildConfig: release + platforms: + - Windows_NT_arm64 + jobParameters: + testGroup: innerloop + readyToRun: true + crossgen2: true + crossgen_crosscomp_verification: true + displayNameArgs: R2R_CG2_CROSSCOMP + liveLibrariesBuildConfig: Release diff --git a/eng/pipelines/coreclr/templates/crossgen-comparison-job.yml b/eng/pipelines/coreclr/templates/crossgen-comparison-job.yml index bc1c6b7d3d568a..904de2b83e2556 100644 --- a/eng/pipelines/coreclr/templates/crossgen-comparison-job.yml +++ b/eng/pipelines/coreclr/templates/crossgen-comparison-job.yml @@ -47,8 +47,6 @@ jobs: - group: DotNet-HelixApi-Access - name: hostArchType value: x64 - - name: targetFlavor - value: $(osGroup).$(archType).$(buildConfigUpper) - name: crossFlavor value: $(osGroup).$(hostArchType)_$(archType).$(buildConfigUpper) - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: diff --git a/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml b/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml index 2e4e5122c94ab3..6e76991b3c102b 100644 --- a/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml +++ b/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml @@ -60,6 +60,9 @@ jobs: - name: binTestsPath value: '$(Build.SourcesDirectory)/artifacts/tests/coreclr' + - name: targetFlavor + value: '$(osGroup).$(archType).$(buildConfigUpper)' + # Build product defines what we are trying to build, either coreclr or mono - name: buildProductArtifactName value: 'CoreCLRProduct_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' diff --git a/src/coreclr/tests/helixpublishwitharcade.proj b/src/coreclr/tests/helixpublishwitharcade.proj index 45b7476550eb71..d6ea26da5334e7 100644 --- a/src/coreclr/tests/helixpublishwitharcade.proj +++ b/src/coreclr/tests/helixpublishwitharcade.proj @@ -27,6 +27,7 @@ PublishTestResults=$(_PublishTestResults); RunCrossGen=$(_RunCrossGen); RunCrossGen2=$(_RunCrossGen2); + CompareAgainstSha1Hashes=$(_CompareAgainstSha1Hashes); CompositeBuildMode=$(_CompositeBuildMode); LongRunningGCTests=$(_LongRunningGCTests); GcSimulatorTests=$(_GcSimulatorTests); @@ -242,6 +243,8 @@ + + @@ -258,6 +261,8 @@ + + diff --git a/src/coreclr/tests/src/CLRTest.CrossGen.targets b/src/coreclr/tests/src/CLRTest.CrossGen.targets index 5ff7ec9a355681..2f2b43b74addad 100644 --- a/src/coreclr/tests/src/CLRTest.CrossGen.targets +++ b/src/coreclr/tests/src/CLRTest.CrossGen.targets @@ -21,6 +21,10 @@ WARNING: When setting properties based on their current state (for example: $(BashScriptSnippetGen);GetCrossgenBashScript $(BatchScriptSnippetGen);GetCrossgenBatchScript + windows + linux + linux + osx - $(RepoRoot)\artifacts\tests\coreclr + $(RepoRoot)artifacts\tests\coreclr $(__TestRootDir) $(BaseOutputPath)\$(OSPlatformConfig)\ $(BaseOutputPathWithConfig) diff --git a/src/coreclr/tests/tests.targets b/src/coreclr/tests/tests.targets index 1637017dd85ea6..cd05a84b9d6b78 100644 --- a/src/coreclr/tests/tests.targets +++ b/src/coreclr/tests/tests.targets @@ -55,6 +55,7 @@ $(CORE_ROOT)\corerun $(CORE_ROOT)\corerun.exe $(DotnetRoot)/dotnet + $(__TestDotNetCmd)