X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fsgen%2Fsgen-protocol.h;h=8b82dc3794aee3a4eb19c7bf3b06da97f34115db;hb=26cad094eeaebca1671e5b902b55ed745e4e0376;hp=1c10d29d5c0e367f07e8d26a0163177da59c1b41;hpb=73b9bd1ddda5da41f7baaf95b2e8464169255d70;p=mono.git diff --git a/mono/sgen/sgen-protocol.h b/mono/sgen/sgen-protocol.h index 1c10d29d5c0..8b82dc3794a 100644 --- a/mono/sgen/sgen-protocol.h +++ b/mono/sgen/sgen-protocol.h @@ -1,6 +1,6 @@ -/* - * sgen-protocol.h: Binary protocol of internal activity, to aid - * debugging. +/** + * \file + * Binary protocol of internal activity, to aid debugging. * * Copyright 2001-2003 Ximian, Inc * Copyright 2003-2010 Novell, Inc. @@ -15,21 +15,18 @@ #include "sgen-gc.h" #define PROTOCOL_HEADER_CHECK 0xde7ec7ab1ec0de -#define PROTOCOL_HEADER_VERSION 1 +/* + * The version needs to be bumped every time we introduce breaking changes (like + * adding new protocol entries or various format changes). The latest protocol grepper + * should be able to handle all the previous versions, while an old grepper will + * be able to tell if it cannot handle the format. + */ +#define PROTOCOL_HEADER_VERSION 2 /* Special indices returned by MATCH_INDEX. */ #define BINARY_PROTOCOL_NO_MATCH (-1) #define BINARY_PROTOCOL_MATCH (-2) -/* We pack all protocol structs by default unless specified otherwise */ -#ifndef PROTOCOL_STRUCT_ATTR -#ifdef __GNUC__ -#define PROTOCOL_STRUCT_ATTR __attribute__ ((packed)) -#else -#define PROTOCOL_STRUCT_ATTR -#endif -#endif - #define PROTOCOL_ID(method) method ## _id #define PROTOCOL_STRUCT(method) method ## _struct #define CLIENT_PROTOCOL_NAME(method) sgen_client_ ## method @@ -80,6 +77,19 @@ enum { #include "sgen-protocol-def.h" }; +/* We pack all protocol structs by default unless specified otherwise */ +#ifndef PROTOCOL_STRUCT_ATTR + +#define PROTOCOL_PACK_STRUCTS + +#if defined(__GNUC__) +#define PROTOCOL_STRUCT_ATTR __attribute__ ((__packed__)) +#else +#define PROTOCOL_STRUCT_ATTR +#endif + +#endif + #define BEGIN_PROTOCOL_ENTRY0(method) #define BEGIN_PROTOCOL_ENTRY1(method,t1,f1) \ typedef struct PROTOCOL_STRUCT_ATTR { \ @@ -147,14 +157,22 @@ enum { #define END_PROTOCOL_ENTRY_FLUSH #define END_PROTOCOL_ENTRY_HEAVY +#if defined(_MSC_VER) && defined(PROTOCOL_PACK_STRUCTS) +#pragma pack(push) +#pragma pack(1) +#endif #include "sgen-protocol-def.h" +#if defined(_MSC_VER) && defined(PROTOCOL_PACK_STRUCTS) +#pragma pack(pop) +#undef PROTOCOL_PACK_STRUCTS +#endif /* missing: finalizers, roots, non-store wbarriers */ void binary_protocol_init (const char *filename, long long limit); gboolean binary_protocol_is_enabled (void); -void binary_protocol_flush_buffers (gboolean force); +gboolean binary_protocol_flush_buffers (gboolean force); #define BEGIN_PROTOCOL_ENTRY0(method) \ void method (void);