[Mono-dev] [patch] reflection.c

Rodrigo Kumpera kumpera at gmail.com
Thu Feb 5 11:18:02 EST 2009


+    if (method->dynamic || method->klass->image->dynamic) {
+        gboolean result;
+        MonoCustomAttrInfo *ainfo = lookup_custom_attr
(method->klass->image, method);
+
+        if (ainfo != NULL) {
+            result = mono_custom_attrs_has_attr_partial (ainfo,
attr_assembly, attr_name_space, attr_name);
+            mono_custom_attrs_free (ainfo);
+            return result;
+        }
+    }

There are quite a few duplicates of the dynamic image check, just it to
mono_custom_attrs_has_attr_partial.
It would look like "mono_custom_attrs_has_attr_partial (void *key, MonoImage
*image, const char *attr_assembly, ...)"

The non static functions should be added to object-internal.h together with
the other reflection.c internal functions and tagged with MONO_INTERNAL.

Your patch add query capabilities to all valid targets of a custom
attribute, which is not something you need for your inline attribute.

Now in order to validate it, get the inline attribute patch up to date. Then
you need to measure the impact of it both in terms of speed and memory
footprint.
The assemblies to be testes can pretty much be:
  -System (or any huge assembly) modified with the attribute added to a
bunch of methods and classes.
  -all assemblies compiled under mcs/class/lib/net_2_0

To test for speed, time the duration of mono --compile-all.
To test for memory consumption, run with mono --compile-all --stats and
gather the values.

To it with and without querying for the attribute presence. Don't change
inlining heuristics for this test as it will cause more code to be compiled
and will rank the result too bad.

Thanks for looking at this,
Rodrigo

2009/2/3 Jerry Maine <crashfourit at gmail.com>

> Jerry Maine wrote:
> > Jerry Maine wrote:
> >
> >> Here is a proof of concept for a patch for reflection.c
> >>
> >> Any comments?
> >>
> > patch released under X11/MIT license.
> >
> >
> Here's an updated patch.
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090205/d39543c1/attachment.html 


More information about the Mono-devel-list mailing list