1 /* src/native/localref.hpp - Management of local reference tables
3 Copyright (C) 1996-2005, 2006, 2007, 2008, 2010
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
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.
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.
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
29 /* forward typedefs ***********************************************************/
31 typedef struct localref_table localref_table;
37 #include "vm/global.h"
38 #include "vm/method.hpp"
41 /* localref_table **************************************************************
43 ATTENTION: keep this structure a multiple of 8-bytes!!! This is
44 essential for the native stub on 64-bit architectures.
46 *******************************************************************************/
48 #define LOCALREFTABLE_CAPACITY 16
50 struct localref_table {
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) */
61 } refs[LOCALREFTABLE_CAPACITY]; /* references */
65 #if defined(ENABLE_THREADS)
66 #define LOCALREFTABLE (THREADOBJECT->_localref_table)
68 extern localref_table *_no_threads_localref_table;
70 #define LOCALREFTABLE (_no_threads_localref_table)
74 /* function prototypes ********************************************************/
80 bool localref_table_init(void);
81 bool localref_table_destroy(void);
82 void localref_table_add(localref_table *lrt);
83 void localref_table_remove();
85 bool localref_frame_push(int32_t capacity);
86 void localref_frame_pop_all(void);
88 java_handle_t *localref_add(java_object_t *o);
89 void localref_del(java_handle_t *localref);
91 void localref_native_enter(methodinfo *m, uint64_t *argument_regs, uint64_t *argument_stack);
92 void localref_native_exit(methodinfo *m, uint64_t *return_regs);
95 void localref_dump(void);
102 #endif // _LOCALREF_HPP
106 * These are local overrides for various environment variables in Emacs.
107 * Please do not remove this and leave it at the end of the file, where
108 * Emacs will automagically detect them.
109 * ---------------------------------------------------------------------
112 * indent-tabs-mode: t
116 * vim:noexpandtab:sw=4:ts=4: