[kaffe] CVS kaffe (guilhem): Fixlets for sparc.

Kaffe CVS cvs-commits at kaffe.org
Sat Jan 1 01:08:12 PST 2005


PatchSet 5738 
Date: 2005/01/01 09:03:45
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fixlets for sparc.

        * kaffe/kaffevm/intrp/methodcalls.c,
        kaffe/kaffevm/jit/methodcalls.c
        (engine_callMethod): Clear the return value to be sure that no
        bits are one.

        * kaffe/kaffevm/systems/unix-jthreads/signal.c,
        kaffe/kaffevm/systems/unix-pthreads/signal.c
        (detectStackBoundaries): Restore old signal handlers for SIGSEGV
        and SIGBUS.

Members: 
	ChangeLog:1.3282->1.3283 
	kaffe/kaffevm/intrp/methodcalls.c:1.4->1.5 
	kaffe/kaffevm/jit/methodcalls.c:1.6->1.7 
	kaffe/kaffevm/systems/unix-jthreads/signal.c:1.28->1.29 
	kaffe/kaffevm/systems/unix-pthreads/signal.c:1.17->1.18 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3282 kaffe/ChangeLog:1.3283
--- kaffe/ChangeLog:1.3282	Sat Jan  1 08:45:57 2005
+++ kaffe/ChangeLog	Sat Jan  1 09:03:45 2005
@@ -1,5 +1,17 @@
 2005-01-01  Guilhem Lavaux  <guilhem at kaffe.org>
 
+	* kaffe/kaffevm/intrp/methodcalls.c,
+	kaffe/kaffevm/jit/methodcalls.c
+	(engine_callMethod): Clear the return value to be sure that no
+	bits are one.
+	
+	* kaffe/kaffevm/systems/unix-jthreads/signal.c,
+	kaffe/kaffevm/systems/unix-pthreads/signal.c
+	(detectStackBoundaries): Restore old signal handlers for SIGSEGV
+	and SIGBUS.
+
+2005-01-01  Guilhem Lavaux  <guilhem at kaffe.org>
+
 	First bug fix of the year ! :)
 
 	* kaffe/kaffevm/external.c: Adapted error handling to darwin's and
Index: kaffe/kaffe/kaffevm/intrp/methodcalls.c
diff -u kaffe/kaffe/kaffevm/intrp/methodcalls.c:1.4 kaffe/kaffe/kaffevm/intrp/methodcalls.c:1.5
--- kaffe/kaffe/kaffevm/intrp/methodcalls.c:1.4	Sat Dec 25 19:09:14 2004
+++ kaffe/kaffe/kaffevm/intrp/methodcalls.c	Sat Jan  1 09:03:49 2005
@@ -101,6 +101,11 @@
 			lockObject(syncobj);
 		}
 
+		/* Put 0 in the biggest field. This is needed for some architecture which stores
+		 * the bytes out of order. */
+		if (call->ret != NULL)
+		  call->ret->j = 0;
+
 		setupExceptionHandling(&mjbuf, meth, syncobj, thread_data);
 
 		/* This exception has yet been handled by the VM creator.
Index: kaffe/kaffe/kaffevm/jit/methodcalls.c
diff -u kaffe/kaffe/kaffevm/jit/methodcalls.c:1.6 kaffe/kaffe/kaffevm/jit/methodcalls.c:1.7
--- kaffe/kaffe/kaffevm/jit/methodcalls.c:1.6	Sat Dec 25 19:09:14 2004
+++ kaffe/kaffe/kaffevm/jit/methodcalls.c	Sat Jan  1 09:03:49 2005
@@ -193,5 +193,8 @@
 void
 engine_callMethod (callMethodInfo *call)
 {
+	/* Clear the long value to clear the all return value. */
+	if (call->ret != NULL)
+	  call->ret->j = 0;
 	sysdepCallMethod (call);
 }
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c:1.28 kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c:1.29
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c:1.28	Thu Dec 30 10:35:42 2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c	Sat Jan  1 09:03:50 2005
@@ -123,11 +123,12 @@
  * OS signal handling code.  See FAQ/FAQ.jsignal for information.
  * ----------------------------------------------- */
 
