[MLton-devel] FW: cygwin segfault

Stephen Weeks MLton@mlton.org
Fri, 9 May 2003 11:35:53 -0700


Hi Mike.  I've found the problem and checked in a fix.  Apply the
following patch to runtime/gc.c.  Let us know of any more problems,
and thanks for all the help.  Now, back to the FFI and OpenGL.

--------------------------------------------------------------------------------
diff -u -r1.130 -r1.131
--- gc.c	2 May 2003 23:47:49 -0000	1.130
+++ gc.c	9 May 2003 18:21:45 -0000	1.131
@@ -2635,19 +2635,25 @@
 	/* Allocate a space of the desired size. */
 	if (heapCreate (s, &h2, desired, minSize)) {
 		pointer from;
+		uint remaining;
 		pointer to;
 
 		from = old + size;
 		to = h2.start + size;
+		remaining = size;
 copy:			
-		from -= COPY_CHUNK_SIZE;
-		to -= COPY_CHUNK_SIZE;
-		if (from > old) {
+		assert (remaining == from - old 
+				and from >= old and to >= h2.start);
+		if (remaining < COPY_CHUNK_SIZE) {
+			copy (old, h2.start, remaining);
+		} else {
+			remaining -= COPY_CHUNK_SIZE;
+			from -= COPY_CHUNK_SIZE;
+			to -= COPY_CHUNK_SIZE;
 			copy (from, to, COPY_CHUNK_SIZE);
-			heapShrink (s, h, from - old);
+			heapShrink (s, h, remaining);
 			goto copy;
 		}
-		copy (old, h2.start, from + COPY_CHUNK_SIZE - old);
 		heapRelease (s, h);
 		*h = h2;
 	} else {


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel