Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 5.6k
[mono][aot] Enabling AOT wrappers for virtual delegates#85643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
33604b1e0d201d6b6dae9c98a7480dbe14f030c8af01231cedc5ae4b1b80a47534c69ff791de0d0442b21405f3f3144e6e175dae93658fbc350bf949f4788c26bf6bf3e4c73dd44a7aeFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -3922,12 +3922,15 @@ encode_method_ref (MonoAotCompile *acfg, MonoMethod *method, guint8 *buf, guint8 | ||||
| encode_klass_ref (acfg, method->klass, p, &p); | ||||
| } else { | ||||
| MonoMethodSignature *sig = mono_method_signature_internal (method); | ||||
| WrapperInfo *wrapper_info = mono_marshal_get_wrapper_info (method); | ||||
| encode_value (0, p, &p); | ||||
| if (method->wrapper_type == MONO_WRAPPER_DELEGATE_INVOKE) | ||||
| encode_value (wrapper_info ? wrapper_info->subtype : 0, p, &p); | ||||
| encode_signature (acfg, sig, p, &p); | ||||
| encode_value (info ? info->subtype : 0, p, &p); | ||||
| if (info && info->subtype == WRAPPER_SUBTYPE_DELEGATE_INVOKE_VIRTUAL) | ||||
| encode_klass_ref (acfg, info->d.delegate_invoke.method->klass, p, &p); | ||||
| else | ||||
| encode_signature (acfg, sig, p, &p); | ||||
| } | ||||
| break; | ||||
| } | ||||
| @@ -4546,6 +4549,41 @@ can_marshal_struct (MonoClass *klass) | ||||
| return can_marshal; | ||||
| } | ||||
| /* Create a ref shared instantiation */ | ||||
| static void | ||||
| create_ref_shared_inst (MonoAotCompile *acfg, MonoMethod *method, MonoGenericContext *ctx) | ||||
| { | ||||
| MonoGenericContext shared_context; | ||||
| MonoType **args; | ||||
| MonoGenericInst *inst; | ||||
| MonoGenericContainer *container; | ||||
| memset (ctx, 0, sizeof (MonoGenericContext)); | ||||
| if (mono_class_is_gtd (method->klass)) { | ||||
| shared_context = mono_class_get_generic_container (method->klass)->context; | ||||
| inst = shared_context.class_inst; | ||||
| args = g_new0 (MonoType*, inst->type_argc); | ||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the memory being deallocated correctly?
| ||||
| memcpy (ginst->type_argv, type_argv, type_argc*sizeof (MonoType*)); |
^ @vargaz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can be freed, but the aot compiler is already leaking memory in a number of places, so its not that important.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1269,15 +1269,25 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod | ||
| ref->method = wrapper; | ||
| } | ||
| } else { | ||
| /* | ||
| * These wrappers are associated with a signature, not with a method. | ||
| * Since we can't decode them into methods, they need a target method. | ||
| */ | ||
| if (!target) | ||
vargaz marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| return FALSE; | ||
| MonoClass *klass; | ||
| MonoMethod *invoke; | ||
| if (wrapper_type == MONO_WRAPPER_DELEGATE_INVOKE) { | ||
| subtype = (WrapperSubtype)decode_value (p, &p); | ||
| if (subtype == WRAPPER_SUBTYPE_DELEGATE_INVOKE_VIRTUAL) { | ||
| klass = decode_klass_ref (module, p, &p, error); | ||
| invoke = mono_get_delegate_invoke_internal (klass); | ||
| ref->method = mono_marshal_get_delegate_invoke_internal(invoke, TRUE, FALSE, NULL); | ||
| break; | ||
| } | ||
| /* | ||
| * These wrappers are associated with a signature, not with a method. | ||
| * Since we can't decode them into methods, they need a target method. | ||
| */ | ||
| if (!target) | ||
| return FALSE; | ||
| info = mono_marshal_get_wrapper_info (target); | ||
| if (info) { | ||
| if (info->subtype != subtype) | ||
| @@ -1287,7 +1297,7 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod | ||
| return FALSE; | ||
| } | ||
| } | ||
| if (sig_matches_target (module, target, p, &p)) | ||
| if (target && sig_matches_target (module, target, p, &p)) | ||
| ref->method = target; | ||
| else | ||
| return FALSE; | ||
Uh oh!
There was an error while loading. Please reload this page.