Merge branch 'alexischr/nursery-canaries-managed-alloc'
[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_param (const char *opt);
37 gboolean sgen_bridge_handle_gc_debug (const char *opt);
38 void sgen_bridge_print_gc_debug_usage (void);
39
40 typedef struct {
41         char *dump_prefix;
42         gboolean accounting;
43         gboolean scc_precise_merge; // Used by Tarjan
44 } SgenBridgeProcessorConfig;
45
46 typedef struct {
47         void (*reset_data) (void);
48         void (*processing_stw_step) (void);
49         void (*processing_build_callback_data) (int generation);
50         void (*processing_after_callback) (int generation);
51         MonoGCBridgeObjectKind (*class_kind) (MonoClass *klass);
52         void (*register_finalized_object) (GCObject *object);
53         void (*describe_pointer) (GCObject *object);
54
55         /* Should be called once, immediately after init */
56         void (*set_config) (const SgenBridgeProcessorConfig *);
57
58         /*
59          * These are set by processing_build_callback_data().
60          */
61         int num_sccs;
62         MonoGCBridgeSCC **api_sccs;
63
64         int num_xrefs;
65         MonoGCBridgeXRef *api_xrefs;
66 } SgenBridgeProcessor;
67
68 void sgen_old_bridge_init (SgenBridgeProcessor *collector);
69 void sgen_new_bridge_init (SgenBridgeProcessor *collector);
70 void sgen_tarjan_bridge_init (SgenBridgeProcessor *collector);
71 void sgen_set_bridge_implementation (const char *name);
72 void sgen_bridge_set_dump_prefix (const char *prefix);
73 void sgen_init_bridge (void);
74
75 #endif
76
77 #endif