[Vm-dev] [commit][3006] CogVM source as per VMMaker.oscog-eem.775

commits at squeakvm.org commits at squeakvm.org
Mon Jun 16 20:42:35 UTC 2014


Revision: 3006
Author:   eliot
Date:     2014-06-16 13:42:34 -0700 (Mon, 16 Jun 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.775

Rationalize the allocation check filler between V3 ObjMem and Spur.  Make it
applicable only to plugin prims and optional, via the checkAllocFiller flag.
Add a prim failure code for this, PrimErrWritePastObject.  Make the Cogit check
and fail offending ext prims if the flag is set.  Don't fill new space with the
alloc check filler if the flag is not set.

Provide a -checkpluginwrites command line flag to turn on the check.

This is good for a -49% increase in the performance of e.g.
	[1 to: 1000000000 do: [:i| {nil}]] timeToRun
on Spur.

Refactor numStrongSlotsOf:ephemeronInactiveIf: and inline it in
scavengeReferentsOf:, reusing the object format for the isWeakling test.
Provide numStrongSlotsOfWeakling: for weakling nilling, and hence arrange
that the numStrongSlotsOf:ephemeronInactiveIf: is always non-nil.

Reorganize the StackInterpreter classes when building a VMMaker image.

Modified Paths:
--------------
    branches/Cog/image/BuildSqueak45VMMakerImage.st
    branches/Cog/nscogsrc/vm/cogit.c
    branches/Cog/nscogsrc/vm/cogit.h
    branches/Cog/nscogsrc/vm/cogmethod.h
    branches/Cog/nscogsrc/vm/cointerp.c
    branches/Cog/nscogsrc/vm/cointerp.h
    branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
    branches/Cog/nscogsrc/vm/interp.h
    branches/Cog/nscogsrc/vm/vmCallback.h
    branches/Cog/nsspursrc/vm/cogit.c
    branches/Cog/nsspursrc/vm/cogit.h
    branches/Cog/nsspursrc/vm/cogmethod.h
    branches/Cog/nsspursrc/vm/cointerp.c
    branches/Cog/nsspursrc/vm/cointerp.h
    branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
    branches/Cog/nsspursrc/vm/interp.h
    branches/Cog/nsspursrc/vm/vmCallback.h
    branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c
    branches/Cog/nsspurstacksrc/vm/interp.c
    branches/Cog/nsspurstacksrc/vm/interp.h
    branches/Cog/nsspurstacksrc/vm/vmCallback.h
    branches/Cog/platforms/Mac OS/vm/sqMacUnixCommandLineInterface.c
    branches/Cog/platforms/unix/vm/sqUnixMain.c
    branches/Cog/platforms/win32/vm/sqWin32Intel.c
    branches/Cog/platforms/win32/vm/sqWin32Window.c
    branches/Cog/sistasrc/vm/cogit.c
    branches/Cog/sistasrc/vm/cogit.h
    branches/Cog/sistasrc/vm/cogmethod.h
    branches/Cog/sistasrc/vm/cointerp.c
    branches/Cog/sistasrc/vm/cointerp.h
    branches/Cog/sistasrc/vm/gcc3x-cointerp.c
    branches/Cog/sistasrc/vm/interp.h
    branches/Cog/sistasrc/vm/vmCallback.h
    branches/Cog/spursistasrc/vm/cogit.c
    branches/Cog/spursistasrc/vm/cogit.h
    branches/Cog/spursistasrc/vm/cogmethod.h
    branches/Cog/spursistasrc/vm/cointerp.c
    branches/Cog/spursistasrc/vm/cointerp.h
    branches/Cog/spursistasrc/vm/gcc3x-cointerp.c
    branches/Cog/spursistasrc/vm/interp.h
    branches/Cog/spursistasrc/vm/vmCallback.h
    branches/Cog/spursrc/vm/cogit.c
    branches/Cog/spursrc/vm/cogit.h
    branches/Cog/spursrc/vm/cogmethod.h
    branches/Cog/spursrc/vm/cointerp.c
    branches/Cog/spursrc/vm/cointerp.h
    branches/Cog/spursrc/vm/gcc3x-cointerp.c
    branches/Cog/spursrc/vm/interp.h
    branches/Cog/spursrc/vm/vmCallback.h
    branches/Cog/spurstacksrc/vm/gcc3x-interp.c
    branches/Cog/spurstacksrc/vm/interp.c
    branches/Cog/spurstacksrc/vm/interp.h
    branches/Cog/spurstacksrc/vm/vmCallback.h
    branches/Cog/src/vm/cogit.c
    branches/Cog/src/vm/cogit.h
    branches/Cog/src/vm/cogmethod.h
    branches/Cog/src/vm/cointerp.c
    branches/Cog/src/vm/cointerp.h
    branches/Cog/src/vm/cointerpmt.c
    branches/Cog/src/vm/cointerpmt.h
    branches/Cog/src/vm/gcc3x-cointerp.c
    branches/Cog/src/vm/gcc3x-cointerpmt.c
    branches/Cog/src/vm/interp.h
    branches/Cog/src/vm/vmCallback.h
    branches/Cog/stacksrc/vm/gcc3x-interp.c
    branches/Cog/stacksrc/vm/interp.c
    branches/Cog/stacksrc/vm/interp.h
    branches/Cog/stacksrc/vm/vmCallback.h

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

Modified: branches/Cog/image/BuildSqueak45VMMakerImage.st
===================================================================
--- branches/Cog/image/BuildSqueak45VMMakerImage.st	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/image/BuildSqueak45VMMakerImage.st	2014-06-16 20:42:34 UTC (rev 3006)
@@ -75,5 +75,7 @@
 		[:c|
 		c organization sortCategories.
 		c class organization sortCategories]].
+StackInterpreter withAllSubclasses do:
+	[:sic| sic reorganizeAsISeeFit].
 
 Smalltalk snapshot: true andQuit: true
Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-06-16 20:42:34 UTC (rev 3006)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422
+	CCodeGenerator VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422
+	StackToRegisterMappingCogit VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -307,6 +307,7 @@
 #define PrimCallMayCallBack 4
 #define PrimCallNeedsNewMethod 1
 #define PrimCallNeedsPrimitiveFunction 2
+#define PrimErrWritePastObject 17
 #define PushCw 71
 #define PushR 70
 #define ReceiverIndex 5
@@ -951,6 +952,7 @@
 static void marshallImplicitReceiverSendArguments(sqInt numArgs) NoDbgRegParms;
 static void marshallSendArguments(sqInt numArgs) NoDbgRegParms;
 usqInt maxCogMethodAddress(void);
+static void maybeCompileAllocFillerCheck(void);
 static sqInt maybeFreeCogMethodDoesntLookKosher(CogMethod *cogMethod) NoDbgRegParms;
 static sqInt maybeGenerateCheckFeatures(void);
 static sqInt maybeGenerateICacheFlush(void);
@@ -4985,6 +4987,7 @@
 			/* begin Label */
 			continuePostSamplePrim = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
 		}
