Move dummy_use to a header and give it a sucky MSVC implementation.
[mono.git] / mono / metadata / sgen-cardtable.c
1 /*
2  * sgen-cardtable.c: Card table implementation for sgen
3  *
4  * Author:
5  *      Rodrigo Kumpera (rkumpera@novell.com)
6  *
7  * SGen is licensed under the terms of the MIT X11 license
8  *
9  * Copyright 2001-2003 Ximian, Inc
10  * Copyright 2003-2010 Novell, Inc.
11  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
12  * 
13  * Permission is hereby granted, free of charge, to any person obtaining
14  * a copy of this software and associated documentation files (the
15  * "Software"), to deal in the Software without restriction, including
16  * without limitation the rights to use, copy, modify, merge, publish,
17  * distribute, sublicense, and/or sell copies of the Software, and to
18  * permit persons to whom the Software is furnished to do so, subject to
19  * the following conditions:
20  * 
21  * The above copyright notice and this permission notice shall be
22  * included in all copies or substantial portions of the Software.
23  * 
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31  */
32
33 #include "config.h"
34 #ifdef HAVE_SGEN_GC
35
36 #include "metadata/sgen-gc.h"
37 #include "metadata/sgen-cardtable.h"
38 #include "utils/mono-counters.h"
39 #include "utils/mono-time.h"
40 #include "utils/mono-memory-model.h"
41
42 #ifdef SGEN_HAVE_CARDTABLE
43
44 //#define CARDTABLE_STATS
45
46 #include <unistd.h>
47 #ifdef HAVE_SYS_MMAN_H
48 #include <sys/mman.h>
49 #endif
50 #include <sys/types.h>
51
52 guint8 *sgen_cardtable;
53
54
55 #ifdef HEAVY_STATISTICS
56 long long marked_cards;
57 long long scanned_cards;
58 long long scanned_objects;
59 long long remarked_cards;
60
61 static long long los_marked_cards;
62 static long long large_objects;
63 static long long bloby_objects;
64 static long long los_array_cards;
65 static long long los_array_remsets;
66
67 #endif
68 static long long major_card_scan_time;
69 static long long los_card_scan_time;
70
71 static long long last_major_scan_time;
72 static long long last_los_scan_time;
73
74 /*WARNING: This function returns the number of cards regardless of overflow in case of overlapping cards.*/
75 static mword
76 cards_in_range (mword address, mword size)
77 {
78         mword end = address + MAX (1, size) - 1;
79         return (end >> CARD_BITS) - (address >> CARD_BITS) + 1;
80 }
81
82 void
83 mono_sgen_card_table_wbarrier_set_field (MonoObject *obj, gpointer field_ptr, MonoObject* value)
84 {
85         *(void**)field_ptr = value;
86         if (mono_sgen_ptr_in_nursery (value))
87                 sgen_card_table_mark_address ((mword)field_ptr);
88         mono_sgen_dummy_use (value);
89 }
90
91 void
92 mono_sgen_card_table_wbarrier_set_arrayref (MonoArray *arr, gpointer slot_ptr, MonoObject* value)
93 {
94         *(void**)slot_ptr = value;
95         if (mono_sgen_ptr_in_nursery (value))
96                 sgen_card_table_mark_address ((mword)slot_ptr);
97         mono_sgen_dummy_use (value);    
98 }
99
100 void
101 mono_sgen_card_table_wbarrier_arrayref_copy (gpointer dest_ptr, gpointer src_ptr, int count)
102 {
103         gpointer *dest = dest_ptr;
104         gpointer *src = src_ptr;
105
106         /*overlapping that required backward copying*/
107         if (src < dest && (src + count) > dest) {
108                 gpointer *start = dest;
109                 dest += count - 1;
110                 src += count - 1;
111
112                 for (; dest >= start; --src, --dest) {
113                         gpointer value = *src;
114                         *dest = value;
115                         if (mono_sgen_ptr_in_nursery (value))
116                                 sgen_card_table_mark_address ((mword)dest);
117                         mono_sgen_dummy_use (value);
118                 }
119         } else {
120                 gpointer *end = dest + count;
121                 for (; dest < end; ++src, ++dest) {
122                         gpointer value = *src;
123                         *dest = value;
124                         if (mono_sgen_ptr_in_nursery (value))
125                                 sgen_card_table_mark_address ((mword)dest);
126                         mono_sgen_dummy_use (value);
127                 }
128         }       
129 }
130
131 void
132 mono_sgen_card_table_wbarrier_value_copy (gpointer dest, gpointer src, int count, MonoClass *klass)
133 {
134         size_t element_size = mono_class_value_size (klass, NULL);
135         size_t size = count * element_size;
136
137 #ifdef DISABLE_CRITICAL_REGION
138         LOCK_GC;
139 #else
140         TLAB_ACCESS_INIT;
141         ENTER_CRITICAL_REGION;
142 #endif
143         mono_gc_memmove (dest, src, size);
144         sgen_card_table_mark_range ((mword)dest, size);
145 #ifdef DISABLE_CRITICAL_REGION
146         UNLOCK_GC;
147 #else
148         EXIT_CRITICAL_REGION;
149 #endif
150 }
151
152 void
153 mono_sgen_card_table_wbarrier_object_copy (MonoObject* obj, MonoObject *src)
154 {
155         int size;
156         TLAB_ACCESS_INIT;
157
158         size = mono_object_class (obj)->instance_size;
159
160 #ifdef DISABLE_CRITICAL_REGION
161         LOCK_GC;
162 #else
163         ENTER_CRITICAL_REGION;
164 #endif
165         mono_gc_memmove ((char*)obj + sizeof (MonoObject), (char*)src + sizeof (MonoObject),
166                         size - sizeof (MonoObject));
167         sgen_card_table_mark_range ((mword)obj, size);
168 #ifdef DISABLE_CRITICAL_REGION
169         UNLOCK_GC;
170 #else
171         EXIT_CRITICAL_REGION;
172 #endif  
173 }
174
175 void
176 mono_sgen_card_table_wbarrier_generic_nostore (gpointer ptr)
177 {
178         sgen_card_table_mark_address ((mword)ptr);      
179 }
180
181 #ifdef SGEN_HAVE_OVERLAPPING_CARDS
182
183 guint8 *sgen_shadow_cardtable;
184
185 #define SGEN_SHADOW_CARDTABLE_END (sgen_shadow_cardtable + CARD_COUNT_IN_BYTES)
186 #define SGEN_CARDTABLE_END (sgen_cardtable + CARD_COUNT_IN_BYTES)
187
188 static gboolean
189 sgen_card_table_region_begin_scanning (mword start, mword end)
190 {
191         /*XXX this can be improved to work on words and have a single loop induction var */
192         while (start <= end) {
193                 if (sgen_card_table_card_begin_scanning (start))
194                         return TRUE;
195                 start += CARD_SIZE_IN_BYTES;
196         }
197         return FALSE;
198 }
199
200 #else
201
202 static gboolean
203 sgen_card_table_region_begin_scanning (mword start, mword size)
204 {
205         gboolean res = FALSE;
206         guint8 *card = sgen_card_table_get_card_address (start);
207         guint8 *end = card + cards_in_range (start, size);
208
209         /*XXX this can be improved to work on words and have a branchless body */
210         while (card != end) {
211                 if (*card++) {
212                         res = TRUE;
213                         break;
214                 }
215         }
216
217         memset (sgen_card_table_get_card_address (start), 0, size >> CARD_BITS);
218
219         return res;
220 }
221
222 #endif
223
224 /*FIXME this assumes that major blocks are multiple of 4K which is pretty reasonable */
225 gboolean
226 sgen_card_table_get_card_data (guint8 *data_dest, mword address, mword cards)
227 {
228         mword *start = (mword*)sgen_card_table_get_card_scan_address (address);
229         mword *dest = (mword*)data_dest;
230         mword *end = (mword*)(data_dest + cards);
231         mword mask = 0;
232
233         for (; dest < end; ++dest, ++start) {
234                 mword v = *start;
235                 *dest = v;
236                 mask |= v;
237
238 #ifndef SGEN_HAVE_OVERLAPPING_CARDS
239                 *start = 0;
240 #endif
241         }
242
243         return mask;
244 }
245
246 void*
247 sgen_card_table_align_pointer (void *ptr)
248 {
249         return (void*)((mword)ptr & ~(CARD_SIZE_IN_BYTES - 1));
250 }
251
252 void
253 sgen_card_table_mark_range (mword address, mword size)
254 {
255         memset (sgen_card_table_get_card_address (address), 1, cards_in_range (address, size));
256 }
257
258 static gboolean
259 sgen_card_table_is_range_marked (guint8 *cards, mword address, mword size)
260 {
261         guint8 *end = cards + cards_in_range (address, size);
262
263         /*This is safe since this function is only called by code that only passes continuous card blocks*/
264         while (cards != end) {
265                 if (*cards++)
266                         return TRUE;
267         }
268         return FALSE;
269
270 }
271
272 void
273 sgen_card_table_init (void)
274 {
275         sgen_cardtable = mono_sgen_alloc_os_memory (CARD_COUNT_IN_BYTES, TRUE);
276
277 #ifdef SGEN_HAVE_OVERLAPPING_CARDS
278         sgen_shadow_cardtable = mono_sgen_alloc_os_memory (CARD_COUNT_IN_BYTES, TRUE);
279 #endif
280
281 #ifdef HEAVY_STATISTICS
282         mono_counters_register ("marked cards", MONO_COUNTER_GC | MONO_COUNTER_LONG, &marked_cards);
283         mono_counters_register ("scanned cards", MONO_COUNTER_GC | MONO_COUNTER_LONG, &scanned_cards);
284         mono_counters_register ("remarked cards", MONO_COUNTER_GC | MONO_COUNTER_LONG, &remarked_cards);
285
286         mono_counters_register ("los marked cards", MONO_COUNTER_GC | MONO_COUNTER_LONG, &los_marked_cards);
287         mono_counters_register ("los array cards scanned ", MONO_COUNTER_GC | MONO_COUNTER_LONG, &los_array_cards);
288         mono_counters_register ("los array remsets", MONO_COUNTER_GC | MONO_COUNTER_LONG, &los_array_remsets);
289         mono_counters_register ("cardtable scanned objects", MONO_COUNTER_GC | MONO_COUNTER_LONG, &scanned_objects);
290         mono_counters_register ("cardtable large objects", MONO_COUNTER_GC | MONO_COUNTER_LONG, &large_objects);
291         mono_counters_register ("cardtable bloby objects", MONO_COUNTER_GC | MONO_COUNTER_LONG, &bloby_objects);
292 #endif
293         mono_counters_register ("cardtable major scan time", MONO_COUNTER_GC | MONO_COUNTER_LONG, &major_card_scan_time);
294         mono_counters_register ("cardtable los scan time", MONO_COUNTER_GC | MONO_COUNTER_LONG, &los_card_scan_time);
295 }
296
297 #ifdef SGEN_HAVE_OVERLAPPING_CARDS
298
299 static void
300 move_cards_to_shadow_table (mword start, mword size)
301 {
302         guint8 *from = sgen_card_table_get_card_address (start);
303         guint8 *to = sgen_card_table_get_shadow_card_address (start);
304         size_t bytes = cards_in_range (start, size);
305
306         if (to + bytes > SGEN_SHADOW_CARDTABLE_END) {
307                 size_t first_chunk = SGEN_SHADOW_CARDTABLE_END - to;
308                 size_t second_chunk = MIN (CARD_COUNT_IN_BYTES, bytes) - first_chunk;
309
310                 memcpy (to, from, first_chunk);
311                 memcpy (sgen_shadow_cardtable, sgen_cardtable, second_chunk);
312         } else {
313                 memcpy (to, from, bytes);
314         }
315 }
316
317 static void
318 clear_cards (mword start, mword size)
319 {
320         guint8 *addr = sgen_card_table_get_card_address (start);
321         size_t bytes = cards_in_range (start, size);
322
323         if (addr + bytes > SGEN_CARDTABLE_END) {
324                 size_t first_chunk = SGEN_CARDTABLE_END - addr;
325
326                 memset (addr, 0, first_chunk);
327                 memset (sgen_cardtable, 0, bytes - first_chunk);
328         } else {
329                 memset (addr, 0, bytes);
330         }
331 }
332
333
334 #else
335
336 static void
337 clear_cards (mword start, mword size)
338 {
339         memset (sgen_card_table_get_card_address (start), 0, cards_in_range (start, size));
340 }
341
342
343 #endif
344
345 void
346 sgen_card_table_clear (void)
347 {
348         /*XXX we could do this in 2 ways. using mincore or iterating over all sections/los objects */
349         sgen_major_collector_iterate_live_block_ranges (clear_cards);
350         mono_sgen_los_iterate_live_block_ranges (clear_cards);
351 }
352
353 void
354 sgen_scan_from_card_tables (void *start_nursery, void *end_nursery, SgenGrayQueue *queue)
355 {
356         SGEN_TV_DECLARE (atv);
357         SGEN_TV_DECLARE (btv);
358
359 #ifdef SGEN_HAVE_OVERLAPPING_CARDS
360         /*FIXME we should have a bit on each block/los object telling if the object have marked cards.*/
361         /*First we copy*/
362         sgen_major_collector_iterate_live_block_ranges (move_cards_to_shadow_table);
363         mono_sgen_los_iterate_live_block_ranges (move_cards_to_shadow_table);
364
365         /*Then we clear*/
366         sgen_card_table_clear ();
367 #endif
368         SGEN_TV_GETTIME (atv);
369         sgen_major_collector_scan_card_table (queue);
370         SGEN_TV_GETTIME (btv);
371         last_major_scan_time = SGEN_TV_ELAPSED_MS (atv, btv); 
372         major_card_scan_time += last_major_scan_time;
373         mono_sgen_los_scan_card_table (queue);
374         SGEN_TV_GETTIME (atv);
375         last_los_scan_time = SGEN_TV_ELAPSED_MS (btv, atv);
376         los_card_scan_time += last_los_scan_time;
377 }
378
379 guint8*
380 mono_gc_get_card_table (int *shift_bits, gpointer *mask)
381 {
382         if (!sgen_cardtable)
383                 return NULL;
384
385         *shift_bits = CARD_BITS;
386 #ifdef SGEN_HAVE_OVERLAPPING_CARDS
387         *mask = (gpointer)CARD_MASK;
388 #else
389         *mask = NULL;
390 #endif
391
392         return sgen_cardtable;
393 }
394
395 #if 0
396 static void
397 collect_faulted_cards (void)
398 {
399 #define CARD_PAGES (CARD_COUNT_IN_BYTES / 4096)
400         int i, count = 0;
401         unsigned char faulted [CARD_PAGES] = { 0 };
402         mincore (sgen_cardtable, CARD_COUNT_IN_BYTES, faulted);
403
404         for (i = 0; i < CARD_PAGES; ++i) {
405                 if (faulted [i])
406                         ++count;
407         }
408
409         printf ("TOTAL card pages %d faulted %d\n", CARD_PAGES, count);
410 }
411
412 void
413 sgen_card_table_dump_obj_card (char *object, size_t size, void *dummy)
414 {
415         guint8 *start = sgen_card_table_get_card_scan_address (object);
416         guint8 *end = start + cards_in_range (object, size);
417         int cnt = 0;
418         printf ("--obj %p %d cards [%p %p]--", object, size, start, end);
419         for (; start < end; ++start) {
420                 if (cnt == 0)
421                         printf ("\n\t[%p] ", start);
422                 printf ("%x ", *start);
423                 ++cnt;
424                 if (cnt == 8)
425                         cnt = 0;
426         }
427         printf ("\n");
428 }
429 #endif
430
431 #define MWORD_MASK (sizeof (mword) - 1)
432
433 static inline int
434 find_card_offset (mword card)
435 {
436 /*XXX Use assembly as this generates some pretty bad code */
437 #if defined(__i386__) && defined(__GNUC__)
438         return  (__builtin_ffs (card) - 1) / 8;
439 #elif defined(__x86_64__) && defined(__GNUC__)
440         return (__builtin_ffsll (card) - 1) / 8;
441 #elif defined(__s390x__)
442         return (__builtin_ffsll (GUINT64_TO_LE(card)) - 1) / 8;
443 #else
444         int i;
445         guint8 *ptr = (guint *) &card;
446         for (i = 0; i < sizeof (mword); ++i) {
447                 if (ptr[i])
448                         return i;
449         }
450         return 0;
451 #endif
452 }
453
454 static guint8*
455 find_next_card (guint8 *card_data, guint8 *end)
456 {
457         mword *cards, *cards_end;
458         mword card;
459
460         while ((((mword)card_data) & MWORD_MASK) && card_data < end) {
461                 if (*card_data)
462                         return card_data;
463                 ++card_data;
464         }
465
466         if (card_data == end)
467                 return end;
468
469         cards = (mword*)card_data;
470         cards_end = (mword*)((mword)end & ~MWORD_MASK);
471         while (cards < cards_end) {
472                 card = *cards;
473                 if (card)
474                         return (guint8*)cards + find_card_offset (card);
475                 ++cards;
476         }
477
478         card_data = (guint8*)cards_end;
479         while (card_data < end) {
480                 if (*card_data)
481                         return card_data;
482                 ++card_data;
483         }
484
485         return end;
486 }
487
488 void
489 sgen_cardtable_scan_object (char *obj, mword block_obj_size, guint8 *cards, SgenGrayQueue *queue)
490 {
491         MonoVTable *vt = (MonoVTable*)SGEN_LOAD_VTABLE (obj);
492         MonoClass *klass = vt->klass;
493         CopyOrMarkObjectFunc copy_func = mono_sgen_get_copy_object ();
494         ScanObjectFunc scan_object_func = mono_sgen_get_minor_scan_object ();
495         ScanVTypeFunc scan_vtype_func = mono_sgen_get_minor_scan_vtype ();
496
497         HEAVY_STAT (++large_objects);
498
499         if (!SGEN_VTABLE_HAS_REFERENCES (vt))
500                 return;
501
502         if (vt->rank) {
503                 guint8 *card_data, *card_base;
504                 guint8 *card_data_end;
505                 char *obj_start = sgen_card_table_align_pointer (obj);
506                 mword obj_size = mono_sgen_par_object_get_size (vt, (MonoObject*)obj);
507                 char *obj_end = obj + obj_size;
508                 size_t card_count;
509                 int extra_idx = 0;
510
511                 MonoArray *arr = (MonoArray*)obj;
512                 mword desc = (mword)klass->element_class->gc_descr;
513                 int elem_size = mono_array_element_size (klass);
514
515 #ifdef SGEN_HAVE_OVERLAPPING_CARDS
516                 guint8 *overflow_scan_end = NULL;
517 #endif
518
519                 if (cards)
520                         card_data = cards;
521                 else
522                         card_data = sgen_card_table_get_card_scan_address ((mword)obj);
523
524                 card_base = card_data;
525                 card_count = cards_in_range ((mword)obj, obj_size);
526                 card_data_end = card_data + card_count;
527
528
529 #ifdef SGEN_HAVE_OVERLAPPING_CARDS
530                 /*Check for overflow and if so, setup to scan in two steps*/
531                 if (!cards && card_data_end >= SGEN_SHADOW_CARDTABLE_END) {
532                         overflow_scan_end = sgen_shadow_cardtable + (card_data_end - SGEN_SHADOW_CARDTABLE_END);
533                         card_data_end = SGEN_SHADOW_CARDTABLE_END;
534                 }
535
536 LOOP_HEAD:
537 #endif
538
539                 card_data = find_next_card (card_data, card_data_end);
540                 for (; card_data < card_data_end; card_data = find_next_card (card_data + 1, card_data_end)) {
541                         int index;
542                         int idx = (card_data - card_base) + extra_idx;
543                         char *start = (char*)(obj_start + idx * CARD_SIZE_IN_BYTES);
544                         char *card_end = start + CARD_SIZE_IN_BYTES;
545                         char *elem;
546
547                         HEAVY_STAT (++los_marked_cards);
548
549                         if (!cards)
550                                 sgen_card_table_prepare_card_for_scanning (card_data);
551
552                         card_end = MIN (card_end, obj_end);
553
554                         if (start <= (char*)arr->vector)
555                                 index = 0;
556                         else
557                                 index = ARRAY_OBJ_INDEX (start, obj, elem_size);
558
559                         elem = (char*)mono_array_addr_with_size ((MonoArray*)obj, elem_size, index);
560                         if (klass->element_class->valuetype) {
561                                 for (; elem < card_end; elem += elem_size)
562                                         scan_vtype_func (elem, desc, queue);
563                         } else {
564                                 HEAVY_STAT (++los_array_cards);
565                                 for (; elem < card_end; elem += SIZEOF_VOID_P) {
566                                         gpointer new, old = *(gpointer*)elem;
567                                         if (G_UNLIKELY (mono_sgen_ptr_in_nursery (old))) {
568                                                 HEAVY_STAT (++los_array_remsets);
569                                                 copy_func ((void**)elem, queue);
570                                                 new = *(gpointer*)elem;
571                                                 if (G_UNLIKELY (mono_sgen_ptr_in_nursery (new)))
572                                                         mono_sgen_add_to_global_remset (elem);
573                                         }
574                                 }
575                         }
576                 }
577
578 #ifdef SGEN_HAVE_OVERLAPPING_CARDS
579                 if (overflow_scan_end) {
580                         extra_idx = card_data - card_base;
581                         card_base = card_data = sgen_shadow_cardtable;
582                         card_data_end = overflow_scan_end;
583                         overflow_scan_end = NULL;
584                         goto LOOP_HEAD;
585                 }
586 #endif
587
588         } else {
589                 HEAVY_STAT (++bloby_objects);
590                 if (cards) {
591                         if (sgen_card_table_is_range_marked (cards, (mword)obj, block_obj_size))
592                                 scan_object_func (obj, queue);
593                 } else if (sgen_card_table_region_begin_scanning ((mword)obj, block_obj_size)) {
594                         scan_object_func (obj, queue);
595                 }
596         }
597 }
598
599 #ifdef CARDTABLE_STATS
600
601 typedef struct {
602         int total, marked, remarked;    
603 } card_stats;
604
605 static card_stats major_stats, los_stats;
606 static card_stats *cur_stats;
607
608 static void
609 count_marked_cards (mword start, mword size)
610 {
611         mword end = start + size;
612         while (start <= end) {
613                 ++cur_stats->total;
614                 if (sgen_card_table_address_is_marked (start))
615                         ++cur_stats->marked;
616                 start += CARD_SIZE_IN_BYTES;
617         }
618 }
619
620 static void
621 count_remarked_cards (mword start, mword size)
622 {
623         mword end = start + size;
624         while (start <= end) {
625                 if (sgen_card_table_address_is_marked (start))
626                         ++cur_stats->remarked;
627                 start += CARD_SIZE_IN_BYTES;
628         }
629 }
630
631 #endif
632
633 void
634 sgen_card_tables_collect_stats (gboolean begin)
635 {
636 #ifdef CARDTABLE_STATS
637         if (begin) {
638                 memset (&major_stats, 0, sizeof (card_stats));
639                 memset (&los_stats, 0, sizeof (card_stats));
640                 cur_stats = &major_stats;
641                 sgen_major_collector_iterate_live_block_ranges (count_marked_cards);
642                 cur_stats = &los_stats;
643                 mono_sgen_los_iterate_live_block_ranges (count_marked_cards);
644         } else {
645                 cur_stats = &major_stats;
646                 sgen_major_collector_iterate_live_block_ranges (count_marked_cards);
647                 cur_stats = &los_stats;
648                 mono_sgen_los_iterate_live_block_ranges (count_remarked_cards);
649                 printf ("cards major (t %d m %d r %d)  los (t %d m %d r %d) major_scan %lld los_scan %lld\n", 
650                         major_stats.total, major_stats.marked, major_stats.remarked,
651                         los_stats.total, los_stats.marked, los_stats.remarked,
652                         last_major_scan_time, last_los_scan_time);
653         }
654 #endif
655 }
656
657 #else
658
659 void
660 sgen_card_table_mark_address (mword address)
661 {
662         g_assert_not_reached ();
663 }
664
665 void
666 sgen_card_table_mark_range (mword address, mword size)
667 {
668         g_assert_not_reached ();
669 }
670
671 guint8*
672 mono_gc_get_card_table (int *shift_bits, gpointer *mask)
673 {
674         return NULL;
675 }
676
677 #endif
678
679 #endif /*HAVE_SGEN_GC*/