Made green threads work again.
authortwisti <none@none>
Fri, 3 Dec 2004 16:23:39 +0000 (16:23 +0000)
committertwisti <none@none>
Fri, 3 Dec 2004 16:23:39 +0000 (16:23 +0000)
src/threads/green/locks.c
src/threads/green/locks.h
src/threads/green/threadio.c
src/threads/green/threads.c
src/threads/green/threads.h

index 98979f5757dc8a2452bc1f1b9270d9145f37f43d..bc4ab446dd77117c6b0dd8d7cbaf516b221b209e 100644 (file)
  * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
  */
 
-#include "config.h"
 
 #include <assert.h>
 #include <stdio.h>
 
-#include "thread.h"
-#include "locks.h"
-#include "builtin.h"
-#include "exceptions.h"
-
-#include "tables.h"
-#include "native.h"
-#include "loader.h"
-#include "toolbox/memory.h"
-
+#include "config.h"
+#include "mm/memory.h"
+#include "native/native.h"
+#include "threads/green/threads.h"
+#include "threads/green/locks.h"
+#include "vm/builtin.h"
+#include "vm/exceptions.h"
+#include "vm/loader.h"
+#include "vm/tables.h"
 
-#if !defined(NATIVE_THREADS)
 
 extern thread* currentThread;
 
@@ -566,4 +563,16 @@ internal_broadcast_cond (iCv* cv)
     }
 }
 
-#endif
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index ceb8eb5565a9f20ef68820a173bbbeb7a83f5610..2d6146439aa5a1a61e0b1e257f8b9ec3a79c3602 100644 (file)
@@ -14,9 +14,8 @@
 #ifndef __locks_h
 #define __locks_h
 
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
+#include "vm/global.h"
 
-#include "global.h"
 
 #define        WAITFOREVER     -1
 
@@ -131,6 +130,18 @@ void internal_lock_mutex_for_object (java_objectheader *obj);
 void internal_unlock_mutex_for_object (java_objectheader *obj);
 void internal_broadcast_cond_for_object (java_objectheader *obj);
 
-#endif /* USE_THREADS */
-
 #endif /* __locks_h */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 6b911a6db25aa388ee75db2f335a10ec184da020..529580aa1e59de3b4f9299dd53cec5d16f4d19ac 100644 (file)
@@ -22,9 +22,8 @@
 #include <string.h>
 
 #include "config.h"
-#include "threads/thread.h"
+#include "threads/green/threads.h"
 
-#if !defined(NATIVE_THREADS)
 
 #define        TH_READ         0
 #define        TH_WRITE        1
@@ -478,4 +477,16 @@ checkEvents(bool block)
     }
 }
 
-#endif
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index b52cf4853a7986c94245c44200ee42520308e066..37c933aacc13d729c103cbd520ab8ee074971b50 100644 (file)
  * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
  */
 
-#include "global.h"
-
-#if !defined(NATIVE_THREADS)
-
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 
 #include "config.h"
-#include "exceptions.h"
-#include "thread.h"
-#include "locks.h"
-#include "tables.h"
-#include "native.h"
-#include "loader.h"
-#include "builtin.h"
-#include "asmpart.h"
-#include "options.h"
-#include "toolbox/logging.h"
-#include "toolbox/memory.h"
+#include "mm/memory.h"
+#include "native/native.h"
+#include "threads/green/locks.h"
+#include "threads/green/threads.h"
 #include "toolbox/avl.h"
+#include "toolbox/logging.h"
+#include "vm/builtin.h"
+#include "vm/exceptions.h"
+#include "vm/global.h"
+#include "vm/loader.h"
+#include "vm/options.h"
+#include "vm/tables.h"
+#include "vm/jit/asmpart.h"
+
 
 static classinfo *class_java_lang_ThreadDeath;
 