+		maybeCompileAllocFillerCheck();
 		/* begin MoveAw:R: */
 		address8 = instructionPointerAddress();
 		genoperandoperand(MoveAwR, address8, ClassReg);
@@ -14785,6 +14788,7 @@
 		/* begin Label */
 		continuePostSample = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
 	}
+	maybeCompileAllocFillerCheck();
 	/* begin MoveAw:R: */
 	address5 = primFailCodeAddress();
 	genoperandoperand(MoveAwR, address5, TempReg);
@@ -18946,6 +18950,40 @@
 }
 
 
+/*	If allocCheckFiller is true, words in newSpace from freeStart to
+	scavengeThreshold are filled with their address, and after each call of a
+	plugin primitive, the VM checks
+	that freeStart points to a word containing the value of freeStart. This is
+	a simple
+	check for primitives overwriting the ends of an object. */
+
+static void
+maybeCompileAllocFillerCheck(void)
+{
+    sqInt address;
+    sqInt address1;
+    AbstractInstruction *jmpOk;
+
+	if (getCheckAllocFiller()) {
+		/* begin MoveAw:R: */
+		address = freeStartAddress();
+		genoperandoperand(MoveAwR, address, ClassReg);
+		/* begin MoveMw:r:R: */
+		genoperandoperandoperand(MoveMwrR, 0, ClassReg, TempReg);
+		/* begin CmpR:R: */
+		genoperandoperand(CmpRR, ClassReg, TempReg);
+		/* begin JumpZero: */
+		jmpOk = genoperand(JumpZero, ((sqInt)0));
+		/* begin MoveCq:R: */
+		genoperandoperand(MoveCqR, PrimErrWritePastObject, TempReg);
+		/* begin MoveR:Aw: */
+		address1 = primFailCodeAddress();
+		genoperandoperand(MoveRAw, TempReg, address1);
+		jmpTarget(jmpOk, gLabel());
+	}
+}
+
+
 /*	Check that the header fields are consistent with the type.
 	Answer 0 if it is ok, otherwise answer a code for the error. */
 

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-06-16 20:42:34 UTC (rev 3006)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422
+	CCodeGenerator VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/nscogsrc/vm/cogmethod.h	2014-06-16 20:42:34 UTC (rev 3006)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422
+	CCodeGenerator VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
  */
 
 typedef struct {

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2014-06-16 20:42:34 UTC (rev 3006)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
    from
-	CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9
+	CoInterpreter VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -94,9 +94,6 @@
 #define AllButMarkBitAndTypeMask 0x7FFFFFFC
 #define AllButRootBit 0xBFFFFFFFUL
 #define AllButTypeMask 0xFFFFFFFCUL
-#if !defined(AllocationCheckFiller)
-# define AllocationCheckFiller 182275669
-#endif
 #define AltLongStoreBytecode 234
 #define AtCacheFixedFields 4
 #define AtCacheFmt 3
@@ -129,6 +126,7 @@
 #define CacheProbeMax 3
 #define CharacterTable 24
 #define CharacterValueIndex 0
+#define CheckAllocationFillerAfterPrimCall 16
 #define ClassAlien 52
 #define ClassArray 7
 #define ClassArrayCompactIndex 3
@@ -286,6 +284,7 @@
 #define PrimErrNotFound 11
 #define PrimErrTableIndex 51
 #define PrimErrUnsupported 7
+#define PrimErrWritePastObject 17
 #define PrimitiveExternalCallIndex 117
 #define PrimNoErr 0
 #define PrimTraceLogSize 256
@@ -621,6 +620,7 @@
 static sqInt fwdBlockValid(sqInt addr) NoDbgRegParms;
 static sqInt fwdTableInit(sqInt blkSize) NoDbgRegParms;
 static sqInt fwdTableSize(sqInt blkSize) NoDbgRegParms;
+sqInt getCheckAllocFiller(void);
 sqInt getCurrentBytecode(void);
 sqInt getFullScreenFlag(void);
 sqInt getInterruptKeycode(void);
@@ -1172,7 +1172,7 @@
 static void rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)(void)) NoDbgRegParms;
 static sqInt roomToPushNArgs(sqInt n) NoDbgRegParms;
 static void runLeakCheckerForFullGC(sqInt fullGCFlag) NoDbgRegParms;
-static sqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
+static usqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
 static sqInt safePrintStringOf(sqInt oop) NoDbgRegParms;
 usqInt scavengeThresholdAddress(void);
 EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext);
@@ -1319,9 +1319,9 @@
 _iss sqInt rootTableCount;
 _iss usqInt memoryLimit;
 _iss usqInt endOfMemory;
+_iss usqInt scavengeThreshold;
 _iss unsigned char primTraceLogIndex;
 _iss StackPage * mostRecentlyUsedPage;
-_iss usqInt scavengeThreshold;
 _iss sqInt numStackPages;
 _iss sqInt needGCFlag;
 _iss sqInt jmpDepth;
@@ -1464,6 +1464,7 @@
 static void (*primitiveFunctionPointer)();
 sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */;
 jmp_buf reenterInterpreter; /* private export */;
+sqInt checkAllocFiller;
 sqInt inIOProcessEvents;
 sqInt checkForLeaks;
 sqInt desiredEdenBytes;
@@ -2060,12 +2061,13 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.746";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.775";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
 
 /*** Macros ***/
+#define checkAllocFiller() GIV(checkAllocFiller)
 #define classFieldOffset() (0 - BaseHeaderSize)
 #define compactClassFieldLSB() 12
 #define compactClassFieldWidth() 5
@@ -5337,6 +5339,13 @@
 					GIV(primFailCode) = 0;
 					dispatchFunctionPointer(primitiveFunctionPointer);
 					
+					/* begin maybeFailForLastObjectOverwrite */
+					if (checkAllocFiller) {
+						if (((freeStart()) < GIV(scavengeThreshold))
+						 && ((longAt(freeStart())) != (freeStart()))) {
+							GIV(primFailCode) = PrimErrWritePastObject;
+						}
+					}
 					if (FailImbalancedPrimitives
 					 && ((!GIV(primFailCode))
 					 && ((GIV(framePointer) == savedFramePointer)
@@ -13616,10 +13625,11 @@
     sqInt fillPointer;
     sqInt header;
     sqInt header1;
-    usqInt i;
-    usqInt i1;
     sqInt obj;
     sqInt obj1;
+    usqInt p;
+    usqInt p1;
+    usqInt start;
     sqInt sz;
     sqInt sz1;
 
@@ -13690,10 +13700,12 @@
 		/* didn't fit.  refill with allocation check pattern and answer count. */
 
 		/* begin maybeFillWithAllocationCheckFillerFrom:to: */
-		for (i = GIV(freeStart); i <= fillPointer; i += BytesPerWord) {
-			longAtput(i, i);
+		start = GIV(freeStart);
+		if (checkAllocFiller()) {
+			for (p = start; p <= fillPointer; p += BytesPerWord) {
+				longAtput(p, p);
+			}
 		}
-
 		return ((count << 1) | 1);
 	}
 	byteSize = fillPointer - (((sqInt)(firstFixedField(container))));
@@ -13702,10 +13714,11 @@
 	longAtput(container - (BytesPerWord * 2), ((byteSize + BytesPerWord) & LongSizeMask) | ((((longAt(container - (BytesPerWord * 2))) | LongSizeMask) - LongSizeMask)));
 	if (fillPointer < afterPreAllocatedObject) {
 		/* begin maybeFillWithAllocationCheckFillerFrom:to: */
-		for (i1 = fillPointer; i1 <= afterPreAllocatedObject; i1 += BytesPerWord) {
-			longAtput(i1, i1);
+		if (checkAllocFiller()) {
+			for (p1 = fillPointer; p1 <= afterPreAllocatedObject; p1 += BytesPerWord) {
+				longAtput(p1, p1);
+			}
 		}
-
 	}
 	GIV(freeStart) = fillPointer;
 	return container;
@@ -18123,10 +18136,6 @@
 	newChunk1 = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + bytes;
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk1)) != (newChunk1))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newChunk = oopForPointer(newChunk1);
 		goto l1;
@@ -19523,10 +19532,6 @@
 	newChunk = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (byteSize + ((hdrSize - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk)) != (newChunk))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk);
 		goto l1;
