* src/mm/cacao-gc/rootset.h [!ENABLE_THREADS]: Added missing include.
[cacao.git] / src / mm / cacao-gc / rootset.h
1 /* mm/cacao-gc/rootset.h - GC header for root set management
2
3    Copyright (C) 2006 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25    $Id$
26
27 */
28
29
30 #ifndef _ROOTSET_H
31 #define _ROOTSET_H
32
33 typedef struct rootset_t rootset_t;
34
35 #include "config.h"
36 #include "vm/types.h"
37
38 #if defined(ENABLE_THREADS)
39 # include "threads/native/threads.h"
40 #else
41 # include "threads/none/threads.h"
42 #endif
43
44 #include "vm/jit/replace.h"
45 #include "vmcore/method.h"
46
47
48 /* Structures *****************************************************************/
49
50 #define ROOTSET_DUMMY_THREAD ((threadobject *) (ptrint) -1)
51 #define RS_REFS 512 /* TODO: you see why we need to rethink this!!! */
52
53 #define REFTYPE_THREADOBJECT 1
54 #define REFTYPE_CLASSLOADER  2
55 #define REFTYPE_GLOBALREF    3
56 #define REFTYPE_FINALIZER    4
57 #define REFTYPE_LOCALREF     5
58 #define REFTYPE_STACK        6
59 #define REFTYPE_CLASSREF     7
60
61 /* rootset is passed as array of pointers, which point to the location of
62    the reference */
63
64 struct rootset_t {
65         rootset_t          *next;           /* link to the next chain element */
66         threadobject       *thread;         /* thread this rootset belongs to */
67         sourcestate_t      *ss;             /* sourcestate of the thread */
68         executionstate_t   *es;             /* executionstate of the thread */
69         s4                  refcount;       /* number of references */
70         java_objectheader **refs[RS_REFS];  /* list of references */
71         bool                ref_marks[RS_REFS]; /* indicates if a reference marks */
72 #if !defined(NDEBUG)
73         s4                  ref_type[RS_REFS];
74 #endif
75 };
76
77
78 /* Prototypes *****************************************************************/
79
80 /*
81 rootset_t *rootset_create(void);
82 void rootset_from_globals(rootset_t *rs);
83 void rootset_from_thread(threadobject *thread, rootset_t *rs);
84 */
85 rootset_t *rootset_readout();
86 void rootset_writeback(rootset_t *rs);
87
88 #if !defined(NDEBUG)
89 void rootset_print(rootset_t *rs);
90 #endif
91
92
93 #endif /* _ROOTSET_H */
94
95 /*
96  * These are local overrides for various environment variables in Emacs.
97  * Please do not remove this and leave it at the end of the file, where
98  * Emacs will automagically detect them.
99  * ---------------------------------------------------------------------
100  * Local variables:
101  * mode: c
102  * indent-tabs-mode: t
103  * c-basic-offset: 4
104  * tab-width: 4
105  * End:
106  * vim:noexpandtab:sw=4:ts=4:
107  */