[mono] Optimize generic sharing for generic methods.#64129
[mono] Optimize generic sharing for generic methods.#64129vargaz merged 4 commits intodotnet:mainfrom
Conversation
05a3821 to
f366e2d
Compare
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
These changes decrease the size of the wasm executable for the System.Runtime tests by about 8%. |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
The llvmfullaot lanes failures look related. |
|
Can't reproduce the failure locally. |
Previously, rgctx entries where stored either in the class rgctx or the method rgctx in linked structures, and accessed using rgctx trampolines (for non-llvmonly configuration), or inline code and fallback C code (for llvmonly configuration). However, if a method has an mrgctx parameter, all the rgctx entries can be stored as an array in the mrgctx and accessed using a simple load. One complication is that the mrgctx might need to be allocated before the method is compiled/loaded, so the rgctx entries need to be stored in a separate array, and the array needs to be initialized on demand. * Add an 'entries' field to MonoMethodRuntimeGenericContext which stores the rgctx entries. * Add a MonoGSharedMethodInfo structure which stores the information needed to initialize a MonoMethodRuntimeGenericContext, i.e. the number of rgctx entries and their contents. * Add a MONO_PATCH_INFO_GSHARED_METHOD_INFO patch type to refer to the previous structure. * Add a mini_init_method_rgctx () JIT icall, which initializes an mrgctx if needed and generate code in the prolog of gshared methods to call it.
Previously, these methods were passed a vtable. Passing the mrgctx instead simplifies some runtime code and allows smaller/faster access to rgctx entries.
|
/azp run runtime-extra-platforms |
|
Comment was made before the most recent commit for PR 64129 in repo dotnet/runtime |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
The llvmfullaot lane failures are related, can't reproduce locally. |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-wasm |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-wasm |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Failures are unrelated. |
|
|
||
| // The +1 is for the NULL check at the beginning | ||
| // FIXME: memory management | ||
| gpointer *entries = mono_mem_manager_alloc0 (get_default_mem_manager (), (sizeof (gpointer) * (info->num_entries + 1))); |
There was a problem hiding this comment.
why not fix it using the correct mem_manager, is this situation difficult to get it?
* [mono] Optimize generic sharing for generic methods. Previously, rgctx entries where stored either in the class rgctx or the method rgctx in linked structures, and accessed using rgctx trampolines (for non-llvmonly configuration), or inline code and fallback C code (for llvmonly configuration). However, if a method has an mrgctx parameter, all the rgctx entries can be stored as an array in the mrgctx and accessed using a simple load. One complication is that the mrgctx might need to be allocated before the method is compiled/loaded, so the rgctx entries need to be stored in a separate array, and the array needs to be initialized on demand. * Add an 'entries' field to MonoMethodRuntimeGenericContext which stores the rgctx entries. * Add a MonoGSharedMethodInfo structure which stores the information needed to initialize a MonoMethodRuntimeGenericContext, i.e. the number of rgctx entries and their contents. * Add a MONO_PATCH_INFO_GSHARED_METHOD_INFO patch type to refer to the previous structure. * Add a mini_init_method_rgctx () JIT icall, which initializes an mrgctx if needed and generate code in the prolog of gshared methods to call it. * [mono] Pass an mrgctx to static/valuetype gshared methods. Previously, these methods were passed a vtable. Passing the mrgctx instead simplifies some runtime code and allows smaller/faster access to rgctx entries. * Add rgctx trampolines in get_ftnptr_for_method (). * [mono][wasm] Avoid AOTing Microsoft.CodeAnalysis.dll as well.
Previously, rgctx entries where stored either in the class rgctx
or the method rgctx in linked structures, and accessed using
rgctx trampolines (for non-llvmonly configuration), or
inline code and fallback C code (for llvmonly configuration).
However, if a method has an mrgctx parameter, all the rgctx entries
can be stored as an array in the mrgctx and accessed using a simple
load.
One complication is that the mrgctx might need to be allocated before
the method is compiled/loaded, so the rgctx entries need to be stored
in a separate array, and the array needs to be initialized on
demand.
the rgctx entries.
needed to initialize a MonoMethodRuntimeGenericContext, i.e. the
number of rgctx entries and their contents.
to the previous structure.
an mrgctx if needed and generate code in the prolog of gshared methods
to call it.