Allow bridge callbacks to be set after GC init
[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  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
7  */
8
9 #ifndef __MONO_SGENBRIDGEINTERNAL_H__
10 #define __MONO_SGENBRIDGEINTERNAL_H__
11
12 #include "config.h"
13
14 #ifdef HAVE_SGEN_GC
15
16 #include "mono/utils/mono-compiler.h"
17
18 #include "mono/sgen/sgen-gc.h"
19 #include "mono/metadata/sgen-bridge.h"
20
21 extern volatile gboolean bridge_processing_in_progress;
22 extern MonoGCBridgeCallbacks bridge_callbacks;
23
24 gboolean sgen_need_bridge_processing (void);
25 void sgen_bridge_reset_data (void);
26 void sgen_bridge_processing_stw_step (void);
27 void sgen_bridge_processing_finish (int generation);
28 gboolean sgen_is_bridge_object (GCObject *obj);
29 MonoGCBridgeObjectKind sgen_bridge_class_kind (MonoClass *klass);
30 void sgen_bridge_register_finalized_object (GCObject *object);
31 void sgen_bridge_describe_pointer (GCObject *object);
32
33 gboolean sgen_is_bridge_object (GCObject *obj);
34 void sgen_mark_bridge_object (GCObject *obj);
35
36 gboolean sgen_bridge_handle_gc_debug (const char *opt);
37 void sgen_bridge_print_gc_debug_usage (void);
38
39 typedef struct {
40         void (*reset_data) (void);
41         void (*processing_stw_step) (void);
42         void (*processing_build_callback_data) (int generation);
43         void (*processing_after_callback) (int generation);
44         MonoGCBridgeObjectKind (*class_kind) (MonoClass *klass);
45         void (*register_finalized_object) (GCObject *object);
46         void (*describe_pointer) (GCObject *object);
47         void (*enable_accounting) (void);
48
49         // Optional-- used for debugging
50         void (*set_dump_prefix) (const char *prefix);
51
52         /*
53          * These are set by processing_build_callback_data().
54          */
55         int num_sccs;
56         MonoGCBridgeSCC **api_sccs;
57
58         int num_xrefs;
59         MonoGCBridgeXRef *api_xrefs;
60 } SgenBridgeProcessor;
61
62 void sgen_old_bridge_init (SgenBridgeProcessor *collector);
63 void sgen_new_bridge_init (SgenBridgeProcessor *collector);
64 void sgen_tarjan_bridge_init (SgenBridgeProcessor *collector);
65 void sgen_set_bridge_implementation (const char *name);
66 void sgen_bridge_set_dump_prefix (const char *prefix);
67 void sgen_init_bridge (void);
68
69 #endif
70
71 #endif