[kaffe] CVS kaffe (hkraemer): warning fixes for unix-pthreads, small fix for jni and jit_stub

Kaffe CVS cvs-commits at kaffe.org
Sun Apr 25 13:39:02 PDT 2004


PatchSet 4694 
Date: 2004/04/25 19:57:50
Author: hkraemer
Branch: HEAD
Tag: (none) 
Log:
warning fixes for unix-pthreads, small fix for jni and jit_stub

Members: 
	ChangeLog:1.2270->1.2271 
	kaffe/kaffevm/jni.c:1.111->1.112 
	kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.57->1.58 
	kaffe/kaffevm/systems/unix-pthreads/lock-impl.h:1.5->1.6 
	kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.23->1.24 
	kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.13->1.14 
	test/internal/jit_stub.c:1.6->1.7 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2270 kaffe/ChangeLog:1.2271
--- kaffe/ChangeLog:1.2270	Sun Apr 25 15:34:18 2004
+++ kaffe/ChangeLog	Sun Apr 25 19:57:50 2004
@@ -1,3 +1,25 @@
+2004-04-25  Helmer Kraemer  <hkraemer at freenet.de>
+
+	* kaffe/kaffevm/systems/unix-jthreads/jthread.h
+	(jthread_detach_current_thread) implement
+
+	* kaffe/kaffevm/systems/unix-pthreads/lock-impl.h,
+	kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:
+	fixes for gcc warnings
+
+	* kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
+	(jthread_detach_current_thread): implement
+	(TwalkThread): use JTHREAD instead of vm_thread for debug mask
+	
+	* kaffe/kaffevm/jni.c
+	(KAFFE_JNI_SETEXCEPTFP): use FIRSTFRAME/FPFRAME macros so we
+	can use the stack pointer if the architecture doesn't use
+	a frame pointer
+	(Kaffe_DetachCurrentThread): call jthread_detach_current_thread
+
+	* test/internal/jit_stub.c (main): don't call jthread_createfirst
+	since that's already done during initialiseKaffe
+	
 2004-04-24  Guilhem Lavaux <guilhem at kaffe.org>
 
 	* libraries/javalib/kaffe/tools/jar/Jar.java
Index: kaffe/kaffe/kaffevm/jni.c
diff -u kaffe/kaffe/kaffevm/jni.c:1.111 kaffe/kaffe/kaffevm/jni.c:1.112
--- kaffe/kaffe/kaffevm/jni.c:1.111	Sun Apr 18 13:57:26 2004
+++ kaffe/kaffe/kaffevm/jni.c	Sun Apr 25 19:57:48 2004
@@ -103,7 +103,9 @@
  */
 #if defined(TRANSLATOR)
 #define KAFFE_JNI_SETEXCEPTFP(ebufp) {				\
-        vmExcept_setJNIFrame(ebufp, __builtin_frame_address(0));\
+	struct _exceptionFrame frame;				\
+	FIRSTFRAME (frame, NULL);				\
+	vmExcept_setJNIFrame(ebufp, FPFRAME(&frame));		\
         }
 #else
 /*
@@ -3645,8 +3647,11 @@
 static jint
 Kaffe_DetachCurrentThread(JavaVM* vm UNUSED)
 {
-	/* Does nothing */
-	return (0);
+	if (jthread_detach_current_thread ()) {
+		return 0;
+	} else {
+		return -1;
+	}
 }
 
 static jint
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.57 kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.58
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.57	Thu Apr 22 16:28:17 2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h	Sun Apr 25 19:57:51 2004
@@ -358,4 +358,10 @@
 	return false;
 }
 
+static inline
+bool jthread_detach_current_thread (void)
+{
+ 	return false;
+}
+
 #endif
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.h
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.h:1.5 kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.h:1.6
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.h:1.5	Sun Feb  1 22:14:55 2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.h	Sun Apr 25 19:57:51 2004
@@ -83,14 +83,14 @@
 
 static inline
 void
-jcondvar_signal( jcondvar* cv, jmutex* mux )
+jcondvar_signal( jcondvar* cv, jmutex* mux UNUSED)
 {
   pthread_cond_signal( cv );
 }       
 
 static inline
 void
-jcondvar_broadcast ( jcondvar* cv, jmutex* mux)
+jcondvar_broadcast ( jcondvar* cv, jmutex* mux UNUSED)
 {
   pthread_cond_broadcast( cv );
 }
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.23 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.24
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.23	Mon Mar 22 15:14:30 2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c	Sun Apr 25 19:57:51 2004
@@ -25,11 +25,11 @@
 #if defined(KAFFE_VMDEBUG)
 
 #define TMSG_SHORT(_msg,_nt)     \
