Backport 64600 to 64607 revisions to the branch
authorMiguel de Icaza <miguel@gnome.org>
Thu, 31 Aug 2006 14:28:11 +0000 (14:28 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Thu, 31 Aug 2006 14:28:11 +0000 (14:28 -0000)
svn path=/trunk/mono/; revision=64617

mono/metadata/ChangeLog
mono/metadata/icall.c
mono/metadata/marshal.c
mono/mini/ChangeLog
mono/mini/mini-amd64.c
mono/mini/mini.c

index 5efd3d2575b9afa423a6d663650fd24039058da8..4bb05fef95290de8e62ae5986912c7342630047e 100644 (file)
@@ -2,9 +2,6 @@
 
        * icall.c (ves_icall_MonoType_get_Name): Add a '&' for byref types. Fixes #79110.
 
-       * marshal.c (emit_marshal_array): Avoid crash when a parameter with type array is 
-       missing a [MarshalAs] directive. Fixes #79203.
-
        * marshal.c (mono_marshal_load_type_info): Fix a race in initializing 
        klass->marshal_info. Fixes #79217.
 
index 2406905a917b642912ae0f28e0f31aa6357f60d4..eb05c9d661696cc5157bcbce1183fde7cb5a10fc 100644 (file)
@@ -1894,16 +1894,7 @@ ves_icall_MonoType_get_Name (MonoReflectionType *type)
 
        MONO_ARCH_SAVE_REGS;
 
-       if (type->type->byref) {
-               char *n = g_strdup_printf ("%s&", class->name);
-               MonoString *res = mono_string_new (domain, n);
-
-               g_free (n);
-
-               return res;
-       } else {
-               return mono_string_new (domain, class->name);
-       }
+       return mono_string_new (domain, class->name);
 }
 
 static MonoString*
index 0449d06c5927b8b598ebcf115090211a0f65aba1..57a01980dd3fe56a603a0dd91002350e1cfd2cd8 100644 (file)
@@ -6472,11 +6472,6 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
                        mono_mb_emit_exception_marshal_directive (mb, msg);
                        return conv_arg;
                }
