Skip to content

Commit 10e7596

Browse files
committed
[mono][interp] Stop trying to inflate signature
The target method and, implicitly, its signature are already inflated. This was allocating a new signature every time the method was called which was leaked. On some of the bigger tests suites, that heavily use generics, this can reduce the mem usage in the order of GBs.
1 parent dfbda9a commit 10e7596

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/mono/mono/mini/interp/transform.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3214,10 +3214,14 @@ interp_constrained_box (TransformData *td, MonoClass *constrained_class, MonoMet
32143214
static MonoMethod*
32153215
interp_get_method (MonoMethod *method, guint32 token, MonoImage *image, MonoGenericContext *generic_context, MonoError *error)
32163216
{
3217-
if (method->wrapper_type == MONO_WRAPPER_NONE)
3217+
if (method->wrapper_type == MONO_WRAPPER_NONE) {
32183218
return mono_get_method_checked (image, token, NULL, generic_context, error);
3219-
else
3220-
return (MonoMethod *)mono_method_get_wrapper_data (method, token);
3219+
} else {
3220+
MonoMethod *target_method = mono_method_get_wrapper_data (method, token);
3221+
if (generic_context)
3222+
target_method = mono_class_inflate_generic_method_checked (target_method, generic_context, error);
3223+
return target_method;
3224+
}
32213225
}
32223226

32233227
/*
@@ -3440,13 +3444,6 @@ interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target
34403444
target_method = interp_get_method (method, token, image, generic_context, error);
34413445
return_val_if_nok (error, FALSE);
34423446
csignature = mono_method_signature_internal (target_method);
3443-
3444-
if (generic_context) {
3445-
csignature = mono_inflate_generic_signature (csignature, generic_context, error);
3446-
return_val_if_nok (error, FALSE);
3447-
target_method = mono_class_inflate_generic_method_checked (target_method, generic_context, error);
3448-
return_val_if_nok (error, FALSE);
3449-
}
34503447
}
34513448
} else {
34523449
csignature = mono_method_signature_internal (target_method);

0 commit comments

Comments
 (0)