#include "mono/sgen/sgen-protocol.h"
#include "mono/sgen/sgen-layout-stats.h"
#include "mono/sgen/sgen-client.h"
+#include "mono/sgen/sgen-workers.h"
#include "mono/utils/mono-memory-model.h"
+#include "mono/utils/mono-proclib.h"
static inline GCObject*
alloc_for_promotion (GCVTable vtable, GCObject *obj, size_t objsize, gboolean has_references)
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_with_concurrent_major_ops (SgenObjectOperations *ops)
+{
+ ops->copy_or_mark_object = SERIAL_COPY_OBJECT;
+ FILL_MINOR_COLLECTOR_SCAN_OBJECT (ops);
+}
+
void
sgen_simple_nursery_init (SgenMinorCollector *collector, gboolean parallel)
{
+ if (mono_cpu_count () <= 1)
+ parallel = FALSE;
+
collector->is_split = FALSE;
collector->is_parallel = parallel;
fill_serial_ops (&collector->serial_ops);
fill_serial_with_concurrent_major_ops (&collector->serial_ops_with_concurrent_major);
fill_parallel_ops (&collector->parallel_ops);
+ fill_parallel_with_concurrent_major_ops (&collector->parallel_ops_with_concurrent_major);
+
+ /*
+ * The nursery worker context is created first so it will have priority over
+ * concurrent mark and concurrent sweep.
+ */
+ if (parallel)
+ sgen_workers_create_context (GENERATION_NURSERY, mono_cpu_count ());
}