Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / sgen / sgen-alloc.c
index fa6046f519a7eca2a9bb6b91854e07ac7058da5c..6c21c466f3fa6fcf51b6b210fa590129b04c668e 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * sgen-alloc.c: Object allocation routines + managed allocators
+/**
+ * \file
+ * Object allocation routines + managed allocators
  *
  * Author:
  *     Paolo Molaro (lupus@ximian.com)
@@ -57,17 +58,10 @@ static guint64 stat_bytes_alloced_los = 0;
  * tlab_real_end points to the end of the TLAB.
  */
 
-#ifdef HAVE_KW_THREAD
-#define TLAB_START     (sgen_thread_info->tlab_start)
-#define TLAB_NEXT      (sgen_thread_info->tlab_next)
-#define TLAB_TEMP_END  (sgen_thread_info->tlab_temp_end)
-#define TLAB_REAL_END  (sgen_thread_info->tlab_real_end)
-#else
 #define TLAB_START     (__thread_info__->tlab_start)
 #define TLAB_NEXT      (__thread_info__->tlab_next)
 #define TLAB_TEMP_END  (__thread_info__->tlab_temp_end)
 #define TLAB_REAL_END  (__thread_info__->tlab_real_end)
-#endif
 
 static GCObject*
 alloc_degraded (GCVTable vtable, size_t size, gboolean for_mature)
@@ -75,7 +69,7 @@ alloc_degraded (GCVTable vtable, size_t size, gboolean for_mature)
        GCObject *p;
 
        if (!for_mature) {
-               sgen_client_degraded_allocation (size);
+               sgen_client_degraded_allocation ();
                SGEN_ATOMIC_ADD_P (degraded_mode, size);
                sgen_ensure_free_space (size, GENERATION_OLD);
        } else {
@@ -217,7 +211,7 @@ sgen_alloc_obj_nolock (GCVTable vtable, size_t size)
                        /* when running in degraded mode, we continue allocing that way
                         * for a while, to decrease the number of useless nursery collections.
                         */
-                       if (degraded_mode && degraded_mode < DEFAULT_NURSERY_SIZE)
+                       if (degraded_mode && degraded_mode < sgen_nursery_size)
                                return alloc_degraded (vtable, size, FALSE);
 
                        available_in_tlab = (int)(TLAB_REAL_END - TLAB_NEXT);//We'll never have tlabs > 2Gb
@@ -247,7 +241,7 @@ sgen_alloc_obj_nolock (GCVTable vtable, size_t size)
                                                p = (void **)sgen_nursery_alloc (size);
                                }
                                if (!p)
-                                       return alloc_degraded (vtable, size, FALSE);
+                                       return alloc_degraded (vtable, size, TRUE);
 
                                zero_tlab_if_necessary (p, size);
                        } else {
@@ -264,7 +258,7 @@ sgen_alloc_obj_nolock (GCVTable vtable, size_t size)
                                                p = (void **)sgen_nursery_alloc_range (tlab_size, size, &alloc_size);
                                }
                                if (!p)
-                                       return alloc_degraded (vtable, size, FALSE);
+                                       return alloc_degraded (vtable, size, TRUE);
 
                                /* Allocate a new TLAB from the current nursery fragment */
                                TLAB_START = (char*)p;