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>2010-05-29 03:38:28 +0400
committerMark Probst <mark.probst@gmail.com>2010-05-29 03:38:28 +0400
commit13b7dece4be75db0079dd8712d32d265745d81af (patch)
tree51fc2cdd3912be7d411e06773a17d1e614c65c09
parent609b1e5c454976241a8a4c58352cb023d33943db (diff)
2010-05-29 Mark Probst <mark.probst@gmail.com>
* sgen-gc.c: Always use DESC_TYPE_RUN_LENGTH for objects without references so that we don't have to do the cache-cold fetch of the class in copy_object_no_checks(). svn path=/trunk/mono/; revision=158137
-rw-r--r--mono/metadata/ChangeLog6
-rw-r--r--mono/metadata/sgen-gc.c11
2 files changed, 16 insertions, 1 deletions
diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog
index 2008db857ed..73b8cdc3c27 100644
--- a/mono/metadata/ChangeLog
+++ b/mono/metadata/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-29 Mark Probst <mark.probst@gmail.com>
+
+ * sgen-gc.c: Always use DESC_TYPE_RUN_LENGTH for objects without
+ references so that we don't have to do the cache-cold fetch of the
+ class in copy_object_no_checks().
+
2010-05-29 Robert Jordan <robertj@gmx.net>
* marshal.c (mono_marshal_asany): marshal LPWSTRs using
diff --git a/mono/metadata/sgen-gc.c b/mono/metadata/sgen-gc.c
index bcde5c4c70b..9718c176057 100644
--- a/mono/metadata/sgen-gc.c
+++ b/mono/metadata/sgen-gc.c
@@ -1101,6 +1101,12 @@ enum {
* We don't use 0 so that 0 isn't a valid GC descriptor. No
* deep reason for this other than to be able to identify a
* non-inited descriptor for debugging.
+ *
+ * If an object contains no references, its GC descriptor is
+ * always DESC_TYPE_RUN_LENGTH, without a size, no exceptions.
+ * This is so that we can quickly check for that in
+ * copy_object_no_checks(), without having to fetch the
+ * object's class.
*/
DESC_TYPE_RUN_LENGTH = 1, /* 15 bits aligned byte size | 1-3 (offset, numptr) bytes tuples */
DESC_TYPE_SMALL_BITMAP, /* 15 bits aligned byte size | 16-48 bit bitmap */
@@ -1281,6 +1287,9 @@ mono_gc_make_descr_for_array (int vector, gsize *elem_bitmap, int numbits, size_
num_set++;
}
}
+ /* See comment at the definition of DESC_TYPE_RUN_LENGTH. */
+ if (first_set < 0)
+ return DESC_TYPE_RUN_LENGTH;
if (elem_size <= MAX_ELEMENT_SIZE) {
desc |= elem_size << VECTOR_ELSIZE_SHIFT;
if (!num_set) {
@@ -2091,7 +2100,7 @@ copy_object_no_checks (void *obj)
mword objsize;
char *destination;
MonoVTable *vt = ((MonoObject*)obj)->vtable;
- gboolean has_references = vt->klass->has_references;
+ gboolean has_references = vt->gc_descr != DESC_TYPE_RUN_LENGTH;
objsize = safe_object_get_size ((MonoObject*)obj);
objsize += ALLOC_ALIGN - 1;