[Mono-devel-list] [PATCH] VTable layout

Paolo Molaro lupus at ximian.com
Sun Mar 21 11:27:44 EST 2004


On 03/20/04 Ben Maurer wrote:
> A changelog:
> 
>       * class.c -- do not insert non-virtual methods in the vtable 
>       * icall.c, mono-debug-debugger.c, object.c: if method->slot == -1,
>         that means the method is non-virtual. This never would have
>         happened before.
> 
> No regressions occur on the mini regression tests, the mono tests, nor
> the corlib tests.

If lluis can confirm there are no regressions, please commit.

> Index: icall.c
> ===================================================================
> RCS file: /cvs/public/mono/mono/metadata/icall.c,v
> retrieving revision 1.434
> diff -u -r1.434 icall.c
> --- icall.c	17 Mar 2004 23:59:47 -0000	1.434
> +++ icall.c	20 Mar 2004 20:42:14 -0000
> @@ -2549,9 +2549,12 @@
>  		}
>  		
>  		match = 0;
> -		if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
> -			continue;
> -		g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), method);
> +		if (method->slot != -1) {
> +			if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
> +				continue;
> +			g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), method);
> +		}
> +		

After this patch is committed and tested, you could try to use a
MonoBitset instead of the hashtable: it may give a measurable speedup.
Also, looking at the code, it's not clear to me what would happen for
properties which override just the get or the set method: maybe in that
case we need to consider both the setter and the getter slots in the
hashtable. Could you write a test case for that and try to break the
current code?
Thanks.

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list