2009-01-26 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Mon, 26 Jan 2009 06:51:37 +0000 (06:51 -0000)
committerZoltan Varga <vargaz@gmail.com>
Mon, 26 Jan 2009 06:51:37 +0000 (06:51 -0000)
Backport of r124456.

* exceptions-amd64.c (mono_arch_exceptions_init): Call
get_throw_pending_exception () to avoid initialization races.

* mini-exceptions.c (mono_exceptions_init): Call an arch specific
mono_arch_exceptions_init () function.

svn path=/branches/mono-2-2/mono/; revision=124461

mono/mini/ChangeLog
mono/mini/exceptions-amd64.c
mono/mini/mini-amd64.h
mono/mini/mini-exceptions.c
mono/mini/mini.h

index f995732c1b6a9b69ba3c9971305645b8a47163da..e19a9f41d03011ed13e94a9f92b17f6893060abb 100644 (file)
@@ -1,3 +1,13 @@
+2009-01-26  Zoltan Varga  <vargaz@gmail.com>
+
+       Backport of r124456.
+
+       * exceptions-amd64.c (mono_arch_exceptions_init): Call 
+       get_throw_pending_exception () to avoid initialization races.
+
+       * mini-exceptions.c (mono_exceptions_init): Call an arch specific
+       mono_arch_exceptions_init () function.
+
 2009-01-25  Zoltan Varga  <vargaz@gmail.com>
 
        * Backport of r123987.
index 84dca7f4dd50cce0f4e67fa25d23af5466253233..f8d578ade1d9e90b1577e68a0e77303d14b186b4 100644 (file)
@@ -1049,6 +1049,13 @@ mono_arch_notify_pending_exc (void)
        *(gpointer*)(lmf->rsp - 8) = get_throw_pending_exception ();
 }
 
+void
+mono_arch_exceptions_init (void)
+{
+       /* Call this to avoid initialization races */
+       get_throw_pending_exception ();
+}
+
 #ifdef PLATFORM_WIN32
 
 /*
index a0ba8977431321dfdca5ba354b206fd4f1dc8c5b..e8ff081712832ad950d6e6c2a33ad7b5386f40a3 100644 (file)
@@ -291,6 +291,7 @@ typedef struct {
 #define MONO_ARCH_HAVE_CMOV_OPS 1
 #define MONO_ARCH_HAVE_NOTIFY_PENDING_EXC 1
 #define MONO_ARCH_ENABLE_NORMALIZE_OPCODES 1
+#define MONO_ARCH_HAVE_EXCEPTIONS_INIT 1
 #define MONO_ARCH_ENABLE_GLOBAL_RA 1
 #define MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK 1
 #if !defined(PLATFORM_WIN32) && !defined(HAVE_MOVING_COLLECTOR)
index ab2e80e3de9c5668fcf1367e54b7210ade6ef556..fdb9c2932ee74594932590998c7b92ef660c308f 100644 (file)
@@ -86,6 +86,10 @@ mono_exceptions_init (void)
        try_more_restore_tramp = mono_create_specific_trampoline (try_more_restore, MONO_TRAMPOLINE_RESTORE_STACK_PROT, mono_domain_get (), NULL);
        restore_stack_protection_tramp = mono_create_specific_trampoline (restore_stack_protection, MONO_TRAMPOLINE_RESTORE_STACK_PROT, mono_domain_get (), NULL);
 #endif
+
+#ifdef MONO_ARCH_HAVE_EXCEPTIONS_INIT
+       mono_arch_exceptions_init ();
+#endif
 }
 
 gpointer
index 9577c668c0f15d22f656237ae555ccab100c9ee0..920e5126ea19bfcde64d44f5b7ae2485024f34f8 100644 (file)
@@ -1498,6 +1498,7 @@ gpointer  mono_arch_get_throw_exception         (void) MONO_INTERNAL;
 gpointer  mono_arch_get_rethrow_exception       (void) MONO_INTERNAL;
 gpointer  mono_arch_get_throw_exception_by_name (void) MONO_INTERNAL;
 gpointer  mono_arch_get_throw_corlib_exception  (void) MONO_INTERNAL;
+void      mono_arch_exceptions_init             (void) MONO_INTERNAL;
 guchar*   mono_arch_create_trampoline_code      (MonoTrampolineType tramp_type) MONO_INTERNAL;
 guchar*   mono_arch_create_trampoline_code_full (MonoTrampolineType tramp_type, guint32 *code_size, MonoJumpInfo **ji, gboolean aot) MONO_INTERNAL;
 gpointer  mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot) MONO_INTERNAL;