Skip to content

Commit

Permalink
[mono] Extend mono_gsharedvt_constrained_call JIT icall to handle sta…
Browse files Browse the repository at this point in the history
…tic virtual methods (#90875)

* Handle static virtual calls in constrained_gsharedvt_call_setup
  • Loading branch information
kotlarmilos committed Aug 24, 2023
1 parent a3b1c63 commit 0c4329b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/mono/mono/mini/jit-icalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ constrained_gsharedvt_call_setup (gpointer mp, MonoMethod *cmethod, MonoClass *k

error_init (error);

if (mono_class_is_interface (klass) || !m_class_is_valuetype (klass)) {
if ((mono_class_is_interface (klass) || !m_class_is_valuetype (klass)) && !m_method_is_static (cmethod)) {
MonoObject *this_obj;

is_iface = mono_class_is_interface (klass);
Expand Down Expand Up @@ -1390,7 +1390,12 @@ constrained_gsharedvt_call_setup (gpointer mp, MonoMethod *cmethod, MonoClass *k
}
}

if (m_class_is_valuetype (klass) && (m->klass == mono_defaults.object_class || m->klass == m_class_get_parent (mono_defaults.enum_class) || m->klass == mono_defaults.enum_class)) {
if (m_method_is_static (cmethod)) {
/*
* Static calls don't have this arg
*/
*this_arg = NULL;
} else if (m_class_is_valuetype (klass) && (m->klass == mono_defaults.object_class || m->klass == m_class_get_parent (mono_defaults.enum_class) || m->klass == mono_defaults.enum_class)) {
/*
* Calling a non-vtype method with a vtype receiver, has to box.
*/
Expand Down

0 comments on commit 0c4329b

Please sign in to comment.