Merge remote-tracking branch 'joncham/sgen-msvc2'
[mono.git] / mono / metadata / sgen-cardtable.c
index a4c755e37efdfefe66bba42605d01d597544ce7c..4fad8b6678afb2e45404160fd6ecdcfc9b653e7d 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "metadata/sgen-gc.h"
 #include "metadata/sgen-cardtable.h"
+#include "metadata/sgen-memory-governor.h"
 #include "utils/mono-counters.h"
 #include "utils/mono-time.h"
 #include "utils/mono-memory-model.h"
@@ -43,7 +44,9 @@
 
 //#define CARDTABLE_STATS
 
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
 #endif
@@ -155,14 +158,12 @@ sgen_card_table_wbarrier_value_copy (gpointer dest, gpointer src, int count, Mon
 static void
 sgen_card_table_wbarrier_object_copy (MonoObject* obj, MonoObject *src)
 {
-       int size;
-       TLAB_ACCESS_INIT;
-
-       size = mono_object_class (obj)->instance_size;
+       int size = mono_object_class (obj)->instance_size;
 
 #ifdef DISABLE_CRITICAL_REGION
        LOCK_GC;
 #else
+       TLAB_ACCESS_INIT;
        ENTER_CRITICAL_REGION;
 #endif
        mono_gc_memmove ((char*)obj + sizeof (MonoObject), (char*)src + sizeof (MonoObject),
@@ -656,10 +657,10 @@ sgen_card_tables_collect_stats (gboolean begin)
 void
 sgen_card_table_init (SgenRemeberedSet *remset)
 {
-       sgen_cardtable = sgen_alloc_os_memory (CARD_COUNT_IN_BYTES, TRUE);
+       sgen_cardtable = sgen_alloc_os_memory (CARD_COUNT_IN_BYTES, SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE, "card table");
 
 #ifdef SGEN_HAVE_OVERLAPPING_CARDS
-       sgen_shadow_cardtable = sgen_alloc_os_memory (CARD_COUNT_IN_BYTES, TRUE);
+       sgen_shadow_cardtable = sgen_alloc_os_memory (CARD_COUNT_IN_BYTES, SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE, "shadow card table");
 #endif
 
 #ifdef HEAVY_STATISTICS
@@ -716,4 +717,4 @@ mono_gc_get_card_table (int *shift_bits, gpointer *mask)
 
 #endif
 
-#endif /*HAVE_SGEN_GC*/
\ No newline at end of file
+#endif /*HAVE_SGEN_GC*/