[sgen] Increase parallelization of minors
[mono.git] / mono / sgen / sgen-simple-nursery.c
index bc8aee7044c8a12baaa684e9411893dedf9f567a..4234559e9e8cec8ced5617f60fe64e9e9e862c38 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * sgen-simple-nursery.c: Simple always promote nursery.
+/**
+ * \file
+ * Simple always promote nursery.
  *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
@@ -65,6 +66,7 @@ init_nursery (SgenFragmentAllocator *allocator, char *start, char *end)
 #define collector_pin_object(obj, queue) sgen_pin_object (obj, queue);
 #define COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION alloc_for_promotion
 
+#define COPY_OR_MARK_PARALLEL
 #include "sgen-copy-object.h"
 
 #define SGEN_SIMPLE_NURSERY
@@ -79,6 +81,19 @@ fill_serial_ops (SgenObjectOperations *ops)
        FILL_MINOR_COLLECTOR_SCAN_OBJECT (ops);
 }
 
+#define SGEN_SIMPLE_PAR_NURSERY
+
+#include "sgen-minor-copy-object.h"
+#include "sgen-minor-scan-object.h"
+
+static void
+fill_parallel_ops (SgenObjectOperations *ops)
+{
+       ops->copy_or_mark_object = SERIAL_COPY_OBJECT;
+       FILL_MINOR_COLLECTOR_SCAN_OBJECT (ops);
+}
+
+#undef SGEN_SIMPLE_PAR_NURSERY
 #define SGEN_CONCURRENT_MAJOR
 
 #include "sgen-minor-copy-object.h"
@@ -92,9 +107,10 @@ fill_serial_with_concurrent_major_ops (SgenObjectOperations *ops)
 }
 
 void
-sgen_simple_nursery_init (SgenMinorCollector *collector)
+sgen_simple_nursery_init (SgenMinorCollector *collector, gboolean parallel)
 {
        collector->is_split = FALSE;
+       collector->is_parallel = parallel;
 
        collector->alloc_for_promotion = alloc_for_promotion;
 
@@ -107,6 +123,7 @@ sgen_simple_nursery_init (SgenMinorCollector *collector)
 
        fill_serial_ops (&collector->serial_ops);
        fill_serial_with_concurrent_major_ops (&collector->serial_ops_with_concurrent_major);
+       fill_parallel_ops (&collector->parallel_ops);
 }