* src/vm/hashtable.h,
authortwisti <none@none>
Mon, 15 May 2006 14:24:36 +0000 (14:24 +0000)
committertwisti <none@none>
Mon, 15 May 2006 14:24:36 +0000 (14:24 +0000)
src/vm/class.c,,
src/vm/suck.c,
src/vm/loader.c,
src/vm/builtin.c,
src/vm/string.c,
src/vm/suck.h,
src/vm/builtin.h,
src/vm/loader.h,
src/vm/finalizer.c,
src/vm/classcache.c,
src/vm/initialize.c,
src/vm/jit/powerpc/linux/md-os.c,
src/vm/jit/powerpc/netbsd/md-os.c,
src/vm/jit/powerpc/darwin/md-os.c,
src/vm/jit/powerpc/darwin/md-asm.h,
src/vm/jit/powerpc/codegen.c,
src/vm/jit/powerpc/asmpart.S,
src/vm/jit/codegen-common.h,
src/vm/jit/alpha/codegen.c,
src/vm/jit/alpha/linux/md-os.c,
src/vm/jit/alpha/asmpart.S,
src/vm/jit/alpha/freebsd/md-os.c,
src/vm/jit/stack.c,
src/vm/jit/code.c,
src/vm/jit/verify/typecheck.c,
src/vm/jit/mips/codegen.c,
src/vm/jit/mips/linux/md-os.c,
src/vm/jit/mips/asmpart.S,
src/vm/jit/mips/irix/md-os.c,
src/vm/jit/patcher.h,
src/vm/jit/inline/inline.c,
src/vm/jit/allocator/simplereg.c,
src/vm/jit/i386/codegen.c,
src/vm/jit/i386/linux/md-os.c,
src/vm/jit/i386/asmpart.S,
src/vm/jit/i386/freebsd/md-os.c,
src/vm/jit/parse.c,
src/vm/jit/intrp/intrp.h,
src/vm/jit/intrp/codegen.c,
src/vm/jit/intrp/engine.c,
src/vm/jit/intrp/asmpart.c,
src/vm/jit/intrp/dynamic-super.c,
src/vm/jit/intrp/java.vmg,
src/vm/jit/asmpart.h,
src/vm/jit/x86_64/md.c,
src/vm/jit/x86_64/codegen.c,
src/vm/jit/x86_64/asmpart.S,
src/vm/jit/profile/profile.c,
src/vm/jit/stacktrace.c,
src/vm/jit/jit.c,
src/vm/jit/stacktrace.h,
src/vm/jit/codegen-common.c,
src/vm/jit/jit.h,
src/vm/global.h,
src/vm/builtintable.inc,
src/vm/signal.c,
src/vm/exceptions.c,
src/vm/vm.c,
src/vm/linker.c,
src/vm/exceptions.h,
src/vm/utf8.c,
src/vm/hashtable.c,
src/cacao/cacao.c,
src/cacao/Makefile.am,
src/native/tools/Makefile.am,
src/native/tools/gennativetable.c,
src/native/jni.c,
src/native/vm/VMObject.c,
src/native/vm/VMThread.c,
src/native/jni.h,
src/native/native.c,
src/native/jvmti/cacaodbg.c,
src/native/jvmti/cacaodbg.h,
src/native/jvmti/jvmti.c,
src/toolbox/avl.c,
src/toolbox/logging.c,
src/toolbox/avl.h,
src/mm/boehm.h,
src/mm/memory.c,
src/mm/boehm.c,
src/threads/green,
src/threads/native/threads.h,
src/threads/native/threads.c,
src/threads/Makefile.am,
src/cacaoh/cacaoh.c,
src/cacaoh/headers.h,
src/cacaoh/Makefile.am,
src/cacaoh/headers.c,
configure.ac: Green threads removal, USE_THREADS renamed to
ENABLE_THREADS, NATIVE_THREADS define removed.

97 files changed:
configure.ac
src/cacao/Makefile.am
src/cacao/cacao.c
src/cacaoh/Makefile.am
src/cacaoh/cacaoh.c
src/cacaoh/headers.c
src/cacaoh/headers.h
src/mm/boehm.c
src/mm/boehm.h
src/mm/memory.c
src/native/jni.c
src/native/jni.h
src/native/jvmti/cacaodbg.c
src/native/jvmti/cacaodbg.h
src/native/jvmti/jvmti.c
src/native/native.c
src/native/tools/Makefile.am
src/native/tools/gennativetable.c
src/native/vm/VMObject.c
src/native/vm/VMThread.c
src/threads/Makefile.am
src/threads/green/.cvsignore [deleted file]
src/threads/green/Makefile.am [deleted file]
src/threads/green/locks.c [deleted file]
src/threads/green/locks.h [deleted file]
src/threads/green/threadio.c [deleted file]
src/threads/green/threadio.h [deleted file]
src/threads/green/threads.c [deleted file]
src/threads/green/threads.h [deleted file]
src/threads/native/threads.c
src/threads/native/threads.h
src/toolbox/avl.c
src/toolbox/avl.h
src/toolbox/logging.c
src/vm/builtin.c
src/vm/builtin.h
src/vm/builtintable.inc
src/vm/class.c
src/vm/classcache.c
src/vm/exceptions.c
src/vm/exceptions.h
src/vm/finalizer.c
src/vm/global.h
src/vm/hashtable.c
src/vm/hashtable.h
src/vm/initialize.c
src/vm/jit/allocator/simplereg.c
src/vm/jit/alpha/asmpart.S
src/vm/jit/alpha/codegen.c
src/vm/jit/alpha/freebsd/md-os.c
src/vm/jit/alpha/linux/md-os.c
src/vm/jit/asmpart.h
src/vm/jit/code.c
src/vm/jit/codegen-common.c
src/vm/jit/codegen-common.h
src/vm/jit/i386/asmpart.S
src/vm/jit/i386/codegen.c
src/vm/jit/i386/freebsd/md-os.c
src/vm/jit/i386/linux/md-os.c
src/vm/jit/inline/inline.c
src/vm/jit/intrp/asmpart.c
src/vm/jit/intrp/codegen.c
src/vm/jit/intrp/dynamic-super.c
src/vm/jit/intrp/engine.c
src/vm/jit/intrp/intrp.h
src/vm/jit/intrp/java.vmg
src/vm/jit/jit.c
src/vm/jit/jit.h
src/vm/jit/mips/asmpart.S
src/vm/jit/mips/codegen.c
src/vm/jit/mips/irix/md-os.c
src/vm/jit/mips/linux/md-os.c
src/vm/jit/parse.c
src/vm/jit/patcher.h
src/vm/jit/powerpc/asmpart.S
src/vm/jit/powerpc/codegen.c
src/vm/jit/powerpc/darwin/md-asm.h
src/vm/jit/powerpc/darwin/md-os.c
src/vm/jit/powerpc/linux/md-os.c
src/vm/jit/powerpc/netbsd/md-os.c
src/vm/jit/profile/profile.c
src/vm/jit/stack.c
src/vm/jit/stacktrace.c
src/vm/jit/stacktrace.h
src/vm/jit/verify/typecheck.c
src/vm/jit/x86_64/asmpart.S
src/vm/jit/x86_64/codegen.c
src/vm/jit/x86_64/md.c
src/vm/linker.c
src/vm/loader.c
src/vm/loader.h
src/vm/signal.c
src/vm/string.c
src/vm/suck.c
src/vm/suck.h
src/vm/utf8.c
src/vm/vm.c

index 447c2d3c52e6d0117d72e6dea835c7f13b19e733..6d8aebfbf15f50951bdafe24979bb6745b39f339 100644 (file)
@@ -449,37 +449,26 @@ AC_MSG_CHECKING(whether to include threads support)
 enable_threads=${enable_threads:-native}
 case "$enable_threads" in
 no | none | single)
-       AC_MSG_RESULT(no)
-       dnl no threads for boehm
-       ac_configure_args="$ac_configure_args --disable-boehm-threads"
-       AM_CONDITIONAL([USE_THREADS], [false])
-       AM_CONDITIONAL([NATIVE_THREADS], [false])
-       ;;
-
-green | native | posix | pthreads)
-       AC_DEFINE([USE_THREADS], 1, [use threads])
-
-       AM_CONDITIONAL([USE_THREADS], [true])
-
-       if test x"$enable_threads" != "xgreen"; then
-               AC_MSG_RESULT(yes, native)
-                AC_CHECK_LIB(pthread, main)
-               AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
-
-               CFLAGS="$CFLAGS -D_REENTRANT"
-
-               dnl tell boehm to support threads as well
-               ac_configure_args="$ac_configure_args --enable-boehm-threads=posix"
-               AM_CONDITIONAL([NATIVE_THREADS], [true])
-
-       else
-               AC_MSG_RESULT(yes, green)
+    AC_MSG_RESULT(no)
+    dnl no threads for boehm
+    ac_configure_args="$ac_configure_args --disable-boehm-threads"
+    AM_CONDITIONAL([ENABLE_THREADS], [false])
+    ;;
 
-               dnl no threads for boehm
-               ac_configure_args="$ac_configure_args --disable-boehm-threads"
-               AM_CONDITIONAL([NATIVE_THREADS], [false])
-       fi
+native | posix | pthreads)
+    AC_DEFINE([ENABLE_THREADS], 1, [enable threads])
+    
+    AM_CONDITIONAL([ENABLE_THREADS], [true])
+    
+    AC_MSG_RESULT(yes, native)
+    AC_CHECK_LIB(pthread, main)
+    
+    CFLAGS="$CFLAGS -D_REENTRANT"
+    
+    dnl tell boehm to support threads as well
+    ac_configure_args="$ac_configure_args --enable-boehm-threads=posix"
     ;;
+
 *)
     AC_MSG_ERROR($enable_threads is an unknown thread package)
     ;;
index 0fb0fa78863e09c51f96c78645fcf48056289c11..445d73893b9577a06f162f994e0de2ae90cd79d0 100644 (file)
 ##
 ## Changes:
 ##
-## $Id: Makefile.am 4737 2006-04-05 12:56:43Z edwin $
+## $Id: Makefile.am 4921 2006-05-15 14:24:36Z twisti $
 
 ## Process this file with automake to produce Makefile.in
 
 AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR) -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR)/$(OS_DIR)
 
 if DISABLE_GC
-if NATIVE_THREADS
-GC_LIB = $(top_builddir)/src/boehm-gc/libgc.la
-else
 GC_LIB =
-endif
 else
 GC_LIB = $(top_builddir)/src/boehm-gc/libgc.la
 endif
 
-if USE_THREADS
-if NATIVE_THREADS
+if ENABLE_THREADS
 THREAD_LIB = $(top_builddir)/src/threads/native/libthreads.la
-else
-THREAD_LIB = $(top_builddir)/src/threads/green/libthreads.la
-endif
-else
-THREAD_LIB =
 endif
 
 if ENABLE_STATICVM
index 4c5fb2cc014ca32d64404b7de6cefe3f7195cac8..bf021ad1657660cf11a5ae653f1952a9d01d4ceb 100644 (file)
@@ -31,7 +31,7 @@
             Philipp Tomsich
             Christian Thalinger
 
-   $Id: cacao.c 4892 2006-05-06 18:29:55Z motse $
+   $Id: cacao.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -51,7 +51,7 @@
 #include "native/jvmti/jvmti.h"
 #include "native/jvmti/cacaodbg.h"
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 #include <pthread.h>
 #endif
 #endif
@@ -189,9 +189,6 @@ void exit_handler(void);
 
 int main(int argc, char **argv)
 {
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-       void *dummy;
-#endif
        s4 i;
        
        /* local variables ********************************************************/
@@ -199,10 +196,6 @@ int main(int argc, char **argv)
        JavaVMInitArgs *vm_args;
        JavaVM         *jvm;                /* denotes a Java VM                  */
 
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-       stackbottom = &dummy;
-#endif
-
        if (atexit(vm_exit_handler))
                throw_cacao_exception_exit(string_java_lang_InternalError,
                                                                   "Unable to register exit_handler");
@@ -219,7 +212,7 @@ int main(int argc, char **argv)
        
        /* load and initialize a Java VM, return a JNI interface pointer in env */
 
-       JNI_CreateJavaVM(&jvm, (void **) &_Jv_env, vm_args);
+       JNI_CreateJavaVM(&jvm, (void *) &_Jv_env, vm_args);
 
 #if defined(ENABLE_JVMTI)
        pthread_mutex_init(&dbgcomlock,NULL);
index e5f9b0c4aa6f8bf85b0f7b6e09ed2dc7ae47e887..7649ad83f0387bd4f77e9eb682e92613dad95db1 100644 (file)
 ##
 ## Changes:
 ##
-## $Id: Makefile.am 4768 2006-04-13 16:58:05Z edwin $
+## $Id: Makefile.am 4921 2006-05-15 14:24:36Z twisti $
 
 ## Process this file with automake to produce Makefile.in
 
 AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR) -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR)/$(OS_DIR)
 
 if DISABLE_GC
-if NATIVE_THREADS
-GC_LIB = $(top_builddir)/src/boehm-gc/libgc.la
-endif
+GC_LIB =
 else
 GC_LIB = $(top_builddir)/src/boehm-gc/libgc.la
 endif
 
-if USE_THREADS
-if NATIVE_THREADS
+if ENABLE_THREADS
 THREAD_LIB = $(top_builddir)/src/threads/native/libthreads.la
-else
-THREAD_LIB = $(top_builddir)/src/threads/green/libthreads.la
-endif
 endif
 
 if ENABLE_RT_TIMING
index ebb5c88968950df9a135c2a821c4eb486ab74552..1b04689fb9eacae76b575796b34a1809417ac3ef 100644 (file)
@@ -30,7 +30,7 @@
             Philipp Tomsich
             Christian Thalinger
 
-   $Id: cacaoh.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: cacaoh.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "mm/memory.h"
 #include "native/include/java_lang_Throwable.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "toolbox/logging.h"
@@ -164,7 +160,6 @@ int main(int argc, char **argv)
        s4 opt;
        classinfo *c;
        char *opt_directory;
-       void *dummy;
 
        /********** internal (only used by main) *****************************/
    
@@ -288,12 +283,9 @@ int main(int argc, char **argv)
 
        gc_init(heapmaxsize, heapstartsize);
 
-#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        threads_preinit();
 #endif
-       lock_init();
-#endif
 
        /* initialize the string hashtable stuff: lock (must be done
           _after_ threads_preinit) */
@@ -329,7 +321,7 @@ int main(int argc, char **argv)
        /* initialize the loader subsystems (must be done _after_
        classcache_init) */
 
-       if (!loader_init((u1 *) &dummy))
+       if (!loader_init())
                throw_main_exception_exit();
 
 
index fc751bbfec678db389266564bcea4f431b74f661..f25c4ac2a02258afde966ced70386ceb74fd0de4 100644 (file)
             Christian Thalinger
                        Edwin Steiner
 
-   $Id: headers.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: headers.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 
+#include "config.h"
+
 #include <assert.h>
 #include <ctype.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "vm/types.h"
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 # if defined(__DARWIN__)
 #  include <signal.h>
 # endif
@@ -77,7 +78,7 @@ u1 *intrp_main_stack;
 
 /* for raising exceptions from native methods *********************************/
 
-#if !defined(USE_THREADS) || !defined(NATIVE_THREADS)
+#if !defined(ENABLE_THREADS)
 java_objectheader *_no_threads_exceptionptr = NULL;
 #endif
 
@@ -460,7 +461,7 @@ void classnotfoundexception_to_noclassdeffounderror(void)
 
 /* machine dependent stuff ****************************************************/
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 critical_section_node_t asm_criticalsections;
 void thread_restartcriticalsection(ucontext_t *uc) {}
 #endif
index 22714d31c244c06f34b7df90258b8d2ce4ac4573..b143b64a94669df14f1a689786e4d597c283a7a0 100644 (file)
 
    Authors: Christian Thalinger
 
-   $Id: headers.h 4357 2006-01-22 23:33:38Z twisti $
+   $Id: headers.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #ifndef _HEADERS_H
 #define _HEADERS_H
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-#  include "threads/green/locks.h"
-# endif
+#include "config.h"
+
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "toolbox/chain.h"
index 67f39ad4d6ae029c9ea85d42eaa813dafd5ee39b..686d30984836fbdc0dc9ddd058d63643ed9e8581 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: boehm.c 4357 2006-01-22 23:33:38Z twisti $
+   $Id: boehm.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "config.h"
 #include "vm/types.h"
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS) && defined(__LINUX__)
+#if defined(ENABLE_THREADS) && defined(__LINUX__)
 #define GC_LINUX_THREADS
 #endif
-#if defined(USE_THREADS) && defined(NATIVE_THREADS) && defined(__IRIX__)
+#if defined(ENABLE_THREADS) && defined(__IRIX__)
 #define GC_IRIX_THREADS
 #endif
 
 #include "mm/boehm.h"
 #include "mm/memory.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "toolbox/logging.h"
 static bool in_gc_out_of_memory = false;    /* is GC out of memory?           */
 
 
-static void
-#ifdef __GNUC__
-       __attribute__ ((unused))
-#endif
-*stackcall_twoargs(struct otherstackcall *p)
-{
-       return (*p->p2)(p->p, p->l);
-}
-
 /* prototype static functions *************************************************/
 
 static void gc_ignore_warnings(char *msg, GC_word arg);
@@ -132,12 +119,6 @@ static void gc_ignore_warnings(char *msg, GC_word arg)
 {
 }
 
-static void *stackcall_malloc(void *p, u4 bytelength)
-{
-       return GC_MALLOC(bytelength);
-}
-
-
 static void *stackcall_malloc_atomic(void *p, u4 bytelength)
 {
        return GC_MALLOC_ATOMIC(bytelength);
@@ -150,37 +131,11 @@ static void *stackcall_malloc_uncollectable(void *p, u4 bytelength)
 }
 
 
-static void *stackcall_free(void *p, u4 bytelength)
-{
-       GC_FREE(p);
-       return NULL;
-}
-
-
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-#define MAINTHREADCALL(r,m,pp,ll) \
-       if (currentThread == NULL || currentThread == mainThread) { \
-               r = m(pp, ll); \
-       } else { \
-               struct otherstackcall sc; \
-               sc.p2 = m; \
-               sc.p = pp; \
-               sc.l = ll; \
-               r = (*asm_switchstackandcall)(CONTEXT(mainThread).usedStackTop, \
-                               stackcall_twoargs, \
-                               (void**)&(CONTEXT(currentThread).usedStackTop), &sc); \
-       }
-#else
-#define MAINTHREADCALL(r,m,pp,ll) \
-       { r = m(pp, ll); }
-#endif
-
-
 void *heap_alloc_uncollectable(u4 bytelength)
 {
        void *result;
 
-       MAINTHREADCALL(result, stackcall_malloc_uncollectable, NULL, bytelength);
+       result = stackcall_malloc_uncollectable(NULL, bytelength);
 
        /* clear allocated memory region */
 
@@ -194,12 +149,10 @@ void *heap_allocate(u4 bytelength, bool references, methodinfo *finalizer)
 {
        void *result;
 
-       if (references) {
-               MAINTHREADCALL(result, stackcall_malloc, NULL, bytelength);
-
-       } else {
-               MAINTHREADCALL(result, stackcall_malloc_atomic, NULL, bytelength);
-       }
+       if (references)
+               result = GC_MALLOC(bytelength);
+       else
+               result = stackcall_malloc_atomic(NULL, bytelength);
 
        if (!result)
                return NULL;
@@ -217,9 +170,7 @@ void *heap_allocate(u4 bytelength, bool references, methodinfo *finalizer)
 
 void heap_free(void *p)
 {
-       void *result;
-
-       MAINTHREADCALL(result, stackcall_free, p, 0);
+       GC_FREE(p);
 }
 
 void gc_call(void)
index 141c555f7c49e0c478ac5495e3ff30335650618f..bcf92ca49e5705fa350c39c1053c5e54ea060d78 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: boehm.h 4357 2006-01-22 23:33:38Z twisti $
+   $Id: boehm.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "vm/method.h"
 
 
-struct otherstackcall;
-
-typedef void *(*calltwoargs)(void *, u4);
-
-struct otherstackcall {
-       calltwoargs  p2;
-       void        *p;
-       u4           l;
-};
-
-
 /* function prototypes ********************************************************/
 
 void  gc_init(u4 heapmaxsize, u4 heapstartsize);
index 6c75b34aba8976c46e9384a2a4ad0d6805f65b23..e166443055fd4d7f57c76ab1dbba499bf45d81c4 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Christian Thalinger
                        Edwin Steiner
 
-   $Id: memory.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: memory.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "mm/memory.h"
 #include "native/native.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "toolbox/logging.h"
 
 *******************************************************************************/
 
-#if !defined(USE_THREADS) || (defined(USE_THREADS) && !defined(NATIVE_THREADS))
+#if !defined(ENABLE_THREADS)
 static dumpinfo _no_threads_dumpinfo;
 #endif
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 #define DUMPINFO    &((threadobject *) THREADOBJECT)->dumpinfo
 #else
 #define DUMPINFO    &_no_threads_dumpinfo
@@ -94,7 +90,7 @@ static dumpinfo _no_threads_dumpinfo;
 
 #define DEFAULT_CODEMEM_SIZE    128 * 1024  /* defaulting to 128kB            */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 static java_objectheader *codememlock = NULL;
 #endif
 static int                codememsize = 0;
@@ -109,13 +105,11 @@ static void              *codememptr  = NULL;
 
 bool memory_init(void)
 {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        codememlock = NEW(java_objectheader);
 
-# if defined(NATIVE_THREADS)
        lock_init_object_lock(codememlock);
-# endif
-#endif /* defined(USE_THREADS) */
+#endif
 
        /* everything's ok */
 
@@ -157,7 +151,7 @@ void *memory_cnew(s4 size)
        void *p;
        int   pagesize;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorenter(codememlock);
 #endif
 
@@ -215,7 +209,7 @@ void *memory_cnew(s4 size)
        codememptr = (void *) ((ptrint) codememptr + size);
        codememsize -= size;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorexit(codememlock);
 #endif
 
index dc8d6bfaf83a1ba8152af511b25e13fc6ce0590b..17bf3d0ef865bb264273326e494879e59e8ee21c 100644 (file)
@@ -32,7 +32,7 @@
             Christian Thalinger
                        Edwin Steiner
 
-   $Id: jni.c 4909 2006-05-13 23:10:21Z edwin $
+   $Id: jni.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 # include "native/jvmti/jvmti.h"
 #endif
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "toolbox/logging.h"
@@ -132,7 +128,7 @@ static methodinfo *dbbirw_init;
 
 /* local reference table ******************************************************/
 
-#if !defined(USE_THREADS)
+#if !defined(ENABLE_THREADS)
 localref_table *_no_threads_localref_table;
 #endif
 
@@ -4934,7 +4930,7 @@ jint MonitorEnter(JNIEnv *env, jobject obj)
                return JNI_ERR;
        }
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorenter(obj);
 #endif
 
@@ -4961,7 +4957,7 @@ jint MonitorExit(JNIEnv *env, jobject obj)
                return JNI_ERR;
        }
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorexit(obj);
 #endif
 
@@ -5120,7 +5116,7 @@ jobject NewGlobalRef(JNIEnv* env, jobject obj)
 
        STATISTICS(jniinvokation());
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorenter(hashtable_global_ref->header);
 #endif
 
@@ -5138,7 +5134,7 @@ jobject NewGlobalRef(JNIEnv* env, jobject obj)
 
                        gre->refs++;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        builtin_monitorexit(hashtable_global_ref->header);
 #endif
 
@@ -5165,7 +5161,7 @@ jobject NewGlobalRef(JNIEnv* env, jobject obj)
 
        hashtable_global_ref->entries++;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorexit(hashtable_global_ref->header);
 #endif
 
@@ -5188,7 +5184,7 @@ void DeleteGlobalRef(JNIEnv* env, jobject globalRef)
 
        STATISTICS(jniinvokation());
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorenter(hashtable_global_ref->header);
 #endif
 
@@ -5223,7 +5219,7 @@ void DeleteGlobalRef(JNIEnv* env, jobject globalRef)
                                FREE(gre, hashtable_global_ref_entry);
                        }
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        builtin_monitorexit(hashtable_global_ref->header);
 #endif
 
@@ -5236,7 +5232,7 @@ void DeleteGlobalRef(JNIEnv* env, jobject globalRef)
 
        log_println("JNI-DeleteGlobalRef: global reference not found");
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorexit(hashtable_global_ref->header);
 #endif
 }
