platforms:
- iOSSimulator_x64
- tvOSSimulator_x64
- - MacCatalyst_x64
variables:
# map dependencies variables to local variables
- name: librariesContainsChange
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
#
- template: /eng/pipelines/common/platform-matrix.yml
<MainLibraryFileName Condition="'$(MainLibraryFileName)' == ''">AppleTestRunner.dll</MainLibraryFileName>
<_MobileIntermediateOutputPath Condition="'$(RunAOTCompilation)' == 'true'">$(IntermediateOutputPath)mobile</_MobileIntermediateOutputPath>
</PropertyGroup>
+ <PropertyGroup>
+ <AOTMode Condition="'$(TargetOS)' != 'MacCatalyst'">Full</AOTMode>
+ <AOTMode Condition="'$(TargetOS)' == 'MacCatalyst' and '$(MonoForceInterpreter)' != 'true'">Full</AOTMode>
+ <AOTMode Condition="'$(TargetOS)' == 'MacCatalyst' and '$(MonoForceInterpreter)' == 'true'">JustInterp</AOTMode>
+ </PropertyGroup>
<ItemGroup>
- <AotInputAssemblies Condition="'$(RunAOTCompilation)' == 'true'" Include="$(PublishDir)*.dll" Exclude="$(PublishDir)System.Runtime.WindowsRuntime.dll">
+ <_AotExcludeAssemblies Include="$(PublishDir)System.Runtime.WindowsRuntime.dll" />
+ <_AotExcludeAssemblies Include="@(NativeLibraries->'$(PublishDir)%(Identity)')" />
+
+ <!-- JustInterp only needs to AOT CoreLib, the other assemblies will just get added to BundleAssemblies via _BundleNonAotAssemblies -->
+ <_AotIncludeAssemblies Condition="'$(RunAOTCompilation)' == 'true' and '$(AOTMode)' == 'JustInterp'" Include="$(PublishDir)System.Private.CoreLib.dll" />
+ <_AotIncludeAssemblies Condition="'$(RunAOTCompilation)' == 'true' and '$(AOTMode)' != 'JustInterp'" Include="$(PublishDir)*.dll" />
+
+ <AotInputAssemblies Condition="'$(RunAOTCompilation)' == 'true'" Include="@(_AotIncludeAssemblies)" Exclude="@(_AotExcludeAssemblies)">
<AotArguments>@(MonoAOTCompilerDefaultAotArguments, ';')</AotArguments>
<ProcessArguments>@(MonoAOTCompilerDefaultProcessArguments, ';')</ProcessArguments>
</AotInputAssemblies>
<BundleAssemblies Condition="'$(RunAOTCompilation)' != 'true'" Include="$(PublishDir)*.dll" />
+ <_BundleNonAotAssemblies Condition="'$(RunAOTCompilation)' == 'true' and '$(AOTMode)' == 'JustInterp'" Include="$(PublishDir)*.dll" Exclude="$(PublishDir)System.Private.CoreLib.dll" />
</ItemGroup>
<MakeDir Directories="$(_MobileIntermediateOutputPath)"
<MonoAOTCompiler Condition="'$(RunAOTCompilation)' == 'true'"
CompilerBinaryPath="$(MonoAotCrossCompilerPath)"
OutputDir="$(_MobileIntermediateOutputPath)"
- Mode="Full"
+ Mode="$(AOTMode)"
OutputType="AsmOnly"
Assemblies="@(AotInputAssemblies)"
AotModulesTablePath="$(BundleDir)\modules.m"
<Output TaskParameter="CompiledAssemblies" ItemName="BundleAssemblies" />
</MonoAOTCompiler>
+ <ItemGroup>
+ <BundleAssemblies Include="@(_BundleNonAotAssemblies)" />
+ </ItemGroup>
+
<!-- Run App bundler, it uses AOT libs (if needed), link all native bits, compile simple UI (written in ObjC)
and produce an app bundle (with xcode project) -->
<AppleAppBuilderTask
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
+ <ItemGroup Condition="'$(RunAOTCompilation)' == 'true'">
+ <!-- Identifies native libraries that should be skipped during AOT -->
+ <NativeLibraries Include="NativeLibrary.dll" />
+ <NativeLibraries Include="SecondNativeLibrary.dll" />
+ </ItemGroup>
<ItemGroup>
<Compile Include="FileVersionInfoTest.cs" />
<Compile Include="AssemblyInfo.cs" />
[InlineData(MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.CopyOnWrite)]
[InlineData(MemoryMappedFileAccess.Read, MemoryMappedFileAccess.Read)]
[InlineData(MemoryMappedFileAccess.Read, MemoryMappedFileAccess.CopyOnWrite)]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/53601", runtimes: TestRuntimes.Mono, platforms: TestPlatforms.MacCatalyst)]
public void ValidAccessLevelCombinations(MemoryMappedFileAccess mapAccess, MemoryMappedFileAccess viewAccess)
{
const int Capacity = 4096;
[InlineData(MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.CopyOnWrite)]
[InlineData(MemoryMappedFileAccess.Read, MemoryMappedFileAccess.Read)]
[InlineData(MemoryMappedFileAccess.Read, MemoryMappedFileAccess.CopyOnWrite)]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/53601", runtimes: TestRuntimes.Mono, platforms: TestPlatforms.MacCatalyst)]
public void ValidAccessLevelCombinations(MemoryMappedFileAccess mapAccess, MemoryMappedFileAccess viewAccess)
{
const int Capacity = 4096;
}
[Fact]
+ [ActiveIssue ("https://github.com/dotnet/runtime/issues/53599", platforms: TestPlatforms.MacCatalyst, runtimes: TestRuntimes.Mono)]
public static void ConstructorThrows_StackTrace()
{
Expression<Func<Thrower>> e = () => new Thrower(true);
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")
set(DISABLE_EXECUTABLES 1)
set(DISABLE_CRASH_REPORTING 1)
set(ENABLE_MONOTOUCH 1)
- add_definitions(-DMONOTOUCH=1)
add_definitions("-DSMALL_CONFIG")
add_definitions("-D_XOPEN_SOURCE")
add_definitions("-DHAVE_LARGE_FILE_SUPPORT=1")
set(TARGET_TVOS 1)
endif()
set(ENABLE_MONOTOUCH 1)
- add_definitions(-DMONOTOUCH=1)
elseif(TARGET_SYSTEM_NAME STREQUAL "Linux")
set(TARGET_LINUX 1)
elseif(TARGET_SYSTEM_NAME STREQUAL "Android")
message(FATAL_ERROR "TARGET_ARCH='${TARGET_ARCH}' not supported.")
endif()
+# arm64 MacCatalyst runtime host or AOT target is more like Apple mobile targets than x64
+if ((HOST_MACCAT AND HOST_ARCH STREQUAL "arm64") OR (TARGET_MACCAT AND TARGET_ARCH STREQUAL "arm64"))
+ set(ENABLE_MONOTOUCH 1)
+endif()
+
+if(ENABLE_MONOTOUCH)
+ add_definitions(-DMONOTOUCH=1)
+endif()
+
######################################
# HEADER/FUNCTION CHECKS
######################################
######################################
# 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()
<watchOSVersionMin>2.0</watchOSVersionMin>
<watchOS64_32VersionMin>5.1</watchOS64_32VersionMin>
<macOSVersionMin>10.13</macOSVersionMin>
- <macOSVersionMin Condition="'$(TargetOS)' == 'OSX' and '$(TargetArchitecture)' == 'arm64'">11.0</macOSVersionMin>
+ <!-- FIXME: when we're building ios or tvOS cross-compilers hosted on OSX/arm64 targeting ios/arm64 we should set the min macOS version to 11.0, also -->
+ <macOSVersionMin Condition="('$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'MacCatalyst') and '$(TargetArchitecture)' == 'arm64'">11.0</macOSVersionMin>
<!-- Version of the OS SDK we target -->
<iOSVersion></iOSVersion>
mono_os_mutex_init (&memory_manager->mp_mutex);
memory_manager->_mp = mono_mempool_new ();
- memory_manager->code_mp = mono_code_manager_new ();
+ if (mono_runtime_get_no_exec()) {
+ memory_manager->code_mp = mono_code_manager_new_aot ();
+ } else {
+ memory_manager->code_mp = mono_code_manager_new ();
+ }
memory_manager->lock_free_mp = lock_free_mempool_new ();
memory_manager->alcs = mono_mempool_alloc0 (memory_manager->_mp, sizeof (MonoAssemblyLoadContext *) * nalcs);
#include <mono/metadata/appdomain.h>
#include <mono/metadata/debug-helpers.h>
#include <mono/metadata/assembly.h>
+#include <mono/metadata/assembly-internals.h>
#include <mono/metadata/metadata-internals.h>
#include <mono/metadata/reflection-internals.h>
#include <mono/metadata/marshal.h>
#endif
/* required for mixed mode */
- if (strcmp (acfg->image->assembly->aname.name, "mscorlib") == 0) {
+ if (strcmp (acfg->image->assembly->aname.name, MONO_ASSEMBLY_CORLIB_NAME) == 0) {
add_gc_wrappers (acfg);
for (int i = 0; i < MONO_JIT_ICALL_count; ++i)
msg = g_strdup ("compiled with --aot=full");
usable = FALSE;
}
- if (mono_use_interpreter && !interp && !strcmp (assembly->aname.name, "mscorlib")) {
+ if (mono_use_interpreter && !interp && !strcmp (assembly->aname.name, MONO_ASSEMBLY_CORLIB_NAME)) {
/* mscorlib contains necessary interpreter trampolines */
msg = g_strdup ("not compiled with --aot=interp");
usable = FALSE;
amodule->trampolines [MONO_AOT_TRAMP_FTNPTR_ARG] = (guint8 *)info->ftnptr_arg_trampolines;
amodule->trampolines [MONO_AOT_TRAMP_UNBOX_ARBITRARY] = (guint8 *)info->unbox_arbitrary_trampolines;
- if (mono_is_corlib_image (assembly->image) || !strcmp (assembly->aname.name, "mscorlib") || !strcmp (assembly->aname.name, "System.Private.CoreLib"))
+ if (mono_is_corlib_image (assembly->image) || !strcmp (assembly->aname.name, MONO_ASSEMBLY_CORLIB_NAME)) {
+ g_assert (!mscorlib_aot_module);
mscorlib_aot_module = amodule;
+ }
/* Compute method addresses */
amodule->methods = (void **)g_malloc0 (amodule->info.nmethods * sizeof (gpointer));
return FALSE;
/* "slim" only applies to mscorlib.dll */
- if (strcmp (amodule->aot_name, "mscorlib"))
+ if (strcmp (amodule->aot_name, MONO_ASSEMBLY_CORLIB_NAME))
return FALSE;
guint32 f = amodule->info.flags;
if (!global_codeman) {
/* This can happen during startup */
- global_codeman = mono_code_manager_new ();
+ if (!mono_compile_aot)
+ global_codeman = mono_code_manager_new ();
+ else
+ global_codeman = mono_code_manager_new_aot ();
return mono_code_manager_reserve (global_codeman, size);
}
else {
mono_tls_init_runtime_keys ();
- if (!global_codeman)
- global_codeman = mono_code_manager_new ();
+ if (!global_codeman) {
+ if (!mono_compile_aot)
+ global_codeman = mono_code_manager_new ();
+ else
+ global_codeman = mono_code_manager_new_aot ();
+ }
memset (&callbacks, 0, sizeof (callbacks));
callbacks.create_ftnptr = mini_create_ftnptr;
mini_parse_debug_options ();
}
- mono_code_manager_init ();
+ mono_code_manager_init (mono_compile_aot);
#ifdef MONO_ARCH_HAVE_CODE_CHUNK_TRACKING
if (mini_debug_options.collect_pagefault_stats)
mono_aot_set_make_unreadable (TRUE);
+ /* set no-exec before the default ALC is created */
+ if (mono_compile_aot) {
+ /*
+ * Avoid running managed code when AOT compiling, since the platform
+ * might only support aot-only execution.
+ */
+ mono_runtime_set_no_exec (TRUE);
+ }
+
if (runtime_version)
domain = mono_init_version (filename, runtime_version);
else
register_trampolines (domain);
- if (mono_compile_aot)
- /*
- * Avoid running managed code when AOT compiling, since the platform
- * might only support aot-only execution.
- */
- mono_runtime_set_no_exec (TRUE);
-
mono_mem_account_register_counters ();
#define JIT_RUNTIME_WORKS
#endif
#define MONO_PROT_RWX (MONO_MMAP_READ|MONO_MMAP_WRITE|MONO_MMAP_EXEC|MONO_MMAP_JIT)
+#define MONO_PROT_RW (MONO_MMAP_READ|MONO_MMAP_WRITE)
typedef struct _CodeChunk CodeChunk;
CodeChunk *last;
int dynamic : 1;
int read_only : 1;
+ int no_exec : 1;
};
#define ALIGN_INT(val,alignment) (((val) + (alignment - 1)) & ~(alignment - 1))
static MonoNativeTlsKey write_level_tls_id;
static void*
-codechunk_valloc (void *preferred, guint32 size)
+codechunk_valloc (void *preferred, guint32 size, gboolean no_exec)
{
void *ptr;
GSList *freelist;
freelist = g_slist_delete_link (freelist, freelist);
g_hash_table_insert (valloc_freelists, GUINT_TO_POINTER (size), freelist);
} else {
- ptr = mono_valloc (preferred, size, MONO_PROT_RWX | ARCH_MAP_FLAGS, MONO_MEM_ACCOUNT_CODE);
+ int prot;
+ if (!no_exec)
+ prot = MONO_PROT_RWX | ARCH_MAP_FLAGS;
+ else
+ prot = MONO_PROT_RW | ARCH_MAP_FLAGS;
+ ptr = mono_valloc (preferred, size, prot, MONO_MEM_ACCOUNT_CODE);
if (!ptr && preferred)
- ptr = mono_valloc (NULL, size, MONO_PROT_RWX | ARCH_MAP_FLAGS, MONO_MEM_ACCOUNT_CODE);
+ ptr = mono_valloc (NULL, size, prot, MONO_MEM_ACCOUNT_CODE);
}
mono_os_mutex_unlock (&valloc_mutex);
return ptr;
g_hash_table_destroy (valloc_freelists);
}
+/* non-zero if we don't need to toggle write protection on individual threads */
+static int
+codeman_no_exec;
+
+/**
+ * mono_codeman_set_code_no_exec:
+ *
+ * If set to a non-zero value,
+ * \c mono_codeman_enable_write and \c mono_codeman_disable_write turn into no-ops.
+ *
+ * The AOT compiler should do this if it is allocating RW (no X) memory for code.
+ */
+static void
+mono_codeman_set_code_no_exec (int no_exec)
+{
+ codeman_no_exec = no_exec;
+}
+
void
-mono_code_manager_init (void)
+mono_code_manager_init (gboolean no_exec)
{
mono_counters_register ("Dynamic code allocs", MONO_COUNTER_JIT | MONO_COUNTER_ULONG, &dynamic_code_alloc_count);
mono_counters_register ("Dynamic code bytes", MONO_COUNTER_JIT | MONO_COUNTER_ULONG, &dynamic_code_bytes_count);
mono_counters_register ("Dynamic code frees", MONO_COUNTER_JIT | MONO_COUNTER_ULONG, &dynamic_code_frees_count);
mono_native_tls_alloc (&write_level_tls_id, NULL);
+
+ mono_codeman_set_code_no_exec (no_exec);
}
void
#endif
}
+enum CodeManagerType {
+ MONO_CODEMAN_TYPE_JIT,
+ MONO_CODEMAN_TYPE_DYNAMIC,
+ MONO_CODEMAN_TYPE_AOT,
+};
+
+static gboolean
+codeman_type_is_dynamic (int codeman_type)
+{
+ switch (codeman_type) {
+ case MONO_CODEMAN_TYPE_DYNAMIC:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+static gboolean
+codeman_type_is_aot (int codeman_type)
+{
+ switch (codeman_type) {
+ case MONO_CODEMAN_TYPE_AOT:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
/**
* mono_code_manager_new_internal
*
*/
static
MonoCodeManager*
-mono_code_manager_new_internal (gboolean dynamic)
+mono_code_manager_new_internal (int codeman_type)
{
MonoCodeManager* cman = g_new0 (MonoCodeManager, 1);
if (cman) {
- cman->dynamic = dynamic;
+ cman->dynamic = codeman_type_is_dynamic (codeman_type);
+ cman->no_exec = codeman_type_is_aot (codeman_type);
#if _WIN32
// It would seem the heap should live and die with the codemanager,
// but that was failing, so try a global.
MonoCodeManager*
mono_code_manager_new (void)
{
- return mono_code_manager_new_internal (FALSE);
+ return mono_code_manager_new_internal (MONO_CODEMAN_TYPE_JIT);
}
/**
MonoCodeManager*
mono_code_manager_new_dynamic (void)
{
- return mono_code_manager_new_internal (TRUE);
+ return mono_code_manager_new_internal (MONO_CODEMAN_TYPE_DYNAMIC);
+}
+
+/**
+ * mono_code_manager_new_aot:
+ *
+ * Creates a new code manager that will hold code that is never
+ * executed. This can be used by the AOT compiler to allocate pages
+ * on W^X platforms without asking for execute permission (which may
+ * require additional entitlements, or AOT-time OS calls).
+ */
+MonoCodeManager*
+mono_code_manager_new_aot (void)
+{
+ return mono_code_manager_new_internal (MONO_CODEMAN_TYPE_AOT);
}
static gpointer
{
CodeChunk * const last = cman->last;
int const dynamic = cman->dynamic;
+ int const no_exec = cman->no_exec;
int chunk_size, bsize = 0;
CodeChunk *chunk;
void *ptr;
chunk_size = minsize;
else {
/* Allocate MIN_ALIGN-1 more than we need so we can still */
- /* guarantee MIN_ALIGN alignment for individual allocs */
- /* from mono_code_manager_reserve_align. */
+ /* guarantee MIN_ALIGN alignment for individual allocs */
+ /* from mono_code_manager_reserve_align. */
size += MIN_ALIGN - 1;
size &= ~(MIN_ALIGN - 1);
chunk_size = size;
/* Try to allocate code chunks next to each other to help the VM */
ptr = NULL;
if (last)
- ptr = codechunk_valloc ((guint8*)last->data + last->size, chunk_size);
+ ptr = codechunk_valloc ((guint8*)last->data + last->size, chunk_size, no_exec);
if (!ptr)
- ptr = codechunk_valloc (NULL, chunk_size);
+ ptr = codechunk_valloc (NULL, chunk_size, no_exec);
if (!ptr)
return NULL;
}
void
mono_codeman_enable_write (void)
{
+ if (codeman_no_exec)
+ return;
#ifdef HAVE_PTHREAD_JIT_WRITE_PROTECT_NP
if (__builtin_available (macOS 11, *)) {
int level = GPOINTER_TO_INT (mono_native_tls_get_value (write_level_tls_id));
pthread_jit_write_protect_np (0);
}
#elif defined(HOST_MACCAT) && defined(__aarch64__)
- /* JITing in Catalyst apps is not allowed on Apple Silicon. */
- g_assert_not_reached ();
+ /* JITing in Catalyst apps is not allowed on Apple Silicon, so assume if we're here we don't really have executable pages. */
#endif
}
void
mono_codeman_disable_write (void)
{
+ if (codeman_no_exec)
+ return;
#ifdef HAVE_PTHREAD_JIT_WRITE_PROTECT_NP
if (__builtin_available (macOS 11, *)) {
int level = GPOINTER_TO_INT (mono_native_tls_get_value (write_level_tls_id));
pthread_jit_write_protect_np (1);
}
#elif defined(HOST_MACCAT) && defined(__aarch64__)
- /* JITing in Catalyst apps is not allowed on Apple Silicon. */
- g_assert_not_reached ();
+ /* JITing in Catalyst apps is not allowed on Apple Silicon, so assume if we're here we don't really have executable pages */
#endif
}
MonoCodeManager* mono_code_manager_new (void);
MonoCodeManager* mono_code_manager_new_dynamic (void);
+MonoCodeManager* mono_code_manager_new_aot (void);
void mono_code_manager_destroy (MonoCodeManager *cman);
void mono_code_manager_invalidate (MonoCodeManager *cman);
void mono_code_manager_set_read_only (MonoCodeManager *cman);
void* mono_code_manager_reserve (MonoCodeManager *cman, int size);
void mono_code_manager_commit (MonoCodeManager *cman, void *data, int size, int newsize);
int mono_code_manager_size (MonoCodeManager *cman, int *used_size);
-void mono_code_manager_init (void);
+void mono_code_manager_init (gboolean no_exec);
void mono_code_manager_cleanup (void);
void mono_code_manager_install_callbacks (const MonoCodeManagerCallbacks* callbacks);
}
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, *))
/p:TargetOS=MacCatalyst \
/p:TargetArchitecture=$(MONO_ARCH) \
/p:UseLLVM=False \
- /p:ForceAOT=False
+ /p:ForceAOT=True
run-sim-interp: clean appbuilder
$(DOTNET) publish \
/p:TargetOS=MacCatalyst \
/p:TargetArchitecture=$(MONO_ARCH) \
/p:UseLLVM=False \
- /p:ForceAOT=False \
+ /p:ForceAOT=True \
/p:MonoForceInterpreter=true
clean:
<OutputType>Exe</OutputType>
<OutputPath>bin</OutputPath>
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
- <TargetOS>iOS</TargetOS>
+ <TargetOS Condition="'$(TargetOS)' == ''">iOS</TargetOS>
<TargetOS Condition="'$(TargetsiOSSimulator)' == 'true'">iOSSimulator</TargetOS>
<MicrosoftNetCoreAppRuntimePackDir>$(ArtifactsBinDir)microsoft.netcore.app.runtime.$(TargetOS.ToLower())-$(TargetArchitecture)\$(Configuration)\runtimes\$(TargetOS.ToLower())-$(TargetArchitecture)\</MicrosoftNetCoreAppRuntimePackDir>
<EnableTargetingPackDownload>false</EnableTargetingPackDownload>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetOS)' == 'MacCatalyst'">
- <DevTeamProvisioning Condition="'$(TargetOS)' == 'MacCatalyst' and '$(DevTeamProvisioning)' == ''">-</DevTeamProvisioning>
+ <DevTeamProvisioning Condition="'$(TargetOS)' == 'MacCatalyst' and '$(DevTeamProvisioning)' == ''">adhoc</DevTeamProvisioning>
</PropertyGroup>
<!-- Redirect 'dotnet publish' to in-tree runtime pack -->
</AotInputAssemblies>
</ItemGroup>
+ <PropertyGroup>
+ <AOTMode Condition="'$(TargetOS)' != 'MacCatalyst'">Full</AOTMode>
+ <AOTMode Condition="'$(TargetOS)' == 'MacCatalyst' and '$(MonoForceInterpreter)' != 'true'">Full</AOTMode>
+ <AOTMode Condition="'$(TargetOS)' == 'MacCatalyst' and '$(MonoForceInterpreter)' == 'true'">JustInterp</AOTMode>
+ </PropertyGroup>
+
<MonoAOTCompiler
Condition="'$(RunAOTCompilation)' == 'true'"
CompilerBinaryPath="$(MonoAotCrossCompilerPath)"
- Mode="Full"
+ Mode="$(AOTMode)"
OutputType="AsmOnly"
Assemblies="@(AotInputAssemblies)"
AotModulesTablePath="$(AppDir)\modules.m"
DevTeamProvisioning="$(DevTeamProvisioning)"
OutputDirectory="$(AppDir)"
Optimized="$(Optimized)"
- ForceAOT="$(ForceAOT)"
+ ForceAOT="$(RunAOTCompilation)"
ForceInterpreter="$(MonoForceInterpreter)"
RuntimeComponents="$(RuntimeComponents)"
DiagnosticPorts="$(DiagnosticPorts)"
<Message Importance="High" Text="Xcode: $(XcodeProjectPath)"/>
<Message Importance="High" Text="App: $(AppBundlePath)"/>
+ </Target>
+
+ <Target Name="RunAppBundle"
+ AfterTargets="BuildAppBundle"
+ Condition="'$(ArchiveTests)' != 'true'">
+ <!-- FIXME: only run if the TargetArchitecture matches the current architecture -->
<!-- install and run on ios simulator -->
<Exec Condition="'$(IosSimulator)' != '' and '$(ArchiveTests)' != 'true'" Command="xcrun simctl shutdown "$(IosSimulator)"" ContinueOnError="WarnAndContinue" />
</Target>
- <Target Name="CopySampleAppToHelixTestDir"
- Condition="'$(ArchiveTests)' == 'true'"
+ <Target Name="CopySampleAppToHelixTestDir"
+ Condition="'$(ArchiveTests)' == 'true'"
AfterTargets="Build"
DependsOnTargets="Publish;BuildAppBundle" >
<PropertyGroup>
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");
}
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);
mono_install_assembly_preload_hook (assembly_preload_hook, NULL);
mono_install_load_aot_data_hook (load_aot_data, free_aot_data, NULL);
{
defines.AppendLine("add_definitions(-DFORCE_INTERPRETER=1)");
}
- else if (forceAOT)
+
+ if (forceAOT)
{
defines.AppendLine("add_definitions(-DFORCE_AOT=1)");
}