SgenObjectOperations serial_ops;
SgenObjectOperations serial_ops_with_concurrent_major;
+ SgenObjectOperations parallel_ops;
void (*prepare_to_space) (char *to_space_bitmap, size_t space_bitmap_size);
void (*clear_fragments) (void);
#if defined(SGEN_SIMPLE_NURSERY)
+#ifdef SGEN_SIMPLE_PAR_NURSERY
+/* Not supported with concurrent major yet */
+#define SERIAL_COPY_OBJECT simple_par_nursery_copy_object
+#define SERIAL_COPY_OBJECT_FROM_OBJ simple_par_nursery_copy_object_from_obj
+#else
#ifdef SGEN_CONCURRENT_MAJOR
#define SERIAL_COPY_OBJECT simple_nursery_serial_with_concurrent_major_copy_object
#define SERIAL_COPY_OBJECT_FROM_OBJ simple_nursery_serial_with_concurrent_major_copy_object_from_obj
#define SERIAL_COPY_OBJECT simple_nursery_serial_copy_object
#define SERIAL_COPY_OBJECT_FROM_OBJ simple_nursery_serial_copy_object_from_obj
#endif
+#endif
#elif defined (SGEN_SPLIT_NURSERY)
HEAVY_STAT (++stat_objects_copied_nursery);
+#ifdef SGEN_SIMPLE_PAR_NURSERY
+ copy = copy_object_no_checks_par (obj, queue);
+#else
copy = copy_object_no_checks (obj, queue);
+#endif
SGEN_UPDATE_REFERENCE (obj_slot, copy);
}
HEAVY_STAT (++stat_objects_copied_nursery);
+#ifdef SGEN_SIMPLE_PAR_NURSERY
+ copy = copy_object_no_checks_par (obj, queue);
+#else
copy = copy_object_no_checks (obj, queue);
+#endif
#ifdef SGEN_CONCURRENT_MAJOR
/*
* If an object is evacuated to the major heap and a reference to it, from the major
#if defined(SGEN_SIMPLE_NURSERY)
+#ifdef SGEN_SIMPLE_PAR_NURSERY
+#define SERIAL_SCAN_OBJECT simple_par_nursery_serial_scan_object
+#define SERIAL_SCAN_VTYPE simple_par_nursery_serial_scan_vtype
+#define SERIAL_SCAN_PTR_FIELD simple_par_nursery_serial_scan_ptr_field
+#define SERIAL_DRAIN_GRAY_STACK simple_par_nursery_serial_drain_gray_stack
+#else
#ifdef SGEN_CONCURRENT_MAJOR
#define SERIAL_SCAN_OBJECT simple_nursery_serial_with_concurrent_major_scan_object
#define SERIAL_SCAN_VTYPE simple_nursery_serial_with_concurrent_major_scan_vtype
#define SERIAL_SCAN_PTR_FIELD simple_nursery_serial_scan_ptr_field
#define SERIAL_DRAIN_GRAY_STACK simple_nursery_serial_drain_gray_stack
#endif
+#endif
#elif defined (SGEN_SPLIT_NURSERY)
static gboolean
SERIAL_DRAIN_GRAY_STACK (SgenGrayQueue *queue)
{
- for (;;) {
- GCObject *obj;
- SgenDescriptor desc;
+#ifdef SGEN_SIMPLE_PAR_NURSERY
+ int i;
+ /*
+ * We do bounded iteration so we can switch to optimized context
+ * when we are the last worker remaining.
+ */
+ for (i = 0; i < 32; i++) {
+#else
+ for (;;) {
+#endif
+ GCObject *obj;
+ SgenDescriptor desc;
+
+#ifdef SGEN_SIMPLE_PAR_NURSERY
+ GRAY_OBJECT_DEQUEUE_PARALLEL (queue, &obj, &desc);
+#else
+ GRAY_OBJECT_DEQUEUE_SERIAL (queue, &obj, &desc);
+#endif
+ if (!obj)
+ return TRUE;
- GRAY_OBJECT_DEQUEUE_SERIAL (queue, &obj, &desc);
- if (!obj)
- return TRUE;
+ SERIAL_SCAN_OBJECT (obj, desc, queue);
+ }
- SERIAL_SCAN_OBJECT (obj, desc, queue);
- }
+ return FALSE;
}
#define FILL_MINOR_COLLECTOR_SCAN_OBJECT(ops) do { \
#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
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"
fill_serial_ops (&collector->serial_ops);
fill_serial_with_concurrent_major_ops (&collector->serial_ops_with_concurrent_major);
+ fill_parallel_ops (&collector->parallel_ops);
}