Fix warnings.
[mono.git] / mono / metadata / sgen-protocol.h
1 /*
2  * Copyright 2001-2003 Ximian, Inc
3  * Copyright 2003-2010 Novell, Inc.
4  * 
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  * 
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24
25 #include "sgen-gc.h"
26
27 #ifdef SGEN_BINARY_PROTOCOL
28
29 enum {
30         SGEN_PROTOCOL_COLLECTION,
31         SGEN_PROTOCOL_ALLOC,
32         SGEN_PROTOCOL_COPY,
33         SGEN_PROTOCOL_PIN,
34         SGEN_PROTOCOL_MARK,
35         SGEN_PROTOCOL_WBARRIER,
36         SGEN_PROTOCOL_GLOBAL_REMSET,
37         SGEN_PROTOCOL_PTR_UPDATE,
38         SGEN_PROTOCOL_CLEANUP,
39         SGEN_PROTOCOL_EMPTY,
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 };
47
48 typedef struct {
49         int generation;
50 } SGenProtocolCollection;
51
52 typedef struct {
53         gpointer obj;
54         gpointer vtable;
55         int size;
56 } SGenProtocolAlloc;
57
58 typedef struct {
59         gpointer from;
60         gpointer to;
61         gpointer vtable;
62         int size;
63 } SGenProtocolCopy;
64
65 typedef struct {
66         gpointer obj;
67         gpointer vtable;
68         int size;
69 } SGenProtocolPin;
70
71 typedef struct {
72         gpointer obj;
73         gpointer vtable;
74         int size;
75 } SGenProtocolMark;
76
77 typedef struct {
78         gpointer ptr;
79         gpointer value;
80         gpointer value_vtable;
81 } SGenProtocolWBarrier;
82
83 typedef struct {
84         gpointer ptr;
85         gpointer value;
86         gpointer value_vtable;
87 } SGenProtocolGlobalRemset;
88
89 typedef struct {
90         gpointer ptr;
91         gpointer old_value;
92         gpointer new_value;
93         gpointer vtable;
94         int size;
95 } SGenProtocolPtrUpdate;
96
97 typedef struct {
98         gpointer ptr;
99         gpointer vtable;
100         int size;
101 } SGenProtocolCleanup;
102
103 typedef struct {
104         gpointer start;
105         int size;
106 } SGenProtocolEmpty;
107
108 typedef struct {
109         gpointer thread;
110 } SGenProtocolThreadRestart;
111
112 typedef struct {
113         gpointer thread;
114 } SGenProtocolThreadRegister;
115
116 typedef struct {
117         gpointer thread;
118 } SGenProtocolThreadUnregister;
119
120 typedef struct {
121         gpointer obj;
122         gpointer obj_vtable;
123         int offset;
124         gpointer value;
125         gpointer value_vtable;
126         int value_pinned;
127 } SGenProtocolMissingRemset;
128
129 /* missing: finalizers, dislinks, roots, non-store wbarriers */
130
131 void binary_protocol_init (const char *filename) MONO_INTERNAL;
132 gboolean binary_protocol_is_enabled (void) MONO_INTERNAL;
133
134 void binary_protocol_flush_buffers (gboolean force) MONO_INTERNAL;
135
136 void binary_protocol_collection (int generation) MONO_INTERNAL;
137 void binary_protocol_alloc (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
138 void binary_protocol_alloc_pinned (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
139 void binary_protocol_alloc_degraded (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
140 void binary_protocol_copy (gpointer from, gpointer to, gpointer vtable, int size) MONO_INTERNAL;
141 void binary_protocol_pin (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
142 void binary_protocol_mark (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
143 void binary_protocol_wbarrier (gpointer ptr, gpointer value, gpointer value_vtable) MONO_INTERNAL;
144 void binary_protocol_global_remset (gpointer ptr, gpointer value, gpointer value_vtable) MONO_INTERNAL;
145 void binary_protocol_ptr_update (gpointer ptr, gpointer old_value, gpointer new_value, gpointer vtable, int size) MONO_INTERNAL;
146 void binary_protocol_cleanup (gpointer ptr, gpointer vtable, int size) MONO_INTERNAL;
147 void binary_protocol_empty (gpointer start, int size) MONO_INTERNAL;
148 void binary_protocol_thread_restart (gpointer thread) MONO_INTERNAL;
149 void binary_protocol_thread_register (gpointer thread) MONO_INTERNAL;
150 void binary_protocol_thread_unregister (gpointer thread) MONO_INTERNAL;
151 void binary_protocol_missing_remset (gpointer obj, gpointer obj_vtable, int offset,
152                 gpointer value, gpointer value_vtable, int value_pinned) MONO_INTERNAL;
153
154 #else
155
156 #define binary_protocol_is_enabled()    FALSE
157
158 #define binary_protocol_flush_buffers(force)
159 #define binary_protocol_collection(generation)
160 #define binary_protocol_alloc(obj, vtable, size)
161 #define binary_protocol_alloc_pinned(obj, vtable, size)
162 #define binary_protocol_alloc_degraded(obj, vtable, size)
163 #define binary_protocol_copy(from, to, vtable, size)
164 #define binary_protocol_pin(obj, vtable, size)
165 #define binary_protocol_mark(obj, vtable, size)
166 #define binary_protocol_wbarrier(ptr, value, value_vtable)
167 #define binary_protocol_global_remset(ptr, value, value_vtable)
168 #define binary_protocol_ptr_update(ptr, old_value, new_value, vtable, size)
169 #define binary_protocol_cleanup(ptr, vtable, size)
170 #define binary_protocol_empty(start, size)
171 #define binary_protocol_thread_restart(thread)
172 #define binary_protocol_thread_register(thread)
173 #define binary_protocol_thread_unregister(thread)
174 #define binary_protocol_missing_remset(obj, obj_vtable, offset, value, value_vtable, value_pinned)
175
176 #endif