@@ -19640,10 +19645,6 @@
 	newChunk = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (byteSize + ((hdrSize - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk)) != (newChunk))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk);
 		goto l1;
@@ -19811,10 +19812,6 @@
 	newChunk = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (byteSize + ((hdrSize - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk)) != (newChunk))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk);
 		goto l1;
@@ -19892,10 +19889,6 @@
 	newChunk = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (sizeInBytes + ((1 - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk)) != (newChunk))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk);
 		goto l1;
@@ -19969,10 +19962,6 @@
 	newChunk = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (sizeInBytes + ((1 - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk)) != (newChunk))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk);
 		goto l1;
@@ -20046,10 +20035,6 @@
 	newChunk = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (sizeInBytes + ((hdrSize - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk)) != (newChunk))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk);
 		goto l1;
@@ -23047,7 +23032,13 @@
 	return (fwdLast - fwdFirst) / blkSize;
 }
 
+sqInt
+getCheckAllocFiller(void)
+{
+	return checkAllocFiller;
+}
 
+
 /*	currentBytecode will be private to the main dispatch loop in the generated
 	code. This method allows the currentBytecode to be retrieved from global
 	variables. Override to answer -1 if we're not in an interpreter frame. */
@@ -23989,17 +23980,15 @@
     sqInt header1;
     sqInt header2;
     sqInt header3;
-    sqInt header4;
     usqInt lastWord;
     sqInt newFreeChunk;
     sqInt newOop;
-    sqInt next;
+    usqInt next;
     sqInt oop;
     sqInt realHeader;
     sqInt sz;
     sqInt sz1;
     sqInt sz2;
-    sqInt sz3;
     sqInt target;
     usqInt w;
 
@@ -24010,21 +23999,7 @@
 		/* begin objectAfterWhileForwarding: */
 		header2 = longAt(oop);
 		if ((header2 & MarkBit) == 0) {
-			/* begin objectAfter: */
-			if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
-				error("no objects after the end of memory");
-			}
-			if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
-				sz2 = (longAt(oop)) & AllButTypeMask;
-			}
-			else {
-				/* begin sizeBitsOf: */
-				header3 = longAt(oop);
-				sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
-					? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
-					: header3 & SizeMask);
-			}
-			next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
+			next = ((sqInt) (objectAfter(oop)));
 			goto l1;
 		}
 		fwdBlock1 = (header2 & AllButMarkBitAndTypeMask) << 1;
@@ -24039,7 +24014,7 @@
 		else {
 			sz1 = realHeader & SizeMask;
 		}
-		next = (oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask]);
+		next = ((sqInt) ((oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask])));
 	l1:	/* end objectAfterWhileForwarding: */;
 		if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
 
@@ -24093,18 +24068,18 @@
 	}
 	/* begin safeObjectAfter: */
 	if (((longAt(newFreeChunk)) & TypeMask) == HeaderTypeFree) {
-		sz3 = (longAt(newFreeChunk)) & AllButTypeMask;
+		sz2 = (longAt(newFreeChunk)) & AllButTypeMask;
 	}
 	else {
 		/* begin sizeBitsOf: */
-		header4 = longAt(newFreeChunk);
-		sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
+		header3 = longAt(newFreeChunk);
+		sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
 			? (longAt(newFreeChunk - (BytesPerWord * 2))) & LongSizeMask
-			: header4 & SizeMask);
+			: header3 & SizeMask);
 	}
