* src/vmcore/linker.c (build_display): Removed superfluous recursion; return
[cacao.git] / src / native / localref.h
1 /* src/native/localref.h - Management of local reference tables
2
3    Copyright (C) 1996-2005, 2006, 2007 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 */
26
27
28 #ifndef _LOCALREF_H
29 #define _LOCALREF_H
30
31 /* forward typedefs ***********************************************************/
32
33 typedef struct localref_table localref_table;
34
35 #include "config.h"
36 #include "vm/types.h"
37
38 #include "vm/global.h"
39
40 #include "vmcore/method.h"
41
42
43 /* localref_table **************************************************************
44
45    ATTENTION: keep this structure a multiple of 8-bytes!!! This is
46    essential for the native stub on 64-bit architectures.
47
48 *******************************************************************************/
49
50 #define LOCALREFTABLE_CAPACITY    16
51
52 struct localref_table {
53         s4                 capacity;        /* table size                         */
54         s4                 used;            /* currently used references          */
55         s4                 localframes;     /* number of current frames           */
56         s4                 PADDING;         /* 8-byte padding                     */
57         localref_table    *prev;            /* link to prev table (LocalFrame)    */
58         java_object_t     *refs[LOCALREFTABLE_CAPACITY]; /* references            */
59 };
60
61
62 #if defined(ENABLE_THREADS)
63 #define LOCALREFTABLE    (THREADOBJECT->_localref_table)
64 #else
65 extern localref_table *_no_threads_localref_table;
66
67 #define LOCALREFTABLE    (_no_threads_localref_table)
68 #endif
69
70
71 /* function prototypes ********************************************************/
72
73 bool localref_table_init(void);
74 bool localref_table_destroy(void);
75 void localref_table_add(localref_table *lrt);
76 void localref_table_remove();
77
78 bool localref_frame_push(int32_t capacity);
79 void localref_frame_pop_all(void);
80
81 java_handle_t *localref_add(java_object_t *o);
82 void           localref_del(java_handle_t *localref);
83
84 void localref_native_enter(methodinfo *m, uint64_t *argument_regs, uint64_t *argument_stack);
85 void localref_native_exit(methodinfo *m, uint64_t *return_regs);
86
87 #if !defined(NDEBUG)
88 void localref_dump(void);
89 #endif
90
91
92 #endif /* _LOCALREF_H */
93
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  */