[kaffe] CVS kaffe (robilad): resynced with gnu classpath: vm interface update

Kaffe CVS cvs-commits at kaffe.org
Sun May 22 08:58:58 PDT 2005


PatchSet 6569 
Date: 2005/05/22 15:49:42
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
resynced with gnu classpath: vm interface update

2005-05-21  Dalibor Topic  <robilad at kaffe.org>

        * kaffe/jvmpi/jvmpi_kaffe.c
        kaffe/kaffevm/exception.c
        kaffe/kaffevm/stackTrace.c:
        Renamed backtrace field to vmdata.

        * kaffe/kaffevm/thread.c
        libraries/clib/native/Thread.c
        libraries/clib/native/Throwable.c:
        Renamed jthreadID field to vmdata.

        Resynced with GNU Classpath.

        2005-05-21  Archie Cobbs  <archie at dellroad.org>

        * java/lang/ClassLoader.java: (vmdata): add
        * vm/reference/java/lang/VMThread.java: (vmdata): add
        (countStackFrames()): make native
        * vm/reference/java/lang/VMThrowable.java: (vmdata): add
        (fillInStackTrace()): make native
        (getStackTrace()): make native

Members: 
	ChangeLog:1.4096->1.4097 
	kaffe/jvmpi/jvmpi_kaffe.c:1.10->1.11 
	kaffe/kaffevm/exception.c:1.100->1.101 
	kaffe/kaffevm/stackTrace.c:1.48->1.49 
	kaffe/kaffevm/thread.c:1.100->1.101 
	libraries/clib/native/Thread.c:INITIAL->1.25 
	libraries/clib/native/Throwable.c:INITIAL->1.12 
	libraries/javalib/java/lang/ClassLoader.java:1.43->1.44 
	libraries/javalib/java/lang/VMThread.java:1.5->1.6 
	libraries/javalib/java/lang/VMThrowable.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4096 kaffe/ChangeLog:1.4097
--- kaffe/ChangeLog:1.4096	Sun May 22 12:08:47 2005
+++ kaffe/ChangeLog	Sun May 22 15:49:42 2005
@@ -1,5 +1,28 @@
 2005-05-21  Dalibor Topic  <robilad at kaffe.org>
 
+	* kaffe/jvmpi/jvmpi_kaffe.c
+	kaffe/kaffevm/exception.c
+	kaffe/kaffevm/stackTrace.c:
+	Renamed backtrace field to vmdata.
+
+	* kaffe/kaffevm/thread.c
+	libraries/clib/native/Thread.c
+	libraries/clib/native/Throwable.c:
+	Renamed jthreadID field to vmdata.
+
+	Resynced with GNU Classpath.
+
+	2005-05-21  Archie Cobbs  <archie at dellroad.org>
+
+        * java/lang/ClassLoader.java: (vmdata): add
+        * vm/reference/java/lang/VMThread.java: (vmdata): add
+        (countStackFrames()): make native
+        * vm/reference/java/lang/VMThrowable.java: (vmdata): add
+        (fillInStackTrace()): make native
+        (getStackTrace()): make native
+
+2005-05-21  Dalibor Topic  <robilad at kaffe.org>
+
 	Resynced with GNU Classpath.
 
 	2005-05-21  Michael Koch  <konqueror at gmx.de>
Index: kaffe/kaffe/jvmpi/jvmpi_kaffe.c
diff -u kaffe/kaffe/jvmpi/jvmpi_kaffe.c:1.10 kaffe/kaffe/jvmpi/jvmpi_kaffe.c:1.11
--- kaffe/kaffe/jvmpi/jvmpi_kaffe.c:1.10	Sat May  7 08:55:43 2005
+++ kaffe/kaffe/jvmpi/jvmpi_kaffe.c	Sun May 22 15:49:46 2005
@@ -195,7 +195,7 @@
 	ev->u.thread_start.parent_name = NULL;
 	ev->u.thread_start.thread_id = tid;
 	ev->u.thread_start.thread_env_id = 
-		&KTHREAD(get_data)((jthread_t)tid->vmThread->jthreadID)->jniEnv;
+		&KTHREAD(get_data)((jthread_t)tid->vmThread->vmdata)->jniEnv;
 }
 
 void jvmpiFillClassLoad(JVMPI_Event *ev, struct Hjava_lang_Class *cl)