-   dprintf(_msg" %p [tid:%4ld, java:%p]\n", \
+   dprintf(_msg" %p [tid:%4lx, java:%p]\n", \
     _nt, _nt->tid, _nt->data.jlThread)
 
 #define TMSG_LONG(_msg,_nt)      \
-   dprintf(_msg" %p [tid:%4ld, java:%p], stack [%p..%p..%p], state: %c%c%c\n",         \
+   dprintf(_msg" %p [tid:%4lx, java:%p], stack [%p..%p..%p], state: %c%c%c\n",         \
         _nt, _nt->tid, _nt->data.jlThread, _nt->stackMin, _nt->stackCur, _nt->stackMax,  \
         stat_act[_nt->active], stat_susp[_nt->suspendState], stat_block[_nt->blockState])
 
@@ -483,9 +483,7 @@
   pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, &oldCancelType);
 
   /* if we aren't the first one, we are in trouble */
-  // Jim - I'm commenting out this assertion, as jit_stub.c in test/internal  
-  // seems to violate the assumption.
-  // assert( activeThreads == 0);
+  assert( activeThreads == 0);
  
   activeThreads = firstThread = nt;
   nonDaemons=1;
@@ -522,6 +520,15 @@
   return true;
 }
 
+bool jthread_detach_current_thread (void)
+{
+  jthread_t	cur = jthread_current ();
+
+  tDispose (cur);
+
+  return true;
+}
+
 /*
  * This is our thread function wrapper, which we need because of two
  * reasons. First, there is no way to set thread specific data from
@@ -1172,7 +1179,7 @@
 	return;
   }
 
-  DBG( vm_thread, TMSG_LONG( "walking ", nt));
+  DBG( JTHREAD, TMSG_LONG( "walking ", nt));
 
   if ( !nt->suspendState && !nt->blockState ){
 	t = GET_CURRENT_THREAD(&t);
@@ -1182,14 +1189,14 @@
 	}
 	else {
 	  /* everything else should be blocked or suspended by now */
-	  DBG( vm_thread, ("walking a running thread %p\n", nt));
+	  DBG( JTHREAD, ("walking a running thread %p\n", nt));
 	  //tDump();
 	  //ABORT();
 	  return;
 	}
   }
   else if ( nt->suspendState == SS_PENDING_SUSPEND ){
-	DBG( vm_thread, ("pending suspend, walk whole stack\n"));
+	DBG( JTHREAD, ("pending suspend, walk whole stack\n"));
 	/*
 	 * Assuming the very next thing after a context switch to this thread
 	 * would be calling the signal handler, we accept that case. Unfortunately,
@@ -1204,7 +1211,7 @@
 
   if ( ((uintp) nt->stackCur < (uintp) nt->stackMin) ||
 	   (((uintp) nt->stackCur > (uintp) nt->stackMax)) ) {
-	DBG( vm_thread, ("inconsistent stack\n"));
+	DBG( JTHREAD, ("inconsistent stack\n"));
 	tDump();
 	ABORT();
   }
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.13 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.14
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.13	Thu Apr 22 16:28:17 2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h	Sun Apr 25 19:57:51 2004
@@ -91,6 +91,12 @@
  */
 bool jthread_attach_current_thread (bool is_daemon);
 
+/**
+ * Detaches the calling thread from the vm.
+ *
+ */
+bool jthread_detach_current_thread (void);
+
 void jthread_sleep (jlong timeout);
 
 /**
@@ -119,7 +125,7 @@
  * @param tid the thread to stop.
  */
 static inline
-void jthread_stop(jthread_t tid)
+void jthread_stop(jthread_t tid UNUSED)
 {
 }
 
@@ -136,7 +142,7 @@
  * @param func the func to execute.
  */
 static inline
-void jthread_atexit(void (* func)(void))
+void jthread_atexit(void (* func)(void) UNUSED)
 {
 }
 
@@ -146,7 +152,7 @@
  * @param tid the thread whose info is to be dumped.
  */
 static inline
-void jthread_dumpthreadinfo(jthread_t tid)
+void jthread_dumpthreadinfo(jthread_t tid UNUSED)
 {
 }
 
@@ -225,10 +231,10 @@
   assert(tid->suspendState == SS_SUSPENDED);
 #if defined(STACK_GROWS_UP)
   *from = tid->stackMin;
-  *len = tid->stackCur - tid->stackMin;
+  *len = (uintp)tid->stackCur - (uintp)tid->stackMin;
 #else
   *from = tid->stackCur;
-  *len = tid->stackMax - tid->stackCur;
+  *len = (uintp)tid->stackMax - (uintp)tid->stackCur;
 #endif
   return true;
 }
