X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fmini-gc.c;h=1566cb0d8741a3473f18e0329270b1c4bb7c6bd4;hb=416d4e10f905b8fe3d57f20b957e8cff86a7f1ec;hp=750d2ed0da2e4455ee977e77bb71bd4a0e4caf9e;hpb=dd6251e6f846fc59c73e39494027858a8d3b77c0;p=mono.git diff --git a/mono/mini/mini-gc.c b/mono/mini/mini-gc.c index 750d2ed0da2..1566cb0d874 100644 --- a/mono/mini/mini-gc.c +++ b/mono/mini/mini-gc.c @@ -436,6 +436,9 @@ static int callee_saved_regs [] = { AMD64_RBP, AMD64_RBX, AMD64_R12, AMD64_R13, static int callee_saved_regs [] = { X86_EBX, X86_ESI, X86_EDI }; #elif defined(TARGET_ARM) static int callee_saved_regs [] = { ARMREG_V1, ARMREG_V2, ARMREG_V3, ARMREG_V4, ARMREG_V5, ARMREG_V7, ARMREG_FP }; +#elif defined(TARGET_ARM64) +// FIXME: +static int callee_saved_regs [] = { }; #elif defined(TARGET_S390X) static int callee_saved_regs [] = { s390_r6, s390_r7, s390_r8, s390_r9, s390_r10, s390_r11, s390_r12, s390_r13, s390_r14 }; #endif @@ -590,21 +593,30 @@ thread_suspend_func (gpointer user_data, void *sigctx, MonoContext *ctx) if (!tls) { /* Happens during startup */ - tls->unwind_state.valid = FALSE; return; } if (tls->tid != GetCurrentThreadId ()) { /* Happens on osx because threads are not suspended using signals */ +#ifndef TARGET_WIN32 gboolean res; +#endif g_assert (tls->info); - res = mono_thread_state_init_from_handle (&tls->unwind_state, (MonoNativeThreadId)tls->tid, tls->info->native_handle); +#ifdef TARGET_WIN32 + return; +#else + res = mono_thread_state_init_from_handle (&tls->unwind_state, tls->info); +#endif } else { tls->unwind_state.unwind_data [MONO_UNWIND_DATA_LMF] = mono_get_lmf (); if (sigctx) { +#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX mono_arch_sigctx_to_monoctx (sigctx, &tls->unwind_state.ctx); tls->unwind_state.valid = TRUE; +#else + tls->unwind_state.valid = FALSE; +#endif } else if (ctx) { memcpy (&tls->unwind_state.ctx, ctx, sizeof (MonoContext)); tls->unwind_state.valid = TRUE; @@ -695,6 +707,7 @@ static void conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end) { MonoJitInfo *ji; + MonoMethod *method; MonoContext ctx, new_ctx; MonoLMF *lmf; guint8 *stack_limit; @@ -804,10 +817,15 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end) continue; } + if (ji) + method = jinfo_get_method (ji); + else + method = NULL; + /* The last frame can be in any state so mark conservatively */ if (last) { if (ji) { - DEBUG (char *fname = mono_method_full_name (ji->method, TRUE); fprintf (logfile, "Mark(0): %s+0x%x (%p)\n", fname, pc_offset, (gpointer)MONO_CONTEXT_GET_IP (&ctx)); g_free (fname)); + DEBUG (char *fname = mono_method_full_name (method, TRUE); fprintf (logfile, "Mark(0): %s+0x%x (%p)\n", fname, pc_offset, (gpointer)MONO_CONTEXT_GET_IP (&ctx)); g_free (fname)); } DEBUG (fprintf (logfile, "\t \n")); last = FALSE; @@ -834,8 +852,8 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end) pc_offset = (guint8*)MONO_CONTEXT_GET_IP (&ctx) - (guint8*)ji->code_start; /* These frames are very problematic */ - if (ji->method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) { - DEBUG (char *fname = mono_method_full_name (ji->method, TRUE); fprintf (logfile, "Mark(0): %s+0x%x (%p)\n", fname, pc_offset, (gpointer)MONO_CONTEXT_GET_IP (&ctx)); g_free (fname)); + if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) { + DEBUG (char *fname = mono_method_full_name (method, TRUE); fprintf (logfile, "Mark(0): %s+0x%x (%p)\n", fname, pc_offset, (gpointer)MONO_CONTEXT_GET_IP (&ctx)); g_free (fname)); DEBUG (fprintf (logfile, "\tSkip.\n")); continue; } @@ -866,7 +884,7 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end) emap = ji->gc_info; if (!emap) { - DEBUG (char *fname = mono_method_full_name (ji->method, TRUE); fprintf (logfile, "Mark(0): %s+0x%x (%p)\n", fname, pc_offset, (gpointer)MONO_CONTEXT_GET_IP (&ctx)); g_free (fname)); + DEBUG (char *fname = mono_method_full_name (jinfo_get_method (ji), TRUE); fprintf (logfile, "Mark(0): %s+0x%x (%p)\n", fname, pc_offset, (gpointer)MONO_CONTEXT_GET_IP (&ctx)); g_free (fname)); DEBUG (fprintf (logfile, "\tNo GC Map.\n")); continue; } @@ -878,14 +896,14 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end) * Debugging aid to control the number of frames scanned precisely */ if (!precise_frame_limit_inited) { - if (getenv ("MONO_PRECISE_COUNT")) - precise_frame_limit = atoi (getenv ("MONO_PRECISE_COUNT")); + if (g_getenv ("MONO_PRECISE_COUNT")) + precise_frame_limit = atoi (g_getenv ("MONO_PRECISE_COUNT")); precise_frame_limit_inited = TRUE; } if (precise_frame_limit != -1) { if (precise_frame_count [FALSE] == precise_frame_limit) - printf ("LAST PRECISE FRAME: %s\n", mono_method_full_name (ji->method, TRUE)); + printf ("LAST PRECISE FRAME: %s\n", mono_method_full_name (method, TRUE)); if (precise_frame_count [FALSE] > precise_frame_limit) continue; } @@ -906,7 +924,7 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end) frame_start = fp + map->start_offset + map->map_offset; frame_end = fp + map->end_offset; - DEBUG (char *fname = mono_method_full_name (ji->method, TRUE); fprintf (logfile, "Mark(0): %s+0x%x (%p) limit=%p fp=%p frame=%p-%p (%d)\n", fname, pc_offset, (gpointer)MONO_CONTEXT_GET_IP (&ctx), stack_limit, fp, frame_start, frame_end, (int)(frame_end - frame_start)); g_free (fname)); + DEBUG (char *fname = mono_method_full_name (jinfo_get_method (ji), TRUE); fprintf (logfile, "Mark(0): %s+0x%x (%p) limit=%p fp=%p frame=%p-%p (%d)\n", fname, pc_offset, (gpointer)MONO_CONTEXT_GET_IP (&ctx), stack_limit, fp, frame_start, frame_end, (int)(frame_end - frame_start)); g_free (fname)); /* Find the callsite index */ if (map->callsite_entry_size == 1) { @@ -928,7 +946,7 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end) break; } if (i == map->ncallsites) { - printf ("Unable to find ip offset 0x%x in callsite list of %s.\n", pc_offset + 1, mono_method_full_name (ji->method, TRUE)); + printf ("Unable to find ip offset 0x%x in callsite list of %s.\n", pc_offset + 1, mono_method_full_name (method, TRUE)); g_assert_not_reached (); } cindex = i; @@ -1107,7 +1125,7 @@ precise_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end) fi = &tls->frames [findex]; frame_start = stack_start + fi->frame_start_offset; - DEBUG (char *fname = mono_method_full_name (fi->ji->method, TRUE); fprintf (logfile, "Mark(1): %s\n", fname); g_free (fname)); + DEBUG (char *fname = mono_method_full_name (jinfo_get_method (fi->ji), TRUE); fprintf (logfile, "Mark(1): %s\n", fname); g_free (fname)); /* * FIXME: Add a function to mark using a bitmap, to avoid doing a @@ -1234,10 +1252,10 @@ mini_gc_init_gc_map (MonoCompile *cfg) static int precise_count; precise_count ++; - if (getenv ("MONO_GCMAP_COUNT")) { - if (precise_count == atoi (getenv ("MONO_GCMAP_COUNT"))) + if (g_getenv ("MONO_GCMAP_COUNT")) { + if (precise_count == atoi (g_getenv ("MONO_GCMAP_COUNT"))) printf ("LAST: %s\n", mono_method_full_name (cfg->method, TRUE)); - if (precise_count > atoi (getenv ("MONO_GCMAP_COUNT"))) + if (precise_count > atoi (g_getenv ("MONO_GCMAP_COUNT"))) return; } } @@ -1853,7 +1871,11 @@ sp_offset_to_fp_offset (MonoCompile *cfg, int sp_offset) #elif defined(TARGET_X86) /* The offset is computed from the sp at the start of the call sequence */ g_assert (cfg->frame_reg == X86_EBP); +#ifdef MONO_X86_NO_PUSHES + return (- cfg->arch.sp_fp_offset + sp_offset); +#else return (- cfg->arch.sp_fp_offset - sp_offset); +#endif #else NOT_IMPLEMENTED; return -1; @@ -2040,7 +2062,11 @@ compute_frame_size (MonoCompile *cfg) #ifdef TARGET_AMD64 min_offset = MIN (min_offset, -cfg->arch.sp_fp_offset); #elif defined(TARGET_X86) +#ifdef MONO_X86_NO_PUSHES + min_offset = MIN (min_offset, -cfg->arch.sp_fp_offset); +#else min_offset = MIN (min_offset, - (cfg->arch.sp_fp_offset + cfg->arch.param_area_size)); +#endif #elif defined(TARGET_ARM) // FIXME: #elif defined(TARGET_s390X) @@ -2436,9 +2462,9 @@ static void parse_debug_options (void) { char **opts, **ptr; - char *env; + const char *env; - env = getenv ("MONO_GCMAP_DEBUG"); + env = g_getenv ("MONO_GCMAP_DEBUG"); if (!env) return; @@ -2513,6 +2539,11 @@ mini_gc_init (void) #else +void +mini_gc_enable_gc_maps_for_aot (void) +{ +} + void mini_gc_init (void) { @@ -2542,11 +2573,6 @@ mini_gc_set_slot_type_from_cfa (MonoCompile *cfg, int slot_offset, GCSlotType ty #endif /* DISABLE_JIT */ -void -mini_gc_enable_gc_maps_for_aot (void) -{ -} - #endif #ifndef DISABLE_JIT