Merge pull request #2442 from schani/fix-larger-tlab-size
[mono.git] / mono / sgen / sgen-gc.c
index 8c27decedcf0bcc877c034e49611677bf7c413fb..1956af35772abe1839f3fc8736377b71161fbf87 100644 (file)
@@ -1056,6 +1056,7 @@ finish_gray_stack (int generation, ScanCopyContext ctx)
        char *end_addr = generation == GENERATION_NURSERY ? sgen_get_nursery_end () : (char*)-1;
        SgenGrayQueue *queue = ctx.queue;
 
+       binary_protocol_finish_gray_stack_start (sgen_timestamp (), generation);
        /*
         * We copied all the reachable objects. Now it's the time to copy
         * the objects that were not referenced by the roots, but by the copied objects.
@@ -1189,6 +1190,7 @@ finish_gray_stack (int generation, ScanCopyContext ctx)
        g_assert (sgen_gray_object_queue_is_empty (queue));
 
        sgen_gray_object_queue_trim_free_list (queue);
+       binary_protocol_finish_gray_stack_end (sgen_timestamp (), generation);
 }
 
 void
@@ -1547,11 +1549,6 @@ collect_nursery (SgenGrayQueue *unpin_queue, gboolean finish_up_concurrent_mark)
        SGEN_LOG (2, "Finding pinned pointers: %zd in %ld usecs", sgen_get_pinned_count (), TV_ELAPSED (btv, atv));
        SGEN_LOG (4, "Start scan with %zd pinned objects", sgen_get_pinned_count ());
 
-       /*
-        * FIXME: When we finish a concurrent collection we do a nursery collection first,
-        * as part of which we scan the card table.  Then, later, we scan the mod union
-        * cardtable.  We should only have to do one.
-        */
        sj = (ScanJob*)sgen_thread_pool_job_alloc ("scan remset", job_remembered_set_scan, sizeof (ScanJob));
        sj->ops = object_ops;
        sgen_workers_enqueue_job (&sj->job, FALSE);
@@ -1977,6 +1974,7 @@ major_finish_collection (const char *reason, size_t old_next_pin_slot, gboolean
        time_major_fragment_creation += TV_ELAPSED (atv, btv);
 
        binary_protocol_sweep_begin (GENERATION_OLD, !major_collector.sweeps_lazily);
+       sgen_memgov_major_pre_sweep ();
 
        TV_GETTIME (atv);
        time_major_free_bigobjs += TV_ELAPSED (btv, atv);
@@ -2157,12 +2155,12 @@ major_finish_concurrent_collection (gboolean forced)
  * LOCKING: The GC lock MUST be held.
  */
 void
-sgen_ensure_free_space (size_t size)
+sgen_ensure_free_space (size_t size, int generation)
 {
        int generation_to_collect = -1;
        const char *reason = NULL;
 
-       if (size > SGEN_MAX_SMALL_OBJ_SIZE) {
+       if (generation == GENERATION_OLD) {
                if (sgen_need_major_collection (size)) {
                        reason = "LOS overflow";
                        generation_to_collect = GENERATION_OLD;