Merge pull request #4615 from alexanderkyte/string_error_handling
[mono.git] / mono / sgen / sgen-alloc.c
index d18fc7cfc73462dcbc69a84a794258fcf196a106..20ecc4e5f2f3e4ab146bd772f8bfabe80cde69b2 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)
@@ -402,8 +396,11 @@ sgen_alloc_obj (GCVTable vtable, size_t size)
                int current_alloc = InterlockedIncrement (&alloc_count);
 
                if (verify_before_allocs) {
-                       if ((current_alloc % verify_before_allocs) == 0)
+                       if ((current_alloc % verify_before_allocs) == 0) {
+                               LOCK_GC;
                                sgen_check_whole_heap_stw ();
+                               UNLOCK_GC;
+                       }
                }
                if (collect_before_allocs) {
                        if (((current_alloc % collect_before_allocs) == 0) && nursery_section) {