@@ -96,7 +94,7 @@ java_objectheader *init_vmthread(void *thr)
                                                  utf_new_char("(Ljava/lang/Thread;)V"));
 
         if (!m) {                                       /* initializer not found  */
-                if (verbose) {
+                if (opt_verbose) {
                         char logtext[MAXLOGTEXT];
                         sprintf(logtext, "Warning: class has no instance-initializer: ");
                         utf_sprint_classname(logtext + strlen(logtext), c->name);
@@ -898,5 +896,16 @@ void cacao_suspendhandler(void *ctx)
 {
 }
 
-#endif
 
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 0d05af8914f2eac09835371de0ab297d1fb863a7..d9c0b941913be4473ac0d84c009fb2f7c1771c33 100644 (file)
  * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
  */
 
-#ifndef _THREAD_H
-#define _THREAD_H
-
-#include "config.h"
 
+#ifndef _THREADS_H
+#define _THREADS_H
 
-#ifdef USE_THREADS
+#include "config.h"
+#include "mm/memory.h"
+#include "vm/global.h"                                 /* for native includes */
+#include "native/include/java_lang_ClassLoader.h"
+#include "native/include/java_lang_String.h"
+#include "native/include/java_lang_Throwable.h"
 
-#include "global.h"
 
 #define        THREADCLASS         "java/lang/Thread"
 #define        THREADGROUPCLASS    "java/lang/ThreadGroup"
@@ -39,7 +41,6 @@
 #define THREAD_FLAGS_USER_SUSPEND       2  /* Flag explicit suspend() call */
 #define        THREAD_FLAGS_KILLED             4
 
-#if !defined(NATIVE_THREADS)
 
 #define MAXTHREADS              256          /* schani */
 
@@ -90,59 +91,49 @@ typedef struct _threadGroup {
 } threadGroup;
 
 
-
-/* This structure mirrors java.lang.VMThread.h */
-typedef struct vmthread {
-   java_objectheader header;
-   struct _thread* thread;
-   s4 running;
-   s4 status;
-   s4 priority;
-   void* restorePoint;
-   void* stackMem;
-   void* stackBase;
-   void* stackEnd;
-   void* usedStackTop;
-   s8 time;
-   java_objectheader *texceptionptr;
-   struct _thread* nextlive;
-   struct _thread* next;
-   s4 flags;
-} vmthread;
+typedef struct thread thread;
+typedef struct vmthread vmthread;
 
 /* This structure mirrors java.lang.Thread.h */
-typedef struct _thread {
-   java_objectheader header;
-   vmthread* vmThread;
-   threadGroup* group;
+
+struct thread {
+   java_objectheader      header;
+   vmthread              *vmThread;
+   threadGroup           *group;
    struct java_lang_Runnable* runnable;
-   struct java_lang_String* name;
-   s4 daemon;
-   s4 priority;
-   s8 stacksize;
-   struct java_lang_Throwable* stillborn;
-   struct java_lang_ClassLoader* contextClassLoader;
-} thread;
+   java_lang_String      *name;
+   s4                     daemon;
+   s4                     priority;
+   s8                     stacksize;
+   java_lang_Throwable   *stillborn;
+   java_lang_ClassLoader *contextClassLoader;
+};
 
-void initThreads (u1 *stackbottom);
-void clear_thread_flags (void);
-void startThread (thread*);
-void resumeThread (thread*);
-void iresumeThread (thread*);
-void suspendThread (thread*);
-void suspendOnQThread (thread*, thread**);
-void yieldThread (void);
-void killThread (thread*);
-void setPriorityThread (thread*, int);
 
-s8 currentTime (void);
-void sleepThread(s8 millis, s4 nanos);
-bool aliveThread (thread*);
-long framesThread (thread*);
+/* This structure mirrors java.lang.VMThread.h */
 
-void reschedule (void);
+struct vmthread {
+       java_objectheader  header;
+       thread            *thread;
+       s4                 running;
+       s4                 status;
+       s4                 priority;
+       void              *restorePoint;
+       void              *stackMem;
+       void              *stackBase;
+       void              *stackEnd;
+       void              *usedStackTop;
+       s8                 time;
+       java_objectheader *texceptionptr;
+       struct _thread    *nextlive;
+       struct _thread    *next;
+       s4                 flags;
+
+#if 0
+       dumpinfo          *dumpinfo;        /* dump memory info structure         */
+#endif
+};
 
-void checkEvents (bool block);
 
 extern int blockInts;
 extern bool needReschedule;
@@ -195,20 +186,40 @@ extern thread *threadQhead[MAX_THREAD_PRIO + 1];
     } while(0)
 
 
-/* function prototypes */
-void asm_perform_threadswitch(u1 **from, u1 **to, u1 **stackTop);
-u1*  asm_initialize_thread_stack(void *func, u1 *stack);
+/* function prototypes ********************************************************/
 
-#else /* NATIVE_THREADS */
-#include "nativethread.h"
-#endif
+void initThreads (u1 *stackbottom);
+void clear_thread_flags (void);
+void startThread (thread*);
+void resumeThread (thread*);
+void iresumeThread (thread*);
+void suspendThread (thread*);
+void suspendOnQThread (thread*, thread**);
+void yieldThread (void);
+void killThread (thread*);
+void setPriorityThread (thread*, int);
 
-#else
+s8 currentTime (void);
+void sleepThread(s8 millis, s4 nanos);
+bool aliveThread (thread*);
+long framesThread (thread*);
+
+void reschedule (void);
 
-#define intsDisable()
-#define intsRestore()
+void checkEvents (bool block);
 
-#endif /* USE_THREADS */
+#endif /* _THREADS_H */
 
-#endif /* _THREAD_H */
 
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */