Hi,

attached you'll find my latest patch to somehow fix the cygwin build. It applies cleanly against CVS head.

in order to get the Cygwin build to work, I had to 'deinline' jthreads.h and move the inlined functions back into jthreads.c. I get tons of linker errors on Cygwin with the current sources otherwise.

I've ran a benchmark (EmbeddedCaffeineMark) against both version, and haven't found much difference (<5%) between the inlined and deinlined version. So if noone minds (and posts some numbers ;), I'll check it in for 1.1.1.

cheers,
dalibor topic
diff -ur kaffe-backup/configure.in kaffe/configure.in
--- kaffe-backup/configure.in   2003-07-29 16:45:51.000000000 -0400
+++ kaffe/configure.in  2003-07-30 11:41:53.000000000 -0400
@@ -1433,6 +1433,13 @@
 else
        KLIBFLAGS=
 fi
+dnl uncomment the line below to build
+dnl kaffe helper libraries as dlls on cygwin
+dnl
+dnl that doesn't work currently, it fails because
+dnl many symbols are undefined.
+dnl
+dnl KLIBFLAGS="$KLIBFLAGS -no-undefined"
 AC_SUBST(KLIBFLAGS)
 
 if test x"$vm_dynamic_binary" = x"no"; then
diff -ur kaffe-backup/kaffe/kaffeh/sigs.c kaffe/kaffe/kaffeh/sigs.c
--- kaffe-backup/kaffe/kaffeh/sigs.c    2002-05-30 05:55:17.000000000 -0400
+++ kaffe/kaffe/kaffeh/sigs.c   2003-07-30 09:50:25.000000000 -0400
@@ -8,7 +8,10 @@
  * See the file "license.terms" for information on usage and redistribution 
  * of this file. 
  */
-
+
+#include <stdlib.h>
+#include <string.h>
+
 #include "config.h"
 #include "config-std.h"
 #include "config-mem.h"
Only in kaffe/kaffe/kaffevm: classMethod.c.~1.105.~
diff -ur kaffe-backup/kaffe/kaffevm/systems/unix-jthreads/jthread.c 
kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c
--- kaffe-backup/kaffe/kaffevm/systems/unix-jthreads/jthread.c  2003-07-26 
15:21:50.000000000 -0400
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c 2003-07-30 12:18:11.000000000 
-0400
@@ -651,6 +651,15 @@
 }
 
 /*
+ * return thread-specific data for a given jthread
+ */
+threadData*
+jthread_get_data(jthread_t tid) 
+{
+       return (&tid->localData);
+}
+
+/*
  * handle an interrupt.
  * 
  * this function is either invoked from within a signal handler, or as the
@@ -1474,6 +1483,109 @@
  *
  */
 
+/* 
+ * return the current thread 
+ */
+jthread_t
+jthread_current(void) 
+{ 
+       return currentJThread; 
+}
+
+/*
+ * determine whether a location is on the stack of the current thread
+ */
+int
+jthread_on_current_stack(void *bp)      
+{
+        int rc = bp >= currentJThread->stackBase && bp < currentJThread->stackEnd;
+
+DBG(JTHREADDETAIL,
+       dprintf("on current stack: base=%p size=%ld bp=%p %s\n",
+               currentJThread->stackBase,
+               (long)((char *) currentJThread->stackEnd - (char *) 
currentJThread->stackBase),
+               bp,
+               (rc ? "yes" : "no"));
+    )
+
+        return rc;
+}
+
+/* 
+ * Check for room on stack.
+ */
+int     
+jthread_stackcheck(int left)
+{
+       int rc;
+#if defined(STACK_GROWS_UP)
+        rc = jthread_on_current_stack((char*)&rc + left);
+#else
+        rc = jthread_on_current_stack((char*)&rc - left);
+#endif
+       return (rc);
+}
+
+/*
+ * Get the current stack limit.
+ */
+
+#define        REDZONE 1024
+
+void
+jthread_relaxstack(int yes)
+{
+       if( yes )
+       {
+#if defined(STACK_GROWS_UP)
+               uintp end = (uintp) currentJThread->stackEnd;
+               end += REDZONE;
+               currentJThread->stackEnd = (void *) end;
+#else
+               uintp base = (uintp) currentJThread->stackBase;
+               base -= REDZONE;
+               currentJThread->stackBase = (void *) base;
+#endif
+       }
+       else
+       {
+#if defined(STACK_GROWS_UP)
+               uintp end = (uintp) currentJThread->stackEnd;
+               end -= REDZONE;
+               currentJThread->stackEnd = (void *) end;
+#else
+               uintp base = (uintp) currentJThread->stackBase;
+               base += REDZONE;
+               currentJThread->stackBase = (void *) base;
+#endif
+       }
+}
+
+void*
+jthread_stacklimit(void)
+{
+#if defined(STACK_GROWS_UP)
+        return (void*)((uintp)currentJThread->stackEnd - REDZONE);
+#else
+        return (void*)((uintp)currentJThread->stackBase + REDZONE);
+#endif
+}
+
+/* Spinlocks: simple since we're uniprocessor */
+/* ARGSUSED */
+void
+jthread_spinon(void *arg)
+{
+       jthread_suspendall();
+}
+
+/* ARGSUSED */
+void
+jthread_spinoff(void *arg)
+{
+       jthread_unsuspendall();
+}
+
 /*
  * yield to a thread of equal priority
  */
