aacd8504168294852b528cc8fa47fc9cfcfa01b6
[cacao.git] / src / native / jni.h
1 /* src/native/jni.h - JNI types and data structures
2
3    Copyright (C) 1996-2005, 2006, 2007, 2008
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 /* jni.h ***********************************************************************
27
28    ATTENTION: We include this file before we actually define our own
29    jni.h.  We do this because otherwise we can get into unresolvable
30    circular header dependencies.
31
32    This is OK as GNU Classpath defines:
33
34    #define __CLASSPATH_JNI_MD_H__
35    #define _CLASSPATH_JNI_H
36
37    and OpenJDK defines:
38
39    #define _JAVASOFT_JNI_MD_H_
40    #define _JAVASOFT_JNI_H_
41
42    CLASSPATH_JNI_MD_H and CLASSPATH_JNI_H are defined in config.h.
43
44 *******************************************************************************/
45
46 #include "config.h"
47
48 /* We include both headers with the absolute path so we can be sure
49    that the preprocessor does not take another header.  Furthermore we
50    include jni_md.h before jni.h as the latter includes the former. */
51
52 #include INCLUDE_JNI_MD_H
53 #include INCLUDE_JNI_H
54
55 #ifndef _JNI_H
56 #define _JNI_H
57
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61
62 #include "vm/types.h"
63
64 #include "vm/global.h"
65 #include "vm/method.h"
66
67
68 #if 0
69 /* _Jv_JNIEnv *****************************************************************/
70
71 #ifndef __cplusplus
72
73 // FIXME The __cplusplus define is just a quick workaround and needs
74 // to be fixed properly.
75
76 typedef struct _Jv_JNIEnv _Jv_JNIEnv;
77
78 struct _Jv_JNIEnv {
79         const struct JNINativeInterface_ *env;    /* This MUST be the first entry */
80 };
81
82 #endif
83
84
85 /* _Jv_JavaVM *****************************************************************/
86
87 #ifndef __cplusplus
88
89 // FIXME The __cplusplus define is just a quick workaround and needs
90 // to be fixed properly.
91
92 typedef struct _Jv_JavaVM _Jv_JavaVM;
93
94 struct _Jv_JavaVM {
95         const struct JNIInvokeInterface_ *functions;/*This MUST be the first entry*/
96
97         /* JVM instance-specific variables */
98
99         s8 starttime;                       /* VM startup time                    */
100
101         s4 Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_verbose;
102         s4 Java_gnu_java_lang_management_VMMemoryMXBeanImpl_verbose;
103         s4 java_lang_management_ThreadMXBean_PeakThreadCount;
104         s4 java_lang_management_ThreadMXBean_ThreadCount;
105         s8 java_lang_management_ThreadMXBean_TotalStartedThreadCount;
106 };
107
108 #endif
109 #endif
110
111
112 /* CACAO related stuff ********************************************************/
113
114 extern const struct JNIInvokeInterface_ _Jv_JNIInvokeInterface;
115 extern struct JNINativeInterface_ _Jv_JNINativeInterface;
116
117
118 /* hashtable_global_ref_entry *************************************************/
119
120 typedef struct hashtable_global_ref_entry hashtable_global_ref_entry;
121
122 struct hashtable_global_ref_entry {
123         java_object_t              *o;      /* object pointer of global ref       */
124         s4                          refs;   /* references of the current pointer  */
125         hashtable_global_ref_entry *hashlink; /* link for external chaining       */
126 };
127
128
129 /* function prototypes ********************************************************/
130
131 bool jni_init(void);
132 bool jni_version_check(int version);
133
134 #ifdef __cplusplus
135 }
136 #endif
137
138 #endif /* _JNI_H */
139
140
141 /*
142  * These are local overrides for various environment variables in Emacs.
143  * Please do not remove this and leave it at the end of the file, where
144  * Emacs will automagically detect them.
145  * ---------------------------------------------------------------------
146  * Local variables:
147  * mode: c
148  * indent-tabs-mode: t
149  * c-basic-offset: 4
150  * tab-width: 4
151  * End:
152  */