[Mono-dev] [patch] coreclr check for newarr

Rodrigo Kumpera kumpera at gmail.com
Wed Sep 16 15:31:10 EDT 2009


Hi Sebastien,

A few notes:

+    /* we check rank == 0 because this is the "newarr" instruction, i.e.
newarr Char --> Char[] */
+    if (element->rank != 0)
+        return;
You don't need to check for element->rank == 0 as newarr is only ever used
for them.

Besides that, are you sure this restriction doesn't apply to bounded rank-1
arrays?

As noted on irc, your patch don't work with domain sharing (-O=shared)
enabled.

+        if (mlevel == MONO_SECURITY_CORE_CLR_TRANSPARENT) {
+            cfg->exception_type = MONO_EXCEPTION_TYPE_LOAD;
+            cfg->exception_message = g_strdup_printf ("Invalid array of
[SecurityCritical] '%s' type.", element->name);
+        }

Please use something like mono_type_get_full_name that builds the FQN of the
type.


On Sun, Sep 13, 2009 at 12:47 PM, Sebastien Pouliot <
sebastien.pouliot at gmail.com> wrote:

> Hello,
>
> This patch adds a new check for newarr when CoreCLR is enabled. In this
> case creating an array of a [SecuirtyCritical] type will throw a
> TypeLoadException at JIT time. AFAIK* this is the last runtime behavior
> difference, wrt CoreCLR, between Moonlight and Silverlight.
>
> Thanks,
> Sebastien
>
> * please feel free to educate me better ;-)
>
> _______________________________________________
> 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/20090916/f33201e1/attachment-0001.html 


More information about the Mono-devel-list mailing list