Skip to content

Commit c111208

Browse files
committed
[mono][aot] Avoid emitting gshared methods multiple times when preferring instances of them.
This fixes a part of the size regression added by c7c6aa0.
1 parent 2072f16 commit c111208

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/mono/mono/mini/aot-compiler.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4346,9 +4346,11 @@ add_extra_method_full (MonoAotCompile *acfg, MonoMethod *method, gboolean prefer
43464346
return;
43474347
}
43484348

4349-
if (g_hash_table_lookup (acfg->prefer_instances, method))
4350-
/* Compile an instance as well */
4349+
if (g_hash_table_lookup (acfg->prefer_instances, method) && !is_open_method (orig)) {
4350+
/* Compile an instance instead */
43514351
add_extra_method_full (acfg, orig, FALSE, depth);
4352+
return;
4353+
}
43524354

43534355
/* Add it to profile_methods so its not skipped later */
43544356
if (acfg->aot_opts.profile_only && g_hash_table_lookup (acfg->profile_methods, orig))
@@ -9282,6 +9284,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
92829284
* for performance reasons, since gshared methods cannot implement some
92839285
* features like static virtual methods efficiently.
92849286
*/
9287+
/* Instances encountered later will be handled in add_extra_method_full () */
92859288
g_hash_table_insert (acfg->prefer_instances, method, method);
92869289
GPtrArray *instances = g_hash_table_lookup (acfg->gshared_instances, method);
92879290
if (instances) {

0 commit comments

Comments
 (0)