From 3f632d1eae4d587f7b2d0823a111f4ab60b20ba8 Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Fri, 14 Jul 2023 14:24:45 -0400 Subject: [PATCH 01/19] Add ILStrip task to wasm app build process --- src/mono/wasm/build/WasmApp.InTree.targets | 1 + src/mono/wasm/build/WasmApp.Native.targets | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/mono/wasm/build/WasmApp.InTree.targets b/src/mono/wasm/build/WasmApp.InTree.targets index 0a2f332c2a718..da873baf69f73 100644 --- a/src/mono/wasm/build/WasmApp.InTree.targets +++ b/src/mono/wasm/build/WasmApp.InTree.targets @@ -1,6 +1,7 @@ + diff --git a/src/mono/wasm/build/WasmApp.Native.targets b/src/mono/wasm/build/WasmApp.Native.targets index 34736613dd8f6..8b6d7411296b0 100644 --- a/src/mono/wasm/build/WasmApp.Native.targets +++ b/src/mono/wasm/build/WasmApp.Native.targets @@ -674,12 +674,25 @@ CacheFilePath="$(_AOTCompilerCacheFile)" LLVMDebug="dwarfdebug" LLVMPath="$(EmscriptenUpstreamBinPath)" + CollectCompiledMethods="$(WASMStripIL)" + CompiledMethodsOutputDirectory="$(_WasmIntermediateOutputPath)tokens" IntermediateOutputPath="$(_WasmIntermediateOutputPath)" AotProfilePath="@(AotProfilePath)"> + + + + <_BitcodeFile Include="%(_WasmAssembliesInternal.LlvmBitcodeFile)" /> From 2f1765bc0758afec00db2ce3fc708922f2c68c19 Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Sun, 16 Jul 2023 16:35:04 -0400 Subject: [PATCH 02/19] Make it work for wasm app building workflow --- src/mono/wasm/build/WasmApp.Native.targets | 2 +- src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mono/wasm/build/WasmApp.Native.targets b/src/mono/wasm/build/WasmApp.Native.targets index 8b6d7411296b0..c5d5bb28d1f0f 100644 --- a/src/mono/wasm/build/WasmApp.Native.targets +++ b/src/mono/wasm/build/WasmApp.Native.targets @@ -682,7 +682,7 @@ - diff --git a/src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs b/src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs index 34c81b67f54e4..93a4c08eb7071 100644 --- a/src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs +++ b/src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs @@ -116,6 +116,7 @@ private bool StripAssembly(ITaskItem assemblyItem) private bool TrimMethods(ITaskItem assemblyItem) { + string assemblyFilePathArg = assemblyItem.ItemSpec; string methodTokenFile = assemblyItem.GetMetadata("MethodTokenFile"); if (string.IsNullOrEmpty(methodTokenFile)) { @@ -165,7 +166,7 @@ private bool TrimMethods(ITaskItem assemblyItem) if (isTrimmed) { - AddItemToTrimmedList(assemblyFilePath, trimmedAssemblyFilePath); + AddItemToTrimmedList(assemblyFilePathArg, trimmedAssemblyFilePath); } return true; From cfd4c60b8432099841fe1482cdfcdad394127efb Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Mon, 17 Jul 2023 10:11:03 -0400 Subject: [PATCH 03/19] Interp: stop inlining stripped methods. ILStrip: set code size to zero for tiny methods --- src/mono/mono/mini/interp/transform.c | 4 ++++ src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 32c9b2e3468a8..829a974b2db27 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -2982,6 +2982,10 @@ interp_inline_method (TransformData *td, MonoMethod *target_method, MonoMethodHe int nargs = csignature->param_count + !!csignature->hasthis; InterpInst *prev_last_ins; + if (header->code_size == 0) + /* IL stripped */ + return FALSE; + if (csignature->is_inflated) generic_context = mono_method_get_context (target_method); else { diff --git a/src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs b/src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs index 93a4c08eb7071..719064d9387b8 100644 --- a/src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs +++ b/src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs @@ -253,6 +253,8 @@ private void CreateTrimmedAssembly(PEReader peReader, string trimmedAssemblyFile int methodSize = ComputeMethodSize(peReader, rva); int actualLoc = ComputeMethodHash(peReader, rva); int headerSize = ComputeMethodHeaderSize(memStream, actualLoc); + if (headerSize == 1) //Set code size to zero for TinyFormat + SetCodeSizeToZeroForTiny(ref memStream, actualLoc); ZeroOutMethodBody(ref memStream, methodSize, actualLoc, headerSize); } else if (count < 0) @@ -283,6 +285,13 @@ private static int ComputeMethodHeaderSize(MemoryStream memStream, int actualLoc return (headerFlag == 2 ? 1 : 4); } + private static void SetCodeSizeToZeroForTiny(ref MemoryStream memStream, int actualLoc) + { + memStream.Position = actualLoc; + byte[] header = {0b10}; + memStream.Write(header, 0, 1); + } + private static void ZeroOutMethodBody(ref MemoryStream memStream, int methodSize, int actualLoc, int headerSize) { memStream.Position = actualLoc + headerSize; From 074abf0631b413552203fdaf213244059af7bf32 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Mon, 17 Jul 2023 12:04:34 -0400 Subject: [PATCH 04/19] [mono][aot] Avoid adding some methods to the compiled method file. * Methods which have 'deopt' set can enter the interpreter during EH. * Methods which have 'interp_entry_only' set are AOTed, but the AOT code is only used to enter the interpreter. --- src/mono/mono/mini/aot-compiler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index c7e2141171c75..2170384d88091 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -9832,7 +9832,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method) mono_atomic_inc_i32 (&acfg->stats.ccount); if (acfg->aot_opts.compiled_methods_outfile && acfg->compiled_methods_outfile != NULL) { - if (!mono_method_is_generic_impl (method) && method->token != 0) { + if (!mono_method_is_generic_impl (method) && method->token != 0 && !cfg->deopt && !cfg->interp_entry_only) { fprintf (acfg->compiled_methods_outfile, "%x\n", method->token); } } From ae0c62af8607c50095ab9b0de680cb9b2e001160 Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Thu, 27 Jul 2023 18:53:35 -0400 Subject: [PATCH 05/19] Only trim the methods that interpreter is able to call the aot'ed verion of it --- src/mono/mono/mini/aot-compiler.c | 26 ++++++++++++++++++++++- src/mono/mono/mini/interp/interp.c | 34 +++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 2170384d88091..25137f3560b3a 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -9409,6 +9409,30 @@ add_referenced_patch (MonoAotCompile *acfg, MonoJumpInfo *patch_info, int depth) } } +static gboolean +mono_interp_jit_call_can_be_supported (MonoMethod *method, MonoMethodSignature *sig) +{ + if (sig->param_count > 10) + return FALSE; + if (sig->pinvoke) + return FALSE; + if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) + return FALSE; + if (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) + return FALSE; + if (!mono_llvm_only && method->is_inflated) + return FALSE; + if (method->string_ctor) + return FALSE; + if (method->wrapper_type != MONO_WRAPPER_NONE) + return FALSE; + if (method->flags & METHOD_ATTRIBUTE_REQSECOBJ) + /* Used to mark methods containing StackCrawlMark locals */ + return FALSE; + + return TRUE; +} + /* * compile_method: * @@ -9832,7 +9856,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method) mono_atomic_inc_i32 (&acfg->stats.ccount); if (acfg->aot_opts.compiled_methods_outfile && acfg->compiled_methods_outfile != NULL) { - if (!mono_method_is_generic_impl (method) && method->token != 0 && !cfg->deopt && !cfg->interp_entry_only) { + if (!mono_method_is_generic_impl (method) && method->token != 0 && !cfg->deopt && !cfg->interp_entry_only && mono_interp_jit_call_can_be_supported (method, mono_method_signature_internal (method))) { fprintf (acfg->compiled_methods_outfile, "%x\n", method->token); } } diff --git a/src/mono/mono/mini/interp/interp.c b/src/mono/mono/mini/interp/interp.c index 4ca6be9da1be6..6ef4a4aa4a4ec 100644 --- a/src/mono/mono/mini/interp/interp.c +++ b/src/mono/mono/mini/interp/interp.c @@ -4055,7 +4055,39 @@ mono_interp_exec_method (InterpFrame *frame, ThreadContext *context, FrameClause } ip += 5; - goto call; + InterpMethodCodeType code_type = cmethod->code_type; + + g_assert (code_type == IMETHOD_CODE_UNKNOWN || + code_type == IMETHOD_CODE_INTERP || + code_type == IMETHOD_CODE_COMPILED); + + if (G_UNLIKELY (code_type == IMETHOD_CODE_UNKNOWN)) { + // FIXME push/pop LMF + MonoMethodSignature *sig = mono_method_signature_internal (cmethod->method); + if (mono_interp_jit_call_supported (cmethod->method, sig)) + code_type = IMETHOD_CODE_COMPILED; + else + code_type = IMETHOD_CODE_INTERP; + cmethod->code_type = code_type; + } + + if (code_type == IMETHOD_CODE_INTERP) { + + goto call; + + } else if (code_type == IMETHOD_CODE_COMPILED) { + frame->state.ip = ip; + error_init_reuse (error); + do_jit_call (context, (stackval*)(locals + return_offset), (stackval*)(locals + call_args_offset), frame, cmethod, error); + if (!is_ok (error)) { + MonoException *call_ex = interp_error_convert_to_exception (frame, error, ip); + THROW_EX (call_ex, ip); + } + + CHECK_RESUME_STATE (context); + } + + MINT_IN_BREAK; } MINT_IN_CASE(MINT_CALLI) { gboolean need_unbox; From 52a2a8c749f14528e037d3c96814363bca8e12ff Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Thu, 27 Jul 2023 19:10:05 -0400 Subject: [PATCH 06/19] Add default value and documentation for WASMStripIL --- src/mono/wasm/build/WasmApp.targets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index ba181982935c4..718e6ec5ec92d 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -85,6 +85,7 @@ - AppBundle directly contains user files - AppBundle/_framework contains generated files (dlls, runtime scripts, icu) - AppBundle/_content contains web files from nuget packages (css, js, etc) + - $(WASMStripIL) - Set to true to enable trimming away AOT compiled methods body (IL code) Public items: - @(WasmExtraFilesToDeploy) - Files to copy to $(WasmAppDir). @@ -144,6 +145,9 @@ true + + false + _framework From 0c9a83ef511acbf2a1f2c973cd122f0609293b93 Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Wed, 2 Aug 2023 17:17:43 -0400 Subject: [PATCH 07/19] Move jit_call_can_be_supported to interp.c --- src/mono/mono/mini/aot-compiler.c | 26 +------------------- src/mono/mono/mini/ee.h | 1 + src/mono/mono/mini/interp-stubs.c | 6 +++++ src/mono/mono/mini/interp/interp-internals.h | 3 +++ src/mono/mono/mini/interp/interp.c | 25 +++++++++++++++++++ src/mono/mono/mini/interp/transform.c | 18 +------------- 6 files changed, 37 insertions(+), 42 deletions(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 25137f3560b3a..21f026f6f6e4c 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -9409,30 +9409,6 @@ add_referenced_patch (MonoAotCompile *acfg, MonoJumpInfo *patch_info, int depth) } } -static gboolean -mono_interp_jit_call_can_be_supported (MonoMethod *method, MonoMethodSignature *sig) -{ - if (sig->param_count > 10) - return FALSE; - if (sig->pinvoke) - return FALSE; - if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) - return FALSE; - if (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) - return FALSE; - if (!mono_llvm_only && method->is_inflated) - return FALSE; - if (method->string_ctor) - return FALSE; - if (method->wrapper_type != MONO_WRAPPER_NONE) - return FALSE; - if (method->flags & METHOD_ATTRIBUTE_REQSECOBJ) - /* Used to mark methods containing StackCrawlMark locals */ - return FALSE; - - return TRUE; -} - /* * compile_method: * @@ -9856,7 +9832,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method) mono_atomic_inc_i32 (&acfg->stats.ccount); if (acfg->aot_opts.compiled_methods_outfile && acfg->compiled_methods_outfile != NULL) { - if (!mono_method_is_generic_impl (method) && method->token != 0 && !cfg->deopt && !cfg->interp_entry_only && mono_interp_jit_call_can_be_supported (method, mono_method_signature_internal (method))) { + if (!mono_method_is_generic_impl (method) && method->token != 0 && !cfg->deopt && !cfg->interp_entry_only && mini_get_interp_callbacks ()->jit_call_can_be_supported (method, mono_method_signature_internal (method))) { fprintf (acfg->compiled_methods_outfile, "%x\n", method->token); } } diff --git a/src/mono/mono/mini/ee.h b/src/mono/mono/mini/ee.h index caa04bef85872..27d00bad51750 100644 --- a/src/mono/mono/mini/ee.h +++ b/src/mono/mono/mini/ee.h @@ -65,6 +65,7 @@ typedef gpointer MonoInterpFrameHandle; MONO_EE_CALLBACK (void, entry_llvmonly, (gpointer res, gpointer *args, gpointer imethod)) \ MONO_EE_CALLBACK (gpointer, get_interp_method, (MonoMethod *method)) \ MONO_EE_CALLBACK (MonoJitInfo*, compile_interp_method, (MonoMethod *method, MonoError *error)) \ + MONO_EE_CALLBACK (gboolean, jit_call_can_be_supported, (MonoMethod *method, MonoMethodSignature *sig)) \ typedef struct _MonoEECallbacks { diff --git a/src/mono/mono/mini/interp-stubs.c b/src/mono/mono/mini/interp-stubs.c index 8d1487c8876ea..e67445f0ce453 100644 --- a/src/mono/mono/mini/interp-stubs.c +++ b/src/mono/mono/mini/interp-stubs.c @@ -252,6 +252,12 @@ stub_compile_interp_method (MonoMethod *method, MonoError *error) return NULL; } +static gboolean +stub_jit_call_can_be_supported (MonoMethod *method, MonoMethodSignature *sig) +{ + return TRUE; +} + #undef MONO_EE_CALLBACK #define MONO_EE_CALLBACK(ret, name, sig) stub_ ## name, diff --git a/src/mono/mono/mini/interp/interp-internals.h b/src/mono/mono/mini/interp/interp-internals.h index 9be34b46d8457..592b129248a75 100644 --- a/src/mono/mono/mini/interp/interp-internals.h +++ b/src/mono/mono/mini/interp/interp-internals.h @@ -320,6 +320,9 @@ mono_mint_type (MonoType *type); int mono_interp_type_size (MonoType *type, int mt, int *align_p); +gboolean +interp_jit_call_can_be_supported (MonoMethod *method, MonoMethodSignature *sig); + #if HOST_BROWSER gboolean diff --git a/src/mono/mono/mini/interp/interp.c b/src/mono/mono/mini/interp/interp.c index 6ef4a4aa4a4ec..9948f22c5b0f8 100644 --- a/src/mono/mono/mini/interp/interp.c +++ b/src/mono/mono/mini/interp/interp.c @@ -8601,6 +8601,31 @@ interp_sufficient_stack (gsize size) return (context->stack_pointer + size) < (context->stack_start + INTERP_STACK_SIZE); } +gboolean +interp_jit_call_can_be_supported (MonoMethod *method, MonoMethodSignature *sig) +{ + if (sig->param_count > 10) + return FALSE; + if (sig->pinvoke) + return FALSE; + if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) + return FALSE; + if (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) + return FALSE; + if (!mono_llvm_only && method->is_inflated) + return FALSE; + if (method->string_ctor) + return FALSE; + if (method->wrapper_type != MONO_WRAPPER_NONE) + return FALSE; + + if (method->flags & METHOD_ATTRIBUTE_REQSECOBJ) + /* Used to mark methods containing StackCrawlMark locals */ + return FALSE; + + return TRUE; +} + static void interp_cleanup (void) { diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 829a974b2db27..d53cceb9dca1d 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -1213,23 +1213,7 @@ mono_interp_jit_call_supported (MonoMethod *method, MonoMethodSignature *sig) { GSList *l; - if (sig->param_count > 10) - return FALSE; - if (sig->pinvoke) - return FALSE; - if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) - return FALSE; - if (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) - return FALSE; - if (!mono_llvm_only && method->is_inflated) - return FALSE; - if (method->string_ctor) - return FALSE; - if (method->wrapper_type != MONO_WRAPPER_NONE) - return FALSE; - - if (method->flags & METHOD_ATTRIBUTE_REQSECOBJ) - /* Used to mark methods containing StackCrawlMark locals */ + if (!interp_jit_call_can_be_supported (method, sig)) return FALSE; if (mono_aot_only && m_class_get_image (method->klass)->aot_module && !(method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)) { From 7d583ced4f824d3db402326d10b879a3e3b97b2c Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Wed, 2 Aug 2023 17:20:35 -0400 Subject: [PATCH 08/19] Minor format fix --- docs/workflow/building/mono/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/workflow/building/mono/README.md b/docs/workflow/building/mono/README.md index 318c23cdab517..19dfcc4a4c482 100644 --- a/docs/workflow/building/mono/README.md +++ b/docs/workflow/building/mono/README.md @@ -66,7 +66,7 @@ For `build.sh` `/p:DisableCrossgen=true` - Skips building the installer if you don't need it (builds faster) -`-p:KeepNativeSymbols=true` - Keep the symbols in the binary instead of stripping them out to a separate file. This helps with debugging Mono with lldb. +`/p:KeepNativeSymbols=true` - Keep the symbols in the binary instead of stripping them out to a separate file. This helps with debugging Mono with lldb. The build has a number of options that you can learn about using build -?. From f7bb6013032ba419f66e0b69d544a77f5583f9cc Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Wed, 2 Aug 2023 17:54:24 -0400 Subject: [PATCH 09/19] Add a test --- src/libraries/tests.proj | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index a82506e2cd933..5e949eec91d6e 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -371,6 +371,13 @@ + + + + + From 41cf1b74447ccbf738ec5ec78be227144c0fbddb Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Wed, 2 Aug 2023 17:57:29 -0400 Subject: [PATCH 10/19] For testing --- src/libraries/tests.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 5e949eec91d6e..d0e0a16152a3d 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -373,7 +373,7 @@ - From 617d8a70db33c6fb2c8b8362e6488057efe4991b Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Wed, 2 Aug 2023 23:43:58 -0400 Subject: [PATCH 11/19] Fix typo --- src/libraries/tests.proj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index d0e0a16152a3d..ac8717e22bb8d 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -373,8 +373,8 @@ - From feead7148954698c5aa8459c47ce12c028671a21 Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Thu, 3 Aug 2023 14:25:46 -0400 Subject: [PATCH 12/19] Skip TestUtilities Reference --- .../StartupHook/WebAssembly.Browser.StartupHook.Test.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/FunctionalTests/WebAssembly/Browser/StartupHook/WebAssembly.Browser.StartupHook.Test.csproj b/src/tests/FunctionalTests/WebAssembly/Browser/StartupHook/WebAssembly.Browser.StartupHook.Test.csproj index 0acd55e74ce80..67872db3b67c0 100644 --- a/src/tests/FunctionalTests/WebAssembly/Browser/StartupHook/WebAssembly.Browser.StartupHook.Test.csproj +++ b/src/tests/FunctionalTests/WebAssembly/Browser/StartupHook/WebAssembly.Browser.StartupHook.Test.csproj @@ -1,6 +1,7 @@ true + false From 74fbf163c9b4b21f5db6e4580f608e92e8165838 Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Mon, 7 Aug 2023 13:06:40 -0400 Subject: [PATCH 13/19] Address review feedback --- src/mono/wasm/build/WasmApp.targets | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index 718e6ec5ec92d..e32dd6bdd41b2 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -86,6 +86,7 @@ - AppBundle/_framework contains generated files (dlls, runtime scripts, icu) - AppBundle/_content contains web files from nuget packages (css, js, etc) - $(WASMStripIL) - Set to true to enable trimming away AOT compiled methods body (IL code) + Defaults to false. Public items: - @(WasmExtraFilesToDeploy) - Files to copy to $(WasmAppDir). From 64bbd78458c2dc498c8e2482bd33baa6e559287d Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Tue, 8 Aug 2023 15:13:36 -0400 Subject: [PATCH 14/19] Change it to true --- .../StartupHook/WebAssembly.Browser.StartupHook.Test.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/FunctionalTests/WebAssembly/Browser/StartupHook/WebAssembly.Browser.StartupHook.Test.csproj b/src/tests/FunctionalTests/WebAssembly/Browser/StartupHook/WebAssembly.Browser.StartupHook.Test.csproj index 67872db3b67c0..225d1a2f45e54 100644 --- a/src/tests/FunctionalTests/WebAssembly/Browser/StartupHook/WebAssembly.Browser.StartupHook.Test.csproj +++ b/src/tests/FunctionalTests/WebAssembly/Browser/StartupHook/WebAssembly.Browser.StartupHook.Test.csproj @@ -1,7 +1,7 @@ true - false + true From 859f10a97f59393a92414d488a92c742c173a85e Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Wed, 9 Aug 2023 10:11:17 -0400 Subject: [PATCH 15/19] Change name to trimming eligible --- src/mono/mono/mini/aot-compiler.c | 34 ++++++++++---------- src/mono/sample/HelloWorld/HelloWorld.csproj | 4 +-- src/mono/sample/HelloWorld/Makefile | 4 +-- src/mono/wasm/build/WasmApp.Native.targets | 4 +-- src/tasks/AotCompilerTask/MonoAOTCompiler.cs | 26 +++++++-------- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 61ac9f126d315..1958c43e124e3 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -188,7 +188,7 @@ typedef struct MonoAotOptions { char *llvm_outfile; char *data_outfile; char *export_symbols_outfile; - char *compiled_methods_outfile; + char *trimming_eligible_methods_outfile; GList *profile_files; GList *mibc_profile_files; gboolean save_temps; @@ -420,7 +420,7 @@ typedef struct MonoAotCompile { FILE *logfile; FILE *instances_logfile; FILE *data_outfile; - FILE *compiled_methods_outfile; + FILE *trimming_eligible_methods_outfile; int datafile_offset; int gc_name_offset; @@ -8804,8 +8804,8 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts) opts->llvm_outfile = g_strdup (arg + strlen ("llvm-outfile=")); } else if (str_begins_with (arg, "export-symbols-outfile=")) { opts->export_symbols_outfile = g_strdup (arg + strlen ("export-symbols-outfile=")); - } else if (str_begins_with (arg, "compiled-methods-outfile=")) { - opts->compiled_methods_outfile = g_strdup (arg + strlen ("compiled-methods-outfile=")); + } else if (str_begins_with (arg, "trimming-eligible-methods-outfile=")) { + opts->trimming_eligible_methods_outfile = g_strdup (arg + strlen ("trimming-eligible-methods-outfile=")); } else if (str_begins_with (arg, "temp-path=")) { opts->temp_path = clean_path (g_strdup (arg + strlen ("temp-path="))); } else if (str_begins_with (arg, "save-temps")) { @@ -9864,9 +9864,9 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method) mono_atomic_inc_i32 (&acfg->stats.ccount); - if (acfg->aot_opts.compiled_methods_outfile && acfg->compiled_methods_outfile != NULL) { + if (acfg->aot_opts.trimming_eligible_methods_outfile && acfg->trimming_eligible_methods_outfile != NULL) { if (!mono_method_is_generic_impl (method) && method->token != 0 && !cfg->deopt && !cfg->interp_entry_only && mini_get_interp_callbacks ()->jit_call_can_be_supported (method, mono_method_signature_internal (method))) { - fprintf (acfg->compiled_methods_outfile, "%x\n", method->token); + fprintf (acfg->trimming_eligible_methods_outfile, "%x\n", method->token); } } } @@ -14884,13 +14884,13 @@ aot_assembly (MonoAssembly *ass, guint32 jit_opts, MonoAotOptions *aot_options) acfg->logfile = fopen (acfg->aot_opts.logfile, "a+"); } - if (acfg->aot_opts.compiled_methods_outfile && acfg->dedup_phase != DEDUP_COLLECT) { - acfg->compiled_methods_outfile = fopen (acfg->aot_opts.compiled_methods_outfile, "w+"); - if (!acfg->compiled_methods_outfile) - aot_printerrf (acfg, "Unable to open compiled-methods-outfile specified file %s\n", acfg->aot_opts.compiled_methods_outfile); + if (acfg->aot_opts.trimming_eligible_methods_outfile && acfg->dedup_phase != DEDUP_COLLECT) { + acfg->trimming_eligible_methods_outfile = fopen (acfg->aot_opts.trimming_eligible_methods_outfile, "w+"); + if (!acfg->trimming_eligible_methods_outfile) + aot_printerrf (acfg, "Unable to open trimming-eligible-methods-outfile specified file %s\n", acfg->aot_opts.trimming_eligible_methods_outfile); else { - fprintf(acfg->compiled_methods_outfile, "%s\n", ass->image->filename); - fprintf(acfg->compiled_methods_outfile, "%s\n", ass->image->guid); + fprintf(acfg->trimming_eligible_methods_outfile, "%s\n", ass->image->filename); + fprintf(acfg->trimming_eligible_methods_outfile, "%s\n", ass->image->guid); } } @@ -15244,8 +15244,8 @@ aot_assembly (MonoAssembly *ass, guint32 jit_opts, MonoAotOptions *aot_options) current_acfg = NULL; - if (acfg->compiled_methods_outfile) { - fclose (acfg->compiled_methods_outfile); + if (acfg->trimming_eligible_methods_outfile) { + fclose (acfg->trimming_eligible_methods_outfile); } return emit_aot_image (acfg); @@ -15623,9 +15623,9 @@ mono_aot_assemblies (MonoAssembly **assemblies, int nassemblies, guint32 jit_opt dedup_methods = g_hash_table_new (NULL, NULL); } - if (aot_opts.compiled_methods_outfile) { - if (g_ensure_directory_exists (aot_opts.compiled_methods_outfile) == FALSE) { - fprintf (stderr, "AOT : failed to create the directory to save the compiled method names: %s\n", aot_opts.compiled_methods_outfile); + if (aot_opts.trimming_eligible_methods_outfile) { + if (g_ensure_directory_exists (aot_opts.trimming_eligible_methods_outfile) == FALSE) { + fprintf (stderr, "AOT : failed to create the directory to save the compiled method names: %s\n", aot_opts.trimming_eligible_methods_outfile); exit (1); } } diff --git a/src/mono/sample/HelloWorld/HelloWorld.csproj b/src/mono/sample/HelloWorld/HelloWorld.csproj index ef6aa16657606..3ee6d0a1d46d8 100644 --- a/src/mono/sample/HelloWorld/HelloWorld.csproj +++ b/src/mono/sample/HelloWorld/HelloWorld.csproj @@ -27,8 +27,8 @@ LibraryFormat="$(_AotLibraryFormat)" Assemblies="@(AotInputAssemblies)" OutputDir="$(PublishDir)" - CollectCompiledMethods="$(StripILCode)" - CompiledMethodsOutputDirectory="$(CompiledMethodsOutputDirectory)" + CollectTrimmingEligibleMethods="$(StripILCode)" + TrimmingEligibleMethodsOutputDirectory="$(TrimmingEligibleMethodsOutputDirectory)" IntermediateOutputPath="$(IntermediateOutputPath)" UseAotDataFile="$(UseAotDataFile)" CacheFilePath="$(IntermediateOutputPath)aot_compiler_cache.json" diff --git a/src/mono/sample/HelloWorld/Makefile b/src/mono/sample/HelloWorld/Makefile index 8441e565d29c5..f1df4731374fb 100644 --- a/src/mono/sample/HelloWorld/Makefile +++ b/src/mono/sample/HelloWorld/Makefile @@ -7,7 +7,7 @@ MONO_ARCH?=$(shell . $(TOP)eng/native/init-os-and-arch.sh && echo $${arch}) TARGET_OS?=$(shell . $(TOP)eng/native/init-os-and-arch.sh && echo $${os}) AOT?=false StripILCode?=false -CompiledMethodsOutputDirectory?= # +TrimmingEligibleMethodsOutputDirectory?= # #NET_TRACE_PATH= #PGO_BINARY_PATH= @@ -21,7 +21,7 @@ publish: -r $(TARGET_OS)-$(MONO_ARCH) \ /p:RunAOTCompilation=$(AOT) \ /p:StripILCode=$(StripILCode) \ - /p:CompiledMethodsOutputDirectory=$(CompiledMethodsOutputDirectory) \ + /p:TrimmingEligibleMethodsOutputDirectory=$(TrimmingEligibleMethodsOutputDirectory) \ '/p:NetTracePath="$(NET_TRACE_PATH)"' \ '/p:PgoBinaryPath="$(PGO_BINARY_PATH)"' \ '/p:MibcProfilePath="$(MIBC_PROFILE_PATH)"' diff --git a/src/mono/wasm/build/WasmApp.Native.targets b/src/mono/wasm/build/WasmApp.Native.targets index 471a41c9c0593..0832ec7411720 100644 --- a/src/mono/wasm/build/WasmApp.Native.targets +++ b/src/mono/wasm/build/WasmApp.Native.targets @@ -685,8 +685,8 @@ CacheFilePath="$(_AOTCompilerCacheFile)" LLVMDebug="dwarfdebug" LLVMPath="$(EmscriptenUpstreamBinPath)" - CollectCompiledMethods="$(WASMStripIL)" - CompiledMethodsOutputDirectory="$(_WasmIntermediateOutputPath)tokens" + CollectTrimmingEligibleMethods="$(WASMStripIL)" + TrimmingEligibleMethodsOutputDirectory="$(_WasmIntermediateOutputPath)tokens" IntermediateOutputPath="$(_WasmIntermediateOutputPath)" AotProfilePath="@(AotProfilePath)"> diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs index ffc95c0d38f2c..9e52322770b04 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs +++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs @@ -67,7 +67,7 @@ public class MonoAOTCompiler : Microsoft.Build.Utilities.Task /// - LlvmObjectFile (if using LLVM) /// - LlvmBitcodeFile (if using LLVM-only) /// - ExportsFile (used in LibraryMode only) - /// - MethodTokenFile (when using CollectCompiledMethods=true) + /// - MethodTokenFile (when using CollectTrimmingEligibleMethods=true) /// [Output] public ITaskItem[]? CompiledAssemblies { get; set; } @@ -156,12 +156,12 @@ public class MonoAOTCompiler : Microsoft.Build.Utilities.Task /// /// Instructs the AOT compiler to print the list of aot compiled methods /// - public bool CollectCompiledMethods { get; set; } + public bool CollectTrimmingEligibleMethods { get; set; } /// - /// Directory to store the aot output when using switch compiled-methods-outfile + /// Directory to store the aot output when using switch trimming-eligible-methods-outfile /// - public string? CompiledMethodsOutputDirectory { get; set; } + public string? TrimmingEligibleMethodsOutputDirectory { get; set; } /// /// File to use for profile-guided optimization, *only* the methods described in the file will be AOT compiled. @@ -453,14 +453,14 @@ private bool ProcessAndValidateArguments() throw new LogAsErrorException($"Could not find {fullPath} to AOT"); } - if (CollectCompiledMethods) + if (CollectTrimmingEligibleMethods) { - if (string.IsNullOrEmpty(CompiledMethodsOutputDirectory)) - throw new LogAsErrorException($"{nameof(CompiledMethodsOutputDirectory)} is empty. When {nameof(CollectCompiledMethods)} is set to true, the user needs to provide a directory for {nameof(CompiledMethodsOutputDirectory)}."); + if (string.IsNullOrEmpty(TrimmingEligibleMethodsOutputDirectory)) + throw new LogAsErrorException($"{nameof(TrimmingEligibleMethodsOutputDirectory)} is empty. When {nameof(CollectTrimmingEligibleMethods)} is set to true, the user needs to provide a directory for {nameof(TrimmingEligibleMethodsOutputDirectory)}."); - if (!Directory.Exists(CompiledMethodsOutputDirectory)) + if (!Directory.Exists(TrimmingEligibleMethodsOutputDirectory)) { - Directory.CreateDirectory(CompiledMethodsOutputDirectory); + Directory.CreateDirectory(TrimmingEligibleMethodsOutputDirectory); } } @@ -744,20 +744,20 @@ private PrecompileArguments GetPrecompileArgumentsFor(ITaskItem assemblyItem, st aotArgs.Add("dedup-skip"); } - if (CollectCompiledMethods) + if (CollectTrimmingEligibleMethods) { string assemblyName = assemblyFilename.Replace(".", "_"); string outputFileName = assemblyName + "_compiled_methods.txt"; string outputFilePath; - if (string.IsNullOrEmpty(CompiledMethodsOutputDirectory)) + if (string.IsNullOrEmpty(TrimmingEligibleMethodsOutputDirectory)) { outputFilePath = outputFileName; } else { - outputFilePath = Path.Combine(CompiledMethodsOutputDirectory, outputFileName); + outputFilePath = Path.Combine(TrimmingEligibleMethodsOutputDirectory, outputFileName); } - aotArgs.Add($"compiled-methods-outfile={outputFilePath}"); + aotArgs.Add($"trimming-eligible-methods-outfile={outputFilePath}"); aotAssembly.SetMetadata("MethodTokenFile", outputFilePath); } From eaf4f55c3163f0cf30122e16a739cc11957a1fe5 Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Wed, 9 Aug 2023 15:17:25 -0400 Subject: [PATCH 16/19] Remove testing --- src/libraries/tests.proj | 7 ------- .../WebAssembly.Browser.StartupHook.Test.csproj | 1 - 2 files changed, 8 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 2c54f738a4ede..edce0bafbf461 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -371,13 +371,6 @@ - - - - - diff --git a/src/tests/FunctionalTests/WebAssembly/Browser/StartupHook/WebAssembly.Browser.StartupHook.Test.csproj b/src/tests/FunctionalTests/WebAssembly/Browser/StartupHook/WebAssembly.Browser.StartupHook.Test.csproj index 225d1a2f45e54..0acd55e74ce80 100644 --- a/src/tests/FunctionalTests/WebAssembly/Browser/StartupHook/WebAssembly.Browser.StartupHook.Test.csproj +++ b/src/tests/FunctionalTests/WebAssembly/Browser/StartupHook/WebAssembly.Browser.StartupHook.Test.csproj @@ -1,7 +1,6 @@ true - true From 0ac748c79153285e5aeaccb2d804c4afacfece2c Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Wed, 9 Aug 2023 15:22:44 -0400 Subject: [PATCH 17/19] Address review feedback --- src/mono/wasm/build/WasmApp.Native.targets | 6 +++--- src/mono/wasm/build/WasmApp.targets | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mono/wasm/build/WasmApp.Native.targets b/src/mono/wasm/build/WasmApp.Native.targets index 0832ec7411720..1a894ad7b9eab 100644 --- a/src/mono/wasm/build/WasmApp.Native.targets +++ b/src/mono/wasm/build/WasmApp.Native.targets @@ -685,7 +685,7 @@ CacheFilePath="$(_AOTCompilerCacheFile)" LLVMDebug="dwarfdebug" LLVMPath="$(EmscriptenUpstreamBinPath)" - CollectTrimmingEligibleMethods="$(WASMStripIL)" + CollectTrimmingEligibleMethods="$(WasmStripILAfterAOT)" TrimmingEligibleMethodsOutputDirectory="$(_WasmIntermediateOutputPath)tokens" IntermediateOutputPath="$(_WasmIntermediateOutputPath)" AotProfilePath="@(AotProfilePath)"> @@ -694,13 +694,13 @@ diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index 77d0c5569fb73..36d6aeb0ceb0d 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -85,7 +85,7 @@ - AppBundle directly contains user files - AppBundle/_framework contains generated files (dlls, runtime scripts, icu) - AppBundle/_content contains web files from nuget packages (css, js, etc) - - $(WASMStripIL) - Set to true to enable trimming away AOT compiled methods body (IL code) + - $(WasmStripILAfterAOT) - Set to true to enable trimming away AOT compiled methods body (IL code) Defaults to false. Public items: @@ -149,7 +149,7 @@ .dll - false + false _framework From 5476bb16589ceb954f89837202d732838330fa05 Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Wed, 9 Aug 2023 17:16:48 -0400 Subject: [PATCH 18/19] Address review feedback from Kate --- src/mono/mono/mini/aot-compiler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 1958c43e124e3..7822e7b9bb6bc 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -9866,6 +9866,8 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method) if (acfg->aot_opts.trimming_eligible_methods_outfile && acfg->trimming_eligible_methods_outfile != NULL) { if (!mono_method_is_generic_impl (method) && method->token != 0 && !cfg->deopt && !cfg->interp_entry_only && mini_get_interp_callbacks ()->jit_call_can_be_supported (method, mono_method_signature_internal (method))) { + // The call back to jit_call_can_be_supported is necessary for WASM, because it would still interprete some methods sometimes even though they were already AOT'ed. + // When that happens, interpreter needs to have the capability to call the AOT'ed version of that method, since the method body has already been trimmed. fprintf (acfg->trimming_eligible_methods_outfile, "%x\n", method->token); } } @@ -15625,7 +15627,7 @@ mono_aot_assemblies (MonoAssembly **assemblies, int nassemblies, guint32 jit_opt if (aot_opts.trimming_eligible_methods_outfile) { if (g_ensure_directory_exists (aot_opts.trimming_eligible_methods_outfile) == FALSE) { - fprintf (stderr, "AOT : failed to create the directory to save the compiled method names: %s\n", aot_opts.trimming_eligible_methods_outfile); + fprintf (stderr, "AOT : failed to create the directory to save the trimmable method names: %s\n", aot_opts.trimming_eligible_methods_outfile); exit (1); } } From 99b91bed6881d52cc91ed5e24421aaf45535cc04 Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Thu, 10 Aug 2023 10:34:08 -0400 Subject: [PATCH 19/19] Add a var for llvm_only --- src/mono/mono/mini/aot-compiler.c | 2 +- src/mono/mono/mini/ee.h | 2 +- src/mono/mono/mini/interp-stubs.c | 2 +- src/mono/mono/mini/interp/interp-internals.h | 2 +- src/mono/mono/mini/interp/interp.c | 4 ++-- src/mono/mono/mini/interp/transform.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 7822e7b9bb6bc..1944a77d2c00b 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -9865,7 +9865,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method) mono_atomic_inc_i32 (&acfg->stats.ccount); if (acfg->aot_opts.trimming_eligible_methods_outfile && acfg->trimming_eligible_methods_outfile != NULL) { - if (!mono_method_is_generic_impl (method) && method->token != 0 && !cfg->deopt && !cfg->interp_entry_only && mini_get_interp_callbacks ()->jit_call_can_be_supported (method, mono_method_signature_internal (method))) { + if (!mono_method_is_generic_impl (method) && method->token != 0 && !cfg->deopt && !cfg->interp_entry_only && mini_get_interp_callbacks ()->jit_call_can_be_supported (method, mono_method_signature_internal (method), acfg->aot_opts.llvm_only)) { // The call back to jit_call_can_be_supported is necessary for WASM, because it would still interprete some methods sometimes even though they were already AOT'ed. // When that happens, interpreter needs to have the capability to call the AOT'ed version of that method, since the method body has already been trimmed. fprintf (acfg->trimming_eligible_methods_outfile, "%x\n", method->token); diff --git a/src/mono/mono/mini/ee.h b/src/mono/mono/mini/ee.h index 27d00bad51750..1e88e9aaaa9d8 100644 --- a/src/mono/mono/mini/ee.h +++ b/src/mono/mono/mini/ee.h @@ -65,7 +65,7 @@ typedef gpointer MonoInterpFrameHandle; MONO_EE_CALLBACK (void, entry_llvmonly, (gpointer res, gpointer *args, gpointer imethod)) \ MONO_EE_CALLBACK (gpointer, get_interp_method, (MonoMethod *method)) \ MONO_EE_CALLBACK (MonoJitInfo*, compile_interp_method, (MonoMethod *method, MonoError *error)) \ - MONO_EE_CALLBACK (gboolean, jit_call_can_be_supported, (MonoMethod *method, MonoMethodSignature *sig)) \ + MONO_EE_CALLBACK (gboolean, jit_call_can_be_supported, (MonoMethod *method, MonoMethodSignature *sig, gboolean is_llvm_only)) \ typedef struct _MonoEECallbacks { diff --git a/src/mono/mono/mini/interp-stubs.c b/src/mono/mono/mini/interp-stubs.c index e67445f0ce453..0ade0c95e0440 100644 --- a/src/mono/mono/mini/interp-stubs.c +++ b/src/mono/mono/mini/interp-stubs.c @@ -253,7 +253,7 @@ stub_compile_interp_method (MonoMethod *method, MonoError *error) } static gboolean -stub_jit_call_can_be_supported (MonoMethod *method, MonoMethodSignature *sig) +stub_jit_call_can_be_supported (MonoMethod *method, MonoMethodSignature *sig, gboolean is_llvm_only) { return TRUE; } diff --git a/src/mono/mono/mini/interp/interp-internals.h b/src/mono/mono/mini/interp/interp-internals.h index 592b129248a75..4e0be7db04334 100644 --- a/src/mono/mono/mini/interp/interp-internals.h +++ b/src/mono/mono/mini/interp/interp-internals.h @@ -321,7 +321,7 @@ int mono_interp_type_size (MonoType *type, int mt, int *align_p); gboolean -interp_jit_call_can_be_supported (MonoMethod *method, MonoMethodSignature *sig); +interp_jit_call_can_be_supported (MonoMethod *method, MonoMethodSignature *sig, gboolean is_llvm_only); #if HOST_BROWSER diff --git a/src/mono/mono/mini/interp/interp.c b/src/mono/mono/mini/interp/interp.c index 76c9658181804..6fb6bdd582d29 100644 --- a/src/mono/mono/mini/interp/interp.c +++ b/src/mono/mono/mini/interp/interp.c @@ -8628,7 +8628,7 @@ interp_sufficient_stack (gsize size) } gboolean -interp_jit_call_can_be_supported (MonoMethod *method, MonoMethodSignature *sig) +interp_jit_call_can_be_supported (MonoMethod *method, MonoMethodSignature *sig, gboolean is_llvm_only) { if (sig->param_count > 10) return FALSE; @@ -8638,7 +8638,7 @@ interp_jit_call_can_be_supported (MonoMethod *method, MonoMethodSignature *sig) return FALSE; if (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) return FALSE; - if (!mono_llvm_only && method->is_inflated) + if (!is_llvm_only && method->is_inflated) return FALSE; if (method->string_ctor) return FALSE; diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 85fefefbbd43d..d4b7a94d8a4d9 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -1213,7 +1213,7 @@ mono_interp_jit_call_supported (MonoMethod *method, MonoMethodSignature *sig) { GSList *l; - if (!interp_jit_call_can_be_supported (method, sig)) + if (!interp_jit_call_can_be_supported (method, sig, mono_llvm_only)) return FALSE; if (mono_aot_only && m_class_get_image (method->klass)->aot_module && !(method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)) {