From 56f106393e33e4d558f37ddfd6317fdb2690d7c0 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Sun, 28 Feb 2010 03:29:18 +0000 Subject: [PATCH] 2010-02-28 Zoltan Varga * object.c (build_imt_slots): Compute the vtable slot correctly for interfaces with static methods. Fixes #583817. svn path=/branches/mono-2-6/mono/; revision=152620 --- mono/metadata/ChangeLog | 5 +++++ mono/metadata/object.c | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog index db0ddccad082d..ac5d94ad1a52c 100644 --- a/mono/metadata/ChangeLog +++ b/mono/metadata/ChangeLog @@ -1,3 +1,8 @@ +2010-02-28 Zoltan Varga + + * object.c (build_imt_slots): Compute the vtable slot correctly for interfaces + with static methods. Fixes #583817. + 2010-02-26 Zoltan Varga * class.c (get_implicit_generic_array_interfaces): Fix the last change so diff --git a/mono/metadata/object.c b/mono/metadata/object.c index 3ac98100b7c8d..465da198ffbd3 100644 --- a/mono/metadata/object.c +++ b/mono/metadata/object.c @@ -1255,7 +1255,9 @@ build_imt_slots (MonoClass *klass, MonoVTable *vt, MonoDomain *domain, gpointer* for (i = 0; i < klass->interface_offsets_count; ++i) { MonoClass *iface = klass->interfaces_packed [i]; int interface_offset = klass->interface_offsets_packed [i]; - int method_slot_in_interface; + int method_slot_in_interface, vt_slot; + + vt_slot = interface_offset; for (method_slot_in_interface = 0; method_slot_in_interface < iface->method.count; method_slot_in_interface++) { MonoMethod *method; @@ -1267,15 +1269,22 @@ build_imt_slots (MonoClass *klass, MonoVTable *vt, MonoDomain *domain, gpointer* * add_imt_builder_entry anyway. */ method = mono_class_get_method_by_index (iface->generic_class->container_class, method_slot_in_interface); - if (mono_method_get_imt_slot (method) != slot_num) + if (mono_method_get_imt_slot (method) != slot_num) { + vt_slot ++; continue; + } } method = mono_class_get_method_by_index (iface, method_slot_in_interface); if (method->is_generic) { has_generic_virtual = TRUE; + vt_slot ++; continue; } - add_imt_builder_entry (imt_builder, method, &imt_collisions_bitmap, interface_offset + method_slot_in_interface, slot_num); + + if (!(method->flags & METHOD_ATTRIBUTE_STATIC)) { + add_imt_builder_entry (imt_builder, method, &imt_collisions_bitmap, vt_slot, slot_num); + vt_slot ++; + } } } if (extra_interfaces) {