[sgen] Use concurrent mark concurrently with parallel minors
authorVlad Brezae <brezaevlad@gmail.com>
Wed, 21 Jun 2017 10:43:39 +0000 (13:43 +0300)
committerVlad Brezae <brezaevlad@gmail.com>
Fri, 23 Jun 2017 17:47:49 +0000 (20:47 +0300)
mono/sgen/sgen-gc.c
mono/sgen/sgen-gc.h
mono/sgen/sgen-minor-copy-object.h
mono/sgen/sgen-minor-scan-object.h
mono/sgen/sgen-simple-nursery.c

index a590153dd637f005f9bbfd55af8220908d4cbc3f..8f6ee8aa833b60c240bb421bea0236c118fd28ad 100644 (file)
@@ -1659,15 +1659,14 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
 
        binary_protocol_collection_begin (gc_stats.minor_gc_count, GENERATION_NURSERY);
 
-       if (sgen_concurrent_collection_in_progress ()) {
-               /* FIXME Support parallel nursery collections with concurrent major */
-               object_ops_nopar = &sgen_minor_collector.serial_ops_with_concurrent_major;
-       } else {
-               object_ops_nopar = &sgen_minor_collector.serial_ops;
-               if (sgen_minor_collector.is_parallel && sgen_nursery_size >= SGEN_PARALLEL_MINOR_MIN_NURSERY_SIZE) {
-                       object_ops_par = &sgen_minor_collector.parallel_ops;
-                       is_parallel = TRUE;
-               }
+       object_ops_nopar = sgen_concurrent_collection_in_progress ()
+                               ? &sgen_minor_collector.serial_ops_with_concurrent_major
+                               : &sgen_minor_collector.serial_ops;
+       if (sgen_minor_collector.is_parallel && sgen_nursery_size >= SGEN_PARALLEL_MINOR_MIN_NURSERY_SIZE) {
+               object_ops_par = sgen_concurrent_collection_in_progress ()
+                                       ? &sgen_minor_collector.parallel_ops_with_concurrent_major
+                                       : &sgen_minor_collector.parallel_ops;
+               is_parallel = TRUE;
        }
 
        if (do_verify_nursery || do_dump_nursery_content)
index 0cc573aab763c59322a99063f7a8a329175faf44..2faad109d1ec06e3496ebd23f1ac4ab1d5d39de7 100644 (file)
@@ -552,6 +552,7 @@ typedef struct {
        SgenObjectOperations serial_ops;
        SgenObjectOperations serial_ops_with_concurrent_major;
        SgenObjectOperations parallel_ops;
+       SgenObjectOperations parallel_ops_with_concurrent_major;
 
        void (*prepare_to_space) (char *to_space_bitmap, size_t space_bitmap_size);
        void (*clear_fragments) (void);
index 3ad10aac4447fb2608803abd67bd71b77cf8441d..b1e07c167a6eaad6ec933ef2af3204b73fb8792f 100644 (file)
 #if defined(SGEN_SIMPLE_NURSERY)
 
 #ifdef SGEN_SIMPLE_PAR_NURSERY
-/* Not supported with concurrent major yet */
+
+#ifdef SGEN_CONCURRENT_MAJOR
+#define SERIAL_COPY_OBJECT simple_par_nursery_with_concurrent_major_copy_object
+#define SERIAL_COPY_OBJECT_FROM_OBJ simple_par_nursery_with_concurrent_major_copy_object_from_obj
+#else
 #define SERIAL_COPY_OBJECT simple_par_nursery_copy_object
 #define SERIAL_COPY_OBJECT_FROM_OBJ simple_par_nursery_copy_object_from_obj
+#endif
+
 #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
@@ -26,6 +33,7 @@
 #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)
index b92d309f4ec1228d02086deb5d856902459c94cc..f0baac8f87ebcdc8561b7ded135a3a033f74a33d 100644 (file)
@@ -19,10 +19,17 @@ extern guint64 stat_scan_object_called_nursery;
 #if defined(SGEN_SIMPLE_NURSERY)
 
 #ifdef SGEN_SIMPLE_PAR_NURSERY
+#ifdef SGEN_CONCURRENT_MAJOR
+#define SERIAL_SCAN_OBJECT simple_par_nursery_serial_with_concurrent_major_scan_object
+#define SERIAL_SCAN_VTYPE simple_par_nursery_serial_with_concurrent_major_scan_vtype
+#define SERIAL_SCAN_PTR_FIELD simple_par_nursery_serial_with_concurrent_major_scan_ptr_field
+#define SERIAL_DRAIN_GRAY_STACK simple_par_nursery_serial_with_concurrent_major_drain_gray_stack
+#else
 #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
+#endif
 #else
 #ifdef SGEN_CONCURRENT_MAJOR
 #define SERIAL_SCAN_OBJECT simple_nursery_serial_with_concurrent_major_scan_object
index 5d39368402b133d4e6c0a0bd2adcc22ad611c2af..29ab4ed135ddd54d93b74ef707d9bca63e7a6303 100644 (file)
@@ -129,6 +129,18 @@ fill_serial_with_concurrent_major_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_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)
 {
@@ -151,6 +163,7 @@ sgen_simple_nursery_init (SgenMinorCollector *collector, gboolean 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