Boehm now supports long links.
[mono.git] / mono / metadata / sgen-protocol.h
1 /*
2  * sgen-protocol.h: Binary protocol of internal activity, to aid
3  * debugging.
4  *
5  * Copyright 2001-2003 Ximian, Inc
6  * Copyright 2003-2010 Novell, Inc.
7  * Copyright (C) 2012 Xamarin Inc
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License 2.0 as published by the Free Software Foundation;
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License 2.0 along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22
23 #include "sgen-gc.h"
24
25 #ifdef SGEN_BINARY_PROTOCOL
26
27 enum {
28         SGEN_PROTOCOL_COLLECTION_BEGIN,
29         SGEN_PROTOCOL_COLLECTION_END,
30         SGEN_PROTOCOL_ALLOC,
31         SGEN_PROTOCOL_COPY,
32         SGEN_PROTOCOL_PIN,
33         SGEN_PROTOCOL_MARK,
34         SGEN_PROTOCOL_WBARRIER,
35         SGEN_PROTOCOL_GLOBAL_REMSET,
36         SGEN_PROTOCOL_PTR_UPDATE,
37         SGEN_PROTOCOL_CLEANUP,
38         SGEN_PROTOCOL_EMPTY,
39         SGEN_PROTOCOL_THREAD_SUSPEND,
40         SGEN_PROTOCOL_THREAD_RESTART,
41         SGEN_PROTOCOL_THREAD_REGISTER,
42         SGEN_PROTOCOL_THREAD_UNREGISTER,
43         SGEN_PROTOCOL_MISSING_REMSET,
44         SGEN_PROTOCOL_ALLOC_PINNED,
45         SGEN_PROTOCOL_ALLOC_DEGRADED,
46         SGEN_PROTOCOL_CARD_SCAN
47 };
48
49 typedef struct {
50         int index, generation;
51 } SGenProtocolCollection;
52
53 typedef struct {
54         gpointer obj;
55         gpointer vtable;
56         int size;
57 } SGenProtocolAlloc;
58
59 typedef struct {
60         gpointer from;
61         gpointer to;
62         gpointer vtable;
63         int size;
64 } SGenProtocolCopy;
65
66 typedef struct {
67         gpointer obj;
68         gpointer vtable;
69         int size;
70 } SGenProtocolPin;
71
72 typedef struct {
73         gpointer obj;
74         gpointer vtable;
75         int size;
76 } SGenProtocolMark;
77
78 typedef struct {
79         gpointer ptr;
80         gpointer value;
81         gpointer value_vtable;
82 } SGenProtocolWBarrier;
83
84 typedef struct {
85         gpointer ptr;
86         gpointer value;
87         gpointer value_vtable;
88 } SGenProtocolGlobalRemset;
89
90 typedef struct {
91         gpointer ptr;
92         gpointer old_value;
93         gpointer new_value;
94         gpointer vtable;
95         int size;
96 } SGenProtocolPtrUpdate;
97
98 typedef struct {
99         gpointer ptr;
100         gpointer vtable;
101         int size;
102 } SGenProtocolCleanup;
103
104 typedef struct {
105         gpointer start;
106         int size;
107 } SGenProtocolEmpty;
108
109 typedef struct {
110         gpointer thread, stopped_ip;
111 } SGenProtocolThreadSuspend;
112
113 typedef struct {
114         gpointer thread;
115 } SGenProtocolThreadRestart;
116
117 typedef struct {
118         gpointer thread;
119 } SGenProtocolThreadRegister;
120
121 typedef struct {
122         gpointer thread;
123 } SGenProtocolThreadUnregister;
124
125 typedef struct {
126         gpointer obj;
127         gpointer obj_vtable;
128         int offset;
129         gpointer value;
130         gpointer value_vtable;
131         int value_pinned;
132 } SGenProtocolMissingRemset;
133
134 typedef struct {
135         gpointer start;
136         int size;
137 } SGenProtocolCardScan;
138
139 /* missing: finalizers, dislinks, roots, non-store wbarriers */
140
141 void binary_protocol_init (const char *filename) MONO_INTERNAL;
142 gboolean binary_protocol_is_enabled (void) MONO_INTERNAL;
143
144 void binary_protocol_flush_buffers (gboolean force) MONO_INTERNAL;
145
146 void binary_protocol_collection_begin (int index, int generation) MONO_INTERNAL;
147 void binary_protocol_collection_end (int index, int generation) MONO_INTERNAL;
148 void binary_protocol_alloc (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
149 void binary_protocol_alloc_pinned (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
150 void binary_protocol_alloc_degraded (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
151 void binary_protocol_copy (gpointer from, gpointer to, gpointer vtable, int size) MONO_INTERNAL;
152 void binary_protocol_pin (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
153 void binary_protocol_mark (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
154 void binary_protocol_wbarrier (gpointer ptr, gpointer value, gpointer value_vtable) MONO_INTERNAL;
155 void binary_protocol_global_remset (gpointer ptr, gpointer value, gpointer value_vtable) MONO_INTERNAL;
156 void binary_protocol_ptr_update (gpointer ptr, gpointer old_value, gpointer new_value, gpointer vtable, int size) MONO_INTERNAL;
157 void binary_protocol_cleanup (gpointer ptr, gpointer vtable, int size) MONO_INTERNAL;
158 void binary_protocol_empty (gpointer start, int size) MONO_INTERNAL;
159 void binary_protocol_thread_suspend (gpointer thread, gpointer stopped_ip) MONO_INTERNAL;
160 void binary_protocol_thread_restart (gpointer thread) MONO_INTERNAL;
161 void binary_protocol_thread_register (gpointer thread) MONO_INTERNAL;
162 void binary_protocol_thread_unregister (gpointer thread) MONO_INTERNAL;
163 void binary_protocol_missing_remset (gpointer obj, gpointer obj_vtable, int offset,
164                 gpointer value, gpointer value_vtable, int value_pinned) MONO_INTERNAL;
165 void binary_protocol_card_scan (gpointer start, int size) MONO_INTERNAL;
166
167 #else
168
169 #define binary_protocol_is_enabled()    FALSE
170
171 #define binary_protocol_flush_buffers(force)
172 #define binary_protocol_collection_begin(index, generation)
173 #define binary_protocol_collection_end(index, generation)
174 #define binary_protocol_alloc(obj, vtable, size)
175 #define binary_protocol_alloc_pinned(obj, vtable, size)
176 #define binary_protocol_alloc_degraded(obj, vtable, size)
177 #define binary_protocol_copy(from, to, vtable, size)
178 #define binary_protocol_pin(obj, vtable, size)
179 #define binary_protocol_mark(obj, vtable, size)
180 #define binary_protocol_wbarrier(ptr, value, value_vtable)
181 #define binary_protocol_global_remset(ptr, value, value_vtable)
182 #define binary_protocol_ptr_update(ptr, old_value, new_value, vtable, size)
183 #define binary_protocol_cleanup(ptr, vtable, size)
184 #define binary_protocol_empty(start, size)
185 #define binary_protocol_thread_suspend(thread, ip)
186 #define binary_protocol_thread_restart(thread)
187 #define binary_protocol_thread_register(thread)
188 #define binary_protocol_thread_unregister(thread)
189 #define binary_protocol_missing_remset(obj, obj_vtable, offset, value, value_vtable, value_pinned)
190 #define binary_protocol_card_scan(start, size)
191
192 #endif