[remoting] Convert mono_load_remote_field_new_checked to managed code (#3149)
[mono.git] / mono / sgen / sgen-gc.c
index 6304d166df8cac513943b85387a9e203019490ba..e16cd9b957ad1b2beaa769cdf4b0fac426c8e725 100644 (file)
@@ -326,7 +326,7 @@ nursery_canaries_enabled (void)
 
 #define safe_object_get_size   sgen_safe_object_get_size
 
-#if defined(PLATFORM_MACOSX) || defined(HOST_WIN32) || (defined(__linux__) && !defined(PLATFORM_ANDROID))
+#if defined(HAVE_CONC_GC_AS_DEFAULT)
 /* Use concurrent major on deskstop platforms */
 #define DEFAULT_MAJOR_INIT sgen_marksweep_conc_init
 #define DEFAULT_MAJOR_NAME "marksweep-conc"
@@ -2226,14 +2226,14 @@ sgen_ensure_free_space (size_t size, int generation)
 
        if (generation_to_collect == -1)
                return;
-       sgen_perform_collection (size, generation_to_collect, reason, FALSE);
+       sgen_perform_collection (size, generation_to_collect, reason, FALSE, TRUE);
 }
 
 /*
  * LOCKING: Assumes the GC lock is held.
  */
 void
-sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish)
+sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish, gboolean stw)
 {
        TV_DECLARE (gc_total_start);
        TV_DECLARE (gc_total_end);
@@ -2246,7 +2246,11 @@ sgen_perform_collection (size_t requested_size, int generation_to_collect, const
 
        SGEN_ASSERT (0, generation_to_collect == GENERATION_NURSERY || generation_to_collect == GENERATION_OLD, "What generation is this?");
 
-       sgen_stop_world (generation_to_collect);
+       if (stw)
+               sgen_stop_world (generation_to_collect);
+       else
+               SGEN_ASSERT (0, sgen_is_world_stopped (), "We can only collect if the world is stopped");
+               
 
        TV_GETTIME (gc_total_start);
 
@@ -2306,7 +2310,8 @@ sgen_perform_collection (size_t requested_size, int generation_to_collect, const
        TV_GETTIME (gc_total_end);
        time_max = MAX (time_max, TV_ELAPSED (gc_total_start, gc_total_end));
 
-       sgen_restart_world (oldest_generation_collected);
+       if (stw)
+               sgen_restart_world (oldest_generation_collected);
 }
 
 /*
@@ -2676,7 +2681,7 @@ sgen_gc_collect (int generation)
        LOCK_GC;
        if (generation > 1)
                generation = 1;
-       sgen_perform_collection (0, generation, "user request", TRUE);
+       sgen_perform_collection (0, generation, "user request", TRUE, TRUE);
        UNLOCK_GC;
 }
 
@@ -2914,7 +2919,7 @@ sgen_gc_init (void)
                                double val;
                                opt = strchr (opt, '=') + 1;
                                if (parse_double_in_interval (MONO_GC_PARAMS_NAME, "default-allowance-ratio", opt,
-                                               SGEN_MIN_ALLOWANCE_NURSERY_SIZE_RATIO, SGEN_MIN_ALLOWANCE_NURSERY_SIZE_RATIO, &val)) {
+                                               SGEN_MIN_ALLOWANCE_NURSERY_SIZE_RATIO, SGEN_MAX_ALLOWANCE_NURSERY_SIZE_RATIO, &val)) {
                                        allowance_ratio = val;
                                }
                                continue;