[kaffe] CVS kaffe (dalibor): Fix for build problems on Cygwin

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Fri Dec 19 11:21:02 2003


PatchSet 4229 
Date: 2003/12/19 18:35:58
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Fix for build problems on Cygwin

There were problems due to undefined symbols in static libraries. Moving the inlined
functions back into the .c file and deinlining them solved the issue.

2003-12-19  Dalibor Topic <robilad@kaffe.org>

        * kaffe/kaffevm/systems/unix-jthreads/jthread.c
        (jthread_current, jthread_on_current_stack,
        jthread_stackcheck, jthread_relaxstack,
        jthread_stacklimit, jthread_spinon,
        jthread_spinoff, jthread_get_usage): New functions, deinlined
        from kaffe/kaffevm/systems/unix-jthreads/jthread.h.

        * kaffe/kaffevm/systems/unix-jthreads/jthread.h
        (jthread_current, jthread_on_current_stack,
        jthread_stackcheck, jthread_relaxstack,
        jthread_stacklimit, jthread_spinon,
        jthread_spinoff, jthread_get_usage): Replaced inline functions
        by prototype declarations, and moved implementations over to
        kaffe/kaffevm/systems/unix-jthreads/jthread.c to fix build
        problems on Cygwin.

Members: 
	ChangeLog:1.1818->1.1819 
	kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.103->1.104 
	kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.46->1.47 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1818 kaffe/ChangeLog:1.1819
--- kaffe/ChangeLog:1.1818	Fri Dec 19 18:12:28 2003
+++ kaffe/ChangeLog	Fri Dec 19 18:35:58 2003
@@ -1,5 +1,23 @@
 2003-12-19  Dalibor Topic <robilad@kaffe.org>
 
+	* kaffe/kaffevm/systems/unix-jthreads/jthread.c
+	(jthread_current, jthread_on_current_stack, 
+	jthread_stackcheck, jthread_relaxstack, 
+	jthread_stacklimit, jthread_spinon, 
+	jthread_spinoff, jthread_get_usage): New functions, deinlined
+	from kaffe/kaffevm/systems/unix-jthreads/jthread.h.
+
+	* kaffe/kaffevm/systems/unix-jthreads/jthread.h
+	(jthread_current, jthread_on_current_stack,
+        jthread_stackcheck, jthread_relaxstack,
+        jthread_stacklimit, jthread_spinon,
+        jthread_spinoff, jthread_get_usage): Replaced inline functions
+	by prototype declarations, and moved implementations over to
+	kaffe/kaffevm/systems/unix-jthreads/jthread.c to fix build 
+	problems on Cygwin.
+
+2003-12-19  Dalibor Topic <robilad@kaffe.org>
+
 	* include/nets.h
 	[!HAVE_INET_NTOP]: Added prototype for inet_ntop.
 	[!HAVE_INET_PTON]: Added prototype for inet_pton.
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.103 kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.104
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.103	Mon Nov  3 05:29:32 2003
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c	Fri Dec 19 18:36:00 2003
@@ -1605,6 +1605,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
  */
 void
@@ -3075,4 +3178,29 @@
 	intsDisable();
 	blockingFD[fd] = blocking;
 	intsRestore();
+}
+
+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 * 1000000)
+                       + ((jlong)ru.ru_utime.tv_usec);
+               ct += ((jlong)ru.ru_stime.tv_sec * 1000000)
+                       + ((jlong)ru.ru_stime.tv_usec);
+
+               retval = jt->totalUsed + (ct - jt->startUsed);
+       }
+       else
+       {
+               retval = jt->totalUsed;
+       }
+       retval *= 1000; /* Convert to nanos */
+       return( retval );
 }
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.46 kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.47
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.46	Sat Aug 30 23:57:12 2003
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h	Fri Dec 19 18:36:00 2003
@@ -207,11 +207,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 
@@ -241,83 +237,19 @@
 /*
  * 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.
  */
+void jthread_relaxstack(int yes);
 
-#define	REDZONE	1024
-
-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
@@ -396,52 +328,17 @@
 #define JTHREAD_RESTORE_FD
 void jthreadRestoreFD(int fd);
 
-
 /* Spinlocks: simple since we're uniprocessor */
-/* ARGSUSED */
-static inline
-void jthread_spinon(void *arg)
-{
-	jthread_suspendall();
-}
+void jthread_spinon(void *arg);
 
-/* ARGSUSED */
-static inline
-void jthread_spinoff(void *arg)
-{
-	jthread_unsuspendall();
-}
+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 * 1000000)
-			+ ((jlong)ru.ru_utime.tv_usec);
-		ct += ((jlong)ru.ru_stime.tv_sec * 1000000)
-			+ ((jlong)ru.ru_stime.tv_usec);
-
-		retval = jt->totalUsed + (ct - jt->startUsed);
-	}
-	else
-	{
-		retval = jt->totalUsed;
-	}
-	retval *= 1000; /* Convert to nanos */
-	return( retval );
-}
+jlong jthread_get_usage(jthread_t jt);
 
 static inline
 int jthread_get_status(jthread_t jt)