-	next = ((newFreeChunk + sz3) >= GIV(freeStart)
+	next = ((newFreeChunk + sz2) >= GIV(freeStart)
 		? GIV(freeStart)
-		: (newFreeChunk + sz3) + (headerTypeBytes[(longAt(newFreeChunk + sz3)) & TypeMask]));
+		: (newFreeChunk + sz2) + (headerTypeBytes[(longAt(newFreeChunk + sz2)) & TypeMask]));
 	assert((next == GIV(freeStart))
 	 || (next == (oopFromChunk(GIV(compEnd)))));
 	if (next == GIV(freeStart)) {
@@ -24289,9 +24264,11 @@
 static void
 initializeMemoryFirstFree(sqInt firstFree)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    usqInt end;
     sqInt fwdBlockBytes;
-    usqInt i;
     sqInt newEndOfMemory;
+    usqInt p;
+    usqInt start;
     sqInt totalReserve;
 
 	fwdBlockBytes = GIV(totalObjectCount) & ((WordMask - BytesPerWord) + 1);
@@ -24319,10 +24296,13 @@
 	GIV(freeStart) = firstFree;
 	GIV(scavengeThreshold) = (((GIV(freeStart) + GIV(edenBytes)) < GIV(reserveStart)) ? (GIV(freeStart) + GIV(edenBytes)) : GIV(reserveStart));
 	/* begin maybeFillWithAllocationCheckFillerFrom:to: */
-	for (i = GIV(freeStart); i <= GIV(scavengeThreshold); i += BytesPerWord) {
-		longAtput(i, i);
+	start = GIV(freeStart);
+	end = GIV(scavengeThreshold);
+	if (checkAllocFiller()) {
+		for (p = start; p <= end; p += BytesPerWord) {
+			longAtput(p, p);
+		}
 	}
-
 	assert(oopisLessThan(GIV(freeStart), GIV(reserveStart)));
 	
 	assert(oopisLessThan(GIV(endOfMemory), GIV(memoryLimit)));
@@ -24634,10 +24614,6 @@
 	newChunk1 = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (byteSize + ((hdrSize - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk1)) != (newChunk1))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk1);
 		goto l2;
@@ -24889,6 +24865,13 @@
 			GIV(primFailCode) = 0;
 			dispatchFunctionPointer(primitiveFunctionPointer);
 			
+			/* begin maybeFailForLastObjectOverwrite */
+			if (checkAllocFiller) {
+				if (((freeStart()) < GIV(scavengeThreshold))
+				 && ((longAt(freeStart())) != (freeStart()))) {
+					GIV(primFailCode) = PrimErrWritePastObject;
+				}
+			}
 			if (FailImbalancedPrimitives
 			 && ((!GIV(primFailCode))
 			 && ((GIV(framePointer) == savedFramePointer)
@@ -34920,6 +34903,13 @@
 	}
 	/* begin callExternalPrimitive: */
 	dispatchFunctionPointer(addr);
+	/* begin maybeFailForLastObjectOverwrite */
+	if (checkAllocFiller) {
+		if (((freeStart()) < GIV(scavengeThreshold))
+		 && ((longAt(freeStart())) != (freeStart()))) {
+			GIV(primFailCode) = PrimErrWritePastObject;
+		}
+	}
 	/* begin popRemappableOop */
 	oop4 = GIV(remapBuffer)[GIV(remapBufferCount)];
 	GIV(remapBufferCount) -= 1;
@@ -35080,6 +35070,13 @@
 	GIV(primFailCode) = 0;
 	dispatchFunctionPointer(primitiveFunctionPointer);
 	
+	/* begin maybeFailForLastObjectOverwrite */
+	if (checkAllocFiller) {
+		if (((freeStart()) < GIV(scavengeThreshold))
+		 && ((longAt(freeStart())) != (freeStart()))) {
+			GIV(primFailCode) = PrimErrWritePastObject;
+		}
+	}
 	if (FailImbalancedPrimitives
 	 && ((!GIV(primFailCode))
 	 && ((GIV(framePointer) == savedFramePointer)
@@ -35725,6 +35722,13 @@
 			rewriteMethodCacheEntryForExternalPrimitiveToFunction(addr);
 			/* begin callExternalPrimitive: */
 			dispatchFunctionPointer(addr);
+			/* begin maybeFailForLastObjectOverwrite */
+			if (checkAllocFiller) {
+				if (((freeStart()) < GIV(scavengeThreshold))
+				 && ((longAt(freeStart())) != (freeStart()))) {
+					GIV(primFailCode) = PrimErrWritePastObject;
+				}
+			}
 			return;
 		}
 		(GIV(primFailCode) = PrimErrNamedInternal);
@@ -35810,6 +35814,13 @@
 		rewriteMethodCacheEntryForExternalPrimitiveToFunction(addr);
 		/* begin callExternalPrimitive: */
 		dispatchFunctionPointer(addr);
+		/* begin maybeFailForLastObjectOverwrite */
+		if (checkAllocFiller) {
+			if (((freeStart()) < GIV(scavengeThreshold))
+			 && ((longAt(freeStart())) != (freeStart()))) {
+				GIV(primFailCode) = PrimErrWritePastObject;
+			}
+		}
 	}
 	else {
 
@@ -41505,6 +41516,9 @@
 		/* For callbacks */
 
 		baseFlags = baseFlags | ((PrimCallNeedsNewMethod + PrimCallNeedsPrimitiveFunction) + PrimCallMayCallBack);
+		if (checkAllocFiller) {
+			baseFlags = baseFlags | CheckAllocationFillerAfterPrimCall;
+		}
 	}
 	return baseFlags;
 }
@@ -50010,6 +50024,7 @@
 	GIV(jmpDepth) = 0;
 	GIV(longRunningPrimitiveStartUsecs) = (GIV(longRunningPrimitiveStopUsecs) = 0);
 	GIV(maxExtSemTabSizeSet) = 0;
+	checkAllocFiller = 0;
 	GIV(statForceInterruptCheck) = 0;
 	GIV(statStackOverflow) = 0;
 	GIV(statCheckForEvents) = 0;
@@ -50734,7 +50749,7 @@
 	given object or free chunk in memory. Return freeStart when
 	enumeration is complete. This is for assertion checking only. */
 
-static sqInt
+static usqInt
 safeObjectAfter(sqInt oop)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt header;
@@ -51462,11 +51477,12 @@
     sqInt classFormat;
     sqInt deltaBytes;
     sqInt desiredLength;
+    usqInt end;
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
-    usqInt i;
     sqInt indexableFields;
+    usqInt p;
     sqInt sz;
     sqInt totalLength;
 
@@ -51521,10 +51537,12 @@
 		/* Shortening the last object.  Need to reduce freeStart. */
 
 		/* begin maybeFillWithAllocationCheckFillerFrom:to: */
-		for (i = ((obj + BaseHeaderSize) + (desiredLength * BytesPerWord)); i <= GIV(freeStart); i += BytesPerWord) {
-			longAtput(i, i);
+		end = GIV(freeStart);
+		if (checkAllocFiller()) {
+			for (p = ((obj + BaseHeaderSize) + (desiredLength * BytesPerWord)); p <= end; p += BytesPerWord) {
+				longAtput(p, p);
+			}
 		}
-
 		GIV(freeStart) = (obj + BaseHeaderSize) + (desiredLength * BytesPerWord);
 	}
 	else {
@@ -52399,6 +52417,13 @@
 	GIV(primFailCode) = 0;
 	dispatchFunctionPointer(primitiveFunctionPointer);
 	
+	/* begin maybeFailForLastObjectOverwrite */
+	if (checkAllocFiller) {
+		if (((freeStart()) < GIV(scavengeThreshold))
+		 && ((longAt(freeStart())) != (freeStart()))) {
+			GIV(primFailCode) = PrimErrWritePastObject;
+		}
+	}
 	if (FailImbalancedPrimitives
 	 && ((!GIV(primFailCode))
 	 && ((GIV(framePointer) == savedFramePointer)

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2014-06-16 20:42:34 UTC (rev 3006)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
  */
 
 
@@ -99,6 +99,7 @@
 usqInt freeStartAddress(void);
 void (*functionPointerForCompiledMethodprimitiveIndex(sqInt methodObj, sqInt primIndex))(void) ;
 void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) ;
+sqInt getCheckAllocFiller(void);
 usqLong getNextWakeupUsecs(void);
 sqInt * getStackPointer(void);
 sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader);
@@ -253,6 +254,7 @@
 /*** Global Variables ***/
 char * breakSelector;
 sqInt breakSelectorLength ;
+sqInt checkAllocFiller;
 sqInt checkForLeaks;
 sqInt deferDisplayUpdates;
 sqInt desiredCogCodeSize;

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-06-16 20:42:34 UTC (rev 3006)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
    from
-	CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9
+	CoInterpreter VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -97,9 +97,6 @@
 #define AllButMarkBitAndTypeMask 0x7FFFFFFC
 #define AllButRootBit 0xBFFFFFFFUL
 #define AllButTypeMask 0xFFFFFFFCUL
-#if !defined(AllocationCheckFiller)
-# define AllocationCheckFiller 182275669
-#endif
 #define AltLongStoreBytecode 234
 #define AtCacheFixedFields 4
 #define AtCacheFmt 3
@@ -132,6 +129,7 @@
 #define CacheProbeMax 3
 #define CharacterTable 24
 #define CharacterValueIndex 0
+#define CheckAllocationFillerAfterPrimCall 16
 #define ClassAlien 52
 #define ClassArray 7
 #define ClassArrayCompactIndex 3
@@ -289,6 +287,7 @@
 #define PrimErrNotFound 11
 #define PrimErrTableIndex 51
 #define PrimErrUnsupported 7
+#define PrimErrWritePastObject 17
 #define PrimitiveExternalCallIndex 117
 #define PrimNoErr 0
 #define PrimTraceLogSize 256
@@ -624,6 +623,7 @@
 static sqInt fwdBlockValid(sqInt addr) NoDbgRegParms;
 static sqInt fwdTableInit(sqInt blkSize) NoDbgRegParms;
 static sqInt fwdTableSize(sqInt blkSize) NoDbgRegParms;
+sqInt getCheckAllocFiller(void);
 sqInt getCurrentBytecode(void);
 sqInt getFullScreenFlag(void);
 sqInt getInterruptKeycode(void);
@@ -1175,7 +1175,7 @@
 static void rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)(void)) NoDbgRegParms;
 static sqInt roomToPushNArgs(sqInt n) NoDbgRegParms;
 static void runLeakCheckerForFullGC(sqInt fullGCFlag) NoDbgRegParms;
-static sqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
+static usqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
 static sqInt safePrintStringOf(sqInt oop) NoDbgRegParms;
 usqInt scavengeThresholdAddress(void);
 EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext);
@@ -1322,9 +1322,9 @@
 _iss sqInt rootTableCount;
 _iss usqInt memoryLimit;
 _iss usqInt endOfMemory;
+_iss usqInt scavengeThreshold;
 _iss unsigned char primTraceLogIndex;
 _iss StackPage * mostRecentlyUsedPage;
-_iss usqInt scavengeThreshold;
 _iss sqInt numStackPages;
 _iss sqInt needGCFlag;
 _iss sqInt jmpDepth;
@@ -1467,6 +1467,7 @@
 static void (*primitiveFunctionPointer)();
 sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */;
 jmp_buf reenterInterpreter; /* private export */;
+sqInt checkAllocFiller;
 sqInt inIOProcessEvents;
 sqInt checkForLeaks;
 sqInt desiredEdenBytes;
@@ -2063,12 +2064,13 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.746";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.775";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
 
 /*** Macros ***/
+#define checkAllocFiller() GIV(checkAllocFiller)
 #define classFieldOffset() (0 - BaseHeaderSize)
 #define compactClassFieldLSB() 12
 #define compactClassFieldWidth() 5
@@ -5346,6 +5348,13 @@
 					GIV(primFailCode) = 0;
 					dispatchFunctionPointer(primitiveFunctionPointer);
 					
+					/* begin maybeFailForLastObjectOverwrite */
+					if (checkAllocFiller) {
+						if (((freeStart()) < GIV(scavengeThreshold))
+						 && ((longAt(freeStart())) != (freeStart()))) {
+							GIV(primFailCode) = PrimErrWritePastObject;
+						}
+					}
 					if (FailImbalancedPrimitives
 					 && ((!GIV(primFailCode))
 					 && ((GIV(framePointer) == savedFramePointer)
@@ -13625,10 +13634,11 @@
     sqInt fillPointer;
     sqInt header;
     sqInt header1;
-    usqInt i;
-    usqInt i1;
     sqInt obj;
     sqInt obj1;
+    usqInt p;
+    usqInt p1;
+    usqInt start;
     sqInt sz;
     sqInt sz1;
 
@@ -13699,10 +13709,12 @@
 		/* didn't fit.  refill with allocation check pattern and answer count. */
 
 		/* begin maybeFillWithAllocationCheckFillerFrom:to: */
-		for (i = GIV(freeStart); i <= fillPointer; i += BytesPerWord) {
-			longAtput(i, i);
+		start = GIV(freeStart);
+		if (checkAllocFiller()) {
+			for (p = start; p <= fillPointer; p += BytesPerWord) {
+				longAtput(p, p);
+			}
 		}
-
 		return ((count << 1) | 1);
 	}
 	byteSize = fillPointer - (((sqInt)(firstFixedField(container))));
@@ -13711,10 +13723,11 @@
 	longAtput(container - (BytesPerWord * 2), ((byteSize + BytesPerWord) & LongSizeMask) | ((((longAt(container - (BytesPerWord * 2))) | LongSizeMask) - LongSizeMask)));
 	if (fillPointer < afterPreAllocatedObject) {
 		/* begin maybeFillWithAllocationCheckFillerFrom:to: */
-		for (i1 = fillPointer; i1 <= afterPreAllocatedObject; i1 += BytesPerWord) {
-			longAtput(i1, i1);
+		if (checkAllocFiller()) {
+			for (p1 = fillPointer; p1 <= afterPreAllocatedObject; p1 += BytesPerWord) {
+				longAtput(p1, p1);
+			}
 		}
-
 	}
 	GIV(freeStart) = fillPointer;
 	return container;
@@ -18132,10 +18145,6 @@
 	newChunk1 = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + bytes;
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk1)) != (newChunk1))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newChunk = oopForPointer(newChunk1);
 		goto l1;
@@ -19532,10 +19541,6 @@
 	newChunk = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (byteSize + ((hdrSize - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk)) != (newChunk))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk);
 		goto l1;
@@ -19649,10 +19654,6 @@
 	newChunk = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (byteSize + ((hdrSize - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk)) != (newChunk))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk);
 		goto l1;
@@ -19820,10 +19821,6 @@
 	newChunk = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (byteSize + ((hdrSize - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk)) != (newChunk))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk);
 		goto l1;
