[kaffe] CVS kaffe (hkraemer): removed redundant ThreadGroup instance
Kaffe CVS
cvs-commits at kaffe.org
Wed Oct 27 10:05:07 PDT 2004
PatchSet 5369
Date: 2004/10/27 16:11:59
Author: hkraemer
Branch: HEAD
Tag: (none)
Log:
removed redundant ThreadGroup instance
Members:
ChangeLog:1.2921->1.2922
kaffe/kaffevm/thread.c:1.78->1.79
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2921 kaffe/ChangeLog:1.2922
--- kaffe/ChangeLog:1.2921 Wed Oct 27 01:43:19 2004
+++ kaffe/ChangeLog Wed Oct 27 16:11:59 2004
@@ -1,3 +1,9 @@
+2004-10-27 Helmer Kraemer <hkraemer at freenet.de>
+
+ * kaffe/kaffevm/thread.c (standardGroup): removed
+ (attachFakedThreadInstance): use ThreadGroup.root for the new
+ thread
+
2004-10-26 Dalibor Topic <robilad at kaffe.org>
* libraries/javalib/gnu/java/net/protocol/http/Connection.java:
Index: kaffe/kaffe/kaffevm/thread.c
diff -u kaffe/kaffe/kaffevm/thread.c:1.78 kaffe/kaffe/kaffevm/thread.c:1.79
--- kaffe/kaffe/kaffevm/thread.c:1.78 Wed Oct 20 16:47:13 2004
+++ kaffe/kaffe/kaffevm/thread.c Wed Oct 27 16:12:03 2004
@@ -57,7 +57,6 @@
Hjava_lang_Class* ThreadClass;
Hjava_lang_Class* VMThreadClass;
Hjava_lang_Class* ThreadGroupClass;
-Hjava_lang_ThreadGroup* standardGroup;
static void firstStartThread(void*);
static void runfinalizer(void);
@@ -132,13 +131,6 @@
ThreadGroupClass = lookupClass(THREADGROUPCLASS, NULL, &info);
assert(ThreadGroupClass != 0);
- /* Create base group */
- standardGroup = (struct Hjava_lang_ThreadGroup*)
- execute_java_constructor(NULL, NULL,
- ThreadGroupClass, "()V");
-
- assert(standardGroup != 0);
-
/* Allocate a thread to be the main thread */
attachFakedThreadInstance("main", false);
@@ -236,6 +228,7 @@
attachFakedThreadInstance(const char* nm, int isDaemon)
{
Hjava_lang_Thread* tid;
+ int i;
DBG(VMTHREAD, dprintf("attachFakedThreadInstance(%s)\n", nm); )
@@ -247,7 +240,23 @@
assert(unhand(tid)->name != NULL);
unhand(tid)->priority = java_lang_Thread_NORM_PRIORITY;
unhand(tid)->daemon = isDaemon;
- unhand(tid)->group = standardGroup;
+
+ /* use root group for this thread:
+ * loop over all static fields of java.lang.ThreadGroup ...
+ */
+ for (i=0; i<CLASS_NSFIELDS(ThreadGroupClass); i++)
+ {
+ Field* f = &CLASS_SFIELDS(ThreadGroupClass)[i];
+
+ /* ... and if it's a field called root, take it */
+ if (!strcmp (f->name->data, "root"))
+ {
+ unhand(tid)->group = * (jref *)FIELD_ADDRESS(f);
+ }
+ }
+ /* finally complain if we did not find the field */
+ assert(unhand(tid)->group != NULL);
+
unhand(tid)->runnable = NULL;
unhand(tid)->vmThread = (Hjava_lang_VMThread *)
execute_java_constructor(NULL, NULL,
More information about the kaffe
mailing list