@@ -2272,22 +2272,28 @@ instantiate_info (MonoMemoryManager *mem_manager, MonoRuntimeGenericContextInfoT
2272
2272
2273
2273
mono_class_setup_vtable (info -> klass );
2274
2274
// FIXME: Check type load
2275
- if (mono_class_is_interface (iface_class )) {
2276
- gboolean variance_used ;
2277
- ioffset = mono_class_interface_offset_with_variance (info -> klass , iface_class , & variance_used );
2278
- g_assert (ioffset != -1 );
2279
- } else {
2280
- ioffset = 0 ;
2281
- }
2282
-
2283
- if (info -> method -> is_generic == 0 && mono_class_is_ginst (info -> method -> klass )) {
2284
- slot = mono_method_get_vtable_slot (((MonoMethodInflated * )(info -> method ))-> declaring );
2275
+
2276
+ if (mono_class_is_interface (info -> klass )) {
2277
+ // If constrained class is interface, we don't learn anything new by constraining
2278
+ method = info -> method ;
2285
2279
} else {
2286
- slot = mono_method_get_vtable_slot (info -> method );
2280
+ if (mono_class_is_interface (iface_class )) {
2281
+ gboolean variance_used ;
2282
+ ioffset = mono_class_interface_offset_with_variance (info -> klass , iface_class , & variance_used );
2283
+ g_assert (ioffset != -1 );
2284
+ } else {
2285
+ ioffset = 0 ;
2286
+ }
2287
+
2288
+ if (info -> method -> is_generic == 0 && mono_class_is_ginst (info -> method -> klass )) {
2289
+ slot = mono_method_get_vtable_slot (((MonoMethodInflated * )(info -> method ))-> declaring );
2290
+ } else {
2291
+ slot = mono_method_get_vtable_slot (info -> method );
2292
+ }
2293
+ g_assert (slot != -1 );
2294
+ g_assert (m_class_get_vtable (info -> klass ));
2295
+ method = m_class_get_vtable (info -> klass ) [ioffset + slot ];
2287
2296
}
2288
- g_assert (slot != -1 );
2289
- g_assert (m_class_get_vtable (info -> klass ));
2290
- method = m_class_get_vtable (info -> klass ) [ioffset + slot ];
2291
2297
2292
2298
if (info -> method -> is_inflated ) {
2293
2299
MonoGenericContext * method_ctx = mono_method_get_context (info -> method );
0 commit comments