[kaffe] CVS kaffe (guilhem): Fixed pointer arithmetic in the GC.

Kaffe CVS cvs-commits at kaffe.org
Sun Jan 16 01:13:32 PST 2005


PatchSet 5863 
Date: 2005/01/16 09:08:58
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fixed pointer arithmetic in the GC.

Members: 
	ChangeLog:1.3406->1.3407 
	kaffe/kaffevm/kaffe-gc/gc-mem.c:1.23->1.24 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3406 kaffe/ChangeLog:1.3407
--- kaffe/ChangeLog:1.3406	Sat Jan 15 21:55:42 2005
+++ kaffe/ChangeLog	Sun Jan 16 09:08:58 2005
@@ -1,3 +1,9 @@
+2005-01-16  Guilhem Lavaux  <guilhem at kaffe.org>
+
+	* kaffe/kaffevm/kaffe-gc/gc-mem.c
+	(gc_block_alloc): Fixed incorrect pointer arithmetic when adjusting
+	blocks.
+
 2005-01-15  Dalibor Topic  <robilad at kaffe.org>
 
 	* kaffe/kaffeh/sigs.c (translateSig): Added missing default case.
Index: kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c
diff -u kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c:1.23 kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c:1.24
--- kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c:1.23	Wed Dec 29 16:27:42 2004
+++ kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c	Sun Jan 16 09:09:01 2005
@@ -1136,27 +1136,27 @@
 			int i;
 			gc_block *b = (gc_block *) gc_block_base;
 			uintp delta = gc_block_base - old_blocks;
-#define R(X) if (X) X = X + delta
+#define R(type,X) if (X) X = (type*)((uintp)X + delta)
 
 			DBG(GCSYSALLOC,
 			    dprintf("relocating gc_block array\n"));
 			for (i = 0; i < onb; i++) 
 			  {
-			    R(b[i].next);
-			    R(b[i].pprev);
-			    R(b[i].pnext);
+			    R(gc_block, b[i].next);
+			    R(gc_block, b[i].pprev);
+			    R(gc_block, b[i].pnext);
                             if (inside(b[i].free, (gc_block*)old_blocks, onb))
-				R(b[i].free);
+				R(gc_freeobj, b[i].free);
 			  }
 
 			memset(b + onb, 0,
 			       (nblocks - onb) * sizeof(gc_block));
 
 			for (i = 0; i<=KGC_PRIM_LIST_COUNT; i++)
-				R(gc_prim_freelist[i]);
+				R(gc_block, gc_prim_freelist[i]);
 
 			for (i = 0; freelist[i].list != (void*)-1; i++) 
-				R(freelist[i].list);
+				R(gc_block, freelist[i].list);
 #undef R
 		}
 		KTHREAD(spinoff)(NULL);




More information about the kaffe mailing list