X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fexceptions-ia64.c;h=a7d04a568487c7697a4afe24b7f24baae939db09;hb=07178b9c886ac087f6785d3fc593bfa98d169082;hp=0b8bb2f3620de70c01545ee716fbf99c48b9d2f3;hpb=25a65a17552f510c26f16a21dfd086f112b61133;p=mono.git diff --git a/mono/mini/exceptions-ia64.c b/mono/mini/exceptions-ia64.c index 0b8bb2f3620..a7d04a56848 100644 --- a/mono/mini/exceptions-ia64.c +++ b/mono/mini/exceptions-ia64.c @@ -37,8 +37,6 @@ #define ALIGN_TO(val,align) (((val) + ((align) - 1)) & ~((align) - 1)) -#define NOT_IMPLEMENTED g_assert_not_reached () - #define GP_SCRATCH_REG 31 #define GP_SCRATCH_REG2 30 @@ -101,8 +99,8 @@ static gpointer get_real_call_filter (void) { static gpointer filter; + static gboolean inited = FALSE; guint8 *start; - gboolean inited = FALSE; Ia64CodegenState code; int in0, local0, out0, nout; unw_dyn_info_t *di; @@ -116,17 +114,18 @@ get_real_call_filter (void) /* int call_filter (guint64 fp, guint64 ip) */ /* - * We have to create a register+stack frame similar to the frame which contains - * the filter. + * We have to create a register+stack frame similar to the frame which + * contains the filter. * - setting fp * - setting up a register stack frame - * These cannot be set up in this function, because the fp register is a stacked - * register which is different in each method. Also, the register stack frame is - * different in each method. So we pass the FP value in a a non-stacked - * register and the code generated by the OP_START_HANDLER opcode will copy it - * to the appropriate register after setting up the register stack frame. + * These cannot be set up in this function, because the fp register is a + * stacked register which is different in each method. Also, the register + * stack frame is different in each method. So we pass the FP value in a a + * non-stacked register and the code generated by the OP_START_HANDLER + * opcode will copy it to the appropriate register after setting up the + * register stack frame. * The stacked registers are not need to be set since variables used in - * handler registers are never allocated to registers. + * handler regions are never allocated to registers. */ in0 = 32; @@ -152,25 +151,13 @@ get_real_call_filter (void) /* Target ip */ ia64_mov_to_br (code, IA64_B6, in0 + 1); - /* Return address */ - ia64_mov_from_ip (code, GP_SCRATCH_REG); - ia64_adds_imm (code, GP_SCRATCH_REG, 3 * 16, GP_SCRATCH_REG); - /* Call the filter */ ia64_br_call_reg (code, IA64_B0, IA64_B6); /* R8 contains the result of the filter */ - /* R9 contains the saved apr_pfs value */ /* FIXME: Add unwind info for this */ - /* The filter returns using br_cond_reg, so have to do another return */ - ia64_mov_to_ar_i (code, IA64_PFS, IA64_R9); - ia64_mov_from_ip (code, GP_SCRATCH_REG); - ia64_adds_imm (code, GP_SCRATCH_REG, 4 * 16, GP_SCRATCH_REG); - ia64_mov_to_br (code, IA64_B0, GP_SCRATCH_REG); - ia64_br_ret_reg (code, IA64_B0); - ia64_begin_bundle (code); r_body = mono_ia64_create_unwind_region (&code); @@ -269,7 +256,7 @@ throw_exception (MonoObject *exc, guint64 rethrow) res = unw_get_reg (&ctx.cursor, UNW_IA64_SP, &sp); g_assert (res == 0); - ji = mono_jit_info_table_find (mono_domain_get (), (gpointer)ip); + ji = mini_jit_info_table_find (mono_domain_get (), (gpointer)ip, NULL); //printf ("UN: %s %lx %lx\n", ji ? ji->method->name : "", ip, sp); @@ -287,6 +274,7 @@ throw_exception (MonoObject *exc, guint64 rethrow) } g_assert (res >= 0); } + ctx.precise_ip = FALSE; mono_handle_exception (&ctx, exc, (gpointer)(ip), FALSE); restore_context (&ctx); @@ -398,32 +386,12 @@ mono_arch_get_rethrow_exception (void) return start; } -gpointer -mono_arch_get_throw_exception_by_name (void) -{ - guint8* start; - Ia64CodegenState code; - - start = mono_global_codeman_reserve (64); - - /* Not used on ia64 */ - ia64_codegen_init (code, start); - ia64_break_i (code, 1001); - ia64_codegen_close (code); - - g_assert ((code.buf - start) <= 256); - - mono_arch_flush_icache (start, code.buf - start); - - return start; -} - /** * mono_arch_get_throw_corlib_exception: * * Returns a function pointer which can be used to raise * corlib exceptions. The returned function has the following - * signature: void (*func) (guint32 ex_token, guint32 offset); + * signature: void (*func) (guint32 ex_token_index, guint32 offset); * Here, offset is the offset which needs to be substracted from the caller IP * to get the IP of the throw. Passing the offset has the advantage that it * needs no relocations in the caller. @@ -431,8 +399,9 @@ mono_arch_get_throw_exception_by_name (void) gpointer mono_arch_get_throw_corlib_exception (void) { - static guint8* start; + static guint8* res; static gboolean inited = FALSE; + guint8 *start; gpointer ptr; int i, in0, local0, out0, nout; Ia64CodegenState code; @@ -440,7 +409,7 @@ mono_arch_get_throw_corlib_exception (void) unw_dyn_region_info_t *r_pro; if (inited) - return start; + return res; start = mono_global_codeman_reserve (1024); @@ -466,6 +435,8 @@ mono_arch_get_throw_corlib_exception (void) /* Call exception_from_token */ ia64_movl (code, out0 + 0, mono_defaults.exception_class->image); ia64_mov (code, out0 + 1, in0 + 0); + ia64_movl (code, GP_SCRATCH_REG, MONO_TOKEN_TYPE_DEF); + ia64_add (code, out0 + 1, in0 + 0, GP_SCRATCH_REG); ptr = mono_exception_from_token; ia64_movl (code, GP_SCRATCH_REG, ptr); ia64_ld8_inc_imm (code, GP_SCRATCH_REG2, GP_SCRATCH_REG, 8); @@ -510,7 +481,10 @@ mono_arch_get_throw_corlib_exception (void) mono_arch_flush_icache (start, code.buf - start); - return ia64_create_ftnptr (start); + res = ia64_create_ftnptr (start); + inited = TRUE; + + return res; } /* mono_arch_find_jit_info: @@ -524,14 +498,14 @@ mono_arch_get_throw_corlib_exception (void) */ MonoJitInfo * mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *res, MonoJitInfo *prev_ji, MonoContext *ctx, - MonoContext *new_ctx, char **trace, MonoLMF **lmf, int *native_offset, - gboolean *managed) + MonoContext *new_ctx, MonoLMF **lmf, gboolean *managed) { MonoJitInfo *ji; int err; unw_word_t ip; *new_ctx = *ctx; + new_ctx->precise_ip = FALSE; while (TRUE) { err = unw_get_reg (&new_ctx->cursor, UNW_IA64_IP, &ip); @@ -541,7 +515,7 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInf if (prev_ji && ((guint8*)ip > (guint8*)prev_ji->code_start && ((guint8*)ip < ((guint8*)prev_ji->code_start) + prev_ji->code_size))) ji = prev_ji; else - ji = mono_jit_info_table_find (domain, (gpointer)ip); + ji = mini_jit_info_table_find (domain, (gpointer)ip, NULL); if (managed) *managed = FALSE; @@ -617,7 +591,7 @@ mono_arch_handle_exception (void *sigctx, gpointer obj, gboolean test_only) res = unw_get_reg (&ctx.cursor, UNW_IA64_IP, &ip); g_assert (res == 0); - ji = mono_jit_info_table_find (mono_domain_get (), (gpointer)ip); + ji = mini_jit_info_table_find (mono_domain_get (), (gpointer)ip, NULL); if (ji) break; @@ -625,6 +599,7 @@ mono_arch_handle_exception (void *sigctx, gpointer obj, gboolean test_only) res = unw_step (&ctx.cursor); g_assert (res >= 0); } + ctx.precise_ip = TRUE; mono_handle_exception (&ctx, obj, (gpointer)ip, test_only);