Merge pull request #2803 from BrzVlad/feature-conc-pinned-scan
[mono.git] / mono / sgen / sgen-layout-stats.h
1 /*
2  * Copyright Xamarin Inc (http://www.xamarin.com)
3  *
4  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
5  */
6 #ifndef __MONO_SGEN_LAYOUT_STATS_H__
7 #define __MONO_SGEN_LAYOUT_STATS_H__
8
9 #ifdef SGEN_OBJECT_LAYOUT_STATISTICS
10
11 #define SGEN_OBJECT_LAYOUT_BITMAP_BITS  16
12
13 void sgen_object_layout_scanned_bitmap (unsigned int bitmap);
14 void sgen_object_layout_scanned_bitmap_overflow (void);
15 void sgen_object_layout_scanned_ref_array (void);
16 void sgen_object_layout_scanned_vtype_array (void);
17
18 void sgen_object_layout_dump (FILE *out);
19
20 #define SGEN_OBJECT_LAYOUT_STATISTICS_DECLARE_BITMAP    unsigned int __object_layout_bitmap = 0
21 #define SGEN_OBJECT_LAYOUT_STATISTICS_MARK_BITMAP(o,p)  do {            \
22                 int __index = ((void**)(p)) - ((void**)(((char*)(o)) + SGEN_CLIENT_OBJECT_HEADER_SIZE)); \
23                 if (__index >= SGEN_OBJECT_LAYOUT_BITMAP_BITS)          \
24                         __object_layout_bitmap = (unsigned int)-1;      \
25                 else if (__object_layout_bitmap != (unsigned int)-1)    \
26                         __object_layout_bitmap |= (1 << __index);       \
27         } while (0)
28 #define SGEN_OBJECT_LAYOUT_STATISTICS_COMMIT_BITMAP do {                \
29                 if (__object_layout_bitmap == (unsigned int)-1)         \
30                         sgen_object_layout_scanned_bitmap_overflow ();  \
31                 else                                                    \
32                         sgen_object_layout_scanned_bitmap (__object_layout_bitmap); \
33         } while (0)
34
35 #else
36
37 #define sgen_object_layout_scanned_bitmap(bitmap)
38 #define sgen_object_layout_scanned_bitmap_overflow()
39 #define sgen_object_layout_scanned_ref_array()
40 #define sgen_object_layout_scanned_vtype_array()
41
42 #define sgen_object_layout_dump(out)
43
44 #define SGEN_OBJECT_LAYOUT_STATISTICS_DECLARE_BITMAP
45 #define SGEN_OBJECT_LAYOUT_STATISTICS_MARK_BITMAP(o,p)
46 #define SGEN_OBJECT_LAYOUT_STATISTICS_COMMIT_BITMAP
47
48 #endif
49
50 #endif