mono_parse_response_options (response_options, &argc, &argv, FALSE);
g_free (response_content);
} else if (argv [i][0] == '-' && argv [i][1] == '-' && mini_parse_debug_option (argv [i] + 2)) {
+ } else if (strcmp (argv [i], "--use-map-jit") == 0){
+ mono_setmmapjit (TRUE);
} else {
fprintf (stderr, "Unknown command line option: '%s'\n", argv [i]);
return 1;
}
#endif
+static int use_mmap_jit;
+
+/**
+ * mono_setmmapjit:
+ * \param flag indicating whether to enable or disable the use of MAP_JIT in mmap
+ *
+ * Call this method to enable or disable the use of MAP_JIT to create the pages
+ * for the JIT to use. This is only needed for scenarios where Mono is bundled
+ * as an App in MacOS
+ */
+void
+mono_setmmapjit (int flag)
+{
+ use_mmap_jit = flag;
+}
+
/**
* mono_valloc:
* \param addr memory address
#endif
#if defined(__APPLE__) && defined(MAP_JIT)
- if (flags & MONO_MMAP_JIT) {
+ if ((flags & MONO_MMAP_JIT) && use_mmap_jit) {
if (get_darwin_version () >= DARWIN_VERSION_MOJAVE) {
mflags |= MAP_JIT;
}
MONO_API int mono_file_map_fd (MonoFileMap *fmap);
MONO_API int mono_file_map_close (MonoFileMap *fmap);
+MONO_API void mono_setmmapjit (int flag);
MONO_API int mono_pagesize (void);
MONO_API int mono_valloc_granule (void);
MONO_API void* mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type);