[Vm-dev] [commit][3354] CogVM source as per VMMaker.oscog-eem.1318

commits at squeakvm.org commits at squeakvm.org
Thu May 21 19:54:23 UTC 2015


Revision: 3354
Author:   eliot
Date:     2015-05-21 12:54:19 -0700 (Thu, 21 May 2015)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.1318

Spur:
Fix bad C bug in nextInSortedFreeListLink:given:.  The result
type must be usqInt, otherwise the list can be wrongly
terminated and the second compaction pass can segfault.

Change printFreeChunk:isNextChunk: to printFreeChunk:printAsTreeNode:, and use
it to implement printSortedFreeList.

Make checkTraversableSortedFreeList robust in presence of
empty sorted free list.

Modified Paths:
--------------
    branches/Cog/nsspursrc/vm/cogit.h
    branches/Cog/nsspursrc/vm/cointerp.c
    branches/Cog/nsspursrc/vm/cointerp.h
    branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
    branches/Cog/nsspurstack64src/vm/gcc3x-interp.c
    branches/Cog/nsspurstack64src/vm/interp.c
    branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c
    branches/Cog/nsspurstacksrc/vm/interp.c
    branches/Cog/spursistasrc/vm/cogit.h
    branches/Cog/spursistasrc/vm/cointerp.c
    branches/Cog/spursistasrc/vm/cointerp.h
    branches/Cog/spursistasrc/vm/gcc3x-cointerp.c
    branches/Cog/spursrc/vm/cogit.h
    branches/Cog/spursrc/vm/cointerp.c
    branches/Cog/spursrc/vm/cointerp.h
    branches/Cog/spursrc/vm/gcc3x-cointerp.c
    branches/Cog/spurstack64src/vm/gcc3x-interp.c
    branches/Cog/spurstack64src/vm/interp.c
    branches/Cog/spurstacksrc/vm/gcc3x-interp.c
    branches/Cog/spurstacksrc/vm/interp.c

Property Changed:
----------------
    branches/Cog/platforms/Cross/vm/sqSCCSVersion.h

Modified: branches/Cog/nsspursrc/vm/cogit.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.h	2015-05-21 18:18:06 UTC (rev 3353)
+++ branches/Cog/nsspursrc/vm/cogit.h	2015-05-21 19:54:19 UTC (rev 3354)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440
+	CCodeGenerator VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2
  */
 
 

Modified: branches/Cog/nsspursrc/vm/cointerp.c
===================================================================
--- branches/Cog/nsspursrc/vm/cointerp.c	2015-05-21 18:18:06 UTC (rev 3353)
+++ branches/Cog/nsspursrc/vm/cointerp.c	2015-05-21 19:54:19 UTC (rev 3354)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2
    from
-	CoInterpreter VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440
+	CoInterpreter VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1116,7 +1116,7 @@
 static sqInt moveARunOfObjectsStartingAtupTo(usqInt startAddress, usqInt limit) NoDbgRegParms;
 static sqInt newObjectHash(void);
 static sqInt newSpaceIsEmpty(void);
-sqInt nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree);
+usqInt nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree);
 sqInt nilObject(void);
 static void nilUnmarkedWeaklingSlots(void) NeverInline;
 static sqInt noCheckClassAtIndex(sqInt classIndex) NoDbgRegParms;
@@ -1148,7 +1148,7 @@
 void printForwarders(void);
 void printFreeChunks(void);
 void printFreeChunk(sqInt freeChunk);
-static void printFreeChunkisNextChunk(sqInt freeChunk, sqInt isNextChunk) NoDbgRegParms;
+static void printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode) NoDbgRegParms;
 void printFreeListHeads(void);
 void printFreeList(sqInt chunkOrIndex);
 void printFreeTree(void);
@@ -1166,6 +1166,7 @@
 void printObjStack(sqInt objStack);
 void printOopsFromto(sqInt startAddress, sqInt endAddress);
 void printReferencesTo(sqInt anOop);
+void printSortedFreeList(void);
 static sqInt pushOnUnscannedEphemeronsStack(sqInt anEphemeron) NoDbgRegParms;
 void pushRemappableOop(sqInt oop);
 static sqInt pushonObjStack(sqInt objOop, sqInt objStack) NoDbgRegParms;
@@ -1191,7 +1192,7 @@
 static sqInt storeImageSegmentIntooutPointersroots(sqInt segmentWordArray, sqInt outPointerArray, sqInt arrayOfRoots) NoDbgRegParms;
 sqInt storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt valuePointer);
 sqInt storePointerofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt valuePointer);
-sqInt stringForCString(const char *aCString);
+usqInt stringForCString(const char *aCString);
 static sqInt sufficientSpaceAfterGC(sqInt numBytes) NoDbgRegParms;
 static sqInt swizzleObjStackAt(sqInt objStackRootIndex) NoDbgRegParms;
 void tenuringIncrementalGC(void);
@@ -1591,11 +1592,11 @@
 _iss sqInt remapBufferCount;
 _iss usqInt freeListsMask;
 _iss sqInt profileProcess;
+_iss usqInt firstFreeChunk;
 _iss sqInt profileSemaphore;
 _iss sqInt longRunningPrimitiveCheckSemaphore;
 _iss sqInt profileMethod;
 _iss SpurContiguousObjStack unscannedEphemerons;
-_iss usqInt firstFreeChunk;
 _iss sqInt numStackPages;
 _iss StackPage * mostRecentlyUsedPage;
 _iss SpurNewSpaceSpace pastSpace;
@@ -1609,10 +1610,10 @@
 _iss SpurNewSpaceSpace futureSpace;
 _iss sqInt numRememberedEphemerons;
 _iss sqInt jmpDepth;
+_iss usqInt lastFreeChunk;
 _iss SpurNewSpaceSpace eden;
 _iss sqInt becomeEffectsFlags;
 _iss sqInt futureSurvivorStart;
-_iss usqInt lastFreeChunk;
 _iss char * objStackInvalidBecause;
 _iss sqInt ephemeronList;
 _iss usqInt freeOldSpaceStart;
@@ -2380,7 +2381,7 @@
 /*560*/	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1
 	};
 char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1317";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1318";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -31817,7 +31818,7 @@
     usqInt newObj;
     usqInt numBytes;
     sqInt numSlots;
-    usqInt s;
+    sqInt s;
     char *sp;
     sqInt sz;
 
@@ -31866,7 +31867,7 @@
 				GIV(needGCFlag) = 1;
 				forceInterruptCheck();
 			}
