PR feedback: Add a runtime switch for the aggressive SCC merging
[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         char *dump_prefix;
41         gboolean accounting;
42         gboolean scc_precise_merge; // Used by Tarjan
43 } SgenBridgeProcessorConfig;
44
45 typedef struct {
46         void (*reset_data) (void);
47         void (*processing_stw_step) (void);
48         void (*processing_build_callback_data) (int generation);
49         void (*processing_after_callback) (int generation);
50         MonoGCBridgeObjectKind (*class_kind) (MonoClass *klass);
51         void (*register_finalized_object) (GCObject *object);
52         void (*describe_pointer) (GCObject *object);
53
54         /* Should be called once, immediately after init */
55         void (*set_config) (const SgenBridgeProcessorConfig *);
56
57         /*
58          * These are set by processing_build_callback_data().
59          */
60         int num_sccs;
61         MonoGCBridgeSCC **api_sccs;
62
63         int num_xrefs;
64         MonoGCBridgeXRef *api_xrefs;
65 } SgenBridgeProcessor;
66
67 void sgen_old_bridge_init (SgenBridgeProcessor *collector);
68 void sgen_new_bridge_init (SgenBridgeProcessor *collector);
69 void sgen_tarjan_bridge_init (SgenBridgeProcessor *collector);
70 void sgen_set_bridge_implementation (const char *name);
71 void sgen_bridge_set_dump_prefix (const char *prefix);
72 void sgen_init_bridge (void);
73
74 #endif
75
76 #endif