[System] UriKind.RelativeOrAbsolute workaround.
[mono.git] / mono / sgen / 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 #ifndef __MONO_SGENPROTOCOL_H__
24 #define __MONO_SGENPROTOCOL_H__
25
26 #include "sgen-gc.h"
27
28 /* Special indices returned by MATCH_INDEX. */
29 #define BINARY_PROTOCOL_NO_MATCH (-1)
30 #define BINARY_PROTOCOL_MATCH (-2)
31
32 #define PROTOCOL_ID(method) method ## _id
33 #define PROTOCOL_STRUCT(method) method ## _struct
34 #define CLIENT_PROTOCOL_NAME(method) sgen_client_ ## method
35
36 #define TYPE_INT int
37 #define TYPE_LONGLONG long long
38 #define TYPE_SIZE size_t
39 #define TYPE_POINTER gpointer
40 #define TYPE_BOOL gboolean
41
42 enum {
43 #define BEGIN_PROTOCOL_ENTRY0(method) PROTOCOL_ID(method),
44 #define BEGIN_PROTOCOL_ENTRY1(method,t1,f1) PROTOCOL_ID(method),
45 #define BEGIN_PROTOCOL_ENTRY2(method,t1,f1,t2,f2) PROTOCOL_ID(method),
46 #define BEGIN_PROTOCOL_ENTRY3(method,t1,f1,t2,f2,t3,f3) PROTOCOL_ID(method),
47 #define BEGIN_PROTOCOL_ENTRY4(method,t1,f1,t2,f2,t3,f3,t4,f4) PROTOCOL_ID(method),
48 #define BEGIN_PROTOCOL_ENTRY5(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5) PROTOCOL_ID(method),
49 #define BEGIN_PROTOCOL_ENTRY6(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6) PROTOCOL_ID(method),
50 #define BEGIN_PROTOCOL_ENTRY_HEAVY0(method) PROTOCOL_ID(method),
51 #define BEGIN_PROTOCOL_ENTRY_HEAVY1(method,t1,f1) PROTOCOL_ID(method),
52 #define BEGIN_PROTOCOL_ENTRY_HEAVY2(method,t1,f1,t2,f2) PROTOCOL_ID(method),
53 #define BEGIN_PROTOCOL_ENTRY_HEAVY3(method,t1,f1,t2,f2,t3,f3) PROTOCOL_ID(method),
54 #define BEGIN_PROTOCOL_ENTRY_HEAVY4(method,t1,f1,t2,f2,t3,f3,t4,f4) PROTOCOL_ID(method),
55 #define BEGIN_PROTOCOL_ENTRY_HEAVY5(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5) PROTOCOL_ID(method),
56 #define BEGIN_PROTOCOL_ENTRY_HEAVY6(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6) PROTOCOL_ID(method),
57
58 #define FLUSH()
59
60 #define DEFAULT_PRINT()
61 #define CUSTOM_PRINT(_)
62
63 #define IS_ALWAYS_MATCH(_)
64 #define MATCH_INDEX(_)
65 #define IS_VTABLE_MATCH(_)
66
67 #define END_PROTOCOL_ENTRY
68 #define END_PROTOCOL_ENTRY_HEAVY
69
70 #include "sgen-protocol-def.h"
71 };
72
73 #define BEGIN_PROTOCOL_ENTRY0(method)
74 #define BEGIN_PROTOCOL_ENTRY1(method,t1,f1) \
75         typedef struct { \
76                 t1 f1; \
77         } PROTOCOL_STRUCT(method);
78 #define BEGIN_PROTOCOL_ENTRY2(method,t1,f1,t2,f2) \
79         typedef struct { \
80                 t1 f1; \
81                 t2 f2; \
82         } PROTOCOL_STRUCT(method);
83 #define BEGIN_PROTOCOL_ENTRY3(method,t1,f1,t2,f2,t3,f3) \
84         typedef struct { \
85                 t1 f1; \
86                 t2 f2; \
87                 t3 f3; \
88         } PROTOCOL_STRUCT(method);
89 #define BEGIN_PROTOCOL_ENTRY4(method,t1,f1,t2,f2,t3,f3,t4,f4) \
90         typedef struct { \
91                 t1 f1; \
92                 t2 f2; \
93                 t3 f3; \
94                 t4 f4; \
95         } PROTOCOL_STRUCT(method);
96 #define BEGIN_PROTOCOL_ENTRY5(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5) \
97         typedef struct { \
98                 t1 f1; \
99                 t2 f2; \
100                 t3 f3; \
101                 t4 f4; \
102                 t5 f5; \
103         } PROTOCOL_STRUCT(method);
104 #define BEGIN_PROTOCOL_ENTRY6(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6) \
105         typedef struct { \
106                 t1 f1; \
107                 t2 f2; \
108                 t3 f3; \
109                 t4 f4; \
110                 t5 f5; \
111                 t6 f6; \
112         } PROTOCOL_STRUCT(method);
113
114 #define BEGIN_PROTOCOL_ENTRY_HEAVY0(method) \
115         BEGIN_PROTOCOL_ENTRY0 (method)
116 #define BEGIN_PROTOCOL_ENTRY_HEAVY1(method,t1,f1) \
117         BEGIN_PROTOCOL_ENTRY1 (method,t1,f1)
118 #define BEGIN_PROTOCOL_ENTRY_HEAVY2(method,t1,f1,t2,f2) \
119         BEGIN_PROTOCOL_ENTRY2 (method,t1,f1,t2,f2)
120 #define BEGIN_PROTOCOL_ENTRY_HEAVY3(method,t1,f1,t2,f2,t3,f3) \
121         BEGIN_PROTOCOL_ENTRY3 (method,t1,f1,t2,f2,t3,f3)
122 #define BEGIN_PROTOCOL_ENTRY_HEAVY4(method,t1,f1,t2,f2,t3,f3,t4,f4) \
123         BEGIN_PROTOCOL_ENTRY4 (method,t1,f1,t2,f2,t3,f3,t4,f4)
124 #define BEGIN_PROTOCOL_ENTRY_HEAVY5(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5) \
125         BEGIN_PROTOCOL_ENTRY5 (method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5)
126 #define BEGIN_PROTOCOL_ENTRY_HEAVY6(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6) \
127         BEGIN_PROTOCOL_ENTRY6 (method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6)
128
129 #define FLUSH()
130
131 #define DEFAULT_PRINT()
132 #define CUSTOM_PRINT(_)
133
134 #define IS_ALWAYS_MATCH(_)
135 #define MATCH_INDEX(_)
136 #define IS_VTABLE_MATCH(_)
137
138 #define END_PROTOCOL_ENTRY
139 #define END_PROTOCOL_ENTRY_HEAVY
140
141 #include "sgen-protocol-def.h"
142
143 /* missing: finalizers, roots, non-store wbarriers */
144
145 void binary_protocol_init (const char *filename, long long limit);
146 gboolean binary_protocol_is_enabled (void);
147
148 void binary_protocol_flush_buffers (gboolean force);
149
150 #define BEGIN_PROTOCOL_ENTRY0(method) \
151         void method (void);
152 #define BEGIN_PROTOCOL_ENTRY1(method,t1,f1) \
153         void method (t1 f1);
154 #define BEGIN_PROTOCOL_ENTRY2(method,t1,f1,t2,f2) \
155         void method (t1 f1, t2 f2);
156 #define BEGIN_PROTOCOL_ENTRY3(method,t1,f1,t2,f2,t3,f3) \
157         void method (t1 f1, t2 f2, t3 f3);
158 #define BEGIN_PROTOCOL_ENTRY4(method,t1,f1,t2,f2,t3,f3,t4,f4) \
159         void method (t1 f1, t2 f2, t3 f3, t4 f4);
160 #define BEGIN_PROTOCOL_ENTRY5(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5) \
161         void method (t1 f1, t2 f2, t3 f3, t4 f4, t5 f5);
162 #define BEGIN_PROTOCOL_ENTRY6(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6) \
163         void method (t1 f1, t2 f2, t3 f3, t4 f4, t5 f5, t6 f6);
164
165 #ifdef SGEN_HEAVY_BINARY_PROTOCOL
166 #define binary_protocol_is_heavy_enabled()      binary_protocol_is_enabled ()
167
168 #define BEGIN_PROTOCOL_ENTRY_HEAVY0(method) \
169         BEGIN_PROTOCOL_ENTRY0 (method)
170 #define BEGIN_PROTOCOL_ENTRY_HEAVY1(method,t1,f1) \
171         BEGIN_PROTOCOL_ENTRY1 (method,t1,f1)
172 #define BEGIN_PROTOCOL_ENTRY_HEAVY2(method,t1,f1,t2,f2) \
173         BEGIN_PROTOCOL_ENTRY2 (method,t1,f1,t2,f2)
174 #define BEGIN_PROTOCOL_ENTRY_HEAVY3(method,t1,f1,t2,f2,t3,f3) \
175         BEGIN_PROTOCOL_ENTRY3 (method,t1,f1,t2,f2,t3,f3)
176 #define BEGIN_PROTOCOL_ENTRY_HEAVY4(method,t1,f1,t2,f2,t3,f3,t4,f4) \
177         BEGIN_PROTOCOL_ENTRY4 (method,t1,f1,t2,f2,t3,f3,t4,f4)
178 #define BEGIN_PROTOCOL_ENTRY_HEAVY5(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5) \
179         BEGIN_PROTOCOL_ENTRY5 (method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5)
180 #define BEGIN_PROTOCOL_ENTRY_HEAVY6(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6) \
181         BEGIN_PROTOCOL_ENTRY6 (method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6)
182 #else
183 #define binary_protocol_is_heavy_enabled()      FALSE
184
185 #define BEGIN_PROTOCOL_ENTRY_HEAVY0(method) \
186         static inline void method (void) {}
187 #define BEGIN_PROTOCOL_ENTRY_HEAVY1(method,t1,f1) \
188         static inline void method (t1 f1) {}
189 #define BEGIN_PROTOCOL_ENTRY_HEAVY2(method,t1,f1,t2,f2) \
190         static inline void method (t1 f1, t2 f2) {}
191 #define BEGIN_PROTOCOL_ENTRY_HEAVY3(method,t1,f1,t2,f2,t3,f3) \
192         static inline void method (t1 f1, t2 f2, t3 f3) {}
193 #define BEGIN_PROTOCOL_ENTRY_HEAVY4(method,t1,f1,t2,f2,t3,f3,t4,f4) \
194         static inline void method (t1 f1, t2 f2, t3 f3, t4 f4) {}
195 #define BEGIN_PROTOCOL_ENTRY_HEAVY5(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5) \
196         static inline void method (t1 f1, t2 f2, t3 f3, t4 f4, t5 f5) {}
197 #define BEGIN_PROTOCOL_ENTRY_HEAVY6(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6) \
198         static inline void method (t1 f1, t2 f2, t3 f3, t4 f4, t5 f5, t6 f6) {}
199 #endif
200
201 #define FLUSH()
202
203 #define DEFAULT_PRINT()
204 #define CUSTOM_PRINT(_)
205
206 #define IS_ALWAYS_MATCH(_)
207 #define MATCH_INDEX(_)
208 #define IS_VTABLE_MATCH(_)
209
210 #define END_PROTOCOL_ENTRY
211 #define END_PROTOCOL_ENTRY_HEAVY
212
213 #include "sgen-protocol-def.h"
214
215 #undef TYPE_INT
216 #undef TYPE_LONGLONG
217 #undef TYPE_SIZE
218 #undef TYPE_POINTER
219 #undef TYPE_BOOL
220
221 #endif