@@ -243,9 +249,9 @@
 {
   jthread_t nt = jthread_current();
 #if defined(STACK_GROWS_UP)
-  return (nt->stackMax - STACKREDZONE);
+  return (void *)((uintp)nt->stackMax - STACKREDZONE);
 #else
-  return (nt->stackMin + STACKREDZONE);
+  return (void *)((uintp)nt->stackMin + STACKREDZONE);
 #endif
 }
 
@@ -259,17 +265,17 @@
 	if( yes )
 	{
 #if defined(STACK_GROWS_UP)
-		jthread_current()->stackMax += STACKREDZONE;
+		(uintp)jthread_current()->stackMax += STACKREDZONE;
 #else
-		jthread_current()->stackMin -= STACKREDZONE;
+		(uintp)jthread_current()->stackMin -= STACKREDZONE;
 #endif
 	}
 	else
 	{
 #if defined(STACK_GROWS_UP)
-		jthread_current()->stackMax -= STACKREDZONE;
+		(uintp)jthread_current()->stackMax -= STACKREDZONE;
 #else
-		jthread_current()->stackMin += STACKREDZONE;
+		(uintp)jthread_current()->stackMin += STACKREDZONE;
 #endif
 	}
 }
@@ -289,7 +295,7 @@
  *
  */
 static inline
-void jthread_spinon(int dummy)
+void jthread_spinon(int dummy UNUSED)
 {
 }
 
@@ -298,7 +304,7 @@
  *
  */
 static inline
-void jthread_spinoff(int dummy)
+void jthread_spinoff(int dummy UNUSED)
 {
 }
 
@@ -394,47 +400,33 @@
 void jthread_set_blocking (int fd, int blocking);
 
 static inline void
-jthread_suspend(jthread_t jt, void *suspender)
+jthread_suspend(jthread_t jt UNUSED, void *suspender UNUSED)
 {
 	/* TODO */
 }
 
 static inline void
-jthread_resume(jthread_t jt, void *suspender)
+jthread_resume(jthread_t jt UNUSED, void *suspender UNUSED)
 {
 	/* TODO */
 }
 
 static inline jthread_t
-jthread_from_data(threadData *td, void *suspender)
+jthread_from_data(threadData *td UNUSED, void *suspender UNUSED)
 {
 	/* TODO */
 	return NULL;
 }
 
 static inline
-jlong jthread_get_usage(jthread_t jt)
-{
-	/* TODO */
-	return 0;
-}
-
-static inline
-int jthread_is_interrupted(jthread_t jt)
-{
-	/* TODO */
-	return 0;
-}
-
-static inline
-int jthread_on_mutex(jthread_t jt)
+jlong jthread_get_usage(jthread_t jt UNUSED)
 {
 	/* TODO */
 	return 0;
 }
 
 static inline
-int jthread_on_condvar(jthread_t jt)
+int jthread_is_interrupted(jthread_t jt UNUSED)
 {
 	/* TODO */
 	return 0;
Index: kaffe/test/internal/jit_stub.c
diff -u kaffe/test/internal/jit_stub.c:1.6 kaffe/test/internal/jit_stub.c:1.7
--- kaffe/test/internal/jit_stub.c:1.6	Sat Apr 24 16:57:36 2004
+++ kaffe/test/internal/jit_stub.c	Sun Apr 25 19:57:49 2004
@@ -157,16 +157,6 @@
 		loadStaticClass(&javaLangNullPointerException, "java/lang/NullPointerException");
 		loadStaticClass(&javaLangArrayIndexOutOfBoundsException, "java/lang/ArrayIndexOutOfBoundsException");
 		memset(&mainThread, 0, sizeof(mainThread));
-#if defined(KAFFEMD_STACKSIZE)
-		stackSize = mdGetStackSize();
-		if (stackSize < 0)
-		  stackSize = MAINSTACKSIZE;
-#else
-		stackSize = MAINSTACKSIZE;
-#endif
-		jthread_createfirst(stackSize,
-				    java_lang_Thread_NORM_PRIORITY,
-				    &mainThread);
 
 		if( (tests = getenv(TEST_CLASSES)) )
 		{




More information about the kaffe mailing list