diff --git a/eng/Subsets.props b/eng/Subsets.props index ba8bc03906a1cb..1431cd92a378d9 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -372,7 +372,7 @@ The cross tools are used as part of the build process with the downloaded build tools, so we need to build them for the host architecture and build them as unsanitized binaries. --> - <_BuildAnyCrossArch Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(HostOS)' != '$(TargetOS)' or '$(EnableNativeSanitizers)' != '') and '$(TargetArchitecture)' != 'wasm'">true + <_BuildAnyCrossArch Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(HostOS)' != '$(TargetOS)' or '$(EnableNativeSanitizers)' != '')">true <_BuildCrossComponents Condition="$(_subset.Contains('+clr.crossarchtools+'))">true <_BuildCrossComponents Condition="'$(ClrRuntimeBuildSubsets)' != '' and ('$(PrimaryRuntimeFlavor)' == 'CoreCLR' or '$(TargetsMobile)' == 'true')">true <_CrossBitwidthBuild Condition="'$(BuildArchitecture)' == 'x64' and ('$(TargetArchitecture)' == 'x86' or '$(TargetArchitecture)' == 'arm')">true @@ -381,7 +381,9 @@ - <_CrossToolSubset Condition="'$(_BuildCrossComponents)' == 'true' and ($(_subset.Contains('+clr.tools+')) or $(_subset.Contains('+clr.nativecorelib+')) or $(_subset.Contains('+clr.crossarchtools+')))" Include="ClrAllJitsSubset=true" /> + <_CrossToolSubset Condition="'$(_BuildCrossComponents)' == 'true' and '$(TargetArchitecture)' != 'wasm' and ($(_subset.Contains('+clr.tools+')) or $(_subset.Contains('+clr.nativecorelib+')) or $(_subset.Contains('+clr.crossarchtools+')))" Include="ClrAllJitsSubset=true" /> + + <_CrossToolSubset Condition="'$(_BuildCrossComponents)' == 'true' and '$(TargetArchitecture)' == 'wasm' and ($(_subset.Contains('+clr.tools+')) or $(_subset.Contains('+clr.nativecorelib+')) or $(_subset.Contains('+clr.crossarchtools+')))" Include="ClrWasmJitSubset=true" /> <_CrossToolSubset Condition="'$(_BuildCrossComponents)' == 'true' and '$(TargetsWindows)' == 'true'" Include="ClrDebugSubset=true" /> false - - false + false CopyILCoreLib @@ -42,6 +41,11 @@ $(CrossgenTargetName);LinkCoreLibMachO + + wasm + CopyILCoreLib;$(CrossgenTargetName) + + $(CrossgenTargetName);CopyR2RComponentCoreLib @@ -68,6 +72,10 @@ $([MSBuild]::NormalizePath('$(BinDir)', '$(CoreLibAssemblyName).dylib')) + + $([MSBuild]::NormalizePath('$(BinDir)', '$(CoreLibAssemblyName).NotReadyYet.wasm')) + + $([MSBuild]::NormalizePath('$(IntermediateOutputPath)', '$(CoreLibAssemblyName).dll')) @@ -149,6 +157,7 @@ $(CrossGenDllCmd) -r:$([MSBuild]::NormalizePath('$(BinDir)', 'IL', '*.dll')) $(CrossGenDllCmd) --targetarch:$(TargetArchitecture) $(CrossGenDllCmd) --obj-format:$(PublishReadyToRunContainerFormat) + $(CrossGenDllCmd) --codegenopt:JitWasmNyiToR2RUnsupported=1 $(CrossGenDllCmd) --composite $(CrossGenDllCmd) --targetos:$(TargetOS) diff --git a/src/coreclr/gcinfo/CMakeLists.txt b/src/coreclr/gcinfo/CMakeLists.txt index 05521608a09a73..9757b755f27173 100644 --- a/src/coreclr/gcinfo/CMakeLists.txt +++ b/src/coreclr/gcinfo/CMakeLists.txt @@ -93,5 +93,6 @@ endif (CLR_CMAKE_TARGET_ARCH_I386 AND CLR_CMAKE_TARGET_UNIX) if (CLR_CMAKE_TARGET_ARCH_WASM) create_gcinfo_lib(TARGET gcinfo_unix_wasm OS browser ARCH wasm) + create_gcinfo_lib(TARGET gcinfo_universal_wasm OS universal ARCH wasm) install_clr(TARGETS gcinfo_unix_wasm DESTINATIONS sharedFramework COMPONENT runtime) endif (CLR_CMAKE_TARGET_ARCH_WASM) diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt index dd83c6891518fe..3dadf640040780 100644 --- a/src/coreclr/jit/CMakeLists.txt +++ b/src/coreclr/jit/CMakeLists.txt @@ -719,6 +719,10 @@ if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) endif(CLR_CMAKE_BUILD_COMMUNITY_ALTJITS EQUAL 1) endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) +if (CLR_CMAKE_TARGET_ARCH_WASM) + create_standalone_jit(TARGET clrjit_universal_wasm_${ARCH_HOST_NAME} OS universal ARCH wasm) +endif (CLR_CMAKE_TARGET_ARCH_WASM) + if (CLR_CMAKE_TARGET_ARCH_LOONGARCH64) create_standalone_jit(TARGET clrjit_unix_loongarch64_${ARCH_HOST_NAME} OS unix ARCH loongarch64) endif (CLR_CMAKE_TARGET_ARCH_LOONGARCH64) diff --git a/src/coreclr/jit/codegenwasm.cpp b/src/coreclr/jit/codegenwasm.cpp index 0d89746cf97da6..cadcd3ce857632 100644 --- a/src/coreclr/jit/codegenwasm.cpp +++ b/src/coreclr/jit/codegenwasm.cpp @@ -3321,10 +3321,12 @@ void CodeGen::genEmitGSCookieCheck(bool tailCall) NYI_WASM("genEmitGSCookieCheck"); } +#ifdef PROFILING_SUPPORTED void CodeGen::genProfilingLeaveCallback(unsigned helper) { NYI_WASM("genProfilingLeaveCallback"); } +#endif void CodeGen::genSpillVar(GenTree* tree) { diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 24b980ccc8f755..b01372eead07a5 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -3113,10 +3113,12 @@ void Compiler::compInitOptions(JitFlags* jitFlags) printf("OPTIONS: compProcedureSplittingEH = %s\n", dspBool(opts.compProcedureSplittingEH)); // This is rare; don't clutter up the dump with it normally. +#ifdef PROFILING_SUPPORTED if (compProfilerHookNeeded) { printf("OPTIONS: compProfilerHookNeeded = %s\n", dspBool(compProfilerHookNeeded)); } +#endif if (jitFlags->IsSet(JitFlags::JIT_FLAG_BBOPT)) { diff --git a/src/coreclr/jit/error.h b/src/coreclr/jit/error.h index cf2103620f2c9f..6c533a5ccc50b9 100644 --- a/src/coreclr/jit/error.h +++ b/src/coreclr/jit/error.h @@ -226,13 +226,9 @@ extern void notYetImplemented(const char* msg, const char* file, unsigned line); #define NYI_LOONGARCH64(msg) do { } while (0) #define NYI_RISCV64(msg) do { } while (0) -#if DEBUG #define NYI_WASM(msg) do { if (JitConfig.JitWasmNyiToR2RUnsupported() > 0) \ { JITDUMP("NYI_WASM: " msg); implReadyToRunUnsupported(); } \ else { NYIRAW("NYI_WASM: " msg); } } while (0) -#else -#define NYI_WASM(msg) NYIRAW("NYI_WASM: " msg) -#endif // DEBUG #else diff --git a/src/coreclr/jit/fgwasm.cpp b/src/coreclr/jit/fgwasm.cpp index 66fb058fc935f3..d695e77b5c5b10 100644 --- a/src/coreclr/jit/fgwasm.cpp +++ b/src/coreclr/jit/fgwasm.cpp @@ -2313,8 +2313,8 @@ void Compiler::fgWasmEhTransformTry(ArrayStack* catchRetBlocks, BasicBlock* const rethrowBlock = fgNewBBinRegion(BBJ_THROW, biasedEnclosingTryIndex, biasedEnclosingHndIndex, switchBlock); - switchBlock->bbSetRunRarely(); - rethrowBlock->bbSetRunRarely(); + switchBlock->inheritWeightPercentage(regionEntryBlock, 0); + rethrowBlock->inheritWeightPercentage(regionEntryBlock, 0); // Split the header so we can branch to the switch on exception. // diff --git a/src/coreclr/jit/jitconfigvalues.h b/src/coreclr/jit/jitconfigvalues.h index a87b20f8491c78..88ac0fe83e4924 100644 --- a/src/coreclr/jit/jitconfigvalues.h +++ b/src/coreclr/jit/jitconfigvalues.h @@ -885,7 +885,7 @@ CONFIG_INTEGER(JitDispIns, "JitDispIns", 0) #if defined(TARGET_WASM) // Set this to 1 to turn NYI_WASM into R2R unsupported failures instead of asserts. -CONFIG_INTEGER(JitWasmNyiToR2RUnsupported, "JitWasmNyiToR2RUnsupported", 0) +RELEASE_CONFIG_INTEGER(JitWasmNyiToR2RUnsupported, "JitWasmNyiToR2RUnsupported", 0) // Specify methods that will fail with R2R unsupported after codegen. // Useful for bypassing methods that compile cleanly but have invalid Wasm codegen. CONFIG_STRING(JitR2RUnsupportedRange, "JitR2RUnsupportedRange") diff --git a/src/coreclr/pal/src/CMakeLists.txt b/src/coreclr/pal/src/CMakeLists.txt index 6903d78e15c9de..9e75a724102757 100644 --- a/src/coreclr/pal/src/CMakeLists.txt +++ b/src/coreclr/pal/src/CMakeLists.txt @@ -10,7 +10,7 @@ elseif (CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_OPENBSD) include_directories(SYSTEM $ENV{ROOTFS_DIR}/usr/local/include) endif() -if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_ARCH_WASM) +if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_HOST_ARCH_WASM) include_directories(${CLR_SRC_NATIVE_DIR}/external/libunwind/include) include_directories(${CLR_SRC_NATIVE_DIR}/external/libunwind/include/tdep) include_directories(${CLR_ARTIFACTS_OBJ_DIR}/external/libunwind/include) @@ -21,7 +21,7 @@ elseif(NOT CLR_CMAKE_TARGET_APPLE) find_unwind_libs(UNWIND_LIBS) else() add_subdirectory(${CLR_SRC_NATIVE_DIR}/external/libunwind_extras ${CLR_ARTIFACTS_OBJ_DIR}/external/libunwind) -endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_ARCH_WASM) +endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_HOST_ARCH_WASM) include(configure.cmake) @@ -86,9 +86,9 @@ endif(CLR_CMAKE_TARGET_APPLE) if (FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION) add_definitions(-DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION) endif(FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION) -if(NOT CLR_CMAKE_TARGET_ARCH_WASM OR FEATURE_MULTITHREADING) +if(NOT CLR_CMAKE_HOST_ARCH_WASM OR FEATURE_MULTITHREADING) add_definitions(-DFEATURE_MULTITHREADING) -endif(NOT CLR_CMAKE_TARGET_ARCH_WASM OR FEATURE_MULTITHREADING) +endif(NOT CLR_CMAKE_HOST_ARCH_WASM OR FEATURE_MULTITHREADING) add_definitions(-DLP64COMPATIBLE) add_definitions(-DCORECLR) add_definitions(-DPIC) @@ -116,7 +116,7 @@ endif(CLR_CMAKE_TARGET_HAIKU) # turn off capability to remove unused functions (which was enabled in debug build with sanitizers) set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -Wl,--no-gc-sections") -if (NOT CLR_CMAKE_TARGET_ARCH_WASM) +if (NOT CLR_CMAKE_HOST_ARCH_WASM) set(ARCH_SOURCES arch/${PAL_ARCH_SOURCES_DIR}/context2.S arch/${PAL_ARCH_SOURCES_DIR}/debugbreak.S @@ -124,18 +124,18 @@ if (NOT CLR_CMAKE_TARGET_ARCH_WASM) ) endif() -if (CLR_CMAKE_TARGET_ARCH_WASM) +if (CLR_CMAKE_HOST_ARCH_WASM) set(PLATFORM_SOURCES arch/${PAL_ARCH_SOURCES_DIR}/stubs.cpp ) endif() -if(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_TARGET_ARCH_WASM) +if(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_HOST_ARCH_WASM) list(APPEND PLATFORM_SOURCES arch/${PAL_ARCH_SOURCES_DIR}/callsignalhandlerwrapper.S arch/${PAL_ARCH_SOURCES_DIR}/signalhandlerhelper.cpp ) -endif(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_TARGET_ARCH_WASM) +endif(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_HOST_ARCH_WASM) if(CLR_CMAKE_HOST_ARCH_ARM) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") @@ -215,9 +215,9 @@ set_source_files_properties( INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/../inc/rt ) -if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_ARCH_WASM) +if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_HOST_ARCH_WASM) set(LIBUNWIND_OBJECTS $) -endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_ARCH_WASM) +endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_HOST_ARCH_WASM) add_library(coreclrpal_objects OBJECT diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.props b/src/coreclr/tools/aot/crossgen2/crossgen2.props index 2589fde1ea9da4..825f499e688d04 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.props +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.props @@ -55,7 +55,7 @@ CopyToPublishDirectory="PreserveNewest" ExcludeFromSingleFile="$(PublishSingleFile)" Link="%(FileName)%(Extension)" - Condition="'$(TargetsWasm)' != 'true'" + Condition="'$(TargetsWasm)' != 'true' or '$(CrossHostArch)' != ''" />