CACAO
localref.hpp
Go to the documentation of this file.
1 /* src/native/localref.hpp - Management of local reference tables
2 
3  Copyright (C) 1996-2005, 2006, 2007, 2008, 2010
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 _LOCALREF_HPP
27 #define _LOCALREF_HPP
28 
29 /* forward typedefs ***********************************************************/
30 
32 
33 #include "config.h"
34 
35 #include "vm/types.hpp"
36 
37 #include "vm/global.hpp"
38 
39 struct methodinfo;
40 
41 /* localref_table **************************************************************
42 
43  ATTENTION: keep this structure a multiple of 8-bytes!!! This is
44  essential for the native stub on 64-bit architectures.
45 
46 *******************************************************************************/
47 
48 #define LOCALREFTABLE_CAPACITY 16
49 
51  s4 capacity; /* table size */
52  s4 used; /* currently used references */
53  s4 firstfree; /* head of the free list */
54  s4 hwm; /* high water mark */
55  s4 localframes; /* number of current frames */
56  s4 PADDING; /* 8-byte padding */
57  localref_table *prev; /* link to prev table (LocalFrame) */
58  union {
61  } refs[LOCALREFTABLE_CAPACITY]; /* references */
62 };
63 
64 /* function prototypes ********************************************************/
65 
66 bool localref_table_init(void);
67 bool localref_table_destroy(void);
70 
71 bool localref_frame_push(int32_t capacity);
72 void localref_frame_pop_all(void);
73 
75 void localref_del(java_handle_t *localref);
76 
77 void localref_native_enter(methodinfo *m, uint64_t *argument_regs, uint64_t *argument_stack);
78 void localref_native_exit(methodinfo *m, uint64_t *return_regs);
79 
80 #if !defined(NDEBUG)
81 void localref_dump(void);
82 #endif
83 
84 #endif // _LOCALREF_HPP
85 
86 
87 /*
88  * These are local overrides for various environment variables in Emacs.
89  * Please do not remove this and leave it at the end of the file, where
90  * Emacs will automagically detect them.
91  * ---------------------------------------------------------------------
92  * Local variables:
93  * mode: c++
94  * indent-tabs-mode: t
95  * c-basic-offset: 4
96  * tab-width: 4
97  * End:
98  * vim:noexpandtab:sw=4:ts=4:
99  */
bool localref_table_init(void)
Definition: localref.cpp:81
void localref_del(java_handle_t *localref)
Definition: localref.cpp:383
void localref_native_exit(methodinfo *m, uint64_t *return_regs)
void localref_table_remove()
Definition: localref.cpp:168
void localref_native_enter(methodinfo *m, uint64_t *argument_regs, uint64_t *argument_stack)
Definition: localref.cpp:439
java_object_t * ptr
Definition: localref.hpp:59
bool localref_frame_push(int32_t capacity)
Definition: localref.cpp:199
java_handle_t * localref_add(java_object_t *o)
Definition: localref.cpp:318
bool localref_table_destroy(void)
Definition: localref.cpp:114
void localref_frame_pop_all(void)
Definition: localref.cpp:254
int32_t s4
Definition: types.hpp:45
void localref_dump()
Definition: localref.cpp:545
#define LOCALREFTABLE_CAPACITY
Definition: localref.hpp:48
void localref_table_add(localref_table *lrt)
Definition: localref.cpp:142
union localref_table::@1 refs[LOCALREFTABLE_CAPACITY]
localref_table * prev
Definition: localref.hpp:57