Signed-off-by: Esme Povirk esme@codeweavers.com --- dlls/mscoree/metahost.c | 28 ++++++++++++++++++++++++++++ dlls/mscoree/mscoree_private.h | 12 ++++++++++++ 2 files changed, 40 insertions(+)
diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c index d9b599fadc7..907d8af9791 100644 --- a/dlls/mscoree/metahost.c +++ b/dlls/mscoree/metahost.c @@ -106,6 +106,7 @@ MonoImage* (CDECL *mono_image_open_from_module_handle)(HMODULE module_handle, ch static void (CDECL *mono_install_assembly_preload_hook)(MonoAssemblyPreLoadFunc func, void *user_data); int (CDECL *mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]); MonoDomain* (CDECL *mono_jit_init_version)(const char *domain_name, const char *runtime_version); +static void (CDECL *mono_jit_set_aot_mode)(MonoAotMode mode); static int (CDECL *mono_jit_set_trace_options)(const char* options); void* (CDECL *mono_marshal_get_vtfixup_ftnptr)(MonoImage *image, DWORD token, WORD type); MonoDomain* (CDECL *mono_object_get_domain)(MonoObject *obj); @@ -158,6 +159,8 @@ static HRESULT load_mono(LPCWSTR mono_path) WCHAR mono_dll_path[MAX_PATH+16]; WCHAR mono_lib_path[MAX_PATH+4], mono_etc_path[MAX_PATH+4]; char mono_lib_path_a[MAX_PATH], mono_etc_path_a[MAX_PATH]; + int aot_size; + char aot_setting[256]; int trace_size; char trace_setting[256]; int verbose_size; @@ -239,6 +242,7 @@ static HRESULT load_mono(LPCWSTR mono_path)
LOAD_OPT_MONO_FUNCTION(mono_callspec_set_assembly, NULL); LOAD_OPT_MONO_FUNCTION(mono_image_open_from_module_handle, image_open_module_handle_dummy); + LOAD_OPT_MONO_FUNCTION(mono_jit_set_aot_mode, NULL); LOAD_OPT_MONO_FUNCTION(mono_profiler_create, NULL); LOAD_OPT_MONO_FUNCTION(mono_profiler_install, NULL); LOAD_OPT_MONO_FUNCTION(mono_profiler_set_runtime_shutdown_begin_callback, NULL); @@ -277,6 +281,30 @@ static HRESULT load_mono(LPCWSTR mono_path)
mono_install_assembly_preload_hook(mono_assembly_preload_hook_fn, NULL);
+ aot_size = GetEnvironmentVariableA("WINE_MONO_AOT", aot_setting, sizeof(aot_setting)); + + if (aot_size) + { + MonoAotMode mode; + if (strcmp(aot_setting, "interp") == 0) + mode = MONO_AOT_MODE_INTERP_ONLY; + else if (strcmp(aot_setting, "none") == 0) + mode = MONO_AOT_MODE_NONE; + else + { + ERR("unknown WINE_MONO_AOT setting, valid settings are interp and none\n"); + mode = MONO_AOT_MODE_NONE; + } + if (mono_jit_set_aot_mode != NULL) + { + mono_jit_set_aot_mode(mode); + } + else + { + ERR("mono_jit_set_aot_mode export not found\n"); + } + } + trace_size = GetEnvironmentVariableA("WINE_MONO_TRACE", trace_setting, sizeof(trace_setting));
if (trace_size) diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h index da587285cfe..69c30e5e3e0 100644 --- a/dlls/mscoree/mscoree_private.h +++ b/dlls/mscoree/mscoree_private.h @@ -147,6 +147,18 @@ typedef void (CDECL *MonoProfileFunc)(MonoProfiler *prof);
typedef void (CDECL *MonoPrintCallback) (const char *string, INT is_stdout);
+typedef enum { + MONO_AOT_MODE_NONE, + MONO_AOT_MODE_NORMAL, + MONO_AOT_MODE_HYBRID, + MONO_AOT_MODE_FULL, + MONO_AOT_MODE_LLVMONLY, + MONO_AOT_MODE_INTERP, + MONO_AOT_MODE_INTERP_LLVMONLY, + MONO_AOT_MODE_LLVMONLY_INTERP, + MONO_AOT_MODE_INTERP_ONLY +} MonoAotMode; + extern BOOL is_mono_started DECLSPEC_HIDDEN;
extern MonoImage* (CDECL *mono_assembly_get_image)(MonoAssembly *assembly) DECLSPEC_HIDDEN;