Index: kaffe/kaffe/kaffevm/exception.c
diff -u kaffe/kaffe/kaffevm/exception.c:1.100 kaffe/kaffe/kaffevm/exception.c:1.101
--- kaffe/kaffe/kaffevm/exception.c:1.100	Sat May 14 21:46:31 2005
+++ kaffe/kaffe/kaffevm/exception.c	Sun May 22 15:49:46 2005
@@ -336,7 +336,7 @@
 		unhand(eobj)->vmState = vmstate;
 	}
 	backtrace = buildStackTrace(NULL);
-	unhand(vmstate)->backtrace = backtrace;
+	unhand(vmstate)->vmdata = backtrace;
 	dispatchException(eobj, (stackTraceInfo*)backtrace);
 }
 
@@ -547,7 +547,7 @@
 	soe = (Hjava_lang_Throwable*)newObject(javaLangStackOverflowError);
 	vmstate = (Hjava_lang_VMThrowable*)newObject(javaLangVMThrowable);
 	backtrace = buildStackTrace(frame);
-	unhand(vmstate)->backtrace = backtrace;
+	unhand(vmstate)->vmdata = backtrace;
 	unhand(soe)->vmState = vmstate;
 #if defined(HAVE_GCJ_SUPPORT)
 	FAKE_THROW_FRAME();
@@ -568,7 +568,7 @@
 	npe = (Hjava_lang_Throwable*)newObject(javaLangNullPointerException);
 	vmstate = (Hjava_lang_VMThrowable*)newObject(javaLangVMThrowable);
 	backtrace = buildStackTrace(frame);
-	unhand(vmstate)->backtrace = backtrace;
+	unhand(vmstate)->vmdata = backtrace;
 	unhand(npe)->vmState = vmstate;
 #if defined(HAVE_GCJ_SUPPORT)
 	FAKE_THROW_FRAME();
@@ -589,7 +589,7 @@
 	ae = (Hjava_lang_Throwable*)newObject(javaLangArithmeticException);
 	vmstate = (Hjava_lang_VMThrowable*)newObject(javaLangVMThrowable);
 	backtrace = buildStackTrace(frame);
-	unhand(vmstate)->backtrace = backtrace;
+	unhand(vmstate)->vmdata = backtrace;
 	unhand(ae)->vmState = vmstate;
 #if defined(HAVE_GCJ_SUPPORT)
 	FAKE_THROW_FRAME();
Index: kaffe/kaffe/kaffevm/stackTrace.c
diff -u kaffe/kaffe/kaffevm/stackTrace.c:1.48 kaffe/kaffe/kaffevm/stackTrace.c:1.49
--- kaffe/kaffe/kaffevm/stackTrace.c:1.48	Sat May 14 21:46:31 2005
+++ kaffe/kaffe/kaffevm/stackTrace.c	Sun May 22 15:49:47 2005
@@ -165,7 +165,7 @@
 
 	frame = 0;
 	first_frame = 0;
-	stack = (stackTraceInfo*)unhand(state)->backtrace;
+	stack = (stackTraceInfo*)unhand(state)->vmdata;
 	throwable_class = ((Hjava_lang_Object*)throwable)->vtable->class;
 
 	for (i = 0; stack[i].meth != ENDOFSTACK; i++) {
@@ -232,7 +232,7 @@
 	if (vmstate == NULL) {
 		return;
 	}
-	info = (stackTraceInfo*)unhand(vmstate)->backtrace;
+	info = (stackTraceInfo*)unhand(vmstate)->vmdata;
 	if (info == NULL) {
 		return;
 	}
Index: kaffe/kaffe/kaffevm/thread.c
diff -u kaffe/kaffe/kaffevm/thread.c:1.100 kaffe/kaffe/kaffevm/thread.c:1.101
--- kaffe/kaffe/kaffevm/thread.c:1.100	Tue May 17 10:43:40 2005
+++ kaffe/kaffe/kaffevm/thread.c	Sun May 22 15:49:47 2005
@@ -78,7 +78,7 @@
 	threadData *thread_data = KTHREAD(get_data)(thread);
 
 	thread_data->jlThread = jlThread;
-	unhand (jlThread)->jthreadID = (struct Hkaffe_util_Ptr *)thread;
+	unhand (jlThread)->vmdata = (struct Hkaffe_util_Ptr *)thread;
 
 	thread_data->jnireferences = NULL;
 	thread_data->jniEnv = &Kaffe_JNINativeInterface;
@@ -185,10 +185,10 @@
 interruptThread(Hjava_lang_VMThread* tid)
 {
 DBG(VMTHREAD, dprintf ("%p (%p) interrupting %p (%p)\n", KTHREAD(current)(),
-                       THREAD_DATA()->jlThread, unhand(tid)->jthreadID, tid); );
-	assert(unhand(tid)->jthreadID != NULL);
+                       THREAD_DATA()->jlThread, unhand(tid)->vmdata, tid); );
+	assert(unhand(tid)->vmdata != NULL);
 
