* src/native/vm/gnu_java_lang_management_VMClassLoadingMXBeanImpl.c:
[cacao.git] / src / native / jni.h
1 /* native/jni.h - JNI types and data structures
2
3    Copyright (C) 1996-2005, 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    Contact: cacao@cacaojvm.org
26
27    Authors: Reinhard Grafl
28             Roman Obermaisser
29
30    Changes: Christian Thalinger
31
32    $Id: jni.h 5193 2006-07-31 14:35:41Z twisti $
33
34 */
35
36
37 #ifndef _JNI_H
38 #define _JNI_H
39
40 #include "config.h"
41 #include "vm/types.h"
42
43 #include "vm/global.h"
44 #include "vm/method.h"
45
46
47 /* Include the JNI header from GNU Classpath **********************************/
48
49 #include CLASSPATH_JNI_H
50
51
52 /* _Jv_JNIEnv *****************************************************************/
53
54 typedef struct _Jv_JNIEnv _Jv_JNIEnv;
55
56 struct _Jv_JNIEnv {
57         const struct JNINativeInterface *env;     /* This MUST be the first entry */
58 };
59
60
61 /* _Jv_JavaVM *****************************************************************/
62
63 typedef struct _Jv_JavaVM _Jv_JavaVM;
64
65 struct _Jv_JavaVM {
66         const struct JNIInvokeInterface *functions;/* This MUST be the first entry*/
67
68         /* JVM instance-specific variables */
69
70         s8 starttime;                       /* VM startup time                    */
71
72         s4 Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_verbose;
73         s4 Java_gnu_java_lang_management_VMMemoryMXBeanImpl_verbose;
74         s4 Java_java_lang_VMClassLoader_defaultAssertionStatus;
75 };
76
77
78 /* CACAO related stuff ********************************************************/
79
80 extern const struct JNIInvokeInterface _Jv_JNIInvokeInterface;
81 extern struct JNINativeInterface _Jv_JNINativeInterface;
82
83
84 /* local reference table ******************************************************/
85
86 #define LOCALREFTABLE_CAPACITY    16
87
88 typedef struct localref_table localref_table;
89
90 /* localref_table **************************************************************
91
92    ATTENTION: keep this structure a multiple of 8-bytes!!! This is
93    essential for the native stub on 64-bit architectures.
94
95 *******************************************************************************/
96
97 struct localref_table {
98         s4                 capacity;        /* table size                         */
99         s4                 used;            /* currently used references          */
100         s4                 localframes;     /* number of current frames           */
101         s4                 PADDING;         /* 8-byte padding                     */
102         localref_table    *prev;            /* link to prev table (LocalFrame)    */
103         java_objectheader *refs[LOCALREFTABLE_CAPACITY]; /* references            */
104 };
105
106 #if defined(ENABLE_THREADS)
107 #define LOCALREFTABLE    (THREADOBJECT->_localref_table)
108 #else
109 extern localref_table *_no_threads_localref_table;
110
111 #define LOCALREFTABLE    (_no_threads_localref_table)
112 #endif
113
114
115 /* hashtable_global_ref_entry *************************************************/
116
117 typedef struct hashtable_global_ref_entry hashtable_global_ref_entry;
118
119 struct hashtable_global_ref_entry {
120         java_objectheader          *o;      /* object pointer of global ref       */
121         s4                          refs;   /* references of the current pointer  */
122         hashtable_global_ref_entry *hashlink; /* link for external chaining       */
123 };
124
125
126 /* function prototypes ********************************************************/
127
128 /* initialize JNI subsystem */
129 bool jni_init(void);
130
131 java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
132                                                                                 java_objectarray *params);
133
134 #endif /* _JNI_H */
135
136
137 /*
138  * These are local overrides for various environment variables in Emacs.
139  * Please do not remove this and leave it at the end of the file, where
140  * Emacs will automagically detect them.
141  * ---------------------------------------------------------------------
142  * Local variables:
143  * mode: c
144  * indent-tabs-mode: t
145  * c-basic-offset: 4
146  * tab-width: 4
147  * End:
148  */