Skip to content

Commit

Permalink
[mini] Don't add unbox tramopline on generic DIM calls
Browse files Browse the repository at this point in the history
Don't unbox a valuetype `this` if the generic method is a DIM

Fixes dotnet/runtime#58394
  • Loading branch information
lambdageek committed Sep 2, 2021
1 parent 1bdb6cc commit 83b1e1f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mono/mini/mini-trampolines.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,11 +642,13 @@ common_call_trampoline (host_mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTa
return NULL;

if (generic_virtual || variant_iface) {
if (m_class_is_valuetype (vt->klass)) /*FIXME is this required variant iface?*/
if (m_class_is_valuetype (vt->klass) && !mini_method_is_default_method (m)) /*FIXME is this required variant iface?*/
need_unbox_tramp = TRUE;
} else if (orig_vtable_slot) {
if (m_class_is_valuetype (m->klass))
if (m_class_is_valuetype (m->klass)) {
g_assert (!mini_method_is_default_method (m));
need_unbox_tramp = TRUE;
}
}

addr = mini_add_method_trampoline (m, compiled_method, need_rgctx_tramp, need_unbox_tramp);
Expand Down

0 comments on commit 83b1e1f

Please sign in to comment.