@@ -19901,10 +19898,6 @@
 	newChunk = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (sizeInBytes + ((1 - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk)) != (newChunk))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk);
 		goto l1;
@@ -19978,10 +19971,6 @@
 	newChunk = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (sizeInBytes + ((1 - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk)) != (newChunk))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk);
 		goto l1;
@@ -20055,10 +20044,6 @@
 	newChunk = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (sizeInBytes + ((hdrSize - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk)) != (newChunk))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk);
 		goto l1;
@@ -23056,7 +23041,13 @@
 	return (fwdLast - fwdFirst) / blkSize;
 }
 
+sqInt
+getCheckAllocFiller(void)
+{
+	return checkAllocFiller;
+}
 
+
 /*	currentBytecode will be private to the main dispatch loop in the generated
 	code. This method allows the currentBytecode to be retrieved from global
 	variables. Override to answer -1 if we're not in an interpreter frame. */
@@ -23998,17 +23989,15 @@
     sqInt header1;
     sqInt header2;
     sqInt header3;
-    sqInt header4;
     usqInt lastWord;
     sqInt newFreeChunk;
     sqInt newOop;
-    sqInt next;
+    usqInt next;
     sqInt oop;
     sqInt realHeader;
     sqInt sz;
     sqInt sz1;
     sqInt sz2;
-    sqInt sz3;
     sqInt target;
     usqInt w;
 
