[kaffe] CVS kaffe (guilhem): Jthread compilation fixes.

Kaffe CVS cvs-commits at kaffe.org
Mon Aug 25 00:51:02 PDT 2003


PatchSet 3978 
Date: 2003/08/25 07:48:24
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Jthread compilation fixes.

BTW, added a new parameter to jthread_init to be able to pass a reallocator.

Members: 
	ChangeLog:1.1575->1.1576 
	kaffe/kaffevm/thread.c:1.53->1.54 
	kaffe/kaffevm/systems/unix-jthreads/jqueue.c:1.2->1.3 
	kaffe/kaffevm/systems/unix-jthreads/jqueue.h:1.2->1.3 
	kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.98->1.99 
	kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.44->1.45 
	kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.16->1.17 
	kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.9->1.10 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1575 kaffe/ChangeLog:1.1576
--- kaffe/ChangeLog:1.1575	Mon Aug 25 06:30:10 2003
+++ kaffe/ChangeLog	Mon Aug 25 07:48:24 2003
@@ -1,5 +1,22 @@
 2003-08-24  Guilhem Lavaux <guilhem at kaffe.org>
 
+	* kaffe/kaffevm/systems/unix-jthreads/jqueue.c,
+	kaffe/kaffevm/systems/unix-jthreads/jqueue.h: Loads of compilation
+	fixes. (Sorry I have not checked what I have commited).
+
+	* kaffe/kaffevm/thread.c: Added thread_realloc.
+	(initNativeThreads) Add thread_realloc in the parameter list to
+	jthread_init
+
+	* kaffe/kaffevm/systems/unix-pthreads/thread-impl.c,
+	kaffe/kaffevm/systems/unix-pthreads/thread-impl.h,
+	kaffe/kaffevm/systems/unix-jthreads/jthread.c,
+	kaffe/kaffevm/systems/unix-jthreads/jthread.h:
+	(jthread_init) added a new parameter _reallocator to be able to
+	reallocate some memory.
+
+2003-08-24  Guilhem Lavaux <guilhem at kaffe.org>
+
 	* libraries/javalib/essential.files: Added
 	AttributedCharacterIterator.java and CharacterIterator.java for KJC.
 
Index: kaffe/kaffe/kaffevm/thread.c
diff -u kaffe/kaffe/kaffevm/thread.c:1.53 kaffe/kaffe/kaffevm/thread.c:1.54
--- kaffe/kaffe/kaffevm/thread.c:1.53	Thu Jul 31 22:46:46 2003
+++ kaffe/kaffe/kaffevm/thread.c	Mon Aug 25 07:48:26 2003
@@ -82,6 +82,13 @@
 	gc_free(p);
 }
 
+static
+void *
+thread_realloc(void *p, size_t s)
+{
+	return gc_realloc(p, s, GC_ALLOC_THREADCTX);
+}
+
 /*
  * Initialise threads.
  */
@@ -687,6 +694,7 @@
 		java_lang_Thread_MIN_PRIORITY,
 		thread_malloc,
 		thread_free,
+		thread_realloc,
 		broadcastDeath,
 		throwDeath,
 		onDeadlock);
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jqueue.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jqueue.c:1.2 kaffe/kaffe/kaffevm/systems/unix-jthreads/jqueue.c:1.3
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jqueue.c:1.2	Mon Aug 25 06:14:47 2003
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jqueue.c	Mon Aug 25 07:48:26 2003
@@ -12,7 +12,7 @@
 
 static KaffeAllocator gs_default_allocator;
 static KaffeDeallocator gs_default_deallocator;
