X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fmini-gc.c;h=47265e1d10f50156070c8372ba7447619fb12436;hb=a341404ecdd3b5ca2ed0ab1e9a5bcb9b5ccd2566;hp=93bcd7d1a2efceb8ece1addc184566dbd2602fb5;hpb=4e9a0636c24e5f7114b98c558398412c73af766f;p=mono.git diff --git a/mono/mini/mini-gc.c b/mono/mini/mini-gc.c index 93bcd7d1a2e..47265e1d10f 100644 --- a/mono/mini/mini-gc.c +++ b/mono/mini/mini-gc.c @@ -10,13 +10,35 @@ #include "config.h" #include "mini-gc.h" -#include +#include + +static gboolean +get_provenance (StackFrameInfo *frame, MonoContext *ctx, gpointer data) +{ + MonoJitInfo *ji = frame->ji; + MonoMethod *method; + if (!ji) + return FALSE; + method = jinfo_get_method (ji); + if (method->wrapper_type != MONO_WRAPPER_NONE) + return FALSE; + *(gpointer *)data = method; + return TRUE; +} + +static gpointer +get_provenance_func (void) +{ + gpointer provenance = NULL; + mono_walk_stack (get_provenance, MONO_UNWIND_DEFAULT, (gpointer)&provenance); + return provenance; +} #if 0 //#if defined(MONO_ARCH_GC_MAPS_SUPPORTED) #include -#include +#include #include #define SIZEOF_SLOT ((int)sizeof (mgreg_t)) @@ -436,6 +458,13 @@ static int callee_saved_regs [] = { ARMREG_V1, ARMREG_V2, ARMREG_V3, ARMREG_V4, 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 }; +#elif defined(TARGET_POWERPC64) && _CALL_ELF == 2 +static int callee_saved_regs [] = { + ppc_r13, ppc_r14, ppc_r15, ppc_r16, + ppc_r17, ppc_r18, ppc_r19, ppc_r20, + ppc_r21, ppc_r22, ppc_r23, ppc_r24, + ppc_r25, ppc_r26, ppc_r27, ppc_r28, + ppc_r29, ppc_r30, ppc_r31 }; #elif defined(TARGET_POWERPC) static int callee_saved_regs [] = { ppc_r6, ppc_r7, ppc_r8, ppc_r9, ppc_r10, ppc_r11, ppc_r12, ppc_r13, ppc_r14 }; #endif @@ -568,7 +597,7 @@ thread_attach_func (void) TlsData *tls; tls = g_new0 (TlsData, 1); - tls->tid = GetCurrentThreadId (); + tls->tid = mono_native_thread_id_get (); tls->info = mono_thread_info_current (); stats.tlsdata_size += sizeof (TlsData); @@ -593,7 +622,7 @@ thread_suspend_func (gpointer user_data, void *sigctx, MonoContext *ctx) return; } - if (tls->tid != GetCurrentThreadId ()) { + if (tls->tid != mono_native_thread_id_get ()) { /* Happens on osx because threads are not suspended using signals */ #ifndef TARGET_WIN32 gboolean res; @@ -792,6 +821,7 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end) ji = frame.ji; // FIXME: For skipped frames, scan the param area of the parent frame conservatively ? + // FIXME: trampolines if (frame.type == FRAME_TYPE_MANAGED_TO_NATIVE) { /* @@ -1649,7 +1679,7 @@ process_variables (MonoCompile *cfg) int hreg; GCSlotType slot_type; - t = mini_type_get_underlying_type (NULL, t); + t = mini_get_underlying_type (t); hreg = ins->dreg; g_assert (hreg < MONO_MAX_IREGS); @@ -1657,7 +1687,7 @@ process_variables (MonoCompile *cfg) if (byref) slot_type = SLOT_PIN; else - slot_type = mini_type_is_reference (cfg, t) ? SLOT_REF : SLOT_NOREF; + slot_type = mini_type_is_reference (t) ? SLOT_REF : SLOT_NOREF; if (slot_type == SLOT_PIN) { /* These have no live interval, be conservative */ @@ -1804,9 +1834,9 @@ process_variables (MonoCompile *cfg) } #endif - t = mini_type_get_underlying_type (NULL, t); + t = mini_get_underlying_type (t); - if (!mini_type_is_reference (cfg, t)) { + if (!mini_type_is_reference (t)) { set_slot_everywhere (gcfg, pos, SLOT_NOREF); if (cfg->verbose_level > 1) printf ("\tnoref%s at %s0x%x(fp) (R%d, slot = %d): %s\n", (is_arg ? " arg" : ""), ins->inst_offset < 0 ? "-" : "", (ins->inst_offset < 0) ? -(int)ins->inst_offset : (int)ins->inst_offset, vmv->vreg, pos, mono_type_full_name (ins->inst_vtype)); @@ -1910,7 +1940,7 @@ process_param_area_slots (MonoCompile *cfg) guint32 size; if (MONO_TYPE_ISSTRUCT (t)) { - size = mini_type_stack_size_full (cfg->generic_sharing_context, t, &align, FALSE); + size = mini_type_stack_size_full (t, &align, FALSE); } else { size = sizeof (mgreg_t); } @@ -2024,7 +2054,7 @@ compute_frame_size (MonoCompile *cfg) if (ins->opcode == OP_REGOFFSET) { int size, size_in_slots; - size = mini_type_stack_size_full (cfg->generic_sharing_context, ins->inst_vtype, NULL, ins->backend.is_pinvoke); + size = mini_type_stack_size_full (ins->inst_vtype, NULL, ins->backend.is_pinvoke); size_in_slots = ALIGN_TO (size, SIZEOF_SLOT) / SIZEOF_SLOT; min_offset = MIN (min_offset, ins->inst_offset); @@ -2485,6 +2515,7 @@ mini_gc_init (void) cb.thread_suspend_func = thread_suspend_func; /* Comment this out to disable precise stack marking */ cb.thread_mark_func = thread_mark_func; + cb.get_provenance_func = get_provenance_func; mono_gc_set_gc_callbacks (&cb); logfile = mono_gc_get_logfile (); @@ -2544,6 +2575,10 @@ mini_gc_enable_gc_maps_for_aot (void) void mini_gc_init (void) { + MonoGCCallbacks cb; + memset (&cb, 0, sizeof (cb)); + cb.get_provenance_func = get_provenance_func; + mono_gc_set_gc_callbacks (&cb); } #ifndef DISABLE_JIT