/* src/native/jni.h - JNI types and data structures
- Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
- C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
- E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
- J. Wenninger, Institut f. Computersprachen - TU Wien
+ Copyright (C) 1996-2005, 2006, 2007, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jni.h 8132 2007-06-22 11:15:47Z twisti $
-
*/
-/* GNU Classpath jni.h *********************************************************
+/* jni.h ***********************************************************************
ATTENTION: We include this file before we actually define our own
- jni.h. We do this because, otherwise we can get into unresolvable
+ jni.h. We do this because otherwise we can get into unresolvable
circular header dependencies.
This is OK as GNU Classpath defines:
+ #define __CLASSPATH_JNI_MD_H__
#define _CLASSPATH_JNI_H
- CLASSPATH_JNI_H is in config.h defined.
+ and OpenJDK defines:
+
+ #define _JAVASOFT_JNI_MD_H_
+ #define _JAVASOFT_JNI_H_
+
+ CLASSPATH_JNI_MD_H and CLASSPATH_JNI_H are defined in config.h.
*******************************************************************************/
#include "config.h"
-/* XXX quick hack to not include GCJ's jni_md.h */
-#define __GCJ_JNI_MD_H__
+/* We include both headers with the absolute path so we can be sure
+ that the preprocessor does not take another header. Furthermore we
+ include jni_md.h before jni.h as the latter includes the former. */
-#include CLASSPATH_JNI_MD_H
-#include CLASSPATH_JNI_H
+#include INCLUDE_JNI_MD_H
+#include INCLUDE_JNI_H
#ifndef _JNI_H
#define _JNI_H
-/* forward typedefs ***********************************************************/
-
-typedef struct localref_table localref_table;
-
+#ifdef __cplusplus
+extern "C" {
+#endif
#include "vm/types.h"
#include "vm/global.h"
-
-#include "vmcore/method.h"
+#include "vm/method.h"
+#if 0
/* _Jv_JNIEnv *****************************************************************/
+#ifndef __cplusplus
+
+// FIXME The __cplusplus define is just a quick workaround and needs
+// to be fixed properly.
+
typedef struct _Jv_JNIEnv _Jv_JNIEnv;
struct _Jv_JNIEnv {
const struct JNINativeInterface_ *env; /* This MUST be the first entry */
};
+#endif
+
/* _Jv_JavaVM *****************************************************************/
+#ifndef __cplusplus
+
+// FIXME The __cplusplus define is just a quick workaround and needs
+// to be fixed properly.
+
typedef struct _Jv_JavaVM _Jv_JavaVM;
struct _Jv_JavaVM {
s4 java_lang_management_ThreadMXBean_PeakThreadCount;
s4 java_lang_management_ThreadMXBean_ThreadCount;
s8 java_lang_management_ThreadMXBean_TotalStartedThreadCount;
- s4 Java_java_lang_VMClassLoader_defaultAssertionStatus;
};
+#endif
+#endif
+
/* CACAO related stuff ********************************************************/
extern struct JNINativeInterface_ _Jv_JNINativeInterface;
-/* local reference table ******************************************************/
-
-#define LOCALREFTABLE_CAPACITY 16
-
-/* localref_table **************************************************************
-
- ATTENTION: keep this structure a multiple of 8-bytes!!! This is
- essential for the native stub on 64-bit architectures.
-
-*******************************************************************************/
-
-struct localref_table {
- s4 capacity; /* table size */
- s4 used; /* currently used references */
- s4 localframes; /* number of current frames */
- s4 PADDING; /* 8-byte padding */
- localref_table *prev; /* link to prev table (LocalFrame) */
- java_objectheader *refs[LOCALREFTABLE_CAPACITY]; /* references */
-};
-
-#if defined(ENABLE_THREADS)
-#define LOCALREFTABLE (THREADOBJECT->_localref_table)
-#else
-extern localref_table *_no_threads_localref_table;
-
-#define LOCALREFTABLE (_no_threads_localref_table)
-#endif
-
-
/* hashtable_global_ref_entry *************************************************/
typedef struct hashtable_global_ref_entry hashtable_global_ref_entry;
struct hashtable_global_ref_entry {
- java_objectheader *o; /* object pointer of global ref */
+ java_object_t *o; /* object pointer of global ref */
s4 refs; /* references of the current pointer */
hashtable_global_ref_entry *hashlink; /* link for external chaining */
};
/* function prototypes ********************************************************/
-/* initialize JNI subsystem */
bool jni_init(void);
-bool jni_init_localref_table(void);
+bool jni_version_check(int version);
-java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
- java_objectarray *params);
+#ifdef __cplusplus
+}
+#endif
#endif /* _JNI_H */