Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[sgen] Binary protocol entry for card scanning.

  • Loading branch information...
commit 6d4aac5358a522745ea56e862288033a0762b006 1 parent 0438680
@schani schani authored
View
9 mono/metadata/sgen-cardtable.c
@@ -29,6 +29,7 @@
#include "metadata/sgen-gc.h"
#include "metadata/sgen-cardtable.h"
#include "metadata/sgen-memory-governor.h"
+#include "metadata/sgen-protocol.h"
#include "utils/mono-counters.h"
#include "utils/mono-time.h"
#include "utils/mono-memory-model.h"
@@ -537,7 +538,7 @@ sgen_cardtable_scan_object (char *obj, mword block_obj_size, guint8 *cards, Sgen
int idx = (card_data - card_base) + extra_idx;
char *start = (char*)(obj_start + idx * CARD_SIZE_IN_BYTES);
char *card_end = start + CARD_SIZE_IN_BYTES;
- char *elem;
+ char *first_elem, *elem;
HEAVY_STAT (++los_marked_cards);
@@ -551,7 +552,7 @@ sgen_cardtable_scan_object (char *obj, mword block_obj_size, guint8 *cards, Sgen
else
index = ARRAY_OBJ_INDEX (start, obj, elem_size);
- elem = (char*)mono_array_addr_with_size ((MonoArray*)obj, elem_size, index);
+ elem = first_elem = (char*)mono_array_addr_with_size ((MonoArray*)obj, elem_size, index);
if (klass->element_class->valuetype) {
ScanVTypeFunc scan_vtype_func = sgen_get_current_object_ops ()->scan_vtype;
@@ -572,6 +573,8 @@ sgen_cardtable_scan_object (char *obj, mword block_obj_size, guint8 *cards, Sgen
}
}
}
+
+ binary_protocol_card_scan (first_elem, elem - first_elem);
}
#ifdef SGEN_HAVE_OVERLAPPING_CARDS
@@ -592,6 +595,8 @@ sgen_cardtable_scan_object (char *obj, mword block_obj_size, guint8 *cards, Sgen
} else if (sgen_card_table_region_begin_scanning ((mword)obj, block_obj_size)) {
sgen_get_current_object_ops ()->scan_object (obj, queue);
}
+
+ binary_protocol_card_scan (obj, sgen_safe_object_get_size ((MonoObject*)obj));
}
}
View
25 mono/metadata/sgen-los.c
@@ -496,23 +496,28 @@ mono_sgen_los_describe_pointer (char *ptr)
for (obj = los_object_list; obj; obj = obj->next) {
MonoVTable *vtable;
const char *los_kind;
+ mword size;
+ gboolean pinned;
+
if (obj->data > ptr || obj->data + obj->size <= ptr)
continue;
- if (obj->size > LOS_SECTION_OBJECT_LIMIT)
- los_kind = "huge-los-ptr ";
+ size = sgen_los_object_size (obj);
+ pinned = sgen_los_object_is_pinned (obj->data);
+
+ if (size > LOS_SECTION_OBJECT_LIMIT)
+ los_kind = "huge-los-ptr";
else
- los_kind = "los-ptr ";
+ los_kind = "los-ptr";
vtable = (MonoVTable*)SGEN_LOAD_VTABLE (obj->data);
- if (obj->data == ptr)
- SGEN_LOG (1, "%s (object %s.%s size %d)",
- los_kind, vtable->klass->name_space, vtable->klass->name, (int)obj->size);
- else
- SGEN_LOG (1, "%s (interior-ptr offset %td of %p (%s.%s) size %d)",
- los_kind, ptr - obj->data, obj->data,
- vtable->klass->name_space, vtable->klass->name, (int)obj->size);
+ if (obj->data == ptr) {
+ SGEN_LOG (0, "%s (size %td pin %d)\n", los_kind, size, pinned ? 1 : 0);
+ } else {
+ SGEN_LOG (0, "%s (interior-ptr offset %td size %td pin %d)",
+ los_kind, ptr - obj->data, size, pinned ? 1 : 0);
+ }
return TRUE;
}
View
28 mono/metadata/sgen-marksweep.c
@@ -932,33 +932,38 @@ major_describe_pointer (char *ptr)
char *obj;
gboolean live;
MonoVTable *vtable;
+ int w, b;
+ gboolean marked;
if ((block->block > ptr) || ((block->block + MS_BLOCK_SIZE) <= ptr))
continue;
- SGEN_LOG (1, "major-ptr (block %p sz %d pin %d ref %d) ",
+ SGEN_LOG (0, "major-ptr (block %p sz %d pin %d ref %d)\n",
block->block, block->obj_size, block->pinned, block->has_references);
idx = MS_BLOCK_OBJ_INDEX (ptr, block);
obj = (char*)MS_BLOCK_OBJ (block, idx);
live = MS_OBJ_ALLOCED (obj, block);
vtable = live ? (MonoVTable*)SGEN_LOAD_VTABLE (obj) : NULL;
-
+
+ MS_CALC_MARK_BIT (w, b, obj);
+ marked = MS_MARK_BIT (block, w, b);
+
if (obj == ptr) {
+ SGEN_LOG (0, "\t(");
if (live)
- SGEN_LOG (1, "\t(object %s.%s)", vtable->klass->name_space, vtable->klass->name);
+ SGEN_LOG (0, "object");
else
- SGEN_LOG (1, "(dead-object)");
+ SGEN_LOG (0, "dead-object");
} else {
if (live)
- SGEN_LOG (1, "(interior-ptr offset %td of %p %s.%s)",
- ptr - obj,
- obj, vtable->klass->name_space, vtable->klass->name);
+ SGEN_LOG (0, "interior-ptr offset %td", ptr - obj);
else
- SGEN_LOG (1, "(dead-interior-ptr to %td to %p)",
- ptr - obj, obj);
+ SGEN_LOG (0, "dead-interior-ptr offset %td", ptr - obj);
}
+ SGEN_LOG (0, " marked %d)\n", marked ? 1 : 0);
+
return TRUE;
} END_FOREACH_BLOCK;
@@ -2095,7 +2100,7 @@ major_scan_card_table (gboolean mod_union, SgenGrayQueue *queue)
int idx = card_data - card_base;
char *start = (char*)(block_start + idx * CARD_SIZE_IN_BYTES);
char *end = start + CARD_SIZE_IN_BYTES;
- char *obj;
+ char *first_obj, *obj;
HEAVY_STAT (++scanned_cards);
@@ -2114,7 +2119,7 @@ major_scan_card_table (gboolean mod_union, SgenGrayQueue *queue)
else
index = MS_BLOCK_OBJ_INDEX_FAST (start, block_start, block_obj_size);
- obj = (char*)MS_BLOCK_OBJ_FAST (block_start, block_obj_size, index);
+ obj = first_obj = (char*)MS_BLOCK_OBJ_FAST (block_start, block_obj_size, index);
while (obj < end) {
if (!MS_OBJ_ALLOCED_FAST (obj, block_start))
goto next_small;
@@ -2133,6 +2138,7 @@ major_scan_card_table (gboolean mod_union, SgenGrayQueue *queue)
obj += block_obj_size;
}
HEAVY_STAT (if (*card_data) ++remarked_cards);
+ binary_protocol_card_scan (first_obj, obj - first_obj);
}
}
} END_FOREACH_BLOCK;
View
7 mono/metadata/sgen-protocol.c
@@ -281,6 +281,13 @@ binary_protocol_missing_remset (gpointer obj, gpointer obj_vtable, int offset, g
}
+void
+binary_protocol_card_scan (gpointer start, int size)
+{
+ SGenProtocolCardScan entry = { start, size };
+ protocol_entry (SGEN_PROTOCOL_CARD_SCAN, &entry, sizeof (SGenProtocolCardScan));
+}
+
#endif
#endif /* HAVE_SGEN_GC */
View
10 mono/metadata/sgen-protocol.h
@@ -42,7 +42,8 @@ enum {
SGEN_PROTOCOL_THREAD_UNREGISTER,
SGEN_PROTOCOL_MISSING_REMSET,
SGEN_PROTOCOL_ALLOC_PINNED,
- SGEN_PROTOCOL_ALLOC_DEGRADED
+ SGEN_PROTOCOL_ALLOC_DEGRADED,
+ SGEN_PROTOCOL_CARD_SCAN
};
typedef struct {
@@ -130,6 +131,11 @@ typedef struct {
int value_pinned;
} SGenProtocolMissingRemset;
+typedef struct {
+ gpointer start;
+ int size;
+} SGenProtocolCardScan;
+
/* missing: finalizers, dislinks, roots, non-store wbarriers */
void binary_protocol_init (const char *filename) MONO_INTERNAL;
@@ -156,6 +162,7 @@ void binary_protocol_thread_register (gpointer thread) MONO_INTERNAL;
void binary_protocol_thread_unregister (gpointer thread) MONO_INTERNAL;
void binary_protocol_missing_remset (gpointer obj, gpointer obj_vtable, int offset,
gpointer value, gpointer value_vtable, int value_pinned) MONO_INTERNAL;
+void binary_protocol_card_scan (gpointer start, int size) MONO_INTERNAL;
#else
@@ -180,5 +187,6 @@ void binary_protocol_missing_remset (gpointer obj, gpointer obj_vtable, int offs
#define binary_protocol_thread_register(thread)
#define binary_protocol_thread_unregister(thread)
#define binary_protocol_missing_remset(obj, obj_vtable, offset, value, value_vtable, value_pinned)
+#define binary_protocol_card_scan(start, size)
#endif
View
10 tools/sgen/sgen-grep-binprot.c
@@ -37,6 +37,7 @@ read_entry (FILE *in, void **data)
case SGEN_PROTOCOL_THREAD_REGISTER: size = sizeof (SGenProtocolThreadRegister); break;
case SGEN_PROTOCOL_THREAD_UNREGISTER: size = sizeof (SGenProtocolThreadUnregister); break;
case SGEN_PROTOCOL_MISSING_REMSET: size = sizeof (SGenProtocolMissingRemset); break;
+ case SGEN_PROTOCOL_CARD_SCAN: size = sizeof (SGenProtocolCardScan); break;
default: assert (0);
}
@@ -143,6 +144,11 @@ print_entry (int type, void *data)
entry->obj, entry->obj_vtable, entry->offset, entry->value, entry->value_vtable, entry->value_pinned);
break;
}
+ case SGEN_PROTOCOL_CARD_SCAN: {
+ SGenProtocolCardScan *entry = data;
+ printf ("card_scan start %p size %d\n", entry->start, entry->size);
+ break;
+ }
default:
assert (0);
}
@@ -209,6 +215,10 @@ is_match (gpointer ptr, int type, void *data)
SGenProtocolMissingRemset *entry = data;
return ptr == entry->obj || ptr == entry->value || ptr == (char*)entry->obj + entry->offset;
}
+ case SGEN_PROTOCOL_CARD_SCAN: {
+ SGenProtocolCardScan *entry = data;
+ return matches_interval (ptr, entry->start, entry->size);
+ }
default:
assert (0);
}
Please sign in to comment.
Something went wrong with that request. Please try again.