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