e61315f555a6fae6bdd8955515b270bcd31c65fa
[cacao.git] / src / mm / cacao-gc / rootset.h
1 /* src/mm/cacao-gc/rootset.h - GC header for root set management
2
3    Copyright (C) 2006, 2008
4    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5
6    This file is part of CACAO.
7
8    This program is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2, or (at
11    your option) any later version.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23 */
24
25
26 #ifndef _ROOTSET_H
27 #define _ROOTSET_H
28
29 typedef struct rootset_t rootset_t;
30
31 #include "config.h"
32 #include "vm/types.h"
33
34 #include "threads/thread.h"
35
36 #include "vm/jit/replace.h"
37 #include "vmcore/method.h"
38
39
40 /* Structures *****************************************************************/
41
42 #define ROOTSET_DUMMY_THREAD ((threadobject *) (ptrint) -1)
43
44 #define ROOTSET_INITIAL_CAPACITY 16
45
46 /* rootset is passed as array of pointers, which point to the location of
47    the reference */
48
49 typedef struct rootset_entry_t {
50         java_object_t     **ref;            /* a pointer to the actual reference */
51         bool                marks;          /* indicates if a reference marks */
52 #if !defined(NDEBUG)
53         s4                  reftype;
54 #endif
55 } rootset_entry_t;
56
57
58 struct rootset_t {
59         rootset_t          *next;           /* link to the next chain element */
60         threadobject       *thread;         /* thread this rootset belongs to */
61         s4                  capacity;       /* the current capacity of this rs */
62         s4                  refcount;       /* number of references */
63         rootset_entry_t     refs[ROOTSET_INITIAL_CAPACITY]; /* list of references */
64 };
65
66
67 /* Prototypes *****************************************************************/
68
69 /*
70 rootset_t *rootset_create(void);
71 void rootset_from_globals(rootset_t *rs);
72 void rootset_from_thread(threadobject *thread, rootset_t *rs);
73 */
74 rootset_t *rootset_readout();
75 void rootset_writeback(rootset_t *rs);
76
77 #if !defined(NDEBUG)
78 void rootset_print(rootset_t *rs);
79 #endif
80
81
82 #endif /* _ROOTSET_H */
83
84 /*
85  * These are local overrides for various environment variables in Emacs.
86  * Please do not remove this and leave it at the end of the file, where
87  * Emacs will automagically detect them.
88  * ---------------------------------------------------------------------
89  * Local variables:
90  * mode: c
91  * indent-tabs-mode: t
92  * c-basic-offset: 4
93  * tab-width: 4
94  * End:
95  * vim:noexpandtab:sw=4:ts=4:
96  */