@@ -1787,6 +1899,51 @@
                handleIO(true);
        }
 }
+
+jlong jthread_get_usage(jthread_t jt)
+{
+       jlong retval;
+       
+       if( jt == jthread_current() )
+       {
+               struct rusage ru;
+               jlong ct;
+               
+               getrusage(RUSAGE_SELF, &ru);
+               ct = ((jlong)ru.ru_utime.tv_sec * 1000)
+                       + ((jlong)ru.ru_utime.tv_usec / (jlong)1000);
+               ct += ((jlong)ru.ru_stime.tv_sec * 1000)
+                       + ((jlong)ru.ru_stime.tv_usec / (jlong)1000);
+
+               retval = jt->totalUsed + (ct - jt->startUsed);
+       }
+       else
+       {
+               retval = jt->totalUsed;
+       }
+       retval *= 1000; /* Convert to nanos */
+       return( retval );
+}
+
+int jthread_get_status(jthread_t jt)
+{
+       return( jt->status );
+}
+
+int jthread_is_interrupted(jthread_t jt)
+{
+       return( jt->flags & THREAD_FLAGS_INTERRUPTED );
+}
+
+int jthread_on_mutex(jthread_t jt)
+{
+       return( jt->flags & THREAD_FLAGS_WAIT_MUTEX );
+}
+
+int jthread_on_condvar(jthread_t jt)
+{
+       return( jt->flags & THREAD_FLAGS_WAIT_CONDVAR );
+}
 
 /*============================================================================
  * 
diff -ur kaffe-backup/kaffe/kaffevm/systems/unix-jthreads/jthread.h 
kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h
--- kaffe-backup/kaffe/kaffevm/systems/unix-jthreads/jthread.h  2003-07-26 
15:21:50.000000000 -0400
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h 2003-07-30 13:40:59.000000000 
-0400
@@ -124,7 +124,6 @@
        double                          align[0];
 } jthread, *jthread_t;
 
-extern jthread_t currentJThread;
 
 /****************************************************************************
  *
@@ -209,11 +208,7 @@
 /* 
  * return the current thread 
  */
-static inline jthread_t
-jthread_current(void) 
-{ 
-       return currentJThread; 
-}
+jthread_t jthread_current(void);
 
 /* 
  * count the number of stack frames - unimplemented 
@@ -243,83 +238,20 @@
 /*
  * determine whether a location is on the stack of the current thread
  */
-static inline int
-jthread_on_current_stack(void *bp)      
-{
-        int rc = bp >= currentJThread->stackBase && bp < currentJThread->stackEnd;
-
-DBG(JTHREADDETAIL,
-       dprintf("on current stack: base=%p size=%ld bp=%p %s\n",
-               currentJThread->stackBase,
-               (long)((char *) currentJThread->stackEnd - (char *) 
currentJThread->stackBase),
-               bp,
-               (rc ? "yes" : "no"));
-    )
-
-        return rc;
-}
+int            jthread_on_current_stack(void *bp);
 
 /* 
  * Check for room on stack.
  */
-static inline int     
-jthread_stackcheck(int left)
-{
-       int rc;
-#if defined(STACK_GROWS_UP)
-        rc = jthread_on_current_stack((char*)&rc + left);
-#else
-        rc = jthread_on_current_stack((char*)&rc - left);
-#endif
-       return (rc);
-}
+int            jthread_stackcheck(int left);
 
 /*
  * Get the current stack limit.
  */
 
-#define        REDZONE 1024
+void jthread_relaxstack(int yes);
 
-static inline void
-jthread_relaxstack(int yes)
-{
-       if( yes )
-       {
-#if defined(STACK_GROWS_UP)
-               uintp end = (uintp) currentJThread->stackEnd;
-               end += REDZONE;
-               currentJThread->stackEnd = (void *) end;
-#else
-               uintp base = (uintp) currentJThread->stackBase;
-               base -= REDZONE;
-               currentJThread->stackBase = (void *) base;
-#endif
-       }
-       else
-       {
-#if defined(STACK_GROWS_UP)
-               uintp end = (uintp) currentJThread->stackEnd;
-               end -= REDZONE;
-               currentJThread->stackEnd = (void *) end;
-#else
-               uintp base = (uintp) currentJThread->stackBase;
-               base += REDZONE;
-               currentJThread->stackBase = (void *) base;
-#endif
-       }
-}
-
-static
-inline
-void*
-jthread_stacklimit(void)
-{
-#if defined(STACK_GROWS_UP)
-        return (void*)((uintp)currentJThread->stackEnd - REDZONE);
-#else
-        return (void*)((uintp)currentJThread->stackBase + REDZONE);
-#endif
-}
+void* jthread_stacklimit(void);
 
 /*
  * determine the "interesting" stack range a conservative gc must walk
@@ -364,11 +296,7 @@
 /*
  * return thread-specific data for a given jthread
  */