-			s = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, formatField, ClassByteStringCompactIndex);
+			s = ((usqInt) (allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, formatField, ClassByteStringCompactIndex)));
 			goto l1;
 		}
 		if (numSlots >= 0xFF) {
@@ -47782,7 +47783,7 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     usqInt freeChunk;
     usqInt limit;
-    sqInt next;
+    usqInt next;
     sqInt o;
     usqInt objOop;
     sqInt objOop1;
@@ -47792,6 +47793,9 @@
     sqInt prevPrevObj;
 
 	prevFree = (prevPrevFree = 0);
+	if (GIV(firstFreeChunk) == 0) {
+		return GIV(lastFreeChunk) == 0;
+	}
 	freeChunk = GIV(firstFreeChunk);
 	/* begin allOldSpaceEntitiesDo: */
 	/* begin allOldSpaceEntitiesFrom:do: */
@@ -47804,7 +47808,7 @@
 		assert((long64At(objOop1)) != 0);
 		if (((longAt(objOop1)) & 0x3FFFFF) == 0) {
 			assert(objOop1 == freeChunk);
-			next = (longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree;
+			next = ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree));
 
 			/* coInterpreter transcript cr; print: freeChunk; tab; print: o; tab; print: prevFree; nextPutAll: '<->'; print: next; flush. */
 
@@ -48403,21 +48407,21 @@
 			if (prevFree == 0) {
 				assert(free == GIV(lastFreeChunk));
 				prevFree = GIV(lastFreeChunk);
-				free = (longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0 << (shiftForWord())))) ^ 0;
+				free = ((usqInt)((longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0 << (shiftForWord())))) ^ 0));
 			}
 			else {
 				assert(isFreeObject(prevFree));
 				if (prevPrevFree == 0) {
 					prevPrevFree = GIV(lastFreeChunk);
-					prevFree = (longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0 << (shiftForWord())))) ^ 0;
+					prevFree = ((usqInt)((longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0 << (shiftForWord())))) ^ 0));
 				}
 				else {
 					assert(isFreeObject(prevPrevFree));
-					free = (longAt((prevFree + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevPrevFree;
+					free = ((usqInt)((longAt((prevFree + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevPrevFree));
 					prevPrevFree = prevFree;
 					prevFree = free;
 				}
-				free = (longAt((prevFree + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevPrevFree;
+				free = ((usqInt)((longAt((prevFree + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevPrevFree));
 			}
 		}
 		assert(checkTraversableSortedFreeList());
@@ -51353,14 +51357,14 @@
 	if (((next = longAt((freeChunk + BaseHeaderSize) + (3 << (shiftForWord()))))) != 0) {
 		inOrderPrintFreeTreeprintList(next, printNextList);
 	}
-	printFreeChunkisNextChunk(freeChunk, 0);
+	printFreeChunkprintAsTreeNode(freeChunk, 1);
 	if (printNextList) {
 		next = freeChunk;
 		while (((next = longAt((next + BaseHeaderSize) + (0 << (shiftForWord()))))) != 0) {
 			/* begin tab */
 			/* begin printChar: */
 			putchar('	');
-			printFreeChunkisNextChunk(next, 1);
+			printFreeChunkprintAsTreeNode(next, 0);
 		}
 	}
 	if (((next = longAt((freeChunk + BaseHeaderSize) + (4 << (shiftForWord()))))) != 0) {
@@ -59340,10 +59344,10 @@
     usqInt maxFreeChunk;
     sqInt moved;
     sqInt newChunk;
-    sqInt next;
+    usqInt next;
     usqInt nextFree;
-    sqInt nextNext;
-    sqInt nextNextFree;
+    usqInt nextNext;
+    usqInt nextNextFree;
     usqInt numSlots;
     usqInt numSlots1;
     usqInt numSlots11;
@@ -59410,7 +59414,7 @@
 		assert((isFreeObject(GIV(firstFreeChunk)))
 		 && (isFreeObject(thisFreeChunk)));
 		freeBytes = bytesInObject(thisFreeChunk);
-		nextFree = (longAt((thisFreeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFreeChunk;
+		nextFree = ((usqInt)((longAt((thisFreeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFreeChunk));
 		destination = ((byteAt(thisFreeChunk + 7)) == 0xFF
 			? thisFreeChunk - BaseHeaderSize
 			: thisFreeChunk);
@@ -59466,7 +59470,7 @@
 			/* we did overwrite it; we need to repair the free list */
 
 			if (nextFree != 0) {
-				nextNextFree = (longAt((nextFree + BaseHeaderSize) + (0 << (shiftForWord())))) ^ thisFreeChunk;
+				nextNextFree = ((usqInt)((longAt((nextFree + BaseHeaderSize) + (0 << (shiftForWord())))) ^ thisFreeChunk));
 				assert(isFreeObject(nextFree));
 			}
 			if ((destination > thisFreeChunk)
@@ -59556,7 +59560,7 @@
 			pigBytes = there - here;
 			while ((freeChunk != 0)
 			 && (freeChunk < hereObj)) {
-				next = (longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree;
+				next = ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree));
 				dest = ((byteAt(freeChunk + 7)) == 0xFF
 					? freeChunk - BaseHeaderSize
 					: freeChunk);
@@ -59580,7 +59584,7 @@
 					flag("endianness");
 					longAtput(hereObj, ((longAt(hereObj)) & ((unsigned int)~((0x1F << 24) + 0x3FFFFF))) + (8 + (7 << 24)));
 					if (next != 0) {
-						nextNext = (longAt((next + BaseHeaderSize) + (0 << (shiftForWord())))) ^ freeChunk;
+						nextNext = ((usqInt)((longAt((next + BaseHeaderSize) + (0 << (shiftForWord())))) ^ freeChunk));
 					}
 					if (pigBytes < chunkBytes) {
 
@@ -59714,10 +59718,10 @@
 	`Circular Lists', exercise. 18
 	http://en.wikipedia.org/wiki/XOR_linked_list. */
 
-sqInt
+usqInt
 nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree)
 {
-	return (longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree;
+	return ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree));
 }
 
 sqInt
@@ -60811,7 +60815,7 @@
 				seenNewFreeChunk = 1;
 			}
 			/* begin printFreeChunk: */
-			printFreeChunkisNextChunk(objOop, 0);
+			printFreeChunkprintAsTreeNode(objOop, 1);
 		}
 
 		prevPrevObj = prevObj;
@@ -60833,7 +60837,7 @@
 				seenNewFreeChunk = 1;
 			}
 			/* begin printFreeChunk: */
-			printFreeChunkisNextChunk(objOop, 0);
+			printFreeChunkprintAsTreeNode(objOop, 1);
 		}
 
 		prevPrevObj = prevObj;
@@ -60853,7 +60857,7 @@
 		assert((long64At(objOop1)) != 0);
 		if (((longAt(objOop1)) & 0x3FFFFF) == 0) {
 			/* begin printFreeChunk: */
-			printFreeChunkisNextChunk(objOop1, 0);
+			printFreeChunkprintAsTreeNode(objOop1, 1);
 		}
 
 		prevPrevObj1 = prevObj1;
@@ -60867,11 +60871,11 @@
 void
 printFreeChunk(sqInt freeChunk)
 {
-	printFreeChunkisNextChunk(freeChunk, 0);
+	printFreeChunkprintAsTreeNode(freeChunk, 1);
 }
 
 static void
-printFreeChunkisNextChunk(sqInt freeChunk, sqInt isNextChunk)
+printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode)
 {
     usqInt numBytes;
     void *p;
@@ -60892,7 +60896,7 @@
 	/* begin printHexnp: */
 	printf("0x%lx", ((unsigned long) (oopForPointer(p3))));
 	if ((numBytes >= (32 * 8))
-	 && (!isNextChunk)) {
+	 && (printAsTreeNode)) {
 		print(" ^ ");
 		/* begin printHexPtrnp: */
 		p = ((void *) (longAt((freeChunk + BaseHeaderSize) + (2 << (shiftForWord())))));
@@ -60959,7 +60963,7 @@
 	freeChunk = chunkOrIndex;
 	while (freeChunk != 0) {
 		/* begin printFreeChunk: */
-		printFreeChunkisNextChunk(freeChunk, 0);
+		printFreeChunkprintAsTreeNode(freeChunk, 1);
 		freeChunk = longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())));
 	}
 }
@@ -60981,7 +60985,7 @@
 	if (chunkOrZero > 0) {
 		printFreeTreeChunk(longAt((chunkOrZero + BaseHeaderSize) + (3 << (shiftForWord()))));
 		/* begin printFreeChunk: */
-		printFreeChunkisNextChunk(chunkOrZero, 0);
+		printFreeChunkprintAsTreeNode(chunkOrZero, 1);
 		printFreeTreeChunk(longAt((chunkOrZero + BaseHeaderSize) + (4 << (shiftForWord()))));
 	}
 }
@@ -61947,7 +61951,41 @@
 	
 }
 
+void
+printSortedFreeList(void)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    usqInt freeChunk;
+    usqInt nextFree;
+    usqInt prevFree;
 
+	if (!((GIV(firstFreeChunk) > 0)
+		 && (GIV(lastFreeChunk) > GIV(firstFreeChunk)))) {
+		print("sorted free list empty or corrupt");
+		/* begin cr */
+		printf("\n");
+		return;
+	}
+	freeChunk = GIV(firstFreeChunk);
+	prevFree = 0;
+	while (1) {
+		if (!((addressCouldBeObj(freeChunk))
+			 && (((longAt(freeChunk)) & 0x3FFFFF) == 0))) {
+			/* begin printHexnp: */
+			printf("0x%lx", ((unsigned long) freeChunk));
+			print(" is not a free chunk!");
+			/* begin cr */
+			printf("\n");
+			return;
+		}
+		printFreeChunkprintAsTreeNode(freeChunk, 0);
+		if (!(freeChunk != GIV(lastFreeChunk))) break;
+		nextFree = ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree));
+		prevFree = freeChunk;
+		freeChunk = nextFree;
+	}
+}
+
+
 /*	Attempt to push anEphemeron on the unscanned ephemerons stack
 	and answer if the attempt succeeded. Note that the ephemeron
 	stack overflowing isn't a disaster; it simply means treating the
@@ -62032,7 +62070,7 @@
 	free = GIV(firstFreeChunk);
 	prevPrevFree = (prevFree = 0);
 	while (free != 0) {
-		nextFree = (longAt((free + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree;
+		nextFree = ((usqInt)((longAt((free + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree));
 		assert(isFreeObject(free));
 		assert((nextFree == 0)
 		 || ((nextFree > free)
@@ -63058,7 +63096,7 @@
 /*	Answer a new String copied from a null-terminated C string,
 	or nil if out of memory. */
 
-sqInt
+usqInt
 stringForCString(const char *aCString)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt formatField;
@@ -63750,7 +63788,7 @@
 bridgeFromto(SpurSegmentInfo *aSegment, SpurSegmentInfo *nextSegmentOrNil)
 {
     usqInt bridgeSpan;
-    usqInt clifton;
+    sqInt clifton;
     usqInt segEnd;
 
 	segEnd = ((aSegment->segSize)) + ((aSegment->segStart));
@@ -63981,7 +64019,7 @@
     sqInt largeChild;
     sqInt newEndOfMemory;
     sqInt next;
-    usqInt node;
+    sqInt node;
     SpurSegmentInfo *seg;
     sqInt smallChild;
     sqInt treeNode;
@@ -64084,7 +64122,7 @@
 static sqInt
 readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt bridge;
+    usqInt bridge;
     usqInt bridgehead;
     usqInt bridgeSpan;
     sqInt bytesRead;
@@ -64293,7 +64331,7 @@
     usqLong firstSavedBridgeWord;
     sqInt nWritten;
     usqInt pier1;
-    sqInt pier2;
+    usqInt pier2;
     usqLong secondSavedBridgeWord;
 
 	pier1 = (((segment->segSize)) + ((segment->segStart))) - (2 * BaseHeaderSize);

Modified: branches/Cog/nsspursrc/vm/cointerp.h
===================================================================
--- branches/Cog/nsspursrc/vm/cointerp.h	2015-05-21 18:18:06 UTC (rev 3353)
+++ branches/Cog/nsspursrc/vm/cointerp.h	2015-05-21 19:54:19 UTC (rev 3354)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2
  */
 
 
@@ -222,7 +222,7 @@
 void longPrintReferencesTo(sqInt anOop);
 void markAndTrace(sqInt objOop);
 sqInt maybeSplObj(sqInt index);
-sqInt nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree);
+usqInt nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree);
 sqInt nonIndexablePointerFormat(void);
 sqInt numBytesOf(sqInt objOop);
 sqInt numPointerSlotsOf(sqInt objOop);
@@ -251,6 +251,7 @@
 void printObjStack(sqInt objStack);
 void printOopsFromto(sqInt startAddress, sqInt endAddress);
 void printReferencesTo(sqInt anOop);
+void printSortedFreeList(void);
 void pushRemappableOop(sqInt oop);
 sqInt remapObj(sqInt objOop);
 sqInt rememberedBitShift(void);
@@ -261,7 +262,7 @@
 sqInt splObj(sqInt index);
 usqInt storeCheckBoundary(void);
 sqInt storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt valuePointer);
-sqInt stringForCString(const char *aCString);
+usqInt stringForCString(const char *aCString);
 void tenuringIncrementalGC(void);
 sqInt topRemappableOop(void);
 sqInt validFreeTree(void);

Modified: branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nsspursrc/vm/gcc3x-cointerp.c	2015-05-21 18:18:06 UTC (rev 3353)
+++ branches/Cog/nsspursrc/vm/gcc3x-cointerp.c	2015-05-21 19:54:19 UTC (rev 3354)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2
    from
-	CoInterpreter VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440
+	CoInterpreter VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1119,7 +1119,7 @@
 static sqInt moveARunOfObjectsStartingAtupTo(usqInt startAddress, usqInt limit) NoDbgRegParms;
 static sqInt newObjectHash(void);
 static sqInt newSpaceIsEmpty(void);
-sqInt nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree);
+usqInt nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree);
 sqInt nilObject(void);
 static void nilUnmarkedWeaklingSlots(void) NeverInline;
 static sqInt noCheckClassAtIndex(sqInt classIndex) NoDbgRegParms;
@@ -1151,7 +1151,7 @@
 void printForwarders(void);
 void printFreeChunks(void);
 void printFreeChunk(sqInt freeChunk);
-static void printFreeChunkisNextChunk(sqInt freeChunk, sqInt isNextChunk) NoDbgRegParms;
+static void printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode) NoDbgRegParms;
 void printFreeListHeads(void);
 void printFreeList(sqInt chunkOrIndex);
 void printFreeTree(void);
@@ -1169,6 +1169,7 @@
 void printObjStack(sqInt objStack);
 void printOopsFromto(sqInt startAddress, sqInt endAddress);
 void printReferencesTo(sqInt anOop);
+void printSortedFreeList(void);
 static sqInt pushOnUnscannedEphemeronsStack(sqInt anEphemeron) NoDbgRegParms;
 void pushRemappableOop(sqInt oop);
 static sqInt pushonObjStack(sqInt objOop, sqInt objStack) NoDbgRegParms;
@@ -1194,7 +1195,7 @@
 static sqInt storeImageSegmentIntooutPointersroots(sqInt segmentWordArray, sqInt outPointerArray, sqInt arrayOfRoots) NoDbgRegParms;
 sqInt storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt valuePointer);
 sqInt storePointerofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt valuePointer);
-sqInt stringForCString(const char *aCString);
+usqInt stringForCString(const char *aCString);
 static sqInt sufficientSpaceAfterGC(sqInt numBytes) NoDbgRegParms;
 static sqInt swizzleObjStackAt(sqInt objStackRootIndex) NoDbgRegParms;
 void tenuringIncrementalGC(void);
@@ -1594,11 +1595,11 @@
 _iss sqInt remapBufferCount;
 _iss usqInt freeListsMask;
 _iss sqInt profileProcess;
+_iss usqInt firstFreeChunk;
 _iss sqInt profileSemaphore;
 _iss sqInt longRunningPrimitiveCheckSemaphore;
 _iss sqInt profileMethod;
 _iss SpurContiguousObjStack unscannedEphemerons;
-_iss usqInt firstFreeChunk;
 _iss sqInt numStackPages;
 _iss StackPage * mostRecentlyUsedPage;
 _iss SpurNewSpaceSpace pastSpace;
@@ -1612,10 +1613,10 @@
 _iss SpurNewSpaceSpace futureSpace;
 _iss sqInt numRememberedEphemerons;
 _iss sqInt jmpDepth;
+_iss usqInt lastFreeChunk;
 _iss SpurNewSpaceSpace eden;
 _iss sqInt becomeEffectsFlags;
 _iss sqInt futureSurvivorStart;
-_iss usqInt lastFreeChunk;
 _iss char * objStackInvalidBecause;
 _iss sqInt ephemeronList;
 _iss usqInt freeOldSpaceStart;
@@ -2383,7 +2384,7 @@
 /*560*/	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1
 	};
 char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1317";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1318";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -31826,7 +31827,7 @@
     usqInt newObj;
     usqInt numBytes;
     sqInt numSlots;
-    usqInt s;
+    sqInt s;
     char *sp;
     sqInt sz;
 
@@ -31875,7 +31876,7 @@
 				GIV(needGCFlag) = 1;
 				forceInterruptCheck();
 			}
-			s = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, formatField, ClassByteStringCompactIndex);
+			s = ((usqInt) (allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, formatField, ClassByteStringCompactIndex)));
 			goto l1;
 		}
 		if (numSlots >= 0xFF) {
@@ -47791,7 +47792,7 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     usqInt freeChunk;
     usqInt limit;
-    sqInt next;
+    usqInt next;
     sqInt o;
     usqInt objOop;
     sqInt objOop1;
@@ -47801,6 +47802,9 @@
     sqInt prevPrevObj;
 
 	prevFree = (prevPrevFree = 0);
+	if (GIV(firstFreeChunk) == 0) {
+		return GIV(lastFreeChunk) == 0;
+	}
 	freeChunk = GIV(firstFreeChunk);
 	/* begin allOldSpaceEntitiesDo: */
 	/* begin allOldSpaceEntitiesFrom:do: */
@@ -47813,7 +47817,7 @@
 		assert((long64At(objOop1)) != 0);
 		if (((longAt(objOop1)) & 0x3FFFFF) == 0) {
 			assert(objOop1 == freeChunk);
-			next = (longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree;
+			next = ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree));
 
 			/* coInterpreter transcript cr; print: freeChunk; tab; print: o; tab; print: prevFree; nextPutAll: '<->'; print: next; flush. */
 
@@ -48412,21 +48416,21 @@
 			if (prevFree == 0) {
 				assert(free == GIV(lastFreeChunk));
 				prevFree = GIV(lastFreeChunk);
-				free = (longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0 << (shiftForWord())))) ^ 0;
+				free = ((usqInt)((longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0 << (shiftForWord())))) ^ 0));
 			}
 			else {
 				assert(isFreeObject(prevFree));
 				if (prevPrevFree == 0) {
 					prevPrevFree = GIV(lastFreeChunk);
-					prevFree = (longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0 << (shiftForWord())))) ^ 0;
+					prevFree = ((usqInt)((longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0 << (shiftForWord())))) ^ 0));
 				}
 				else {
 					assert(isFreeObject(prevPrevFree));
-					free = (longAt((prevFree + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevPrevFree;
+					free = ((usqInt)((longAt((prevFree + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevPrevFree));
 					prevPrevFree = prevFree;
 					prevFree = free;
 				}
-				free = (longAt((prevFree + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevPrevFree;
+				free = ((usqInt)((longAt((prevFree + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevPrevFree));
 			}
 		}
 		assert(checkTraversableSortedFreeList());
@@ -51362,14 +51366,14 @@
 	if (((next = longAt((freeChunk + BaseHeaderSize) + (3 << (shiftForWord()))))) != 0) {
 		inOrderPrintFreeTreeprintList(next, printNextList);
 	}
-	printFreeChunkisNextChunk(freeChunk, 0);
+	printFreeChunkprintAsTreeNode(freeChunk, 1);
 	if (printNextList) {
 		next = freeChunk;
 		while (((next = longAt((next + BaseHeaderSize) + (0 << (shiftForWord()))))) != 0) {
 			/* begin tab */
 			/* begin printChar: */
 			putchar('	');
-			printFreeChunkisNextChunk(next, 1);
+			printFreeChunkprintAsTreeNode(next, 0);
 		}
 	}
 	if (((next = longAt((freeChunk + BaseHeaderSize) + (4 << (shiftForWord()))))) != 0) {
@@ -59349,10 +59353,10 @@
     usqInt maxFreeChunk;
     sqInt moved;
     sqInt newChunk;
-    sqInt next;
+    usqInt next;
     usqInt nextFree;
-    sqInt nextNext;
-    sqInt nextNextFree;
+    usqInt nextNext;
+    usqInt nextNextFree;
     usqInt numSlots;
     usqInt numSlots1;
     usqInt numSlots11;
@@ -59419,7 +59423,7 @@
 		assert((isFreeObject(GIV(firstFreeChunk)))
 		 && (isFreeObject(thisFreeChunk)));
 		freeBytes = bytesInObject(thisFreeChunk);
-		nextFree = (longAt((thisFreeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFreeChunk;
+		nextFree = ((usqInt)((longAt((thisFreeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFreeChunk));
 		destination = ((byteAt(thisFreeChunk + 7)) == 0xFF
 			? thisFreeChunk - BaseHeaderSize
 			: thisFreeChunk);
@@ -59475,7 +59479,7 @@
 			/* we did overwrite it; we need to repair the free list */
 
 			if (nextFree != 0) {
-				nextNextFree = (longAt((nextFree + BaseHeaderSize) + (0 << (shiftForWord())))) ^ thisFreeChunk;
+				nextNextFree = ((usqInt)((longAt((nextFree + BaseHeaderSize) + (0 << (shiftForWord())))) ^ thisFreeChunk));
 				assert(isFreeObject(nextFree));
 			}
 			if ((destination > thisFreeChunk)
@@ -59565,7 +59569,7 @@
 			pigBytes = there - here;
 			while ((freeChunk != 0)
 			 && (freeChunk < hereObj)) {
-				next = (longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree;
+				next = ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree));
 				dest = ((byteAt(freeChunk + 7)) == 0xFF
 					? freeChunk - BaseHeaderSize
 					: freeChunk);
@@ -59589,7 +59593,7 @@
 					flag("endianness");
 					longAtput(hereObj, ((longAt(hereObj)) & ((unsigned int)~((0x1F << 24) + 0x3FFFFF))) + (8 + (7 << 24)));
 					if (next != 0) {
-						nextNext = (longAt((next + BaseHeaderSize) + (0 << (shiftForWord())))) ^ freeChunk;
+						nextNext = ((usqInt)((longAt((next + BaseHeaderSize) + (0 << (shiftForWord())))) ^ freeChunk));
 					}
 					if (pigBytes < chunkBytes) {
 
@@ -59723,10 +59727,10 @@
 	`Circular Lists', exercise. 18
 	http://en.wikipedia.org/wiki/XOR_linked_list. */
 
-sqInt
+usqInt
 nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree)
 {
-	return (longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree;
+	return ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree));
 }
 
 sqInt
@@ -60820,7 +60824,7 @@
 				seenNewFreeChunk = 1;
 			}
 			/* begin printFreeChunk: */
-			printFreeChunkisNextChunk(objOop, 0);
+			printFreeChunkprintAsTreeNode(objOop, 1);
 		}
 
 		prevPrevObj = prevObj;
@@ -60842,7 +60846,7 @@
 				seenNewFreeChunk = 1;
 			}
 			/* begin printFreeChunk: */
-			printFreeChunkisNextChunk(objOop, 0);
+			printFreeChunkprintAsTreeNode(objOop, 1);
 		}
 
 		prevPrevObj = prevObj;
@@ -60862,7 +60866,7 @@
 		assert((long64At(objOop1)) != 0);
 		if (((longAt(objOop1)) & 0x3FFFFF) == 0) {
 			/* begin printFreeChunk: */
-			printFreeChunkisNextChunk(objOop1, 0);
+			printFreeChunkprintAsTreeNode(objOop1, 1);
 		}
 
 		prevPrevObj1 = prevObj1;
@@ -60876,11 +60880,11 @@
 void
 printFreeChunk(sqInt freeChunk)
 {
-	printFreeChunkisNextChunk(freeChunk, 0);
+	printFreeChunkprintAsTreeNode(freeChunk, 1);
 }
 
 static void
-printFreeChunkisNextChunk(sqInt freeChunk, sqInt isNextChunk)
+printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode)
 {
     usqInt numBytes;
     void *p;
@@ -60901,7 +60905,7 @@
 	/* begin printHexnp: */
 	printf("0x%lx", ((unsigned long) (oopForPointer(p3))));
 	if ((numBytes >= (32 * 8))
-	 && (!isNextChunk)) {
+	 && (printAsTreeNode)) {
 		print(" ^ ");
 		/* begin printHexPtrnp: */
 		p = ((void *) (longAt((freeChunk + BaseHeaderSize) + (2 << (shiftForWord())))));
@@ -60968,7 +60972,7 @@
 	freeChunk = chunkOrIndex;
 	while (freeChunk != 0) {
 		/* begin printFreeChunk: */
-		printFreeChunkisNextChunk(freeChunk, 0);
+		printFreeChunkprintAsTreeNode(freeChunk, 1);
 		freeChunk = longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())));
 	}
 }
@@ -60990,7 +60994,7 @@
 	if (chunkOrZero > 0) {
 		printFreeTreeChunk(longAt((chunkOrZero + BaseHeaderSize) + (3 << (shiftForWord()))));
 		/* begin printFreeChunk: */
-		printFreeChunkisNextChunk(chunkOrZero, 0);
+		printFreeChunkprintAsTreeNode(chunkOrZero, 1);
 		printFreeTreeChunk(longAt((chunkOrZero + BaseHeaderSize) + (4 << (shiftForWord()))));
 	}
 }
@@ -61956,7 +61960,41 @@
 	
 }
 
+void
+printSortedFreeList(void)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    usqInt freeChunk;
+    usqInt nextFree;
+    usqInt prevFree;
 
+	if (!((GIV(firstFreeChunk) > 0)
+		 && (GIV(lastFreeChunk) > GIV(firstFreeChunk)))) {
+		print("sorted free list empty or corrupt");
+		/* begin cr */
+		printf("\n");
+		return;
+	}
+	freeChunk = GIV(firstFreeChunk);
+	prevFree = 0;
+	while (1) {
+		if (!((addressCouldBeObj(freeChunk))
+			 && (((longAt(freeChunk)) & 0x3FFFFF) == 0))) {
+			/* begin printHexnp: */
+			printf("0x%lx", ((unsigned long) freeChunk));
+			print(" is not a free chunk!");
+			/* begin cr */
+			printf("\n");
+			return;
+		}
+		printFreeChunkprintAsTreeNode(freeChunk, 0);
+		if (!(freeChunk != GIV(lastFreeChunk))) break;
+		nextFree = ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree));
+		prevFree = freeChunk;
+		freeChunk = nextFree;
+	}
+}
+
+
 /*	Attempt to push anEphemeron on the unscanned ephemerons stack
 	and answer if the attempt succeeded. Note that the ephemeron
 	stack overflowing isn't a disaster; it simply means treating the
@@ -62041,7 +62079,7 @@
 	free = GIV(firstFreeChunk);
 	prevPrevFree = (prevFree = 0);
 	while (free != 0) {
-		nextFree = (longAt((free + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree;
+		nextFree = ((usqInt)((longAt((free + BaseHeaderSize) + (0 << (shiftForWord())))) ^ prevFree));
 		assert(isFreeObject(free));
 		assert((nextFree == 0)
 		 || ((nextFree > free)
@@ -63067,7 +63105,7 @@
 /*	Answer a new String copied from a null-terminated C string,
 	or nil if out of memory. */
 
-sqInt
+usqInt
 stringForCString(const char *aCString)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt formatField;
@@ -63759,7 +63797,7 @@
 bridgeFromto(SpurSegmentInfo *aSegment, SpurSegmentInfo *nextSegmentOrNil)
 {
     usqInt bridgeSpan;
-    usqInt clifton;
+    sqInt clifton;
     usqInt segEnd;
 
 	segEnd = ((aSegment->segSize)) + ((aSegment->segStart));
@@ -63990,7 +64028,7 @@
     sqInt largeChild;
     sqInt newEndOfMemory;
     sqInt next;
-    usqInt node;
+    sqInt node;
     SpurSegmentInfo *seg;
     sqInt smallChild;
     sqInt treeNode;
@@ -64093,7 +64131,7 @@
 static sqInt
 readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt bridge;
+    usqInt bridge;
     usqInt bridgehead;
     usqInt bridgeSpan;
     sqInt bytesRead;
@@ -64302,7 +64340,7 @@
     usqLong firstSavedBridgeWord;
     sqInt nWritten;
     usqInt pier1;
-    sqInt pier2;
+    usqInt pier2;
     usqLong secondSavedBridgeWord;
 
 	pier1 = (((segment->segSize)) + ((segment->segStart))) - (2 * BaseHeaderSize);

Modified: branches/Cog/nsspurstack64src/vm/gcc3x-interp.c
===================================================================
--- branches/Cog/nsspurstack64src/vm/gcc3x-interp.c	2015-05-21 18:18:06 UTC (rev 3353)
+++ branches/Cog/nsspurstack64src/vm/gcc3x-interp.c	2015-05-21 19:54:19 UTC (rev 3354)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2
    from
-	StackInterpreter VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440
+	StackInterpreter VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2
  */
-static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440 " __DATE__ ;
+static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -887,7 +887,7 @@
 static sqInt moveARunOfObjectsStartingAtupTo(usqInt startAddress, usqInt limit) NoDbgRegParms;
 static sqInt newObjectHash(void);
 static sqInt newSpaceIsEmpty(void);
-sqInt nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree);
+usqInt nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree);
 sqInt nilObject(void);
 static void nilUnmarkedWeaklingSlots(void) NeverInline;
 static sqInt noCheckClassAtIndex(sqInt classIndex) NoDbgRegParms;
@@ -919,7 +919,7 @@
 void printForwarders(void);
 void printFreeChunks(void);
 void printFreeChunk(sqInt freeChunk);
-static void printFreeChunkisNextChunk(sqInt freeChunk, sqInt isNextChunk) NoDbgRegParms;
+static void printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode) NoDbgRegParms;
 void printFreeListHeads(void);
 void printFreeList(sqInt chunkOrIndex);
 void printFreeTree(void);
@@ -937,6 +937,7 @@
 void printObjStack(sqInt objStack);
 void printOopsFromto(sqInt startAddress, sqInt endAddress);
 void printReferencesTo(sqInt anOop);
+void printSortedFreeList(void);
 static sqInt pushOnUnscannedEphemeronsStack(sqInt anEphemeron) NoDbgRegParms;
 void pushRemappableOop(sqInt oop);
 static sqInt pushonObjStack(sqInt objOop, sqInt objStack) NoDbgRegParms;
@@ -1406,9 +1407,9 @@
 _iss sqInt remapBufferCount;
 _iss sqInt bytesPerPage;
 _iss usqInt freeListsMask;
+_iss usqInt firstFreeChunk;
 _iss sqInt tempOop;
 _iss SpurContiguousObjStack unscannedEphemerons;
-_iss usqInt firstFreeChunk;
 _iss StackPage * mostRecentlyUsedPage;
 _iss SpurNewSpaceSpace pastSpace;
 _iss usqInt newSpaceStart;
@@ -1423,12 +1424,12 @@
 _iss sqLong nextProfileTick;
 _iss sqInt numRememberedEphemerons;
 _iss sqInt jmpDepth;
+_iss usqInt lastFreeChunk;
 _iss SpurNewSpaceSpace eden;
 _iss sqInt futureSurvivorStart;
 _iss sqInt longRunningPrimitiveCheckMethod;
 _iss sqInt longRunningPrimitiveCheckSemaphore;
 _iss sqInt profileSemaphore;
-_iss usqInt lastFreeChunk;
 _iss char * objStackInvalidBecause;
 _iss sqInt becomeEffectsFlags;
 _iss sqInt ephemeronList;
@@ -2149,7 +2150,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.1317";
+const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.1318";
 volatile int sendTrace;
 sqInt suppressHeartbeatFlag;
 
@@ -35374,7 +35375,7 @@
     sqInt followingWordAddress;
     usqInt freeChunk;
     usqInt limit;
-    sqInt next;
+    usqInt next;
     usqInt numSlots;
     usqInt numSlots1;
     sqInt o;
@@ -35387,6 +35388,9 @@
     sqInt slotBytes;
 
 	prevFree = (prevPrevFree = 0);
+	if (GIV(firstFreeChunk) == 0) {
+		return GIV(lastFreeChunk) == 0;
+	}
 	freeChunk = GIV(firstFreeChunk);
 	/* begin allOldSpaceEntitiesDo: */
 	/* begin allOldSpaceEntitiesFrom:do: */
@@ -35399,7 +35403,7 @@
 		assert((long64At(objOop1)) != 0);
 		if (((longAt(objOop1)) & 0x3FFFFF) == 0) {
 			assert(objOop1 == freeChunk);
-			next = (longAt((freeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree;
+			next = ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree));
 
 			/* coInterpreter transcript cr; print: freeChunk; tab; print: o; tab; print: prevFree; nextPutAll: '<->'; print: next; flush. */
 
@@ -36168,21 +36172,21 @@
 			if (prevFree == 0) {
 				assert(free == GIV(lastFreeChunk));
 				prevFree = GIV(lastFreeChunk);
-				free = (longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ 0;
+				free = ((usqInt)((longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ 0));
 			}
 			else {
 				assert(isFreeObject(prevFree));
 				if (prevPrevFree == 0) {
 					prevPrevFree = GIV(lastFreeChunk);
-					prevFree = (longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ 0;
+					prevFree = ((usqInt)((longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ 0));
 				}
 				else {
 					assert(isFreeObject(prevPrevFree));
-					free = (longAt((prevFree + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevPrevFree;
+					free = ((usqInt)((longAt((prevFree + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevPrevFree));
 					prevPrevFree = prevFree;
 					prevFree = free;
 				}
-				free = (longAt((prevFree + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevPrevFree;
+				free = ((usqInt)((longAt((prevFree + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevPrevFree));
 			}
 		}
 		assert(checkTraversableSortedFreeList());
@@ -39867,14 +39871,14 @@
 	if (((next = longAt((freeChunk + BaseHeaderSize) + (3LL << (shiftForWord()))))) != 0) {
 		inOrderPrintFreeTreeprintList(next, printNextList);
 	}
-	printFreeChunkisNextChunk(freeChunk, 0);
+	printFreeChunkprintAsTreeNode(freeChunk, 1);
 	if (printNextList) {
 		next = freeChunk;
 		while (((next = longAt((next + BaseHeaderSize) + (0LL << (shiftForWord()))))) != 0) {
 			/* begin tab */
 			/* begin printChar: */
 			putchar('	');
-			printFreeChunkisNextChunk(next, 1);
+			printFreeChunkprintAsTreeNode(next, 0);
 		}
 	}
 	if (((next = longAt((freeChunk + BaseHeaderSize) + (4LL << (shiftForWord()))))) != 0) {
@@ -48113,10 +48117,10 @@
     usqInt maxFreeChunk;
     sqInt moved;
     sqInt newChunk;
-    sqInt next;
+    usqInt next;
     usqInt nextFree;
-    sqInt nextNext;
-    sqInt nextNextFree;
+    usqInt nextNext;
+    usqInt nextNextFree;
     usqInt numSlots;
     usqInt numSlots1;
     usqInt numSlots11;
@@ -48183,7 +48187,7 @@
 		assert((isFreeObject(GIV(firstFreeChunk)))
 		 && (isFreeObject(thisFreeChunk)));
 		freeBytes = bytesInObject(thisFreeChunk);
-		nextFree = (longAt((thisFreeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFreeChunk;
+		nextFree = ((usqInt)((longAt((thisFreeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFreeChunk));
 		destination = ((byteAt(thisFreeChunk + 7)) == 0xFF
 			? thisFreeChunk - BaseHeaderSize
 			: thisFreeChunk);
@@ -48238,7 +48242,7 @@
 			/* we did overwrite it; we need to repair the free list */
 
 			if (nextFree != 0) {
-				nextNextFree = (longAt((nextFree + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ thisFreeChunk;
+				nextNextFree = ((usqInt)((longAt((nextFree + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ thisFreeChunk));
 				assert(isFreeObject(nextFree));
 			}
 			if ((destination > thisFreeChunk)
@@ -48328,7 +48332,7 @@
 			pigBytes = there - here;
 			while ((freeChunk != 0)
 			 && (freeChunk < hereObj)) {
-				next = (longAt((freeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree;
+				next = ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree));
 				dest = ((byteAt(freeChunk + 7)) == 0xFF
 					? freeChunk - BaseHeaderSize
 					: freeChunk);
@@ -48351,7 +48355,7 @@
 					assert(((7 >= 0) && (7 <= (formatMask()))));
 					longAtput(hereObj, ((longAt(hereObj)) & (~((0x1FLL << 24) + 0x3FFFFF))) + (8 + (7LL << 24)));
 					if (next != 0) {
-						nextNext = (longAt((next + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ freeChunk;
+						nextNext = ((usqInt)((longAt((next + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ freeChunk));
 					}
 					if (pigBytes < chunkBytes) {
 
@@ -48485,10 +48489,10 @@
 	`Circular Lists', exercise. 18
 	http://en.wikipedia.org/wiki/XOR_linked_list. */
 
-sqInt
+usqInt
 nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree)
 {
-	return (longAt((freeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree;
+	return ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree));
 }
 
 sqInt
@@ -49928,7 +49932,7 @@
 				seenNewFreeChunk = 1;
 			}
 			/* begin printFreeChunk: */
-			printFreeChunkisNextChunk(objOop, 0);
+			printFreeChunkprintAsTreeNode(objOop, 1);
 		}
 
 		prevPrevObj = prevObj;
@@ -49973,7 +49977,7 @@
 				seenNewFreeChunk = 1;
 			}
 			/* begin printFreeChunk: */
-			printFreeChunkisNextChunk(objOop, 0);
+			printFreeChunkprintAsTreeNode(objOop, 1);
 		}
 
 		prevPrevObj = prevObj;
@@ -50016,7 +50020,7 @@
 		assert((long64At(objOop1)) != 0);
 		if (((longAt(objOop1)) & 0x3FFFFF) == 0) {
 			/* begin printFreeChunk: */
-			printFreeChunkisNextChunk(objOop1, 0);
+			printFreeChunkprintAsTreeNode(objOop1, 1);
 		}
 
 		prevPrevObj1 = prevObj1;
@@ -50053,11 +50057,11 @@
 void
 printFreeChunk(sqInt freeChunk)
 {
-	printFreeChunkisNextChunk(freeChunk, 0);
+	printFreeChunkprintAsTreeNode(freeChunk, 1);
 }
 
 static void
-printFreeChunkisNextChunk(sqInt freeChunk, sqInt isNextChunk)
+printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode)
 {
     usqInt numBytes;
     void *p;
@@ -50078,7 +50082,7 @@
 	/* begin printHexnp: */
 	printf("0x%lx", ((unsigned long) (oopForPointer(p3))));
 	if ((numBytes >= (64 * 8))
-	 && (!isNextChunk)) {
+	 && (printAsTreeNode)) {
 		print(" ^ ");
 		/* begin printHexPtrnp: */
 		p = ((void *) (longAt((freeChunk + BaseHeaderSize) + (2LL << (shiftForWord())))));
@@ -50145,7 +50149,7 @@
 	freeChunk = chunkOrIndex;
 	while (freeChunk != 0) {
 		/* begin printFreeChunk: */
-		printFreeChunkisNextChunk(freeChunk, 0);
+		printFreeChunkprintAsTreeNode(freeChunk, 1);
 		freeChunk = longAt((freeChunk + BaseHeaderSize) + (0LL << (shiftForWord())));
 	}
 }
@@ -50167,7 +50171,7 @@
 	if (chunkOrZero > 0) {
 		printFreeTreeChunk(longAt((chunkOrZero + BaseHeaderSize) + (3LL << (shiftForWord()))));
 		/* begin printFreeChunk: */
-		printFreeChunkisNextChunk(chunkOrZero, 0);
+		printFreeChunkprintAsTreeNode(chunkOrZero, 1);
 		printFreeTreeChunk(longAt((chunkOrZero + BaseHeaderSize) + (4LL << (shiftForWord()))));
 	}
 }
@@ -51436,7 +51440,41 @@
 	
 }
 
+void
+printSortedFreeList(void)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    usqInt freeChunk;
+    usqInt nextFree;
+    usqInt prevFree;
 
+	if (!((GIV(firstFreeChunk) > 0)
+		 && (GIV(lastFreeChunk) > GIV(firstFreeChunk)))) {
+		print("sorted free list empty or corrupt");
+		/* begin cr */
+		printf("\n");
+		return;
+	}
+	freeChunk = GIV(firstFreeChunk);
+	prevFree = 0;
+	while (1) {
+		if (!((addressCouldBeObj(freeChunk))
+			 && (((longAt(freeChunk)) & 0x3FFFFF) == 0))) {
+			/* begin printHexnp: */
+			printf("0x%lx", ((unsigned long) freeChunk));
+			print(" is not a free chunk!");
+			/* begin cr */
+			printf("\n");
+			return;
+		}
+		printFreeChunkprintAsTreeNode(freeChunk, 0);
+		if (!(freeChunk != GIV(lastFreeChunk))) break;
+		nextFree = ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree));
+		prevFree = freeChunk;
+		freeChunk = nextFree;
+	}
+}
+
+
 /*	Attempt to push anEphemeron on the unscanned ephemerons stack
 	and answer if the attempt succeeded. Note that the ephemeron
 	stack overflowing isn't a disaster; it simply means treating the
@@ -51521,7 +51559,7 @@
 	free = GIV(firstFreeChunk);
 	prevPrevFree = (prevFree = 0);
 	while (free != 0) {
-		nextFree = (longAt((free + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree;
+		nextFree = ((usqInt)((longAt((free + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree));
 		assert(isFreeObject(free));
 		assert((nextFree == 0)
 		 || ((nextFree > free)

Modified: branches/Cog/nsspurstack64src/vm/interp.c
===================================================================
--- branches/Cog/nsspurstack64src/vm/interp.c	2015-05-21 18:18:06 UTC (rev 3353)
+++ branches/Cog/nsspurstack64src/vm/interp.c	2015-05-21 19:54:19 UTC (rev 3354)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2
    from
-	StackInterpreter VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440
+	StackInterpreter VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2
  */
-static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.1317 uuid: a7e082b5-1ad8-42ef-84cc-0079605c8440 " __DATE__ ;
+static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.1318 uuid: dc8819e1-ef78-459c-9ee5-7f67a285f5d2 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -884,7 +884,7 @@
 static sqInt moveARunOfObjectsStartingAtupTo(usqInt startAddress, usqInt limit) NoDbgRegParms;
 static sqInt newObjectHash(void);
 static sqInt newSpaceIsEmpty(void);
-sqInt nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree);
+usqInt nextInSortedFreeListLinkgiven(sqInt freeChunk, sqInt prevFree);
 sqInt nilObject(void);
 static void nilUnmarkedWeaklingSlots(void) NeverInline;
 static sqInt noCheckClassAtIndex(sqInt classIndex) NoDbgRegParms;
@@ -916,7 +916,7 @@
 void printForwarders(void);
 void printFreeChunks(void);
 void printFreeChunk(sqInt freeChunk);
-static void printFreeChunkisNextChunk(sqInt freeChunk, sqInt isNextChunk) NoDbgRegParms;
+static void printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode) NoDbgRegParms;
 void printFreeListHeads(void);
 void printFreeList(sqInt chunkOrIndex);
 void printFreeTree(void);
@@ -934,6 +934,7 @@
 void printObjStack(sqInt objStack);
 void printOopsFromto(sqInt startAddress, sqInt endAddress);
 void printReferencesTo(sqInt anOop);
+void printSortedFreeList(void);
 static sqInt pushOnUnscannedEphemeronsStack(sqInt anEphemeron) NoDbgRegParms;
 void pushRemappableOop(sqInt oop);
 static sqInt pushonObjStack(sqInt objOop, sqInt objStack) NoDbgRegParms;
@@ -1403,9 +1404,9 @@
 _iss sqInt remapBufferCount;
 _iss sqInt bytesPerPage;
 _iss usqInt freeListsMask;
+_iss usqInt firstFreeChunk;
 _iss sqInt tempOop;
 _iss SpurContiguousObjStack unscannedEphemerons;
-_iss usqInt firstFreeChunk;
 _iss StackPage * mostRecentlyUsedPage;
 _iss SpurNewSpaceSpace pastSpace;
 _iss usqInt newSpaceStart;
@@ -1420,12 +1421,12 @@
 _iss sqLong nextProfileTick;
 _iss sqInt numRememberedEphemerons;
 _iss sqInt jmpDepth;
+_iss usqInt lastFreeChunk;
 _iss SpurNewSpaceSpace eden;
 _iss sqInt futureSurvivorStart;
 _iss sqInt longRunningPrimitiveCheckMethod;
 _iss sqInt longRunningPrimitiveCheckSemaphore;
 _iss sqInt profileSemaphore;
-_iss usqInt lastFreeChunk;
 _iss char * objStackInvalidBecause;
 _iss sqInt becomeEffectsFlags;
 _iss sqInt ephemeronList;
@@ -2146,7 +2147,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.1317";
+const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.1318";
 volatile int sendTrace;
 sqInt suppressHeartbeatFlag;
 
@@ -35365,7 +35366,7 @@
     sqInt followingWordAddress;
     usqInt freeChunk;
     usqInt limit;
-    sqInt next;
+    usqInt next;
     usqInt numSlots;
     usqInt numSlots1;
     sqInt o;
@@ -35378,6 +35379,9 @@
     sqInt slotBytes;
 
 	prevFree = (prevPrevFree = 0);
+	if (GIV(firstFreeChunk) == 0) {
+		return GIV(lastFreeChunk) == 0;
+	}
 	freeChunk = GIV(firstFreeChunk);
 	/* begin allOldSpaceEntitiesDo: */
 	/* begin allOldSpaceEntitiesFrom:do: */
@@ -35390,7 +35394,7 @@
 		assert((long64At(objOop1)) != 0);
 		if (((longAt(objOop1)) & 0x3FFFFF) == 0) {
 			assert(objOop1 == freeChunk);
-			next = (longAt((freeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree;
+			next = ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree));
 
 			/* coInterpreter transcript cr; print: freeChunk; tab; print: o; tab; print: prevFree; nextPutAll: '<->'; print: next; flush. */
 
@@ -36159,21 +36163,21 @@
 			if (prevFree == 0) {
 				assert(free == GIV(lastFreeChunk));
 				prevFree = GIV(lastFreeChunk);
-				free = (longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ 0;
+				free = ((usqInt)((longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ 0));
 			}
 			else {
 				assert(isFreeObject(prevFree));
 				if (prevPrevFree == 0) {
 					prevPrevFree = GIV(lastFreeChunk);
-					prevFree = (longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ 0;
+					prevFree = ((usqInt)((longAt((GIV(lastFreeChunk) + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ 0));
 				}
 				else {
 					assert(isFreeObject(prevPrevFree));
-					free = (longAt((prevFree + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevPrevFree;
+					free = ((usqInt)((longAt((prevFree + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevPrevFree));
 					prevPrevFree = prevFree;
 					prevFree = free;
 				}
-				free = (longAt((prevFree + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevPrevFree;
+				free = ((usqInt)((longAt((prevFree + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevPrevFree));
 			}
 		}
 		assert(checkTraversableSortedFreeList());
@@ -39858,14 +39862,14 @@
 	if (((next = longAt((freeChunk + BaseHeaderSize) + (3LL << (shiftForWord()))))) != 0) {
 		inOrderPrintFreeTreeprintList(next, printNextList);
 	}
-	printFreeChunkisNextChunk(freeChunk, 0);
+	printFreeChunkprintAsTreeNode(freeChunk, 1);
 	if (printNextList) {
 		next = freeChunk;
 		while (((next = longAt((next + BaseHeaderSize) + (0LL << (shiftForWord()))))) != 0) {
 			/* begin tab */
 			/* begin printChar: */
 			putchar('	');
-			printFreeChunkisNextChunk(next, 1);
+			printFreeChunkprintAsTreeNode(next, 0);
 		}
 	}
 	if (((next = longAt((freeChunk + BaseHeaderSize) + (4LL << (shiftForWord()))))) != 0) {
@@ -48104,10 +48108,10 @@
     usqInt maxFreeChunk;
     sqInt moved;
     sqInt newChunk;
-    sqInt next;
+    usqInt next;
     usqInt nextFree;
-    sqInt nextNext;
-    sqInt nextNextFree;
+    usqInt nextNext;
+    usqInt nextNextFree;
     usqInt numSlots;
     usqInt numSlots1;
     usqInt numSlots11;
@@ -48174,7 +48178,7 @@
 		assert((isFreeObject(GIV(firstFreeChunk)))
 		 && (isFreeObject(thisFreeChunk)));
 		freeBytes = bytesInObject(thisFreeChunk);
-		nextFree = (longAt((thisFreeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFreeChunk;
+		nextFree = ((usqInt)((longAt((thisFreeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFreeChunk));
 		destination = ((byteAt(thisFreeChunk + 7)) == 0xFF
 			? thisFreeChunk - BaseHeaderSize
 			: thisFreeChunk);
@@ -48229,7 +48233,7 @@
 			/* we did overwrite it; we need to repair the free list */
 
 			if (nextFree != 0) {
-				nextNextFree = (longAt((nextFree + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ thisFreeChunk;
+				nextNextFree = ((usqInt)((longAt((nextFree + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ thisFreeChunk));
 				assert(isFreeObject(nextFree));
 			}
 			if ((destination > thisFreeChunk)
@@ -48319,7 +48323,7 @@
 			pigBytes = there - here;
 			while ((freeChunk != 0)
 			 && (freeChunk < hereObj)) {
-				next = (longAt((freeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree;
+				next = ((usqInt)((longAt((freeChunk + BaseHeaderSize) + (0LL << (shiftForWord())))) ^ prevFree));
 				dest = ((byteAt(freeChunk + 7)) == 0xFF
 					? freeChunk - BaseHeaderSize
 					: freeChunk);
@@ -48342,7 +48346,7 @@
 					assert(((7 >= 0) && (7 <= (formatMask()))));
 					longAtput(hereObj, ((longAt(hereObj)) & (~((0x1FLL << 24) + 0x3FFFFF))) + (8 + (7LL << 24)));
 					if (next != 0) {

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list