* Copyright 2011-2012 Xamarin Inc (http://www.xamarin.com)
* Copyright (C) 2012 Xamarin Inc
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License 2.0 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License 2.0 along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include "config.h"
int age;
age = get_object_age (obj);
- if (age >= promote_age)
+ if (age >= promote_age) {
+ total_promoted_size += objsize;
return major_collector.alloc_object (vtable, objsize, has_references);
+ }
/* Promote! */
++age;
age_alloc_buffers [age].next += objsize;
} else {
p = alloc_for_promotion_slow_path (age, objsize);
- if (!p)
+ if (!p) {
+ total_promoted_size += objsize;
return major_collector.alloc_object (vtable, objsize, has_references);
+ }
}
/* FIXME: assumes object layout */
/******************************************Copy/Scan functins ************************************************/
+#define collector_pin_object(obj, queue) sgen_pin_object (obj, queue);
+#define COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION alloc_for_promotion
+
+#include "sgen-copy-object.h"
+
#define SGEN_SPLIT_NURSERY
-#define SERIAL_COPY_OBJECT split_nursery_serial_copy_object
-#define SERIAL_COPY_OBJECT_FROM_OBJ split_nursery_serial_copy_object_from_obj
+#include "sgen-minor-copy-object.h"
+#include "sgen-minor-scan-object.h"
+
+static void
+fill_serial_ops (SgenObjectOperations *ops)
+{
+ ops->copy_or_mark_object = SERIAL_COPY_OBJECT;
+ FILL_MINOR_COLLECTOR_SCAN_OBJECT (ops);
+}
+
+#define SGEN_CONCURRENT_MAJOR
#include "sgen-minor-copy-object.h"
#include "sgen-minor-scan-object.h"
+static void
+fill_serial_with_concurrent_major_ops (SgenObjectOperations *ops)
+{
+ ops->copy_or_mark_object = SERIAL_COPY_OBJECT;
+ FILL_MINOR_COLLECTOR_SCAN_OBJECT (ops);
+}
+
void
sgen_split_nursery_init (SgenMinorCollector *collector)
{
collector->handle_gc_param = handle_gc_param;
collector->print_gc_param_usage = print_gc_param_usage;
- FILL_MINOR_COLLECTOR_COPY_OBJECT (collector);
- FILL_MINOR_COLLECTOR_SCAN_OBJECT (collector);
+ fill_serial_ops (&collector->serial_ops);
+ fill_serial_with_concurrent_major_ops (&collector->serial_ops_with_concurrent_major);
}