X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fsgen%2Fsgen-copy-object.h;h=bb97e4a681689a2000318aeed0de938f8d8bfff6;hb=919a03d17d36604f05e1d99c3f9f26a1509e9655;hp=8faebc836df639657a28625e7435c0d723fcfbc5;hpb=6dd609be32144c149f4b51b4f5eea79a4c3e0b44;p=mono.git diff --git a/mono/sgen/sgen-copy-object.h b/mono/sgen/sgen-copy-object.h index 8faebc836df..bb97e4a6816 100644 --- a/mono/sgen/sgen-copy-object.h +++ b/mono/sgen/sgen-copy-object.h @@ -1,5 +1,6 @@ -/* - * sgen-copy-object.h: This is where objects are copied. +/** + * \file + * This is where objects are copied. * * Copyright 2001-2003 Ximian, Inc * Copyright 2003-2010 Novell, Inc. @@ -83,7 +84,7 @@ copy_object_no_checks (GCObject *obj, SgenGrayQueue *queue) if (has_references) { SGEN_LOG (9, "Enqueuing gray object %p (%s)", destination, sgen_client_vtable_get_name (vt)); - GRAY_OBJECT_ENQUEUE (queue, (GCObject *)destination, sgen_vtable_get_descriptor (vt)); + GRAY_OBJECT_ENQUEUE_SERIAL (queue, (GCObject *)destination, sgen_vtable_get_descriptor (vt)); } return (GCObject *)destination; @@ -107,7 +108,7 @@ copy_object_no_checks_par (GCObject *obj, SgenGrayQueue *queue) */ gboolean has_references = SGEN_VTABLE_HAS_REFERENCES (vt); mword objsize = SGEN_ALIGN_UP (sgen_client_par_object_get_size (vt, obj)); - destination = major_collector.alloc_object_par (vt, objsize, has_references); + destination = COLLECTOR_PARALLEL_ALLOC_FOR_PROMOTION (vt, obj, objsize, has_references); par_copy_object_no_checks ((char*)destination, vt, obj, objsize); @@ -120,9 +121,15 @@ copy_object_no_checks_par (GCObject *obj, SgenGrayQueue *queue) /* In a racing case, only the worker that allocated the object enqueues it */ if (has_references) { SGEN_LOG (9, "Enqueuing gray object %p (%s)", destination, sgen_client_vtable_get_name (vt)); - GRAY_OBJECT_ENQUEUE (queue, (GCObject *)destination, sgen_vtable_get_descriptor (vt)); + GRAY_OBJECT_ENQUEUE_PARALLEL (queue, (GCObject *)destination, sgen_vtable_get_descriptor (vt)); } } else { + /* + * Unlikely case. Clear the allocated object so it doesn't confuse nursery + * card table scanning, since it can contain old invalid refs. + * FIXME make sure it is not a problem if another threads scans it while we clear + */ + mono_gc_bzero_aligned (destination, objsize); destination = final_destination; } } @@ -132,5 +139,6 @@ copy_object_no_checks_par (GCObject *obj, SgenGrayQueue *queue) #endif #undef COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION +#undef COLLECTOR_PARALLEL_ALLOC_FOR_PROMOTION #undef collector_pin_object #undef COPY_OR_MARK_PARALLEL