-static KaffeDeallocator gs_default_reallocator;
+static KaffeReallocator gs_default_reallocator;
 
 void KaffeSetDefaultAllocator(KaffeAllocator allocator,
 			      KaffeDeallocator deallocator,
@@ -75,7 +75,7 @@
   if (pool->num_free_nodes == 0)
   {
     int old_free = pool->num_free_nodes;
-    int i;
+    int i, j;
 
     /* We need to increment the number of internal pool nodes.
      * The array of free nodes is reallocated, a new pool 
@@ -98,11 +98,11 @@
     /* No more memory to handle threads, abort */
     assert(pool->pools != NULL);
     
-    pool->pools[num_pools-1] = (KaffeNodeQueue *)
-      pool->allocator(sizeof(KaffeNodeQueue)*DEFAULT_NUMBER_NODES_IN_POOL);
+    pool->pools[pool->num_pools-1] = (KaffeNodeQueue *)
+      pool->allocator(sizeof(KaffeNodeQueue)*DEFAULT_NUMBER_OF_NODES_IN_POOL);
 
-    for (i=old_free;i<pool->num_free_nodes;i++)
-      pool->free_nodes[i] = &pool->pools[num_pools-1][i];
+    for (j=0,i=old_free;i<pool->num_free_nodes;j++,i++)
+      pool->free_nodes[i] = &pool->pools[pool->num_pools-1][j];
   }
   assert(pool->num_free_nodes != 0);
 
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jqueue.h
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jqueue.h:1.2 kaffe/kaffe/kaffevm/systems/unix-jthreads/jqueue.h:1.3
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jqueue.h:1.2	Mon Aug 25 06:14:47 2003
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jqueue.h	Mon Aug 25 07:48:26 2003
@@ -35,10 +35,12 @@
 
   KaffeAllocator allocator;
   KaffeDeallocator deallocator;
+  KaffeReallocator reallocator;
 } KaffePool;
 
 void KaffeSetDefaultAllocator(KaffeAllocator allocator,
-			      KaffeDeallocator deallocator);
+			      KaffeDeallocator deallocator,
+			      KaffeReallocator reallocator);
 KaffePool *KaffeCreatePool(void);
 void KaffeDestroyPool(KaffePool *pool);
 KaffeNodeQueue *KaffePoolNewNode(KaffePool *pool);
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.98 kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.99
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.98	Mon Aug 11 17:55:39 2003
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c	Mon Aug 25 07:48:26 2003
@@ -1202,6 +1202,7 @@
 	int maxpr, int minpr,
 	void *(*_allocator)(size_t), 
 	void (*_deallocator)(void*),
+	void *(*_reallocator)(void*,size_t),
 	void (*_destructor1)(void*),
 	void (*_onstop)(void),
 	void (*_ondeadlock)(void))
@@ -1216,7 +1217,7 @@
 	 */
 	ignoreSignal(SIGHUP);
 
-	KaffeSetDefaultAllocator(_allocator, _deallocator);
+	KaffeSetDefaultAllocator(_allocator, _deallocator, _reallocator);
 	queuePool = KaffeCreatePool();
 
 #if defined(SIGVTALRM)
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.44 kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.45
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.44	Tue Aug  5 06:44:39 2003
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h	Mon Aug 25 07:48:26 2003
@@ -134,11 +134,12 @@
  */
 void 
 jthread_init(
-	int preemptive,			/* preemptive scheduling */
-	int maxpr, 			/* maximum priority */
-	int minpr, 			/* minimum priority */
-        void *(*_allocator)(size_t),	/* memory allocator */
-	void (*_deallocator)(void*),	/* memory deallocator */
+	int preemptive,				/* preemptive scheduling */
+	int maxpr, 				/* maximum priority */
+	int minpr, 				/* minimum priority */
+        void *(*_allocator)(size_t),		/* memory allocator */
+	void (*_deallocator)(void*),		/* memory deallocator */
+	void *(*_reallocator)(void*,size_t),	/* memory reallocator */
 	void (*_destructor1)(void*),	/* called when a thread exits */ 
 	void (*_onstop)(void), 		/* called when a thread is stopped */
 	void (*_ondeadlock)(void)); 	/* called when we detect deadlock */
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.16 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.17
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.16	Sat Aug  9 21:55:05 2003
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c	Mon Aug 25 07:48:27 2003
@@ -405,6 +405,7 @@
         int maxpr, int minpr,
         void *(*_allocator)(size_t),
         void (*_deallocator)(void*),
+        void *(*_reallocator)(void*,size_t),
         void (*_destructor1)(void*),
         void (*_onstop)(void),
         void (*_ondeadlock)(void))
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.9 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.10
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.9	Tue Aug  5 06:44:40 2003
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h	Mon Aug 25 07:48:27 2003
@@ -308,11 +308,12 @@
  * Initialize the thread subsystem.
  *
  */
-void jthread_init(int preemptive,                 /* preemptive scheduling */
-		  int maxpr,                      /* maximum priority */
-		  int minpr,                      /* minimum priority */
-		  void *(*_allocator)(size_t),    /* memory allocator */
-		  void (*_deallocator)(void*),    /* memory deallocator */
+void jthread_init(int preemptive,                	/* preemptive scheduling */
+		  int maxpr,                     	/* maximum priority */
+		  int minpr,                     	/* minimum priority */
+		  void *(*_allocator)(size_t),   	/* memory allocator */
+		  void (*_deallocator)(void*),    	/* memory deallocator */
+		  void *(*_reallocator)(void*,size_t),  /* memory reallocator */
 		  void (*_destructor1)(void*),    /* called when a thread exits */
 		  void (*_onstop)(void),          /* called when a thread is stopped */
 		  void (*_ondeadlock)(void));     /* called when we detect deadlock */




More information about the kaffe mailing list