@@ -24019,21 +24008,7 @@
 		/* begin objectAfterWhileForwarding: */
 		header2 = longAt(oop);
 		if ((header2 & MarkBit) == 0) {
-			/* begin objectAfter: */
-			if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
-				error("no objects after the end of memory");
-			}
-			if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
-				sz2 = (longAt(oop)) & AllButTypeMask;
-			}
-			else {
-				/* begin sizeBitsOf: */
-				header3 = longAt(oop);
-				sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
-					? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
-					: header3 & SizeMask);
-			}
-			next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
+			next = ((sqInt) (objectAfter(oop)));
 			goto l1;
 		}
 		fwdBlock1 = (header2 & AllButMarkBitAndTypeMask) << 1;
@@ -24048,7 +24023,7 @@
 		else {
 			sz1 = realHeader & SizeMask;
 		}
-		next = (oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask]);
+		next = ((sqInt) ((oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask])));
 	l1:	/* end objectAfterWhileForwarding: */;
 		if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
 
@@ -24102,18 +24077,18 @@
 	}
 	/* begin safeObjectAfter: */
 	if (((longAt(newFreeChunk)) & TypeMask) == HeaderTypeFree) {
-		sz3 = (longAt(newFreeChunk)) & AllButTypeMask;
+		sz2 = (longAt(newFreeChunk)) & AllButTypeMask;
 	}
 	else {
 		/* begin sizeBitsOf: */
-		header4 = longAt(newFreeChunk);
-		sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
+		header3 = longAt(newFreeChunk);
+		sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
 			? (longAt(newFreeChunk - (BytesPerWord * 2))) & LongSizeMask
-			: header4 & SizeMask);
+			: header3 & SizeMask);
 	}
