#include <mono/metadata/appdomain.h>
#include <mono/metadata/marshal.h>
#include <mono/metadata/tabledefs.h>
-#include <mono/metadata/mono-debug-debugger.h>
#include "mini.h"
#include "mini-sparc.h"
}
}
+void
+mono_arch_patch_plt_entry (guint8 *code, guint8 *addr)
+{
+ g_assert_not_reached ();
+}
+
void
mono_arch_nullify_class_init_trampoline (guint8 *code, gssize *regs)
{
sparc_nop (code);
}
+void
+mono_arch_nullify_plt_entry (guint8 *code)
+{
+ g_assert_not_reached ();
+}
+
#define ALIGN_TO(val,align) (((val) + ((align) - 1)) & ~((align) - 1))
guchar*
if (tramp_type == MONO_TRAMPOLINE_CLASS_INIT)
tramp_addr = &mono_class_init_trampoline;
+ else if (tramp_type == MONO_TRAMPOLINE_AOT)
+ tramp_addr = mono_aot_trampoline;
else
tramp_addr = &mono_magic_trampoline;
- sparc_ldi_imm (code, sparc_sp, MONO_SPARC_STACK_BIAS + 200, sparc_o0);
+ sparc_ldi_imm (code, sparc_sp, MONO_SPARC_STACK_BIAS + 200, sparc_o2);
/* pass address of register table as third argument */
- sparc_add_imm (code, FALSE, sparc_sp, regs_offset, sparc_o2);
+ sparc_add_imm (code, FALSE, sparc_sp, regs_offset, sparc_o0);
sparc_set (code, tramp_addr, sparc_o7);
/* set %o1 to caller address */
if (has_caller)
sparc_mov_reg_reg (code, sparc_i7, sparc_o1);
else
sparc_set (code, 0, sparc_o1);
+ sparc_set (code, 0, sparc_o3);
sparc_jmpl (code, sparc_o7, sparc_g0, sparc_o7);
sparc_nop (code);
#define TRAMPOLINE_SIZE (((SPARC_SET_MAX_SIZE >> 2) * 2) + 2)
-static MonoJitInfo*
-create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain)
+gpointer
+mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len)
{
- MonoJitInfo *ji;
guint32 *code, *buf, *tramp;
tramp = mono_get_trampoline_code (tramp_type);
g_assert ((code - buf) <= TRAMPOLINE_SIZE);
- ji = g_new0 (MonoJitInfo, 1);
- ji->code_start = buf;
- ji->code_size = (code - buf) * 4;
+ if (code_len)
+ *code_len = (code - buf) * 4;
mono_jit_stats.method_trampolines++;
- mono_arch_flush_icache (ji->code_start, ji->code_size);
+ mono_arch_flush_icache (buf, (code - buf) * 4);
- return ji;
+ return buf;
}
-MonoJitInfo*
-mono_arch_create_jump_trampoline (MonoMethod *method)
-{
- MonoJitInfo *ji = create_specific_trampoline (method, MONO_TRAMPOLINE_JUMP, mono_domain_get ());
-
- ji->method = method;
- return ji;
-}
-
-/**
- * mono_arch_create_jit_trampoline:
- * @method: pointer to the method info
- *
- * Creates a trampoline function for virtual methods. If the created
- * code is called it first starts JIT compilation of method,
- * and then calls the newly created method. I also replaces the
- * corresponding vtable entry (see sparc_magic_trampoline).
- *
- * Returns: a pointer to the newly created code
- */
-gpointer
-mono_arch_create_jit_trampoline (MonoMethod *method)
-{
- MonoJitInfo *ji;
- gpointer code_start;
-
- ji = create_specific_trampoline (method, MONO_TRAMPOLINE_GENERIC, mono_domain_get ());
- code_start = ji->code_start;
- g_free (ji);
-
- return code_start;
-}
-
-/**
- * mono_arch_create_class_init_trampoline:
- * @vtable: the type to initialize
- *
- * Creates a trampoline function to run a type initializer.
- * If the trampoline is called, it calls mono_runtime_class_init with the
- * given vtable, then patches the caller code so it does not get called any
- * more.
- *
- * Returns: a pointer to the newly created code
- */
-gpointer
-mono_arch_create_class_init_trampoline (MonoVTable *vtable)
-{
- MonoJitInfo *ji;
- gpointer code;
-
- ji = create_specific_trampoline (vtable, MONO_TRAMPOLINE_CLASS_INIT, vtable->domain);
- code = ji->code_start;
- g_free (ji);
-
- return code;
-}
-
/*
* This method is only called when running in the Mono Debugger.
*/
gpointer
-mono_debugger_create_notification_function (gpointer *notification_address)
+mono_debugger_create_notification_function (MonoCodeManager *codeman)
{
guint8 *ptr, *buf;
- ptr = buf = mono_global_codeman_reserve (16);
- if (notification_address)
- *notification_address = buf;
+ ptr = buf = mono_code_manager_reserve (codeman, 16);
g_assert_not_reached ();