From: Aleksey Kliger Date: Wed, 20 Sep 2017 21:34:59 +0000 (-0400) Subject: [class] Short circuit collect_implemented_interfaces_aux on gparams X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=2d7b258eb95f64552d3118af545397003dcebfd6 [class] Short circuit collect_implemented_interfaces_aux on gparams and also setup_interface_offsets. A gparam is never a real interface so we can just short circuit if we see a gparam during interface collection. (A gparam may be instantiated with an interface --- but ginst interface offsets are processed anew when the ginst is initialized in mono_class_init, not somehow extracted from the gtd and the MonoGenericContext). --- diff --git a/mono/metadata/class.c b/mono/metadata/class.c index f00d436281a..f3e87fe6428 100644 --- a/mono/metadata/class.c +++ b/mono/metadata/class.c @@ -2926,6 +2926,10 @@ collect_implemented_interfaces_aux (MonoClass *klass, GPtrArray **res, GHashTabl *ifaces = g_hash_table_new (NULL, NULL); if (g_hash_table_lookup (*ifaces, ic)) continue; + /* A gparam is not an implemented interface for the purposes of + * mono_class_get_implemented_interfaces */ + if (mono_class_is_gparam (ic)) + continue; g_ptr_array_add (*res, ic); g_hash_table_insert (*ifaces, ic, ic); mono_class_init (ic); @@ -3316,7 +3320,9 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite) for (i = 0; i < k->interface_count; i++) { ic = k->interfaces [i]; - mono_class_init (ic); + /* A gparam does not have any interface_id set. */ + if (! mono_class_is_gparam (ic)) + mono_class_init (ic); if (max_iid < ic->interface_id) max_iid = ic->interface_id;