Merge pull request #1066 from esdrubal/bug19313
[mono.git] / mono / metadata / sgen-pinning.h
1 /*
2  * sgen-pinning.h: All about pinning objects.
3  *
4  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
5  * Copyright (C) 2012 Xamarin Inc
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License 2.0 as published by the Free Software Foundation;
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License 2.0 along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20 #ifndef __MONO_SGEN_PINNING_H__
21 #define __MONO_SGEN_PINNING_H__
22
23 enum {
24         PIN_TYPE_STACK,
25         PIN_TYPE_STATIC_DATA,
26         PIN_TYPE_OTHER,
27         PIN_TYPE_MAX
28 };
29
30 void sgen_pin_stage_ptr (void *ptr) MONO_INTERNAL;
31 void sgen_optimize_pin_queue (size_t start_slot) MONO_INTERNAL;
32 void sgen_init_pinning (void) MONO_INTERNAL;
33 void sgen_finish_pinning (void) MONO_INTERNAL;
34 void sgen_pin_queue_clear_discarded_entries (GCMemSection *section, size_t max_pin_slot) MONO_INTERNAL;
35 size_t sgen_get_pinned_count (void) MONO_INTERNAL;
36 void sgen_pinning_setup_section (GCMemSection *section) MONO_INTERNAL;
37 void sgen_pinning_trim_queue_to_section (GCMemSection *section) MONO_INTERNAL;
38
39 void sgen_dump_pin_queue (void) MONO_INTERNAL;
40
41 /* Pinning stats */
42
43 void sgen_pin_stats_register_address (char *addr, int pin_type) MONO_INTERNAL;
44 size_t sgen_pin_stats_get_pinned_byte_count (int pin_type) MONO_INTERNAL;
45 ObjectList *sgen_pin_stats_get_object_list (void) MONO_INTERNAL;
46 void sgen_pin_stats_reset (void) MONO_INTERNAL;
47
48 /* Perpetual pinning, aka cementing */
49
50 void sgen_cement_init (gboolean enabled) MONO_INTERNAL;
51 void sgen_cement_reset (void) MONO_INTERNAL;
52 void sgen_cement_concurrent_start (void) MONO_INTERNAL;
53 void sgen_cement_concurrent_finish (void) MONO_INTERNAL;
54 gboolean sgen_cement_lookup (char *obj) MONO_INTERNAL;
55 gboolean sgen_cement_lookup_or_register (char *obj) MONO_INTERNAL;
56 void sgen_cement_iterate (IterateObjectCallbackFunc callback, void *callback_data) MONO_INTERNAL;
57 void sgen_cement_clear_below_threshold (void) MONO_INTERNAL;
58
59 #endif