-static inline threadData*
-jthread_get_data(jthread_t tid) 
-{
-       return (&tid->localData);
-}
+threadData* jthread_get_data(jthread_t tid);
 
 /*
  * API related to I/O
@@ -391,75 +319,21 @@
 #define JTHREAD_RESTORE_FD
 void jthreadRestoreFD(int fd);
 
-
 /* Spinlocks: simple since we're uniprocessor */
-/* ARGSUSED */
-static inline
-void jthread_spinon(void *arg)
-{
-       jthread_suspendall();
-}
-
-/* ARGSUSED */
-static inline
-void jthread_spinoff(void *arg)
-{
-       jthread_unsuspendall();
-}
+void jthread_spinon(void *arg);
+
+void jthread_spinoff(void *arg);
 
 void jthread_suspend(jthread_t jt, void *suspender);
 void jthread_resume(jthread_t jt, void *suspender);
 
 jthread_t jthread_from_data(threadData *td, void *suspender);
 
-static inline
-jlong jthread_get_usage(jthread_t jt)
-{
-       jlong retval;
-       
-       if( jt == jthread_current() )
-       {
-               struct rusage ru;
-               jlong ct;
-               
-               getrusage(RUSAGE_SELF, &ru);
-               ct = ((jlong)ru.ru_utime.tv_sec * 1000)
-                       + ((jlong)ru.ru_utime.tv_usec / (jlong)1000);
-               ct += ((jlong)ru.ru_stime.tv_sec * 1000)
-                       + ((jlong)ru.ru_stime.tv_usec / (jlong)1000);
-
-               retval = jt->totalUsed + (ct - jt->startUsed);
-       }
-       else
-       {
-               retval = jt->totalUsed;
-       }
-       retval *= 1000; /* Convert to nanos */
-       return( retval );
-}
-
-static inline
-int jthread_get_status(jthread_t jt)
-{
-       return( jt->status );
-}
-
-static inline
-int jthread_is_interrupted(jthread_t jt)
-{
-       return( jt->flags & THREAD_FLAGS_INTERRUPTED );
-}
-
-static inline
-int jthread_on_mutex(jthread_t jt)
-{
-       return( jt->flags & THREAD_FLAGS_WAIT_MUTEX );
-}
-
-static inline
-int jthread_on_condvar(jthread_t jt)
-{
-       return( jt->flags & THREAD_FLAGS_WAIT_CONDVAR );
-}
+jlong jthread_get_usage(jthread_t jt);
+
+int jthread_get_status(jthread_t jt);
+int jthread_is_interrupted(jthread_t jt);
+int jthread_on_mutex(jthread_t jt);
+int jthread_on_condvar(jthread_t jt);
 
 #endif
diff -ur kaffe-backup/kaffe/kaffevm/systems/unix-jthreads/Makefile.am 
kaffe/kaffe/kaffevm/systems/unix-jthreads/Makefile.am
--- kaffe-backup/kaffe/kaffevm/systems/unix-jthreads/Makefile.am        2003-05-24 
06:10:24.000000000 -0400
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/Makefile.am       2003-07-30 
12:10:50.000000000 -0400
@@ -10,8 +10,13 @@
 libkthread_la_LDFLAGS = $(KVMLIBFLAGS)
 libkthread_la_LIBADD = $(NET_LIBS)
 libkthread_la_SOURCES = jthread.c syscalls.c signal.c
-EXTRA_DIST = Makefile.frag config-jthreads.h jsignal.h jthread.h \
-               lock-impl.h thread-impl.h
+EXTRA_DIST = \
+Makefile.frag \
+config-jthreads.h \
+jsignal.h \
+jthread.h \
+lock-impl.h \
+thread-impl.h
 
 @engine_frag@
 
Only in kaffe/kaffe/kaffevm/systems/unix-jthreads: Makefile.am.~1.8.~
diff -ur kaffe-backup/kaffe/kaffevm/systems/unix-jthreads/Makefile.in 
kaffe/kaffe/kaffevm/systems/unix-jthreads/Makefile.in
--- kaffe-backup/kaffe/kaffevm/systems/unix-jthreads/Makefile.in        2003-07-29 
16:47:23.000000000 -0400
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/Makefile.in       2003-07-30 
12:20:39.000000000 -0400
@@ -252,8 +252,13 @@
 libkthread_la_LDFLAGS = $(KVMLIBFLAGS)
 libkthread_la_LIBADD = $(NET_LIBS)
 libkthread_la_SOURCES = jthread.c syscalls.c signal.c
-EXTRA_DIST = Makefile.frag config-jthreads.h jsignal.h jthread.h \
-               lock-impl.h thread-impl.h
+EXTRA_DIST = \
+Makefile.frag \
+config-jthreads.h \
+jsignal.h \
+jthread.h \
+lock-impl.h \
+thread-impl.h
 
 
 AM_CPPFLAGS = \

Reply via email to