-static void
+static void *
 registerSignalHandler(int sig, void* handler, int isAsync)
 {
 #if defined(HAVE_SIGACTION)
 	struct sigaction newact;
+	struct sigaction oldact;
 
 	newact.sa_handler = (SIG_T)handler;
 	sigemptyset(&newact.sa_mask);
@@ -156,11 +157,12 @@
 #if defined(SA_RESTART)
 	newact.sa_flags |= SA_RESTART;
 #endif
-	sigaction(sig, &newact, NULL);
+	sigaction(sig, &newact, &oldact);
 
+	return oldact.sa_handler;
 #elif defined(HAVE_SIGNAL)
 #warning The default signal() semantics may not be sufficient for Kaffe.
-	signal(sig, (SIG_T)handler);
+	return signal(sig, (SIG_T)handler);
 
 #else
 #error No signal handler support.  Jthreads requires signal support.	
@@ -171,7 +173,7 @@
 /*
  * Register a handler for an asynchronous signal.
  */
-void
+void *
 registerAsyncSignalHandler(int sig, void* handler)
 {
 #if !defined(NDEBUG)
@@ -196,13 +198,13 @@
 	 * Register an asynchronous signal handler that will block all
 	 * other asynchronous signals while the handler is running.
 	 */
-	registerSignalHandler(sig, handler, true);
+	return registerSignalHandler(sig, handler, true);
 }
 
 /*
  * Register a signal handler for a synchronous signal.
  */
-void
+void *
 registerSyncSignalHandler(int sig, void* handler)
 {
 #if !defined(NDEBUG)
@@ -225,7 +227,7 @@
 	assert(validSig);
 	
 	/* Register a synchronous signal handler */
-	registerSignalHandler(sig, handler, false);
+	return registerSignalHandler(sig, handler, false);
 }
 
 /*
@@ -443,14 +445,15 @@
 detectStackBoundaries(jthread_t jtid, int mainThreadStackSize)
 {
 	static volatile char *guessPointer;
+	void *old_sigsegv, *old_sigbus;
 
 	setupSigAltStack();
 
 #if defined(SIGSEGV)
-	registerSyncSignalHandler(SIGSEGV, stackOverflowDetector);
+	old_sigsegv = registerSyncSignalHandler(SIGSEGV, stackOverflowDetector);
 #endif
 #if defined(SIGBUS)
-	registerSyncSignalHandler(SIGBUS, stackOverflowDetector);
+	old_sigbus = haregisterSyncSignalHandler(SIGBUS, stackOverflowDetector);
 #endif
 	
 	if (JTHREAD_SETJMP(outOfLoop) == 0)
@@ -483,6 +486,13 @@
 	jtid->stackEnd = guessPointer;
 	jtid->stackBase = (char *)jtid->stackEnd - mainThreadStackSize;
 	jtid->restorePoint = jtid->stackBase;
+#endif
+
+#if defined(SIGSEGV)
+	registerSignalHandler(SIGSEGV, old_sigsegv, false);
+#endif
+#if defined(SIGBUS)
+	registerSignalHandler(SIGBUS, old_sigbus, false);
 #endif
 }
 
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c:1.17 kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c:1.18
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c:1.17	Wed Dec 29 16:27:43 2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c	Sat Jan  1 09:03:50 2005
@@ -480,13 +480,13 @@
 	jtid->stackCur = jtid->stackMin;
 #endif
 
+	/* We restore the old signal handlers (SIG_DFL and SIG_IGN are included.
+	 */ 
 #if defined(SIGSEGV)
-	if (handler_segv != NULL)
-	  registerSyncSignalHandler(SIGSEGV, handler_segv);
+	registerSignalHandler(SIGSEGV, handler_segv, false);
 #endif
 #if defined(SIGBUS)
-	if (handler_bus != NULL)
-	  registerSyncSignalHandler(SIGBUS, handler_bus);
+	registerSignalHandler(SIGBUS, handler_bus, false);
 #endif
 }
 




More information about the kaffe mailing list