*/
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);
#endif
#undef COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION
+#undef COLLECTOR_PARALLEL_ALLOC_FOR_PROMOTION
#undef collector_pin_object
#undef COPY_OR_MARK_PARALLEL
gboolean is_parallel;
GCObject* (*alloc_for_promotion) (GCVTable vtable, GCObject *obj, size_t objsize, gboolean has_references);
+ GCObject* (*alloc_for_promotion_par) (GCVTable vtable, GCObject *obj, size_t objsize, gboolean has_references);
SgenObjectOperations serial_ops;
SgenObjectOperations serial_ops_with_concurrent_major;
return major_collector.alloc_object (vtable, objsize, has_references);
}
+static inline GCObject*
+alloc_for_promotion_par (GCVTable vtable, GCObject *obj, size_t objsize, gboolean has_references)
+{
+ /*
+ * FIXME
+ * Note that the stat is not precise. total_promoted_size incrementing is not atomic and
+ * even in that case, the same object might be promoted simultaneously by different workers
+ * leading to one of the allocated major object to be discarded.
+ */
+ total_promoted_size += objsize;
+ return major_collector.alloc_object_par (vtable, objsize, has_references);
+}
+
static SgenFragment*
build_fragments_get_exclude_head (void)
{
#define collector_pin_object(obj, queue) sgen_pin_object (obj, queue);
#define COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION alloc_for_promotion
+#define COLLECTOR_PARALLEL_ALLOC_FOR_PROMOTION alloc_for_promotion_par
#define COPY_OR_MARK_PARALLEL
#include "sgen-copy-object.h"
collector->is_parallel = parallel;
collector->alloc_for_promotion = alloc_for_promotion;
+ collector->alloc_for_promotion_par = alloc_for_promotion_par;
collector->prepare_to_space = prepare_to_space;
collector->clear_fragments = clear_fragments;