[msvc] Fixed missing semi-colon.
[mono.git] / mono / metadata / sgen-cardtable.h
index e609896678b57fe36a70c6b3cf038bf3b8e1153b..bc9ea77a5e320885d00440949a7c06028d6b2307 100644 (file)
 #ifndef __MONO_SGEN_CARD_TABLE_INLINES_H__
 #define __MONO_SGEN_CARD_TABLE_INLINES_H__
 
-#define SGEN_HAVE_CARDTABLE    1
-
-#if SIZEOF_VOID_P == 8
-#define SGEN_HAVE_OVERLAPPING_CARDS    1
-#endif
-
-#ifdef SGEN_HAVE_CARDTABLE
-
 void sgen_card_table_reset_region (mword start, mword end) MONO_INTERNAL;
 void* sgen_card_table_align_pointer (void *ptr) MONO_INTERNAL;
-void sgen_card_table_mark_address (mword address) MONO_INTERNAL;
 void sgen_card_table_mark_range (mword address, mword size) MONO_INTERNAL;
-void sgen_cardtable_scan_object (char *obj, mword obj_size, guint8 *cards, SgenGrayQueue *queue) MONO_INTERNAL;
-void sgen_card_table_get_card_data (guint8 *dest, mword address, mword cards) MONO_INTERNAL;
-typedef void (*sgen_cardtable_block_callback) (mword start, mword size);
+void sgen_cardtable_scan_object (char *obj, mword obj_size, guint8 *cards,
+               gboolean mod_union, SgenGrayQueue *queue) MONO_INTERNAL;
+
+gboolean sgen_card_table_get_card_data (guint8 *dest, mword address, mword cards) MONO_INTERNAL;
 
+guint8* sgen_card_table_update_mod_union_from_cards (guint8 *dest, guint8 *start_card, size_t num_cards) MONO_INTERNAL;
+guint8* sgen_card_table_update_mod_union (guint8 *dest, char *obj, mword obj_size, size_t *out_num_cards) MONO_INTERNAL;
+
+void sgen_card_table_init (SgenRemeberedSet *remset) MONO_INTERNAL;
+
+/*How many bytes a single card covers*/
 #define CARD_BITS 9
+
+/* How many bits of the address space is covered by the card table.
+ * If this value is smaller than the number of address bits, card aliasing is required.
+ */
+#define CARD_TABLE_BITS 32
+
 #define CARD_SIZE_IN_BYTES (1 << CARD_BITS)
-#define CARD_COUNT_BITS (32 - 9)
+#define CARD_COUNT_BITS (CARD_TABLE_BITS - CARD_BITS)
 #define CARD_COUNT_IN_BYTES (1 << CARD_COUNT_BITS)
 #define CARD_MASK ((1 << CARD_COUNT_BITS) - 1)
 
+#if SIZEOF_VOID_P * 8 > CARD_TABLE_BITS
+#define SGEN_HAVE_OVERLAPPING_CARDS    1
+#endif
+
 extern guint8 *sgen_cardtable MONO_INTERNAL;
 
+
+#ifdef SGEN_HAVE_OVERLAPPING_CARDS
+
 static inline guint8*
 sgen_card_table_get_card_address (mword address)
 {
-       return sgen_cardtable + (address >> CARD_BITS);
+       return sgen_cardtable + ((address >> CARD_BITS) & CARD_MASK);
 }
 
-
-#ifdef SGEN_HAVE_OVERLAPPING_CARDS
-
 extern guint8 *sgen_shadow_cardtable MONO_INTERNAL;
 
-static inline  guint8*
+static inline guint8*
 sgen_card_table_get_shadow_card_address (mword address)
 {
-       return shadow_cardtable + ((address >> CARD_BITS) & CARD_MASK);
+       return sgen_shadow_cardtable + ((address >> CARD_BITS) & CARD_MASK);
 }
 
 static inline gboolean
@@ -71,8 +79,21 @@ sgen_card_table_card_begin_scanning (mword address)
        return *sgen_card_table_get_shadow_card_address (address) != 0;
 }
 
+static inline void
+sgen_card_table_prepare_card_for_scanning (guint8 *card)
+{
+}
+
+#define sgen_card_table_get_card_scan_address sgen_card_table_get_shadow_card_address
+
 #else
 
+static inline guint8*
+sgen_card_table_get_card_address (mword address)
+{
+       return sgen_cardtable + (address >> CARD_BITS);
+}
+
 static inline gboolean
 sgen_card_table_card_begin_scanning (mword address)
 {
@@ -81,10 +102,27 @@ sgen_card_table_card_begin_scanning (mword address)
        *card = 0;
        return res;
 }
-#endif
+
+static inline void
+sgen_card_table_prepare_card_for_scanning (guint8 *card)
+{
+       *card = 0;
+}
+
+#define sgen_card_table_get_card_scan_address sgen_card_table_get_card_address
 
 #endif
 
+static inline gboolean
+sgen_card_table_address_is_marked (mword address)
+{
+       return *sgen_card_table_get_card_address (address) != 0;
+}
 
+static inline void
+sgen_card_table_mark_address (mword address)
+{
+       *sgen_card_table_get_card_address (address) = 1;
+}
 
 #endif