[aot] Fix a small memory leak.
[mono.git] / mono / mini / tramp-ppc.c
index 7391809975f55188e747518e2f13b3e69a7bfa70..6fac1a1bcb0d8547183da06ccdcf4c8b479318e8 100644 (file)
@@ -14,6 +14,7 @@
 #include <config.h>
 #include <glib.h>
 
+#include <mono/metadata/abi-details.h>
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/tabledefs.h>
@@ -22,8 +23,7 @@
 #include "mini.h"
 #include "mini-ppc.h"
 
-static guint8* nullified_class_init_trampoline;
-
+#if 0
 /* Same as mono_create_ftnptr, but doesn't require a domain */
 static gpointer
 mono_ppc_create_ftnptr (guint8 *code)
@@ -40,6 +40,7 @@ mono_ppc_create_ftnptr (guint8 *code)
        return code;
 #endif
 }
+#endif
 
 /*
  * Return the instruction to jump from code to target, 0 if not
@@ -200,16 +201,7 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *a
 void
 mono_arch_nullify_class_init_trampoline (guint8 *code, mgreg_t *regs)
 {
-       mono_arch_patch_callsite (NULL, code, nullified_class_init_trampoline);
-}
-
-void
-mono_arch_nullify_plt_entry (guint8 *code, mgreg_t *regs)
-{
-       if (mono_aot_only && !nullified_class_init_trampoline)
-               nullified_class_init_trampoline = mono_aot_get_trampoline ("nullified_class_init_trampoline");
-
-       mono_arch_patch_plt_entry (code, NULL, regs, nullified_class_init_trampoline);
+       mono_arch_patch_callsite (NULL, code, mini_get_nullified_class_init_trampoline ());
 }
 
 /* Stack size for trampoline function 
@@ -440,11 +432,6 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf
        /* Sanity check */
        g_assert ((code - buf) <= size);
 
-       if (tramp_type == MONO_TRAMPOLINE_CLASS_INIT) {
-               /* Initialize the nullified class init trampoline */
-               nullified_class_init_trampoline = mono_ppc_create_ftnptr (mono_arch_get_nullified_class_init_trampoline (NULL));
-       }
-
        if (info) {
                tramp_name = mono_get_generic_trampoline_name (tramp_type);
                *info = mono_tramp_info_create (tramp_name, buf, code - buf, ji, unwind_ops);
@@ -559,7 +546,7 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info
                ppc_mr (code, ppc_r4, PPC_FIRST_ARG_REG);
        } else {
                /* load rgctx ptr from vtable */
-               ppc_ldptr (code, ppc_r4, G_STRUCT_OFFSET (MonoVTable, runtime_generic_context), PPC_FIRST_ARG_REG);
+               ppc_ldptr (code, ppc_r4, MONO_STRUCT_OFFSET (MonoVTable, runtime_generic_context), PPC_FIRST_ARG_REG);
                /* is the rgctx ptr null? */
                ppc_compare_reg_imm (code, 0, ppc_r4, 0);
                /* if yes, jump to actual trampoline */