diff --git a/eng/pipelines/runtime-staging.yml b/eng/pipelines/runtime-staging.yml index 2abbda21953ae3..e716216f09c46d 100644 --- a/eng/pipelines/runtime-staging.yml +++ b/eng/pipelines/runtime-staging.yml @@ -66,7 +66,6 @@ jobs: platforms: - iOSSimulator_x64 - tvOSSimulator_x64 - - MacCatalyst_x64 variables: # map dependencies variables to local variables - name: librariesContainsChange @@ -96,6 +95,48 @@ jobs: eq(variables['monoContainsChange'], true), eq(variables['isFullMatrix'], true)) +# +# MacCatalyst interp - requires AOT Compilation and Interp flags +# Build the whole product using Mono and run libraries tests +# +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml + buildConfig: Release + runtimeFlavor: mono + platforms: + - MacCatalyst_x64 + - MacCatalyst_arm64 + variables: + # map dependencies variables to local variables + - name: librariesContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ] + - name: monoContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ] + jobParameters: + testGroup: innerloop + nameSuffix: AllSubsets_Mono + buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunAOTCompilation=true /p:MonoForceInterpreter=true + timeoutInMinutes: 180 + condition: >- + or( + eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), + eq(variables['isFullMatrix'], true)) + # extra steps, run tests + extraStepsTemplate: /eng/pipelines/libraries/helix.yml + extraStepsParameters: + creator: dotnet-bot + interpreter: true + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) + # # Build the whole product using Mono and run libraries tests # diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index 2fedf68d956005..1a8c3d9405909d 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -160,8 +160,16 @@ AppleTestRunner.dll <_MobileIntermediateOutputPath Condition="'$(RunAOTCompilation)' == 'true'">$(IntermediateOutputPath)mobile + + Full + Full + JustInterp + - + <_AotExcludeAssemblies Include="$(PublishDir)System.Runtime.WindowsRuntime.dll" /> + <_AotExcludeAssemblies Include="@(NativeLibraries->'$(PublishDir)%(Identity)')" /> + + @(MonoAOTCompilerDefaultAotArguments, ';') @(MonoAOTCompilerDefaultProcessArguments, ';') @@ -175,7 +183,7 @@ PreserveNewest + + + + + diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index 22cf849b4460f2..801610da782fbc 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -160,11 +160,11 @@ if(NOT AOT_TARGET_TRIPLE STREQUAL "") elseif(AOT_TARGET_TRIPLE STREQUAL "x86_64-apple-maccatalyst") set(TARGET_SYSTEM_NAME "Darwin") set(TARGET_ARCH "x86_64") - set(CMAKE_SYSTEM_VARIANT "MacCatalyst") + set(TARGET_MACCAT 1) elseif(AOT_TARGET_TRIPLE STREQUAL "aarch64-apple-maccatalyst") set(TARGET_SYSTEM_NAME "Darwin") set(TARGET_ARCH "arm64") - set(CMAKE_SYSTEM_VARIANT "MacCatalyst") + set(TARGET_MACCAT 1) elseif(AOT_TARGET_TRIPLE STREQUAL "wasm32-unknown-none") set(TARGET_SYSTEM_NAME "Emscripten") set(TARGET_ARCH "wasm") @@ -296,9 +296,6 @@ if(TARGET_SYSTEM_NAME STREQUAL "Darwin") set(TARGET_MACH 1) set(TARGET_OSX 1) set(TARGET_DARWIN 1) - if(CMAKE_SYSTEM_VARIANT STREQUAL "MacCatalyst") - set(TARGET_MACCAT 1) - endif() elseif(TARGET_SYSTEM_NAME STREQUAL "iOS" OR TARGET_SYSTEM_NAME STREQUAL "tvOS") set(TARGET_MACH 1) set(TARGET_IOS 1) @@ -744,7 +741,7 @@ set(FULL_VERSION ${product_version_string}) ###################################### # OS SPECIFIC CHECKS ###################################### -if(TARGET_IOS OR TARGET_ANDROID OR TARGET_MACCAT) +if(HOST_IOS OR HOST_ANDROID OR HOST_MACCAT) # FIXME: the mobile products use mono_dllmap_insert so allow this unset(DISABLE_DLLMAP) else() diff --git a/src/mono/Directory.Build.props b/src/mono/Directory.Build.props index 356a3175019ad8..2eb7bc5647519c 100644 --- a/src/mono/Directory.Build.props +++ b/src/mono/Directory.Build.props @@ -18,7 +18,8 @@ 2.0 5.1 10.13 - 11.0 + + 11.0 diff --git a/src/mono/mono/utils/mono-mmap.c b/src/mono/mono/utils/mono-mmap.c index e362b698dc454c..08ce984f25e6c5 100644 --- a/src/mono/mono/utils/mono-mmap.c +++ b/src/mono/mono/utils/mono-mmap.c @@ -305,7 +305,7 @@ mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type) } if ((flags & MONO_MMAP_JIT) && (use_mmap_jit || is_hardened_runtime == 1)) mflags |= MAP_JIT; -#if defined(HOST_ARM64) +#if defined(HOST_ARM64) && !defined(HOST_MACCAT) /* Patching code on apple silicon seems to cause random crashes without this flag */ /* No __builtin_available in old versions of Xcode that could be building Mono on x86 or amd64 */ if (__builtin_available (macOS 11, *)) diff --git a/src/tasks/AppleAppBuilder/AppleAppBuilder.cs b/src/tasks/AppleAppBuilder/AppleAppBuilder.cs index 85efde52b045fa..2434ad8300191f 100644 --- a/src/tasks/AppleAppBuilder/AppleAppBuilder.cs +++ b/src/tasks/AppleAppBuilder/AppleAppBuilder.cs @@ -193,7 +193,7 @@ public override bool Execute() throw new InvalidOperationException("Need list of AOT files for device builds."); } - if (ForceInterpreter && ForceAOT) + if (TargetOS != TargetNames.MacCatalyst && ForceInterpreter && ForceAOT) { throw new InvalidOperationException("Interpreter and AOT cannot be enabled at the same time"); } diff --git a/src/tasks/AppleAppBuilder/Templates/runtime.m b/src/tasks/AppleAppBuilder/Templates/runtime.m index 8b8d6d181d00de..03e7e982d9bdea 100644 --- a/src/tasks/AppleAppBuilder/Templates/runtime.m +++ b/src/tasks/AppleAppBuilder/Templates/runtime.m @@ -260,14 +260,22 @@ monovm_initialize (sizeof (appctx_keys) / sizeof (appctx_keys [0]), appctx_keys, appctx_values); -#if FORCE_INTERPRETER +#if (FORCE_INTERPRETER && !FORCE_AOT) + // interp w/ JIT fallback. Assumption is that your configuration can JIT os_log_info (OS_LOG_DEFAULT, "INTERP Enabled"); mono_jit_set_aot_mode (MONO_AOT_MODE_INTERP_ONLY); #elif (!TARGET_OS_SIMULATOR && !TARGET_OS_MACCATALYST) || FORCE_AOT register_dllmap (); // register modules register_aot_modules (); + +#if (FORCE_INTERPRETER && TARGET_OS_MACCATALYST) + os_log_info (OS_LOG_DEFAULT, "AOT INTERP Enabled"); + mono_jit_set_aot_mode (MONO_AOT_MODE_INTERP); +#else mono_jit_set_aot_mode (MONO_AOT_MODE_FULL); +#endif + #endif mono_debug_init (MONO_DEBUG_FORMAT_MONO); diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 3245ba2695a040..34982bb28c36a1 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -197,7 +197,8 @@ public string GenerateXCode( { defines.AppendLine("add_definitions(-DFORCE_INTERPRETER=1)"); } - else if (forceAOT) + + if (forceAOT) { defines.AppendLine("add_definitions(-DFORCE_AOT=1)"); }