[kaffe] CVS kaffe (hkraemer): moved handling of thread interruption to jthread layer,

2004-10-31 Thread Kaffe CVS
PatchSet 5389 
Date: 2004/10/31 14:35:33
Author: hkraemer
Branch: HEAD
Tag: (none) 
Log:
moved handling of thread interruption to jthread layer,
some minor fixes

Members: 
ChangeLog:1.2940-1.2941 
include/errors.h:1.13-1.14 
kaffe/kaffevm/stackTrace.c:1.38-1.39 
kaffe/kaffevm/thread.c:1.79-1.80 
kaffe/kaffevm/jni/jni.c:1.7-1.8 
kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.123-1.124 
kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.63-1.64 
kaffe/kaffevm/systems/unix-pthreads/lock-impl.c:1.10-1.11 
kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.50-1.51 
libraries/clib/native/Object.c:1.9-1.10 
libraries/clib/native/Thread.c:1.18-1.19 
libraries/javalib/java/lang/VMObject.java:1.1-1.2 
libraries/javalib/java/lang/VMThread.java:1.1-1.2 
libraries/javalib/kaffe/lang/ThreadStack.java:1.2-1.3 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2940 kaffe/ChangeLog:1.2941
--- kaffe/ChangeLog:1.2940  Sun Oct 31 13:36:22 2004
+++ kaffe/ChangeLog Sun Oct 31 14:35:33 2004
@@ -1,3 +1,53 @@
+2004-10-31  Helmer Kraemer  [EMAIL PROTECTED]
+
+   Moved complete handling of thread interruption down to jthread layer:
+   
+   * kaffe/kaffevm/systems/unix-jthreads/jthread.h
+   (THREAD_FLAGS_INTERRUPTED_READ) removed
+   * kaffe/kaffevm/systems/unix-jthreads/jthread.c
+   (suspendOnQThread): don't clear interrupted flag
+   (jthread_interrupt): set interrupted flag if a thread interrupts
+   itself; only resume threads not waiting for a mutex
+
+   * kaffe/kaffevm/systems/unix-pthreads/lock-impl.c
+   (jcondvar_wait): don't mess around with interrupted flag, it's
+   set correctly by the interrupting thread
+   * kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
+   (jthread_interrupt): if thread is waiting for its semaphore, signal that
+   one instead of sending a signal
+   (jthread_is_interrupted, jthread_interrupted): add comments
+   (jthread_suspendall): lock thread's suspendLock before reading its
+   suspendState
+
+   * include/errors.h: added define for java.lang.InterruptedException
+   
+   * libraries/clib/native/Object.c, libraries/javalib/java/lang/VMObject.java
+   (nativeWait): removed
+   (wait): moved to native code
+
+   * libraries/clib/native/Thread.c, libraries/javalib/java/lang/VMThread.java
+   (nativeInterrupt, nativeIsInterrupted, nativeInterrupted): removed
+   (interrupt, isInterrupted, interrupted, sleep): moved to native code
+
+   Some other minor fixes:
+
+   * libraries/javalib/kaffe/lang/ThreadStack.java
+   (getCallersClassLoader): return AppClassLoader if there're no java methods
+   on the stack
+
+   * kaffe/kaffevm/jni/jni.c (tryClassForName): removed
+   (Kaffe_FindClass): simply call Class.forName and let ThreadStack find the
+   correct ClassLoader
+   
+   * libraries/javalib/Klasses.jar.bootstrap: regenerated
+   
+   * kaffe/kaffevm/stackTrace.c (getStackTraceElements): adapted to
+   changes of field names of java.lang.StackTraceElement
+   
+   * kaffe/kaffevm/thread.c (thread_malloc, thread_free,
+   thread_realloc): removed
+   Added debug messages and removed unused variables
+   
 2004-10-30  Dalibor Topic  [EMAIL PROTECTED]
 
* libraries/javalib/gnu/xml/xpath/VariableReference.java,
Index: kaffe/include/errors.h
diff -u kaffe/include/errors.h:1.13 kaffe/include/errors.h:1.14
--- kaffe/include/errors.h:1.13 Tue Oct 12 17:00:10 2004
+++ kaffe/include/errors.h  Sun Oct 31 14:35:32 2004
@@ -107,6 +107,7 @@
 #define ThreadDeath NEW_LANG_EXCEPTION(ThreadDeath)
 #define StackOverflowError NEW_LANG_EXCEPTION(StackOverflowError)
 #define IllegalThreadStateException NEW_LANG_EXCEPTION(IllegalThreadStateException)
+#define InterruptedException NEW_LANG_EXCEPTION(InterruptedException)
 #defineInstantiationException(M) 
NEW_LANG_EXCEPTION_MESSAGE(InstantiationException, M)
 
 #if !defined(KAFFEH)
Index: kaffe/kaffe/kaffevm/stackTrace.c
diff -u kaffe/kaffe/kaffevm/stackTrace.c:1.38 kaffe/kaffe/kaffevm/stackTrace.c:1.39
--- kaffe/kaffe/kaffevm/stackTrace.c:1.38   Fri Oct 22 22:32:41 2004
+++ kaffe/kaffe/kaffevm/stackTrace.cSun Oct 31 14:35:32 2004
@@ -184,7 +184,7 @@
(CLASS_SOURCEFILE(meth-class));
unhand(element)-lineNumber
= getLineNumber(meth, stack[i].pc);
-   unhand(element)-className
+   unhand(element)-declaringClass
= utf8Const2JavaReplace
(meth-class-name, '/', '.');
unhand(element)-methodName
Index: kaffe/kaffe/kaffevm/thread.c
diff -u kaffe/kaffe/kaffevm/thread.c:1.79 

Re: [kaffe] CVS kaffe (hkraemer): moved handling of thread interruption

2004-10-31 Thread Timothy Stack

 moved handling of thread interruption to jthread layer,

So, I haven't been paying close attention...  But, didn't interruption
used to be in the jthread layer, and then someone moved it up to the java
layer.  Why move it back down?

thanks,

tim

___
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe


Re: [kaffe] CVS kaffe (hkraemer): moved handling of thread interruption

2004-10-31 Thread Helmer Krämer
On Sun, 31 Oct 2004 08:47:50 -0700 (MST)
Timothy Stack [EMAIL PROTECTED] wrote:

 
  moved handling of thread interruption to jthread layer,
 
 So, I haven't been paying close attention...  But, didn't interruption
 used to be in the jthread layer, and then someone moved it up to the java
 layer.  Why move it back down?

The previous code had an interrupted flag  in the jthread
layer and one in the java layer and I figured it would be
a bit cleaner to have just one flag at the jthread layer.

Regards,
Helmer

___
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe


Re: [kaffe] CVS kaffe (hkraemer): moved handling of thread interruption

2004-10-31 Thread Guilhem Lavaux
Timothy Stack wrote:
moved handling of thread interruption to jthread layer,

So, I haven't been paying close attention...  But, didn't interruption
used to be in the jthread layer, and then someone moved it up to the java
layer.  Why move it back down?
Hmmm... I guess it is cleanest and safer if the interruption procedure 
is totally handled by the thread subsystem. Previously I had to move 
some parts of the interrupt procedure in the java code as pthread_lock, 
pthread_conds are not guaranteed to be interrupted by a signal (what 
about other syscalls ? I think I've turned the problem around in 
jthreaded syscalls too...). But I had to modify the suspend procedure 
too in jthread_suspendall and introduce some way to catch 
pthread_mutex_lock and signal_wait so maybe it is time to put it back in 
 the thread layer.

Regards,
Guilhem.
___
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe