* src/native/localref.c: Added new file.
[cacao.git] / src / native / jni.h
index 8ab484cb8b371cb9fc1745732aeee4908a3a1df1..e295b00f14509a6b344ce669ddf3a831d4344d72 100644 (file)
@@ -1,6 +1,6 @@
-/* native/jni.h - JNI types and data structures
+/* src/native/jni.h - JNI types and data structures
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   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
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
+   $Id: jni.h 8297 2007-08-12 00:02:48Z michi $
 
-   Authors: Reinhard Grafl
-            Roman Obermaisser
+*/
 
-   Changes: Christian Thalinger
 
-   $Id: jni.h 4565 2006-03-07 09:40:37Z twisti $
+/* GNU Classpath 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
+   circular header dependencies.
+
+   This is OK as GNU Classpath defines:
+
+   #define _CLASSPATH_JNI_H
+
+   CLASSPATH_JNI_H is in config.h defined.
+
+*******************************************************************************/
+
+#include "config.h"
 
+/* XXX quick hack to not include GCJ's jni_md.h */
+#define __GCJ_JNI_MD_H__
+
+#include CLASSPATH_JNI_MD_H
+#include CLASSPATH_JNI_H
 
 #ifndef _JNI_H
 #define _JNI_H
 
-#include "config.h"
+
 #include "vm/types.h"
 
 #include "vm/global.h"
-#include "vm/method.h"
-
-
-/* Include the JNI header from GNU Classpath **********************************/
 
-#include CLASSPATH_JNI_H
+#include "vmcore/method.h"
 
 
 /* _Jv_JNIEnv *****************************************************************/
@@ -54,7 +65,7 @@
 typedef struct _Jv_JNIEnv _Jv_JNIEnv;
 
 struct _Jv_JNIEnv {
-       const struct JNINativeInterface *env;     /* This MUST be the first entry */
+       const struct JNINativeInterface_ *env;    /* This MUST be the first entry */
 };
 
 
@@ -63,56 +74,46 @@ struct _Jv_JNIEnv {
 typedef struct _Jv_JavaVM _Jv_JavaVM;
 
 struct _Jv_JavaVM {
-       const struct JNIInvokeInterface *functions;/* This MUST be the first entry*/
-};
-
+       const struct JNIInvokeInterface_ *functions;/*This MUST be the first entry*/
 
-/* CACAO related stuff ********************************************************/
+       /* JVM instance-specific variables */
 
-extern const struct JNIInvokeInterface _Jv_JNIInvokeInterface;
-extern struct JNINativeInterface _Jv_JNINativeInterface;
+       s8 starttime;                       /* VM startup time                    */
 
+       s4 Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_verbose;
+       s4 Java_gnu_java_lang_management_VMMemoryMXBeanImpl_verbose;
+       s4 java_lang_management_ThreadMXBean_PeakThreadCount;
+       s4 java_lang_management_ThreadMXBean_ThreadCount;
+       s8 java_lang_management_ThreadMXBean_TotalStartedThreadCount;
+       s4 Java_java_lang_VMClassLoader_defaultAssertionStatus;
+};
 
-/* local reference table ******************************************************/
 
-#define LOCALREFTABLE_CAPACITY    16
+/* CACAO related stuff ********************************************************/
 
-typedef struct localref_table localref_table;
+extern const struct JNIInvokeInterface_ _Jv_JNIInvokeInterface;
+extern struct JNINativeInterface_ _Jv_JNINativeInterface;
 
-/* localref_table **************************************************************
 
-   ATTENTION: keep this structure a multiple of 8-bytes!!! This is
-   essential for the native stub on 64-bit architectures.
+/* hashtable_global_ref_entry *************************************************/
 
-*******************************************************************************/
+typedef struct hashtable_global_ref_entry hashtable_global_ref_entry;
 
-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            */
+struct hashtable_global_ref_entry {
+       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       */
 };
 
-#if defined(USE_THREADS)
-#define LOCALREFTABLE    (THREADINFO->_localref_table)
-#else
-extern localref_table *_no_threads_localref_table;
-
-#define LOCALREFTABLE    (_no_threads_localref_table)
-#endif
 
+/* function prototypes ********************************************************/
 
 /* initialize JNI subsystem */
 bool jni_init(void);
 
-java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
+java_handle_t *_Jv_jni_invokeNative(methodinfo *m, java_handle_t *o,
                                                                                java_objectarray *params);
 
-extern void* ptr_env;
-extern struct JNINativeInterface JNI_JNIEnvTable;
-
 #endif /* _JNI_H */