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

Sebastien Pouliot sebastien.pouliot at gmail.com
Wed Sep 16 14:49:27 EDT 2009


On Wed, 2009-09-16 at 16:31 -0300, Rodrigo Kumpera wrote:
> 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.

It was needed (and part of the new coreclrtest.cs tests) since the check
does not apply to jagged arrays where Foo[][] translate into newarr
Foo[]

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

Yep. Anyway like we said on IRC there are other ways to create an array
of a critical type. So it could be that the "newarr" is actually the bug
(and not the others). 

I'll fill a bug with MS and add/commit some new tests to Moonlight (so
we'll know if future versions of SL change their behavior). I'll
re-issue the (fixed) patch if/when I get more information.

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

The good news is that the rest of coreclr seems happy (at least in
runtime tests) with domain sharing.

> +        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
>         
> 



More information about the Mono-devel-list mailing list