@@ -5435,7 +5431,7 @@ jint GetEnv(JavaVM *vm, void **env, jint version)
 {
        STATISTICS(jniinvokation());
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        if (threads_get_current_threadobject() == NULL) {
                *env = NULL;
 
index aa6a8af9e4a81c1a32eee67a7ef540ca72c34d5c..ce329683ed79e7bddd9c90aaa7312a1d0992f8c3 100644 (file)
@@ -29,7 +29,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: jni.h 4913 2006-05-14 14:02:51Z edwin $
+   $Id: jni.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -95,7 +95,7 @@ struct localref_table {
        java_objectheader *refs[LOCALREFTABLE_CAPACITY]; /* references            */
 };
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 #define LOCALREFTABLE    (THREADOBJECT->_localref_table)
 #else
 extern localref_table *_no_threads_localref_table;
index aaddbcf0b9f57e52413a98c1f55dafc428770bcd..bfeee43b53a905ede73cb9896860e0f60d879dde 100644 (file)
@@ -63,7 +63,7 @@ jvmtiError allthreads (jint * threads_count_ptr, threadobject*** threads_ptr) {
     int i = 0, cnt = 8; 
     threadobject *thread, **tthreads;
        
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        tthreads = MNEW(threadobject*, (sizeof(threadobject*) * cnt));
 
        thread = mainthreadobj;
index b5d1deb5e9eccd6fabb3f7dcdd28ad63519afe3b..928fe7d905bef450672601c75b5800999cd1dfc4 100644 (file)
@@ -1,4 +1,4 @@
-/* src/native/jvmti/cacaodbg.h - contains cacao specifics for debugging support                                  
+/* src/native/jvmti/cacaodbg.h - contains cacao specifics for debugging support
 
    Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
@@ -99,7 +99,7 @@ typedef struct {
 
 cacaodbgcommunication *dbgcom;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 struct _jrawMonitorID {
     java_lang_String *name;
 };
index 911c9ea45af2fe2c17a0f3168b3fd30f21c278f3..3fa86579f3be02567f0545481913cffb1e1e28d7 100644 (file)
@@ -31,7 +31,7 @@
             Samuel Vinson
 
    
-   $Id: jvmti.c 4913 2006-05-14 14:02:51Z edwin $
+   $Id: jvmti.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -75,7 +75,7 @@
 #include <unistd.h>
 #include <sched.h>
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 #include "threads/native/threads.h"
 #include <sched.h>
 #include <pthread.h>
@@ -690,7 +690,7 @@ GetOwnedMonitorInfo (jvmtiEnv * env, jthread thread,
 
        CHECK_THREAD_IS_ALIVE(thread);
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 
        om=MNEW(java_objectheader*,size);
 
@@ -753,7 +753,7 @@ GetCurrentContendedMonitor (jvmtiEnv * env, jthread thread,
        CHECK_THREAD_IS_ALIVE(thread);
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 
        pthread_mutex_lock(&lock_global_pool_lock);
 
@@ -826,7 +826,7 @@ RunAgentThread (jvmtiEnv * env, jthread thread, jvmtiStartFunction proc,
        rap.arg = (void*)arg;
        rap.jvmti_env = env;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        pthread_attr_init(&threadattr);
        pthread_attr_setdetachstate(&threadattr, PTHREAD_CREATE_DETACHED);
        if (priority == JVMTI_THREAD_MIN_PRIORITY) {
@@ -871,7 +871,7 @@ GetTopThreadGroups (jvmtiEnv * env, jint * group_count_ptr,
     if ((groups_ptr == NULL) || (group_count_ptr == NULL)) 
         return JVMTI_ERROR_NULL_POINTER;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        tg = MNEW(jthreadGroup*,size);
        x = 0;
        if (JVMTI_ERROR_NONE!=GetAllThreads(env,&threads_count_ptr,(jthread**)&threads_ptr))
@@ -1071,7 +1071,7 @@ GetThreadState (jvmtiEnv * env, jthread thread, jint * thread_state_ptr)
        if (thread_state_ptr == NULL) return JVMTI_ERROR_NULL_POINTER;
 
        *thread_state_ptr = 0;
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        if((th->vmThread==NULL)&&(th->group==NULL)) { /* alive ? */
                /* not alive */
                if (((threadobject*)th->vmThread)->info.tid == 0)
@@ -1379,7 +1379,7 @@ CreateRawMonitor (jvmtiEnv * env, const char *name,
        if ((name == NULL) || (monitor_ptr == NULL)) 
                return JVMTI_ERROR_NULL_POINTER;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        monitor->name=javastring_new_from_ascii(name);
 #else
        log_text ("CreateRawMonitor not supported");
@@ -1406,7 +1406,7 @@ DestroyRawMonitor (jvmtiEnv * env, jrawMonitorID monitor)
        if (!builtin_instanceof((java_objectheader*)monitor->name,class_java_lang_String))
                return JVMTI_ERROR_INVALID_MONITOR;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        if (!lock_does_thread_hold_lock((threadobject*)THREADOBJECT, (java_objectheader*)monitor->name))
                return JVMTI_ERROR_NOT_MONITOR_OWNER;
        
@@ -1433,7 +1433,7 @@ RawMonitorEnter (jvmtiEnv * env, jrawMonitorID monitor)
        if (!builtin_instanceof((java_objectheader*)monitor->name,class_java_lang_String))
                return JVMTI_ERROR_INVALID_MONITOR;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorenter((java_objectheader*)monitor->name);        
 #else
        log_text ("RawMonitorEnter not supported");
@@ -1455,7 +1455,7 @@ RawMonitorExit (jvmtiEnv * env, jrawMonitorID monitor)
        if (!builtin_instanceof((java_objectheader*)monitor->name,class_java_lang_String))
                return JVMTI_ERROR_INVALID_MONITOR;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        /* assure current thread owns this monitor */
        if (!lock_does_thread_hold_lock((threadobject*)THREADOBJECT,(java_objectheader*)monitor->name))
                return JVMTI_ERROR_NOT_MONITOR_OWNER;
@@ -1481,7 +1481,7 @@ RawMonitorWait (jvmtiEnv * env, jrawMonitorID monitor, jlong millis)
        if (!builtin_instanceof((java_objectheader*)monitor->name,class_java_lang_String))
                return JVMTI_ERROR_INVALID_MONITOR;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        /* assure current thread owns this monitor */
        if (!lock_does_thread_hold_lock((threadobject*)THREADOBJECT,(java_objectheader*)monitor->name))
                return JVMTI_ERROR_NOT_MONITOR_OWNER;
@@ -1510,7 +1510,7 @@ RawMonitorNotify (jvmtiEnv * env, jrawMonitorID monitor)
        if (!builtin_instanceof((java_objectheader*)monitor->name,class_java_lang_String))
                return JVMTI_ERROR_INVALID_MONITOR;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        /* assure current thread owns this monitor */
        if (!lock_does_thread_hold_lock((threadobject*)THREADOBJECT,(java_objectheader*)monitor->name))
                return JVMTI_ERROR_NOT_MONITOR_OWNER;
@@ -1536,7 +1536,7 @@ RawMonitorNotifyAll (jvmtiEnv * env, jrawMonitorID monitor)
        if (!builtin_instanceof((java_objectheader*)monitor->name,class_java_lang_String))
                return JVMTI_ERROR_INVALID_MONITOR;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        /* assure current thread owns this monitor */
        if (!lock_does_thread_hold_lock((threadobject*)THREADOBJECT, (java_objectheader*)monitor->name))
                return JVMTI_ERROR_NOT_MONITOR_OWNER;
@@ -4103,7 +4103,7 @@ static jvmtiCapabilities JVMTI_Capabilities = {
   1,                           /* can_get_bytecodes */
   0,                           /* can_get_synthetic_attribute */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
   1,                           /* can_get_owned_monitor_info */
   1,                           /* can_get_current_contended_monitor */
 #else
index ef54cef40df0de23b09162e8be9f4aa1abb406b5..682fc9a2a76112fb4d419ab61cbd3c6292f70598 100644 (file)
@@ -30,7 +30,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: native.c 4900 2006-05-11 09:18:28Z twisti $
+   $Id: native.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -341,7 +341,7 @@ void native_hashtable_library_add(utf *filename, java_objectheader *loader,
        u4   key;                           /* hashkey                            */
        u4   slot;                          /* slot in hashtable                  */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorenter(hashtable_library->header);
 #endif
 
@@ -386,7 +386,7 @@ void native_hashtable_library_add(utf *filename, java_objectheader *loader,
 
        while (ne) {
                if (ne->name == filename) {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        builtin_monitorexit(hashtable_library->header);
 #endif
 
@@ -408,7 +408,7 @@ void native_hashtable_library_add(utf *filename, java_objectheader *loader,
        ne->hashlink = le->namelink;
        le->namelink = ne;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorexit(hashtable_library->header);
 #endif
 }
index 75a6ffc76193c8baa5c9759821619c9252049485..0b802c88b4c63dfec1f1c91b312ae92d15f64bd9 100644 (file)
@@ -28,7 +28,7 @@
 ##
 ## Changes:
 ##
-## $Id: Makefile.am 4627 2006-03-16 12:53:32Z twisti $
+## $Id: Makefile.am 4921 2006-05-15 14:24:36Z twisti $
 
 ## Process this file with automake to produce Makefile.in
 
@@ -37,9 +37,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR) -I$(top
 LIBS =
 
 if DISABLE_GC
-if NATIVE_THREADS
 GC_LIB = $(top_builddir)/src/boehm-gc/libgc.la
-endif
 else
 GC_LIB = $(top_builddir)/src/boehm-gc/libgc.la
 endif
index 25b7538eca6cd42d843da08087e8ca11fb326fe8..2daa62e0260a7d3d7ac32561a2d073b14ad41326 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: gennativetable.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: gennativetable.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "mm/boehm.h"
 #include "mm/memory.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "toolbox/chain.h"
@@ -105,8 +101,6 @@ int main(int argc, char **argv)
        methodinfo *m2;
        bool nativelyoverloaded;
 
-       void *dummy;
-
 #if defined(DISABLE_GC)
        nogc_init(HEAP_MAXSIZE, HEAP_STARTSIZE);
 #endif
@@ -145,12 +139,9 @@ int main(int argc, char **argv)
 
        gc_init(HEAP_MAXSIZE, HEAP_STARTSIZE);
 
-#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        threads_preinit();
 #endif
-       lock_init();
-#endif
 
        /* initialize the string hashtable stuff: lock (must be done
           _after_ threads_preinit) */
@@ -181,7 +172,7 @@ int main(int argc, char **argv)
        /* initialize the loader subsystems (must be done _after_
        classcache_init) */
 
-       if (!loader_init((u1 *) &dummy))
+       if (!loader_init())
                throw_main_exception_exit();
 
 
index 4782d013c9d97356e1cc40d8dfc577113b2cfcec..9bc68a404e6bffb3ebd38f0920d145d0ca4c1fe5 100644 (file)
    Changes: Joseph Wenninger
             Christian Thalinger
 
-   $Id: VMObject.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: VMObject.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 
+#include "config.h"
+
 #include <stdlib.h>
 #include <string.h>
 
+#include "vm/types.h"
+
 #include "mm/boehm.h"
 #include "mm/memory.h"
 #include "toolbox/logging.h"
 #include "native/include/java_lang_Cloneable.h"
 #include "native/include/java_lang_Object.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-#  include "threads/green/locks.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "vm/builtin.h"
@@ -100,12 +99,12 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_VMObject_clone(JNIEnv *env, j
                new = (java_lang_Object *)
                        heap_allocate(size, (desc->arraytype == ARRAYTYPE_OBJECT), NULL);
 
-               if (!new)
+               if (new == NULL)
                        return NULL;
 
                MCOPY(new, this, u1, size);
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                lock_init_object_lock((java_objectheader *) new);
 #endif
         
@@ -124,12 +123,12 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_VMObject_clone(JNIEnv *env, j
     c = this->header.vftbl->class;
     new = (java_lang_Object *) builtin_new(c);
 
-    if (!new)
+    if (new == NULL)
         return NULL;
 
     MCOPY(new, this, u1, c->instancesize);
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        lock_init_object_lock((java_objectheader *) new);
 #endif
 
@@ -144,7 +143,7 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_VMObject_clone(JNIEnv *env, j
  */
 JNIEXPORT void JNICALL Java_java_lang_VMObject_notify(JNIEnv *env, jclass clazz, java_lang_Object *this)
 {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        lock_notify_object(&this->header);
 #endif
 }
@@ -157,7 +156,7 @@ JNIEXPORT void JNICALL Java_java_lang_VMObject_notify(JNIEnv *env, jclass clazz,
  */
 JNIEXPORT void JNICALL Java_java_lang_VMObject_notifyAll(JNIEnv *env, jclass clazz, java_lang_Object *this)
 {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        lock_notify_all_object(&this->header);
 #endif
 }
@@ -170,7 +169,7 @@ JNIEXPORT void JNICALL Java_java_lang_VMObject_notifyAll(JNIEnv *env, jclass cla
  */
 JNIEXPORT void JNICALL Java_java_lang_VMObject_wait(JNIEnv *env, jclass clazz, java_lang_Object *o, s8 ms, s4 ns)
 {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        lock_wait_for_object(&o->header, ms, ns);
 #endif
 }
index 359aaf6510c381399c2339c82bddc0780dc4c0c2..8eb6989586d28f3acae0ba31d052cc5d530d2695 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Joseph Wenninger
             Christian Thalinger
 
-   $Id: VMThread.c 4909 2006-05-13 23:10:21Z edwin $
+   $Id: VMThread.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "native/include/java_lang_VMThread.h"
 #include "native/include/java_lang_Thread.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "toolbox/logging.h"
@@ -78,7 +74,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_VMThread_countStackFrames(JNIEnv *env, java_
  */
 JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMThread *this, s8 stacksize)
 {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        this->thread->vmThread = this;
 
        /* don't pass a function pointer (NULL) since we want Thread.run()V here */
@@ -95,10 +91,8 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMTh
  */
 JNIEXPORT void JNICALL Java_java_lang_VMThread_interrupt(JNIEnv *env, java_lang_VMThread *this)
 {
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        threads_interrupt_thread(this);
-#else
-       log_text("Java_java_lang_VMThread_interrupt called");
 #endif
 }
 
@@ -110,11 +104,8 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_interrupt(JNIEnv *env, java_lang_
  */
 JNIEXPORT s4 JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, java_lang_VMThread *this)
 {
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        return threads_thread_has_been_interrupted(this);
-#else
-       log_text("Java_java_lang_VMThread_isInterrupted called");
-       return 0;
 #endif
 }
 
@@ -126,8 +117,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, java_lan
  */
 JNIEXPORT void JNICALL Java_java_lang_VMThread_suspend(JNIEnv *env, java_lang_VMThread *this)
 {
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-       suspendThread((java_lang_Thread *) this->thread);
+#if defined(ENABLE_THREADS)
 #endif
 }
 
@@ -139,8 +129,7 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_suspend(JNIEnv *env, java_lang_VM
  */
 JNIEXPORT void JNICALL Java_java_lang_VMThread_resume(JNIEnv *env, java_lang_VMThread *this)
 {
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-       resumeThread((java_lang_Thread *) this->thread);
+#if defined(ENABLE_THREADS)
 #endif
 }
 
@@ -152,8 +141,9 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_resume(JNIEnv *env, java_lang_VMT
  */
 JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, java_lang_VMThread *this, s4 priority)
 {
-#if defined(USE_THREADS)
-       threads_java_lang_Thread_set_priority((java_lang_Thread *) this->thread, priority);
+#if defined(ENABLE_THREADS)
+       threads_java_lang_Thread_set_priority((java_lang_Thread *) this->thread,
+                                                                                 priority);
 #endif
 }
 
@@ -165,19 +155,7 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, ja
  */
 JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeStop(JNIEnv *env, java_lang_VMThread *this, java_lang_Throwable *t)
 {
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-       if (currentThread == (java_lang_Thread *) this->thread) {
-               log_text("killing");
-               killThread(0);
-               /*
-                 exceptionptr = proto_java_lang_ThreadDeath;
-                 return;
-               */
-
-       } else {
-               /*CONTEXT((java_lang_Thread*)this)*/ this->flags |= THREAD_FLAGS_KILLED;
-               resumeThread((java_lang_Thread *) this->thread);
-       }
+#if defined(ENABLE_THREADS)
 #endif
 }
 
@@ -191,12 +169,8 @@ JNIEXPORT java_lang_Thread* JNICALL Java_java_lang_VMThread_currentThread(JNIEnv
 {
        java_lang_Thread *t;
 
-#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        t = ((threadobject*) THREADOBJECT)->o.thread;
-#else
-       t = (java_lang_Thread *) currentThread;
-#endif
 
        if (t == NULL)
                log_text("t ptr is NULL\n");
@@ -228,7 +202,7 @@ JNIEXPORT java_lang_Thread* JNICALL Java_java_lang_VMThread_currentThread(JNIEnv
  */
 JNIEXPORT void JNICALL Java_java_lang_VMThread_yield(JNIEnv *env, jclass clazz)
 {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        threads_yield();
 #endif
 }
@@ -241,11 +215,8 @@ JNIEXPORT void JNICALL Java_java_lang_VMThread_yield(JNIEnv *env, jclass clazz)
  */
 JNIEXPORT s4 JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass clazz)
 {
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        return threads_check_if_interrupted_and_reset();
-#else
-       log_text("Java_java_lang_VMThread_interrupted");
-       return 0;
 #endif
 }
 
@@ -257,12 +228,9 @@ JNIEXPORT s4 JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass cla
  */
 JNIEXPORT s4 JNICALL Java_java_lang_VMThread_holdsLock(JNIEnv *env, jclass clazz, java_lang_Object* o)
 {
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        return lock_does_thread_hold_lock((threadobject*) THREADOBJECT,
-                                                  (java_objectheader *) o);
-#else
-       /* I don't know how to find out [stefan] */
-       return 0;
+                                                                         (java_objectheader *) o);
 #endif
 }
 
index 7348124ebe1bb526e3160fee8d9396c1454fed63..4c618f93a8b5d795cf5732e595e75c8c04d67bce 100644 (file)
 ##
 ## Changes:
 ##
-## $Id: Makefile.am 4357 2006-01-22 23:33:38Z twisti $
+## $Id: Makefile.am 4921 2006-05-15 14:24:36Z twisti $
 
 ## Process this file with automake to produce Makefile.in
 
-if USE_THREADS
-if NATIVE_THREADS
+if ENABLE_THREADS
 SUBDIRS = native
 else
-SUBDIRS = green
-endif
-else
 SUBDIRS =
 endif
 
diff --git a/src/threads/green/.cvsignore b/src/threads/green/.cvsignore
deleted file mode 100644 (file)
index cfca562..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-*.a
-*.o
-*.la
-*.lo
-.deps
-.libs
-Makefile
-Makefile.in
diff --git a/src/threads/green/Makefile.am b/src/threads/green/Makefile.am
deleted file mode 100644 (file)
index 5cbcdd9..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-## src/threads/green/Makefile.am
-##
-## Copyright (C) 1996-2005, 2006 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
-##
-## This file is part of CACAO.
-##
-## This program is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public License as
-## published by the Free Software Foundation; either version 2, or (at
-## your option) any later version.
-##
-## This program is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-## 02110-1301, USA.
-##
-## Contact: cacao@cacaojvm.org
-##
-## Authors: Christian Thalinger
-##
-## Changes:
-##
-## $Id: Makefile.am 4357 2006-01-22 23:33:38Z twisti $
-
-## Process this file with automake to produce Makefile.in
-
-INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/src/vm/jit/@ARCH_DIR@
-
-noinst_LTLIBRARIES = libthreads.la
-
-libthreads_la_SOURCES = \
-       locks.c \
-       locks.h \
-       threads.c \
-       threads.h \
-       threadio.c \
-       threadio.h
-
-
-## Local variables:
-## mode: Makefile
-## indent-tabs-mode: t
-## c-basic-offset: 4
-## tab-width: 8
-## compile-command: "automake --add-missing"
-## End:
diff --git a/src/threads/green/locks.c b/src/threads/green/locks.c
deleted file mode 100644 (file)
index e1ff9ad..0000000
+++ /dev/null
@@ -1,578 +0,0 @@
-/* -*- mode: c; tab-width: 4; c-basic-offset: 4 -*- */
-/*
- * locks.c
- * Manage locking system
- * This include the mutex's and cv's.
- *
- * Copyright (c) 1996 T. J. Wilkinson & Associates, London, UK.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
- */
-
-
-#include <assert.h>
-#include <stdio.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"
-
-
-extern thread* currentThread;
-
-mutexHashEntry *mutexHashTable;
-int mutexHashTableSize;
-long mutexHashMask;
-
-mutexHashEntry *mutexOverflowTable;
-int mutexOverflowTableSize;
-mutexHashEntry *firstFreeOverflowEntry = 0;
-
-conditionHashEntry *conditionHashTable;
-int conditionHashTableSize;
-long conditionHashMask;
-
-/*
- * Init the tables.
- */
-void
-lock_init (void)
-{
-    int i;
-
-    mutexHashTableSize = MUTEX_HASH_TABLE_SIZE;
-    mutexHashTable = MNEW(mutexHashEntry, mutexHashTableSize);
-    mutexHashMask = (mutexHashTableSize - 1) << 3;
-
-    for (i = 0; i < mutexHashTableSize; ++i)
-    {
-               mutexHashTable[i].object = 0;
-               mutexHashTable[i].mutex.holder = 0;
-               mutexHashTable[i].mutex.count = 0;
-               mutexHashTable[i].mutex.muxWaiters = 0;
-               mutexHashTable[i].conditionCount = 0;
-               mutexHashTable[i].next = 0;
-    }
-
-    mutexOverflowTableSize = MUTEX_OVERFLOW_TABLE_SIZE;
-    mutexOverflowTable = MNEW(mutexHashEntry, mutexOverflowTableSize);
-
-    firstFreeOverflowEntry = &mutexOverflowTable[0];
-
-    for (i = 0; i < mutexOverflowTableSize; ++i)
-    {
-               mutexOverflowTable[i].object = 0;
-               mutexOverflowTable[i].mutex.holder = 0;
-               mutexOverflowTable[i].mutex.count = 0;
-               mutexOverflowTable[i].mutex.muxWaiters = 0;
-               mutexOverflowTable[i].conditionCount = 0;
-               mutexOverflowTable[i].next = &mutexOverflowTable[i + 1];
-    }
-    mutexOverflowTable[i - 1].next = 0;
-
-    conditionHashTableSize = CONDITION_HASH_TABLE_SIZE;
-    conditionHashTable = MNEW(conditionHashEntry, conditionHashTableSize);
-    conditionHashMask = (conditionHashTableSize - 1) << 3;
-
-    for (i = 0; i < conditionHashTableSize; ++i)
-    {
-               conditionHashTable[i].object = 0;
-               conditionHashTable[i].condition.cvWaiters = 0;
-               conditionHashTable[i].condition.mux = 0;
-    }
-}
-
-
-/*
- * Reorders part of the condition hash table. Must be called after an entry has been deleted.
- */
-void
-reorderConditionHashTable (int begin)
-{
-    while (conditionHashTable[begin].object != 0)
-    {
-       int hashValue = CONDITION_HASH_VALUE(conditionHashTable[begin].object);
-
-       if (hashValue != begin)
-       {
-           while (conditionHashTable[hashValue].object != 0)
-           {
-               hashValue = CONDITION_HASH_SUCCESSOR(hashValue);
-               if (hashValue == begin)
-                   break;
-           }
-           if (hashValue != begin)
-           {
-               conditionHashTable[hashValue] = conditionHashTable[begin];
-               conditionHashTable[begin].object = 0;
-               conditionHashTable[begin].condition.cvWaiters = 0;
-               conditionHashTable[begin].condition.mux = 0;
-           }
-       }
-
-       begin = CONDITION_HASH_SUCCESSOR(begin);
-    }
-}
-
-/*
- * Looks up an entry in the condition hash table.
- */
-iCv*
-conditionForObject (java_objectheader *object)
-{
-    int hashValue;
-
-    intsDisable();
-
-    hashValue = CONDITION_HASH_VALUE(object);
-    while (conditionHashTable[hashValue].object != object
-                  && conditionHashTable[hashValue].object != 0)
-               hashValue = CONDITION_HASH_SUCCESSOR(hashValue);
-
-    if (conditionHashTable[hashValue].object == 0)
-    {
-               intsRestore();
-               return 0;
-    }
-    
-    intsRestore();
-    return &conditionHashTable[hashValue].condition;
-}
-
-/*
- * Adds a new entry in the condition hash table and returns a pointer to the condition
- */
-iCv*
-addConditionForObject (java_objectheader *object)
-{
-    int hashValue;
-
-    intsDisable();
-
-    hashValue = CONDITION_HASH_VALUE(object);
-    while (conditionHashTable[hashValue].object != 0)
-               hashValue = CONDITION_HASH_SUCCESSOR(hashValue);
-
-    conditionHashTable[hashValue].object = object;
-
-    intsRestore();
-
-    return &conditionHashTable[hashValue].condition;
-}
-
-/*
- * Removes an entry from the condition hash table.
- */
-void
-removeConditionForObject (java_objectheader *object)
-{
-    int hashValue;
-
-    intsDisable();
-
-    hashValue = CONDITION_HASH_VALUE(object);
-    while (conditionHashTable[hashValue].object != object)
-               hashValue = CONDITION_HASH_SUCCESSOR(hashValue);
-
-    conditionHashTable[hashValue].object = 0;
-    conditionHashTable[hashValue].condition.cvWaiters = 0;
-    conditionHashTable[hashValue].condition.mux = 0;
-
-    reorderConditionHashTable(CONDITION_HASH_SUCCESSOR(hashValue));
-
-    intsRestore();
-}
-
-/*
- * Returns the mutex entry for the specified object and increments its conditionCount.
- */
-mutexHashEntry*
-conditionLockedMutexForObject (java_objectheader *object)
-{
-    int hashValue;
-    mutexHashEntry *entry;
-
-    assert(object != 0);
-
-    intsDisable();
-
-    hashValue = MUTEX_HASH_VALUE(object);
-    entry = &mutexHashTable[hashValue];
-
-    if (entry->object != 0)
-    {
-               if (entry->mutex.count == 0 && entry->conditionCount == 0)
-               {
-                       entry->object = 0;
-                       entry->mutex.holder = 0;
-                       entry->mutex.count = 0;
-                       entry->mutex.muxWaiters = 0;
-               }
-               else
-               {
-                       while (entry->next != 0 && entry->object != object)
-                               entry = entry->next;
-
-                       if (entry->object != object)
-                       {
-                               entry->next = firstFreeOverflowEntry;
-                               firstFreeOverflowEntry = firstFreeOverflowEntry->next;
-                               
-                               entry = entry->next;
-                               entry->object = 0;
-                               entry->next = 0;
-                               assert(entry->conditionCount == 0);
-                       }
-               }
-    }
-
-    if (entry->object == 0)
-        entry->object = object;
-
-    ++entry->conditionCount;
-
-    intsRestore();
-
-    return entry;
-}
-
-/*
- * Wait for the condition of an object to be signalled
- */
-void
-lock_wait_for_object (java_objectheader *obj, s8 time, s4 par3)
-{
-    iCv *condition;
-    mutexHashEntry *mutexEntry;
-
-    intsDisable();
-
-    mutexEntry = conditionLockedMutexForObject(obj);
-
-    condition = conditionForObject(obj);
-    if (condition == 0)
-               condition = addConditionForObject(obj);
-
-    DBG( fprintf(stderr, "condition of %p is %p\n", obj, condition); );
-
-    internal_wait_cond(&mutexEntry->mutex, condition, time);
-
-    if (condition->cvWaiters == 0 && condition->mux == 0)
-               removeConditionForObject(obj);
-    --mutexEntry->conditionCount;
-
-    intsRestore();
-}
-
-/*
- * Signal the condition of an object
- */
-void
-lock_notify_object (java_objectheader *obj)
-{
-    iCv *condition;
-
-    intsDisable();
-
-    condition = conditionForObject(obj);
-    if (condition == 0)
-               condition = addConditionForObject(obj);
-
-    DBG( fprintf(stderr, "condition of %p is %p\n", obj, condition); );
-    
-    internal_signal_cond(condition);
-
-    if (condition->cvWaiters == 0 && condition->mux == 0)
-               removeConditionForObject(obj);
-
-    intsRestore();
-}
-
-/*
- * Broadcast the condition of an object.
- */
-void
-lock_notify_all_object (java_objectheader *obj)
-{
-       intsDisable();
-       internal_lock_notify_all_object(obj);
-       intsRestore();
-}
-
-/*
- * Internal: Broadcast the condition of an object.
- */
-void
-internal_lock_notify_all_object (java_objectheader *obj)
-{
-    iCv *condition;
-
-    condition = conditionForObject(obj);
-    if (condition == 0)
-               condition = addConditionForObject(obj);
-
-    internal_broadcast_cond(condition);
-
-    if (condition->cvWaiters == 0 && condition->mux == 0)
-               removeConditionForObject(obj);
-}
-
-/*
- * Lock a mutex.
- */
-void
-lock_mutex (iMux *mux)
-{
-       intsDisable();
-       internal_lock_mutex(mux);
-       intsRestore();
-}
-
-/*
- * Lock the mutex for an object.
- */
-void
-lock_mutex_for_object (java_objectheader *obj)
-{
-       intsDisable();
-       internal_lock_mutex_for_object(obj);
-       intsRestore();
-}
-
-/*
- * Unlock a mutex.
- */
-void
-unlock_mutex (iMux *mux)
-{
-       intsDisable();
-       internal_unlock_mutex(mux);
-       intsRestore();
-}
-
-/*
- * Unlock the mutex for an object.
- */
-void
-unlock_mutex_for_object (java_objectheader *obj)
-{
-       intsDisable();
-       internal_unlock_mutex_for_object(obj);
-       intsRestore();
-}
-
-/*
- * Wait on a condition variable.
- */
-void
-wait_cond (iMux *mux, iCv *cond, s8 timeout)
-{
-       intsDisable();
-       internal_wait_cond(mux, cond, timeout);
-       intsRestore();
-}
-
-/*
- * Signal a condition variable.
- */
-void
-signal_cond (iCv *cond)
-{
-       intsDisable();
-       internal_signal_cond(cond);
-       intsRestore();
-}
-
-/*
- * Broadcast a condition variable.
- */
-void
-broadcast_cond (iCv *cond)
-{
-       intsDisable();
-       internal_broadcast_cond(cond);
-       intsRestore();
-}
-
-/*
- * Internal: Lock a mutex.
- */
-void
-internal_lock_mutex(iMux* mux)
-{
-       assert(blockInts > 0);
-
-    if (mux->holder == 0)
-    {
-               mux->holder = currentThread;
-               mux->count = 1;
-               DBG( fprintf(stderr, "set holder of %p to %p\n", mux, mux->holder); )
-    }
-    else if (mux->holder == currentThread)
-    {
-               mux->count++;
-    }
-    else
-    {
-               while (mux->holder != 0)
-               {
-                       suspendOnQThread(currentThread, &mux->muxWaiters);
-               }
-               mux->holder = currentThread;
-               mux->count = 1;
-    }
-}
-
-/*
- * Internal: Release a mutex.
- */
-void
-internal_unlock_mutex(iMux* mux)
-{
-    thread* tid;
-
-       assert(blockInts > 0);
-
-    assert(mux->holder == currentThread);
-    
-    mux->count--;
-    if (mux->count == 0)
-    {
-               mux->holder = 0;
-               if (mux->muxWaiters != 0)
-               {
-                       tid = mux->muxWaiters;
-                       mux->muxWaiters = tid->vmThread->next;
-                       iresumeThread(tid);
-               }
-    }
-}
-
-/*
- * Internal: Wait on a conditional variable.
- *  (timeout currently ignored)
- */
-void
-internal_wait_cond(iMux* mux, iCv* cv, s8 timeout)
-{
-    int count;
-    thread* tid;
-
-    DBG( fprintf(stderr, "waiting on %p\n", cv); );
-
-    if (mux->holder != currentThread) {
-               *exceptionptr = new_exception(string_java_lang_IllegalMonitorStateException);
-    }
-
-       assert(blockInts > 0);
-
-    count = mux->count;
-    mux->holder = 0;
-    mux->count = 0;
-    cv->mux = mux;
-
-    /* If there's anyone waiting here, wake them up */
-    if (mux->muxWaiters != 0) {
-               tid = mux->muxWaiters;
-               mux->muxWaiters = tid->vmThread->next;
-               iresumeThread(tid);
-    }
-
-    /* Suspend, and keep suspended until I re-get the lock */
-    suspendOnQThread(currentThread, &cv->cvWaiters);
-    while (mux->holder != 0) {
-               DBG( fprintf(stderr, "woke up\n"); );
-               suspendOnQThread(currentThread, &mux->muxWaiters);
-    }
-
-    mux->holder = currentThread;
-    mux->count = count;
-}
-
-/*
- * Internal: Wake one thread on a conditional variable.
- */
-void
-internal_signal_cond (iCv* cv)
-{
-    thread* tid;
-
-    DBG( fprintf(stderr, "signalling on %p\n", cv); );
-
-    /* If 'mux' isn't set then we've never waited on this object. */
-    if (cv->mux == 0) {
-               return;
-    }
-
-    if (cv->mux->holder != currentThread) {
-               *exceptionptr = new_exception(string_java_lang_IllegalMonitorStateException);
-    }
-
-       assert(blockInts > 0);
-
-    /* Remove one thread from cv list */
-    if (cv->cvWaiters != 0) {
-               DBG( fprintf(stderr, "releasing a waiter\n"); );
-
-               tid = cv->cvWaiters;
-               cv->cvWaiters = tid->vmThread->next;
-
-               /* Place it on mux list */
-               tid->vmThread->next = cv->mux->muxWaiters;
-               cv->mux->muxWaiters = tid;
-    }
-}
-
-/*
- * Internal: Wake all threads on a conditional variable.
- */
-void
-internal_broadcast_cond (iCv* cv)
-{
-    thread** tidp;
-
-    /* If 'mux' isn't set then we've never waited on this object. */
-    if (cv->mux == 0) {
-               return;
-    }
-
-    if (cv->mux->holder != currentThread) {
-               *exceptionptr = new_exception(string_java_lang_IllegalMonitorStateException);
-    }
-
-       assert(blockInts > 0);
-
-    /* Find the end of the cv list */
-    if (cv->cvWaiters) {
-               for (tidp = &cv->cvWaiters; *tidp != 0; tidp = &(*tidp)->vmThread->next)
-                       ;
-
-               /* Place entire cv list on mux list */
-               (*tidp) = cv->mux->muxWaiters;
-               cv->mux->muxWaiters = cv->cvWaiters;
-               cv->cvWaiters = 0;
-    }
-}
-
-
-/*
- * 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:
- */
diff --git a/src/threads/green/locks.h b/src/threads/green/locks.h
deleted file mode 100644 (file)
index fbbe0d2..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * locks.h
- * Manage locking system
- * This include the mutex's and cv's.
- *
- * Copyright (c) 1996 T. J. Wilkinson & Associates, London, UK.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
- */
-
-#ifndef __locks_h
-#define __locks_h
-
-#include "vm/global.h"
-
-
-#define        WAITFOREVER     -1
-
-struct _thread;
-
-typedef struct _iMux {
-    struct _thread *holder;
-    int        count;
-    struct _thread *muxWaiters;
-} iMux;
-
-typedef struct _iCv {
-       struct _thread*         cvWaiters;
-       struct _iMux*           mux;
-} iCv;
-
-#define MAX_MUTEXES             256
-
-typedef struct _mutexHashEntry
-{
-    java_objectheader *object;
-    iMux mutex;
-    struct _mutexHashEntry *next;
-    int conditionCount;
-} mutexHashEntry;
-
-#define MUTEX_HASH_TRASH_BITS                3
-#define MUTEX_HASH_SIGN_BITS                10
-
-#define MUTEX_HASH_TABLE_SIZE             1024
-#define MUTEX_OVERFLOW_TABLE_SIZE         1024
-/*
-#define MAX_MUTEX_HASH_TABLE_SIZE        65536
-*/
-
-/*
-#define MUTEX_USE_THRESHOLD               1024
-*/
-
-extern long mutexHashMask;
-extern int mutexHashTableSize;
-extern mutexHashEntry *mutexHashTable;
-
-extern mutexHashEntry *mutexOverflowTable;
-extern int mutexOverflowTableSize;
-extern mutexHashEntry *firstFreeOverflowEntry;
-
-#define MUTEX_HASH_MASK                  ((MUTEX_HASH_TABLE_SIZE - 1) << 3)
-
-#if 0
-#define MUTEX_HASH_VALUE(a)      ((((long)(a)) & MUTEX_HASH_MASK) >> MUTEX_HASH_TRASH_BITS)
-#else
-#define MUTEX_HASH_VALUE(a)      (( (((long)(a)) ^ ((long)(a) >> MUTEX_HASH_SIGN_BITS)) & mutexHashMask) >> MUTEX_HASH_TRASH_BITS)
-#endif
-#define MUTEX_HASH_SUCCESSOR(h)                  (((h) + 7) & (mutexHashTableSize - 1))
-
-typedef struct _conditionHashEntry
-{
-    java_objectheader *object;
-    iCv condition;
-} conditionHashEntry;
-
-#define CONDITION_HASH_TABLE_SIZE                1024
-
-#define CONDITION_HASH_VALUE(a)                  ((((long)(a)) & conditionHashMask) >> 3)
-#define CONDITION_HASH_SUCCESSOR(h)              (((h) + 7) & (conditionHashTableSize - 1))
-
-typedef struct
-{
-    bool free;
-    java_objectheader *object;
-    iMux mutex;
-    iCv condition;
-} object_mutex;
-
-extern void lock_init (void);
-
-mutexHashEntry* conditionLockedMutexForObject (java_objectheader *object);
-
-void reorderConditionHashTable (int begin);
-iCv* conditionForObject (java_objectheader *object);
-iCv* addConditionForObject (java_objectheader *object);
-void removeConditionForObject (java_objectheader *object);
-
-/*
- * use these functions only outside critical sections (intsEnable/intsRestore).
- */
-
-void lock_notify_object (java_objectheader *obj);
-void lock_notify_all_object (java_objectheader *obj);
-void lock_wait_for_object (java_objectheader *obj, s8 time, s4);
-void lock_mutex_for_object (java_objectheader *obj);
-void unlock_mutex_for_object (java_objectheader *obj);
-
-void lock_mutex (iMux*);
-void unlock_mutex (iMux*);
-void wait_cond (iMux*, iCv*, s8);
-void signal_cond (iCv*);
-void broadcast_cond (iCv*);
-
-/*
- * use these internal functions only in critical sections. blockInts must be exactly
- * 1.
- */
-void internal_lock_mutex (iMux*);
-void internal_unlock_mutex (iMux*);
-void internal_wait_cond (iMux*, iCv*, s8);
-void internal_signal_cond (iCv*);
-void internal_broadcast_cond (iCv*);
-
-void internal_lock_mutex_for_object (java_objectheader *obj);
-void internal_unlock_mutex_for_object (java_objectheader *obj);
-void internal_lock_notify_all_object (java_objectheader *obj);
-
-#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:
- */
diff --git a/src/threads/green/threadio.c b/src/threads/green/threadio.c
deleted file mode 100644 (file)
index 529580a..0000000
+++ /dev/null
@@ -1,492 +0,0 @@
-/*
- * threadCalls.c
- * Support for threaded ops which may block (read, write, connect, etc.).
- *
- * Copyright (c) 1996 T. J. Wilkinson & Associates, London, UK.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
- */
-
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <assert.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "config.h"
-#include "threads/green/threads.h"
-
-
-#define        TH_READ         0
-#define        TH_WRITE        1
-#define        TH_ACCEPT       TH_READ
-#define        TH_CONNECT      TH_WRITE
-
-static int maxFd;
-static fd_set readsPending;
-static fd_set writesPending;
-static thread* readQ[FD_SETSIZE];
-static thread* writeQ[FD_SETSIZE];
-
-void blockOnFile(int, int);
-void waitOnEvents(void);
-
-extern thread* currentThread;
-
-/* These are undefined because we do not yet support async I/O */
-#undef F_SETOWN
-#undef FIOSETOWN
-#undef O_ASYNC
-#undef FIOASYNC
-
-/*
- * Create a threaded file descriptor.
- */
-int
-threadedFileDescriptor(int fd)
-{
-#if !defined(BLOCKING_CALLS)
-    int r;
-#if defined(HAVE_IOCTL) && defined(FIOASYNC)
-    int on = 1;
-#endif
-    int pid;
-
-    /* Make non-blocking */
-#if defined(HAVE_FCNTL) && defined(O_NONBLOCK)
-    r = fcntl(fd, F_GETFL, 0);
-    r = fcntl(fd, F_SETFL, r|O_NONBLOCK);
-#elif defined(HAVE_IOCTL) && defined(FIONBIO)
-    r = ioctl(fd, FIONBIO, &on);
-#else
-    r = 0;
-#endif
-    if (r < 0)
-    {
-       return (r);
-    }
-
-    /* Allow socket to signal this process when new data is available */
-    pid = getpid();
-#if defined(HAVE_FCNTL) && defined(F_SETOWN)
-    r = fcntl(fd, F_SETOWN, pid);
-#elif defined(HAVE_IOCTL) && defined(FIOSETOWN)
-    r = ioctl(fd, FIOSETOWN, &pid);
-#else
-    r = 0;
-#endif
-    if (r < 0)
-    {
-       return (r);
-    }
-
-#if defined(HAVE_FCNTL) && defined(O_ASYNC)
-    r = fcntl(fd, F_GETFL, 0);
-    r = fcntl(fd, F_SETFL, r|O_ASYNC);
-#elif defined(HAVE_IOCTL) && defined(FIOASYNC)
-    r = ioctl(fd, FIOASYNC, &on);
-#else
-    r = 0;
-#endif
-    if (r < 0)
-    {
-       return (r);
-    }
-#endif
-    return (fd);
-}
-
-void clear_thread_flags(void)
-{
-#if !defined(BLOCKING_CALLS)
-#if defined(HAVE_FCNTL) && defined(O_NONBLOCK)
-    int fl, fd;
-
-    fd = fileno(stdin);
-    fl = fcntl(fd, F_GETFL, 0);
-    fl = fcntl(fd, F_SETFL, fl & (~O_NONBLOCK));
-
-    fd = fileno(stdout);
-    fl = fcntl(fd, F_GETFL, 0);
-    fl = fcntl(fd, F_SETFL, fl & (~O_NONBLOCK));
-
-    fd = fileno(stderr);
-    fl = fcntl(fd, F_GETFL, 0);
-    fl = fcntl(fd, F_SETFL, fl & (~O_NONBLOCK));
-
-#elif defined(HAVE_IOCTL) && defined(FIONBIO)
-    int fl, fd;
-
-    fl = 0;
-    fd = fileno(stdin);
-    (void) ioctl(fd, FIONBIO, &fl);
-
-    fd = fileno(stdout);
-    (void) ioctl(fd, FIONBIO, &fl);
-
-    fd = fileno(stderr);
-    (void) ioctl(fd, FIONBIO, &fl);
-#endif
-#endif
-
-    fflush(stdout);
-    fflush(stderr);
-}
-
-
-/*
- * Threaded create socket.
- */
-int
-threadedSocket(int af, int type, int proto)
-{
-    int fd;
-
-    fd = socket(af, type, proto);
-    return (threadedFileDescriptor(fd));
-}
-
-/*
- * Threaded file open.
- */
-int
-threadedOpen(char* path, int flags, int mode)
-{
-    int fd;
-
-    fd = open(path, flags, mode);
-    return (threadedFileDescriptor(fd));
-}
-
-/*
- * Threaded socket connect.
- */
-int
-threadedConnect(int fd, struct sockaddr* addr, int len)
-{
-    int r;
-
-    r = connect(fd, addr, len);
-#if !defined(BLOCKING_CALLS)
-    if ((r < 0)
-       && (errno == EINPROGRESS || errno == EALREADY
-           || errno == EWOULDBLOCK)) {
-       blockOnFile(fd, TH_CONNECT);
-       r = 0; /* Assume it's okay when we get released */
-    }
-#endif
-
-    return (r);
-}
-
-/*
- * Threaded socket accept.
- */
-int
-threadedAccept(int fd, struct sockaddr* addr, int* len)
-{
-    int r;
-
-    for (;;)
-    {
-#if defined(BLOCKING_CALLS)
-       blockOnFile(fd, TH_ACCEPT);
-#endif
-       r = accept(fd, addr, (int*)len);
-       if (r >= 0
-           || !(errno == EINPROGRESS || errno == EALREADY
-                || errno == EWOULDBLOCK))
-       {
-           break;
-       }
-#if !defined(BLOCKING_CALLS)
-       blockOnFile(fd, TH_ACCEPT);
-#endif
-    }
-    return (threadedFileDescriptor(r));
-}
-
-/*
- * Read but only if we can.
- */
-int
-threadedRead(int fd, char* buf, int len)
-{
-    int r;
-
-    DBG(   printf("threadedRead\n");          )
-
-#if defined(BLOCKING_CALLS)
-    blockOnFile(fd, TH_READ);
-#endif
-    for (;;)
-    {
-       r = read(fd, buf, len);
-       if (r < 0
-           && (errno == EAGAIN || errno == EWOULDBLOCK
-               || errno == EINTR))
-       {
-           blockOnFile(fd, TH_READ);
-           continue;
-       }
-       return (r);
-    }
-}
-
-/*
- * Write but only if we can.
- */
-int
-threadedWrite(int fd, char* buf, int len)
-{
-    int r;
-    char* ptr;
-
-    ptr = buf;
-    r = 1;
-
-    DBG(    printf("threadedWrite %dbytes\n",len);      )
-
-    while (len > 0 && r > 0)
-    {
-#if defined(BLOCKING_CALLS)
-       blockOnFile(fd, TH_WRITE);
-#endif
-       r = write(fd, ptr, len);
-       if (r < 0
-           && (errno == EAGAIN || errno == EWOULDBLOCK
-               || errno == EINTR))
-       {
-#if !defined(BLOCKING_CALLS)
-           blockOnFile(fd, TH_WRITE);
-#endif
-           r = 1;
-       }
-       else
-       {
-           ptr += r;
-           len -= r;
-       }
-    }
-    return (ptr - buf);
-}
-
-/*
- * Receive, but only if we can.
- */
-int
-threadedRecvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *addr, int *addrlen)
-{
-    int r;
-
-    DBG(   printf("threadedRecvfrom\n");          )
-
-#if defined(BLOCKING_CALLS)
-    blockOnFile(fd, TH_READ);
-#endif
-    for (;;)
-    {
-       r = recvfrom(fd, buf, len, flags, addr, addrlen);
-       if (r < 0
-           && (errno == EAGAIN || errno == EWOULDBLOCK
-               || errno == EINTR))
-       {
-           blockOnFile(fd, TH_READ);
-           continue;
-       }
-       return (r);
-    }
-}
-
-/*
- * Send, but only if we can.
- */
-int
-threadedSendto (int fd, void *buf, size_t len, int flags, struct sockaddr *addr, int addrlen)
-{
-    int r;
-
-    DBG(   printf("threadedSendto\n");          )
-
-#if defined(BLOCKING_CALLS)
-    blockOnFile(fd, TH_WRITE);
-#endif
-    for (;;)
-    {
-       r = sendto(fd, buf, len, flags, addr, addrlen);
-       if (r < 0
-           && (errno == EAGAIN || errno == EWOULDBLOCK
-               || errno == EINTR))
-       {
-           blockOnFile(fd, TH_WRITE);
-           continue;
-       }
-       return (r);
-    }
-}
-
-/*
- * An attempt to access a file would block, so suspend the thread until
- * it will happen.
- */
-void
-blockOnFile(int fd, int op)
-{
-DBG(   printf("blockOnFile()\n");                                      )
-
-    intsDisable();
-
-    if (fd > maxFd)
-    {
-       maxFd = fd;
-    }
-
-    if (op == TH_READ)
-    {
-       FD_SET(fd, &readsPending);
-       suspendOnQThread(currentThread, &readQ[fd]);
-       FD_CLR(fd, &readsPending);
-    }
-    else
-    {
-       FD_SET(fd, &writesPending);
-       suspendOnQThread(currentThread, &writeQ[fd]);
-       FD_CLR(fd, &writesPending);
-    }
-
-    intsRestore();
-}
-
-/*
- * Check if some file descriptor or other event to become ready.
- * Block if required (but make sure we can still take timer interrupts).
- */
-void
-checkEvents(bool block)
-{
-    int r;
-    fd_set rd;
-    fd_set wr;
-    thread* tid;
-    thread* ntid;
-    int i;
-    s8 time = -1;
-    struct timeval tv;
-    struct timeval *timeout;
-
-    assert(blockInts > 0);
-
-    DBG( printf("checkEvents block:%d\n", block); )
-
-    if (sleepThreads != 0)
-    {
-       time = currentTime();
-       while (sleepThreads != 0 && time >= CONTEXT(sleepThreads).time)
-       {
-           tid = sleepThreads;
-           sleepThreads = sleepThreads->vmThread->next;
-           tid->vmThread->next = 0;
-
-           iresumeThread(tid);
-       }
-    }
-
-    if (block)
-    {
-       if (sleepThreads != 0)
-       {
-           s8 wait_time = CONTEXT(sleepThreads).time - time;
-
-           tv.tv_sec = wait_time / 1000;
-           tv.tv_usec = (wait_time % 1000) * 1000;
-           timeout = &tv;
-       }
-       else
-           timeout = 0;
-    }
-    else
-    {
-       tv.tv_sec = 0;
-       tv.tv_usec = 0;
-       timeout = &tv;
-    }
-
-#if defined(FD_COPY)
-    FD_COPY(&readsPending, &rd);
-    FD_COPY(&writesPending, &wr);
-#else
-    memcpy(&rd, &readsPending, sizeof(rd));
-    memcpy(&wr, &writesPending, sizeof(wr));
-#endif
-
-    r = select(maxFd+1, &rd, &wr, 0, timeout);
-
-    /* We must be holding off interrupts before we start playing with
-     * the read and write queues.  This should be already done but a
-     * quick check never hurt anyone.
-     */
-    assert(blockInts > 0);
-
-    DBG( printf("Select returns %d\n", r); )
-
-    /* Some threads may have finished sleeping.
-     */
-    if (block && sleepThreads != 0)
-    {
-       time = currentTime();
-       while (sleepThreads != 0 && time >= CONTEXT(sleepThreads).time)
-       {
-           tid = sleepThreads;
-           sleepThreads = sleepThreads->vmThread->next;
-           tid->vmThread->next = 0;
-
-           iresumeThread(tid);
-       }
-    }
-
-    for (i = 0; r > 0 && i <= maxFd; i++)
-    {
-       if (readQ[i] != 0 && FD_ISSET(i, &rd))
-       {
-           for (tid = readQ[i]; tid != 0; tid = ntid)
-           {
-               ntid = tid->vmThread->next;
-               iresumeThread(tid);
-           }
-           readQ[i] = 0;
-           r--;
-       }
-       if (writeQ[i] != 0 && FD_ISSET(i, &wr))
-       {
-           for (tid = writeQ[i]; tid != 0; tid = ntid)
-           {
-               ntid = tid->vmThread->next;
-               iresumeThread(tid);
-           }
-           writeQ[i] = 0;
-           r--;
-       }
-    }
-}
-
-
-/*
- * 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:
- */
diff --git a/src/threads/green/threadio.h b/src/threads/green/threadio.h
deleted file mode 100644 (file)
index e95dd08..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- c -*- */
-
-#ifndef __threadio_h_
-#define __threadio_h_
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include "global.h"
-
-#ifdef USE_THREADS
-int threadedFileDescriptor(int fd);
-int threadedSocket(int af, int type, int proto);
-int threadedOpen(char* path, int flags, int mode);
-int threadedConnect(int fd, struct sockaddr* addr, int len);
-int threadedAccept(int fd, struct sockaddr* addr, int* len);
-int threadedRead(int fd, char* buf, int len);
-int threadedWrite(int fd, char* buf, int len);
-int threadedRecvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr *addr, int *addrlen);
-int threadedSendto(int fd, void *buf, size_t len, int flags, struct sockaddr *addr, int addrlen);
-#else
-#define threadedFileDescriptor(fd)
-#define threadedRead(fd,buf,len)          read(fd,buf,len)
-#define threadedWrite(fd,buf,len)         write(fd,buf,len)
-#define threadedSocket(af,type,proto)     socket(af,type,proto)
-#define threadedAccept(fd,addr,len)       accept(fd,addr,len)
-#define threadedRecvfrom(fd,buf,len,flags,addr,addrlen) recvfrom(fd,buf,len,flags,addr,addrlen)
-#define threadedSendto(fd,buf,len,flags,addr,addrlen) sendto(fd,buf,len,flags,addr,addrlen)
-#define threadedConnect(fd,addr,len)      connect(fd,addr,len)
-#endif
-
-
-#endif
diff --git a/src/threads/green/threads.c b/src/threads/green/threads.c
deleted file mode 100644 (file)
index f9e5cf9..0000000
+++ /dev/null
@@ -1,926 +0,0 @@
-/* -*- mode: c; tab-width: 4; c-basic-offset: 4 -*- */
-/*
- * thread.c
- * Thread support.
- *
- * Copyright (c) 1996 T. J. Wilkinson & Associates, London, UK.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <sys/mman.h>                   /* for mprotect */
-#include <unistd.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <time.h>
-#include <errno.h>
-
-#include "config.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;
-
-thread* currentThread = NULL;
-thread* mainThread;
-thread* threadQhead[MAX_THREAD_PRIO + 1];
-thread* threadQtail[MAX_THREAD_PRIO + 1];
-
-thread* liveThreads = NULL;
-thread* sleepThreads = NULL;
-
-int blockInts;
-bool needReschedule;
-
-vmthread *contexts[MAXTHREADS];
-
-/* Number of threads alive, also counting daemons */
-static int talive;
-
-/* Number of daemon threads alive */
-static int tdaemon;
-
-static void firstStartThread(void);
-
-void reschedule(void);
-
-/* Setup default thread stack size - this can be overwritten if required */
-int threadStackSize = THREADSTACKSIZE;
-
-/* Pointer to the stack of the last killed thread. The free is delayed. */
-void *stack_to_be_freed = 0;
-
-static thread* startDaemon(void* func, char* nm, int stackSize);
-
-
-
-java_objectheader *init_vmthread(void *thr)
-{
-        methodinfo *m;
-        java_objectheader *o;
-               classinfo *c;
-               
-               if (!load_class_bootstrap(utf_new_char("java/lang/VMThread"),&c))
-                       return *exceptionptr;
-
-        o = builtin_new(c);          /* create object          */
-
-        if (!o)
-                return NULL;
-
-        /* find initializer */
-
-        m = class_findmethod(c,
-                                                 utf_new_char("<init>"),
-                                                 utf_new_char("(Ljava/lang/Thread;)V"));
-
-        if (!m) {                                       /* initializer not found  */
-                if (opt_verbose) {
-                        char logtext[MAXLOGTEXT];
-                        sprintf(logtext, "Warning: class has no instance-initializer: ");
-                        utf_sprint_convert_to_latin1_classname(logtext + strlen(logtext), c->name);
-                        log_text(logtext);
-                }
-                return o;
-        }
-
-        /* call initializer */
-
-        asm_calljavafunction(m, o, thr, NULL, NULL);
-       return o;
-}
-
-
-
-
-/*
- * Allocate the stack for a thread
- */
-void
-allocThreadStack (thread *tid, int size)
-{
-    int pageSize = getpagesize();
-    unsigned long pageBegin;
-
-       assert(stack_to_be_freed == 0);
-
-    CONTEXT(tid).stackMem = GCNEW_UNCOLLECTABLE(u1, size + 4 * pageSize);
-    assert(CONTEXT(tid).stackMem != 0);
-    CONTEXT(tid).stackEnd = CONTEXT(tid).stackMem + size + 2 * pageSize;
-    
-    pageBegin = (unsigned long)(CONTEXT(tid).stackMem) + pageSize - 1;
-    pageBegin = pageBegin - pageBegin % pageSize;
-
-    CONTEXT(tid).stackBase = (u1*)pageBegin + pageSize;
-}
-
-/*
- * Mark the stack for a thread to be freed. We cannot free the stack
- * immediately because it is still in use!
- */
-void
-freeThreadStack (vmthread *vmtid)
-{
-    if (!(vmtid->flags & THREAD_FLAGS_NOSTACKALLOC))
-    {
-               int pageSize = getpagesize();
-               unsigned long pageBegin;
-
-               pageBegin = (unsigned long)(vmtid->stackMem) + pageSize - 1;
-               pageBegin = pageBegin - pageBegin % pageSize;
-
-               assert(stack_to_be_freed == 0);
-
-               stack_to_be_freed = vmtid->stackMem;
-    }
-    vmtid->stackMem = 0;
-    vmtid->stackBase = 0;
-    vmtid->stackEnd = 0;
-}
-
-/*
- * Initialize threads.
- */
-void
-initThreads(u1 *stackbottom)
-{
-       classinfo *c;
-       thread *the_main_thread;
-    int i;
-       char mainname[] = "main";
-       /*int len = strlen(mainname);*/
-
-       signal(SIGPIPE, SIG_IGN);
-
-    lock_init();
-
-    for (i = 0; i < MAXTHREADS; ++i) {
-               contexts[i]=0;
-       }
-
-    /* Allocate a thread to be the main thread */
-       if (!load_class_bootstrap(utf_new_char("java/lang/Thread"),&c)) {
-               log_text("Could not load java/lang/Thread");
-               assert(0);
-       }
-
-    liveThreads = the_main_thread = 
-        (thread *) builtin_new(c);
-    the_main_thread->vmThread=init_vmthread(the_main_thread);
-    assert(the_main_thread != 0);
-    
-/*    the_main_thread->PrivateInfo = 1;
-    CONTEXT(the_main_thread).free = false;*/
-
-#if 0
-    {
-       /* stefan */
-       methodinfo *m;
-       m = class_fetchmethod(
-                       class_java_lang_String,
-                       utf_new_char ("toCharArray"),
-                       utf_new_char ("()[C")
-                       );
-printf("DEADCODE LIVES ?????????\n");fflush(stdout);
-       the_main_thread->name = asm_calljavafunction (m, javastring_new(utf_new_char("main")), 0, 0, 0);
-    }
-#endif
-       the_main_thread->name=javastring_new(utf_new_char(mainname));
-/*     the_main_thread->name = builtin_newarray_char(len);
-       {   u2 *d = the_main_thread->name->data;
-               for (i=0; i<len; i++)
-                       d[i] = mainname[i];
-       }*/
-
-    the_main_thread->priority = NORM_THREAD_PRIO;
-    CONTEXT(the_main_thread).priority = (u1)the_main_thread->priority;
-    CONTEXT(the_main_thread).texceptionptr = 0;
-    the_main_thread->vmThread->next = 0;
-    CONTEXT(the_main_thread).status = THREAD_SUSPENDED;
-    CONTEXT(the_main_thread).stackBase = CONTEXT(the_main_thread).stackEnd = stackbottom;
-    THREADINFO(&CONTEXT(the_main_thread));
-
-    DBG( printf("main thread %p base %p end %p\n", 
-                               the_main_thread,
-                               CONTEXT(the_main_thread).stackBase,
-                               CONTEXT(the_main_thread).stackEnd); );
-
-       CONTEXT(the_main_thread).flags = THREAD_FLAGS_NOSTACKALLOC;
-       CONTEXT(the_main_thread).nextlive = 0;
-       /*CONTEXT(the_main_thread).thread = the_main_thread;*/
-       /*the_main_thread->single_step = 0;*/
-       the_main_thread->daemon = 0;
-       /*the_main_thread->stillborn = 0;*/
-       /*the_main_thread->target = 0;*/
-
-       the_main_thread->contextClassLoader = 0;
-       /*the_main_thread->inheritedAccessControlContext = 0;*/
-       /*the_main_thread->values = 0;*/
-
-       /* Allocate and init ThreadGroup */
-       the_main_thread->group =
-        (threadGroup *) native_new_and_init(class_load(class_new(utf_new_char("java/lang/ThreadGroup"))));
-       assert(the_main_thread->group != 0);
-
-       talive++;
-
-       /* Load exception classes */
-/*      loader_load_sysclass(&class_java_lang_ThreadDeath, */
-/*                           utf_new_char("java/lang/ThreadDeath")); */
-    class_java_lang_ThreadDeath =
-        class_load(class_new(utf_new_char("java/lang/ThreadDeath")));
-
-       DBG( fprintf(stderr, "finishing initThreads\n"); );
-
-    mainThread = currentThread = the_main_thread;
-       contexts[0]=mainThread->vmThread;
-       /* Add thread into runQ */
-       iresumeThread(mainThread);
-
-       assert(blockInts == 0);
-}
-
-/*
- * Start a new thread running.
- */
-void
-startThread (thread* tid)
-{
-    int i;
-
-    /* Allocate a stack context */
-    for (i = 0; i < MAXTHREADS; ++i)
-               if (contexts[i]==0)
-                       break;
-
-       if (i == MAXTHREADS) {
-               log_text("Too many threads");
-               assert(0);
-       }
-
-       assert(tid->priority >= MIN_THREAD_PRIO && tid->priority <= MAX_THREAD_PRIO);
-       contexts[i]=tid->vmThread;
-/*    tid->PrivateInfo = i + 1;
-    CONTEXT(tid).free = false;*/
-    if (tid->vmThread==0) {
-               log_text("vmThread field not set");
-               assert(0);
-/*     tid->vmThread=init_vmthread(tid);*/
-    }
-
-/*     CONTEXT(tid).thread = tid;*/
-    CONTEXT(tid).nextlive = liveThreads;
-    liveThreads = tid;
-    allocThreadStack(tid, threadStackSize);
-    CONTEXT(tid).usedStackTop = CONTEXT(tid).stackBase;
-    CONTEXT(tid).flags = THREAD_FLAGS_GENERAL;
-    CONTEXT(tid).status = THREAD_SUSPENDED;
-    CONTEXT(tid).priority = (u1)tid->priority;
-    CONTEXT(tid).texceptionptr = 0;
-
-    /* Construct the initial restore point. */
-    THREADINIT((&CONTEXT(tid)), firstStartThread);
-
-    DBG( printf("new thread %p base %p end %p\n",
-                               tid, CONTEXT(tid).stackBase,
-                               CONTEXT(tid).stackEnd); );
-
-       talive++;
-       if (tid->daemon)
-               tdaemon++;
-
-       /* Add thread into runQ */
-       iresumeThread(tid);
-}
-
-
-/*
- * Start a daemon thread.
- */
-static thread *startDaemon(void* func, char* nm, int stackSize)
-{
-    thread* tid;
-    int i;
-
-    DBG( printf("startDaemon %s\n", nm); );
-
-       tid = (thread *) builtin_new(class_new(utf_new_char("java/lang/Thread")));
-       assert(tid != 0);
-
-/*     for (i = 0; i < MAXTHREADS; ++i)
-               if (contexts[i]==0)
-                       break;
-       if (i == MAXTHREADS)
-               panic("Too many threads");*/
-
-/*     tid->PrivateInfo = i + 1;
-       CONTEXT(tid).free = false;*/
-       tid->name = 0;          /* for the moment */
-       tid->priority = MAX_THREAD_PRIO;
-       CONTEXT(tid).priority = (u1)tid->priority;
-       tid->vmThread->next = 0;
-       CONTEXT(tid).status = THREAD_SUSPENDED;
-
-       allocThreadStack(tid, stackSize);
-       /*tid->single_step = 0;*/
-       tid->daemon = 1;
-       /*tid->stillborn = 0;*/
-       /*tid->target = 0;*/
-       tid->group = 0;
-
-       /* Construct the initial restore point. */
-       THREADINIT((&CONTEXT(tid)), func);
-
-       talive++;
-       tdaemon++;
-
-       return tid;
-}
-
-/*
- * All threads start here.
- */
-static void
-firstStartThread(void)
-{
-    methodinfo *method;
-
-    DBG( printf("firstStartThread %p\n", currentThread); );
-
-       if (stack_to_be_freed != 0)     {
-               stack_to_be_freed = 0;
-       }
-
-       /* Every thread starts with the interrupts off */
-       intsRestore();
-       assert(blockInts == 0);
-
-       /* Find the run()V method and call it */
-       method = class_findmethod(currentThread->vmThread->header.vftbl->class,
-                                                         utf_new_char("run"), utf_new_char("()V"));
-
-       if (method == 0) {
-               log_text("Cannot find method \'void run ()\'");
-               assert(0);
-       }
-
-       asm_calljavafunction(method, currentThread->vmThread, NULL, NULL, NULL);
-
-    if (*exceptionptr) {
-        utf_display_printable_ascii((*exceptionptr)->vftbl->class->name);
-        printf("\n");
-    }
-
-       killThread(0);
-       assert("Thread returned from killThread" == 0);
-}
-
-/*
- * Resume a thread running.
- * This routine has to be called only from locations which ensure
- * run / block queue consistency. There is no check for illegal resume
- * conditions (like explicitly resuming an IO blocked thread). There also
- * is no update of any blocking queue. Both has to be done by the caller
- */
-void
-iresumeThread(thread* tid)
-{
-       vmthread *vmctid;
-    DBG( printf("resumeThread %p\n", tid); );
-
-       intsDisable();
-       if (tid->vmThread==0) {
-               intsRestore();
-               return;
-       }
-       
-       if (currentThread->vmThread==0) {
-               long i1;
-               for (i1=0;i1<MAXTHREADS;i1++) {
-                       if (!contexts[i1]) continue;
-                       if (contexts[i1]->thread==currentThread) {
-                               vmctid=contexts[i1];
-                               break;
-                       }
-               }
-               if (i1==MAXTHREADS) vmctid=0; /*panic("Thread not found in iresumeThread");*/
-
-       } else {
-               vmctid=currentThread->vmThread;
-       }
-
-       if (CONTEXT(tid).status != THREAD_RUNNING)
-       {
-               CONTEXT(tid).status = THREAD_RUNNING;
-
-               DBG( fprintf(stderr, "prio is %d\n", CONTEXT(tid).priority); );
-
-               /* Place thread on the end of its queue */
-               if (threadQhead[CONTEXT(tid).priority] == 0) {
-                       threadQhead[CONTEXT(tid).priority] = tid;
-                       threadQtail[CONTEXT(tid).priority] = tid;
-                       
-                       if ((vmctid==0) ||  (CONTEXT(tid).priority
-                               > vmctid->priority) )
-                               needReschedule = true;
-               }
-               else
-               {
-                       threadQtail[CONTEXT(tid).priority]->vmThread->next = tid;
-                       threadQtail[CONTEXT(tid).priority] = tid;
-               }
-               tid->vmThread->next = 0;
-       }
-       SDBG( else { printf("Re-resuming %p\n", tid); } );
-
-       intsRestore();
-}
-
-/*
- * Yield process to another thread of equal priority.
- */
-void
-threads_yield()
-{
-    intsDisable();
-
-    if (threadQhead[CONTEXT(currentThread).priority]
-               != threadQtail[CONTEXT(currentThread).priority])
-    {
-               /* Get the next thread and move me to the end */
-               threadQhead[CONTEXT(currentThread).priority] = currentThread->vmThread->next;
-               threadQtail[CONTEXT(currentThread).priority]->vmThread->next = currentThread;
-               threadQtail[CONTEXT(currentThread).priority] = currentThread;
-               currentThread->vmThread->next = 0;
-               needReschedule = true;
-    }
-
-    intsRestore();
-}
-
-/*
- * Explicit request by user to resume a thread
- * The definition says that it is just legal to call this after a preceeding
- * suspend (which got through). If the thread was blocked for some other
- * reason (either sleep or IO or a muxSem), we simply can't do it
- * We use a new thread flag THREAD_FLAGS_USER_SUSPEND for this purpose
- * (which is set by suspendThread(.))
- */
-void
-resumeThread (thread* tid)
-{
-    if ((CONTEXT(tid).flags & THREAD_FLAGS_USER_SUSPEND) != 0)
-    {
-               intsDisable();
-               CONTEXT(tid).flags &= ~THREAD_FLAGS_USER_SUSPEND;
-               iresumeThread(tid);
-               intsRestore();
-    }
-}
-
-/*
- * Suspend a thread.
- * This is an explicit user request to suspend the thread - the counterpart
- * for resumeThreadRequest(.). It is JUST called by the java method
- * Thread.suspend()
- * What makes it distinct is the fact that the suspended thread is not contained
- * in any block queue. Without a special flag (indicating the user suspend), we
- * can't check s suspended thread for this condition afterwards (which is
- * required by resumeThreadRequest()). The new thread flag
- * THREAD_FLAGS_USER_SUSPEND is used for this purpose.
- */
-void
-suspendThread(thread* tid)
-{
-    thread** ntid;
-
-    intsDisable();
-
-    if (CONTEXT(tid).status != THREAD_SUSPENDED)
-    {
-               CONTEXT(tid).status = THREAD_SUSPENDED;
-               
-               /*
-                * This is used to indicate the explicit suspend condition
-                * required by resumeThreadRequest()
-                */
-               CONTEXT(tid).flags |= THREAD_FLAGS_USER_SUSPEND;
-
-               for (ntid = &threadQhead[CONTEXT(tid).priority];
-                        *ntid != 0;
-                        ntid = &(*ntid)->vmThread->next)
-               {
-                       if (*ntid == tid)
-                       {
-                               *ntid = tid->vmThread->next;
-                               tid->vmThread->next = 0;
-                               if (tid == currentThread)
-                               {
-                                       reschedule();
-                               }
-                               break;
-                       }
-               }
-    }
-       SDBG( else { printf("Re-suspending %p\n", tid); } );
-
-       intsRestore();
-}
-
-/*
- * Suspend a thread on a queue.
- */
-void
-suspendOnQThread(thread* tid, thread** queue)
-{
-    thread** ntid;
-
-       DBG( printf("suspendOnQThread %p %p\n", tid, queue); );
-
-       assert(blockInts > 0);
-
-       if (CONTEXT(tid).status != THREAD_SUSPENDED)
-       {
-               CONTEXT(tid).status = THREAD_SUSPENDED;
-
-               for (ntid = &threadQhead[CONTEXT(tid).priority];
-                        *ntid != 0;
-                        ntid = &(*ntid)->vmThread->next)
-               {
-                       if (*ntid == tid)
-                       {
-                               *ntid = tid->vmThread->next;
-                               /* Insert onto head of lock wait Q */
-                               tid->vmThread->next = *queue;
-                               *queue = tid;
-                               if (tid == currentThread)
-                               {
-                                       DBG( fprintf(stderr, "suspending %p (cur=%p) with prio %d\n",
-                                                                tid, currentThread, CONTEXT(tid).priority); );
-                                       reschedule();
-                               }
-                               break;
-                       }
-               }
-       }
-       SDBG( else { printf("Re-suspending %p on %p\n", tid, *queue); } );
-}
-
-/*
- * Kill thread.
- */
-void
-killThread(thread* tid)
-{
-    vmthread *context;
-    thread** ntid;
-
-    intsDisable();
-
-    /* A null tid means the current thread */
-    if (tid == 0)
-    {
-               tid = currentThread;
-    }
-
-       if (tid->vmThread==0) {
-               long i1;
-               for (i1=0;i1<MAXTHREADS;i1++) {
-                       if (!contexts[i1]) continue;
-                       if (contexts[i1]->thread==tid) {
-                               context=contexts[i1];
-                               break;
-                       }
-               }
-               if (i1==MAXTHREADS) {
-                       log_text("Thread not found in killThread");
-                       assert(0);
-               }
-
-       } else context=tid->vmThread;
-
-       DBG( printf("killThread %p\n", tid); );
-
-       if (context->status != THREAD_DEAD)
-       {
-               /* Get thread off runq (if it needs it) */
-               if (context->status == THREAD_RUNNING)
-               {
-                       for (ntid = &threadQhead[context->priority];
-                                *ntid != 0;
-                                ntid = &(*ntid)->vmThread->next)
-                       {
-                               if (*ntid == tid)
-                               {
-                                       *ntid = context->next;
-                                       break;
-                               }
-                       }
-               }
-
-               context->status = THREAD_DEAD;
-               talive--;
-               if (tid->daemon) {
-                       tdaemon--;
-               }
-
-               /* If we only have daemons left, then everyone is dead. */
-               if (talive == tdaemon) {
-                       /* atexit functions get called to clean things up */
-                       intsRestore();
-                       exit(0);
-               }
-
-               /* Notify on the object just in case anyone is waiting */
-               internal_lock_mutex_for_object(&tid->header);
-               internal_lock_notify_all_object(&tid->header);
-               internal_unlock_mutex_for_object(&tid->header);
-
-               /* Remove thread from live list to it can be garbaged */
-               for (ntid = &liveThreads;
-                        *ntid != 0;
-                        ntid = &(CONTEXT((*ntid)).nextlive))
-               {
-                       if (tid == (*ntid))
-                       {
-                               (*ntid) = context->nextlive;
-                               break;
-                       }
-               }
-
-
-               /* Free stack */
-               freeThreadStack(context);
-
-               /* free context */
-               if (tid != mainThread)
-               {
-                       long i;
-                       for (i=0;i<MAXTHREADS;i++) {
-                               if (!contexts[i]) continue;
-                               if (contexts[i]==context) {
-                                       contexts[i]=0;
-                                       break;
-                               }
-                       }
-               }
-/*             if (tid != mainThread) {
-                       CONTEXT(tid).free = true;
-                       CONTEXT(tid).thread = NULL;
-               }*/
-
-               /* Run something else */
-               needReschedule = true;
-       }
-               for (ntid = &sleepThreads;
-                        *ntid != 0;
-                        ntid = &(CONTEXT((*ntid)).next))
-               {
-                       if (tid == (*ntid))
-                       {
-                               (*ntid) = context->next;
-                               break;
-                       }
-               }
-
-       intsRestore();
-}
-
-/*
- * Change thread priority.
- */
-void
-threads_java_lang_Thread_set_priority(thread* tid, int prio)
-{
-    thread** ntid;
-
-       assert(prio >= MIN_THREAD_PRIO && prio <= MAX_THREAD_PRIO);
-
-#warning fixme ??
-/*    if (tid->PrivateInfo == 0) {
-               tid->priority = prio;
-               return;
-    }*/
-
-    if (CONTEXT(tid).status == THREAD_SUSPENDED) {
-               CONTEXT(tid).priority = (u8)prio;
-               return;
-    }
-
-    intsDisable();
-
-    /* Remove from current thread list */
-    for (ntid = &threadQhead[CONTEXT(tid).priority]; *ntid != 0; ntid = &(*ntid)->vmThread->next) {
-               if (*ntid == tid) {
-                       *ntid = tid->vmThread->next;
-                       break;
-               }
-    }
-
-    /* Insert onto a new one */
-    tid->priority = prio;
-    CONTEXT(tid).priority = (u8)tid->priority;
-    if (threadQhead[prio] == 0) {
-               threadQhead[prio] = tid;
-               threadQtail[prio] = tid;
-               if (prio > CONTEXT(currentThread).priority) {
-                       needReschedule = true;
-               }
-    }
-    else {
-               threadQtail[prio]->vmThread->next = tid;
-               threadQtail[prio] = tid;
-    }
-    tid->vmThread->next = 0;
-
-    intsRestore();
-}
-
-/*
- * Get the current time in milliseconds since 1970-01-01.
- */
-s8
-currentTime (void)
-{
-       struct timeval tv;
-       s8 time;
-
-       gettimeofday(&tv, 0);
-
-       time = tv.tv_sec;
-       time *= 1000;
-       time += tv.tv_usec / 1000;
-
-       return time;
-}
-
-/*
- * Put a thread to sleep.
- */
-void
-sleepThread(s8 time, s4 nanos)
-{
-    thread** tidp;
-
-    /* Sleep for no time */
-    if (time <= 0) {
-               return;
-    }
-    
-    intsDisable();
-
-    /* Get absolute time */
-    CONTEXT(currentThread).time = time + currentTime();
-
-    /* Find place in alarm list */
-    for (tidp = &sleepThreads; (*tidp) != 0; tidp = &((*tidp)->vmThread->next))
-       {
-               if (CONTEXT((*tidp)).time > CONTEXT(currentThread).time)
-                       break;
-    }
-
-    /* Suspend thread on it */
-    suspendOnQThread(currentThread, tidp);
-    
-    intsRestore();
-}
-
-/*
- * Is this thread alive?
- */
-bool
-aliveThread(thread* tid)
-{
-    if (tid!=mainThread  && CONTEXT(tid).status != THREAD_DEAD)
-               return (true);
-    else
-               return (false);
-}
-
-/*
- * Reschedule the thread.
- * Called whenever a change in the running thread is required.
- */
-void
-reschedule(void)
-{
-    int i;
-    thread* lastThread;
-    int b;
-    /*    sigset_t nsig; */
-
-    /* A reschedule in a non-blocked context is half way to hell */
-    assert(blockInts > 0);
-    b = blockInts;
-    
-    /* Check events - we may release a high priority thread */
-    /* Just check IO, no need for a reschedule call by checkEvents() */
-    needReschedule = false;
-    checkEvents(false);
-
-    for (;;)
-    {
-               for (i = MAX_THREAD_PRIO; i >= MIN_THREAD_PRIO; i--)
-               {
-                       if (threadQhead[i] != 0)
-                       {
-                               DBG( fprintf(stderr, "found thread %p in head %d\n", threadQhead[i], i); );
-
-                               if (threadQhead[i] != currentThread)
-                               {
-                                       /* USEDSTACKTOP((CONTEXT(currentThread).usedStackTop)); */
-
-                                       lastThread = currentThread;
-                                       currentThread = threadQhead[i];
-
-                                       CONTEXT(currentThread).texceptionptr = *exceptionptr;
-
-                    DBG( fprintf(stderr, "thread switch from: %p to: %p\n", lastThread, currentThread); );
-                                       {
-                                       THREADSWITCH((&CONTEXT(currentThread)),
-                                                                (&CONTEXT(lastThread)));
-                                       }
-                                       blockInts = b;
-
-                                       *exceptionptr = CONTEXT(currentThread).texceptionptr;
-
-                                       if (stack_to_be_freed != 0) {
-                                               stack_to_be_freed = 0;
-                                       }
-
-                                       /* Alarm signal may be blocked - if so
-                                        * unblock it.
-                                        */
-                                       /*
-                                         if (alarmBlocked == true) {
-                                         alarmBlocked = false;
-                                         sigemptyset(&nsig);
-                                         sigaddset(&nsig, SIGALRM);
-                                         sigprocmask(SIG_UNBLOCK, &nsig, 0);
-                                         }
-                                       */
-
-                                       /* I might be dying */
-                                       if ((CONTEXT(lastThread).flags & THREAD_FLAGS_KILLED)
-                                               != 0)
-                                       {
-                                               CONTEXT(lastThread).flags &= ~THREAD_FLAGS_KILLED;
-                                               *exceptionptr = native_new_and_init(class_java_lang_ThreadDeath);
-                                       }
-                               }
-                               /* Now we kill the schedule and turn ints
-                                  back on */
-                               needReschedule = false;
-                               return;
-                       }
-               }
-               /* Nothing to run - wait for external event */
-               DBG( fprintf(stderr, "nothing more to do\n"); );
-               checkEvents(true);
-    }
-}
-
-void lock_stopworld(int dummy)
-{
-}
-
-void unlock_stopworld()
-{
-}
-
-void cacao_suspendhandler(void *ctx)
-{
-}
-
-
-/*
- * 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:
- */
diff --git a/src/threads/green/threads.h b/src/threads/green/threads.h
deleted file mode 100644 (file)
index 5465d6a..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-/* -*- mode: c; tab-width: 4; c-basic-offset: 4 -*- */
-/*
- * thread.h
- * Thread support.
- *
- * Copyright (c) 1996 T. J. Wilkinson & Associates, London, UK.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
- */
-
-
-#ifndef _THREADS_H
-#define _THREADS_H
-
-#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"
-
-
-#define        THREADCLASS         "java/lang/Thread"
-#define        THREADGROUPCLASS    "java/lang/ThreadGroup"
-#define        THREADDEATHCLASS    "java/lang/ThreadDeath"
-
-#define        MIN_THREAD_PRIO         1
-#define        NORM_THREAD_PRIO        5
-#define        MAX_THREAD_PRIO         10
-
-#define        THREAD_SUSPENDED        0
-#define        THREAD_RUNNING          1
-#define        THREAD_DEAD             2
-#define        THREAD_KILL             3
-
-#define        THREAD_FLAGS_GENERAL            0
-#define        THREAD_FLAGS_NOSTACKALLOC       1
-#define THREAD_FLAGS_USER_SUSPEND       2  /* Flag explicit suspend() call */
-#define        THREAD_FLAGS_KILLED             4
-
-#define THREADSPECIFIC
-
-#define MAXTHREADS              256          /* schani */
-
-#if 1
-#define DBG(s)
-#define SDBG(s)
-#else
-#define DBG(s)                 s
-#define SDBG(s)                s
-#endif
-
-struct _thread;
-
-#if 0
-typedef struct _ctx
-{
-    struct _thread    *thread;
-    bool               free;
-    u1                 status;
-    u1                 priority;
-    u1*                restorePoint;
-    u1*                stackMem;           /* includes guard page */
-    u1*                stackBase;
-    u1*                stackEnd;
-    u1*                usedStackTop;
-    s8                 time;
-    java_objectheader *texceptionptr;
-    struct _thread    *nextlive;
-    u1                 flags;
-} ctx;
-#endif
-
-/*
-struct _stringClass;
-struct _object;
-*/
-
-/* This structure mirrors java.lang.ThreadGroup.h */
-
-typedef struct _threadGroup {
-   java_objectheader header;
-   struct _threadGroup* parent;
-   struct java_objectheader* name;
-   struct java_objectheader* threads;
-   struct java_objectheader* groups;
-   s4 daemon_flag;
-   s4 maxpri;
-} threadGroup;
-
-
-typedef struct thread thread;
-typedef struct vmthread vmthread;
-
-/* This structure mirrors java.lang.Thread.h */
-
-struct thread {
-   java_objectheader      header;
-   vmthread              *vmThread;
-   threadGroup           *group;
-   struct java_lang_Runnable* runnable;
-   java_lang_String      *name;
-   s4                     daemon;
-   s4                     priority;
-   s8                     stacksize;
-   java_lang_Throwable   *stillborn;
-   java_lang_ClassLoader *contextClassLoader;
-};
-
-
-/* This structure mirrors java.lang.VMThread.h */
-
-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
-};
-
-
-extern int blockInts;
-extern bool needReschedule;
-extern thread *currentThread;
-extern thread *mainThread;
-/*extern ctx contexts[];*/
-extern int threadStackSize;
-
-extern thread *liveThreads;
-extern thread *sleepThreads;
-
-extern thread *threadQhead[MAX_THREAD_PRIO + 1];
-
-
-/*#define CONTEXT(_t)     (contexts[(_t)->PrivateInfo - 1])*/
-#define CONTEXT(_t)    (*(_t->vmThread))
-
-#define        intsDisable()   blockInts++
-
-#define        intsRestore()   if (blockInts == 1 && needReschedule) { \
-                            reschedule(); \
-                        } \
-                        blockInts--
-
-
-/* access macros */
-
-#define        THREADSTACKSIZE         (32 * 1024)
-
-#define        THREADSWITCH(to, from) \
-    do { \
-       void *from1; \
-       void *from2; \
-        asm_perform_threadswitch((from?&(from)->restorePoint:&from1),\
-                                 &(to)->restorePoint, (from?&(from)->usedStackTop:&from2)); \
-    } while (0)
-
-
-#define THREADINIT(to, func) \
-    do { \
-        (to)->restorePoint = asm_initialize_thread_stack((u1*)(func), \
-                                                         (to)->stackEnd); \
-    } while (0)
-
-
-#define        THREADINFO(e) \
-    do { \
-        (e)->restorePoint = 0; \
-        (e)->flags = THREAD_FLAGS_NOSTACKALLOC; \
-    } while(0)
-
-
-/* function prototypes ********************************************************/
-
-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 threads_yield (void);
-void killThread (thread*);
-void threads_java_lang_Thread_set_priority (thread*, int);
-
-s8 currentTime (void);
-void sleepThread(s8 millis, s4 nanos);
-bool aliveThread (thread*);
-long framesThread (thread*);
-
-void reschedule (void);
-
-void checkEvents (bool block);
-
-#endif /* _THREADS_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 ec7c2cd98ec62a35ca5a55e54c163b8eb64efe60..c9946172549c4948ce21117b3e01f921aee57f03 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Christian Thalinger
                        Edwin Steiner
 
-   $Id: threads.c 4919 2006-05-15 12:23:13Z twisti $
+   $Id: threads.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -724,7 +724,7 @@ void threads_preinit(void)
 
 *******************************************************************************/
 
-bool threads_init(u1 *stackbottom)
+bool threads_init(void)
 {
        java_lang_String      *threadname;
        java_lang_Thread      *mainthread;
index 64675696a30d7c4399775e0c9f9df400d0a1632e..a4f0eaf1a9e0c57c7a3f2e640661198cbcc41a3a 100644 (file)
@@ -29,7 +29,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: threads.h 4919 2006-05-15 12:23:13Z twisti $
+   $Id: threads.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -188,7 +188,7 @@ void threads_sem_post(sem_t *sem);
 threadobject *threads_get_current_threadobject(void);
 
 void threads_preinit(void);
-bool threads_init(u1 *stackbottom);
+bool threads_init(void);
 
 void threads_init_threadobject(java_lang_VMThread *);
 
index 7933ad2e54045a0cbbf9e4a8f5194b6d04b7602a..3b5c4678ae659d3f4aff82cd19e8f2f9feefb910 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: avl.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: avl.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "mm/memory.h"
 #include "toolbox/avl.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "vm/builtin.h"
@@ -69,14 +65,12 @@ avl_tree *avl_create(avl_comparator *compar)
        t->comparator = compar;
        t->entries    = 0;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* create lock object for this tree */
 
        t->lock       = NEW(java_objectheader);
 
-# if defined(NATIVE_THREADS)
        lock_init_object_lock(t->lock);
-# endif
 #endif
 
        return t;
@@ -325,7 +319,7 @@ bool avl_insert(avl_tree *tree, void *data)
        assert(tree);
        assert(data);
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorenter(tree->lock);
 #endif
 
@@ -350,7 +344,7 @@ bool avl_insert(avl_tree *tree, void *data)
        printf("-------------------\n");
 #endif
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorexit(tree->lock);
 #endif
 
@@ -375,7 +369,7 @@ void *avl_find(avl_tree *tree, void *data)
        assert(tree);
        assert(data);
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorenter(tree->lock);
 #endif
 
@@ -389,7 +383,7 @@ void *avl_find(avl_tree *tree, void *data)
                /* was the entry found? return it */
 
                if (res == 0) {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        builtin_monitorexit(tree->lock);
 #endif
 
@@ -401,7 +395,7 @@ void *avl_find(avl_tree *tree, void *data)
                node = node->childs[(res < 0) ? AVL_LEFT : AVL_RIGHT];
        }
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorexit(tree->lock);
 #endif
 
index 7bb76458b25a681dfd353c5f263b8af47db63ced..b73b9b873ce8085a29dad507c4737cb7bf6a6b7a 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: avl.h 4357 2006-01-22 23:33:38Z twisti $
+   $Id: avl.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -63,12 +63,12 @@ typedef struct avl_node avl_node;
 /* avl_tree *******************************************************************/
 
 struct avl_tree {
+#if defined(ENABLE_THREADS)
+       java_objectheader *lock;            /* threads lock object                */
+#endif
        avl_node          *root;            /* pointer to root node               */
        avl_comparator    *comparator;      /* pointer to comparison function     */
        s4                 entries;         /* contains number of entries         */
-#if defined(USE_THREADS)
-       java_objectheader *lock;            /* threads lock object                */
-#endif
 };
 
 
index 2e1a42c37bfa6420b9d6d65fdf12343d701479f3..6c9b411da9e65920b1578a8cfdd43cd4999c517c 100644 (file)
    Changes: Christian Thalinger
                        Edwin Steiner
 
-   $Id: logging.c 4886 2006-05-05 19:22:57Z edwin $
+   $Id: logging.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 
+#include "config.h"
+
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "vm/types.h"
 
 #include "mm/memory.h"
 #include "vm/global.h"
 #include "vm/statistics.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 
@@ -82,12 +81,12 @@ void log_init(const char *fname)
 void log_start(void)
 {
        if (logfile) {
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                fprintf(logfile, "[%p] ", (void *) THREADOBJECT);
 #endif
 
        } else {
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                fprintf(stdout, "LOG: [%p] ", (void *) THREADOBJECT);
 #else
                fputs("LOG: ", stdout);
index 0da821f732075288fcdd1d906c5125f0df984f49..ae613c83476c16875b097a2fd5b071df123aad3e 100644 (file)
@@ -37,7 +37,7 @@
    calls instead of machine instructions, using the C calling
    convention.
 
-   $Id: builtin.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: builtin.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "native/include/java_lang_Object.h"          /* required by VMObject */
 #include "native/include/java_lang_VMObject.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-#  include "threads/green/locks.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "toolbox/logging.h"
@@ -793,7 +788,7 @@ java_objectheader *builtin_new(classinfo *c)
 
        o->vftbl = c->vftbl;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        lock_init_object_lock(o);
 #endif
 
@@ -852,7 +847,7 @@ java_arrayheader *builtin_newarray(s4 size, classinfo *arrayclass)
 
        a->objheader.vftbl = arrayclass->vftbl;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        lock_init_object_lock(&a->objheader);
 #endif
 
@@ -1707,94 +1702,6 @@ void builtin_displaymethodstop(methodinfo *m, s8 l, double d, float f)
 #endif /* !defined(NDEBUG) */
 
 
-/****************************************************************************
-                        SYNCHRONIZATION FUNCTIONS
-*****************************************************************************/
-
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-/*
- * Lock the mutex of an object.
- */
-void internal_lock_mutex_for_object(java_objectheader *object)
-{
-       mutexHashEntry *entry;
-       int hashValue;
-
-       assert(object != 0);
-
-       hashValue = MUTEX_HASH_VALUE(object);
-       entry = &mutexHashTable[hashValue];
-
-       if (entry->object != 0) {
-               if (entry->mutex.count == 0 && entry->conditionCount == 0) {
-                       entry->object = 0;
-                       entry->mutex.holder = 0;
-                       entry->mutex.count = 0;
-                       entry->mutex.muxWaiters = 0;
-
-               } else {
-                       while (entry->next != 0 && entry->object != object)
-                               entry = entry->next;
-
-                       if (entry->object != object) {
-                               entry->next = firstFreeOverflowEntry;
-                               firstFreeOverflowEntry = firstFreeOverflowEntry->next;
-
-                               entry = entry->next;
-                               entry->object = 0;
-                               entry->next = 0;
-                               assert(entry->conditionCount == 0);
-                       }
-               }
-
-       } else {
-               entry->mutex.holder = 0;
-               entry->mutex.count = 0;
-               entry->mutex.muxWaiters = 0;
-       }
-
-       if (entry->object == 0)
-               entry->object = object;
-       
-       internal_lock_mutex(&entry->mutex);
-}
-#endif
-
-
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-/*
- * Unlocks the mutex of an object.
- */
-void internal_unlock_mutex_for_object (java_objectheader *object)
-{
-       int hashValue;
-       mutexHashEntry *entry;
-
-       hashValue = MUTEX_HASH_VALUE(object);
-       entry = &mutexHashTable[hashValue];
-
-       if (entry->object == object) {
-               internal_unlock_mutex(&entry->mutex);
-
-       } else {
-               while (entry->next != 0 && entry->next->object != object)
-                       entry = entry->next;
-
-               assert(entry->next != 0);
-
-               internal_unlock_mutex(&entry->next->mutex);
-
-               if (entry->next->mutex.count == 0 && entry->conditionCount == 0) {
-                       mutexHashEntry *unlinked = entry->next;
-
-                       entry->next = unlinked->next;
-                       unlinked->next = firstFreeOverflowEntry;
-                       firstFreeOverflowEntry = unlinked;
-               }
-       }
-}
-#endif
-
 #if defined(ENABLE_CYCLES_STATS)
 void builtin_print_cycles_stats(FILE *file)
 {
@@ -1809,27 +1716,13 @@ void builtin_print_cycles_stats(FILE *file)
 }
 #endif /* defined(ENABLE_CYCLES_STATS) */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 void builtin_monitorenter(java_objectheader *o)
 {
 #if defined(ENABLE_CYCLES_STATS)
        u8 cycles_start, cycles_overhead, cycles_end;
 #endif
 
-#if !defined(NATIVE_THREADS)
-       int hashValue;
-
-       ++blockInts;
-
-       hashValue = MUTEX_HASH_VALUE(o);
-       if (mutexHashTable[hashValue].object == o 
-               && mutexHashTable[hashValue].mutex.holder == currentThread)
-               ++mutexHashTable[hashValue].mutex.count;
-       else
-               internal_lock_mutex_for_object(o);
-
-       --blockInts;
-#else /* defined(NATIVE_THREADS) */
        CYCLES_STATS_GET(cycles_start);
        CYCLES_STATS_GET(cycles_overhead);
 
@@ -1838,12 +1731,11 @@ void builtin_monitorenter(java_objectheader *o)
        CYCLES_STATS_GET(cycles_end);
        CYCLES_STATS_COUNT(builtin_monitorenter, cycles_end - cycles_overhead);
        CYCLES_STATS_COUNT(builtin_overhead    , cycles_overhead - cycles_start);
-#endif /* defined(NATIVE_THREADS) */
 }
 #endif
 
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 /*
  * Locks the class object - needed for static synchronized methods.
  */
@@ -1854,38 +1746,19 @@ void builtin_staticmonitorenter(classinfo *c)
 #endif
 
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 void builtin_monitorexit(java_objectheader *o)
 {
 #if defined(ENABLE_CYCLES_STATS)
        u8 cycles_start, cycles_end;
 #endif
 
-#if !defined(NATIVE_THREADS)
-       int hashValue;
-
-       ++blockInts;
-
-       hashValue = MUTEX_HASH_VALUE(o);
-       if (mutexHashTable[hashValue].object == o) {
-               if (mutexHashTable[hashValue].mutex.count == 1
-                       && mutexHashTable[hashValue].mutex.muxWaiters != 0)
-                       internal_unlock_mutex_for_object(o);
-               else
-                       --mutexHashTable[hashValue].mutex.count;
-
-       } else
-               internal_unlock_mutex_for_object(o);
-
-       --blockInts;
-#else /* defined(NATIVE_THREADS) */
        CYCLES_STATS_GET(cycles_start);
 
        lock_monitor_exit((threadobject *) THREADOBJECT, o);
 
        CYCLES_STATS_GET(cycles_end);
        CYCLES_STATS_COUNT(builtin_monitorexit, cycles_end - cycles_start);
-#endif /* defined(NATIVE_THREADS) */
 }
 #endif
 
@@ -2705,7 +2578,7 @@ java_arrayheader *builtin_clone_array(void *env, java_arrayheader *o)
 
 *******************************************************************************/
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 java_objectheader **builtin_asm_get_exceptionptrptr(void)
 {
        return builtin_get_exceptionptrptr();
index 2cde3bb900aed00b23aba1d801d6e870eed4ba88..eed044fdb3b4a1c01eab5474806132f4e276f297 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Edwin Steiner
             Christian Thalinger
 
-   $Id: builtin.h 4913 2006-05-14 14:02:51Z edwin $
+   $Id: builtin.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "arch.h"
 #include "toolbox/logging.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "vm/jit/stacktrace.h"
@@ -192,7 +188,7 @@ void builtin_trace_args(s8 a0, s8 a1,
 void builtin_displaymethodstop(methodinfo *m, s8 l, double d, float f);
 /* NOT AN OP */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 void builtin_monitorenter(java_objectheader *o);
 #define BUILTIN_monitorenter (functionptr) builtin_monitorenter
 void builtin_staticmonitorenter(classinfo *c);
@@ -312,7 +308,7 @@ java_arrayheader *builtin_clone_array(void *env, java_arrayheader *o);
 /* this is a wrapper for calls from asmpart */
 java_objectheader **builtin_asm_get_exceptionptrptr(void);
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 static inline java_objectheader **builtin_get_exceptionptrptr(void);
 
 inline java_objectheader **builtin_get_exceptionptrptr(void)
index e6f4ca829e3f4664069a47ece66839af7eff4dcf..90b095e25cbccd32065b8b0dcbfb41107cf98f16 100644 (file)
 
    Changes:
 
-   $Id: builtintable.inc 4357 2006-01-22 23:33:38Z twisti $
+   $Id: builtintable.inc 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 
 #include "config.h"
+
 #include "arch.h"
+
 #include "vm/builtin.h"
 #include "vm/jit/jit.h"
 
@@ -218,7 +220,7 @@ static builtintable_entry builtintable_internal[] = {
                NULL
        },
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        {
                ICMD_MONITORENTER,
                BUILTIN_monitorenter,
index 885396b014c7a304a9175685af732ed140244680..cb296a06bceae1940ee44a83f111798eeb762e97 100644 (file)
@@ -31,7 +31,7 @@
             Christian Thalinger
                        Edwin Steiner
 
-   $Id: class.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: class.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 
 #include "mm/memory.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-#  include "threads/green/locks.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "toolbox/logging.h"
@@ -236,7 +231,7 @@ classinfo *class_create_classinfo(utf *classname)
        if (classname != utf_not_named_yet)
                class_set_packagename(c);
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        lock_init_object_lock(&c->object.header);
 #endif
 
index 2af4fdb4f3a60aa80f10a4b135b7a141ef479f72..bf4fb21004db71df70ef707042b7875ed9355b31 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: classcache.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: classcache.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -212,7 +212,7 @@ void classcache_print_statistics(FILE *file) {
        /*          NOT synchronized!              */
        /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 # define CLASSCACHE_LOCK()      builtin_monitorenter(lock_hashtable_classcache)
 # define CLASSCACHE_UNLOCK()    builtin_monitorexit(lock_hashtable_classcache)
 #else
@@ -226,7 +226,7 @@ void classcache_print_statistics(FILE *file) {
 
 hashtable hashtable_classcache;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 static java_objectheader *lock_hashtable_classcache;
 #endif
 
@@ -259,14 +259,12 @@ bool classcache_init(void)
 
        hashtable_create(&hashtable_classcache, CLASSCACHE_INIT_SIZE);
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* create utf hashtable lock object */
 
        lock_hashtable_classcache = NEW(java_objectheader);
 
-# if defined(NATIVE_THREADS)
        lock_init_object_lock(lock_hashtable_classcache);
-# endif
 #endif
 
        /* everything's ok */
index d2edfd2f4886c8cf2cd03648428df9db9af5d9bf..161879f16f30fc931c20f6ca5aa8a5f6c6c2cc27 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: exceptions.c 4879 2006-05-05 17:34:49Z edwin $
+   $Id: exceptions.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -62,7 +62,7 @@
 
 /* for raising exceptions from native methods *********************************/
 
-#if !defined(USE_THREADS) || !defined(NATIVE_THREADS)
+#if !defined(ENABLE_THREADS)
 java_objectheader *_no_threads_exceptionptr = NULL;
 #endif
 
@@ -1351,7 +1351,7 @@ u1 *exceptions_handle_exception(java_objectheader *xptr, u1 *xpc, u1 *pv, u1 *sp
        s4                     i;
        classref_or_classinfo  cr;
        classinfo             *c;
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        java_objectheader     *o;
 #endif
 
@@ -1439,7 +1439,7 @@ u1 *exceptions_handle_exception(java_objectheader *xptr, u1 *xpc, u1 *pv, u1 *sp
                }
        }
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* is this method synchronized? */
 
        if (issync) {
index 7c99f4ea19aa712ef7278fd74e930ff3f80f14bc..297408c190a2e702cdbc8811503e7d1777d8b061 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: exceptions.h 4690 2006-03-27 11:37:46Z twisti $
+   $Id: exceptions.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -51,13 +51,13 @@ typedef struct exceptionentry exceptionentry;
 #include "vm/method.h"
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 #define exceptionptr    builtin_get_exceptionptrptr()
 #else
 #define exceptionptr    &_no_threads_exceptionptr
 #endif
 
-#if !defined(USE_THREADS) || !defined(NATIVE_THREADS)
+#if !defined(ENABLE_THREADS)
 extern java_objectheader *_no_threads_exceptionptr;
 #endif
 
index 00b0e24ad374e1eebd332240ab77a09c5f0ab87a..00ad2ca206de9ebfe2f3946ebe52f9ffba52958b 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: finalizer.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: finalizer.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -54,7 +54,7 @@
 
 /* global variables ***********************************************************/
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 static java_lang_VMThread *finalizer_vmthread;
 static java_objectheader *lock_finalizer_thread;
 #endif
@@ -68,12 +68,10 @@ static java_objectheader *lock_finalizer_thread;
 
 bool finalizer_init(void)
 {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        lock_finalizer_thread = NEW(java_objectheader);
 
-# if defined(NATIVE_THREADS)
        lock_init_object_lock(lock_finalizer_thread);
-# endif
 #endif
 
        /* everything's ok */
@@ -90,7 +88,7 @@ bool finalizer_init(void)
 
 *******************************************************************************/
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 static void finalizer_thread(void)
 {
        while (true) {
@@ -120,7 +118,7 @@ static void finalizer_thread(void)
 
 *******************************************************************************/
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 bool finalizer_start_thread(void)
 {
        java_lang_Thread *t;
@@ -162,7 +160,7 @@ bool finalizer_start_thread(void)
 
 void finalizer_notify(void)
 {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* get the lock on the finalizer lock object, so we can call wait */
 
        builtin_monitorenter(lock_finalizer_thread);
index b6acb0eb3c6a67d9efc443582dd38dc650f502a9..dd6b02d27a83fe678256613fca22cbd3f00100be 100644 (file)
@@ -33,7 +33,7 @@
             Joseph Wenninger
             Christian Thalinger
 
-   $Id: global.h 4908 2006-05-12 16:49:50Z edwin $
+   $Id: global.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -88,13 +88,6 @@ typedef struct java_objectarray java_objectarray;
 #define CLASSPATH_LIBRARY_PATH      CLASSPATH_LIBDIR "/classpath"
 
 
-/* if we have threads disabled this one is not defined ************************/
-
-#if !defined(USE_THREADS)
-#define THREADSPECIFIC
-#endif
-
-
 #define MAX_ALIGN 8             /* most generic alignment for JavaVM values   */
 
 
@@ -204,7 +197,7 @@ typedef struct java_objectarray java_objectarray;
 
 struct java_objectheader {              /* header for all objects             */
        struct _vftbl            *vftbl;    /* pointer to virtual function table  */
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        struct lock_record_t *monitorPtr;
 #endif
 };
@@ -295,7 +288,7 @@ struct java_objectarray {
 
 /* Synchronization ************************************************************/
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void compiler_lock();
 void compiler_unlock();
 #endif
index aae8ee77817014255ccdca4ad031640076e54be5..a15d123018b1388c6c0161eb6060a7cdb3de11ea 100644 (file)
@@ -30,7 +30,7 @@
             Andreas Krall
             Christian Thalinger
 
-   $Id: hashtable.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: hashtable.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 
 #include "mm/memory.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "vm/hashtable.h"
@@ -60,8 +58,7 @@ void hashtable_create(hashtable *hash, u4 size)
 {
        /* initialize locking pointer */
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        /* We need to seperately allocate a java_objectheader here, as we
           need to store the lock object in the new hashtable if it's
           resized.  Otherwise we get an IllegalMonitorStateException. */
@@ -69,7 +66,6 @@ void hashtable_create(hashtable *hash, u4 size)
        hash->header = NEW(java_objectheader);
 
        lock_init_object_lock(hash->header);
-# endif
 #endif
 
        /* set initial hash values */
@@ -99,7 +95,7 @@ hashtable *hashtable_resize(hashtable *hash, u4 size)
 
        hashtable_create(newhash, size);
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* We need to store the old lock object in the new hashtable.
           Otherwise we get an IllegalMonitorStateException. */
 
@@ -120,6 +116,8 @@ hashtable *hashtable_resize(hashtable *hash, u4 size)
 
    Simply frees the hashtable.
 
+   ATTENTION: It does NOT free the lock object!
+
 *******************************************************************************/
 
 void hashtable_free(hashtable *hash)
index ee66cb9ef54c84ce4e6faf33389bccffa5f9476d..7f718c25860769d56baf8caaf5fdcb1768e765f6 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: hashtable.h 4900 2006-05-11 09:18:28Z twisti $
+   $Id: hashtable.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -100,7 +100,7 @@ hashtable.ptr-->+-------------------+
 /* hashtable ******************************************************************/
 
 struct hashtable {            
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        java_objectheader  *header;         /* required for locking               */
 #endif
        u4                  size;           /* current size of the hashtable      */
index ac3bd9d312cc1e88cd4160b534d5a31c0498793c..1833a459eac3133cf6de1546582150160c025b84 100644 (file)
@@ -30,7 +30,7 @@
             Andreas Krall
             Christian Thalinger
 
-   $Id: initialize.c 4559 2006-03-05 23:24:50Z twisti $
+   $Id: initialize.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -74,7 +74,7 @@ bool initialize_class(classinfo *c)
        if (!makeinitializations)
                return true;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* enter a monitor on the class */
 
        builtin_monitorenter((java_objectheader *) c);
@@ -84,7 +84,7 @@ bool initialize_class(classinfo *c)
           pass the monitor, is currently initalizing this class */
 
        if (CLASS_IS_OR_ALMOST_INITIALIZED(c)) {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                builtin_monitorexit((java_objectheader *) c);
 #endif
 
@@ -97,7 +97,7 @@ bool initialize_class(classinfo *c)
        if (c->state & CLASS_ERROR) {
                *exceptionptr = new_noclassdeffounderror(c->name);
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                builtin_monitorexit((java_objectheader *) c);
 #endif
 
@@ -124,7 +124,7 @@ bool initialize_class(classinfo *c)
 
        c->state &= ~CLASS_INITIALIZING;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* leave the monitor */
 
        builtin_monitorexit((java_objectheader *) c);
@@ -145,9 +145,6 @@ static bool initialize_class_intern(classinfo *c)
 {
        methodinfo        *m;
        java_objectheader *xptr;
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-       int b;
-#endif
 
        /* maybe the class is not already linked */
 
@@ -199,20 +196,10 @@ static bool initialize_class_intern(classinfo *c)
                log_message_class("Starting static class initializer for class: ", c);
 #endif
 
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-       b = blockInts;
-       blockInts = 0;
-#endif
-
        /* now call the initializer */
 
        (void) vm_call_method(m, NULL);
 
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-       assert(blockInts == 0);
-       blockInts = b;
-#endif
-
        /* we have an exception or error */
 
        xptr = *exceptionptr;
index e03bcef071e64e67e0d80d23f4e1c49756a9552c..a814a092ae7d2795145a82bf110288b9599cdf99 100644 (file)
@@ -32,7 +32,7 @@
             Michael Starzinger
             Edwin Steiner
 
-   $Id: simplereg.c 4761 2006-04-12 22:16:59Z edwin $
+   $Id: simplereg.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -1341,6 +1341,32 @@ static void allocate_scratch_registers(jitdata *jd)
                                case ICMD_IF_LCMPGT:
                                case ICMD_IF_LCMPLE:
 
+                               case ICMD_IF_FCMPEQ:
+                               case ICMD_IF_FCMPNE:
+
+                               case ICMD_IF_FCMPL_LT:
+                               case ICMD_IF_FCMPL_GE:
+                               case ICMD_IF_FCMPL_GT:
+                               case ICMD_IF_FCMPL_LE:
+
+                               case ICMD_IF_FCMPG_LT:
+                               case ICMD_IF_FCMPG_GE:
+                               case ICMD_IF_FCMPG_GT:
+                               case ICMD_IF_FCMPG_LE:
+
+                               case ICMD_IF_DCMPEQ:
+                               case ICMD_IF_DCMPNE:
+
+                               case ICMD_IF_DCMPL_LT:
+                               case ICMD_IF_DCMPL_GE:
+                               case ICMD_IF_DCMPL_GT:
+                               case ICMD_IF_DCMPL_LE:
+
+                               case ICMD_IF_DCMPG_LT:
+                               case ICMD_IF_DCMPG_GE:
+                               case ICMD_IF_DCMPG_GT:
+                               case ICMD_IF_DCMPG_LE:
+
                                case ICMD_IF_ACMPEQ:
                                case ICMD_IF_ACMPNE:
 
index 8e4234ca19cf5d2dc83ee832ffbba4ffc68eb10b..9ae20fda879a2df9c613ee26d2192ccb403190c6 100644 (file)
@@ -31,7 +31,7 @@
             Christian Thalinger
                Edwin Steiner
 
-   $Id: asmpart.S 4896 2006-05-10 13:12:06Z twisti $
+   $Id: asmpart.S 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -243,7 +243,7 @@ asm_call_jit_compiler:
                                      /* directly to the caller (ra).             */
 
 L_asm_call_jit_compiler_exception:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        subq    sp,2*8,sp
        stq     ra,0*8(sp)            /* save return address (xpc)                */
        jsr     ra,builtin_asm_get_exceptionptrptr
@@ -503,7 +503,7 @@ L_asm_wrapper_patcher_exception:
 L_asm_wrapper_patcher_exception_load_gp:
        ldgp    gp,0(itmp1)           /* itmp3 == gp, load the current gp         */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        subq    sp,3*8,sp
        stq     xpc,0*8(sp)           /* save return address (xpc)                */
        stq     ra,1*8(sp)
@@ -883,7 +883,7 @@ _crit_end:
     .data
 
 asm_criticalsections:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
     .quad   _crit_begin
     .quad   _crit_end
     .quad   _crit_restart
index 537d3360f9c4cf41f9bcce1a189a05295bd6772c..4e0bb0d85a270e907790e796937db48c342def2a 100644 (file)
@@ -32,7 +32,7 @@
             Christian Ullrich
             Edwin Steiner
 
-   $Id: codegen.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: codegen.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -124,7 +124,7 @@ bool codegen(jitdata *jd)
 
        stackframesize = rd->memuse + savedregs_num;
 
-#if defined(USE_THREADS)           /* space to save argument of monitor_enter */
+#if defined(ENABLE_THREADS)        /* space to save argument of monitor_enter */
        if (checksync && (m->flags & ACC_SYNCHRONIZED))
                stackframesize++;
 #endif
@@ -138,7 +138,7 @@ bool codegen(jitdata *jd)
        (void) dseg_addaddress(cd, m);                          /* MethodPointer  */
        (void) dseg_adds4(cd, stackframesize * 8);              /* FrameSize      */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* IsSync contains the offset relative to the stack pointer for the
           argument of monitor_exit used in the exception handler. Since the
           offset could be zero and give a wrong meaning of the flag it is
@@ -241,7 +241,7 @@ bool codegen(jitdata *jd)
 
        /* call monitorenter function */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                /* stack offset for monitor argument */
 
@@ -2952,7 +2952,7 @@ nowperformreturn:
                        }
 #endif
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                                M_ALD(rd->argintregs[0], REG_SP, rd->memuse * 8);
 
@@ -3328,7 +3328,7 @@ gen_method:
                                        supervftbl = super->vftbl;
                                }
                        
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritrestart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                s1 = emit_load_s1(jd, iptr, src, REG_ITMP1);
@@ -3418,14 +3418,14 @@ gen_method:
 
                                        M_ALD(REG_ITMP2, s1, OFFSET(java_objectheader, vftbl));
                                        M_ALD(REG_ITMP3, REG_PV, disp);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                        codegen_threadcritstart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                        M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval));
                                        /*                              if (s1 != REG_ITMP1) { */
                                        /*                                      M_ILD(REG_ITMP1, REG_ITMP3, OFFSET(vftbl_t, baseval)); */
                                        /*                                      M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval)); */
-                                       /*  #if defined(USE_THREADS) && defined(NATIVE_THREADS) */
+                                       /*  #if defined(ENABLE_THREADS) */
                                        /*                                      codegen_threadcritstop(cd, (u1 *) mcodeptr - cd->mcodebase); */
                                        /*  #endif */
                                        /*                                      M_ISUB(REG_ITMP2, REG_ITMP1, REG_ITMP2); */
@@ -3435,7 +3435,7 @@ gen_method:
                                        M_ISUB(REG_ITMP2, REG_ITMP3, REG_ITMP2);
                                        M_ALD(REG_ITMP3, REG_PV, disp);
                                        M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval));
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                        codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                        /*                              } */
@@ -3513,7 +3513,7 @@ gen_method:
                                supervftbl = super->vftbl;
                        }
                        
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        codegen_threadcritrestart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                        s1 = emit_load_s1(jd, iptr, src, REG_ITMP1);
@@ -3611,13 +3611,13 @@ gen_method:
 
                                M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
                                M_ALD(REG_ITMP2, REG_PV, disp);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritstart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval));
                                M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval));
                                M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval));
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1);
@@ -3850,7 +3850,7 @@ gen_method:
 
                        /* move pointer to java_objectheader onto stack */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        /* create a virtual java_objectheader */
 
                        (void) dseg_addaddress(cd, lock_get_initial_lock_word());          /* monitorPtr */
@@ -4292,7 +4292,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
        /* check for exception */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        disp = dseg_addaddress(cd, builtin_get_exceptionptrptr);
        M_ALD(REG_PV, REG_PV, disp);
        M_JSR(REG_RA, REG_PV);
@@ -4373,7 +4373,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
                        /* move pointer to java_objectheader onto stack */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        /* create a virtual java_objectheader */
 
                        (void) dseg_addaddress(cd, lock_get_initial_lock_word());          /* monitorPtr */
index 53d5f5fe80346c87115d4e6c52544efb0ed2af0b..61eebf5f6953f1d0b8376119ea1f5bd303825c3a 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: md-os.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: md-os.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -97,7 +97,7 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 }
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void thread_restartcriticalsection(ucontext_t *_uc)
 {
        mcontext_t *_mc;
index e1a7794451a44c71b825a203ba7d8d05dcae19d6..412ac5430fb3a43d1a5f96aaf06bbfee87159e9f 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: md-os.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: md-os.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -95,7 +95,7 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 }
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void thread_restartcriticalsection(ucontext_t *_uc)
 {
        mcontext_t *_mc;
index 21d8957d8239bd60daaeb23ce7292b3bd05d890a..d23da4b69f1ddbd14b0bfa1a5b7c61836725f933 100644 (file)
@@ -30,7 +30,7 @@
    Changes: Christian Thalinger
             Edwin Steiner
 
-   $Id: asmpart.h 4920 2006-05-15 13:13:22Z twisti $
+   $Id: asmpart.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "vm/types.h"
 
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-#  include "threads/native/critical.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
+# include "threads/native/critical.h"
 #endif
 
 #include "vm/global.h"
@@ -150,7 +146,7 @@ void asm_replacement_in(executionstate *es);
 
 void *asm_switchstackandcall(void *stack, void *func, void **stacktopsave, void * p);
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 extern critical_section_node_t asm_criticalsections;
 #endif
 
@@ -163,12 +159,6 @@ void asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out);
 void intrp_asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out);
 #endif
 
-
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-void asm_perform_threadswitch(u1 **from, u1 **to, u1 **stackTop);
-u1*  asm_initialize_thread_stack(void *func, u1 *stack);
-#endif
-
 /* cache flush function */
 void asm_cacheflush(u1 *addr, s4 nbytes);
 
index 4341888624d2dc6b766fc5319140a8810f18dbb6..6323aeb80d1fe1f39cf2b873b5b4510376755ba0 100644 (file)
@@ -91,7 +91,7 @@ codeinfo *code_codeinfo_new(methodinfo *m)
 
 int code_get_sync_slot_count(codeinfo *code)
 {
-#ifdef USE_THREADS
+#ifdef ENABLE_THREADS
        int count;
        
        assert(code);
@@ -117,11 +117,11 @@ int code_get_sync_slot_count(codeinfo *code)
 
        return count;
 
-#else /* !USE_THREADS */
+#else /* !ENABLE_THREADS */
        
        return 0;
 
-#endif /* USE_THREADS */
+#endif /* ENABLE_THREADS */
 }
 
 /* code_get_stack_frame_size ***************************************************
index 6ef6c3a745784a5e31061fc5fbfb7ae86b2a7a29..95c0399a5a68ac9e47689d9bf76150acefc7bd1c 100644 (file)
@@ -48,7 +48,7 @@
    memory. All functions writing values into the data area return the offset
    relative the begin of the code area (start of procedure).   
 
-   $Id: codegen-common.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: codegen-common.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "native/jni.h"
 #include "native/native.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "vm/exceptions.h"
@@ -215,7 +211,7 @@ void codegen_setup(jitdata *jd)
        cd->maxstack = m->maxstack;
        cd->maxlocals = m->maxlocals;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        cd->threadcritcurrent.next = NULL;
        cd->threadcritcount = 0;
 #endif
@@ -596,7 +592,7 @@ void codegen_finish(jitdata *jd)
 
        mcodelen = (s4) ((u1 *) cd->mcodeptr - cd->mcodebase);
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        extralen = sizeof(critical_section_node_t) * cd->threadcritcount;
 #else
        extralen = 0;
@@ -726,7 +722,7 @@ void codegen_finish(jitdata *jd)
 #endif
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        {
                critical_section_node_t *n = (critical_section_node_t *) ((ptrint) code->mcode + alignedlen);
                s4 i;
@@ -1113,7 +1109,7 @@ s4 codegen_reg_of_var(registerdata *rd, u2 opcode, stackptr v, s4 tempregnum)
 }
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void codegen_threadcritrestart(codegendata *cd, int offset)
 {
        cd->threadcritcurrent.mcoderestart = offset;
index 036219adbddadbe92ea0223fad8566f0481f6b7b..1f851698ca4ab851f39ebb4f69afa77f0c9694e0 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Christian Ullrich
             Edwin Steiner
 
-   $Id: codegen-common.h 4908 2006-05-12 16:49:50Z edwin $
+   $Id: codegen-common.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -199,7 +199,7 @@ void removenativestub(u1 *stub);
 
 s4 codegen_reg_of_var(registerdata *rd, u2 opcode, stackptr v, s4 tempregnum);
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void codegen_threadcritrestart(codegendata *cd, int offset);
 void codegen_threadcritstart(codegendata *cd, int offset);
 void codegen_threadcritstop(codegendata *cd, int offset);
index 7beec1f2d580243743e2565f3152be8155b472a7..4abda6356195d304dbe7927a6936b40466d6d522 100644 (file)
@@ -31,7 +31,7 @@
    Changes: Joseph Wenninger
             Edwin Steiner
 
-   $Id: asmpart.S 4818 2006-04-24 00:19:06Z edwin $
+   $Id: asmpart.S 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -323,7 +323,7 @@ L_call_method:
        jmp             *v0                         /* ...and now call the new method     */
 
 L_asm_call_jit_compiler_exception:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        call    builtin_asm_get_exceptionptrptr
        mov     v0,itmp2                    /* v0 == itmp1                        */
 #else
@@ -534,7 +534,7 @@ asm_wrapper_patcher:
 L_asm_wrapper_patcher_exception:
        add     $((6+2+4)*4+sizestackframeinfo),sp /* remove stack frame, keep ra */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        call    builtin_asm_get_exceptionptrptr
        mov     v0,itmp2
 #else
@@ -809,7 +809,7 @@ _crit_end2:
        .data
 
 asm_criticalsections:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 #if 0
        .long   _crit_begin1
        .long   _crit_end1
index c6f59fd7029511db140986adc14704c82abfa9be..9288991f4957b44145294cf96141aeef1f54f3fc 100644 (file)
@@ -31,7 +31,7 @@
             Christian Ullrich
                        Edwin Steiner
 
-   $Id: codegen.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: codegen.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -131,7 +131,7 @@ bool codegen(jitdata *jd)
        stackframesize = rd->memuse + savedregs_num;
 
           
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* space to save argument of monitor_enter */
 
        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
@@ -154,7 +154,7 @@ bool codegen(jitdata *jd)
        (void) dseg_addaddress(cd, m);                          /* MethodPointer  */
        (void) dseg_adds4(cd, stackframesize * 4);              /* FrameSize      */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* IsSync contains the offset relative to the stack pointer for the
           argument of monitor_exit used in the exception handler. Since the
           offset could be zero and give a wrong meaning of the flag it is
@@ -327,7 +327,7 @@ bool codegen(jitdata *jd)
 
        /* call monitorenter function */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                s1 = rd->memuse;
 
@@ -593,7 +593,7 @@ bool codegen(jitdata *jd)
                case ICMD_INLINE_START:
                        {
                                insinfo_inline *insinfo = (insinfo_inline *) iptr->target;
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                                if (insinfo->synchronize) {
                                        /* add monitor enter code */
                                        if (insinfo->method->flags & ACC_STATIC) {
@@ -629,7 +629,7 @@ bool codegen(jitdata *jd)
                                dseg_addlinenumber_inline_end(cd, iptr);
                                dseg_addlinenumber(cd, iptr->line);
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                                if (insinfo->synchronize) {
                                        /* add monitor exit code */
                                        if (insinfo->method->flags & ACC_STATIC) {
@@ -4171,7 +4171,7 @@ nowperformreturn:
                        }
 #endif /* !defined(NDEBUG) */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                                M_ALD(REG_ITMP2, REG_SP, rd->memuse * 4);
 
@@ -4581,7 +4581,7 @@ gen_method:
                                        supervftbl = super->vftbl;
                                }
                        
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritrestart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                s1 = emit_load_s1(jd, iptr, src, REG_ITMP1);
@@ -4710,7 +4710,7 @@ gen_method:
                                        }
 
                                        i386_mov_imm_reg(cd, (ptrint) supervftbl, REG_ITMP3);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                        codegen_threadcritstart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                        i386_mov_membase32_reg(cd, REG_ITMP2,
@@ -4720,7 +4720,7 @@ gen_method:
                                        /*                              if (s1 != REG_ITMP1) { */
                                        /*                                      i386_mov_membase_reg(cd, REG_ITMP3, OFFSET(vftbl_t, baseval), REG_ITMP1); */
                                        /*                                      i386_mov_membase_reg(cd, REG_ITMP3, OFFSET(vftbl_t, diffval), REG_ITMP3); */
-                                       /* #if defined(USE_THREADS) && defined(NATIVE_THREADS) */
+                                       /* #if defined(ENABLE_THREADS) */
                                        /*                                      codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase); */
                                        /* #endif */
                                        /*                                      i386_alu_reg_reg(cd, ALU_SUB, REG_ITMP1, REG_ITMP2); */
@@ -4734,7 +4734,7 @@ gen_method:
                                        i386_mov_membase_reg(cd, REG_ITMP3,
                                                                                 OFFSET(vftbl_t, diffval),
                                                                                 REG_ITMP3);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                        codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                        /*                              } */
@@ -4811,7 +4811,7 @@ gen_method:
                                supervftbl = super->vftbl;
                        }
                        
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        codegen_threadcritrestart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
 
@@ -4940,7 +4940,7 @@ gen_method:
                                }
 
                                i386_mov_imm_reg(cd, (ptrint) supervftbl, REG_ITMP2);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritstart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                i386_mov_membase_reg(cd, REG_ITMP1,
@@ -4952,7 +4952,7 @@ gen_method:
                                i386_mov_membase_reg(cd, REG_ITMP2,
                                                                         OFFSET(vftbl_t, baseval),
                                                                         REG_ITMP2);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                i386_alu_reg_reg(cd, ALU_SUB, REG_ITMP2, REG_ITMP1);
@@ -5199,7 +5199,7 @@ gen_method:
 
                        /* move pointer to java_objectheader onto stack */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        (void) dseg_addaddress(cd, lock_get_initial_lock_word());          /* monitorPtr */
                        off = dseg_addaddress(cd, NULL);                    /* vftbl      */
 
@@ -5327,7 +5327,7 @@ u1 *createcompilerstub(methodinfo *m)
 
 *******************************************************************************/
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 /* this way we can call the function directly with a memory call */
 
 static java_objectheader **(*callgetexceptionptrptr)() = builtin_get_exceptionptrptr;
@@ -5591,7 +5591,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
        /* check for exception */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 /*     i386_call_mem(cd, (ptrint) builtin_get_exceptionptrptr); */
        i386_call_mem(cd, (ptrint) &callgetexceptionptrptr);
 #else
@@ -5623,7 +5623,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
        /* handle exception */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        i386_push_reg(cd, REG_ITMP2);
 /*     i386_call_mem(cd, (ptrint) builtin_get_exceptionptrptr); */
        i386_call_mem(cd, (ptrint) &callgetexceptionptrptr);
@@ -5671,7 +5671,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
                        /* move pointer to java_objectheader onto stack */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        /* create a virtual java_objectheader */
 
                        (void) dseg_addaddress(cd, lock_get_initial_lock_word());          /* monitorPtr */
index 583c9a0edf6c85d56339a8a4c1b5df79b5fcd9af..ccafbff196bb695049404ccb16514fcc8e05b063 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: md-os.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: md-os.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -105,7 +105,7 @@ void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
 }
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void thread_restartcriticalsection(ucontext_t *uc)
 {
        void *critical;
index 6665ee1bdcbc1ba542ccf211583ad57c1c1b5f17..8d82836a73668c95f582a71872196e3fb50a4b17 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: md-os.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: md-os.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -108,7 +108,7 @@ void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
 }
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void thread_restartcriticalsection(ucontext_t *uc)
 {
        void *critical;
index 5bd60fbc8bcf140ceb55736e3b5f3a830a67cf56..9d7a9dadf26479ab184309181250ce04e19493e4 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: inline.c 4897 2006-05-10 15:09:49Z edwin $
+   $Id: inline.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -43,6 +43,7 @@
 
 #include "mm/memory.h"
 #include "toolbox/logging.h"
+#include "vm/builtin.h"
 #include "vm/global.h"
 #include "vm/options.h"
 #include "vm/statistics.h"
 
 #include "vm/jit/verify/typecheck.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #ifndef NDEBUG
@@ -233,7 +230,7 @@ static bool inline_jit_compile(inline_node *iln)
        m = iln->m;
        assert(m);
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* enter a monitor on the method */
        builtin_monitorenter((java_objectheader *) m);
 #endif
@@ -296,7 +293,7 @@ static bool inline_jit_compile(inline_node *iln)
 #endif
 
 return_r:
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* leave the monitor */
        builtin_monitorexit((java_objectheader *) m );
 #endif
index 05ce77d4aad34e0bdd1e123b6ff970b2d8145c7e..3c0a774c31d0b1c199b4d74e6957d5658e6a696b 100644 (file)
@@ -29,7 +29,7 @@
 
    Changes:
 
-   $Id: asmpart.c 4856 2006-04-28 00:46:39Z edwin $
+   $Id: asmpart.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -234,24 +234,16 @@ void intrp_asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out
 {
        s4 sbv, sdv, sv;
 
-#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        compiler_lock();
-#else
-       intsDisable();
-#endif
 #endif
 
        sbv = super->baseval;
        sdv = super->diffval;
        sv  = sub->baseval;
 
-#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        compiler_unlock();
-#else
-       intsRestore();
-#endif
 #endif
 
        out->super_baseval = sbv;
index b42066fefd425d3cc65be96cfe7ff25c84e1d2b9..65e041734764b943ee8e0cd003f8cf55cd33a3d5 100644 (file)
@@ -29,7 +29,7 @@
                        
    Changes: Edwin Steiner
 
-   $Id: codegen.c 4863 2006-04-30 16:17:44Z edwin $
+   $Id: codegen.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -239,7 +239,7 @@ struct builtin_gen builtin_gen_table[] = {
     {BUILTIN_newarray_double,         gen_NEWARRAY_DOUBLE, },
     {BUILTIN_arrayinstanceof,         gen_ARRAYINSTANCEOF, },
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
     {BUILTIN_monitorenter,            gen_MONITORENTER,    },
     {BUILTIN_monitorexit,             gen_MONITOREXIT,     },
 #endif
@@ -315,7 +315,7 @@ bool intrp_codegen(jitdata *jd)
        (void) dseg_addaddress(cd, m);                          /* MethodPointer  */
        (void) dseg_adds4(cd, m->maxlocals * SIZEOF_VOID_P);    /* FrameSize      */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        if (checksync && (m->flags & ACC_SYNCHRONIZED))
                (void) dseg_adds4(cd, 1);                           /* IsSync         */
        else
@@ -348,7 +348,7 @@ bool intrp_codegen(jitdata *jd)
 
        gen_BBSTART;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                if (m->flags & ACC_STATIC)
                        gen_ACONST(cd, (java_objectheader *) m->class);
@@ -1539,7 +1539,7 @@ bool intrp_codegen(jitdata *jd)
                case ICMD_IRETURN:      /* ..., retvalue ==> ...                      */
                case ICMD_FRETURN:      /* ..., retvalue ==> ...                      */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                                if (m->flags & ACC_STATIC) {
                                        gen_ACONST(cd, (java_objectheader *) m->class);
@@ -1558,7 +1558,7 @@ bool intrp_codegen(jitdata *jd)
                case ICMD_LRETURN:      /* ..., retvalue ==> ...                      */
                case ICMD_DRETURN:      /* ..., retvalue ==> ...                      */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                                if (m->flags & ACC_STATIC) {
                                        gen_ACONST(cd, (java_objectheader *) m->class);
@@ -1576,7 +1576,7 @@ bool intrp_codegen(jitdata *jd)
 
                case ICMD_RETURN:       /* ...  ==> ...                               */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                                if (m->flags & ACC_STATIC) {
                                        gen_ACONST(cd, (java_objectheader *) m->class);
index c54f696ad5956292b4089ee5a9fed75d9468052f..d8e80f48f99503c193d11e9013285494dbdcb34e 100644 (file)
@@ -32,7 +32,7 @@
 
    Changes:
 
-   $Id: dynamic-super.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: dynamic-super.c 4921 2006-05-15 14:24:36Z twisti $
 */
 
 
 
 #include "mm/memory.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "vm/hashtable.h"
@@ -110,7 +106,7 @@ typedef struct superstart {
 static hashtable hashtable_patchersupers;
 #define HASHTABLE_PATCHERSUPERS_BITS 14
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 static java_objectheader *lock_hashtable_patchersupers;
 #endif
 
@@ -124,7 +120,7 @@ typedef struct superreuse {
 static hashtable hashtable_superreuse;
 #define HASHTABLE_SUPERREUSE_BITS 14
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 static java_objectheader *lock_hashtable_superreuse;
 #endif
 
@@ -373,12 +369,12 @@ static void superreuse_insert(u1 *code, u4 length)
   superreuse *sr = NEW(superreuse);
   sr->code = code;
   sr->length = length;
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
   builtin_monitorenter(lock_hashtable_superreuse);
 #endif
   sr->next = *listp;
   *listp = sr;
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
   builtin_monitorexit(lock_hashtable_superreuse);
 #endif
   count_supers_unique++;
@@ -411,7 +407,7 @@ void patchersuper_rewrite(Inst *p)
   superstart **listp = (superstart **)&hashtable_patchersupers.ptr[slot];
   superstart *ss;
   count_patchers_exec++;
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
   builtin_monitorenter(lock_hashtable_patchersupers);
 #endif
   for (; ss=*listp,  ss!=NULL; listp = &(ss->next)) {
@@ -430,7 +426,7 @@ void patchersuper_rewrite(Inst *p)
       break;
     }
   }
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
   builtin_monitorexit(lock_hashtable_patchersupers);
 #endif
 }
@@ -441,12 +437,12 @@ static void hashtable_patchersupers_insert(superstart *ss)
   u4 slot = ((key + (key>>HASHTABLE_PATCHERSUPERS_BITS)) & 
              ((1<<HASHTABLE_PATCHERSUPERS_BITS)-1));
   void **listp = &hashtable_patchersupers.ptr[slot];
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
   builtin_monitorenter(lock_hashtable_patchersupers);
 #endif
   ss->next = (superstart *)*listp;
   *listp = (void *)ss;
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
   builtin_monitorexit(lock_hashtable_patchersupers);
 #endif
   count_patchers_ins++;
@@ -710,15 +706,13 @@ void dynamic_super_init(void)
   if (opt_no_replication)
     hashtable_create(&hashtable_superreuse,  1<<HASHTABLE_SUPERREUSE_BITS);
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
   /* create patchersupers hashtable lock object */
 
   lock_hashtable_patchersupers = NEW(java_objectheader);
   lock_hashtable_superreuse  = NEW(java_objectheader);
 
-# if defined(NATIVE_THREADS)
   lock_init_object_lock(lock_hashtable_patchersupers);
   lock_init_object_lock(lock_hashtable_superreuse);
-# endif
 #endif
 }
index e330d729521497d575ae99041738adeaf864b6e1..c676fd22e97cb67f996f77349ca24d08e0d8263e 100644 (file)
@@ -29,7 +29,7 @@
 
    Changes:
 
-   $Id: engine.c 4912 2006-05-14 12:22:25Z edwin $
+   $Id: engine.c 4921 2006-05-15 14:24:36Z twisti $
 */
 
 
@@ -51,7 +51,7 @@
 #include "vm/jit/methodheader.h"
 #include "vm/jit/patcher.h"
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 # ifndef USE_FAKE_ATOMIC_INSTRUCTIONS
 #  include "machine-instr.h"
 # else
@@ -59,7 +59,7 @@
 # endif
 #endif
 
-#if !defined(STORE_ORDER_BARRIER) && !defined(USE_THREADS)
+#if !defined(STORE_ORDER_BARRIER) && !defined(ENABLE_THREADS)
 #define STORE_ORDER_BARRIER() /* nothing */
 #endif
 
index 2190d0177a545dbecafc0c3a673353301e83a5bb..1a6e8c3f59ef4d785f00cf9353bf99f5baafea3e 100644 (file)
@@ -29,7 +29,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: intrp.h 4913 2006-05-14 14:02:51Z edwin $
+   $Id: intrp.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -108,11 +108,11 @@ typedef union {
 #endif /* SIZEOF_VOID_P == 4 */
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 
 #define global_sp    (*(Cell **)&(THREADOBJECT->_global_sp))
 
-#else /* defined(USE_THREADS) && defined(NATIVE_THREADS) */
+#else /* defined(ENABLE_THREADS) */
 
 #define MAX_STACK_SIZE 128*1024
 static char stack[MAX_STACK_SIZE];
@@ -120,7 +120,7 @@ static char stack[MAX_STACK_SIZE];
 static Cell *_global_sp = (Cell *)(stack+MAX_STACK_SIZE);
 #define global_sp    _global_sp
 
-#endif /* defined(USE_THREADS) && defined(NATIVE_THREADS) */
+#endif /* defined(ENABLE_THREADS) */
 
 #define CLEAR_global_sp (global_sp=NULL)
 
index d520ad1ff7835570d8ce63837057100a2ef95975..ca87e61c0611a9267f7d603ea6aff535b2396dc7 100644 (file)
@@ -1243,7 +1243,7 @@ ARRAYINSTANCEOF ( aRef aClass  -- iResult )
 
 MONITORENTER ( aRef -- )
 {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
   /* CHECK_NULL_PTR(aRef); is now done explicitly */
   builtin_monitorenter(aRef);
 #endif
@@ -1251,7 +1251,7 @@ MONITORENTER ( aRef -- )
 
 MONITOREXIT ( aRef -- )
 {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
   /* CHECK_NULL_PTR(aRef); cannot happen */
   builtin_monitorexit(aRef);
 #endif
index a2428759fdfc7e037137b576e0114ebee69cc676..4fbfca20a1142a0fc9a4295352320a7c724a77e1 100644 (file)
@@ -31,7 +31,7 @@
             Christian Thalinger
             Christian Ullrich
 
-   $Id: jit.c 4834 2006-04-25 12:25:43Z edwin $
+   $Id: jit.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "vm/jit/verify/typecheck.h"
 #include "vm/rt-timing.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 
@@ -731,10 +727,53 @@ int jcommandsize[256] = {
 #define ICMD_LMULPOW2         215
        1,
 
+#define ICMD_IF_FCMPEQ        216
+       1,
+#define ICMD_IF_FCMPNE        217
+
+#define ICMD_IF_FCMPL_LT      218
+       1,
+#define ICMD_IF_FCMPL_GE      219
+       1,
+#define ICMD_IF_FCMPL_GT      220
+       1,
+#define ICMD_IF_FCMPL_LE      221
+       1,
+
+#define ICMD_IF_FCMPG_LT      222
+       1,
+#define ICMD_IF_FCMPG_GE      223
+       1,
+#define ICMD_IF_FCMPG_GT      224
+       1,
+#define ICMD_IF_FCMPG_LE      225
+       1,
+
+#define ICMD_IF_DCMPEQ        226
+       1,
+#define ICMD_IF_DCMPNE        227
+       1,
+
+#define ICMD_IF_DCMPL_LT      228
+       1,
+#define ICMD_IF_DCMPL_GE      229
+       1,
+#define ICMD_IF_DCMPL_GT      230
+       1,
+#define ICMD_IF_DCMPL_LE      231
+       1,
+
+#define ICMD_IF_DCMPG_LT      232
+       1,
+#define ICMD_IF_DCMPG_GE      233
+       1,
+#define ICMD_IF_DCMPG_GT      234
+       1,
+#define ICMD_IF_DCMPG_LE      235
+       1,
+
        /* unused */
-                   1,1,1,1,
-       1,1,1,1,1,1,1,1,1,1,
-       1,1,1,1,1,1,1,1,1,1,
+               1,1,1,1,1,1,
        1,1,1,1,1,1,1,1,1,1,
        1,1,1,1,1
 };
@@ -958,10 +997,32 @@ char *icmd_names[256] = {
        "IMULPOW2       ", /*             214 */
        "LMULPOW2       ", /*             215 */
 
-       "UNDEF216", "UNDEF217", "UNDEF218", "UNDEF219", "UNDEF220",
-       "UNDEF221", "UNDEF222", "UNDEF223", "UNDEF224", "UNDEF225",
-       "UNDEF226", "UNDEF227", "UNDEF228", "UNDEF229", "UNDEF230",
-       "UNDEF231", "UNDEF232", "UNDEF233", "UNDEF234", "UNDEF235",
+       "IF_FCMPEQ      ", /*             216 */
+       "IF_FCMPNE      ", /*             217 */
+
+       "IF_FCMPL_LT    ", /*             218 */
+       "IF_FCMPL_GE    ", /*             219 */
+       "IF_FCMPL_GT    ", /*             220 */
+       "IF_FCMPL_LE    ", /*             221 */
+
+       "IF_FCMPG_LT    ", /*             222 */
+       "IF_FCMPG_GE    ", /*             223 */
+       "IF_FCMPG_GT    ", /*             224 */
+       "IF_FCMPG_LE    ", /*             225 */
+
+       "IF_DCMPEQ      ", /*             226 */
+       "IF_DCMPNE      ", /*             227 */
+
+       "IF_DCMPL_LT    ", /*             228 */
+       "IF_DCMPL_GE    ", /*             229 */
+       "IF_DCMPL_GT    ", /*             230 */
+       "IF_DCMPL_LE    ", /*             231 */
+       
+       "IF_DCMPG_LT    ", /*             232 */
+       "IF_DCMPG_GE    ", /*             233 */
+       "IF_DCMPG_GT    ", /*             234 */
+       "IF_DCMPG_LE    ", /*             235 */
+       
        "UNDEF236", "UNDEF237", "UNDEF238", "UNDEF239", "UNDEF240",
        "UNDEF241", "UNDEF242", "UNDEF243", "UNDEF244", "UNDEF245",
        "UNDEF246", "UNDEF247", "UNDEF248", "UNDEF249", "UNDEF250",
@@ -1353,7 +1414,7 @@ u1 *jit_compile(methodinfo *m)
                        return m->code->entrypoint;
        }
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* enter a monitor on the method */
 
        builtin_monitorenter((java_objectheader *) m);
@@ -1362,7 +1423,7 @@ u1 *jit_compile(methodinfo *m)
        /* if method has been already compiled return immediately */
 
        if (m->code) {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                builtin_monitorexit((java_objectheader *) m);
 #endif
 
@@ -1440,7 +1501,7 @@ u1 *jit_compile(methodinfo *m)
 #endif
 
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* leave the monitor */
 
        builtin_monitorexit((java_objectheader *) m);
index 0430831ccaea0b2ca11ae664664434505eb8ebd3..9f19c47e6c3ee06dc794ccf828da0cb88b4546cf 100644 (file)
@@ -30,7 +30,7 @@
    Changes: Christian Thalinger
                        Edwin Steiner
 
-   $Id: jit.h 4863 2006-04-30 16:17:44Z edwin $
+   $Id: jit.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -945,29 +945,46 @@ extern int jcommandsize[256];
 /* UNDEF203 */
 
 #define ICMD_IASTORECONST     204
-
 #define ICMD_LASTORECONST     205
-
 #define ICMD_FASTORECONST     206
-
 #define ICMD_DASTORECONST     207
-
 #define ICMD_AASTORECONST     208
-
 #define ICMD_BASTORECONST     209
-
 #define ICMD_CASTORECONST     210
-
 #define ICMD_SASTORECONST     211
 
 #define ICMD_PUTSTATICCONST   212
-
 #define ICMD_PUTFIELDCONST    213
 
 #define ICMD_IMULPOW2         214
-
 #define ICMD_LMULPOW2         215
 
+#define ICMD_IF_FCMPEQ        216
+#define ICMD_IF_FCMPNE        217
+
+#define ICMD_IF_FCMPL_LT      218
+#define ICMD_IF_FCMPL_GE      219
+#define ICMD_IF_FCMPL_GT      220
+#define ICMD_IF_FCMPL_LE      221
+
+#define ICMD_IF_FCMPG_LT      222
+#define ICMD_IF_FCMPG_GE      223
+#define ICMD_IF_FCMPG_GT      224
+#define ICMD_IF_FCMPG_LE      225
+
+#define ICMD_IF_DCMPEQ        226
+#define ICMD_IF_DCMPNE        227
+
+#define ICMD_IF_DCMPL_LT      228
+#define ICMD_IF_DCMPL_GE      229
+#define ICMD_IF_DCMPL_GT      230
+#define ICMD_IF_DCMPL_LE      231
+
+#define ICMD_IF_DCMPG_LT      232
+#define ICMD_IF_DCMPG_GE      233
+#define ICMD_IF_DCMPG_GT      234
+#define ICMD_IF_DCMPG_LE      235
+
 #define ICMD_INLINE_START     251       /* instruction before inlined method  */
 #define ICMD_INLINE_END       252       /* instruction after inlined method   */
 #define ICMD_INLINE_GOTO      253       /* jump to caller of inlined method   */
index 8046b69c86be7b7439ea3ca45cfe4558b07347a0..90300d649818e7c62a194cc8034e7fd688e20778 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Christian Thalinger
             Edwin Steiner
 
-   $Id: asmpart.S 4904 2006-05-11 13:09:53Z twisti $
+   $Id: asmpart.S 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -301,7 +301,7 @@ asm_call_jit_compiler:
                                      /* directly to the caller (ra).             */
 
 L_asm_call_jit_compiler_exception:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        aaddiu  sp,sp,-2*8
        ast     ra,0*8(sp)
        jal     builtin_asm_get_exceptionptrptr
@@ -520,7 +520,7 @@ L_asm_wrapper_patcher_exception:
        ald     xpc,((5+2+16+22+4)*8+sizestackframeinfo)(sp) /* RA to JIT is xpc  */
        aaddiu  sp,sp,((6+2+16+22+4)*8+sizestackframeinfo) /* remove stack frame  */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        daddiu  sp,sp,-4*8
        sd      xpc,0*8(sp)
        sd      ra,1*8(sp)
@@ -888,7 +888,7 @@ _crit_end:
     .data
 
 asm_criticalsections:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
     .dword  _crit_begin
     .dword  _crit_end
     .dword  _crit_restart
index 0e3bc80f7e9cc188fb3018da725f9f4e28d93be4..417b6667474675a17d616b9f562d8efca3687bec 100644 (file)
@@ -35,7 +35,7 @@
    This module generates MIPS machine code for a sequence of
    intermediate code commands (ICMDs).
 
-   $Id: codegen.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: codegen.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -118,7 +118,9 @@ bool codegen(jitdata *jd)
 
        parentargs_base = rd->memuse + savedregs_num;
 
-#if defined(USE_THREADS)           /* space to save argument of monitor_enter */
+#if defined(ENABLE_THREADS)
+       /* space to save argument of monitor_enter */
+
        if (checksync && (m->flags & ACC_SYNCHRONIZED))
                parentargs_base++;
 #endif
@@ -136,7 +138,7 @@ bool codegen(jitdata *jd)
        (void) dseg_addaddress(cd, m);                          /* MethodPointer  */
        (void) dseg_adds4(cd, parentargs_base * 8);             /* FrameSize      */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* IsSync contains the offset relative to the stack pointer for the
           argument of monitor_exit used in the exception handler. Since the
           offset could be zero and give a wrong meaning of the flag it is
@@ -241,7 +243,7 @@ bool codegen(jitdata *jd)
 
        /* call monitorenter function */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                /* stack offset for monitor argument */
 
@@ -2881,7 +2883,7 @@ nowperformreturn:
                                M_LDA(REG_SP, REG_SP, 3 * 8);
                        }
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                                disp = dseg_addaddress(cd, (void *) builtin_monitorexit);
                                M_ALD(REG_ITMP3, REG_PV, disp);
@@ -3285,7 +3287,7 @@ gen_method:
                                        supervftbl = super->vftbl;
                                }
                        
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritrestart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
 
@@ -3385,14 +3387,14 @@ gen_method:
 
                                        M_ALD(REG_ITMP2, s1, OFFSET(java_objectheader, vftbl));
                                        M_ALD(REG_ITMP3, REG_PV, disp);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                        codegen_threadcritstart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                        M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval));
                                        /*                              if (s1 != REG_ITMP1) { */
                                        /*                                      M_ILD(REG_ITMP1, REG_ITMP3, OFFSET(vftbl_t, baseval)); */
                                        /*                                      M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval)); */
-                                       /* #if defined(USE_THREADS) && defined(NATIVE_THREADS) */
+                                       /* #if defined(ENABLE_THREADS) */
                                        /*                                      codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase); */
                                        /* #endif */
                                        /*                                      M_ISUB(REG_ITMP2, REG_ITMP1, REG_ITMP2); */
@@ -3401,7 +3403,7 @@ gen_method:
                                        M_ISUB(REG_ITMP2, REG_ITMP3, REG_ITMP2); 
                                        M_ALD(REG_ITMP3, REG_PV, disp);
                                        M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval));
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                        codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                        /*                              } */
@@ -3478,7 +3480,7 @@ gen_method:
                                supervftbl = super->vftbl;
                        }
                        
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        codegen_threadcritrestart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
 
@@ -3579,13 +3581,13 @@ gen_method:
 
                                M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
                                M_ALD(REG_ITMP2, REG_PV, disp);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritstart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval));
                                M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval));
                                M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval));
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1); 
@@ -3845,7 +3847,7 @@ gen_method:
 
                        /* move pointer to java_objectheader onto stack */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        /* create a virtual java_objectheader */
 
                        (void) dseg_addaddress(cd, lock_get_initial_lock_word());          /* monitorPtr */
@@ -4290,7 +4292,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
        /* check for exception */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        disp = dseg_addaddress(cd, builtin_get_exceptionptrptr);
        M_ALD(REG_ITMP3, REG_PV, disp);
        M_JSR(REG_RA, REG_ITMP3);
@@ -4369,7 +4371,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
                        /* move pointer to java_objectheader onto stack */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        /* order reversed because of data segment layout */
 
                        (void) dseg_addaddress(cd, lock_get_initial_lock_word());          /* monitorPtr */
index ab9f95d4d722ff7eece0a2d06f6366601038d191..e13b52291c9233e6719c1420f3645e6d7274b82e 100644 (file)
@@ -29,7 +29,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: md-os.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: md-os.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -124,7 +124,7 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 }
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void thread_restartcriticalsection(ucontext_t *uc)
 {
        void *critical;
index 3d7d1f913b50ba9c15200194056527b507d27ff2..6f7c99dd5abb09b676ab8a783dd13ae303e22106 100644 (file)
@@ -29,7 +29,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: md-os.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: md-os.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -127,7 +127,7 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 }
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void thread_restartcriticalsection(ucontext_t *_uc)
 {
        mcontext_t *_mc;
index dc992c8d8b77425dd2caca30e732da6d841e8e9b..73a3eb98f048c538bcc00dea7ba0698a98f181c5 100644 (file)
@@ -31,7 +31,7 @@
             Joseph Wenninger
             Christian Thalinger
 
-   $Id: parse.c 4863 2006-04-30 16:17:44Z edwin $
+   $Id: parse.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -217,7 +217,7 @@ bool parse(jitdata *jd)
 
        s_count = 1 + m->exceptiontablelength; /* initialize stack element counter   */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                m->isleafmethod = false;
        }                       
@@ -1012,7 +1012,7 @@ invoke_method:
                        break;
 
                case JAVA_MONITORENTER:
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        if (checksync) {
                                OP(ICMD_CHECKNULL);
                                bte = builtintable_get_internal(BUILTIN_monitorenter);
@@ -1027,7 +1027,7 @@ invoke_method:
                        break;
 
                case JAVA_MONITOREXIT:
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        if (checksync) {
                                bte = builtintable_get_internal(BUILTIN_monitorexit);
                                BUILTIN(bte, false, NULL, currentline);
index 64cbfe69a32b38fa81c54bea16948825c2901056..996bda95a750928e590b9b1fb6a92f97d699c877 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: patcher.h 4760 2006-04-12 20:06:23Z edwin $
+   $Id: patcher.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -44,7 +44,7 @@
 
 /* patcher macros *************************************************************/
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 
 #define PATCHER_MONITORENTER \
        /* enter a monitor on the patching position */       \
@@ -79,7 +79,7 @@
 #define PATCHER_MONITOREXIT                  /* nop */
 #define PATCHER_MARK_PATCHED_MONITOREXIT     /* nop */
 
-#endif /* defined(USE_THREADS) */
+#endif /* defined(ENABLE_THREADS) */
 
 
 /* function prototypes ********************************************************/
index 6998b7e905e33aacd0d269cb70fcdd470dde39fe..a38e19d430f40c975c38983274ba8a700c23ac93 100644 (file)
@@ -31,7 +31,7 @@
    Changes: Christian Thalinger
             Edwin Steiner
 
-   $Id: asmpart.S 4894 2006-05-08 11:05:48Z twisti $
+   $Id: asmpart.S 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -72,9 +72,6 @@
        .globl asm_replacement_in
 
        .globl asm_cacheflush
-       .globl asm_initialize_thread_stack
-       .globl asm_perform_threadswitch
-       .globl asm_switchstackandcall
        .globl asm_criticalsections
        .globl asm_getclassvalues_atomic
 
@@ -714,7 +711,7 @@ L_asm_call_jit_compiler:                /* required for PIC code              */
        bctr                                /* and call the Java method           */
 
 L_asm_call_jit_compiler_exception:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        mflr    r0
        stw     r0,LA_LR_OFFSET(sp)
        stwu    sp,-LA_SIZE_ALIGNED(sp)     /* preserve linkage area              */
@@ -1076,7 +1073,7 @@ L_asm_wrapper_patcher_exception:
        lwz     xpc,(5+LA_WORD_SIZE+5+58)*4+sizestackframeinfo(sp)
        addi    sp,sp,(8+LA_WORD_SIZE+5+58)*4+sizestackframeinfo
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        mflr    r0
        stw     r0,LA_LR_OFFSET(sp)
        stwu    sp,-(LA_SIZE+1*4)(sp) /* preserve linkage area                    */
@@ -1343,180 +1340,6 @@ asm_cacheflush:
        blr
 
 
-       .align 3
-doublezero:
-       .double 0.0
-
-asm_initialize_thread_stack:
-       addi r4,r4,-256
-       stw r3,120(r4)
-       li r3,0
-       stw r3,124(r4)
-       stw r3,0(r4)
-       stw r3,4(r4)
-       stw r3,8(r4)
-       stw r3,12(r4)
-       stw r3,16(r4)
-       stw r3,20(r4)
-       stw r3,24(r4)
-       stw r3,28(r4)
-       stw r3,32(r4)
-       stw r3,36(r4)
-
-       stw r3,128(r4)
-       stw r3,132(r4)
-       stw r3,136(r4)
-       stw r3,140(r4)
-       stw r3,144(r4)
-       stw r3,148(r4)
-       stw r3,152(r4)
-       stw r3,156(r4)
-
-       mflr r0
-       bl 0f
-0:
-       mflr r3
-       mtlr r0
-#if defined(__DARWIN__)
-       lfd fr0,lo16(doublezero-0b)(r3)
-#else
-       lfd fr0,(doublezero-0b)@l(r3)
-#endif
-
-       stfd fr0,40(r4)
-       stfd fr0,48(r4)
-       stfd fr0,56(r4)
-       stfd fr0,64(r4)
-       stfd fr0,72(r4)
-       stfd fr0,80(r4)
-       stfd fr0,88(r4)
-       stfd fr0,96(r4)
-       stfd fr0,104(r4)
-       stfd fr0,112(r4)
-
-       stfd fr0,160(r4)
-       stfd fr0,168(r4)
-       stfd fr0,176(r4)
-       stfd fr0,184(r4)
-       stfd fr0,192(r4)
-       stfd fr0,200(r4)
-       stfd fr0,208(r4)
-       stfd fr0,216(r4)
-
-       mr r3,r4
-       blr
-
-
-asm_perform_threadswitch:
-       mflr r0
-       addi r1,r1,-224
-       stw r0,120(r1)
-       stw pv,124(r1)
-       stw r14,0(r1)
-       stw r15,4(r1)
-       stw r24,8(r1)
-       stw r25,12(r1)
-       stw r26,16(r1)
-       stw r27,20(r1)
-       stw r28,24(r1)
-       stw r29,28(r1)
-       stw r30,32(r1)
-       stw r31,36(r1)
-       stfd fr14,40(r1)
-       stfd fr15,48(r1)
-       stfd fr24,56(r1)
-       stfd fr25,64(r1)
-       stfd fr26,72(r1)
-       stfd fr27,80(r1)
-       stfd fr28,88(r1)
-       stfd fr29,96(r1)
-       stfd fr30,104(r1)
-       stfd fr31,112(r1)
-
-       stw r16,128(r1)
-       stw r17,132(r1)
-       stw r18,136(r1)
-       stw r19,140(r1)
-       stw r20,144(r1)
-       stw r21,148(r1)
-       stw r22,152(r1)
-       stw r23,156(r1)
-       stfd fr16,160(r1)
-       stfd fr17,168(r1)
-       stfd fr18,176(r1)
-       stfd fr19,184(r1)
-       stfd fr20,192(r1)
-       stfd fr21,200(r1)
-       stfd fr22,208(r1)
-       stfd fr23,216(r1)
-
-       stw r1,0(r3)
-       stw r1,0(r5)
-       lwz r1,0(r4)
-
-       lwz r0,120(r1)
-       lwz pv,124(r1)
-       lwz r14,0(r1)
-       lwz r15,4(r1)
-       lwz r24,8(r1)
-       lwz r25,12(r1)
-       lwz r26,16(r1)
-       lwz r27,20(r1)
-       lwz r28,24(r1)
-       lwz r29,28(r1)
-       lwz r30,32(r1)
-       lwz r31,36(r1)
-       lfd fr14,40(r1)
-       lfd fr15,48(r1)
-       lfd fr24,56(r1)
-       lfd fr25,64(r1)
-       lfd fr26,72(r1)
-       lfd fr27,80(r1)
-       lfd fr28,88(r1)
-       lfd fr29,96(r1)
-       lfd fr30,104(r1)
-       lfd fr31,112(r1)
-
-       lwz r16,128(r1)
-       lwz r17,132(r1)
-       lwz r18,136(r1)
-       lwz r19,140(r1)
-       lwz r20,144(r1)
-       lwz r21,148(r1)
-       lwz r22,152(r1)
-       lwz r23,156(r1)
-       lfd fr16,160(r1)
-       lfd fr17,168(r1)
-       lfd fr18,176(r1)
-       lfd fr19,184(r1)
-       lfd fr20,192(r1)
-       lfd fr21,200(r1)
-       lfd fr22,208(r1)
-       lfd fr23,216(r1)
-
-       mtlr r0
-       addi r1,r1,224
-       blr
-
-
-asm_switchstackandcall:
-       mflr r0
-       stwu r3,-48(r3)
-       stw r0,40(r3)
-       stw r1,44(r3)
-       stw r1,0(r5)
-       mr r1,r3
-
-       mtctr r4
-       mr r3,r6
-       bctrl
-
-       lwz r0,40(r1)
-       mtlr r0
-       lwz r1,44(r1)
-       blr
-
-
 asm_getclassvalues_atomic:
 _crit_restart:
 _crit_begin:
@@ -1532,7 +1355,7 @@ _crit_end:
        .data
 
 asm_criticalsections:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        .long   _crit_begin
        .long   _crit_end
        .long   _crit_restart
index dcd4a89ef8b455baf8ca256b29c65dac29661d80..d9adfa6da46dcb8706284e8b3d4236c350cddc90 100644 (file)
@@ -31,7 +31,7 @@
             Christian Ullrich
             Edwin Steiner
 
-   $Id: codegen.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: codegen.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -125,7 +125,7 @@ bool codegen(jitdata *jd)
 
        stackframesize = rd->memuse + savedregs_num;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* space to save argument of monitor_enter and Return Values to survive */
     /* monitor_exit. The stack position for the argument can not be shared  */
        /* with place to save the return register on PPC, since both values     */
@@ -148,7 +148,7 @@ bool codegen(jitdata *jd)
        (void) dseg_addaddress(cd, m);                          /* MethodPointer  */
        (void) dseg_adds4(cd, stackframesize * 4);              /* FrameSize      */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* IsSync contains the offset relative to the stack pointer for the
           argument of monitor_exit used in the exception handler. Since the
           offset could be zero and give a wrong meaning of the flag it is
@@ -296,7 +296,7 @@ bool codegen(jitdata *jd)
 
        /* save monitorenter argument */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                /* stack offset for monitor argument */
 
@@ -1509,6 +1509,122 @@ bool codegen(jitdata *jd)
                        emit_store(jd, iptr, iptr->dst, d);
                        break;
                        
+               case ICMD_IF_FCMPEQ:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_DCMPEQ:
+
+                       s1 = emit_load_s1(jd, iptr, src->prev, REG_FTMP1);
+                       s2 = emit_load_s2(jd, iptr, src, REG_FTMP2);
+                       M_FCMPU(s1, s2);
+                       M_BNAN(1);
+                       M_BEQ(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       break;
+
+               case ICMD_IF_FCMPNE:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_DCMPNE:
+
+                       s1 = emit_load_s1(jd, iptr, src->prev, REG_FTMP1);
+                       s2 = emit_load_s2(jd, iptr, src, REG_FTMP2);
+                       M_FCMPU(s1, s2);
+                       M_BNAN(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       M_BNE(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       break;
+
+
+               case ICMD_IF_FCMPL_LT:  /* ..., value, value ==> ...                  */
+               case ICMD_IF_DCMPL_LT:
+
+                       s1 = emit_load_s1(jd, iptr, src->prev, REG_FTMP1);
+                       s2 = emit_load_s2(jd, iptr, src, REG_FTMP2);
+                       M_FCMPU(s1, s2);
+                       M_BNAN(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       M_BLT(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       break;
+
+               case ICMD_IF_FCMPL_GT:  /* ..., value, value ==> ...                  */
+               case ICMD_IF_DCMPL_GT:
+
+                       s1 = emit_load_s1(jd, iptr, src->prev, REG_FTMP1);
+                       s2 = emit_load_s2(jd, iptr, src, REG_FTMP2);
+                       M_FCMPU(s1, s2);
+                       M_BNAN(1);
+                       M_BGT(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       break;
+
+               case ICMD_IF_FCMPL_LE:  /* ..., value, value ==> ...                  */
+               case ICMD_IF_DCMPL_LE:
+
+                       s1 = emit_load_s1(jd, iptr, src->prev, REG_FTMP1);
+                       s2 = emit_load_s2(jd, iptr, src, REG_FTMP2);
+                       M_FCMPU(s1, s2);
+                       M_BNAN(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       M_BLE(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       break;
+
+               case ICMD_IF_FCMPL_GE:  /* ..., value, value ==> ...                  */
+               case ICMD_IF_DCMPL_GE:
+
+                       s1 = emit_load_s1(jd, iptr, src->prev, REG_FTMP1);
+                       s2 = emit_load_s2(jd, iptr, src, REG_FTMP2);
+                       M_FCMPU(s1, s2);
+                       M_BNAN(1);
+                       M_BGE(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       break;
+
+               case ICMD_IF_FCMPG_LT:  /* ..., value, value ==> ...                  */
+               case ICMD_IF_DCMPG_LT:
+
+                       s1 = emit_load_s1(jd, iptr, src->prev, REG_FTMP1);
+                       s2 = emit_load_s2(jd, iptr, src, REG_FTMP2);
+                       M_FCMPU(s1, s2);
+                       M_BNAN(1);
+                       M_BLT(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       break;
+
+               case ICMD_IF_FCMPG_GT:  /* ..., value, value ==> ...                  */
+               case ICMD_IF_DCMPG_GT:
+
+                       s1 = emit_load_s1(jd, iptr, src->prev, REG_FTMP1);
+                       s2 = emit_load_s2(jd, iptr, src, REG_FTMP2);
+                       M_FCMPU(s1, s2);
+                       M_BNAN(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       M_BGT(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       break;
+
+               case ICMD_IF_FCMPG_LE:  /* ..., value, value ==> ...                  */
+               case ICMD_IF_DCMPG_LE:
+
+                       s1 = emit_load_s1(jd, iptr, src->prev, REG_FTMP1);
+                       s2 = emit_load_s2(jd, iptr, src, REG_FTMP2);
+                       M_FCMPU(s1, s2);
+                       M_BNAN(1);
+                       M_BLE(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       break;
+
+               case ICMD_IF_FCMPG_GE:  /* ..., value, value ==> ...                  */
+               case ICMD_IF_DCMPG_GE:
+
+                       s1 = emit_load_s1(jd, iptr, src->prev, REG_FTMP1);
+                       s2 = emit_load_s2(jd, iptr, src, REG_FTMP2);
+                       M_FCMPU(s1, s2);
+                       M_BNAN(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       M_BGE(0);
+                       codegen_addreference(cd, (basicblock *) iptr->target);
+                       break;
+
 
                /* memory operations **************************************************/
 
@@ -2069,9 +2185,9 @@ bool codegen(jitdata *jd)
                                        /* op1 = target JavaVM pc, val.i = constant   */
 
                        s1 = emit_load_s1(jd, iptr, src, REG_ITMP1);
-                       if ((iptr->val.i >= -32768) && (iptr->val.i <= 32767)) {
+                       if ((iptr->val.i >= -32768) && (iptr->val.i <= 32767))
                                M_CMPI(s1, iptr->val.i);
-                       else {
+                       else {
                                ICONST(REG_ITMP2, iptr->val.i);
                                M_CMP(s1, REG_ITMP2);
                        }
@@ -2507,7 +2623,7 @@ nowperformreturn:
                                M_MTLR(REG_ZERO);
                        }
                        
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                                disp = dseg_addaddress(cd, BUILTIN_monitorexit);
                                M_ALD(REG_ITMP3, REG_PV, disp);
@@ -2920,7 +3036,7 @@ gen_method:
                                        supervftbl = super->vftbl;
                                }
                        
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritrestart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                s1 = emit_load_s1(jd, iptr, src, REG_ITMP1);
@@ -3010,7 +3126,7 @@ gen_method:
                                        }
 
                                        M_ALD(REG_ITMP2, s1, OFFSET(java_objectheader, vftbl));
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                        codegen_threadcritstart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                        M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval));
@@ -3018,7 +3134,7 @@ gen_method:
                                        if (s1 != REG_ITMP1) {
                                                M_ILD(REG_ITMP1, REG_ITMP2, OFFSET(vftbl_t, baseval));
                                                M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval));
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                                codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                                M_ISUB(REG_ITMP3, REG_ITMP1, REG_ITMP3);
@@ -3027,7 +3143,7 @@ gen_method:
                                                M_ISUB(REG_ITMP3, REG_ITMP2, REG_ITMP3);
                                                M_ALD(REG_ITMP2, REG_PV, disp);
                                                M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval));
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                                codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                        }
@@ -3102,7 +3218,7 @@ gen_method:
                                supervftbl = super->vftbl;
                        }
                        
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
             codegen_threadcritrestart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                        s1 = emit_load_s1(jd, iptr, src, REG_ITMP1);
@@ -3197,13 +3313,13 @@ gen_method:
 
                                M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
                                M_ALD(REG_ITMP2, REG_PV, disp);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritstart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval));
                                M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval));
                                M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval));
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1);
@@ -3285,7 +3401,8 @@ gen_method:
 
                default:
                        *exceptionptr =
-                               new_internalerror("Unknown ICMD %d", iptr->opc);
+                               new_internalerror("Unknown ICMD %d during code generation",
+                                                                 iptr->opc);
                        return false;
        } /* switch */
                
@@ -3455,7 +3572,7 @@ gen_method:
 
                        /* move pointer to java_objectheader onto stack */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        /* order reversed because of data segment layout */
 
                        (void) dseg_addaddress(cd, lock_get_initial_lock_word());          /* monitorPtr */
@@ -3917,7 +4034,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
        /* check for exception */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        disp = dseg_addaddress(cd, builtin_get_exceptionptrptr);
        M_ALD(REG_ITMP1, REG_PV, disp);
        M_MTCTR(REG_ITMP1);
@@ -4007,7 +4124,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
                        /* move pointer to java_objectheader onto stack */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        /* order reversed because of data segment layout */
 
                        (void) dseg_addaddress(cd, lock_get_initial_lock_word());          /* monitorPtr */
index 2e0a2b4bfb0b2da39e687d221e1a1ea40a746274..45e8da558637db95d2e6982fbc64c3891163c7fb 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: md-asm.h 4851 2006-04-27 10:32:27Z twisti $
+   $Id: md-asm.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #define stacktrace_remove_stackframeinfo \
     L_stacktrace_remove_stackframeinfo$stub
 
-#if !defined(USE_THREADS) || !defined(NATIVE_THREADS)
+#if !defined(ENABLE_THREADS)
 #define _no_threads_exceptionptr              __no_threads_exceptionptr
 #endif
 
index bd31e9775dd6e850ddd2f82025ad3fdf4111488b..b1a243279e18520624feea9a013d843ee3ae31e7 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: md-os.c 4357 2006-01-22 23:33:38Z twisti $
+   $Id: md-os.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -103,7 +103,7 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 }
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void thread_restartcriticalsection(ucontext_t *uc)
 {
        /* XXX set pc to restart address */
index 8845fb4ba5c1a7eaa124b8086ae9f8d1238138b3..16a1d71ba7dacf0ade32fee3f815bbfa8ea25e16 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: md-os.c 4357 2006-01-22 23:33:38Z twisti $
+   $Id: md-os.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -94,7 +94,7 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 }
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void thread_restartcriticalsection(ucontext_t *uc)
 {
        /* XXX set pc to restart address */
index 22ae480db949d79bd0e1bedbd365cc9786afbf83..77b853c67f22764c4552e9c971aa24e5a26c7a6e 100644 (file)
@@ -94,7 +94,7 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 }
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void thread_restartcriticalsection(ucontext_t *uc)
 {
        /* XXX set pc to restart address */
index c73bbb50be9512e9b874add13f4ee231194de18d..dfb82906e70ed68fc1851d5933c1dbc0091ffc86 100644 (file)
 #include "native/include/java_lang_Thread.h"
 #include "native/include/java_lang_VMThread.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "vm/builtin.h"
@@ -72,7 +68,7 @@ struct list_method_entry {
 
 /* global variables ***********************************************************/
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 static java_lang_VMThread *profile_vmthread;
 #endif
 
@@ -97,7 +93,7 @@ bool profile_init(void)
 
 *******************************************************************************/
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 static void profile_thread(void)
 {
 /*     s4 i = 0; */
@@ -134,7 +130,7 @@ static void profile_thread(void)
 
 *******************************************************************************/
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 bool profile_start_thread(void)
 {
        java_lang_Thread *t;
index aff572e52d764ad280f9ad47fa78325e109bfde6..ed9a2f40de9ea77ca3e6dc35a5e701d91cf4c4ce 100644 (file)
@@ -30,7 +30,7 @@
             Christian Thalinger
             Christian Ullrich
 
-   $Id: stack.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: stack.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -72,7 +72,7 @@
 
 /* global variables ***********************************************************/
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 static java_objectheader *lock_stack_show_icmd;
 #endif
 
@@ -92,14 +92,12 @@ static java_objectheader *lock_stack_show_icmd;
 
 bool stack_init(void)
 {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* initialize the show lock */
 
        lock_stack_show_icmd = NEW(java_objectheader);
 
-# if defined(NATIVE_THREADS)
        lock_init_object_lock(lock_stack_show_icmd);
-# endif
 #endif
 
        /* everything's ok */
@@ -1996,16 +1994,188 @@ bool stack_analyse(jitdata *jd)
 #endif /* SUPPORT_LONG_CMP_CONST */
                                                        OPTT2_1(TYPE_LNG, TYPE_INT);
                                                break;
+
+#if 0
+                                       case ICMD_FCMPL:
+                                               COUNT(count_pcmd_op);
+                                               if ((len > 0) && (iptr[1].val.i == 0)) {
+                                                       switch (iptr[1].opc) {
+                                                       case ICMD_IFEQ:
+                                                               iptr[0].opc = ICMD_IF_FCMPEQ;
+                                                       icmd_if_fcmpl_tail:
+                                                               iptr[0].op1 = iptr[1].op1;
+                                                               iptr[1].opc = ICMD_NOP;
+
+                                                               OP2_0(TYPE_FLT);
+                                                               tbptr = m->basicblocks +
+                                                                       m->basicblockindex[iptr[0].op1];
+                       
+                                                               iptr[0].target = (void *) tbptr;
+
+                                                               MARKREACHED(tbptr, copy);
+                                                               COUNT(count_pcmd_bra);
+                                                               break;
+                                                       case ICMD_IFNE:
+                                                               iptr[0].opc = ICMD_IF_FCMPNE;
+                                                               goto icmd_if_fcmpl_tail;
+                                                       case ICMD_IFLT:
+                                                               iptr[0].opc = ICMD_IF_FCMPL_LT;
+                                                               goto icmd_if_fcmpl_tail;
+                                                       case ICMD_IFGT:
+                                                               iptr[0].opc = ICMD_IF_FCMPL_GT;
+                                                               goto icmd_if_fcmpl_tail;
+                                                       case ICMD_IFLE:
+                                                               iptr[0].opc = ICMD_IF_FCMPL_LE;
+                                                               goto icmd_if_fcmpl_tail;
+                                                       case ICMD_IFGE:
+                                                               iptr[0].opc = ICMD_IF_FCMPL_GE;
+                                                               goto icmd_if_fcmpl_tail;
+                                                       default:
+                                                               OPTT2_1(TYPE_FLT, TYPE_INT);
+                                                       }
+                                               }
+                                               else
+                                                       OPTT2_1(TYPE_FLT, TYPE_INT);
+                                               break;
+
+                                       case ICMD_FCMPG:
+                                               COUNT(count_pcmd_op);
+                                               if ((len > 0) && (iptr[1].val.i == 0)) {
+                                                       switch (iptr[1].opc) {
+                                                       case ICMD_IFEQ:
+                                                               iptr[0].opc = ICMD_IF_FCMPEQ;
+                                                       icmd_if_fcmpg_tail:
+                                                               iptr[0].op1 = iptr[1].op1;
+                                                               iptr[1].opc = ICMD_NOP;
+
+                                                               OP2_0(TYPE_FLT);
+                                                               tbptr = m->basicblocks +
+                                                                       m->basicblockindex[iptr[0].op1];
+                       
+                                                               iptr[0].target = (void *) tbptr;
+
+                                                               MARKREACHED(tbptr, copy);
+                                                               COUNT(count_pcmd_bra);
+                                                               break;
+                                                       case ICMD_IFNE:
+                                                               iptr[0].opc = ICMD_IF_FCMPNE;
+                                                               goto icmd_if_fcmpg_tail;
+                                                       case ICMD_IFLT:
+                                                               iptr[0].opc = ICMD_IF_FCMPG_LT;
+                                                               goto icmd_if_fcmpg_tail;
+                                                       case ICMD_IFGT:
+                                                               iptr[0].opc = ICMD_IF_FCMPG_GT;
+                                                               goto icmd_if_fcmpg_tail;
+                                                       case ICMD_IFLE:
+                                                               iptr[0].opc = ICMD_IF_FCMPG_LE;
+                                                               goto icmd_if_fcmpg_tail;
+                                                       case ICMD_IFGE:
+                                                               iptr[0].opc = ICMD_IF_FCMPG_GE;
+                                                               goto icmd_if_fcmpg_tail;
+                                                       default:
+                                                               OPTT2_1(TYPE_FLT, TYPE_INT);
+                                                       }
+                                               }
+                                               else
+                                                       OPTT2_1(TYPE_FLT, TYPE_INT);
+                                               break;
+
+                                       case ICMD_DCMPL:
+                                               COUNT(count_pcmd_op);
+                                               if ((len > 0) && (iptr[1].val.i == 0)) {
+                                                       switch (iptr[1].opc) {
+                                                       case ICMD_IFEQ:
+                                                               iptr[0].opc = ICMD_IF_DCMPEQ;
+                                                       icmd_if_dcmpl_tail:
+                                                               iptr[0].op1 = iptr[1].op1;
+                                                               iptr[1].opc = ICMD_NOP;
+
+                                                               OP2_0(TYPE_DBL);
+                                                               tbptr = m->basicblocks +
+                                                                       m->basicblockindex[iptr[0].op1];
+                       
+                                                               iptr[0].target = (void *) tbptr;
+
+                                                               MARKREACHED(tbptr, copy);
+                                                               COUNT(count_pcmd_bra);
+                                                               break;
+                                                       case ICMD_IFNE:
+                                                               iptr[0].opc = ICMD_IF_DCMPNE;
+                                                               goto icmd_if_dcmpl_tail;
+                                                       case ICMD_IFLT:
+                                                               iptr[0].opc = ICMD_IF_DCMPL_LT;
+                                                               goto icmd_if_dcmpl_tail;
+                                                       case ICMD_IFGT:
+                                                               iptr[0].opc = ICMD_IF_DCMPL_GT;
+                                                               goto icmd_if_dcmpl_tail;
+                                                       case ICMD_IFLE:
+                                                               iptr[0].opc = ICMD_IF_DCMPL_LE;
+                                                               goto icmd_if_dcmpl_tail;
+                                                       case ICMD_IFGE:
+                                                               iptr[0].opc = ICMD_IF_DCMPL_GE;
+                                                               goto icmd_if_dcmpl_tail;
+                                                       default:
+                                                               OPTT2_1(TYPE_DBL, TYPE_INT);
+                                                       }
+                                               }
+                                               else
+                                                       OPTT2_1(TYPE_DBL, TYPE_INT);
+                                               break;
+
+                                       case ICMD_DCMPG:
+                                               COUNT(count_pcmd_op);
+                                               if ((len > 0) && (iptr[1].val.i == 0)) {
+                                                       switch (iptr[1].opc) {
+                                                       case ICMD_IFEQ:
+                                                               iptr[0].opc = ICMD_IF_DCMPEQ;
+                                                       icmd_if_dcmpg_tail:
+                                                               iptr[0].op1 = iptr[1].op1;
+                                                               iptr[1].opc = ICMD_NOP;
+
+                                                               OP2_0(TYPE_DBL);
+                                                               tbptr = m->basicblocks +
+                                                                       m->basicblockindex[iptr[0].op1];
+                       
+                                                               iptr[0].target = (void *) tbptr;
+
+                                                               MARKREACHED(tbptr, copy);
+                                                               COUNT(count_pcmd_bra);
+                                                               break;
+                                                       case ICMD_IFNE:
+                                                               iptr[0].opc = ICMD_IF_DCMPNE;
+                                                               goto icmd_if_dcmpg_tail;
+                                                       case ICMD_IFLT:
+                                                               iptr[0].opc = ICMD_IF_DCMPG_LT;
+                                                               goto icmd_if_dcmpg_tail;
+                                                       case ICMD_IFGT:
+                                                               iptr[0].opc = ICMD_IF_DCMPG_GT;
+                                                               goto icmd_if_dcmpg_tail;
+                                                       case ICMD_IFLE:
+                                                               iptr[0].opc = ICMD_IF_DCMPG_LE;
+                                                               goto icmd_if_dcmpg_tail;
+                                                       case ICMD_IFGE:
+                                                               iptr[0].opc = ICMD_IF_DCMPG_GE;
+                                                               goto icmd_if_dcmpg_tail;
+                                                       default:
+                                                               OPTT2_1(TYPE_DBL, TYPE_INT);
+                                                       }
+                                               }
+                                               else
+                                                       OPTT2_1(TYPE_DBL, TYPE_INT);
+                                               break;
+#else
                                        case ICMD_FCMPL:
                                        case ICMD_FCMPG:
                                                COUNT(count_pcmd_op);
                                                OPTT2_1(TYPE_FLT, TYPE_INT);
                                                break;
+
                                        case ICMD_DCMPL:
                                        case ICMD_DCMPG:
                                                COUNT(count_pcmd_op);
                                                OPTT2_1(TYPE_DBL, TYPE_INT);
                                                break;
+#endif
 
                                                /* pop 1 push 1 */
                                                
@@ -2718,7 +2888,7 @@ void stack_show_method(jitdata *jd)
        cd   = jd->cd;
        rd   = jd->rd;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* We need to enter a lock here, since the binutils disassembler
           is not reentrant-able and we could not read functions printed
           at the same time. */
@@ -2915,7 +3085,7 @@ void stack_show_method(jitdata *jd)
        }
 #endif
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorexit(lock_stack_show_icmd);
 #endif
 
@@ -3421,12 +3591,40 @@ void stack_show_icmd(instruction *iptr, bool deadcode)
        case ICMD_IF_ICMPGE:
        case ICMD_IF_ICMPGT:
        case ICMD_IF_ICMPLE:
+
        case ICMD_IF_LCMPEQ:
        case ICMD_IF_LCMPNE:
        case ICMD_IF_LCMPLT:
        case ICMD_IF_LCMPGE:
        case ICMD_IF_LCMPGT:
        case ICMD_IF_LCMPLE:
+
+       case ICMD_IF_FCMPEQ:
+       case ICMD_IF_FCMPNE:
+
+       case ICMD_IF_FCMPL_LT:
+       case ICMD_IF_FCMPL_GE:
+       case ICMD_IF_FCMPL_GT:
+       case ICMD_IF_FCMPL_LE:
+
+       case ICMD_IF_FCMPG_LT:
+       case ICMD_IF_FCMPG_GE:
+       case ICMD_IF_FCMPG_GT:
+       case ICMD_IF_FCMPG_LE:
+
+       case ICMD_IF_DCMPEQ:
+       case ICMD_IF_DCMPNE:
+
+       case ICMD_IF_DCMPL_LT:
+       case ICMD_IF_DCMPL_GE:
+       case ICMD_IF_DCMPL_GT:
+       case ICMD_IF_DCMPL_LE:
+
+       case ICMD_IF_DCMPG_LT:
+       case ICMD_IF_DCMPG_GE:
+       case ICMD_IF_DCMPG_GT:
+       case ICMD_IF_DCMPG_LE:
+
        case ICMD_IF_ACMPEQ:
        case ICMD_IF_ACMPNE:
                if (!(iptr->opc & ICMD_CONDITION_MASK)) {
index f7f3fb247c12fe1d03586ff68cec4f32d6186834..63d8d0b1298631b0f6672b0abac54583b48a80ae 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Christian Thalinger
             Edwin Steiner
 
-   $Id: stacktrace.c 4913 2006-05-14 14:02:51Z edwin $
+   $Id: stacktrace.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "native/include/java_lang_Throwable.h"
 #include "native/include/java_lang_VMThrowable.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #else
 # include "threads/none/threads.h"
 #endif
@@ -89,7 +85,7 @@ struct linenumbertable_entry {
 
 /* global variables ***********************************************************/
 
-#if !defined(USE_THREADS)
+#if !defined(ENABLE_THREADS)
 stackframeinfo *_no_threads_stackframeinfo = NULL;
 #endif
 
@@ -819,7 +815,10 @@ stacktracebuffer *stacktrace_create(threadobject* thread)
           native stackframeinfo (VMThrowable.fillInStackTrace is a native
           function). */
 
-#if defined(USE_THREADS)
+       /* We don't use the STACKFRAMEINFO macro here, as we have to use
+          the passed thread. */
+
+#if defined(ENABLE_THREADS)
        sfi = thread->_stackframeinfo;
 #else
        sfi = _no_threads_stackframeinfo;
index acb898a449161ba6908199692ee27bd6a49198ab..1e83f69891837a0b9aad4330981e15614bf78179 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: stacktrace.h 4913 2006-05-14 14:02:51Z edwin $
+   $Id: stacktrace.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -64,7 +64,7 @@ struct stackframeinfo {
        u1             *xpc;                /* XPC (for inline stubs)             */
 };
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 #define STACKFRAMEINFO    (&(THREADOBJECT->_stackframeinfo))
 #else
 extern stackframeinfo *_no_threads_stackframeinfo;
index 5db73df1bd915830f012f8949809574816fdc447..9bd558574ec8cc85712a9f3d2213d76a051d8d4d 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: typecheck.c 4863 2006-04-30 16:17:44Z edwin $
+   $Id: typecheck.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -2100,18 +2100,46 @@ fieldaccess_tail:
                        case ICMD_IF_ICMPLE:
                        case ICMD_IF_ACMPEQ:
                        case ICMD_IF_ACMPNE:
+
                        case ICMD_IF_LEQ:
                        case ICMD_IF_LNE:
                        case ICMD_IF_LLT:
                        case ICMD_IF_LGE:
                        case ICMD_IF_LGT:
                        case ICMD_IF_LLE:
+
                        case ICMD_IF_LCMPEQ:
                        case ICMD_IF_LCMPNE:
                        case ICMD_IF_LCMPLT:
                        case ICMD_IF_LCMPGE:
                        case ICMD_IF_LCMPGT:
                        case ICMD_IF_LCMPLE:
+
+                       case ICMD_IF_FCMPEQ:
+                       case ICMD_IF_FCMPNE:
+
+                       case ICMD_IF_FCMPL_LT:
+                       case ICMD_IF_FCMPL_GE:
+                       case ICMD_IF_FCMPL_GT:
+                       case ICMD_IF_FCMPL_LE:
+
+                       case ICMD_IF_FCMPG_LT:
+                       case ICMD_IF_FCMPG_GE:
+                       case ICMD_IF_FCMPG_GT:
+                       case ICMD_IF_FCMPG_LE:
+
+                       case ICMD_IF_DCMPEQ:
+                       case ICMD_IF_DCMPNE:
+
+                       case ICMD_IF_DCMPL_LT:
+                       case ICMD_IF_DCMPL_GE:
+                       case ICMD_IF_DCMPL_GT:
+                       case ICMD_IF_DCMPL_LE:
+
+                       case ICMD_IF_DCMPG_LT:
+                       case ICMD_IF_DCMPG_GE:
+                       case ICMD_IF_DCMPG_GT:
+                       case ICMD_IF_DCMPG_LE:
                                TYPECHECK_COUNT(stat_ins_branch);
                                tbptr = (basicblock *) state->iptr->target;
 
index c246b932af361255002f2388e70fcfd726f3957e..aaf2e8a5f8922988a4ec2d3da2b1f6ce99b97f0b 100644 (file)
@@ -30,7 +30,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: asmpart.S 4805 2006-04-21 10:54:24Z twisti $
+   $Id: asmpart.S 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -345,7 +345,7 @@ L_asm_call_jit_compiler:                /* required for PIC code              */
        jmp     *v0                         /* ...and now call the new method     */
 
 L_asm_call_jit_compiler_exception:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        call    builtin_asm_get_exceptionptrptr@PLT
        mov     v0,itmp2                    /* v0 == xptr                         */
 #else
@@ -564,7 +564,7 @@ asm_wrapper_patcher:
        ret                                 /* call new patched code              */
 
 L_asm_wrapper_patcher_exception:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        call    builtin_asm_get_exceptionptrptr@PLT
        mov     v0,itmp2                    /* v0 == xptr                         */
 #else
@@ -881,7 +881,7 @@ _crit_end:
        .data
                
 asm_criticalsections:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        .quad   _crit_begin
        .quad   _crit_end
        .quad   _crit_restart
index b61a84689b4cd0aedb704e8d985208f3c4b2d038..6d5b11b11dec479e9e43df8e0ddaad9f9bb35318 100644 (file)
@@ -30,7 +30,7 @@
    Changes: Christian Ullrich
             Edwin Steiner
 
-   $Id: codegen.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: codegen.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -126,7 +126,7 @@ bool codegen(jitdata *jd)
 
        stackframesize = rd->memuse + savedregs_num;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* space to save argument of monitor_enter */
 
        if (checksync && (m->flags & ACC_SYNCHRONIZED))
@@ -144,7 +144,7 @@ bool codegen(jitdata *jd)
        (void) dseg_addaddress(cd, m);                          /* MethodPointer  */
        (void) dseg_adds4(cd, stackframesize * 8);              /* FrameSize      */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* IsSync contains the offset relative to the stack pointer for the
           argument of monitor_exit used in the exception handler. Since the
           offset could be zero and give a wrong meaning of the flag it is
@@ -256,7 +256,7 @@ bool codegen(jitdata *jd)
 
        /* save monitorenter argument */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                /* stack offset for monitor argument */
 
@@ -2992,7 +2992,7 @@ nowperformreturn:
                        }
 #endif /* !defined(NDEBUG) */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
                                M_ALD(rd->argintregs[0], REG_SP, rd->memuse * 8);
        
@@ -3354,7 +3354,7 @@ gen_method:
                                        supervftbl = super->vftbl;
                                }
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritrestart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                s1 = emit_load_s1(jd, iptr, src, REG_ITMP1);
@@ -3478,7 +3478,7 @@ gen_method:
                                        }
 
                                        M_MOV_IMM(supervftbl, REG_ITMP3);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                        codegen_threadcritstart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                        emit_movl_membase32_reg(cd, REG_ITMP2,
@@ -3491,7 +3491,7 @@ gen_method:
                                        /*                                              emit_movl_membase_reg(cd, REG_ITMP3, */
                                        /*                                                                                              OFFSET(vftbl_t, diffval), */
                                        /*                                                                                              REG_ITMP3); */
-                                       /*  #if defined(USE_THREADS) && defined(NATIVE_THREADS) */
+                                       /*  #if defined(ENABLE_THREADS) */
                                        /*                                              codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase); */
                                        /*  #endif */
                                        /*                                              emit_alu_reg_reg(cd, ALU_SUB, REG_ITMP1, REG_ITMP2); */
@@ -3504,7 +3504,7 @@ gen_method:
                                        M_MOV_IMM(supervftbl, REG_ITMP3);
                                        M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval));
                                        /*                                      } */
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                        codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                        M_CMP(REG_ITMP3, REG_ITMP2);
@@ -3576,7 +3576,7 @@ gen_method:
                                supervftbl = super->vftbl;
                        }
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
             codegen_threadcritrestart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
 
@@ -3698,7 +3698,7 @@ gen_method:
                                }
 
                                emit_mov_imm_reg(cd, (ptrint) supervftbl, REG_ITMP2);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritstart(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                emit_movl_membase_reg(cd, REG_ITMP1,
@@ -3710,7 +3710,7 @@ gen_method:
                                emit_movl_membase_reg(cd, REG_ITMP2,
                                                                                OFFSET(vftbl_t, baseval),
                                                                                REG_ITMP2);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                                codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
 #endif
                                emit_alu_reg_reg(cd, ALU_SUB, REG_ITMP2, REG_ITMP1);
@@ -3923,7 +3923,7 @@ gen_method:
 
                        /* move pointer to java_objectheader onto stack */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        /* create a virtual java_objectheader */
 
                        (void) dseg_addaddress(cd, lock_get_initial_lock_word());          /* monitorPtr */
@@ -4301,7 +4301,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
        /* check for exception */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        M_MOV_IMM(builtin_get_exceptionptrptr, REG_ITMP3);
        M_CALL(REG_ITMP3);
 #else
@@ -4331,7 +4331,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
        /* handle exception */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        M_LST(REG_ITMP2, REG_SP, 0 * 8);
        M_MOV_IMM(builtin_get_exceptionptrptr, REG_ITMP3);
        M_CALL(REG_ITMP3);
@@ -4361,7 +4361,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
                ptrint    mcode;
                u1       *savedmcodeptr;
                u1       *tmpmcodeptr;
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                s4        disp;
 #endif
 
@@ -4383,7 +4383,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
                        /* move pointer to java_objectheader onto stack */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
                        /* create a virtual java_objectheader */
 
                        (void) dseg_addaddress(cd, lock_get_initial_lock_word());          /* monitorPtr */
index f3be618c523712a59b09b68bb5dcdb63016dd9d0..c64ef66692c3f08d6e08f904992bd642452c6e9d 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: md.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: md.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -132,7 +132,7 @@ void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
 }
 
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void thread_restartcriticalsection(ucontext_t *uc)
 {
        void *critical;
index 041d627bcb3f84a2f5b9d14fd5e1626d866864e3..97963a5557f223bd1e9daf19481c1d1acdc2782f 100644 (file)
@@ -32,7 +32,7 @@
             Edwin Steiner
             Christian Thalinger
 
-   $Id: linker.c 4834 2006-04-25 12:25:43Z edwin $
+   $Id: linker.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -369,7 +369,7 @@ classinfo *link_class(classinfo *c)
                return NULL;
        }
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* enter a monitor on the class */
 
        builtin_monitorenter((java_objectheader *) c);
@@ -378,7 +378,7 @@ classinfo *link_class(classinfo *c)
        /* maybe the class is already linked */
 
        if (c->state & CLASS_LINKED) {
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                builtin_monitorexit((java_objectheader *) c);
 #endif
 
@@ -414,7 +414,7 @@ classinfo *link_class(classinfo *c)
                compilingtime_start();
 #endif
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* leave the monitor */
 
        builtin_monitorexit((java_objectheader *) c);
@@ -1074,12 +1074,8 @@ static arraydescriptor *link_array(classinfo *c)
 
 static void linker_compute_subclasses(classinfo *c)
 {
-#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        compiler_lock();
-#else
-       intsDisable();
-#endif
 #endif
 
        if (!(c->flags & ACC_INTERFACE)) {
@@ -1098,12 +1094,8 @@ static void linker_compute_subclasses(classinfo *c)
 
        linker_compute_class_values(class_java_lang_Object);
 
-#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        compiler_unlock();
-#else
-       intsRestore();
-#endif
 #endif
 }
 
index bec093a192e6364cce144136510d68e5e9f61108..208754d498ca575c5287c7e5095a55b78aeb30e5 100644 (file)
@@ -32,7 +32,7 @@
             Edwin Steiner
             Christian Thalinger
 
-   $Id: loader.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: loader.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 #include "native/native.h"
 #include "native/include/java_lang_Throwable.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-#  include "threads/green/locks.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "toolbox/logging.h"
 
 *******************************************************************************/
  
-bool loader_init(u1 *stackbottom)
+bool loader_init(void)
 {
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        list_classpath_entry *lce;
 
        /* Initialize the monitor pointer for zip/jar file locking. */
@@ -223,11 +218,6 @@ bool loader_init(u1 *stackbottom)
                  load_class_bootstrap(utf_new_char("[Ljava/lang/Object;"))))
                return false;
 
-#if defined(USE_THREADS)
-       if (stackbottom != 0)
-               lock_init(); /* XXX this should probably be done only for green threads */
-#endif
-
        return true;
 }
 
@@ -1015,7 +1005,7 @@ static bool load_method(classbuffer *cb, methodinfo *m, descriptor_pool *descpoo
 
        c = cb->class;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        lock_init_object_lock(&m->header);
 #endif
 
@@ -2488,7 +2478,7 @@ classinfo *load_newly_created_array(classinfo *c, java_objectheader *loader)
        clone = c->methods;
        MSET(clone, 0, methodinfo, 1);
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        lock_init_object_lock(&clone->header);
 #endif
 
index 412553a531f1a5754a985c7ce67a279aa7e118cd..763cc7c9e97b22205fe745b86ac645cd21680078 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: loader.h 4490 2006-02-12 16:02:43Z edwin $
+   $Id: loader.h 4921 2006-05-15 14:24:36Z twisti $
 */
 
 
@@ -115,17 +115,10 @@ struct classbuffer {
 };
 
 
-/* export variables ***********************************************************/
-
-#if defined(USE_THREADS)
-extern int blockInts;
-#endif
-
-
 /* function prototypes ********************************************************/
 
 /* initialize loader, load important systemclasses */
-bool loader_init(u1 *stackbottom);
+bool loader_init(void);
 
 void loader_load_all_classes(void);
 
index 4529ea3865a3be373ef2762a397ac1ab58915322..d4520fcd82487535ef6663c952442ed808bc9336 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: signal.c 4530 2006-02-21 09:11:53Z twisti $
+   $Id: signal.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -40,7 +40,7 @@
 
 #include "vm/types.h"
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 # include "threads/native/threads.h"
 #endif
 
@@ -115,7 +115,7 @@ void signal_init(void)
 
        /* catch SIGQUIT for thread dump */
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 #if !defined(__FREEBSD__)
        act.sa_sigaction = signal_handler_sigquit;
        act.sa_flags = SA_SIGINFO;
@@ -137,7 +137,7 @@ void signal_init(void)
 
 *******************************************************************************/
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void signal_handler_sigquit(int sig, siginfo_t *siginfo, void *_p)
 {
        /* do thread dump */
@@ -175,7 +175,7 @@ void signal_handler_sigint(int sig, siginfo_t *siginfo, void *_p)
 
 *******************************************************************************/
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
 void signal_handler_sigusr1(int sig, siginfo_t *siginfo, void *_p)
 {
        /* call stacktrace function */
index a0e975559922962987b34e1356d2d6d0ce124d2e..7259258de59d3b364b1128b385d108628db11110 100644 (file)
@@ -31,7 +31,7 @@
    Changes: Christian Thalinger
                        Edwin Steiner
 
-   $Id: string.c 4908 2006-05-12 16:49:50Z edwin $
+   $Id: string.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -61,7 +61,7 @@
 
 hashtable hashtable_string;             /* hashtable for javastrings          */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
 static java_objectheader *lock_hashtable_string;
 #endif
 
@@ -206,14 +206,12 @@ bool string_init(void)
 
        hashtable_create(&hashtable_string, HASHTABLE_STRING_SIZE);
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* create string hashtable lock object */
 
        lock_hashtable_string = NEW(java_objectheader);
 
-# if defined(NATIVE_THREADS)
        lock_init_object_lock(lock_hashtable_string);
-# endif
 #endif
 
        /* everything's ok */
@@ -565,7 +563,7 @@ java_objectheader *literalstring_u2(java_chararray *a, u4 length, u4 offset,
     u4                slot;
     u2                i;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorenter(lock_hashtable_string);
 #endif
 
@@ -590,7 +588,7 @@ java_objectheader *literalstring_u2(java_chararray *a, u4 length, u4 offset,
                        if (!copymode)
                                mem_free(a, sizeof(java_chararray) + sizeof(u2) * (length - 1) + 10);
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        builtin_monitorexit(lock_hashtable_string);
 #endif
 
@@ -632,7 +630,7 @@ java_objectheader *literalstring_u2(java_chararray *a, u4 length, u4 offset,
 
        js = NEW(java_lang_String);
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        lock_init_object_lock(&js->header);
 #endif
 
@@ -693,7 +691,7 @@ java_objectheader *literalstring_u2(java_chararray *a, u4 length, u4 offset,
                hashtable_string = newhash;
        }
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorexit(lock_hashtable_string);
 #endif
 
index b8e753c0a57e2f8a108717b0abf5972b50e1ea5b..2d6be09b2fe20ad829fbb5ffd37b025f0b8adb21 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: suck.c 4883 2006-05-05 18:58:00Z edwin $
+   $Id: suck.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -540,7 +540,7 @@ classbuffer *suck_start(classinfo *c)
 #if defined(ENABLE_ZLIB)
                if (lce->type == CLASSPATH_ARCHIVE) {
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        /* enter a monitor on zip/jar archives */
 
                        builtin_monitorenter((java_objectheader *) lce);
@@ -550,7 +550,7 @@ classbuffer *suck_start(classinfo *c)
 
                        cb = zip_get(lce, c);
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        /* leave the monitor */
 
                        builtin_monitorexit((java_objectheader *) lce);
index 41feb42a254059e491d556c12ecea80de7feb011..a8904ea20e4107dabe70d3c5706ffec23d0172f3 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: suck.h 4357 2006-01-22 23:33:38Z twisti $
+   $Id: suck.h 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
@@ -54,10 +54,9 @@ enum {
 typedef struct list_classpath_entry list_classpath_entry;
 
 struct list_classpath_entry {
-#if defined(USE_THREADS)
-       /* Required for monitor locking on zip/jar files. */
-       java_objectheader  header;
-#endif                           
+#if defined(ENABLE_THREADS)
+       java_objectheader  header;              /* monitor locking on zip/jar files   */
+#endif
        s4                 type;
        char              *path;
        s4                 pathlen;
index cd16f8b3f7ccfb11384b667b8883d3693d433c38..24dabea1ebfdad86861b50d304c3d66f504d447f 100644 (file)
@@ -31,7 +31,7 @@
             Christian Thalinger
                        Edwin Steiner
 
-   $Id: utf8.c 4900 2006-05-11 09:18:28Z twisti $
+   $Id: utf8.c 4921 2006-05-15 14:24:36Z twisti $
 
 */
 
 
 #include "mm/memory.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "vm/builtin.h"
@@ -505,7 +501,7 @@ utf *utf_new(const char *text, u2 length)
        utf *u;                             /* hashtable element                  */
        u2 i;
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorenter(hashtable_utf->header);
 #endif
 
@@ -535,7 +531,7 @@ utf *utf_new(const char *text, u2 length)
 
                        /* symbol found in hashtable */
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
                        builtin_monitorexit(hashtable_utf->header);
 #endif
 
@@ -608,7 +604,7 @@ utf *utf_new(const char *text, u2 length)
                hashtable_utf = newhash;
        }
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        builtin_monitorexit(hashtable_utf->header);
 #endif
 
index 644c8cd0d53bb7bc4606724cb09702c0c5b0ab0f..3676003f3d84d0a3282dc93b67baf6c191ec28f9 100644 (file)
 #include "native/jni.h"
 #include "native/native.h"
 
-#if defined(USE_THREADS)
-# if defined(NATIVE_THREADS)
-#  include "threads/native/threads.h"
-# else
-#  include "threads/green/threads.h"
-#  include "threads/green/locks.h"
-# endif
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
 #endif
 
 #include "vm/classcache.h"
@@ -91,8 +86,6 @@ bool vm_exiting = false;
 u1 *intrp_main_stack = NULL;
 #endif
 
-void **stackbottom = NULL;
-
 char *mainstring = NULL;
 classinfo *mainclass = NULL;
 
@@ -1086,12 +1079,9 @@ bool vm_create(JavaVMInitArgs *vm_args)
        }
 #endif
 
-#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        threads_preinit();
 #endif
-       lock_init();
-#endif
 
        /* initialize the string hashtable stuff: lock (must be done
           _after_ threads_preinit) */
@@ -1160,7 +1150,7 @@ bool vm_create(JavaVMInitArgs *vm_args)
        /* initialize the loader subsystems (must be done _after_
        classcache_init) */
 
-       if (!loader_init((u1 *) stackbottom))
+       if (!loader_init())
                throw_main_exception_exit();
 
        if (!linker_init())
@@ -1182,8 +1172,8 @@ bool vm_create(JavaVMInitArgs *vm_args)
        if (!jni_init())
                throw_main_exception_exit();
 
-#if defined(USE_THREADS)
-       if (!threads_init((u1 *) stackbottom))
+#if defined(ENABLE_THREADS)
+       if (!threads_init())
                throw_main_exception_exit();
 #endif
 
@@ -1202,7 +1192,7 @@ bool vm_create(JavaVMInitArgs *vm_args)
                throw_main_exception_exit();
 #endif
 
-#if defined(USE_THREADS)
+#if defined(ENABLE_THREADS)
        /* finally, start the finalizer thread */
 
        if (!finalizer_start_thread())
@@ -1243,12 +1233,8 @@ bool vm_create(JavaVMInitArgs *vm_args)
 
 s4 vm_destroy(JavaVM *vm)
 {
-#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
        threads_join_all_threads();
-#else
-       killThread(currentThread);
-#endif
 #endif
 
        /* everything's ok */
@@ -1355,11 +1341,6 @@ void vm_exit_handler(void)
 # endif
 #endif /* !defined(NDEBUG) */
 
-#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
-       clear_thread_flags();           /* restores standard file descriptor
-                                      flags */
-#endif
-
 #if defined(ENABLE_RT_TIMING)
        rt_timing_print_time_stats(stderr);
 #endif