-               if (!spec) {
-                       char *msg = g_strdup ("[MarshalAs] attribute required to marshal arrays to managed code.");
-                       mono_mb_emit_exception_marshal_directive (mb, msg);
-                       return conv_arg;
-               }                       
                if (spec->native != MONO_NATIVE_LPARRAY) {
                        char *msg = g_strdup ("Non LPArray marshalling of arrays to managed code is not implemented.");
                        mono_mb_emit_exception_marshal_directive (mb, msg);
@@ -6642,10 +6637,6 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
                int index_var, dest_ptr, loc, esize, param_num, num_elem;
                MonoMarshalConv conv;
                gboolean is_string = FALSE;
-
-               if (!spec)
-                       /* Already handled in CONV_IN */
-                       break;
                
                /* These are already checked in CONV_IN */
                g_assert (!t->byref);
@@ -9229,7 +9220,7 @@ mono_marshal_load_type_info (MonoClass* klass)
 
        layout = klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK;
 
-       info = g_malloc0 (sizeof (MonoMarshalType) + sizeof (MonoMarshalField) * count);
+       klass->marshal_info = info = g_malloc0 (sizeof (MonoMarshalType) + sizeof (MonoMarshalField) * count);
        info->num_fields = count;
        
        /* Try to find a size for this type in metadata */
@@ -9303,14 +9294,6 @@ mono_marshal_load_type_info (MonoClass* klass)
        if (info->native_size != mono_class_value_size (klass, NULL))
                klass->blittable = FALSE;
 
-       mono_loader_lock ();
-       if (klass->marshal_info)
-               /* Another thread already initialized it */
-               g_free (info);
-       else
-               klass->marshal_info = info;
-       mono_loader_unlock ();
-
        /* If this is an array type, ensure that we have element info */
        if (klass->element_class) {
                mono_marshal_load_type_info (klass->element_class);
index e03000bedf915db3b3d6704831732bc43666f173..252e630a1aa2c5e968131fe429189d2eb52f123a 100644 (file)
@@ -2,9 +2,6 @@
 
        * mini-amd64.c (mono_arch_emit_exceptions): Fix assertion introduced by the last change.
 
-       * mini.c (mono_runtime_cleanup_handlers): Clean up signal handlers on unix. Fixes
-       #79130.
-       
        * mini.c (handle_array_new): Applied patch from "briaeros007". Fix
        a race condition.
        (mini_get_ldelema_ins): Ditto.
index f498760366df69f6f85cb402aae04f24f6092d45..574da283349754693121abb9a26ab71fba6e99af 100644 (file)
@@ -4444,9 +4444,9 @@ mono_arch_emit_exceptions (MonoCompile *cfg)
                if (patch_info->type == MONO_PATCH_INFO_EXC)
                        code_size += 40;
                if (patch_info->type == MONO_PATCH_INFO_R8)
-                       code_size += 8 + 15; /* sizeof (double) + alignment */
+                       code_size += 8 + 7; /* sizeof (double) + alignment */
                if (patch_info->type == MONO_PATCH_INFO_R4)
-                       code_size += 4 + 15; /* sizeof (float) + alignment */
+                       code_size += 4 + 7; /* sizeof (float) + alignment */
        }
 
        while (cfg->code_len + code_size > (cfg->code_size - 16)) {
index c62ee11edce1533e064023d8d9c73246ee65c2a7..9434b619b05881cb6cc0c99ff307b4ae077d8f00 100644 (file)
@@ -2857,16 +2857,16 @@ handle_array_new (MonoCompile *cfg, MonoBasicBlock *bblock, int rank, MonoInst *
        /* Need to register the icall so it gets an icall wrapper */
        sprintf (icall_name, "ves_array_new_va_%d", rank);
 
-       mono_jit_lock ();
        info = mono_find_jit_icall_by_name (icall_name);
        if (info == NULL) {
                esig = mono_get_array_new_va_signature (rank);
                name = g_strdup (icall_name);
                info = mono_register_jit_icall (mono_array_new_va, name, esig, FALSE);
 
+               mono_jit_lock ();
                g_hash_table_insert (jit_icall_name_hash, name, name);
+               mono_jit_unlock ();
        }
-       mono_jit_unlock ();
 
        cfg->flags |= MONO_CFG_HAS_VARARGS;
 
@@ -3062,16 +3062,16 @@ mini_get_ldelema_ins (MonoCompile *cfg, MonoBasicBlock *bblock, MonoMethod *cmet
        /* Need to register the icall so it gets an icall wrapper */
        sprintf (icall_name, "ves_array_element_address_%d", rank);
 
-       mono_jit_lock ();
        info = mono_find_jit_icall_by_name (icall_name);
        if (info == NULL) {
                esig = mono_get_element_address_signature (rank);
                name = g_strdup (icall_name);
                info = mono_register_jit_icall (ves_array_element_address, name, esig, FALSE);
 
+               mono_jit_lock ();
                g_hash_table_insert (jit_icall_name_hash, name, name);
+               mono_jit_unlock ();
        }
-       mono_jit_unlock ();
 
        /* FIXME: This uses info->sig, but it should use the signature of the wrapper */
        temp = mono_emit_native_call (cfg, bblock, mono_icall_get_wrapper (info), info->sig, sp, ip, FALSE, FALSE);
@@ -10752,18 +10752,6 @@ add_signal_handler (int signo, gpointer handler)
 #endif
        g_assert (sigaction (signo, &sa, NULL) != -1);
 }
-
-static void
-remove_signal_handler (int signo)
-{
-       struct sigaction sa;
-
-       sa.sa_handler = SIG_DFL;
-       sigemptyset (&sa.sa_mask);
-       sa.sa_flags = 0;
-
-       g_assert (sigaction (signo, &sa, NULL) != -1);
-}
 #endif
 
 static void
@@ -10783,6 +10771,11 @@ mono_runtime_install_handlers (void)
 
 #else /* !PLATFORM_WIN32 */
 
+       /* libpthreads has its own implementation of sigaction(),
+        * but it seems to work well with our current exception
+        * handlers. If not we must call syscall directly instead 
+        * of sigaction */
+
        if (debug_options.handle_sigint)
                add_signal_handler (SIGINT, sigint_signal_handler);
 
@@ -10810,30 +10803,6 @@ mono_runtime_install_handlers (void)
 #endif /* PLATFORM_WIN32 */
 }
 
-static void
-mono_runtime_cleanup_handlers (void)
-{
-#ifdef PLATFORM_WIN32
-       win32_seh_cleanup();
-#else
-       if (debug_options.handle_sigint)
-               remove_signal_handler (SIGINT);
-
-       remove_signal_handler (SIGFPE);
-       remove_signal_handler (SIGQUIT);
-       remove_signal_handler (SIGILL);
-       remove_signal_handler (SIGBUS);
-       if (mono_jit_trace_calls != NULL)
-               remove_signal_handler (SIGUSR2);
-
-       remove_signal_handler (mono_thread_get_abort_signal ());
-
-       remove_signal_handler (SIGABRT);
-
-       remove_signal_handler (SIGSEGV);
-#endif /* PLATFORM_WIN32 */
-}
-
 
 #ifdef HAVE_LINUX_RTC_H
 #include <linux/rtc.h>
@@ -11294,7 +11263,9 @@ mini_cleanup (MonoDomain *domain)
 
        mono_icall_cleanup ();
 
-       mono_runtime_cleanup_handlers ();
+#ifdef PLATFORM_WIN32
+       win32_seh_cleanup();
+#endif
 
        mono_domain_free (domain, TRUE);