-	KTHREAD(interrupt)((jthread_t)unhand(tid)->jthreadID);
+	KTHREAD(interrupt)((jthread_t)unhand(tid)->vmdata);
 }
 
 /*
@@ -206,8 +206,8 @@
 		 * thread won't throw the exception `obj', but it will 
 		 * construct a new ThreadDeath exception when it dies.
 		 */
-		if ((jthread_t)unhand(tid)->jthreadID)
-			KTHREAD(stop)((jthread_t)unhand(tid)->jthreadID);
+		if ((jthread_t)unhand(tid)->vmdata)
+			KTHREAD(stop)((jthread_t)unhand(tid)->vmdata);
 	}
 }
 
@@ -277,7 +277,7 @@
         /*
 	 * set context class loader of primordial thread to app classloader
 	 * must not be done earlier, since getCurrentThread() won't work
-         * before the KTHREAD(createfirst) and the jthreadID assignment.
+         * before the KTHREAD(createfirst) and the vmdata assignment.
 	 *
 	 * If we're creating the Thread instance of the main thread, this
 	 * will trigger the initialization process of the java part of the
@@ -486,10 +486,10 @@
 setPriorityThread(Hjava_lang_VMThread* tid, jint prio)
 {
 	/* no native thread yet */
-	if (unhand(tid)->jthreadID == 0)
+	if (unhand(tid)->vmdata == 0)
 	        return;
 
