Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Probst <mark.probst@gmail.com>2013-04-02 21:11:36 +0400
committerMark Probst <mark.probst@gmail.com>2013-04-02 21:39:30 +0400
commit359f977e79ed0d5b32e9e8d386949c25828d8dd0 (patch)
treecedb157e74d1896b78316f598a071a192bb18609
parentdbb4fd470011e716f821f8f63544dc21df14f829 (diff)
[sgen] Binary protocol entry for user-forced GCs.
-rw-r--r--mono/metadata/sgen-gc.c2
-rw-r--r--mono/metadata/sgen-protocol.c8
-rw-r--r--mono/metadata/sgen-protocol.h7
-rw-r--r--tools/sgen/sgen-grep-binprot.c7
4 files changed, 24 insertions, 0 deletions
diff --git a/mono/metadata/sgen-gc.c b/mono/metadata/sgen-gc.c
index acb5f552567..ee8c445940a 100644
--- a/mono/metadata/sgen-gc.c
+++ b/mono/metadata/sgen-gc.c
@@ -3387,6 +3387,8 @@ sgen_perform_collection (size_t requested_size, int generation_to_collect, const
const char *overflow_reason = NULL;
MONO_GC_REQUESTED (generation_to_collect, requested_size, wait_to_finish ? 1 : 0);
+ if (wait_to_finish)
+ binary_protocol_collection_force (generation_to_collect);
g_assert (generation_to_collect == GENERATION_NURSERY || generation_to_collect == GENERATION_OLD);
diff --git a/mono/metadata/sgen-protocol.c b/mono/metadata/sgen-protocol.c
index bd686ee92fc..ad32d8d0325 100644
--- a/mono/metadata/sgen-protocol.c
+++ b/mono/metadata/sgen-protocol.c
@@ -151,6 +151,14 @@ protocol_entry (unsigned char type, gpointer data, int size)
}
void
+binary_protocol_collection_force (int generation)
+{
+ SGenProtocolCollectionForce entry = { generation };
+ binary_protocol_flush_buffers (FALSE);
+ protocol_entry (SGEN_PROTOCOL_COLLECTION_FORCE, &entry, sizeof (SGenProtocolCollectionForce));
+}
+
+void
binary_protocol_collection_begin (int index, int generation)
{
SGenProtocolCollection entry = { index, generation };
diff --git a/mono/metadata/sgen-protocol.h b/mono/metadata/sgen-protocol.h
index 9005a622917..7b9dff67965 100644
--- a/mono/metadata/sgen-protocol.h
+++ b/mono/metadata/sgen-protocol.h
@@ -25,6 +25,7 @@
#ifdef SGEN_BINARY_PROTOCOL
enum {
+ SGEN_PROTOCOL_COLLECTION_FORCE,
SGEN_PROTOCOL_COLLECTION_BEGIN,
SGEN_PROTOCOL_COLLECTION_END,
SGEN_PROTOCOL_ALLOC,
@@ -52,6 +53,10 @@ enum {
};
typedef struct {
+ int generation;
+} SGenProtocolCollectionForce;
+
+typedef struct {
int index, generation;
} SGenProtocolCollection;
@@ -171,6 +176,7 @@ gboolean binary_protocol_is_enabled (void) MONO_INTERNAL;
void binary_protocol_flush_buffers (gboolean force) MONO_INTERNAL;
+void binary_protocol_collection_force (int generation) MONO_INTERNAL;
void binary_protocol_collection_begin (int index, int generation) MONO_INTERNAL;
void binary_protocol_collection_end (int index, int generation) MONO_INTERNAL;
void binary_protocol_alloc (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
@@ -202,6 +208,7 @@ void binary_protocol_dislink_update (gpointer link, gpointer obj, int track) MON
#define binary_protocol_is_enabled() FALSE
#define binary_protocol_flush_buffers(force)
+#define binary_protocol_collection_force(generation)
#define binary_protocol_collection_begin(index, generation)
#define binary_protocol_collection_end(index, generation)
#define binary_protocol_alloc(obj, vtable, size)
diff --git a/tools/sgen/sgen-grep-binprot.c b/tools/sgen/sgen-grep-binprot.c
index 9a3cbe89286..9978815b73a 100644
--- a/tools/sgen/sgen-grep-binprot.c
+++ b/tools/sgen/sgen-grep-binprot.c
@@ -19,6 +19,7 @@ read_entry (FILE *in, void **data)
if (fread (&type, 1, 1, in) != 1)
return SGEN_PROTOCOL_EOF;
switch (type) {
+ case SGEN_PROTOCOL_COLLECTION_FORCE: size = sizeof (SGenProtocolCollectionForce); break;
case SGEN_PROTOCOL_COLLECTION_BEGIN: size = sizeof (SGenProtocolCollection); break;
case SGEN_PROTOCOL_COLLECTION_END: size = sizeof (SGenProtocolCollection); break;
case SGEN_PROTOCOL_ALLOC: size = sizeof (SGenProtocolAlloc); break;
@@ -61,6 +62,11 @@ static void
print_entry (int type, void *data)
{
switch (type) {
+ case SGEN_PROTOCOL_COLLECTION_FORCE: {
+ SGenProtocolCollectionForce *entry = data;
+ printf ("collection force generation %d\n", entry->generation);
+ break;
+ }
case SGEN_PROTOCOL_COLLECTION_BEGIN: {
SGenProtocolCollection *entry = data;
printf ("collection begin %d generation %d\n", entry->index, entry->generation);
@@ -201,6 +207,7 @@ static gboolean
is_match (gpointer ptr, int type, void *data)
{
switch (type) {
+ case SGEN_PROTOCOL_COLLECTION_FORCE:
case SGEN_PROTOCOL_COLLECTION_BEGIN:
case SGEN_PROTOCOL_COLLECTION_END:
case SGEN_PROTOCOL_THREAD_SUSPEND: