X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Ftramp-ia64.c;h=2b4af7f8fe2ac613acd6667519fa76134d17d8a0;hb=6fc86ee499b93937a52d685a3ca01e5bbecbd0ae;hp=6065e5c2623def4b36390de9667906c129a284ae;hpb=8eb34747c9207df9cf861c5e6e384de919cf4373;p=mono.git diff --git a/mono/mini/tramp-ia64.c b/mono/mini/tramp-ia64.c index 6065e5c2623..2b4af7f8fe2 100644 --- a/mono/mini/tramp-ia64.c +++ b/mono/mini/tramp-ia64.c @@ -19,8 +19,6 @@ #include "mini.h" #include "mini-ia64.h" -#define NOT_IMPLEMENTED g_assert_not_reached () - #define GP_SCRATCH_REG 31 #define GP_SCRATCH_REG2 30 @@ -45,15 +43,10 @@ mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) /* FIXME: Optimize this */ - if (!mono_method_signature (m)->ret->byref && MONO_TYPE_ISSTRUCT (mono_method_signature (m)->ret)) - this_reg = 1; - func_addr = ((gpointer*)addr) [0]; func_gp = ((gpointer*)addr) [1]; - mono_domain_lock (domain); - buf = mono_code_manager_reserve (domain->code_mp, 256); - mono_domain_unlock (domain); + buf = mono_domain_code_reserve (domain, 256); /* Since the this reg is a stacked register, its a bit hard to access it */ ia64_codegen_init (code, buf); @@ -74,11 +67,13 @@ mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) desc [0] = buf; desc [1] = func_gp; + mono_tramp_info_register (mono_tramp_info_create (NULL, buf, code.buf - buf, NULL, NULL), domain); + return desc; } void -mono_arch_patch_callsite (guint8 *code, guint8 *addr) +mono_arch_patch_callsite (guint8 *method_start, guint8 *code, guint8 *addr) { guint8 *callsite_begin; guint64 *callsite = (guint64*)(gpointer)(code - 16); @@ -125,83 +120,13 @@ mono_arch_patch_callsite (guint8 *code, guint8 *addr) } 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) -{ - guint8 *callsite_begin; - guint64 *callsite = (guint64*)(gpointer)(code - 16); - guint64 instructions [3]; - guint64 buf [16]; - Ia64CodegenState gen; - - while ((ia64_bundle_template (callsite) != IA64_TEMPLATE_MLX) && - (ia64_bundle_template (callsite) != IA64_TEMPLATE_MLXS)) - callsite -= 2; - callsite_begin = (guint8*)callsite; - - /* Replace the code generated by emit_call with a sets of nops */ - - /* The first bundle might have other instructions in it */ - instructions [0] = ia64_bundle_ins1 (callsite); - instructions [1] = IA64_NOP_X; - instructions [2] = IA64_NOP_X; - - ia64_codegen_init (gen, (guint8*)buf); - ia64_emit_bundle_template (&gen, ia64_bundle_template (callsite), instructions [0], instructions [1], instructions [2]); - ia64_codegen_close (gen); - - /* This might not be safe, but not all itanium processors support st16 */ - callsite [0] = buf [0]; - callsite [1] = buf [1]; - - callsite += 2; - - /* The other bundles can be full replaced with nops */ - - ia64_codegen_init (gen, (guint8*)buf); - ia64_emit_bundle_template (&gen, IA64_TEMPLATE_MII, IA64_NOP_M, IA64_NOP_I, IA64_NOP_I); - ia64_codegen_close (gen); - - while ((guint8*)callsite < code) { - callsite [0] = buf [0]; - callsite [1] = buf [1]; - callsite += 2; - } - - mono_arch_flush_icache (callsite_begin, code - callsite_begin); -} - -void -mono_arch_nullify_plt_entry (guint8 *code) +mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) { g_assert_not_reached (); } -void -mono_arch_patch_delegate_trampoline (guint8 *code, guint8 *tramp, gssize *regs, guint8 *addr) -{ - /* - * This is called by the code generated by OP_CALL_REG: - * ld8 r30=[r8],8 - * nop.i 0x0;; - * mov.sptk b6=r30 - * ld8 r1=[r8] - * br.call.sptk.few b0=b6 - */ - - /* We patch the function descriptor instead of delegate->method_ptr */ - //g_assert (((gpointer*)(regs [8] - 8))[0] == tramp); - ((gpointer*)(regs [8] - 8))[0] = mono_get_addr_from_ftnptr (addr); - ((gpointer*)(regs [8] - 8))[1] = NULL; -} - guchar* -mono_arch_create_trampoline_code (MonoTrampolineType tramp_type) +mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInfo **info, gboolean aot) { guint8 *buf, *tramp; int i, offset, saved_regs_offset, saved_fpregs_offset, last_offset, framesize; @@ -211,6 +136,9 @@ mono_arch_create_trampoline_code (MonoTrampolineType tramp_type) unw_dyn_info_t *di; unw_dyn_region_info_t *r_pro; + g_assert (!aot); + *info = NULL; + /* * Since jump trampolines are not patched, this trampoline is executed every * time a call is made to a jump trampoline. So we try to keep things faster @@ -328,7 +256,7 @@ mono_arch_create_trampoline_code (MonoTrampolineType tramp_type) /* This is not perf critical code so no need to check the interrupt flag */ ia64_mov (code, l2, IA64_R8); - tramp = (guint8*)mono_thread_interruption_checkpoint; + tramp = (guint8*)mono_thread_force_interruption_checkpoint; ia64_movl (code, l0, tramp); ia64_ld8_inc_imm (code, l1, l0, 8); ia64_mov_to_br (code, IA64_B6, l1); @@ -344,25 +272,17 @@ mono_arch_create_trampoline_code (MonoTrampolineType tramp_type) /* FIXME: Handle NATs in fp regs / scratch regs */ - if (tramp_type != MONO_TRAMPOLINE_CLASS_INIT) { - /* Load method address from function descriptor */ - ia64_ld8 (code, l0, IA64_R8); - ia64_mov_to_br (code, IA64_B6, l0); - } + /* Load method address from function descriptor */ + ia64_ld8 (code, l0, IA64_R8); + ia64_mov_to_br (code, IA64_B6, l0); /* Clean up register/memory stack frame */ ia64_adds_imm (code, IA64_SP, framesize, IA64_SP); ia64_mov_to_ar_i (code, IA64_PFS, l5); - if (tramp_type == MONO_TRAMPOLINE_CLASS_INIT) { - ia64_mov_ret_to_br (code, IA64_B0, l7); - ia64_br_ret_reg (code, IA64_B0); - } - else { - /* Call the compiled method */ - ia64_mov_to_br (code, IA64_B0, l7); - ia64_br_cond_reg (code, IA64_B6); - } + /* Call the compiled method */ + ia64_mov_to_br (code, IA64_B0, l7); + ia64_br_cond_reg (code, IA64_B6); ia64_codegen_close (code); @@ -395,9 +315,7 @@ mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_ty tramp = mono_get_trampoline_code (tramp_type); - mono_domain_lock (domain); - buf = mono_code_manager_reserve (domain->code_mp, TRAMPOLINE_SIZE); - mono_domain_unlock (domain); + buf = mono_domain_code_reserve (domain, TRAMPOLINE_SIZE); /* FIXME: Optimize this */ @@ -435,9 +353,9 @@ mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg) } gpointer -mono_debugger_create_notification_function (void) +mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info, gboolean aot) { - NOT_IMPLEMENTED; - + /* FIXME: implement! */ + g_assert_not_reached (); return NULL; }