[runtime] Use mono_restore_context () to reduce code duplication in the back ends.
[mono.git] / mono / mini / tramp-s390x.c
index 91e760e41880a7af372befeb3c76d343e9b053a5..fe25878f14756bb2b14c4a65d32c84fcfd6e0786 100644 (file)
@@ -219,6 +219,7 @@ mono_arch_nullify_plt_entry (guint8 *code, mgreg_t *regs)
 guchar*
 mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInfo **info, gboolean aot)
 {
+       char *tramp_name;
        guint8 *buf, *tramp, *code;
        int i, offset, lmfOffset;
        GSList *unwind_ops = NULL;
@@ -401,9 +402,11 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf
        /* Flush instruction cache, since we've generated code */
        mono_arch_flush_icache (code, buf - code);
        
-       if (info)
-               *info = mono_tramp_info_create (mono_get_generic_trampoline_name(tramp_type), 
-                                               buf, buf - code, ji, unwind_ops);
+       if (info) {
+               tramp_name = mono_get_generic_trampoline_name (tramp_type);
+               *info = mono_tramp_info_create (tramp_name, buf, buf - code, ji, unwind_ops);
+               g_free (tramp_name);
+       }
 
        /* Sanity check */
        g_assert ((buf - code) <= 512);
@@ -563,8 +566,11 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info
 
        g_assert (code - buf <= tramp_size);
 
-       if (info)
-               *info = mono_tramp_info_create (mono_get_rgctx_fetch_trampoline_name (slot), buf, code - buf, ji, unwind_ops);
+       if (info) {
+               char *name = mono_get_rgctx_fetch_trampoline_name (slot);
+               *info = mono_tramp_info_create (name, buf, code - buf, ji, unwind_ops);
+               g_free (name);
+       }
 
        return(buf);
 #else
@@ -660,7 +666,7 @@ mono_arch_create_generic_class_init_trampoline (MonoTrampInfo **info, gboolean a
        g_assert (code - buf <= tramp_size);
 
        if (info)
-               *info = mono_tramp_info_create (g_strdup_printf ("generic_class_init_trampoline"), buf, code - buf, ji, unwind_ops);
+               *info = mono_tramp_info_create ("generic_class_init_trampoline", buf, code - buf, ji, unwind_ops);
 
        return(buf);
 }