-/*
- * mini-gc.c: GC interface for the mono JIT
+/**
+ * \file
+ * GC interface for the mono JIT
*
* Author:
* Zoltan Varga (vargaz@gmail.com)
*
* Copyright 2009 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include "config.h"
#include "mini-gc.h"
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
static gboolean
get_provenance (StackFrameInfo *frame, MonoContext *ctx, gpointer data)
//#if defined(MONO_ARCH_GC_MAPS_SUPPORTED)
#include <mono/metadata/sgen-conf.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
#include <mono/utils/mono-counters.h>
#define SIZEOF_SLOT ((int)sizeof (mgreg_t))
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);
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;
} else {
tls->unwind_state.valid = FALSE;
}
- tls->unwind_state.unwind_data [MONO_UNWIND_DATA_JIT_TLS] = mono_native_tls_get_value (mono_jit_tls_id);
+ tls->unwind_state.unwind_data [MONO_UNWIND_DATA_JIT_TLS] = mono_tls_get_jit_tls ();
tls->unwind_state.unwind_data [MONO_UNWIND_DATA_DOMAIN] = mono_domain_get ();
}
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) {
/*
* Debugging aid to control the number of frames scanned precisely
*/
if (!precise_frame_limit_inited) {
- if (g_getenv ("MONO_PRECISE_COUNT"))
- precise_frame_limit = atoi (g_getenv ("MONO_PRECISE_COUNT"));
+ char *mono_precise_count = g_getenv ("MONO_PRECISE_COUNT");
+ if (mono_precise_count) {
+ precise_frame_limit = atoi (mono_precise_count);
+ g_free (mono_precise_count);
+ }
precise_frame_limit_inited = TRUE;
}
static int precise_count;
precise_count ++;
- if (g_getenv ("MONO_GCMAP_COUNT")) {
- if (precise_count == atoi (g_getenv ("MONO_GCMAP_COUNT")))
+ char *mono_gcmap_count = g_getenv ("MONO_GCMAP_COUNT");
+ if (mono_gcmap_count) {
+ int count = atoi (mono_gcmap_count);
+ g_free (mono_gcmap_count);
+ if (precise_count == count)
printf ("LAST: %s\n", mono_method_full_name (cfg->method, TRUE));
- if (precise_count > atoi (g_getenv ("MONO_GCMAP_COUNT")))
+ if (precise_count > count)
return;
}
}
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);
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 */
}
#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));
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);
}
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);
exit (1);
}
g_strfreev (opts);
+ g_free (env);
}
void