Fix a case missed by 7e222739db7192eb0c5ec17cad18e309482e71b4.
[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_SUSPEND,
41         SGEN_PROTOCOL_THREAD_RESTART,
42         SGEN_PROTOCOL_THREAD_REGISTER,
43         SGEN_PROTOCOL_THREAD_UNREGISTER,
44         SGEN_PROTOCOL_MISSING_REMSET,
45         SGEN_PROTOCOL_ALLOC_PINNED,
46         SGEN_PROTOCOL_ALLOC_DEGRADED
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 /* missing: finalizers, dislinks, roots, non-store wbarriers */
135
136 void binary_protocol_init (const char *filename) MONO_INTERNAL;
137 gboolean binary_protocol_is_enabled (void) MONO_INTERNAL;
138
139 void binary_protocol_flush_buffers (gboolean force) MONO_INTERNAL;
140
141 void binary_protocol_collection (int index, int generation) MONO_INTERNAL;
142 void binary_protocol_alloc (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
143 void binary_protocol_alloc_pinned (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
144 void binary_protocol_alloc_degraded (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
145 void binary_protocol_copy (gpointer from, gpointer to, gpointer vtable, int size) MONO_INTERNAL;
146 void binary_protocol_pin (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
147 void binary_protocol_mark (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
148 void binary_protocol_wbarrier (gpointer ptr, gpointer value, gpointer value_vtable) MONO_INTERNAL;
149 void binary_protocol_global_remset (gpointer ptr, gpointer value, gpointer value_vtable) MONO_INTERNAL;
150 void binary_protocol_ptr_update (gpointer ptr, gpointer old_value, gpointer new_value, gpointer vtable, int size) MONO_INTERNAL;
151 void binary_protocol_cleanup (gpointer ptr, gpointer vtable, int size) MONO_INTERNAL;
152 void binary_protocol_empty (gpointer start, int size) MONO_INTERNAL;
153 void binary_protocol_thread_suspend (gpointer thread, gpointer stopped_ip) MONO_INTERNAL;
154 void binary_protocol_thread_restart (gpointer thread) MONO_INTERNAL;
155 void binary_protocol_thread_register (gpointer thread) MONO_INTERNAL;
156 void binary_protocol_thread_unregister (gpointer thread) MONO_INTERNAL;
157 void binary_protocol_missing_remset (gpointer obj, gpointer obj_vtable, int offset,
158                 gpointer value, gpointer value_vtable, int value_pinned) MONO_INTERNAL;
159
160 #else
161
162 #define binary_protocol_is_enabled()    FALSE
163
164 #define binary_protocol_flush_buffers(force)
165 #define binary_protocol_collection(index, generation)
166 #define binary_protocol_alloc(obj, vtable, size)
167 #define binary_protocol_alloc_pinned(obj, vtable, size)
168 #define binary_protocol_alloc_degraded(obj, vtable, size)
169 #define binary_protocol_copy(from, to, vtable, size)
170 #define binary_protocol_pin(obj, vtable, size)
171 #define binary_protocol_mark(obj, vtable, size)
172 #define binary_protocol_wbarrier(ptr, value, value_vtable)
173 #define binary_protocol_global_remset(ptr, value, value_vtable)
174 #define binary_protocol_ptr_update(ptr, old_value, new_value, vtable, size)
175 #define binary_protocol_cleanup(ptr, vtable, size)
176 #define binary_protocol_empty(start, size)
177 #define binary_protocol_thread_suspend(thread, ip)
178 #define binary_protocol_thread_restart(thread)
179 #define binary_protocol_thread_register(thread)
180 #define binary_protocol_thread_unregister(thread)
181 #define binary_protocol_missing_remset(obj, obj_vtable, offset, value, value_vtable, value_pinned)
182
183 #endif