First set of licensing changes
[mono.git] / mono / sgen / sgen-simple-nursery.c
1 /*
2  * sgen-simple-nursery.c: Simple always promote nursery.
3  *
4  * Copyright 2001-2003 Ximian, Inc
5  * Copyright 2003-2010 Novell, Inc.
6  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
7  * Copyright (C) 2012 Xamarin Inc
8  *
9  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
10  */
11
12 #include "config.h"
13 #ifdef HAVE_SGEN_GC
14
15 #include <string.h>
16
17 #include "mono/sgen/sgen-gc.h"
18 #include "mono/sgen/sgen-protocol.h"
19 #include "mono/sgen/sgen-layout-stats.h"
20 #include "mono/sgen/sgen-client.h"
21
22 static inline GCObject*
23 alloc_for_promotion (GCVTable vtable, GCObject *obj, size_t objsize, gboolean has_references)
24 {
25         return major_collector.alloc_object (vtable, objsize, has_references);
26 }
27
28 static SgenFragment*
29 build_fragments_get_exclude_head (void)
30 {
31         return NULL;
32 }
33
34 static void
35 build_fragments_release_exclude_head (void)
36 {
37 }
38
39 static void
40 build_fragments_finish (SgenFragmentAllocator *allocator)
41 {
42 }
43
44 static void
45 prepare_to_space (char *to_space_bitmap, size_t space_bitmap_size)
46 {
47 }
48
49 static void
50 clear_fragments (void)
51 {       
52 }
53
54 static void
55 init_nursery (SgenFragmentAllocator *allocator, char *start, char *end)
56 {
57         sgen_fragment_allocator_add (allocator, start, end);
58 }
59
60
61 /******************************************Copy/Scan functins ************************************************/
62
63 #define SGEN_SIMPLE_NURSERY
64
65 #define SERIAL_COPY_OBJECT simple_nursery_serial_copy_object
66 #define SERIAL_COPY_OBJECT_FROM_OBJ simple_nursery_serial_copy_object_from_obj
67
68 #include "sgen-minor-copy-object.h"
69 #include "sgen-minor-scan-object.h"
70
71 void
72 sgen_simple_nursery_init (SgenMinorCollector *collector)
73 {
74         collector->is_split = FALSE;
75
76         collector->alloc_for_promotion = alloc_for_promotion;
77
78         collector->prepare_to_space = prepare_to_space;
79         collector->clear_fragments = clear_fragments;
80         collector->build_fragments_get_exclude_head = build_fragments_get_exclude_head;
81         collector->build_fragments_release_exclude_head = build_fragments_release_exclude_head;
82         collector->build_fragments_finish = build_fragments_finish;
83         collector->init_nursery = init_nursery;
84
85         FILL_MINOR_COLLECTOR_COPY_OBJECT (collector);
86         FILL_MINOR_COLLECTOR_SCAN_OBJECT (collector);
87 }
88
89
90 #endif