[Mono-dev] [Mono-patches] r152558 - trunk/mono/mono/metadata

Rodrigo Kumpera kumpera at gmail.com
Fri Feb 26 13:43:49 EST 2010


Hey Martin,

This changes the runtime behavior in a fundamental way. Please don't cowboy
code and provide tests for that.



On Fri, Feb 26, 2010 at 2:33 PM, Martin Baulig <
mono-patches-list at lists.ximian.com> wrote:

> Author: martin
> Date: 2010-02-26 12:33:31 -0500 (Fri, 26 Feb 2010)
> New Revision: 152558
>
> Modified:
>   trunk/mono/mono/metadata/ChangeLog
>   trunk/mono/mono/metadata/class-internals.h
>   trunk/mono/mono/metadata/object.c
> Log:
> Set `vtable->init_aborted' if we hit a `ThreadAbortException' in the class
> .cctor.
> 2010-02-26  Martin Baulig  <martin at ximian.com>
>
>        * class-internals.h (MonoVTable): Added `init_aborted'.
>
>        * object.c
>        (mono_runtime_class_init_full): Set `vtable->init_aborted' in
>        addition to `vtable->init_failed' if we hit a `ThreadAbortException'
>        while running the class .cctor and reset `init_failed' next time
>        we're called.
>
> Modified: trunk/mono/mono/metadata/ChangeLog
> ===================================================================
> --- trunk/mono/mono/metadata/ChangeLog  2010-02-26 17:33:21 UTC (rev
> 152557)
> +++ trunk/mono/mono/metadata/ChangeLog  2010-02-26 17:33:31 UTC (rev
> 152558)
> @@ -1,5 +1,15 @@
>  2010-02-26  Martin Baulig  <martin at ximian.com>
>
> +       * class-internals.h (MonoVTable): Added `init_aborted'.
> +
> +       * object.c
> +       (mono_runtime_class_init_full): Set `vtable->init_aborted' in
> +       addition to `vtable->init_failed' if we hit a
> `ThreadAbortException'
> +       while running the class .cctor and reset `init_failed' next time
> +       we're called.
> +
> +2010-02-26  Martin Baulig  <martin at ximian.com>
> +
>        * mono-debug.h
>        (MONO_DEBUGGER_MINOR_VERSION): Bump to 5.
>
>
> Modified: trunk/mono/mono/metadata/class-internals.h
> ===================================================================
> --- trunk/mono/mono/metadata/class-internals.h  2010-02-26 17:33:21 UTC
> (rev 152557)
> +++ trunk/mono/mono/metadata/class-internals.h  2010-02-26 17:33:31 UTC
> (rev 152558)
> @@ -438,6 +438,7 @@
>        guint remote          : 1; /* class is remotely activated */
>        guint initialized     : 1; /* cctor has been run */
>        guint init_failed     : 1; /* cctor execution failed */
> +       guint init_aborted    : 1; /* cctor execution aborted */
>        guint32     imt_collisions_bitmap;
>        MonoRuntimeGenericContext *runtime_generic_context;
>        /* do not add any fields after vtable, the structure is dynamically
> extended */
>
> Modified: trunk/mono/mono/metadata/object.c
> ===================================================================
> --- trunk/mono/mono/metadata/object.c   2010-02-26 17:33:21 UTC (rev
> 152557)
> +++ trunk/mono/mono/metadata/object.c   2010-02-26 17:33:31 UTC (rev
> 152558)
> @@ -285,6 +285,17 @@
>                        mono_type_initialization_unlock ();
>                        return NULL;
>                }
> +               if (vtable->init_aborted) {
> +                       /*
> +                        * The current thread was aborting while running
> the .cctor the last time,
> +                        * so let's try again.
> +                        *
> +                        * The Mono Debugger calls Thread.Abort() on the
> current thread to abort a
> +                        * method call (after an expression evaluation
> timeout, for instance).
> +                        */
> +                       vtable->init_aborted = 0;
> +                       vtable->init_failed = 0;
> +               }
>                if (vtable->init_failed) {
>                        mono_type_initialization_unlock ();
>
> @@ -364,6 +375,20 @@
>                                exc_to_throw =
> mono_get_exception_type_initialization (full_name, exc);
>                                g_free (full_name);
>
> +                               if (exc) {
> +                                       MonoClass *exc_klass =
> exc->object.vtable->klass;
> +
> +                                       if (exc_klass->image ==
> mono_defaults.corlib &&
> +                                           !strcmp (exc_klass->name_space,
> "System.Threading") &&
> +                                           !strcmp (exc_klass->name,
> "ThreadAbortException")) {
> +                                               /*
> +                                                * Set `init_aborted' in
> addition to `init_failed' if the
> +                                                * current thread was
> aborted while running the .cctor.
> +                                                */
> +                                               vtable->init_aborted = 1;
> +                                       }
> +                               }
> +
>                                /*
>                                 * Store the exception object so it could be
> thrown on subsequent
>                                 * accesses.
>
> _______________________________________________
> Mono-patches maillist  -  Mono-patches at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-patches
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100226/893b07e6/attachment.html 


More information about the Mono-devel-list mailing list