From 14449bf9c263ad025fc90ac8a0bcc9dcaa160782 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Tue, 19 Aug 2025 17:23:09 +0200 Subject: [PATCH 01/16] [clr-interp] Set up fully interpreted functional test on iOS simulator --- ...ntime-extra-platforms-ioslikesimulator.yml | 2 +- src/coreclr/clrfeatures.cmake | 4 +-- .../dlls/mscoree/coreclr/CMakeLists.txt | 6 ++-- src/coreclr/interpreter/compiler.cpp | 30 +++++++++++++++++++ src/coreclr/interpreter/eeinterp.cpp | 4 +-- src/coreclr/interpreter/intops.def | 2 ++ src/coreclr/interpreter/intrinsics.cpp | 2 ++ src/coreclr/vm/interpexec.cpp | 23 ++++++++++++++ src/coreclr/vm/prestub.cpp | 4 +-- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- src/native/libs/System.Native/CMakeLists.txt | 2 +- src/tasks/AppleAppBuilder/Xcode.cs | 5 ++-- .../Simulator/CoreCLR.Interpreter/Program.cs | 15 +--------- ....Simulator.CoreCLR.Interpreter.Test.csproj | 3 +- 15 files changed, 76 insertions(+), 30 deletions(-) diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml index 80f29f2d8567eb..a60929598a50ea 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml @@ -142,7 +142,7 @@ jobs: parameters: jobTemplate: /eng/pipelines/common/global-build-job.yml helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - buildConfig: checked + buildConfig: debug runtimeFlavor: coreclr isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }} isiOSLikeSimulatorOnlyBuild: ${{ parameters.isiOSLikeSimulatorOnlyBuild }} diff --git a/src/coreclr/clrfeatures.cmake b/src/coreclr/clrfeatures.cmake index 9eb037300cd4f1..3b4fb203ee2c51 100644 --- a/src/coreclr/clrfeatures.cmake +++ b/src/coreclr/clrfeatures.cmake @@ -1,8 +1,8 @@ -if (NOT CLR_CMAKE_TARGET_ARCH_WASM) +if (NOT CLR_CMAKE_TARGET_ARCH_WASM AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_MACCATALYST) set(FEATURE_JIT 1) endif() -if (CLR_CMAKE_TARGET_ARCH_WASM OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) +if (CLR_CMAKE_TARGET_ARCH_WASM OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS OR CLR_CMAKE_TARGET_MACCATALYST) set(FEATURE_STATICALLY_LINKED 1) endif() diff --git a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt index 8b937537c554f9..e997d08de18abc 100644 --- a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt @@ -203,8 +203,10 @@ endif(NOT CLR_CMAKE_HOST_ARCH_WASM) target_link_libraries(coreclr_static PUBLIC ${CORECLR_LIBRARIES} cee_wks_core ${CORECLR_STATIC_CLRJIT_STATIC} ${CEE_WKS_STATIC} ${FOUNDATION}) target_compile_definitions(coreclr_static PUBLIC CORECLR_EMBEDDED) -if (CLR_CMAKE_HOST_ANDROID) - target_link_libraries(coreclr PUBLIC log) +if (CLR_CMAKE_HOST_ANDROID OR CLR_CMAKE_HOST_IOS OR CLR_CMAKE_HOST_TVOS OR CLR_CMAKE_HOST_MACCATALYST) + if (CLR_CMAKE_HOST_ANDROID) + target_link_libraries(coreclr PUBLIC log) + endif() target_link_libraries(coreclr_static PUBLIC coreclrminipal_objects diff --git a/src/coreclr/interpreter/compiler.cpp b/src/coreclr/interpreter/compiler.cpp index 717f4c0dd4dc32..8289fd2bc30d93 100644 --- a/src/coreclr/interpreter/compiler.cpp +++ b/src/coreclr/interpreter/compiler.cpp @@ -2322,6 +2322,36 @@ bool InterpCompiler::EmitNamedIntrinsicCall(NamedIntrinsic ni, CORINFO_CLASS_HAN return true; } + case NI_System_Threading_Interlocked_Exchange: + { + CHECK_STACK(2); + InterpType retType = GetInterpType(sig.retType); + + int32_t opcode; + switch (retType) + { + case InterpTypeI4: + opcode = INTOP_EXCHANGE_I4; + break; + case InterpTypeI8: + opcode = INTOP_EXCHANGE_I8; + break; + default: + return false; + } + + AddIns(opcode); + m_pStackPointer -= 2; + + int32_t addrVar = m_pStackPointer[0].var; + int32_t valueVar = m_pStackPointer[1].var; + + PushInterpType(retType, nullptr); + m_pLastNewIns->SetSVars2(addrVar, valueVar); + m_pLastNewIns->SetDVar(m_pStackPointer[-1].var); + return true; + } + case NI_System_Runtime_CompilerServices_RuntimeHelpers_IsReferenceOrContainsReferences: { CORINFO_CLASS_HANDLE clsHnd = sig.sigInst.methInst[0]; diff --git a/src/coreclr/interpreter/eeinterp.cpp b/src/coreclr/interpreter/eeinterp.cpp index d0351825e06120..0f170867a3dd30 100644 --- a/src/coreclr/interpreter/eeinterp.cpp +++ b/src/coreclr/interpreter/eeinterp.cpp @@ -85,8 +85,8 @@ CorJitResult CILInterp::compileMethod(ICorJitInfo* compHnd, break; } -#ifdef TARGET_WASM - // interpret everything on wasm +#if defined(TARGET_WASM) || defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST) + // interpret everything on wasm and apple mobile doInterpret = true; #else // NOTE: We do this check even if doInterpret==true in order to populate g_interpModule diff --git a/src/coreclr/interpreter/intops.def b/src/coreclr/interpreter/intops.def index 95ea7a745e66f6..2c33204ec1cfc7 100644 --- a/src/coreclr/interpreter/intops.def +++ b/src/coreclr/interpreter/intops.def @@ -409,6 +409,8 @@ OPDEF(INTOP_LOAD_FRAMEVAR, "load.framevar", 2, 1, 0, InterpOpNoArgs) // Intrinsics OPDEF(INTOP_COMPARE_EXCHANGE_I4, "compare.exchange.i4", 5, 1, 3, InterpOpNoArgs) OPDEF(INTOP_COMPARE_EXCHANGE_I8, "compare.exchange.i8", 5, 1, 3, InterpOpNoArgs) +OPDEF(INTOP_EXCHANGE_I4, "exchange.i4", 3, 1, 2, InterpOpNoArgs) +OPDEF(INTOP_EXCHANGE_I8, "exchange.i8", 3, 1, 2, InterpOpNoArgs) // All instructions after this point are IROPS, instructions that are not emitted/executed OPDEF(INTOP_NOP, "nop", 1, 0, 0, InterpOpNoArgs) diff --git a/src/coreclr/interpreter/intrinsics.cpp b/src/coreclr/interpreter/intrinsics.cpp index af57f45c414d4a..2d2ba35cccb772 100644 --- a/src/coreclr/interpreter/intrinsics.cpp +++ b/src/coreclr/interpreter/intrinsics.cpp @@ -104,6 +104,8 @@ NamedIntrinsic GetNamedIntrinsic(COMP_HANDLE compHnd, CORINFO_METHOD_HANDLE comp { if (!strcmp(methodName, "CompareExchange")) return NI_System_Threading_Interlocked_CompareExchange; + else if (!strcmp(methodName, "Exchange")) + return NI_System_Threading_Interlocked_Exchange; else if (!strcmp(methodName, "MemoryBarrier")) return NI_System_Threading_Interlocked_MemoryBarrier; } diff --git a/src/coreclr/vm/interpexec.cpp b/src/coreclr/vm/interpexec.cpp index 144357e8deb5b0..c338f87e1a12b0 100644 --- a/src/coreclr/vm/interpexec.cpp +++ b/src/coreclr/vm/interpexec.cpp @@ -2534,6 +2534,29 @@ do \ break; } +#define EXCHANGE(type) \ +do \ +{ \ + type* dst = LOCAL_VAR(ip[2], type*); \ + NULL_CHECK(dst); \ + type newValue = LOCAL_VAR(ip[3], type); \ + type old = InterlockedExchangeT(dst, newValue); \ + LOCAL_VAR(ip[1], type) = old; \ + ip += 4; \ +} while (0) + + case INTOP_EXCHANGE_I4: + { + EXCHANGE(int32_t); + break; + } + + case INTOP_EXCHANGE_I8: + { + EXCHANGE(int64_t); + break; + } + case INTOP_CALL_FINALLY: { const int32_t* targetIp = ip + ip[1]; diff --git a/src/coreclr/vm/prestub.cpp b/src/coreclr/vm/prestub.cpp index 3ea82cfe8ae4d2..84a607d2b59be8 100644 --- a/src/coreclr/vm/prestub.cpp +++ b/src/coreclr/vm/prestub.cpp @@ -2357,7 +2357,7 @@ PCODE MethodDesc::DoPrestub(MethodTable *pDispatchingMT, CallerGCMode callerGCMo pCode = DoBackpatch(pMT, pDispatchingMT, FALSE); Return: -#if defined(FEATURE_INTERPRETER) && defined(FEATURE_JIT) +#if defined(FEATURE_INTERPRETER) && !defined(TARGET_WASM) InterpByteCodeStart *pInterpreterCode = GetInterpreterCode(); if (pInterpreterCode != NULL) { @@ -2924,7 +2924,7 @@ static PCODE getHelperForSharedStatic(Module * pModule, ReadyToRunFixupKind kind } pArgs->offset = pFD->GetOffset(); - BinderMethodID managedHelperId = fUnbox ? + BinderMethodID managedHelperId = fUnbox ? METHOD__STATICSHELPERS__STATICFIELDADDRESSUNBOX_DYNAMIC : METHOD__STATICSHELPERS__STATICFIELDADDRESS_DYNAMIC; diff --git a/src/native/libs/System.Globalization.Native/CMakeLists.txt b/src/native/libs/System.Globalization.Native/CMakeLists.txt index e3fa46ac9bc3ec..08c1fe46484e23 100644 --- a/src/native/libs/System.Globalization.Native/CMakeLists.txt +++ b/src/native/libs/System.Globalization.Native/CMakeLists.txt @@ -192,7 +192,7 @@ if(CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_WASI) endif() install (TARGETS System.Globalization.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) -if(CLR_CMAKE_HOST_ANDROID) +if(CLR_CMAKE_HOST_ANDROID OR CLR_CMAKE_HOST_IOS OR CLR_CMAKE_HOST_TVOS OR CLR_CMAKE_HOST_MACCATALYST) install (TARGETS System.Globalization.Native-Static DESTINATION sharedFramework COMPONENT runtime) endif() diff --git a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt index 0adecdad88b0ac..6d6345f51d2a8a 100644 --- a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt +++ b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt @@ -215,7 +215,7 @@ endif () install (TARGETS System.IO.Compression.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) -if(CLR_CMAKE_HOST_ANDROID) +if(CLR_CMAKE_HOST_ANDROID OR CLR_CMAKE_HOST_IOS OR CLR_CMAKE_HOST_TVOS OR CLR_CMAKE_HOST_MACCATALYST) install (TARGETS System.IO.Compression.Native-Static DESTINATION sharedFramework COMPONENT runtime) foreach(BROTLI_LIB ${BROTLI_LIBRARIES}) diff --git a/src/native/libs/System.Native/CMakeLists.txt b/src/native/libs/System.Native/CMakeLists.txt index 1407d50e04d2c3..d86eeb2e0330a3 100644 --- a/src/native/libs/System.Native/CMakeLists.txt +++ b/src/native/libs/System.Native/CMakeLists.txt @@ -139,6 +139,6 @@ set_target_properties(System.Native-Static PROPERTIES OUTPUT_NAME System.Native install (TARGETS System.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) -if(CLR_CMAKE_HOST_ANDROID) +if(CLR_CMAKE_HOST_ANDROID OR CLR_CMAKE_HOST_IOS OR CLR_CMAKE_HOST_TVOS OR CLR_CMAKE_HOST_MACCATALYST) install (TARGETS System.Native-Static DESTINATION sharedFramework COMPONENT runtime) endif() diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 9e0f2e6b32602c..4593456092d0ea 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -417,9 +417,10 @@ public string GenerateCMake( string[] dylibs = Directory.GetFiles(workspace, "*.dylib"); if (targetRuntime == TargetRuntime.CoreCLR) { - foreach (string lib in dylibs) + string[] staticLibs = Directory.GetFiles(workspace, "*.a"); + foreach (string lib in staticLibs) { - toLink += $" \"-force_load {lib}\"{Environment.NewLine}"; + toLink += $" \"{lib}\"{Environment.NewLine}"; } } else diff --git a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/Program.cs b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/Program.cs index 7441f31337175b..00bd0387b6458a 100644 --- a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/Program.cs +++ b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/Program.cs @@ -9,22 +9,9 @@ public static class Program { - [DllImport("__Internal")] - public static extern void mono_ios_set_summary(string value); - - public static async Task Main(string[] args) + public static int Main(string[] args) { - mono_ios_set_summary($"Starting functional test"); - int result = RunInterpreter(); Console.WriteLine("Done!"); - await Task.Delay(5000); - - return result; - } - - [MethodImpl(MethodImplOptions.NoInlining)] - public unsafe static int RunInterpreter() - { return 42; } } diff --git a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj index fbf7c10bfd0f22..78aa8f1d9eec9e 100644 --- a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj +++ b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj @@ -13,8 +13,7 @@ - - + From a75d2f675bb8d0bb4c5b2d482787cddfcb3fd887 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 20 Aug 2025 10:29:18 +0200 Subject: [PATCH 02/16] Update src/coreclr/vm/interpexec.cpp Co-authored-by: Aaron Robinson --- src/coreclr/vm/interpexec.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/vm/interpexec.cpp b/src/coreclr/vm/interpexec.cpp index c338f87e1a12b0..1b13fda3e6415c 100644 --- a/src/coreclr/vm/interpexec.cpp +++ b/src/coreclr/vm/interpexec.cpp @@ -2556,6 +2556,7 @@ do \ EXCHANGE(int64_t); break; } +#undef EXCHANGE case INTOP_CALL_FINALLY: { From e1010ed7d81cfe348bcaed287b97bc40ed2b19b1 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 20 Aug 2025 10:29:24 +0200 Subject: [PATCH 03/16] Update src/coreclr/vm/interpexec.cpp Co-authored-by: Aaron Robinson --- src/coreclr/vm/interpexec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/vm/interpexec.cpp b/src/coreclr/vm/interpexec.cpp index 1b13fda3e6415c..be1ccd7a0b9242 100644 --- a/src/coreclr/vm/interpexec.cpp +++ b/src/coreclr/vm/interpexec.cpp @@ -2537,7 +2537,7 @@ do \ #define EXCHANGE(type) \ do \ { \ - type* dst = LOCAL_VAR(ip[2], type*); \ + type* dst = LOCAL_VAR(ip[2], type*); \ NULL_CHECK(dst); \ type newValue = LOCAL_VAR(ip[3], type); \ type old = InterlockedExchangeT(dst, newValue); \ From 3ddeac54b1613e396ca965e06cc5b03d4baa47f6 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 20 Aug 2025 19:53:21 +0200 Subject: [PATCH 04/16] Add StaticLinkedRuntime property --- src/coreclr/vm/prestub.cpp | 3 ++- src/mono/msbuild/apple/build/AppleBuild.props | 2 ++ .../msbuild/apple/build/AppleBuild.targets | 1 + src/tasks/AppleAppBuilder/AppleAppBuilder.cs | 9 +++++-- src/tasks/AppleAppBuilder/Xcode.cs | 25 ++++++++++++++----- ...tor.CoreCLR.Interpreter.Static.Test.csproj | 23 +++++++++++++++++ ....Simulator.CoreCLR.Interpreter.Test.csproj | 3 ++- 7 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj diff --git a/src/coreclr/vm/prestub.cpp b/src/coreclr/vm/prestub.cpp index f2677ed7c1bb83..cba1c2ed8ffe7c 100644 --- a/src/coreclr/vm/prestub.cpp +++ b/src/coreclr/vm/prestub.cpp @@ -2377,13 +2377,14 @@ PCODE MethodDesc::DoPrestub(MethodTable *pDispatchingMT, CallerGCMode callerGCMo pCode = DoBackpatch(pMT, pDispatchingMT, FALSE); Return: +// Interpreter-FIXME: Call stubs are not yet supported on WASM #if defined(FEATURE_INTERPRETER) && !defined(TARGET_WASM) InterpByteCodeStart *pInterpreterCode = GetInterpreterCode(); if (pInterpreterCode != NULL) { CreateNativeToInterpreterCallStub(pInterpreterCode->Method); } -#endif // FEATURE_INTERPRETER && FEATURE_JIT +#endif // FEATURE_INTERPRETER && !TARGET_WASM RETURN pCode; } diff --git a/src/mono/msbuild/apple/build/AppleBuild.props b/src/mono/msbuild/apple/build/AppleBuild.props index ba3ff16ac72337..5f371a630d14c2 100644 --- a/src/mono/msbuild/apple/build/AppleBuild.props +++ b/src/mono/msbuild/apple/build/AppleBuild.props @@ -28,6 +28,8 @@ ComputeIlcCompileInputs;SetupOSSpecificProps;PrepareForILLink <_ReadRuntimeComponentsManifestTargetName Condition="'$(UseNativeAOTRuntime)' != 'true' and '$(UseMonoRuntime)' != 'false'">_MonoReadAvailableComponentsManifest + true + Publish $(_ReadRuntimeComponentsManifestTargetName); diff --git a/src/mono/msbuild/apple/build/AppleBuild.targets b/src/mono/msbuild/apple/build/AppleBuild.targets index 17dd0f47455fb9..6c675ebaf5a6dc 100644 --- a/src/mono/msbuild/apple/build/AppleBuild.targets +++ b/src/mono/msbuild/apple/build/AppleBuild.targets @@ -339,6 +339,7 @@ ProjectName="$(AppName)" RuntimeComponents="@(RuntimeComponents)" StripSymbolTable="$(StripDebugSymbols)" + StaticLinkedRuntime="$(StaticLinkedRuntime)" TargetOS="$(TargetOS)" UseConsoleUITemplate="$(UseConsoleUITemplate)"> diff --git a/src/tasks/AppleAppBuilder/AppleAppBuilder.cs b/src/tasks/AppleAppBuilder/AppleAppBuilder.cs index 34fa7cb1674cd8..89c70340f63c73 100644 --- a/src/tasks/AppleAppBuilder/AppleAppBuilder.cs +++ b/src/tasks/AppleAppBuilder/AppleAppBuilder.cs @@ -197,6 +197,11 @@ public string TargetOS /// public bool IsLibraryMode { get; set; } + /// + /// Static linked runtime + /// + public bool StaticLinkedRuntime { get; set; } = true; + public void ValidateRuntimeSelection() { if (!Enum.TryParse(Runtime, out targetRuntime)) @@ -350,7 +355,7 @@ public override bool Execute() if (GenerateXcodeProject) { XcodeProjectPath = generator.GenerateXCode(ProjectName, MainLibraryFileName, assemblerFiles, assemblerDataFiles, assemblerFilesToLink, extraLinkerArgs, excludes, - AppDir, binDir, MonoRuntimeHeaders, !shouldStaticLink, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, HybridGlobalization, Optimized, EnableRuntimeLogging, EnableAppSandbox, DiagnosticPorts, RuntimeComponents, environmentVariables, NativeMainSource, targetRuntime, IsLibraryMode); + AppDir, binDir, MonoRuntimeHeaders, !shouldStaticLink, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, HybridGlobalization, Optimized, EnableRuntimeLogging, EnableAppSandbox, DiagnosticPorts, RuntimeComponents, environmentVariables, NativeMainSource, targetRuntime, IsLibraryMode, StaticLinkedRuntime); if (BuildAppBundle) { @@ -376,7 +381,7 @@ public override bool Execute() else if (GenerateCMakeProject) { generator.GenerateCMake(ProjectName, MainLibraryFileName, assemblerFiles, assemblerDataFiles, assemblerFilesToLink, extraLinkerArgs, excludes, - AppDir, binDir, MonoRuntimeHeaders, !shouldStaticLink, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, HybridGlobalization, Optimized, EnableRuntimeLogging, EnableAppSandbox, DiagnosticPorts, RuntimeComponents, environmentVariables, NativeMainSource, targetRuntime, IsLibraryMode); + AppDir, binDir, MonoRuntimeHeaders, !shouldStaticLink, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, HybridGlobalization, Optimized, EnableRuntimeLogging, EnableAppSandbox, DiagnosticPorts, RuntimeComponents, environmentVariables, NativeMainSource, targetRuntime, IsLibraryMode, StaticLinkedRuntime); } return true; diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 4593456092d0ea..2bb167c309fd76 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -192,9 +192,10 @@ public string GenerateXCode( IEnumerable environmentVariables, string? nativeMainSource = null, TargetRuntime targetRuntime = TargetRuntime.MonoVM, - bool isLibraryMode = false) + bool isLibraryMode = false, + bool staticLinkedRuntime = true) { - var cmakeDirectoryPath = GenerateCMake(projectName, entryPointLib, asmFiles, asmDataFiles, asmLinkFiles, extraLinkerArgs, excludes, workspace, binDir, monoInclude, preferDylibs, useConsoleUiTemplate, forceAOT, forceInterpreter, invariantGlobalization, hybridGlobalization, optimized, enableRuntimeLogging, enableAppSandbox, diagnosticPorts, runtimeComponents, environmentVariables, nativeMainSource, targetRuntime, isLibraryMode); + var cmakeDirectoryPath = GenerateCMake(projectName, entryPointLib, asmFiles, asmDataFiles, asmLinkFiles, extraLinkerArgs, excludes, workspace, binDir, monoInclude, preferDylibs, useConsoleUiTemplate, forceAOT, forceInterpreter, invariantGlobalization, hybridGlobalization, optimized, enableRuntimeLogging, enableAppSandbox, diagnosticPorts, runtimeComponents, environmentVariables, nativeMainSource, targetRuntime, isLibraryMode, staticLinkedRuntime); CreateXcodeProject(projectName, cmakeDirectoryPath); return Path.Combine(binDir, projectName, projectName + ".xcodeproj"); } @@ -266,7 +267,8 @@ public string GenerateCMake( IEnumerable environmentVariables, string? nativeMainSource = null, TargetRuntime targetRuntime = TargetRuntime.MonoVM, - bool isLibraryMode = false) + bool isLibraryMode = false, + bool staticLinkedRuntime = true) { // bundle everything as resources excluding native files var predefinedExcludes = new List { ".dll.o", ".dll.s", ".dwarf", ".m", ".h", ".a", ".bc", "libmonosgen-2.0.dylib", "icudt*" }; @@ -417,10 +419,21 @@ public string GenerateCMake( string[] dylibs = Directory.GetFiles(workspace, "*.dylib"); if (targetRuntime == TargetRuntime.CoreCLR) { - string[] staticLibs = Directory.GetFiles(workspace, "*.a"); - foreach (string lib in staticLibs) + + if (staticLinkedRuntime) + { + string[] staticLibs = Directory.GetFiles(workspace, "*.a"); + foreach (string lib in staticLibs) + { + toLink += $" \"{lib}\"{Environment.NewLine}"; + } + } + else { - toLink += $" \"{lib}\"{Environment.NewLine}"; + foreach (string lib in dylibs) + { + toLink += $" \"-force_load {lib}\"{Environment.NewLine}"; + } } } else diff --git a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj new file mode 100644 index 00000000000000..728a565a157210 --- /dev/null +++ b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj @@ -0,0 +1,23 @@ + + + Exe + false + false + false + false + true + $(NetCoreAppCurrent) + iossimulator + iOS.Simulator.CoreCLR.Interpreter.Static.Test.dll + false + 42 + + + + + + + + + + diff --git a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj index 78aa8f1d9eec9e..0341270e80e4c0 100644 --- a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj +++ b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj @@ -4,17 +4,18 @@ false false false + false true $(NetCoreAppCurrent) iossimulator iOS.Simulator.CoreCLR.Interpreter.Test.dll false 42 + false - From 321cfc3591da8c522eb117692d33312702e5a99e Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 20 Aug 2025 19:59:29 +0200 Subject: [PATCH 05/16] Update ReadyToRun configuration for iOS platforms --- src/coreclr/inc/clrconfigvalues.h | 5 +++++ .../iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj | 1 - .../iOS.Simulator.CoreCLR.Interpreter.Test.csproj | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index 882a88839a933e..3d21d57219d936 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -572,7 +572,12 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_CreateDumpDiagnostics, W("CreateDumpDiagnostic /// R2R /// RETAIL_CONFIG_STRING_INFO(INTERNAL_NativeImageSearchPaths, W("NativeImageSearchPaths"), "Extra search paths for native composite R2R images") + +#if defined(FEATURE_INTERPRETER) && (defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)) +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ReadyToRun, W("ReadyToRun"), 0, "Enable/disable use of ReadyToRun native code") // Off by default for Apple mobile platforms with interpreter +#else RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ReadyToRun, W("ReadyToRun"), 1, "Enable/disable use of ReadyToRun native code") // On by default for CoreCLR +#endif RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunExcludeList, W("ReadyToRunExcludeList"), "List of assemblies that cannot use Ready to Run images") RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunLogFile, W("ReadyToRunLogFile"), "Name of file to log success/failure of using Ready to Run images") diff --git a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj index 728a565a157210..47571b0fca112c 100644 --- a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj +++ b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj @@ -4,7 +4,6 @@ false false false - false true $(NetCoreAppCurrent) iossimulator diff --git a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj index 0341270e80e4c0..6e8c611bf4f7c7 100644 --- a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj +++ b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj @@ -4,7 +4,6 @@ false false false - false true $(NetCoreAppCurrent) iossimulator From 706eaee73243dbaa835e0623a5c76521748e8a55 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 21 Aug 2025 11:45:47 +0200 Subject: [PATCH 06/16] Remove StaticLinkedRuntime property --- src/mono/msbuild/apple/build/AppleBuild.props | 2 -- .../msbuild/apple/build/AppleBuild.targets | 1 - src/tasks/AppleAppBuilder/AppleAppBuilder.cs | 9 ++----- src/tasks/AppleAppBuilder/Xcode.cs | 27 +++++-------------- ...tor.CoreCLR.Interpreter.Static.Test.csproj | 22 --------------- ....Simulator.CoreCLR.Interpreter.Test.csproj | 1 - 6 files changed, 9 insertions(+), 53 deletions(-) delete mode 100644 src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj diff --git a/src/mono/msbuild/apple/build/AppleBuild.props b/src/mono/msbuild/apple/build/AppleBuild.props index 5f371a630d14c2..ba3ff16ac72337 100644 --- a/src/mono/msbuild/apple/build/AppleBuild.props +++ b/src/mono/msbuild/apple/build/AppleBuild.props @@ -28,8 +28,6 @@ ComputeIlcCompileInputs;SetupOSSpecificProps;PrepareForILLink <_ReadRuntimeComponentsManifestTargetName Condition="'$(UseNativeAOTRuntime)' != 'true' and '$(UseMonoRuntime)' != 'false'">_MonoReadAvailableComponentsManifest - true - Publish $(_ReadRuntimeComponentsManifestTargetName); diff --git a/src/mono/msbuild/apple/build/AppleBuild.targets b/src/mono/msbuild/apple/build/AppleBuild.targets index 6c675ebaf5a6dc..17dd0f47455fb9 100644 --- a/src/mono/msbuild/apple/build/AppleBuild.targets +++ b/src/mono/msbuild/apple/build/AppleBuild.targets @@ -339,7 +339,6 @@ ProjectName="$(AppName)" RuntimeComponents="@(RuntimeComponents)" StripSymbolTable="$(StripDebugSymbols)" - StaticLinkedRuntime="$(StaticLinkedRuntime)" TargetOS="$(TargetOS)" UseConsoleUITemplate="$(UseConsoleUITemplate)"> diff --git a/src/tasks/AppleAppBuilder/AppleAppBuilder.cs b/src/tasks/AppleAppBuilder/AppleAppBuilder.cs index 89c70340f63c73..34fa7cb1674cd8 100644 --- a/src/tasks/AppleAppBuilder/AppleAppBuilder.cs +++ b/src/tasks/AppleAppBuilder/AppleAppBuilder.cs @@ -197,11 +197,6 @@ public string TargetOS /// public bool IsLibraryMode { get; set; } - /// - /// Static linked runtime - /// - public bool StaticLinkedRuntime { get; set; } = true; - public void ValidateRuntimeSelection() { if (!Enum.TryParse(Runtime, out targetRuntime)) @@ -355,7 +350,7 @@ public override bool Execute() if (GenerateXcodeProject) { XcodeProjectPath = generator.GenerateXCode(ProjectName, MainLibraryFileName, assemblerFiles, assemblerDataFiles, assemblerFilesToLink, extraLinkerArgs, excludes, - AppDir, binDir, MonoRuntimeHeaders, !shouldStaticLink, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, HybridGlobalization, Optimized, EnableRuntimeLogging, EnableAppSandbox, DiagnosticPorts, RuntimeComponents, environmentVariables, NativeMainSource, targetRuntime, IsLibraryMode, StaticLinkedRuntime); + AppDir, binDir, MonoRuntimeHeaders, !shouldStaticLink, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, HybridGlobalization, Optimized, EnableRuntimeLogging, EnableAppSandbox, DiagnosticPorts, RuntimeComponents, environmentVariables, NativeMainSource, targetRuntime, IsLibraryMode); if (BuildAppBundle) { @@ -381,7 +376,7 @@ public override bool Execute() else if (GenerateCMakeProject) { generator.GenerateCMake(ProjectName, MainLibraryFileName, assemblerFiles, assemblerDataFiles, assemblerFilesToLink, extraLinkerArgs, excludes, - AppDir, binDir, MonoRuntimeHeaders, !shouldStaticLink, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, HybridGlobalization, Optimized, EnableRuntimeLogging, EnableAppSandbox, DiagnosticPorts, RuntimeComponents, environmentVariables, NativeMainSource, targetRuntime, IsLibraryMode, StaticLinkedRuntime); + AppDir, binDir, MonoRuntimeHeaders, !shouldStaticLink, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, HybridGlobalization, Optimized, EnableRuntimeLogging, EnableAppSandbox, DiagnosticPorts, RuntimeComponents, environmentVariables, NativeMainSource, targetRuntime, IsLibraryMode); } return true; diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 2bb167c309fd76..7f5b3d706e2736 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -192,10 +192,9 @@ public string GenerateXCode( IEnumerable environmentVariables, string? nativeMainSource = null, TargetRuntime targetRuntime = TargetRuntime.MonoVM, - bool isLibraryMode = false, - bool staticLinkedRuntime = true) + bool isLibraryMode = false) { - var cmakeDirectoryPath = GenerateCMake(projectName, entryPointLib, asmFiles, asmDataFiles, asmLinkFiles, extraLinkerArgs, excludes, workspace, binDir, monoInclude, preferDylibs, useConsoleUiTemplate, forceAOT, forceInterpreter, invariantGlobalization, hybridGlobalization, optimized, enableRuntimeLogging, enableAppSandbox, diagnosticPorts, runtimeComponents, environmentVariables, nativeMainSource, targetRuntime, isLibraryMode, staticLinkedRuntime); + var cmakeDirectoryPath = GenerateCMake(projectName, entryPointLib, asmFiles, asmDataFiles, asmLinkFiles, extraLinkerArgs, excludes, workspace, binDir, monoInclude, preferDylibs, useConsoleUiTemplate, forceAOT, forceInterpreter, invariantGlobalization, hybridGlobalization, optimized, enableRuntimeLogging, enableAppSandbox, diagnosticPorts, runtimeComponents, environmentVariables, nativeMainSource, targetRuntime, isLibraryMode); CreateXcodeProject(projectName, cmakeDirectoryPath); return Path.Combine(binDir, projectName, projectName + ".xcodeproj"); } @@ -267,8 +266,7 @@ public string GenerateCMake( IEnumerable environmentVariables, string? nativeMainSource = null, TargetRuntime targetRuntime = TargetRuntime.MonoVM, - bool isLibraryMode = false, - bool staticLinkedRuntime = true) + bool isLibraryMode = false) { // bundle everything as resources excluding native files var predefinedExcludes = new List { ".dll.o", ".dll.s", ".dwarf", ".m", ".h", ".a", ".bc", "libmonosgen-2.0.dylib", "icudt*" }; @@ -416,28 +414,17 @@ public string GenerateCMake( toLink += $" \"-force_load {componentLibToLink}\"{Environment.NewLine}"; } - string[] dylibs = Directory.GetFiles(workspace, "*.dylib"); if (targetRuntime == TargetRuntime.CoreCLR) { - - if (staticLinkedRuntime) - { - string[] staticLibs = Directory.GetFiles(workspace, "*.a"); - foreach (string lib in staticLibs) - { - toLink += $" \"{lib}\"{Environment.NewLine}"; - } - } - else + string[] staticLibs = Directory.GetFiles(workspace, "*.a"); + foreach (string lib in staticLibs) { - foreach (string lib in dylibs) - { - toLink += $" \"-force_load {lib}\"{Environment.NewLine}"; - } + toLink += $" \"{lib}\"{Environment.NewLine}"; } } else { + string[] dylibs = Directory.GetFiles(workspace, "*.dylib"); // Sort the static libraries to link so the brotli libs are added to the list last (after the compression native libs) List staticLibsToLink = Directory.GetFiles(workspace, "*.a").OrderBy(libName => libName.Contains("brotli") ? 1 : 0).ToList(); foreach (string lib in staticLibsToLink) diff --git a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj deleted file mode 100644 index 47571b0fca112c..00000000000000 --- a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Static.Test.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - Exe - false - false - false - true - $(NetCoreAppCurrent) - iossimulator - iOS.Simulator.CoreCLR.Interpreter.Static.Test.dll - false - 42 - - - - - - - - - - diff --git a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj index 6e8c611bf4f7c7..60b9447ba0c895 100644 --- a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj +++ b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj @@ -10,7 +10,6 @@ iOS.Simulator.CoreCLR.Interpreter.Test.dll false 42 - false From ff4b381391e7e2a5ce7bf33a1f2a5d0d6e86d799 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 21 Aug 2025 11:52:39 +0200 Subject: [PATCH 07/16] Add comment --- src/tasks/AppleAppBuilder/Xcode.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 7f5b3d706e2736..3d1590b187c5ee 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -416,6 +416,8 @@ public string GenerateCMake( if (targetRuntime == TargetRuntime.CoreCLR) { + // Interpreter-FIXME: CoreCLR on iOS currently supports only static linking. + // The build system needs to be updated to conditionally initialize the compiler at runtime based on an environment variable. string[] staticLibs = Directory.GetFiles(workspace, "*.a"); foreach (string lib in staticLibs) { From d8d96a7c0ce797bc8d472bc529d5b32cf0f62e9c Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 21 Aug 2025 16:55:55 +0200 Subject: [PATCH 08/16] Simplify CMakeLists.txt --- src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt index e997d08de18abc..4c66a875532d06 100644 --- a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt @@ -203,10 +203,11 @@ endif(NOT CLR_CMAKE_HOST_ARCH_WASM) target_link_libraries(coreclr_static PUBLIC ${CORECLR_LIBRARIES} cee_wks_core ${CORECLR_STATIC_CLRJIT_STATIC} ${CEE_WKS_STATIC} ${FOUNDATION}) target_compile_definitions(coreclr_static PUBLIC CORECLR_EMBEDDED) +if (CLR_CMAKE_HOST_ANDROID) + target_link_libraries(coreclr PUBLIC log) +endif() + if (CLR_CMAKE_HOST_ANDROID OR CLR_CMAKE_HOST_IOS OR CLR_CMAKE_HOST_TVOS OR CLR_CMAKE_HOST_MACCATALYST) - if (CLR_CMAKE_HOST_ANDROID) - target_link_libraries(coreclr PUBLIC log) - endif() target_link_libraries(coreclr_static PUBLIC coreclrminipal_objects From abb4b9f54aab3f38f3dcc2e5156f66d697b75131 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 21 Aug 2025 17:36:25 +0200 Subject: [PATCH 09/16] Test checked build --- .../runtime-extra-platforms-ioslikesimulator.yml | 2 +- src/coreclr/vm/eeconfig.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml index a60929598a50ea..80f29f2d8567eb 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml @@ -142,7 +142,7 @@ jobs: parameters: jobTemplate: /eng/pipelines/common/global-build-job.yml helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml - buildConfig: debug + buildConfig: checked runtimeFlavor: coreclr isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }} isiOSLikeSimulatorOnlyBuild: ${{ parameters.isiOSLikeSimulatorOnlyBuild }} diff --git a/src/coreclr/vm/eeconfig.cpp b/src/coreclr/vm/eeconfig.cpp index 2b7c2c3bd71bfa..c2422dfc8ed37c 100644 --- a/src/coreclr/vm/eeconfig.cpp +++ b/src/coreclr/vm/eeconfig.cpp @@ -639,7 +639,7 @@ HRESULT EEConfig::sync() #if defined(FEATURE_INTERPRETER) if (fTieredCompilation) { - // Disable tiered compilation for interpreter testing. Tiered compilation and interpreter + // Disable tiered compilation for interpreter testing. Tiered compilation and interpreter // do not work well together currently. LPWSTR pwzInterpreterMaybe; IfFailThrow(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_Interpreter, &pwzInterpreterMaybe)); @@ -651,6 +651,9 @@ HRESULT EEConfig::sync() { fTieredCompilation = false; } +#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST) + fTieredCompilation = false; +#endif } #endif From c48d3833f0bd7bd7c4471b7ba15a05f01f5c77ed Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 22 Aug 2025 16:58:45 +0200 Subject: [PATCH 10/16] Fix exchange instruction size --- eng/native/configurecompiler.cmake | 6 +++++ eng/native/configureplatform.cmake | 24 ++++++++++++------- src/coreclr/inc/clrconfigvalues.h | 5 ---- src/coreclr/interpreter/eeinterp.cpp | 4 ++-- src/coreclr/interpreter/intops.def | 4 ++-- src/coreclr/vm/codeman.cpp | 2 ++ src/coreclr/vm/eeconfig.cpp | 3 --- .../msbuild/apple/build/AppleBuild.targets | 5 ++++ ....Simulator.CoreCLR.Interpreter.Test.csproj | 2 +- 9 files changed, 34 insertions(+), 21 deletions(-) diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 3c15b9ff389f27..13aee49673fee5 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -716,6 +716,12 @@ if(CLR_CMAKE_TARGET_UNIX) if(CLR_CMAKE_TARGET_APPLE) add_compile_definitions($<$>>:TARGET_APPLE>) endif() + if(CLR_CMAKE_TARGET_APPLE_MOBILE) + add_compile_definitions($<$>>:TARGET_APPLE_MOBILE>) + endif() + if(CLR_CMAKE_TARGET_APPLE_MOBILE_SIMULATOR) + add_compile_definitions($<$>>:TARGET_APPLE_MOBILE_SIMULATOR>) + endif() if(CLR_CMAKE_TARGET_OSX) add_compile_definitions($<$>>:TARGET_OSX>) elseif(CLR_CMAKE_TARGET_MACCATALYST) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 0855b88bffed1a..615c9b0a431dbd 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -116,7 +116,7 @@ if(CLR_CMAKE_HOST_OS STREQUAL darwin) set(CMAKE_ASM_COMPILE_OBJECT "${CMAKE_C_COMPILER} -o -c ") endif(CLR_CMAKE_HOST_OS STREQUAL darwin) -if(CLR_CMAKE_HOST_OS STREQUAL ios OR CLR_CMAKE_HOST_OS STREQUAL iossimulator) +if(CLR_CMAKE_HOST_OS STREQUAL ios) set(CLR_CMAKE_HOST_UNIX 1) set(CLR_CMAKE_HOST_APPLE 1) set(CLR_CMAKE_HOST_IOS 1) @@ -131,9 +131,9 @@ if(CLR_CMAKE_HOST_OS STREQUAL ios OR CLR_CMAKE_HOST_OS STREQUAL iossimulator) else() clr_unknown_arch() endif() -endif(CLR_CMAKE_HOST_OS STREQUAL ios OR CLR_CMAKE_HOST_OS STREQUAL iossimulator) +endif(CLR_CMAKE_HOST_OS STREQUAL ios) -if(CLR_CMAKE_HOST_OS STREQUAL tvos OR CLR_CMAKE_HOST_OS STREQUAL tvossimulator) +if(CLR_CMAKE_HOST_OS STREQUAL tvos) set(CLR_CMAKE_HOST_UNIX 1) set(CLR_CMAKE_HOST_APPLE 1) set(CLR_CMAKE_HOST_TVOS 1) @@ -144,7 +144,7 @@ if(CLR_CMAKE_HOST_OS STREQUAL tvos OR CLR_CMAKE_HOST_OS STREQUAL tvossimulator) else() clr_unknown_arch() endif() -endif(CLR_CMAKE_HOST_OS STREQUAL tvos OR CLR_CMAKE_HOST_OS STREQUAL tvossimulator) +endif(CLR_CMAKE_HOST_OS STREQUAL tvos) if(CLR_CMAKE_HOST_OS STREQUAL android) set(CLR_CMAKE_HOST_UNIX 1) @@ -392,17 +392,25 @@ if(CLR_CMAKE_TARGET_OS STREQUAL darwin) endif(CMAKE_SYSTEM_VARIANT STREQUAL maccatalyst) endif(CLR_CMAKE_TARGET_OS STREQUAL darwin) -if(CLR_CMAKE_TARGET_OS STREQUAL ios OR CLR_CMAKE_TARGET_OS STREQUAL iossimulator) +if(CLR_CMAKE_TARGET_OS STREQUAL ios) set(CLR_CMAKE_TARGET_UNIX 1) set(CLR_CMAKE_TARGET_APPLE 1) set(CLR_CMAKE_TARGET_IOS 1) -endif(CLR_CMAKE_TARGET_OS STREQUAL ios OR CLR_CMAKE_TARGET_OS STREQUAL iossimulator) + set(CLR_CMAKE_TARGET_APPLE_MOBILE 1) + if(CLI_CMAKE_FALLBACK_OS STREQUAL iossimulator) + set(CLR_CMAKE_TARGET_APPLE_MOBILE_SIMULATOR 1) + endif() +endif(CLR_CMAKE_TARGET_OS STREQUAL ios) -if(CLR_CMAKE_TARGET_OS STREQUAL tvos OR CLR_CMAKE_TARGET_OS STREQUAL tvossimulator) +if(CLR_CMAKE_TARGET_OS STREQUAL tvos) set(CLR_CMAKE_TARGET_UNIX 1) set(CLR_CMAKE_TARGET_APPLE 1) set(CLR_CMAKE_TARGET_TVOS 1) -endif(CLR_CMAKE_TARGET_OS STREQUAL tvos OR CLR_CMAKE_TARGET_OS STREQUAL tvossimulator) + set(CLR_CMAKE_TARGET_APPLE_MOBILE 1) + if(CLI_CMAKE_FALLBACK_OS STREQUAL tvossimulator) + set(CLR_CMAKE_TARGET_APPLE_MOBILE_SIMULATOR 1) + endif() +endif(CLR_CMAKE_TARGET_OS STREQUAL tvos) if(CLR_CMAKE_TARGET_OS STREQUAL freebsd) set(CLR_CMAKE_TARGET_UNIX 1) diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index e7abed3f929605..ec972121420f2a 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -573,12 +573,7 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_CreateDumpDiagnostics, W("CreateDumpDiagnostic /// R2R /// RETAIL_CONFIG_STRING_INFO(INTERNAL_NativeImageSearchPaths, W("NativeImageSearchPaths"), "Extra search paths for native composite R2R images") - -#if defined(FEATURE_INTERPRETER) && (defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)) -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ReadyToRun, W("ReadyToRun"), 0, "Enable/disable use of ReadyToRun native code") // Off by default for Apple mobile platforms with interpreter -#else RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ReadyToRun, W("ReadyToRun"), 1, "Enable/disable use of ReadyToRun native code") // On by default for CoreCLR -#endif RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunExcludeList, W("ReadyToRunExcludeList"), "List of assemblies that cannot use Ready to Run images") RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunLogFile, W("ReadyToRunLogFile"), "Name of file to log success/failure of using Ready to Run images") diff --git a/src/coreclr/interpreter/eeinterp.cpp b/src/coreclr/interpreter/eeinterp.cpp index 0f170867a3dd30..d0351825e06120 100644 --- a/src/coreclr/interpreter/eeinterp.cpp +++ b/src/coreclr/interpreter/eeinterp.cpp @@ -85,8 +85,8 @@ CorJitResult CILInterp::compileMethod(ICorJitInfo* compHnd, break; } -#if defined(TARGET_WASM) || defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST) - // interpret everything on wasm and apple mobile +#ifdef TARGET_WASM + // interpret everything on wasm doInterpret = true; #else // NOTE: We do this check even if doInterpret==true in order to populate g_interpModule diff --git a/src/coreclr/interpreter/intops.def b/src/coreclr/interpreter/intops.def index e8a5f106cdf79a..0f01ac456e00e4 100644 --- a/src/coreclr/interpreter/intops.def +++ b/src/coreclr/interpreter/intops.def @@ -414,8 +414,8 @@ OPDEF(INTOP_LOAD_FRAMEVAR, "load.framevar", 2, 1, 0, InterpOpNoArgs) // Intrinsics OPDEF(INTOP_COMPARE_EXCHANGE_I4, "compare.exchange.i4", 5, 1, 3, InterpOpNoArgs) OPDEF(INTOP_COMPARE_EXCHANGE_I8, "compare.exchange.i8", 5, 1, 3, InterpOpNoArgs) -OPDEF(INTOP_EXCHANGE_I4, "exchange.i4", 3, 1, 2, InterpOpNoArgs) -OPDEF(INTOP_EXCHANGE_I8, "exchange.i8", 3, 1, 2, InterpOpNoArgs) +OPDEF(INTOP_EXCHANGE_I4, "exchange.i4", 4, 1, 2, InterpOpNoArgs) +OPDEF(INTOP_EXCHANGE_I8, "exchange.i8", 4, 1, 2, InterpOpNoArgs) // All instructions after this point are IROPS, instructions that are not emitted/executed OPDEF(INTOP_NOP, "nop", 1, 0, 0, InterpOpNoArgs) diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index ed6bebc1f371b8..54fadc597234e3 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1184,6 +1184,8 @@ void EEJitManager::SetCpuInfo() { #if defined(TARGET_X86) || defined(TARGET_AMD64) EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("\nThe current CPU is missing one or more of the following instruction sets: SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT\n")); +#elif defined(TARGET_APPLE_MOBILE_SIMULATOR) + // iOS and tvOS simulators don't have required instruction sets #elif defined(TARGET_ARM64) && (defined(TARGET_WINDOWS) || defined(TARGET_APPLE)) EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("\nThe current CPU is missing one or more of the following instruction sets: AdvSimd, LSE\n")); #elif defined(TARGET_ARM64) diff --git a/src/coreclr/vm/eeconfig.cpp b/src/coreclr/vm/eeconfig.cpp index c2422dfc8ed37c..3747a07d3295f9 100644 --- a/src/coreclr/vm/eeconfig.cpp +++ b/src/coreclr/vm/eeconfig.cpp @@ -651,9 +651,6 @@ HRESULT EEConfig::sync() { fTieredCompilation = false; } -#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST) - fTieredCompilation = false; -#endif } #endif diff --git a/src/mono/msbuild/apple/build/AppleBuild.targets b/src/mono/msbuild/apple/build/AppleBuild.targets index 17dd0f47455fb9..08f925649eb13f 100644 --- a/src/mono/msbuild/apple/build/AppleBuild.targets +++ b/src/mono/msbuild/apple/build/AppleBuild.targets @@ -99,6 +99,11 @@ + + + diff --git a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj index 60b9447ba0c895..23315975066cd6 100644 --- a/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj +++ b/src/tests/FunctionalTests/iOS/Simulator/CoreCLR.Interpreter/iOS.Simulator.CoreCLR.Interpreter.Test.csproj @@ -13,7 +13,7 @@ - + From 20b5a6e3aa7ae13be5400e16ae767c5a9a7af885 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 22 Aug 2025 17:08:06 +0200 Subject: [PATCH 11/16] Update CLR feature flags for Apple mobile targets in CMake --- src/coreclr/clrfeatures.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/clrfeatures.cmake b/src/coreclr/clrfeatures.cmake index 3b4fb203ee2c51..3597341314a76e 100644 --- a/src/coreclr/clrfeatures.cmake +++ b/src/coreclr/clrfeatures.cmake @@ -1,8 +1,8 @@ -if (NOT CLR_CMAKE_TARGET_ARCH_WASM AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_MACCATALYST) +if (NOT CLR_CMAKE_TARGET_ARCH_WASM AND NOT CLR_CMAKE_TARGET_APPLE_MOBILE) set(FEATURE_JIT 1) endif() -if (CLR_CMAKE_TARGET_ARCH_WASM OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS OR CLR_CMAKE_TARGET_MACCATALYST) +if (CLR_CMAKE_TARGET_ARCH_WASM OR CLR_CMAKE_TARGET_APPLE_MOBILE) set(FEATURE_STATICALLY_LINKED 1) endif() From 7c3d81eb483385598c1bea6aedcb5492b56e010c Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 22 Aug 2025 22:41:20 +0200 Subject: [PATCH 12/16] Skip hardware intrinsics check --- eng/native/configurecompiler.cmake | 6 ------ eng/native/configureplatform.cmake | 24 ++++++++---------------- src/coreclr/vm/codeman.cpp | 6 ++++-- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 13aee49673fee5..3c15b9ff389f27 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -716,12 +716,6 @@ if(CLR_CMAKE_TARGET_UNIX) if(CLR_CMAKE_TARGET_APPLE) add_compile_definitions($<$>>:TARGET_APPLE>) endif() - if(CLR_CMAKE_TARGET_APPLE_MOBILE) - add_compile_definitions($<$>>:TARGET_APPLE_MOBILE>) - endif() - if(CLR_CMAKE_TARGET_APPLE_MOBILE_SIMULATOR) - add_compile_definitions($<$>>:TARGET_APPLE_MOBILE_SIMULATOR>) - endif() if(CLR_CMAKE_TARGET_OSX) add_compile_definitions($<$>>:TARGET_OSX>) elseif(CLR_CMAKE_TARGET_MACCATALYST) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 615c9b0a431dbd..0855b88bffed1a 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -116,7 +116,7 @@ if(CLR_CMAKE_HOST_OS STREQUAL darwin) set(CMAKE_ASM_COMPILE_OBJECT "${CMAKE_C_COMPILER} -o -c ") endif(CLR_CMAKE_HOST_OS STREQUAL darwin) -if(CLR_CMAKE_HOST_OS STREQUAL ios) +if(CLR_CMAKE_HOST_OS STREQUAL ios OR CLR_CMAKE_HOST_OS STREQUAL iossimulator) set(CLR_CMAKE_HOST_UNIX 1) set(CLR_CMAKE_HOST_APPLE 1) set(CLR_CMAKE_HOST_IOS 1) @@ -131,9 +131,9 @@ if(CLR_CMAKE_HOST_OS STREQUAL ios) else() clr_unknown_arch() endif() -endif(CLR_CMAKE_HOST_OS STREQUAL ios) +endif(CLR_CMAKE_HOST_OS STREQUAL ios OR CLR_CMAKE_HOST_OS STREQUAL iossimulator) -if(CLR_CMAKE_HOST_OS STREQUAL tvos) +if(CLR_CMAKE_HOST_OS STREQUAL tvos OR CLR_CMAKE_HOST_OS STREQUAL tvossimulator) set(CLR_CMAKE_HOST_UNIX 1) set(CLR_CMAKE_HOST_APPLE 1) set(CLR_CMAKE_HOST_TVOS 1) @@ -144,7 +144,7 @@ if(CLR_CMAKE_HOST_OS STREQUAL tvos) else() clr_unknown_arch() endif() -endif(CLR_CMAKE_HOST_OS STREQUAL tvos) +endif(CLR_CMAKE_HOST_OS STREQUAL tvos OR CLR_CMAKE_HOST_OS STREQUAL tvossimulator) if(CLR_CMAKE_HOST_OS STREQUAL android) set(CLR_CMAKE_HOST_UNIX 1) @@ -392,25 +392,17 @@ if(CLR_CMAKE_TARGET_OS STREQUAL darwin) endif(CMAKE_SYSTEM_VARIANT STREQUAL maccatalyst) endif(CLR_CMAKE_TARGET_OS STREQUAL darwin) -if(CLR_CMAKE_TARGET_OS STREQUAL ios) +if(CLR_CMAKE_TARGET_OS STREQUAL ios OR CLR_CMAKE_TARGET_OS STREQUAL iossimulator) set(CLR_CMAKE_TARGET_UNIX 1) set(CLR_CMAKE_TARGET_APPLE 1) set(CLR_CMAKE_TARGET_IOS 1) - set(CLR_CMAKE_TARGET_APPLE_MOBILE 1) - if(CLI_CMAKE_FALLBACK_OS STREQUAL iossimulator) - set(CLR_CMAKE_TARGET_APPLE_MOBILE_SIMULATOR 1) - endif() -endif(CLR_CMAKE_TARGET_OS STREQUAL ios) +endif(CLR_CMAKE_TARGET_OS STREQUAL ios OR CLR_CMAKE_TARGET_OS STREQUAL iossimulator) -if(CLR_CMAKE_TARGET_OS STREQUAL tvos) +if(CLR_CMAKE_TARGET_OS STREQUAL tvos OR CLR_CMAKE_TARGET_OS STREQUAL tvossimulator) set(CLR_CMAKE_TARGET_UNIX 1) set(CLR_CMAKE_TARGET_APPLE 1) set(CLR_CMAKE_TARGET_TVOS 1) - set(CLR_CMAKE_TARGET_APPLE_MOBILE 1) - if(CLI_CMAKE_FALLBACK_OS STREQUAL tvossimulator) - set(CLR_CMAKE_TARGET_APPLE_MOBILE_SIMULATOR 1) - endif() -endif(CLR_CMAKE_TARGET_OS STREQUAL tvos) +endif(CLR_CMAKE_TARGET_OS STREQUAL tvos OR CLR_CMAKE_TARGET_OS STREQUAL tvossimulator) if(CLR_CMAKE_TARGET_OS STREQUAL freebsd) set(CLR_CMAKE_TARGET_UNIX 1) diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index 54fadc597234e3..1b948d7f77a9cc 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1184,10 +1184,12 @@ void EEJitManager::SetCpuInfo() { #if defined(TARGET_X86) || defined(TARGET_AMD64) EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("\nThe current CPU is missing one or more of the following instruction sets: SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT\n")); -#elif defined(TARGET_APPLE_MOBILE_SIMULATOR) - // iOS and tvOS simulators don't have required instruction sets #elif defined(TARGET_ARM64) && (defined(TARGET_WINDOWS) || defined(TARGET_APPLE)) +#if defined(FEATURE_INTERPRETER) + // Hardware intrinsics are disabled in CoreCLR interpreter: https://github.com/dotnet/runtime/issues/117948 +#else EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("\nThe current CPU is missing one or more of the following instruction sets: AdvSimd, LSE\n")); +#endif #elif defined(TARGET_ARM64) EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("\nThe current CPU is missing one or more of the following instruction sets: AdvSimd\n")); #else From 1f55447036944b7938c2d77bb6ee684222e25d18 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 22 Aug 2025 22:43:43 +0200 Subject: [PATCH 13/16] Fix clrfeatures condition --- src/coreclr/clrfeatures.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/clrfeatures.cmake b/src/coreclr/clrfeatures.cmake index 3597341314a76e..3b4fb203ee2c51 100644 --- a/src/coreclr/clrfeatures.cmake +++ b/src/coreclr/clrfeatures.cmake @@ -1,8 +1,8 @@ -if (NOT CLR_CMAKE_TARGET_ARCH_WASM AND NOT CLR_CMAKE_TARGET_APPLE_MOBILE) +if (NOT CLR_CMAKE_TARGET_ARCH_WASM AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_MACCATALYST) set(FEATURE_JIT 1) endif() -if (CLR_CMAKE_TARGET_ARCH_WASM OR CLR_CMAKE_TARGET_APPLE_MOBILE) +if (CLR_CMAKE_TARGET_ARCH_WASM OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS OR CLR_CMAKE_TARGET_MACCATALYST) set(FEATURE_STATICALLY_LINKED 1) endif() From 1a7b1db3cf58da9c6d50d5664417845acec07110 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 22 Aug 2025 23:39:45 +0200 Subject: [PATCH 14/16] Add hw.optional.arm.AdvSIMD check --- src/coreclr/vm/codeman.cpp | 4 ---- src/native/minipal/cpufeatures.c | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index 1b948d7f77a9cc..ed6bebc1f371b8 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1185,11 +1185,7 @@ void EEJitManager::SetCpuInfo() #if defined(TARGET_X86) || defined(TARGET_AMD64) EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("\nThe current CPU is missing one or more of the following instruction sets: SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT\n")); #elif defined(TARGET_ARM64) && (defined(TARGET_WINDOWS) || defined(TARGET_APPLE)) -#if defined(FEATURE_INTERPRETER) - // Hardware intrinsics are disabled in CoreCLR interpreter: https://github.com/dotnet/runtime/issues/117948 -#else EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("\nThe current CPU is missing one or more of the following instruction sets: AdvSimd, LSE\n")); -#endif #elif defined(TARGET_ARM64) EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("\nThe current CPU is missing one or more of the following instruction sets: AdvSimd\n")); #else diff --git a/src/native/minipal/cpufeatures.c b/src/native/minipal/cpufeatures.c index b49336a8843655..bfcca50d1608d8 100644 --- a/src/native/minipal/cpufeatures.c +++ b/src/native/minipal/cpufeatures.c @@ -502,7 +502,8 @@ int minipal_getcpufeatures(void) int64_t valueFromSysctl = 0; size_t sz = sizeof(valueFromSysctl); - if ((sysctlbyname("hw.optional.AdvSIMD", &valueFromSysctl, &sz, NULL, 0) != 0) || (valueFromSysctl == 0) || + if ((((sysctlbyname("hw.optional.AdvSIMD", &valueFromSysctl, &sz, NULL, 0) != 0) || (valueFromSysctl == 0)) && + ((sysctlbyname("hw.optional.arm.AdvSIMD", &valueFromSysctl, &sz, NULL, 0) != 0) || (valueFromSysctl == 0))) || (sysctlbyname("hw.optional.arm.FEAT_LSE", &valueFromSysctl, &sz, NULL, 0) != 0) || (valueFromSysctl == 0)) { // One of the baseline ISAs is not supported From 42866bb52713e3bf8655eafba503a2cf5d6acb88 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 22 Aug 2025 23:49:05 +0200 Subject: [PATCH 15/16] Add tracking issue --- src/tasks/AppleAppBuilder/Xcode.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 3d1590b187c5ee..afe16fceb5fc53 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -418,6 +418,7 @@ public string GenerateCMake( { // Interpreter-FIXME: CoreCLR on iOS currently supports only static linking. // The build system needs to be updated to conditionally initialize the compiler at runtime based on an environment variable. + // Tracking issue: https://github.com/dotnet/runtime/issues/119006 string[] staticLibs = Directory.GetFiles(workspace, "*.a"); foreach (string lib in staticLibs) { From 73d906150798744e6688e875c5228b64b43766dc Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 25 Aug 2025 12:38:30 +0200 Subject: [PATCH 16/16] Add macros undef in interpexec --- src/coreclr/vm/interpexec.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/coreclr/vm/interpexec.cpp b/src/coreclr/vm/interpexec.cpp index a1c81606e5cc1d..68a805f05a12a8 100644 --- a/src/coreclr/vm/interpexec.cpp +++ b/src/coreclr/vm/interpexec.cpp @@ -646,6 +646,7 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr // Normal moves between vars case INTOP_MOV_4: MOV(int32_t, int32_t); break; case INTOP_MOV_8: MOV(int64_t, int64_t); break; +#undef MOV case INTOP_MOV_VT: memmove(stack + ip[1], stack + ip[2], ip[3]); @@ -1016,6 +1017,7 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr case INTOP_BRTRUE_I8: BR_UNOP(int64_t, != 0); break; +#undef BR_UNOP #define BR_BINOP_COND(cond) \ if (cond) \ @@ -1226,6 +1228,8 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr BR_BINOP_COND(isunordered(d1, d2) || d1 < d2); break; } +#undef BR_BINOP_COND +#undef BR_BINOP case INTOP_ADD_I4: LOCAL_VAR(ip[1], int32_t) = LOCAL_VAR(ip[2], int32_t) + LOCAL_VAR(ip[3], int32_t); @@ -1682,6 +1686,7 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr case INTOP_CLT_UN_R8: CMP_BINOP_FP(double, <, 1); break; +#undef CMP_BINOP_FP #define LDIND(dtype, ftype) \ do { \ @@ -1715,6 +1720,7 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr case INTOP_LDIND_R8: LDIND(double, double); break; +#undef LDIND case INTOP_LDIND_VT: { char *src = LOCAL_VAR(ip[2], char*); @@ -1757,6 +1763,7 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr case INTOP_STIND_R8: STIND(double, double); break; +#undef STIND case INTOP_STIND_O: { char *dst = LOCAL_VAR(ip[1], char*); @@ -2349,6 +2356,7 @@ do { \ LDELEM(double, double); break; } +#undef LDELEM case INTOP_LDELEM_REF: { BASEARRAYREF arrayRef = LOCAL_VAR(ip[2], BASEARRAYREF); @@ -2435,6 +2443,7 @@ do { \ STELEM(double, double); break; } +#undef STELEM case INTOP_STELEM_REF: { BASEARRAYREF arrayRef = LOCAL_VAR(ip[1], BASEARRAYREF); @@ -2613,6 +2622,7 @@ do \ COMPARE_EXCHANGE(int64_t); break; } +#undef COMPARE_EXCHANGE #define EXCHANGE(type) \ do \