-	KTHREAD(setpriority)((jthread_t)unhand(tid)->jthreadID, prio);
+	KTHREAD(setpriority)((jthread_t)unhand(tid)->vmdata, prio);
 }
 
 /*
@@ -553,7 +553,7 @@
 void
 finalizeThread(Hjava_lang_VMThread* tid)
 {
-	jthread_t jtid = (jthread_t)unhand(tid)->jthreadID;
+	jthread_t jtid = (jthread_t)unhand(tid)->vmdata;
 
 	if (jtid != NULL) {
 		KTHREAD(destroy)(jtid);
===================================================================
Checking out kaffe/libraries/clib/native/Thread.c
RCS:  /home/cvs/kaffe/kaffe/libraries/clib/native/Thread.c,v
VERS: 1.25
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/clib/native/Thread.c	Sun May 22 15:58:58 2005
@@ -0,0 +1,78 @@
+/*
+ * java.lang.Thread.c
+ *
+ * Copyright (c) 1996, 1997
+ *	Transvirtual Technologies, Inc.  All rights reserved.
+ *
+ * Copyright (c) 2004
+ *      The Kaffe.org's developers. See ChangeLog for details.
+ *
+ * See the file "license.terms" for information on usage and redistribution 
+ * of this file. 
+ */
+
+#include "config.h"
+#include "config-std.h"
+#include "gtypes.h"
+#include "java_lang_Thread.h"
+#include "java_lang_VMThread.h"
+#include "thread.h"
+#include "locks.h"
+#include "support.h"
+#include "jthread.h"
+#include "debug.h"
+
+struct Hjava_lang_Thread*
+java_lang_VMThread_currentThread(void)
+{
+  return (getCurrentThread());
+}
+
+/*
+ * Yield processor to another thread of the same priority.
+ */
+void
+java_lang_VMThread_yield(void)
+{
+  yieldThread();
+}
+
+/*
+ * Start this thread running.
+ */
+void
+java_lang_VMThread_start(struct Hjava_lang_VMThread* this, UNUSED jlong stacksize)
+{
+  startThread(this);
+}
+
+/*
+ * Change thread priority.
+ */
+void
+java_lang_VMThread_nativeSetPriority(struct Hjava_lang_VMThread* this, jint prio)
+{
+  setPriorityThread(this, prio);
+}
+
+void
+java_lang_VMThread_interrupt(struct Hjava_lang_VMThread* this)
+{
+  interruptThread(this);
+}
+
+void
+java_lang_VMThread_finalize(struct Hjava_lang_VMThread* this)
+{
+  finalizeThread(this);
+}
+
+jboolean java_lang_VMThread_interrupted(void)
+{
+  return KTHREAD(interrupted)(KTHREAD(current)());
+}
+
+jboolean java_lang_VMThread_isInterrupted(Hjava_lang_VMThread *this)
+{
+  return KTHREAD(is_interrupted)((jthread_t)unhand(this)->vmdata);
+}
===================================================================
Checking out kaffe/libraries/clib/native/Throwable.c
RCS:  /home/cvs/kaffe/kaffe/libraries/clib/native/Throwable.c,v
VERS: 1.12
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/clib/native/Throwable.c	Sun May 22 15:58:58 2005
@@ -0,0 +1,42 @@
+/*
+ * java.lang.Throwable.c
+ *
+ * Copyright (c) 1996, 1997
+ *	Transvirtual Technologies, Inc.  All rights reserved.
+ * Copyright (c) 2003
+ *	Mark J. Wielaard <mark at klomp.org>
+ *
+ * See the file "license.terms" for information on usage and redistribution 
+ * of this file. 
+ */
+
+#include "config.h"
+#include "config-io.h"
+#include <assert.h>
+#include <native.h>
+#include "java_lang_StackTraceElement.h"
+#include "java_lang_Throwable.h"
+#include "java_lang_VMThrowable.h"
+
+extern Hjava_lang_Object* buildStackTrace(void*);
+extern HArrayOfObject* getStackTraceElements(struct Hjava_lang_VMThrowable*,
+					     struct Hjava_lang_Throwable*);
+
+/*
+ * Fill in stack trace information - don't know what thought.
+ */
+void
+java_lang_VMThrowable_fillInStackTrace(struct Hjava_lang_VMThrowable* o)
+{
+	unhand(o)->vmdata = buildStackTrace(NULL);
+	assert(unhand(o)->vmdata != NULL);
+}
+
+/*
+ * Returns a array of StackTraceElements for the given VMThrowable state.
+ */
+HArrayOfObject*
+java_lang_VMThrowable_getStackTrace(struct Hjava_lang_VMThrowable* state, struct Hjava_lang_Throwable* throwable)
+{
+	return getStackTraceElements(state, throwable);
+}
Index: kaffe/libraries/javalib/java/lang/ClassLoader.java
diff -u kaffe/libraries/javalib/java/lang/ClassLoader.java:1.43 kaffe/libraries/javalib/java/lang/ClassLoader.java:1.44
--- kaffe/libraries/javalib/java/lang/ClassLoader.java:1.43	Mon May 16 12:13:49 2005
+++ kaffe/libraries/javalib/java/lang/ClassLoader.java	Sun May 22 15:49:47 2005
@@ -246,6 +246,11 @@
   Map classAssertionStatus;
 
   /**
+   * VM private data.
+   */
+  transient Object vmdata;
+
+  /**
    * Create a new ClassLoader with as parent the system classloader. There
    * may be a security check for <code>checkCreateClassLoader</code>.
    *
Index: kaffe/libraries/javalib/java/lang/VMThread.java
diff -u kaffe/libraries/javalib/java/lang/VMThread.java:1.5 kaffe/libraries/javalib/java/lang/VMThread.java:1.6
--- kaffe/libraries/javalib/java/lang/VMThread.java:1.5	Fri Jan  7 18:50:15 2005
+++ kaffe/libraries/javalib/java/lang/VMThread.java	Sun May 22 15:49:47 2005
@@ -85,9 +85,9 @@
     private volatile boolean running;
 
     /**
-     * Kaffe Specific: Pointer to the jthread identifier.
+     * VM private data.
      */
-    private Ptr jthreadID;
+    private transient Ptr vmdata;
 
     /**
      * Private constructor, create VMThreads with the static create method.
@@ -226,10 +226,7 @@
      *
      * @deprecated unsafe operation
      */
-    int countStackFrames()
-    {
-	return 0;
-    }
+    native int countStackFrames();
 
     /**
      * Wait the specified amount of time for the Thread in question to die.
Index: kaffe/libraries/javalib/java/lang/VMThrowable.java
diff -u kaffe/libraries/javalib/java/lang/VMThrowable.java:1.1 kaffe/libraries/javalib/java/lang/VMThrowable.java:1.2
--- kaffe/libraries/javalib/java/lang/VMThrowable.java:1.1	Mon Jul 28 08:09:47 2003
+++ kaffe/libraries/javalib/java/lang/VMThrowable.java	Sun May 22 15:49:47 2005
@@ -48,13 +48,16 @@
  */
 final class VMThrowable
 {
+  /**
+   * VM private data.
+   */
   /*
    * NB: this is a place where native code stores private
    * data.  The gc will mark the memory referenced, but its allocation
    * type is such that it won't be walked further.
    * Do not use kaffe.util.Ptr here.
    */
-  private transient Object backtrace;
+  private transient Object vmdata;
 
   /**
    * Private contructor, create VMThrowables with fillInStackTrace();




More information about the kaffe mailing list