Permalink
Browse files

[sgen] MONO_GC_DEBUG option for disabling the managed allocator.

This can be used to make all object allocations show up in the dtrace probe.
  • Loading branch information...
1 parent d33ff74 commit a520276c76fed3f136658b16995c3182be7dc643 @schani schani committed Nov 1, 2012
Showing with 26 additions and 0 deletions.
  1. +3 −0 man/mono.1
  2. +11 −0 mono/metadata/sgen-alloc.c
  3. +11 −0 mono/metadata/sgen-gc.c
  4. +1 −0 mono/metadata/sgen-gc.h
View
3 man/mono.1
@@ -1189,6 +1189,9 @@ Don't do major collections.
Forces the GC to scan the stack conservatively, even if precise
scanning is available.
.TP
+\fBno-managed-allocator\fR
+Disables the managed allocator.
+.TP
\fBcheck-scan-starts\fR
If set, does a plausibility check on the scan_starts before and after each collection
.TP
View
11 mono/metadata/sgen-alloc.c
@@ -69,6 +69,8 @@ enum {
#undef OPDEF
+static gboolean use_managed_allocator = TRUE;
+
#ifdef HEAVY_STATISTICS
static long long stat_objects_alloced = 0;
static long long stat_bytes_alloced = 0;
@@ -986,12 +988,21 @@ mono_gc_get_managed_array_allocator (MonoVTable *vtable, int rank)
#endif
}
+void
+sgen_set_use_managed_allocator (gboolean flag)
+{
+ use_managed_allocator = flag;
+}
+
MonoMethod*
mono_gc_get_managed_allocator_by_type (int atype)
{
#ifdef MANAGED_ALLOCATION
MonoMethod *res;
+ if (!use_managed_allocator)
+ return NULL;
+
if (!mono_runtime_has_tls_get ())
return NULL;
View
11 mono/metadata/sgen-gc.c
@@ -4541,6 +4541,8 @@ mono_gc_base_init (void)
do_verify_nursery = TRUE;
} else if (!strcmp (opt, "dump-nursery-at-minor-gc")) {
do_dump_nursery_content = TRUE;
+ } else if (!strcmp (opt, "no-managed-allocator")) {
+ sgen_set_use_managed_allocator (FALSE);
} else if (!strcmp (opt, "disable-minor")) {
disable_minor_collections = TRUE;
} else if (!strcmp (opt, "disable-major")) {
@@ -4568,12 +4570,21 @@ mono_gc_base_init (void)
fprintf (stderr, " verify-before-allocs[=<n>]\n");
fprintf (stderr, " check-at-minor-collections\n");
fprintf (stderr, " verify-before-collections\n");
+ fprintf (stderr, " verify-nursery-at-minor-gc\n");
+ fprintf (stderr, " dump-nursery-at-minor-gc\n");
fprintf (stderr, " disable-minor\n");
fprintf (stderr, " disable-major\n");
fprintf (stderr, " xdomain-checks\n");
fprintf (stderr, " clear-at-gc\n");
+ fprintf (stderr, " clear-nursery-at-gc\n");
+ fprintf (stderr, " check-scan-starts\n");
+ fprintf (stderr, " no-managed-allocator\n");
fprintf (stderr, " print-allowance\n");
fprintf (stderr, " print-pinning\n");
+ fprintf (stderr, " heap-dump=<filename>\n");
+#ifdef SGEN_BINARY_PROTOCOL
+ fprintf (stderr, " binary-protocol=<filename>\n");
+#endif
exit (1);
}
}
View
1 mono/metadata/sgen-gc.h
@@ -1028,6 +1028,7 @@ typedef enum {
void sgen_init_tlab_info (SgenThreadInfo* info);
void sgen_clear_tlabs (void);
+void sgen_set_use_managed_allocator (gboolean flag);
gboolean sgen_is_managed_allocator (MonoMethod *method);
gboolean sgen_has_managed_allocator (void);

0 comments on commit a520276

Please sign in to comment.