-	next = ((newFreeChunk + sz3) >= GIV(freeStart)
+	next = ((newFreeChunk + sz2) >= GIV(freeStart)
 		? GIV(freeStart)
-		: (newFreeChunk + sz3) + (headerTypeBytes[(longAt(newFreeChunk + sz3)) & TypeMask]));
+		: (newFreeChunk + sz2) + (headerTypeBytes[(longAt(newFreeChunk + sz2)) & TypeMask]));
 	assert((next == GIV(freeStart))
 	 || (next == (oopFromChunk(GIV(compEnd)))));
 	if (next == GIV(freeStart)) {
@@ -24298,9 +24273,11 @@
 static void
 initializeMemoryFirstFree(sqInt firstFree)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    usqInt end;
     sqInt fwdBlockBytes;
-    usqInt i;
     sqInt newEndOfMemory;
+    usqInt p;
+    usqInt start;
     sqInt totalReserve;
 
 	fwdBlockBytes = GIV(totalObjectCount) & ((WordMask - BytesPerWord) + 1);
@@ -24328,10 +24305,13 @@
 	GIV(freeStart) = firstFree;
 	GIV(scavengeThreshold) = (((GIV(freeStart) + GIV(edenBytes)) < GIV(reserveStart)) ? (GIV(freeStart) + GIV(edenBytes)) : GIV(reserveStart));
 	/* begin maybeFillWithAllocationCheckFillerFrom:to: */
-	for (i = GIV(freeStart); i <= GIV(scavengeThreshold); i += BytesPerWord) {
-		longAtput(i, i);
+	start = GIV(freeStart);
+	end = GIV(scavengeThreshold);
+	if (checkAllocFiller()) {
+		for (p = start; p <= end; p += BytesPerWord) {
+			longAtput(p, p);
+		}
 	}
-
 	assert(oopisLessThan(GIV(freeStart), GIV(reserveStart)));
 	
 	assert(oopisLessThan(GIV(endOfMemory), GIV(memoryLimit)));
@@ -24643,10 +24623,6 @@
 	newChunk1 = GIV(freeStart);
 	newFreeStart = GIV(freeStart) + (byteSize + ((hdrSize - 1) * BytesPerWord));
 	if (newFreeStart < GIV(scavengeThreshold)) {
-		if ((AllocationCheckFiller != 0)
-		 && ((longAt(newChunk1)) != (newChunk1))) {
-			error("last object overwritten");
-		}
 		GIV(freeStart) = newFreeStart;
 		newObj = oopForPointer(newChunk1);
 		goto l2;
@@ -24898,6 +24874,13 @@
 			GIV(primFailCode) = 0;
 			dispatchFunctionPointer(primitiveFunctionPointer);
 			
+			/* begin maybeFailForLastObjectOverwrite */
+			if (checkAllocFiller) {
+				if (((freeStart()) < GIV(scavengeThreshold))
+				 && ((longAt(freeStart())) != (freeStart()))) {
+					GIV(primFailCode) = PrimErrWritePastObject;
+				}
+			}
 			if (FailImbalancedPrimitives
 			 && ((!GIV(primFailCode))
 			 && ((GIV(framePointer) == savedFramePointer)
@@ -34929,6 +34912,13 @@
 	}
 	/* begin callExternalPrimitive: */
 	dispatchFunctionPointer(addr);
+	/* begin maybeFailForLastObjectOverwrite */
+	if (checkAllocFiller) {
+		if (((freeStart()) < GIV(scavengeThreshold))
+		 && ((longAt(freeStart())) != (freeStart()))) {
+			GIV(primFailCode) = PrimErrWritePastObject;
+		}
+	}
 	/* begin popRemappableOop */
 	oop4 = GIV(remapBuffer)[GIV(remapBufferCount)];
 	GIV(remapBufferCount) -= 1;
@@ -35089,6 +35079,13 @@
 	GIV(primFailCode) = 0;
 	dispatchFunctionPointer(primitiveFunctionPointer);
 	
+	/* begin maybeFailForLastObjectOverwrite */
+	if (checkAllocFiller) {
+		if (((freeStart()) < GIV(scavengeThreshold))
+		 && ((longAt(freeStart())) != (freeStart()))) {
+			GIV(primFailCode) = PrimErrWritePastObject;
+		}
+	}
 	if (FailImbalancedPrimitives
 	 && ((!GIV(primFailCode))
 	 && ((GIV(framePointer) == savedFramePointer)
@@ -35734,6 +35731,13 @@
 			rewriteMethodCacheEntryForExternalPrimitiveToFunction(addr);
 			/* begin callExternalPrimitive: */
 			dispatchFunctionPointer(addr);
+			/* begin maybeFailForLastObjectOverwrite */
+			if (checkAllocFiller) {
+				if (((freeStart()) < GIV(scavengeThreshold))
+				 && ((longAt(freeStart())) != (freeStart()))) {
+					GIV(primFailCode) = PrimErrWritePastObject;
+				}
+			}
 			return;
 		}
 		(GIV(primFailCode) = PrimErrNamedInternal);
@@ -35819,6 +35823,13 @@
 		rewriteMethodCacheEntryForExternalPrimitiveToFunction(addr);
 		/* begin callExternalPrimitive: */
 		dispatchFunctionPointer(addr);
+		/* begin maybeFailForLastObjectOverwrite */
+		if (checkAllocFiller) {
+			if (((freeStart()) < GIV(scavengeThreshold))
+			 && ((longAt(freeStart())) != (freeStart()))) {
+				GIV(primFailCode) = PrimErrWritePastObject;
+			}
+		}
 	}
 	else {
 
@@ -41514,6 +41525,9 @@
 		/* For callbacks */
 
 		baseFlags = baseFlags | ((PrimCallNeedsNewMethod + PrimCallNeedsPrimitiveFunction) + PrimCallMayCallBack);
+		if (checkAllocFiller) {
+			baseFlags = baseFlags | CheckAllocationFillerAfterPrimCall;
+		}
 	}
 	return baseFlags;
 }
@@ -50019,6 +50033,7 @@
 	GIV(jmpDepth) = 0;
 	GIV(longRunningPrimitiveStartUsecs) = (GIV(longRunningPrimitiveStopUsecs) = 0);
 	GIV(maxExtSemTabSizeSet) = 0;
+	checkAllocFiller = 0;
 	GIV(statForceInterruptCheck) = 0;
 	GIV(statStackOverflow) = 0;
 	GIV(statCheckForEvents) = 0;
@@ -50743,7 +50758,7 @@
 	given object or free chunk in memory. Return freeStart when
 	enumeration is complete. This is for assertion checking only. */
 
-static sqInt
+static usqInt
 safeObjectAfter(sqInt oop)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt header;
@@ -51471,11 +51486,12 @@
     sqInt classFormat;
     sqInt deltaBytes;
     sqInt desiredLength;
+    usqInt end;
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
-    usqInt i;
     sqInt indexableFields;
+    usqInt p;
     sqInt sz;
     sqInt totalLength;
 
@@ -51530,10 +51546,12 @@
 		/* Shortening the last object.  Need to reduce freeStart. */
 
 		/* begin maybeFillWithAllocationCheckFillerFrom:to: */
-		for (i = ((obj + BaseHeaderSize) + (desiredLength * BytesPerWord)); i <= GIV(freeStart); i += BytesPerWord) {
-			longAtput(i, i);
+		end = GIV(freeStart);
+		if (checkAllocFiller()) {
+			for (p = ((obj + BaseHeaderSize) + (desiredLength * BytesPerWord)); p <= end; p += BytesPerWord) {
+				longAtput(p, p);
+			}
 		}
-
 		GIV(freeStart) = (obj + BaseHeaderSize) + (desiredLength * BytesPerWord);
 	}
 	else {
@@ -52408,6 +52426,13 @@
 	GIV(primFailCode) = 0;
 	dispatchFunctionPointer(primitiveFunctionPointer);
 	
+	/* begin maybeFailForLastObjectOverwrite */
+	if (checkAllocFiller) {
+		if (((freeStart()) < GIV(scavengeThreshold))
+		 && ((longAt(freeStart())) != (freeStart()))) {
+			GIV(primFailCode) = PrimErrWritePastObject;
+		}
+	}
 	if (FailImbalancedPrimitives
 	 && ((!GIV(primFailCode))
 	 && ((GIV(framePointer) == savedFramePointer)

Modified: branches/Cog/nscogsrc/vm/interp.h
===================================================================
--- branches/Cog/nscogsrc/vm/interp.h	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/nscogsrc/vm/interp.h	2014-06-16 20:42:34 UTC (rev 3006)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.759 uuid: 988e84e2-8576-4edb-984a-98c755c8e2e8
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
  */
 
 #define VM_PROXY_MAJOR 1
@@ -27,6 +27,7 @@
 #define PrimErrObjectMayMove 14
 #define PrimErrLimitExceeded 15
 #define PrimErrObjectIsPinned 16
+#define PrimErrWritePastObject 17
 
 #define NewspeakVM 1
 #define MULTIPLEBYTECODESETS 1

Modified: branches/Cog/nscogsrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nscogsrc/vm/vmCallback.h	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/nscogsrc/vm/vmCallback.h	2014-06-16 20:42:34 UTC (rev 3006)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
  */
 
 #define VM_CALLBACK_INC 1

Modified: branches/Cog/nsspursrc/vm/cogit.c
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.c	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/nsspursrc/vm/cogit.c	2014-06-16 20:42:34 UTC (rev 3006)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422
+	CCodeGenerator VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422
+	StackToRegisterMappingCogit VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -305,6 +305,7 @@
 #define PrimCallMayCallBack 4
 #define PrimCallNeedsNewMethod 1
 #define PrimCallNeedsPrimitiveFunction 2
+#define PrimErrWritePastObject 17
 #define PushCw 71
 #define PushR 70
 #define ReceiverIndex 5
@@ -957,6 +958,7 @@
 static void marshallImplicitReceiverSendArguments(sqInt numArgs) NoDbgRegParms;
 static void marshallSendArguments(sqInt numArgs) NoDbgRegParms;
 usqInt maxCogMethodAddress(void);
+static void maybeCompileAllocFillerCheck(void);
 static sqInt maybeFreeCogMethodDoesntLookKosher(CogMethod *cogMethod) NoDbgRegParms;
 static sqInt maybeGenerateCheckFeatures(void);
 static sqInt maybeGenerateICacheFlush(void);
@@ -4925,6 +4927,7 @@
 			/* begin Label */
 			continuePostSamplePrim = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
 		}
+		maybeCompileAllocFillerCheck();
 		/* begin MoveAw:R: */
 		address8 = instructionPointerAddress();
 		genoperandoperand(MoveAwR, address8, ClassReg);
@@ -16423,6 +16426,7 @@
 		/* begin Label */
 		continuePostSample = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
 	}
+	maybeCompileAllocFillerCheck();
 	/* begin MoveAw:R: */
 	address5 = primFailCodeAddress();
 	genoperandoperand(MoveAwR, address5, TempReg);
@@ -20324,6 +20328,40 @@
 }
 
 
+/*	If allocCheckFiller is true, words in newSpace from freeStart to
+	scavengeThreshold are filled with their address, and after each call of a
+	plugin primitive, the VM checks
+	that freeStart points to a word containing the value of freeStart. This is
+	a simple
+	check for primitives overwriting the ends of an object. */
+
+static void
+maybeCompileAllocFillerCheck(void)
+{
+    sqInt address;
+    sqInt address1;
+    AbstractInstruction *jmpOk;
+
+	if (getCheckAllocFiller()) {
+		/* begin MoveAw:R: */
+		address = freeStartAddress();
+		genoperandoperand(MoveAwR, address, ClassReg);
+		/* begin MoveMw:r:R: */
+		genoperandoperandoperand(MoveMwrR, 0, ClassReg, TempReg);
+		/* begin CmpR:R: */
+		genoperandoperand(CmpRR, ClassReg, TempReg);
+		/* begin JumpZero: */
+		jmpOk = genoperand(JumpZero, ((sqInt)0));
+		/* begin MoveCq:R: */
+		genoperandoperand(MoveCqR, PrimErrWritePastObject, TempReg);
+		/* begin MoveR:Aw: */
+		address1 = primFailCodeAddress();
+		genoperandoperand(MoveRAw, TempReg, address1);
+		jmpTarget(jmpOk, gLabel());
+	}
+}
+
+
 /*	Check that the header fields are consistent with the type.
 	Answer 0 if it is ok, otherwise answer a code for the error. */
 

Modified: branches/Cog/nsspursrc/vm/cogit.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.h	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/nsspursrc/vm/cogit.h	2014-06-16 20:42:34 UTC (rev 3006)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422
+	CCodeGenerator VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
  */
 
 

Modified: branches/Cog/nsspursrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogmethod.h	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/nsspursrc/vm/cogmethod.h	2014-06-16 20:42:34 UTC (rev 3006)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422
+	CCodeGenerator VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
  */
 
 typedef struct {

Modified: branches/Cog/nsspursrc/vm/cointerp.c
===================================================================
--- branches/Cog/nsspursrc/vm/cointerp.c	2014-06-16 20:39:22 UTC (rev 3005)
+++ branches/Cog/nsspursrc/vm/cointerp.c	2014-06-16 20:42:34 UTC (rev 3006)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
    from
-	CoInterpreter VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422
+	CoInterpreter VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.774 uuid: 665ef9a5-4139-4f97-85c0-0d0df9eea422 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.775 uuid: dd27f525-f775-49fc-8bf0-2463d78bfb97 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -142,7 +142,7 @@
 #define CacheProbeMax 3
 #define CharacterTable null
 #define CharacterValueIndex 0
-#define CheckObjectOverwrite 1
+#define CheckAllocationFillerAfterPrimCall 16
 #define ClassAlien 52
 #define ClassArray 7
 #define ClassArrayCompactIndex 51
@@ -295,6 +295,7 @@
 #define PrimErrObjectIsPinned 16
 #define PrimErrTableIndex 51
 #define PrimErrUnsupported 7
+#define PrimErrWritePastObject 17
 #define PrimitiveExternalCallIndex 117
 #define PrimNoErr 0
 #define PrimTraceLogSize 256
@@ -690,6 +691,7 @@
 usqLong fullGC(void);
 void (*functionPointerForCompiledMethodprimitiveIndex(sqInt methodObj, sqInt primIndex))(void) ;
 void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) ;
+sqInt getCheckAllocFiller(void);
 sqInt getCurrentBytecode(void);
 sqInt getFullScreenFlag(void);
 static float getHeapGrowthToSizeGCRatio(void);
@@ -936,7 +938,8 @@
 static usqInt numSlotsOfAny(sqInt objOop) NoDbgRegParms;
 usqInt numSlotsOf(sqInt objOop);
 static sqInt numStkPages(void);
-sqInt numStrongSlotsOfephemeronInactiveIf(sqInt objOop, int (*criterion)(sqInt key));
+sqInt numStrongSlotsOfWeakling(sqInt objOop);
+static sqInt numStrongSlotsOfephemeronInactiveIf(sqInt objOop, int (*criterion)(sqInt key)) NoDbgRegParms;
 sqInt numTagBits(void);
 static sqInt objCouldBeClassObj(sqInt objOop) NoDbgRegParms;
 sqInt objectAfter(sqInt objOop);
@@ -1482,9 +1485,9 @@
 _iss sqInt numSegments;
 _iss sqInt traceLogIndex;
 _iss usqInt pastSpaceStart;
+_iss usqInt scavengeThreshold;
 _iss char * stackLimit;
 _iss sqInt * freeLists;
-_iss usqInt scavengeThreshold;
 _iss usqInt freeListsMask;
 _iss sqInt rememberedSetSize;
 _iss SpurContiguousObjStack unscannedEphemerons;
@@ -1645,6 +1648,7 @@
 static void (*primitiveFunctionPointer)();
 sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */;
 jmp_buf reenterInterpreter; /* private export */;
+sqInt checkAllocFiller;
 sqInt inIOProcessEvents;
 sqInt checkForLeaks;
 sqInt desiredEdenBytes;
@@ -2238,12 +2242,13 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.774";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.775";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
 
 /*** Macros ***/
+#define checkAllocFiller() GIV(checkAllocFiller)
 #define compilationBreakpoint(sel, len) do { \
 	if ((len) == breakSelectorLength \
 	 && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, breakSelectorLength)) { \
@@ -6229,6 +6234,13 @@
 						GIV(primFailCode) = 0;
 						dispatchFunctionPointer(primitiveFunctionPointer);
 					}
+					/* begin maybeFailForLastObjectOverwrite */
+					if (checkAllocFiller) {
+						if (((freeStart()) < GIV(scavengeThreshold))
+						 && ((longAt(freeStart())) != (freeStart()))) {
+							GIV(primFailCode) = PrimErrWritePastObject;
+						}
+					}
 					if (FailImbalancedPrimitives
 					 && ((!GIV(primFailCode))
 					 && ((GIV(framePointer) == savedFramePointer)
@@ -24223,13 +24235,14 @@
 	GIV(pastSpaceStart) = ((sqInt) oldStart);
 	assert(oopisGreaterThanOrEqualToandLessThanOrEqualTo(GIV(pastSpaceStart), ((pastSpace()).start), ((pastSpace()).limit)));
 	GIV(freeStart) = ((eden()).start);
-	/* begin initSpaceForAllocationCheck: */
+	/* begin initSpaceForAllocationCheck:limit: */
 	aNewSpace = (&(eden()));
 	if (!(GIV(memory) == null)) {
-		for (p = ((aNewSpace->start)); p < ((aNewSpace->limit)); p += (wordSize())) {
-			longAtput(p, p);
+		if (checkAllocFiller()) {
+			for (p = ((aNewSpace->start)); p < GIV(scavengeThreshold); p += (wordSize())) {
+				longAtput(p, p);
+			}
 		}
-
 	}
 	GIV(scavengeInProgress) = 0;
 }
@@ -29305,7 +29318,13 @@
 		: primitiveTable[primIdx]);
 }
 
+sqInt
+getCheckAllocFiller(void)
+{
+	return checkAllocFiller;
+}
 
+
 /*	currentBytecode will be private to the main dispatch loop in the generated
 	code. This method allows the currentBytecode to be retrieved from global
 	variables. Override to answer -1 if we're not in an interpreter frame. */
@@ -30877,13 +30896,14 @@
 	GIV(scavengeThreshold) = ((((eden()).limit)) - (((sqInt) (((GIV(eden).limit)) - ((GIV(eden).start))) >> 6))) - (interpreterAllocationReserveBytes());
 	GIV(newSpaceStart) = (((((pastSpace()).start)) < (((futureSpace()).start))) ? (((pastSpace()).start)) : (((futureSpace()).start)));
 	assert(GIV(newSpaceStart) < (((eden()).start)));
-	/* begin initSpaceForAllocationCheck: */
+	/* begin initSpaceForAllocationCheck:limit: */
 	aNewSpace = (&(eden()));
 	if (!(GIV(memory) == null)) {
-		for (p = ((aNewSpace->start)); p < ((aNewSpace->limit)); p += (wordSize())) {
-			longAtput(p, p);
+		if (checkAllocFiller()) {
+			for (p = ((aNewSpace->start)); p < GIV(scavengeThreshold); p += (wordSize())) {
+				longAtput(p, p);
+			}
 		}
-
 	}
 
 	/* begin initializeOldSpaceFirstFree: */
@@ -31360,6 +31380,13 @@
 				GIV(primFailCode) = 0;

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list