ac7dfb975998a1f290d9ab82d0923a253b8f4b58
[mono.git] / mono / metadata / sgen-bridge-internals.h
1 /*
2  * sgen-bridge-internals.h: The cross-GC bridge.
3  *
4  * Copyright (C) 2015 Xamarin Inc
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License 2.0 as published by the Free Software Foundation;
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License 2.0 along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20 #ifndef __MONO_SGENBRIDGEINTERNAL_H__
21 #define __MONO_SGENBRIDGEINTERNAL_H__
22
23 #include "config.h"
24
25 #ifdef HAVE_SGEN_GC
26
27 #include "mono/utils/mono-compiler.h"
28
29 #include "mono/sgen/sgen-gc.h"
30 #include "mono/metadata/sgen-bridge.h"
31
32 extern volatile gboolean bridge_processing_in_progress;
33 extern MonoGCBridgeCallbacks bridge_callbacks;
34
35 gboolean sgen_need_bridge_processing (void);
36 void sgen_bridge_reset_data (void);
37 void sgen_bridge_processing_stw_step (void);
38 void sgen_bridge_processing_finish (int generation);
39 gboolean sgen_is_bridge_object (GCObject *obj);
40 MonoGCBridgeObjectKind sgen_bridge_class_kind (MonoClass *klass);
41 void sgen_bridge_register_finalized_object (GCObject *object);
42 void sgen_bridge_describe_pointer (GCObject *object);
43
44 gboolean sgen_is_bridge_object (GCObject *obj);
45 void sgen_mark_bridge_object (GCObject *obj);
46
47 gboolean sgen_bridge_handle_gc_debug (const char *opt);
48 void sgen_bridge_print_gc_debug_usage (void);
49
50 typedef struct {
51         void (*reset_data) (void);
52         void (*processing_stw_step) (void);
53         void (*processing_build_callback_data) (int generation);
54         void (*processing_after_callback) (int generation);
55         MonoGCBridgeObjectKind (*class_kind) (MonoClass *klass);
56         void (*register_finalized_object) (GCObject *object);
57         void (*describe_pointer) (GCObject *object);
58         void (*enable_accounting) (void);
59         void (*set_dump_prefix) (const char *prefix);
60
61         /*
62          * These are set by processing_build_callback_data().
63          */
64         int num_sccs;
65         MonoGCBridgeSCC **api_sccs;
66
67         int num_xrefs;
68         MonoGCBridgeXRef *api_xrefs;
69 } SgenBridgeProcessor;
70
71 void sgen_old_bridge_init (SgenBridgeProcessor *collector);
72 void sgen_new_bridge_init (SgenBridgeProcessor *collector);
73 void sgen_tarjan_bridge_init (SgenBridgeProcessor *collector);
74 void sgen_set_bridge_implementation (const char *name);
75 void sgen_bridge_set_dump_prefix (const char *prefix);
76
77 #endif
78
79 #endif