3 * Simple always promote nursery.
5 * Copyright 2001-2003 Ximian, Inc
6 * Copyright 2003-2010 Novell, Inc.
7 * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
8 * Copyright (C) 2012 Xamarin Inc
10 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
18 #include "mono/sgen/sgen-gc.h"
19 #include "mono/sgen/sgen-protocol.h"
20 #include "mono/sgen/sgen-layout-stats.h"
21 #include "mono/sgen/sgen-client.h"
22 #include "mono/utils/mono-memory-model.h"
24 static inline GCObject*
25 alloc_for_promotion (GCVTable vtable, GCObject *obj, size_t objsize, gboolean has_references)
27 total_promoted_size += objsize;
28 return major_collector.alloc_object (vtable, objsize, has_references);
32 build_fragments_get_exclude_head (void)
38 build_fragments_release_exclude_head (void)
43 build_fragments_finish (SgenFragmentAllocator *allocator)
48 prepare_to_space (char *to_space_bitmap, size_t space_bitmap_size)
53 clear_fragments (void)
58 init_nursery (SgenFragmentAllocator *allocator, char *start, char *end)
60 sgen_fragment_allocator_add (allocator, start, end);
64 /******************************************Copy/Scan functins ************************************************/
66 #define collector_pin_object(obj, queue) sgen_pin_object (obj, queue);
67 #define COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION alloc_for_promotion
69 #define COPY_OR_MARK_PARALLEL
70 #include "sgen-copy-object.h"
72 #define SGEN_SIMPLE_NURSERY
74 #include "sgen-minor-copy-object.h"
75 #include "sgen-minor-scan-object.h"
78 fill_serial_ops (SgenObjectOperations *ops)
80 ops->copy_or_mark_object = SERIAL_COPY_OBJECT;
81 FILL_MINOR_COLLECTOR_SCAN_OBJECT (ops);
84 #define SGEN_SIMPLE_PAR_NURSERY
86 #include "sgen-minor-copy-object.h"
87 #include "sgen-minor-scan-object.h"
90 fill_parallel_ops (SgenObjectOperations *ops)
92 ops->copy_or_mark_object = SERIAL_COPY_OBJECT;
93 FILL_MINOR_COLLECTOR_SCAN_OBJECT (ops);
96 #undef SGEN_SIMPLE_PAR_NURSERY
97 #define SGEN_CONCURRENT_MAJOR
99 #include "sgen-minor-copy-object.h"
100 #include "sgen-minor-scan-object.h"
103 fill_serial_with_concurrent_major_ops (SgenObjectOperations *ops)
105 ops->copy_or_mark_object = SERIAL_COPY_OBJECT;
106 FILL_MINOR_COLLECTOR_SCAN_OBJECT (ops);
110 sgen_simple_nursery_init (SgenMinorCollector *collector, gboolean parallel)
112 collector->is_split = FALSE;
113 collector->is_parallel = parallel;
115 collector->alloc_for_promotion = alloc_for_promotion;
117 collector->prepare_to_space = prepare_to_space;
118 collector->clear_fragments = clear_fragments;
119 collector->build_fragments_get_exclude_head = build_fragments_get_exclude_head;
120 collector->build_fragments_release_exclude_head = build_fragments_release_exclude_head;
121 collector->build_fragments_finish = build_fragments_finish;
122 collector->init_nursery = init_nursery;
124 fill_serial_ops (&collector->serial_ops);
125 fill_serial_with_concurrent_major_ops (&collector->serial_ops_with_concurrent_major);
126 fill_parallel_ops (&collector->parallel_ops);