* Removed all Id tags.
[cacao.git] / src / threads / native / threads.h
index e829a52c94f984f154ded93cd1696b3de8f53049..417b273d1849ff2236f6a5fe6b4dc10d7cfc5d9c 100644 (file)
@@ -22,8 +22,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: threads.h 7669 2007-04-05 11:39:58Z twisti $
-
 */
 
 
@@ -32,9 +30,7 @@
 
 /* forward typedefs ***********************************************************/
 
-typedef struct threadobject          threadobject;
-typedef union  threads_table_entry_t threads_table_entry_t;
-typedef struct threads_table_t       threads_table_t;
+typedef struct threadobject threadobject;
 
 
 #include "config.h"
@@ -46,6 +42,7 @@ typedef struct threads_table_t       threads_table_t;
 
 #include "mm/memory.h"
 #include "native/jni.h"
+#include "native/localref.h"
 #include "native/include/java_lang_Thread.h"
 
 #include "threads/native/lock.h"
@@ -92,32 +89,6 @@ extern pthread_key_t threads_current_threadobject_key;
 #endif /* defined(HAVE___THREAD) */
 
 
-/* threads_table_entry_t *******************************************************
-
-   An entry in the global threads table.
-
-*******************************************************************************/
-
-union threads_table_entry_t {
-       threadobject       *thread;        /* an existing thread                  */
-       ptrint              nextfree;      /* next free index                     */
-};
-
-
-/* threads_table_t *************************************************************
-
-   Struct for the global threads table.
-
-*******************************************************************************/
-
-struct threads_table_t {
-       threads_table_entry_t *table;      /* the table, threads[0] is the head   */
-                                          /* of the free list. Real entries      */
-                                                                          /* start at threads[1].                */
-       s4                     size;       /* current size of the table           */
-};
-
-
 /* threadobject ****************************************************************
 
    Struct holding thread local variables.
@@ -132,11 +103,6 @@ struct threads_table_t {
 struct threadobject {
        java_lang_Thread     *object;       /* link to java.lang.Thread object    */
 
-       lock_execution_env_t  ee;           /* data for the lock implementation   */
-
-       threadobject         *next;         /* next thread in list, or self       */
-       threadobject         *prev;         /* prev thread in list, or self       */
-
        ptrint                thinlock;     /* pre-computed thin lock value       */
 
        s4                    index;        /* thread index, starting with 1      */
@@ -149,9 +115,6 @@ struct threadobject {
        mach_port_t           mach_thread;       /* Darwin thread id              */
 #endif
 
-       pthread_mutex_t       joinmutex;
-       pthread_cond_t        joincond;
-
        /* these are used for the wait/notify implementation                      */
        pthread_mutex_t       waitmutex;
        pthread_cond_t        waitcond;
@@ -162,7 +125,7 @@ struct threadobject {
 
        u1                   *pc;           /* current PC (used for profiling)    */
 
-       java_objectheader    *_exceptionptr;     /* current exception             */
+       java_object_t        *_exceptionptr;     /* current exception             */
        stackframeinfo       *_stackframeinfo;   /* current native stackframeinfo */
        localref_table       *_localref_table;   /* JNI local references          */
 
@@ -171,6 +134,17 @@ struct threadobject {
 #endif
 
        dumpinfo_t            dumpinfo;     /* dump memory info structure         */
+
+#if defined(ENABLE_DEBUG_FILTER)
+       u2                    filterverbosecallctr[2]; /* counters for verbose call filter */
+#endif
+
+#if !defined(NDEBUG)
+       s4                    tracejavacallindent;
+       u4                    tracejavacallcount;
+#endif
+
+       listnode_t            linkage;      /* threads-list                       */
 };
 
 
@@ -183,11 +157,18 @@ struct threadobject {
 
 #define STACKFRAMEINFO    (THREADOBJECT->_stackframeinfo)
 
+/* counter for verbose call filter ********************************************/
 
-/* variables ******************************************************************/
+#if defined(ENABLE_DEBUG_FILTER)
+#      define FILTERVERBOSECALLCTR (THREADOBJECT->filterverbosecallctr)
+#endif
 
-extern threadobject *mainthreadobj;
+/* state for trace java call **************************************************/
 
+#if !defined(NDEBUG)
+#      define TRACEJAVACALLINDENT (THREADOBJECT->tracejavacallindent)
+#      define TRACEJAVACALLCOUNT (THREADOBJECT->tracejavacallcount)
+#endif
 
 /* functions ******************************************************************/
 
@@ -197,10 +178,8 @@ void threads_sem_post(sem_t *sem);
 
 threadobject *threads_get_current_threadobject(void);
 
-void threads_preinit(void);
 bool threads_init(void);
 
-void threads_start_javathread(java_lang_Thread *object);
 void threads_start_thread(threadobject *thread, functionptr function);
 
 void threads_set_thread_priority(pthread_t tid, int priority);
@@ -211,7 +190,6 @@ bool threads_detach_thread(threadobject *thread);
 void threads_join_all_threads(void);
 
 void threads_sleep(s8 millis, s4 nanos);
-void threads_yield(void);
 
 bool threads_wait_with_timeout_relative(threadobject *t, s8 millis, s4 nanos);