#endif
#define GC_NO_DESCRIPTOR ((gpointer)(0 | GC_DS_LENGTH))
+/*Boehm max heap cannot be smaller than 16MB*/
+#define MIN_BOEHM_MAX_HEAP_SIZE_IN_MB 16
+#define MIN_BOEHM_MAX_HEAP_SIZE (MIN_BOEHM_MAX_HEAP_SIZE_IN_MB << 20)
static gboolean gc_initialized = FALSE;
void
mono_gc_base_init (void)
{
+ char *env;
+
if (gc_initialized)
return;
GC_stackbottom = (char*)ss.ss_sp;
}
+#elif defined(__native_client__)
+ /* Do nothing, GC_stackbottom is set correctly in libgc */
#else
{
int dummy;
#ifdef HAVE_GC_GCJ_MALLOC
GC_init_gcj_malloc (5, NULL);
#endif
+
+#ifdef HAVE_GC_ALLOW_REGISTER_THREADS
+ GC_allow_register_threads();
+#endif
+
+ if ((env = getenv ("MONO_GC_PARAMS"))) {
+ char **ptr, **opts = g_strsplit (env, ",", -1);
+ for (ptr = opts; *ptr; ++ptr) {
+ char *opt = *ptr;
+ if (g_str_has_prefix (opt, "max-heap-size=")) {
+ glong max_heap;
+
+ opt = strchr (opt, '=') + 1;
+ if (*opt && mono_gc_parse_environment_string_extract_number (opt, &max_heap)) {
+ if (max_heap < MIN_BOEHM_MAX_HEAP_SIZE) {
+ fprintf (stderr, "max-heap-size must be at least %dMb.\n", MIN_BOEHM_MAX_HEAP_SIZE_IN_MB);
+ exit (1);
+ }
+ GC_set_max_heap_size (max_heap);
+ } else {
+ fprintf (stderr, "max-heap-size must be an integer.\n");
+ exit (1);
+ }
+ continue;
+ } else {
+ fprintf (stderr, "MONO_GC_PARAMS must be a comma-delimited list of one or more of the following:\n");
+ fprintf (stderr, " max-heap-size=N (where N is an integer, possibly with a k, m or a g suffix)\n");
+ exit (1);
+ }
+ }
+ g_strfreev (opts);
+ }
+
mono_gc_enable_events ();
gc_initialized = TRUE;
}
return NULL;
if (!SMALL_ENOUGH (klass->instance_size))
return NULL;
- if (klass->has_finalize || klass->marshalbyref || (mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS))
+ if (mono_class_has_finalizer (klass) || klass->marshalbyref || (mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS))
return NULL;
if (klass->rank)
return NULL;
g_assert_not_reached ();
}
+
+guint8*
+mono_gc_get_card_table (int *shift_bits, gpointer *card_mask)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
+void*
+mono_gc_get_nursery (int *shift_bits, size_t *size)
+{
+ return NULL;
+}
+
+gboolean
+mono_gc_precise_stack_mark_enabled (void)
+{
+ return FALSE;
+}
+
+FILE *
+mono_gc_get_logfile (void)
+{
+ return NULL;
+}
+
+void
+mono_gc_conservatively_scan_area (void *start, void *end)
+{
+ g_assert_not_reached ();
+}
+
+void *
+mono_gc_scan_object (void *obj)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
+gsize*
+mono_gc_get_bitmap_for_descr (void *descr, int *numbits)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
+void
+mono_gc_set_gc_callbacks (MonoGCCallbacks *callbacks)
+{
+}
+
/*
* These will call the redefined versions in libgc.
*/
#endif
+#ifdef HOST_WIN32
+BOOL APIENTRY mono_gc_dllmain (HMODULE module_handle, DWORD reason, LPVOID reserved)
+{
+ return GC_DllMain (module_handle, reason, reserved);
+}
+#endif
+
#endif /* no Boehm GC */