[Vm-dev] [commit][3222] CogVM source as per VMMaker.oscog-eem.1014

commits at squeakvm.org commits at squeakvm.org
Fri Jan 9 20:30:37 UTC 2015


Revision: 3222
Author:   eliot
Date:     2015-01-09 12:30:33 -0800 (Fri, 09 Jan 2015)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.1014

Make the pin primitives Spur-only.

General:
Bow to the inevitable and add eassert: for those
expensive asserts you just can't let go of.

Spur:
Make sure the caller (& saved) context(s) in base frames stack page are
followed post-become in followForwardingPointersInStackZone:.

Add an assert to Spur's shouldRemapObj: to verify that new space references
are only visited once in a scavenge.

Add asserts to check that contexts are not
forwarded when marrying stable contexts.

General:
Never inline mapStackPages, for debugging.

Add an assert to returnToExecutive:postContextSwitch: to ensure the
instructionPointer is valid when checking for being at a send return pc.

Spur:
Fix bad bug introduced in become changes in  VMMaker.oscog-eem.841 through 844.
The class table contains puns, e.g. using Array and WeakArray.  These class
index puns must not mislead the allInstances primitive into concluding that
the class in question is at multiple indices and wrongly purge it.

Modified Paths:
--------------
    branches/Cog/nscogsrc/vm/cointerp.c
    branches/Cog/nscogsrc/vm/cointerp.h
    branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
    branches/Cog/nsspursrc/vm/cointerp.c
    branches/Cog/nsspursrc/vm/cointerp.h
    branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
    branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c
    branches/Cog/nsspurstacksrc/vm/interp.c
    branches/Cog/platforms/Cross/vm/sqAssert.h
    branches/Cog/sistasrc/vm/cointerp.c
    branches/Cog/sistasrc/vm/cointerp.h
    branches/Cog/sistasrc/vm/gcc3x-cointerp.c
    branches/Cog/spursistasrc/vm/cointerp.c
    branches/Cog/spursistasrc/vm/cointerp.h
    branches/Cog/spursistasrc/vm/gcc3x-cointerp.c
    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
    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/stacksrc/vm/gcc3x-interp.c
    branches/Cog/stacksrc/vm/interp.c

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

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2015-01-08 00:51:28 UTC (rev 3221)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2015-01-09 20:30:33 UTC (rev 3222)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1008 uuid: e5b26122-f27e-498b-bc8a-70f5f0fc3e1a
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d
    from
-	CoInterpreter VMMaker.oscog-eem.1008 uuid: e5b26122-f27e-498b-bc8a-70f5f0fc3e1a
+	CoInterpreter VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1008 uuid: e5b26122-f27e-498b-bc8a-70f5f0fc3e1a " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -475,7 +475,7 @@
 sqInt lookupreceiver(sqInt selector, sqInt rcvr);
 static StackPage * makeBaseFrameFor(sqInt aContext) NoDbgRegParms;
 static void mapPrimTraceLog(void);
-static void mapStackPages(void);
+static void mapStackPages(void) NeverInline;
 static void mapTraceLog(void);
 void markActiveMethodsAndReferents(void);
 static void markAndTracePrimTraceLog(void);
@@ -689,7 +689,6 @@
 EXPORT(sqInt) primitiveInterruptChecksPerMSec(void);
 static void primitiveInterruptSemaphore(void);
 static void primitiveInvokeObjectAsMethod(void);
-static void primitiveIsPinned(void);
 EXPORT(sqInt) primitiveIsRoot(void);
 EXPORT(sqInt) primitiveIsWindowObscured(void);
 EXPORT(sqInt) primitiveIsYoung(void);
@@ -729,7 +728,6 @@
 EXPORT(sqInt) primitivePathToUsing(void);
 static void primitivePerformInSuperclass(void);
 static void primitivePerformWithArgs(void);
-static void primitivePin(void);
 EXPORT(sqInt) primitiveProfilePrimitive(void);
 EXPORT(sqInt) primitiveProfileSample(void);
 EXPORT(sqInt) primitiveProfileStart(void);
@@ -1311,6 +1309,7 @@
 EXPORT(sqInt) primitiveLongRunningPrimitive(void);
 static void primitiveObjectPointsTo(void);
 static void primitivePerform(void);
+static void primitivePin(void);
 EXPORT(void) primitiveSetGCSemaphore(void);
 static void primitiveSignalAtMilliseconds(void);
 static void primitiveSignalAtUTCMicroseconds(void);
@@ -1342,8 +1341,8 @@
 _iss sqInt bytecodeSetSelector;
 _iss usqInt freeStart;
 _iss sqInt argumentCount;
-_iss sqInt nilObj;
 _iss usqInt instructionPointer;
+_iss sqInt nilObj;
 _iss usqInt newMethod;
 _iss sqInt messageSelector;
 _iss usqInt youngStart;
@@ -1707,7 +1706,7 @@
 	/* 180 */ (void (*)(void))0,
 	/* 181 */ (void (*)(void))0,
 	/* 182 */ (void (*)(void))0,
-	/* 183 */ primitiveIsPinned,
+	/* 183 */ (void (*)(void))0,
 	/* 184 */ primitivePin,
 	/* 185 */ primitiveExitCriticalSection,
 	/* 186 */ primitiveEnterCriticalSection,
@@ -2101,7 +2100,8 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1008";
+char expensiveAsserts = 0;
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1014";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -7955,7 +7955,7 @@
 			/* bytecodePrimBitShift */
 			{
 				sqInt integerArgument;
-				usqInt integerReceiver;
+				sqLong integerReceiver;
 				sqInt shifted;
 				char *sp;
 
@@ -8015,7 +8015,7 @@
 							null;
 							goto l108;
 						}
-						shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
+						shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
 					}
 					shifted = positive32BitIntegerFor(shifted);
 					/* begin pop:thenPush: */
@@ -10909,7 +10909,7 @@
 			/* bytecodePrimBitShift */
 			{
 				sqInt integerArgument;
-				usqInt integerReceiver;
+				sqLong integerReceiver;
 				sqInt shifted;
 				char *sp;
 
@@ -10969,7 +10969,7 @@
 							null;
 							goto l243;
 						}
-						shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
+						shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
 					}
 					shifted = positive32BitIntegerFor(shifted);
 					/* begin pop:thenPush: */
@@ -16312,6 +16312,12 @@
 				theIPPtr = ((usqInt)(theFP + FoxCallerSavedIP));
 				theFP = callerFP;
 			}
+			theSP = ((thePage->baseAddress)) - BytesPerWord;
+			while (theSP <= ((thePage->baseAddress))) {
+				oop = longAt(theSP);
+				
+				theSP += BytesPerWord;
+			}
 		}
 	}
 }
@@ -17158,6 +17164,7 @@
 
 	/* theIP must be typed as signed because it is assigned ceCannotResumePC and so maybe implicitly typed as unsigned. */
 
+	assert(isContext(aContext));
 	assert(isSingleContext(aContext));
 	assert(goodContextSize(aContext));
 	theIP = longAt((aContext + BaseHeaderSize) + (InstructionPointerIndex << (shiftForWord())));
@@ -19482,6 +19489,8 @@
 		if (switchedContext) {
 			/* begin mframeCogMethod: */
 			cogMethod = ((CogBlockMethod *) ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodMask));
+			assert((GIV(instructionPointer) > (minCogMethodAddress()))
+			 && (GIV(instructionPointer) < (maxCogMethodAddress())));
 			if ((GIV(instructionPointer) != ((((sqInt)cogMethod)) + ((cogMethod->stackCheckOffset))))
 			 && (isSendReturnPC(GIV(instructionPointer)))) {
 				assert(addressCouldBeOop(stackTop()));
@@ -24410,7 +24419,7 @@
 primitiveBitShift(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt integerArgument;
-    usqInt integerReceiver;
+    sqLong integerReceiver;
     sqInt shifted;
     char *sp;
 
@@ -24457,7 +24466,7 @@
 				}
 				return;
 			}
-			shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
+			shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
 		}
 		shifted = positive32BitIntegerFor(shifted);
 		/* begin pop:thenPush: */
@@ -29009,31 +29018,6 @@
 }
 
 
-/*	Answer if the receiver is pinned, i.e. immobile. */
-
-static void
-primitiveIsPinned(void)
-{   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt obj;
-    char *sp;
-    sqInt trueOrFalse;
-
-	obj = longAt(GIV(stackPointer));
-	if (((obj & 1))
-	 || (isForwarded(obj))) {
-		(GIV(primFailCode) = PrimErrBadReceiver);
-		return;
-	}
-	/* begin pop:thenPushBool: */
-	trueOrFalse = 0
-	 && (GIV(falseObj));
-	longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (trueOrFalse
-		? GIV(trueObj)
-		: GIV(falseObj)));
-	GIV(stackPointer) = sp;
-}
-
-
 /*	Primitive. Answer whether the argument to the primitive is a root for
 	young space
  */
@@ -30867,51 +30851,6 @@
 }
 
 
-/*	Pin or unpin the receiver, i.e. make it immobile or mobile, based on the
-	argument. Answer whether the object was already pinned. N.B. pinning does
-	*not* prevent
-	an object from being garbage collected. */
-
-static void
-primitivePin(void)
-{   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt boolean;
-    sqInt obj;
-    char *sp;
-    sqInt wasPinned;
-
-	(GIV(primFailCode) = PrimErrUnsupported);
-	return;
-
-	obj = longAt(GIV(stackPointer) + (1 * BytesPerWord));
-	if (((obj & 1))
-	 || ((isForwarded(obj))
-	 || ((((obj & 1) == 0)
-	 && (((((usqInt) (longAt(obj))) >> (compactClassFieldLSB())) & 0x1F) == ClassMethodContextCompactIndex))
-	 && ((((longAt((obj + BaseHeaderSize) + (SenderIndex << (shiftForWord())))) & 1))
-	 && (!(isWidowedContext(obj))))))) {
-		(GIV(primFailCode) = PrimErrBadReceiver);
-		return;
-	}
-	boolean = longAt(GIV(stackPointer));
-	if (!((boolean == GIV(falseObj))
-		 || (boolean == GIV(trueObj)))) {
-		(GIV(primFailCode) = PrimErrBadArgument);
-		return;
-	}
-	wasPinned = GIV(falseObj);
-	if (((boolean == GIV(trueObj))
- && (pinObject(obj))) == 0) {
-		(GIV(primFailCode) = PrimErrNoMemory);
-		return;
-	}
-
-	/* begin pop:thenPush: */
-	longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), wasPinned);
-	GIV(stackPointer) = sp;
-}
-
-
 /*	Primitive. Answer the last primitive method sampled by the profiler. */
 
 EXPORT(sqInt)
@@ -55725,6 +55664,55 @@
 }
 
 
+/*	Pin or unpin the receiver, i.e. make it immobile or mobile, based on the
+	argument. Answer whether the object was already pinned. N.B. pinning does
+	*not* prevent
+	an object from being garbage collected. */
+
+static void
+primitivePin(void)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt boolean;
+    sqInt obj;
+    char *sp;
+    sqInt wasPinned;
+
+	(GIV(primFailCode) = PrimErrUnsupported);
+	return;
+
+	obj = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+	if (((obj & 1))
+	 || (isForwarded(obj))) {
+		(GIV(primFailCode) = PrimErrBadReceiver);
+		return;
+	}
+	boolean = longAt(GIV(stackPointer));
+	if (!((boolean == GIV(falseObj))
+		 || (boolean == GIV(trueObj)))) {
+		(GIV(primFailCode) = PrimErrBadArgument);
+		return;
+	}
+	wasPinned = GIV(falseObj);
+	if (boolean == GIV(trueObj)) {
+		if ((((obj & 1) == 0)
+		 && (((((usqInt) (longAt(obj))) >> (compactClassFieldLSB())) & 0x1F) == ClassMethodContextCompactIndex))
+		 && ((((longAt((obj + BaseHeaderSize) + (SenderIndex << (shiftForWord())))) & 1))
+		 && (!(isWidowedContext(obj))))) {
+			(GIV(primFailCode) = PrimErrBadReceiver);
+			return;
+		}
+		if ((pinObject(obj)) == 0) {
+			(GIV(primFailCode) = PrimErrNoMemory);
+			return;
+		}
+	}
+
+	/* begin pop:thenPush: */
+	longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), wasPinned);
+	GIV(stackPointer) = sp;
+}
+
+
 /*	Primitive. Indicate the semaphore to be signalled for upon garbage
 	collection 
  */

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2015-01-08 00:51:28 UTC (rev 3221)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2015-01-09 20:30:33 UTC (rev 3222)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1008 uuid: e5b26122-f27e-498b-bc8a-70f5f0fc3e1a
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d
  */
 
 

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2015-01-08 00:51:28 UTC (rev 3221)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2015-01-09 20:30:33 UTC (rev 3222)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1008 uuid: e5b26122-f27e-498b-bc8a-70f5f0fc3e1a
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d
    from
-	CoInterpreter VMMaker.oscog-eem.1008 uuid: e5b26122-f27e-498b-bc8a-70f5f0fc3e1a
+	CoInterpreter VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1008 uuid: e5b26122-f27e-498b-bc8a-70f5f0fc3e1a " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -478,7 +478,7 @@
 sqInt lookupreceiver(sqInt selector, sqInt rcvr);
 static StackPage * makeBaseFrameFor(sqInt aContext) NoDbgRegParms;
 static void mapPrimTraceLog(void);
-static void mapStackPages(void);
+static void mapStackPages(void) NeverInline;
 static void mapTraceLog(void);
 void markActiveMethodsAndReferents(void);
 static void markAndTracePrimTraceLog(void);
@@ -692,7 +692,6 @@
 EXPORT(sqInt) primitiveInterruptChecksPerMSec(void);
 static void primitiveInterruptSemaphore(void);
 static void primitiveInvokeObjectAsMethod(void);
-static void primitiveIsPinned(void);
 EXPORT(sqInt) primitiveIsRoot(void);
 EXPORT(sqInt) primitiveIsWindowObscured(void);
 EXPORT(sqInt) primitiveIsYoung(void);
@@ -732,7 +731,6 @@
 EXPORT(sqInt) primitivePathToUsing(void);
 static void primitivePerformInSuperclass(void);
 static void primitivePerformWithArgs(void);
-static void primitivePin(void);
 EXPORT(sqInt) primitiveProfilePrimitive(void);
 EXPORT(sqInt) primitiveProfileSample(void);
 EXPORT(sqInt) primitiveProfileStart(void);
@@ -1314,6 +1312,7 @@
 EXPORT(sqInt) primitiveLongRunningPrimitive(void);
 static void primitiveObjectPointsTo(void);
 static void primitivePerform(void);
+static void primitivePin(void);
 EXPORT(void) primitiveSetGCSemaphore(void);
 static void primitiveSignalAtMilliseconds(void);
 static void primitiveSignalAtUTCMicroseconds(void);
@@ -1345,8 +1344,8 @@
 _iss sqInt bytecodeSetSelector;
 _iss usqInt freeStart;
 _iss sqInt argumentCount;
-_iss sqInt nilObj;
 _iss usqInt instructionPointer;
+_iss sqInt nilObj;
 _iss usqInt newMethod;
 _iss sqInt messageSelector;
 _iss usqInt youngStart;
@@ -1710,7 +1709,7 @@
 	/* 180 */ (void (*)(void))0,
 	/* 181 */ (void (*)(void))0,
 	/* 182 */ (void (*)(void))0,
-	/* 183 */ primitiveIsPinned,
+	/* 183 */ (void (*)(void))0,
 	/* 184 */ primitivePin,
 	/* 185 */ primitiveExitCriticalSection,
 	/* 186 */ primitiveEnterCriticalSection,
@@ -2104,7 +2103,8 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1008";
+char expensiveAsserts = 0;
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1014";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -7964,7 +7964,7 @@
 			/* bytecodePrimBitShift */
 			{
 				sqInt integerArgument;
-				usqInt integerReceiver;
+				sqLong integerReceiver;
 				sqInt shifted;
 				char *sp;
 
@@ -8024,7 +8024,7 @@
 							null;
 							goto l108;
 						}
-						shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
+						shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
 					}
 					shifted = positive32BitIntegerFor(shifted);
 					/* begin pop:thenPush: */
@@ -10918,7 +10918,7 @@
 			/* bytecodePrimBitShift */
 			{
 				sqInt integerArgument;
-				usqInt integerReceiver;
+				sqLong integerReceiver;
 				sqInt shifted;
 				char *sp;
 
@@ -10978,7 +10978,7 @@
 							null;
 							goto l243;
 						}
-						shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
+						shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
 					}
 					shifted = positive32BitIntegerFor(shifted);
 					/* begin pop:thenPush: */
@@ -16321,6 +16321,12 @@
 				theIPPtr = ((usqInt)(theFP + FoxCallerSavedIP));
 				theFP = callerFP;
 			}
+			theSP = ((thePage->baseAddress)) - BytesPerWord;
+			while (theSP <= ((thePage->baseAddress))) {
+				oop = longAt(theSP);
+				
+				theSP += BytesPerWord;
+			}
 		}
 	}
 }
@@ -17167,6 +17173,7 @@
 
 	/* theIP must be typed as signed because it is assigned ceCannotResumePC and so maybe implicitly typed as unsigned. */
 
+	assert(isContext(aContext));
 	assert(isSingleContext(aContext));
 	assert(goodContextSize(aContext));
 	theIP = longAt((aContext + BaseHeaderSize) + (InstructionPointerIndex << (shiftForWord())));
@@ -19491,6 +19498,8 @@
 		if (switchedContext) {
 			/* begin mframeCogMethod: */
 			cogMethod = ((CogBlockMethod *) ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodMask));
+			assert((GIV(instructionPointer) > (minCogMethodAddress()))
+			 && (GIV(instructionPointer) < (maxCogMethodAddress())));
 			if ((GIV(instructionPointer) != ((((sqInt)cogMethod)) + ((cogMethod->stackCheckOffset))))
 			 && (isSendReturnPC(GIV(instructionPointer)))) {
 				assert(addressCouldBeOop(stackTop()));
@@ -24419,7 +24428,7 @@
 primitiveBitShift(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt integerArgument;
-    usqInt integerReceiver;
+    sqLong integerReceiver;
     sqInt shifted;
     char *sp;
 
@@ -24466,7 +24475,7 @@
 				}
 				return;
 			}
-			shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
+			shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
 		}
 		shifted = positive32BitIntegerFor(shifted);
 		/* begin pop:thenPush: */
@@ -29018,31 +29027,6 @@
 }
 
 
-/*	Answer if the receiver is pinned, i.e. immobile. */
-
-static void
-primitiveIsPinned(void)
-{   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt obj;
-    char *sp;
-    sqInt trueOrFalse;
-
-	obj = longAt(GIV(stackPointer));
-	if (((obj & 1))
-	 || (isForwarded(obj))) {
-		(GIV(primFailCode) = PrimErrBadReceiver);
-		return;
-	}
-	/* begin pop:thenPushBool: */
-	trueOrFalse = 0
-	 && (GIV(falseObj));
-	longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (trueOrFalse
-		? GIV(trueObj)
-		: GIV(falseObj)));
-	GIV(stackPointer) = sp;
-}
-
-
 /*	Primitive. Answer whether the argument to the primitive is a root for
 	young space
  */
@@ -30876,51 +30860,6 @@
 }
 
 
-/*	Pin or unpin the receiver, i.e. make it immobile or mobile, based on the
-	argument. Answer whether the object was already pinned. N.B. pinning does
-	*not* prevent
-	an object from being garbage collected. */
-
-static void
-primitivePin(void)
-{   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt boolean;
-    sqInt obj;
-    char *sp;
-    sqInt wasPinned;
-
-	(GIV(primFailCode) = PrimErrUnsupported);
-	return;
-
-	obj = longAt(GIV(stackPointer) + (1 * BytesPerWord));
-	if (((obj & 1))
-	 || ((isForwarded(obj))
-	 || ((((obj & 1) == 0)
-	 && (((((usqInt) (longAt(obj))) >> (compactClassFieldLSB())) & 0x1F) == ClassMethodContextCompactIndex))
-	 && ((((longAt((obj + BaseHeaderSize) + (SenderIndex << (shiftForWord())))) & 1))
-	 && (!(isWidowedContext(obj))))))) {
-		(GIV(primFailCode) = PrimErrBadReceiver);
-		return;
-	}
-	boolean = longAt(GIV(stackPointer));
-	if (!((boolean == GIV(falseObj))
-		 || (boolean == GIV(trueObj)))) {
-		(GIV(primFailCode) = PrimErrBadArgument);
-		return;
-	}
-	wasPinned = GIV(falseObj);
-	if (((boolean == GIV(trueObj))
- && (pinObject(obj))) == 0) {
-		(GIV(primFailCode) = PrimErrNoMemory);
-		return;
-	}
-
-	/* begin pop:thenPush: */
-	longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), wasPinned);
-	GIV(stackPointer) = sp;
-}
-
-
 /*	Primitive. Answer the last primitive method sampled by the profiler. */
 
 EXPORT(sqInt)
@@ -55734,6 +55673,55 @@
 }
 
 
+/*	Pin or unpin the receiver, i.e. make it immobile or mobile, based on the
+	argument. Answer whether the object was already pinned. N.B. pinning does
+	*not* prevent
+	an object from being garbage collected. */
+
+static void
+primitivePin(void)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt boolean;
+    sqInt obj;
+    char *sp;
+    sqInt wasPinned;
+
+	(GIV(primFailCode) = PrimErrUnsupported);
+	return;
+
+	obj = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+	if (((obj & 1))
+	 || (isForwarded(obj))) {
+		(GIV(primFailCode) = PrimErrBadReceiver);
+		return;
+	}
+	boolean = longAt(GIV(stackPointer));
+	if (!((boolean == GIV(falseObj))
+		 || (boolean == GIV(trueObj)))) {
+		(GIV(primFailCode) = PrimErrBadArgument);
+		return;
+	}
+	wasPinned = GIV(falseObj);
+	if (boolean == GIV(trueObj)) {
+		if ((((obj & 1) == 0)
+		 && (((((usqInt) (longAt(obj))) >> (compactClassFieldLSB())) & 0x1F) == ClassMethodContextCompactIndex))
+		 && ((((longAt((obj + BaseHeaderSize) + (SenderIndex << (shiftForWord())))) & 1))
+		 && (!(isWidowedContext(obj))))) {
+			(GIV(primFailCode) = PrimErrBadReceiver);
+			return;
+		}
+		if ((pinObject(obj)) == 0) {
+			(GIV(primFailCode) = PrimErrNoMemory);
+			return;
+		}
+	}
+
+	/* begin pop:thenPush: */
+	longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), wasPinned);
+	GIV(stackPointer) = sp;
+}
+
+
 /*	Primitive. Indicate the semaphore to be signalled for upon garbage
 	collection 
  */

Modified: branches/Cog/nsspursrc/vm/cointerp.c
===================================================================
--- branches/Cog/nsspursrc/vm/cointerp.c	2015-01-08 00:51:28 UTC (rev 3221)
+++ branches/Cog/nsspursrc/vm/cointerp.c	2015-01-09 20:30:33 UTC (rev 3222)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1010 uuid: 9065e685-b193-428f-9c7a-27ce1afe8c71
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d
    from
-	CoInterpreter VMMaker.oscog-eem.1010 uuid: 9065e685-b193-428f-9c7a-27ce1afe8c71
+	CoInterpreter VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1010 uuid: 9065e685-b193-428f-9c7a-27ce1afe8c71 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -486,7 +486,7 @@
 sqInt lookupreceiver(sqInt selector, sqInt rcvr);
 static StackPage * makeBaseFrameFor(sqInt aContext) NoDbgRegParms;
 static void mapPrimTraceLog(void);
-static void mapStackPages(void);
+static void mapStackPages(void) NeverInline;
 static void mapTraceLog(void);
 void markActiveMethodsAndReferents(void);
 static void markAndTracePrimTraceLog(void);
@@ -1564,25 +1564,25 @@
 _iss sqInt * rememberedSet;
 _iss usqInt freeListsMask;
 _iss sqInt profileProcess;
+_iss sqInt profileSemaphore;
 _iss sqInt classTableFirstPage;
+_iss sqInt longRunningPrimitiveCheckSemaphore;
 _iss unsigned char primTraceLogIndex;
-_iss sqInt profileSemaphore;
-_iss sqInt longRunningPrimitiveCheckSemaphore;
+_iss sqInt profileMethod;
 _iss SpurContiguousObjStack unscannedEphemerons;
 _iss usqInt firstFreeChunk;
-_iss sqInt profileMethod;
 _iss StackPage * mostRecentlyUsedPage;
 _iss sqInt numStackPages;
 _iss SpurNewSpaceSpace pastSpace;
 _iss sqInt longRunningPrimitiveCheckMethod;
 _iss usqInt oldSpaceStart;
+_iss sqInt tempOop2;
 _iss sqInt numClassTablePages;
-_iss sqInt tempOop2;
+_iss sqInt classTableIndex;
 _iss SpurNewSpaceSpace futureSpace;
 _iss sqLong nextProfileTick;
 _iss sqInt numRememberedEphemerons;
 _iss sqInt jmpDepth;
-_iss sqInt classTableIndex;
 _iss sqInt futureSurvivorStart;
 _iss char * objStackInvalidBecause;
 _iss sqInt becomeEffectsFlags;
@@ -2353,7 +2353,8 @@
 /*540*/	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
 /*560*/	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1
 	};
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1010";
+char expensiveAsserts = 0;
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1014";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -17765,6 +17766,14 @@
 				theIPPtr = ((usqInt)(theFP + FoxCallerSavedIP));
 				theFP = callerFP;
 			}
+			theSP = ((thePage->baseAddress)) - BytesPerWord;
+			while (theSP <= ((thePage->baseAddress))) {
+				oop = longAt(theSP);
+				if (((longAt(oop)) & (0x3FFFFF - 8)) == 0) {
+					longAtput(theSP, followForwarded(oop));
+				}
+				theSP += BytesPerWord;
+			}
 		}
 	}
 }
@@ -18811,6 +18820,7 @@
 
 	/* theIP must be typed as signed because it is assigned ceCannotResumePC and so maybe implicitly typed as unsigned. */
 
+	assert(isContext(aContext));
 	assert(isSingleContext(aContext));
 	assert(goodContextSize(aContext));
 	theIP = longAt((aContext + BaseHeaderSize) + (InstructionPointerIndex << (shiftForWord())));
@@ -19000,7 +19010,8 @@
 			if ((selector != 0)
 			 && (((selector & 3) == 0)
 			 && ((((longAt(selector)) & (0x3FFFFF - 8)) == 0)
-			 || (isReallyYoungObject(selector))))) {
+			 || ((assert(!((isInFutureSpace(selector)))),
+			isReallyYoungObject(selector)))))) {
 				GIV(primTraceLog)[i] = (remapObj(selector));
 			}
 		}
@@ -19010,7 +19021,8 @@
 		if ((selector != 0)
 		 && (((selector & 3) == 0)
 		 && ((((longAt(selector)) & (0x3FFFFF - 8)) == 0)
-		 || (isReallyYoungObject(selector))))) {
+		 || ((assert(!((isInFutureSpace(selector)))),
+		isReallyYoungObject(selector)))))) {
 			GIV(primTraceLog)[i] = (remapObj(selector));
 		}
 	}
@@ -19061,7 +19073,8 @@
 					oop = longAt(theSP);
 					if (((oop & 3) == 0)
 					 && ((((longAt(oop)) & (0x3FFFFF - 8)) == 0)
-					 || (isReallyYoungObject(oop)))) {
+					 || ((assert(!((isInFutureSpace(oop)))),
+					isReallyYoungObject(oop))))) {
 						longAtput(theSP, remapObj(oop));
 					}
 					theSP += BytesPerWord;
@@ -19070,7 +19083,8 @@
 					? ((longAt(theFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
 					: (byteAt((theFP + FoxIFrameFlags) + 2)) != 0)) {
 					if ((((longAt(longAt(theFP + FoxThisContext))) & (0x3FFFFF - 8)) == 0)
-					 || (isReallyYoungObject(longAt(theFP + FoxThisContext)))) {
+					 || ((assert(!((isInFutureSpace(longAt(theFP + FoxThisContext))))),
+					isReallyYoungObject(longAt(theFP + FoxThisContext))))) {
 						longAtput(theFP + FoxThisContext, remapObj(longAt(theFP + FoxThisContext)));
 					}
 					assert((isMarriedOrWidowedContext(frameContext(theFP)))
@@ -19079,7 +19093,8 @@
 				}
 				if (!((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory()))) {
 					if ((((longAt(longAt(theFP + FoxMethod))) & (0x3FFFFF - 8)) == 0)
-					 || (isReallyYoungObject(longAt(theFP + FoxMethod)))) {
+					 || ((assert(!((isInFutureSpace(longAt(theFP + FoxMethod))))),
+					isReallyYoungObject(longAt(theFP + FoxMethod))))) {
 						if (theIPPtr != 0) {
 							theIP = longAt(theIPPtr);
 							if (theIP == (ceReturnToInterpreterPC())) {
@@ -19107,7 +19122,8 @@
 				oop = longAt(theSP);
 				if (((oop & 3) == 0)
 				 && ((((longAt(oop)) & (0x3FFFFF - 8)) == 0)
-				 || (isReallyYoungObject(oop)))) {
+				 || ((assert(!((isInFutureSpace(oop)))),
+				isReallyYoungObject(oop))))) {
 					longAtput(theSP, remapObj(oop));
 				}
 				theSP += BytesPerWord;
@@ -19143,13 +19159,15 @@
 		intOrClass = GIV(traceLog)[i];
 		if (((intOrClass & 3) == 0)
 		 && ((((longAt(intOrClass)) & (0x3FFFFF - 8)) == 0)
-		 || (isReallyYoungObject(intOrClass)))) {
+		 || ((assert(!((isInFutureSpace(intOrClass)))),
+		isReallyYoungObject(intOrClass))))) {
 			GIV(traceLog)[i] = (remapObj(intOrClass));
 		}
 		selectorOrMethod = GIV(traceLog)[i + 1];
 		if (((selectorOrMethod & 3) == 0)
 		 && ((((longAt(selectorOrMethod)) & (0x3FFFFF - 8)) == 0)
-		 || (isReallyYoungObject(selectorOrMethod)))) {
+		 || ((assert(!((isInFutureSpace(selectorOrMethod)))),
+		isReallyYoungObject(selectorOrMethod))))) {
 			GIV(traceLog)[i + 1] = (remapObj(selectorOrMethod));
 		}
 	}
@@ -23920,6 +23938,8 @@
 		if (switchedContext) {
 			/* begin mframeCogMethod: */
 			cogMethod = ((CogBlockMethod *) ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodMask));
+			assert((GIV(instructionPointer) > (minCogMethodAddress()))
+			 && (GIV(instructionPointer) < (maxCogMethodAddress())));
 			if ((GIV(instructionPointer) != ((((sqInt)cogMethod)) + ((cogMethod->stackCheckOffset))))
 			 && (isSendReturnPC(GIV(instructionPointer)))) {
 				assert(addressCouldBeOop(stackTop()));
@@ -42039,7 +42059,8 @@
 			mapInterpreterOops();
 			/* begin mapExtraRoots */
 			if ((((longAt(GIV(specialObjectsOop))) & (0x3FFFFF - 8)) == 0)
-			 || (isReallyYoungObject(GIV(specialObjectsOop)))) {
+			 || ((assert(!((isInFutureSpace(GIV(specialObjectsOop))))),
+			isReallyYoungObject(GIV(specialObjectsOop))))) {
 				GIV(specialObjectsOop) = remapObj(GIV(specialObjectsOop));
 			}
 			assert(GIV(remapBufferCount) == 0);
@@ -42048,7 +42069,8 @@
 				if (!(((oop & 3) != 0)
 					 || (((longAt(oop)) & 0x3FFFFF) == 0))) {
 					if ((((longAt(oop)) & (0x3FFFFF - 8)) == 0)
-					 || (isReallyYoungObject(oop))) {
+					 || ((assert(!((isInFutureSpace(oop)))),
+					isReallyYoungObject(oop)))) {
 						(GIV(extraRoots)[i])[0] = (remapObj(oop));
 					}
 				}
@@ -43054,6 +43076,7 @@
 				}
 			}
 		}
+		assert(GIV(classTableIndex) >= (1 << (classTableMajorIndexShift())));
 		count = count2;
 		ptr = ptr2;
 
@@ -44880,6 +44903,7 @@
 			}
 		}
 	}
+	assert(GIV(classTableIndex) >= (1 << (classTableMajorIndexShift())));
 l7:	/* end postBecomeScanClassTable: */;
 	GIV(becomeEffectsFlags) = 0;
 	assert(validClassTableHashes());
@@ -47040,7 +47064,7 @@
 	if (objStack == GIV(nilObj)) {
 		return;
 	}
-	assert(isValidObjStack(objStack));
+	eassert(isValidObjStack(objStack));
 	/* begin storePointer:ofObjStack:withValue: */
 	assert((formatOf(objStack)) == (wordIndexableFormat()));
 	null;
@@ -47066,7 +47090,7 @@
 	assert((formatOf(objStack)) == (wordIndexableFormat()));
 	null;
 	longAtput((objStack + BaseHeaderSize) + (ObjStackNextx << (shiftForWord())), 0);
-	assert(isValidObjStack(objStack));
+	eassert(isValidObjStack(objStack));
 }
 
 static sqInt
@@ -47258,7 +47282,11 @@
 		}
 		for (i = minorIndex, iLimiT = ((1 << 10) - 1); i <= iLimiT; i += 1) {
 			if ((longAt((page + BaseHeaderSize) + (i << (shiftForWord())))) == GIV(nilObj)) {
+
+				/* classTableIndex must never index the first page, which is reserved for classes known to the VM. */
+
 				GIV(classTableIndex) = (majorIndex << 10) + i;
+				assert(GIV(classTableIndex) >= (1 << (classTableMajorIndexShift())));
 				/* begin storePointer:ofObject:withValue: */
 				assert(!(isForwarded(page)));
 				if (isOldObject(page)) {
@@ -47387,6 +47415,7 @@
 	if (classIndex < GIV(classTableIndex)) {
 		GIV(classTableIndex) = classIndex;
 	}
+	assert(GIV(classTableIndex) >= (1 << (classTableMajorIndexShift())));
 }
 
 sqInt
@@ -49323,7 +49352,9 @@
 }
 
 
-/*	Answer if aClass exists at only one index in the class table. */
+/*	Answer if aClass exists at only one index in the class table. Be careful
+	not to
+	be misled by classes that have puns, such as Array. */
 
 static sqInt
 isClassAtUniqueIndex(sqInt aClass)
@@ -49346,7 +49377,8 @@
 			if (classOrNil != GIV(nilObj)) {
 				index = (i << 10) + j;
 				if ((classOrNil == aClass)
-				 && (index != expectedIndex)) {
+				 && ((index != expectedIndex)
+				 && (index > 0x1F))) {
 					return 0;
 				}
 
@@ -49405,7 +49437,7 @@
 	if (objStack == GIV(nilObj)) {
 		return 1;
 	}
-	assert(isValidObjStack(objStack));
+	eassert(isValidObjStack(objStack));
 	return (0 == (longAt((objStack + BaseHeaderSize) + (ObjStackTopx << (shiftForWord())))))
 	 && (0 == (longAt((objStack + BaseHeaderSize) + (ObjStackNextx << (shiftForWord())))));
 }
@@ -56620,6 +56652,7 @@
 			}
 		}
 	}
+	assert(GIV(classTableIndex) >= (1 << (classTableMajorIndexShift())));
 	nilUnmarkedWeaklingSlots();
 }
 
@@ -56711,7 +56744,7 @@
 		markAndTraceMachineCodeOfMarkedMethods();
 		do {
 			/* begin objStack:from:do: */
-			assert(isValidObjStack(GIV(weaklingStack)));
+			eassert(isValidObjStack(GIV(weaklingStack)));
 			size = longAt((GIV(weaklingStack) + BaseHeaderSize) + (ObjStackTopx << (shiftForWord())));
 			objStackPage = longAt((GIV(weaklingStack) + BaseHeaderSize) + (ObjStackNextx << (shiftForWord())));
 			while (objStackPage != 0) {
@@ -58050,7 +58083,7 @@
 		return;
 	}
 	/* begin objStack:from:do: */
-	assert(isValidObjStack(GIV(weaklingStack)));
+	eassert(isValidObjStack(GIV(weaklingStack)));
 	size = longAt((GIV(weaklingStack) + BaseHeaderSize) + (ObjStackTopx << (shiftForWord())));
 	objStackPage = longAt((GIV(weaklingStack) + BaseHeaderSize) + (ObjStackNextx << (shiftForWord())));
 	while (objStackPage != 0) {
@@ -58120,7 +58153,7 @@
 {
     sqInt topx;
 
-	assert(isValidObjStack(objStack));
+	eassert(isValidObjStack(objStack));
 	null;
 	topx = longAt((objStack + BaseHeaderSize) + (ObjStackTopx << (shiftForWord())));
 	if (topx >= ObjStackLimit) {
@@ -58833,7 +58866,7 @@
     sqInt top;
     sqInt topx;
 
-	assert(isValidObjStack(objStack));
+	eassert(isValidObjStack(objStack));
 	topx = longAt((objStack + BaseHeaderSize) + (ObjStackTopx << (shiftForWord())));
 	if (topx == 0) {
 		assert((fetchPointerofObject(ObjStackNextx, objStack)) == 0);
@@ -58889,10 +58922,10 @@
 			error("Case not found and no otherwise clause");
 		}
 		nextPage;
-		assert(isValidObjStack(nextPage));
+		eassert(isValidObjStack(nextPage));
 	}
 	else {
-		assert(isValidObjStack(objStack));
+		eassert(isValidObjStack(objStack));
 	}
 	return top;
 }
@@ -60359,7 +60392,8 @@
 shouldRemapObj(sqInt objOop)
 {
 	return (((longAt(objOop)) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(objOop));
+	 || ((assert(!((isInFutureSpace(objOop)))),
+	isReallyYoungObject(objOop)));
 }
 
 
@@ -60371,7 +60405,8 @@
 {
 	return ((oop & 3) == 0)
 	 && ((((longAt(oop)) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(oop)));
+	 || ((assert(!((isInFutureSpace(oop)))),
+	isReallyYoungObject(oop))));
 }
 
 
@@ -67694,7 +67729,8 @@
 	mapPrimTraceLog();
 	/* begin mapVMRegisters */
 	if ((((longAt(GIV(method))) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(GIV(method)))) {
+	 || ((assert(!((isInFutureSpace(GIV(method))))),
+	isReallyYoungObject(GIV(method))))) {
 
 		/* i.e. interpreter instructionPointer in method as opposed to machine code? */
 
@@ -67708,7 +67744,8 @@
 	}
 	if (((GIV(newMethod) & 3) == 0)
 	 && ((((longAt(GIV(newMethod))) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(GIV(newMethod))))) {
+	 || ((assert(!((isInFutureSpace(GIV(newMethod))))),
+	isReallyYoungObject(GIV(newMethod)))))) {
 
 		/* maybe oop due to object-as-method */
 
@@ -67716,15 +67753,18 @@
 	}
 	/* begin mapProfileState */
 	if ((((longAt(GIV(profileProcess))) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(GIV(profileProcess)))) {
+	 || ((assert(!((isInFutureSpace(GIV(profileProcess))))),
+	isReallyYoungObject(GIV(profileProcess))))) {
 		GIV(profileProcess) = remapObj(GIV(profileProcess));
 	}
 	if ((((longAt(GIV(profileMethod))) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(GIV(profileMethod)))) {
+	 || ((assert(!((isInFutureSpace(GIV(profileMethod))))),
+	isReallyYoungObject(GIV(profileMethod))))) {
 		GIV(profileMethod) = remapObj(GIV(profileMethod));
 	}
 	if ((((longAt(GIV(profileSemaphore))) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(GIV(profileSemaphore)))) {
+	 || ((assert(!((isInFutureSpace(GIV(profileSemaphore))))),
+	isReallyYoungObject(GIV(profileSemaphore))))) {
 		GIV(profileSemaphore) = remapObj(GIV(profileSemaphore));
 	}
 	sqLowLevelMFence();
@@ -67734,7 +67774,8 @@
 		}
 		else {
 			if ((((longAt(GIV(longRunningPrimitiveCheckMethod))) & (0x3FFFFF - 8)) == 0)
-			 || (isReallyYoungObject(GIV(longRunningPrimitiveCheckMethod)))) {
+			 || ((assert(!((isInFutureSpace(GIV(longRunningPrimitiveCheckMethod))))),
+			isReallyYoungObject(GIV(longRunningPrimitiveCheckMethod))))) {
 				GIV(longRunningPrimitiveCheckMethod) = remapObj(GIV(longRunningPrimitiveCheckMethod));
 			}
 		}
@@ -67742,7 +67783,8 @@
 	}
 	if (!(GIV(longRunningPrimitiveCheckSemaphore) == null)) {
 		if ((((longAt(GIV(longRunningPrimitiveCheckSemaphore))) & (0x3FFFFF - 8)) == 0)
-		 || (isReallyYoungObject(GIV(longRunningPrimitiveCheckSemaphore)))) {
+		 || ((assert(!((isInFutureSpace(GIV(longRunningPrimitiveCheckSemaphore))))),
+		isReallyYoungObject(GIV(longRunningPrimitiveCheckSemaphore))))) {
 			GIV(longRunningPrimitiveCheckSemaphore) = remapObj(GIV(longRunningPrimitiveCheckSemaphore));
 		}
 	}
@@ -67751,25 +67793,29 @@
 		oop = GIV(suspendedCallbacks)[i];
 		if (((oop & 3) == 0)
 		 && ((((longAt(oop)) & (0x3FFFFF - 8)) == 0)
-		 || (isReallyYoungObject(oop)))) {
+		 || ((assert(!((isInFutureSpace(oop)))),
+		isReallyYoungObject(oop))))) {
 			GIV(suspendedCallbacks)[i] = (remapObj(oop));
 		}
 		oop = GIV(suspendedMethods)[i];
 		if ((((longAt(oop)) & (0x3FFFFF - 8)) == 0)
-		 || (isReallyYoungObject(oop))) {
+		 || ((assert(!((isInFutureSpace(oop)))),
+		isReallyYoungObject(oop)))) {
 			GIV(suspendedMethods)[i] = (remapObj(oop));
 		}
 	}
 	if ((GIV(tempOop) != 0)
 	 && (((GIV(tempOop) & 3) == 0)
 	 && ((((longAt(GIV(tempOop))) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(GIV(tempOop)))))) {
+	 || ((assert(!((isInFutureSpace(GIV(tempOop))))),
+	isReallyYoungObject(GIV(tempOop))))))) {
 		GIV(tempOop) = remapObj(GIV(tempOop));
 	}
 	if ((GIV(tempOop2) != 0)
 	 && (((GIV(tempOop2) & 3) == 0)
 	 && ((((longAt(GIV(tempOop2))) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(GIV(tempOop2)))))) {
+	 || ((assert(!((isInFutureSpace(GIV(tempOop2))))),
+	isReallyYoungObject(GIV(tempOop2))))))) {
 		GIV(tempOop2) = remapObj(GIV(tempOop2));
 	}
 }

Modified: branches/Cog/nsspursrc/vm/cointerp.h
===================================================================
--- branches/Cog/nsspursrc/vm/cointerp.h	2015-01-08 00:51:28 UTC (rev 3221)
+++ branches/Cog/nsspursrc/vm/cointerp.h	2015-01-09 20:30:33 UTC (rev 3222)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1010 uuid: 9065e685-b193-428f-9c7a-27ce1afe8c71
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d
  */
 
 

Modified: branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nsspursrc/vm/gcc3x-cointerp.c	2015-01-08 00:51:28 UTC (rev 3221)
+++ branches/Cog/nsspursrc/vm/gcc3x-cointerp.c	2015-01-09 20:30:33 UTC (rev 3222)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1010 uuid: 9065e685-b193-428f-9c7a-27ce1afe8c71
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d
    from
-	CoInterpreter VMMaker.oscog-eem.1010 uuid: 9065e685-b193-428f-9c7a-27ce1afe8c71
+	CoInterpreter VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1010 uuid: 9065e685-b193-428f-9c7a-27ce1afe8c71 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1014 uuid: 8c9c75f6-b340-4135-ae40-399c35379d5d " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -489,7 +489,7 @@
 sqInt lookupreceiver(sqInt selector, sqInt rcvr);
 static StackPage * makeBaseFrameFor(sqInt aContext) NoDbgRegParms;
 static void mapPrimTraceLog(void);
-static void mapStackPages(void);
+static void mapStackPages(void) NeverInline;
 static void mapTraceLog(void);
 void markActiveMethodsAndReferents(void);
 static void markAndTracePrimTraceLog(void);
@@ -1567,25 +1567,25 @@
 _iss sqInt * rememberedSet;
 _iss usqInt freeListsMask;
 _iss sqInt profileProcess;
+_iss sqInt profileSemaphore;
 _iss sqInt classTableFirstPage;
+_iss sqInt longRunningPrimitiveCheckSemaphore;
 _iss unsigned char primTraceLogIndex;
-_iss sqInt profileSemaphore;
-_iss sqInt longRunningPrimitiveCheckSemaphore;
+_iss sqInt profileMethod;
 _iss SpurContiguousObjStack unscannedEphemerons;
 _iss usqInt firstFreeChunk;
-_iss sqInt profileMethod;
 _iss StackPage * mostRecentlyUsedPage;
 _iss sqInt numStackPages;
 _iss SpurNewSpaceSpace pastSpace;
 _iss sqInt longRunningPrimitiveCheckMethod;
 _iss usqInt oldSpaceStart;
+_iss sqInt tempOop2;
 _iss sqInt numClassTablePages;
-_iss sqInt tempOop2;
+_iss sqInt classTableIndex;
 _iss SpurNewSpaceSpace futureSpace;
 _iss sqLong nextProfileTick;
 _iss sqInt numRememberedEphemerons;
 _iss sqInt jmpDepth;
-_iss sqInt classTableIndex;
 _iss sqInt futureSurvivorStart;
 _iss char * objStackInvalidBecause;
 _iss sqInt becomeEffectsFlags;
@@ -2356,7 +2356,8 @@
 /*540*/	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
 /*560*/	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1
 	};
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1010";
+char expensiveAsserts = 0;
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1014";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -17774,6 +17775,14 @@
 				theIPPtr = ((usqInt)(theFP + FoxCallerSavedIP));
 				theFP = callerFP;
 			}
+			theSP = ((thePage->baseAddress)) - BytesPerWord;
+			while (theSP <= ((thePage->baseAddress))) {
+				oop = longAt(theSP);
+				if (((longAt(oop)) & (0x3FFFFF - 8)) == 0) {
+					longAtput(theSP, followForwarded(oop));
+				}
+				theSP += BytesPerWord;
+			}
 		}
 	}
 }
@@ -18820,6 +18829,7 @@
 
 	/* theIP must be typed as signed because it is assigned ceCannotResumePC and so maybe implicitly typed as unsigned. */
 
+	assert(isContext(aContext));
 	assert(isSingleContext(aContext));
 	assert(goodContextSize(aContext));
 	theIP = longAt((aContext + BaseHeaderSize) + (InstructionPointerIndex << (shiftForWord())));
@@ -19009,7 +19019,8 @@
 			if ((selector != 0)
 			 && (((selector & 3) == 0)
 			 && ((((longAt(selector)) & (0x3FFFFF - 8)) == 0)
-			 || (isReallyYoungObject(selector))))) {
+			 || ((assert(!((isInFutureSpace(selector)))),
+			isReallyYoungObject(selector)))))) {
 				GIV(primTraceLog)[i] = (remapObj(selector));
 			}
 		}
@@ -19019,7 +19030,8 @@
 		if ((selector != 0)
 		 && (((selector & 3) == 0)
 		 && ((((longAt(selector)) & (0x3FFFFF - 8)) == 0)
-		 || (isReallyYoungObject(selector))))) {
+		 || ((assert(!((isInFutureSpace(selector)))),
+		isReallyYoungObject(selector)))))) {
 			GIV(primTraceLog)[i] = (remapObj(selector));
 		}
 	}
@@ -19070,7 +19082,8 @@
 					oop = longAt(theSP);
 					if (((oop & 3) == 0)
 					 && ((((longAt(oop)) & (0x3FFFFF - 8)) == 0)
-					 || (isReallyYoungObject(oop)))) {
+					 || ((assert(!((isInFutureSpace(oop)))),
+					isReallyYoungObject(oop))))) {
 						longAtput(theSP, remapObj(oop));
 					}
 					theSP += BytesPerWord;
@@ -19079,7 +19092,8 @@
 					? ((longAt(theFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
 					: (byteAt((theFP + FoxIFrameFlags) + 2)) != 0)) {
 					if ((((longAt(longAt(theFP + FoxThisContext))) & (0x3FFFFF - 8)) == 0)
-					 || (isReallyYoungObject(longAt(theFP + FoxThisContext)))) {
+					 || ((assert(!((isInFutureSpace(longAt(theFP + FoxThisContext))))),
+					isReallyYoungObject(longAt(theFP + FoxThisContext))))) {
 						longAtput(theFP + FoxThisContext, remapObj(longAt(theFP + FoxThisContext)));
 					}
 					assert((isMarriedOrWidowedContext(frameContext(theFP)))
@@ -19088,7 +19102,8 @@
 				}
 				if (!((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory()))) {
 					if ((((longAt(longAt(theFP + FoxMethod))) & (0x3FFFFF - 8)) == 0)
-					 || (isReallyYoungObject(longAt(theFP + FoxMethod)))) {
+					 || ((assert(!((isInFutureSpace(longAt(theFP + FoxMethod))))),
+					isReallyYoungObject(longAt(theFP + FoxMethod))))) {
 						if (theIPPtr != 0) {
 							theIP = longAt(theIPPtr);
 							if (theIP == (ceReturnToInterpreterPC())) {
@@ -19116,7 +19131,8 @@
 				oop = longAt(theSP);
 				if (((oop & 3) == 0)
 				 && ((((longAt(oop)) & (0x3FFFFF - 8)) == 0)
-				 || (isReallyYoungObject(oop)))) {
+				 || ((assert(!((isInFutureSpace(oop)))),
+				isReallyYoungObject(oop))))) {
 					longAtput(theSP, remapObj(oop));
 				}
 				theSP += BytesPerWord;
@@ -19152,13 +19168,15 @@
 		intOrClass = GIV(traceLog)[i];
 		if (((intOrClass & 3) == 0)
 		 && ((((longAt(intOrClass)) & (0x3FFFFF - 8)) == 0)
-		 || (isReallyYoungObject(intOrClass)))) {
+		 || ((assert(!((isInFutureSpace(intOrClass)))),
+		isReallyYoungObject(intOrClass))))) {
 			GIV(traceLog)[i] = (remapObj(intOrClass));
 		}
 		selectorOrMethod = GIV(traceLog)[i + 1];
 		if (((selectorOrMethod & 3) == 0)
 		 && ((((longAt(selectorOrMethod)) & (0x3FFFFF - 8)) == 0)
-		 || (isReallyYoungObject(selectorOrMethod)))) {
+		 || ((assert(!((isInFutureSpace(selectorOrMethod)))),
+		isReallyYoungObject(selectorOrMethod))))) {
 			GIV(traceLog)[i + 1] = (remapObj(selectorOrMethod));
 		}
 	}
@@ -23929,6 +23947,8 @@
 		if (switchedContext) {
 			/* begin mframeCogMethod: */
 			cogMethod = ((CogBlockMethod *) ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodMask));
+			assert((GIV(instructionPointer) > (minCogMethodAddress()))
+			 && (GIV(instructionPointer) < (maxCogMethodAddress())));
 			if ((GIV(instructionPointer) != ((((sqInt)cogMethod)) + ((cogMethod->stackCheckOffset))))
 			 && (isSendReturnPC(GIV(instructionPointer)))) {
 				assert(addressCouldBeOop(stackTop()));
@@ -42048,7 +42068,8 @@
 			mapInterpreterOops();
 			/* begin mapExtraRoots */
 			if ((((longAt(GIV(specialObjectsOop))) & (0x3FFFFF - 8)) == 0)
-			 || (isReallyYoungObject(GIV(specialObjectsOop)))) {
+			 || ((assert(!((isInFutureSpace(GIV(specialObjectsOop))))),
+			isReallyYoungObject(GIV(specialObjectsOop))))) {
 				GIV(specialObjectsOop) = remapObj(GIV(specialObjectsOop));
 			}
 			assert(GIV(remapBufferCount) == 0);
@@ -42057,7 +42078,8 @@
 				if (!(((oop & 3) != 0)
 					 || (((longAt(oop)) & 0x3FFFFF) == 0))) {
 					if ((((longAt(oop)) & (0x3FFFFF - 8)) == 0)
-					 || (isReallyYoungObject(oop))) {
+					 || ((assert(!((isInFutureSpace(oop)))),
+					isReallyYoungObject(oop)))) {
 						(GIV(extraRoots)[i])[0] = (remapObj(oop));
 					}
 				}
@@ -43063,6 +43085,7 @@
 				}
 			}
 		}
+		assert(GIV(classTableIndex) >= (1 << (classTableMajorIndexShift())));
 		count = count2;
 		ptr = ptr2;
 
@@ -44889,6 +44912,7 @@
 			}
 		}
 	}
+	assert(GIV(classTableIndex) >= (1 << (classTableMajorIndexShift())));
 l7:	/* end postBecomeScanClassTable: */;
 	GIV(becomeEffectsFlags) = 0;
 	assert(validClassTableHashes());
@@ -47049,7 +47073,7 @@
 	if (objStack == GIV(nilObj)) {
 		return;
 	}
-	assert(isValidObjStack(objStack));
+	eassert(isValidObjStack(objStack));
 	/* begin storePointer:ofObjStack:withValue: */
 	assert((formatOf(objStack)) == (wordIndexableFormat()));
 	null;
@@ -47075,7 +47099,7 @@
 	assert((formatOf(objStack)) == (wordIndexableFormat()));
 	null;
 	longAtput((objStack + BaseHeaderSize) + (ObjStackNextx << (shiftForWord())), 0);
-	assert(isValidObjStack(objStack));
+	eassert(isValidObjStack(objStack));
 }
 
 static sqInt
@@ -47267,7 +47291,11 @@
 		}
 		for (i = minorIndex, iLimiT = ((1 << 10) - 1); i <= iLimiT; i += 1) {
 			if ((longAt((page + BaseHeaderSize) + (i << (shiftForWord())))) == GIV(nilObj)) {
+
+				/* classTableIndex must never index the first page, which is reserved for classes known to the VM. */
+
 				GIV(classTableIndex) = (majorIndex << 10) + i;
+				assert(GIV(classTableIndex) >= (1 << (classTableMajorIndexShift())));
 				/* begin storePointer:ofObject:withValue: */
 				assert(!(isForwarded(page)));
 				if (isOldObject(page)) {
@@ -47396,6 +47424,7 @@
 	if (classIndex < GIV(classTableIndex)) {
 		GIV(classTableIndex) = classIndex;
 	}
+	assert(GIV(classTableIndex) >= (1 << (classTableMajorIndexShift())));
 }
 
 sqInt
@@ -49332,7 +49361,9 @@
 }
 
 
-/*	Answer if aClass exists at only one index in the class table. */
+/*	Answer if aClass exists at only one index in the class table. Be careful
+	not to
+	be misled by classes that have puns, such as Array. */
 
 static sqInt
 isClassAtUniqueIndex(sqInt aClass)
@@ -49355,7 +49386,8 @@
 			if (classOrNil != GIV(nilObj)) {
 				index = (i << 10) + j;
 				if ((classOrNil == aClass)
-				 && (index != expectedIndex)) {
+				 && ((index != expectedIndex)
+				 && (index > 0x1F))) {
 					return 0;
 				}
 
@@ -49414,7 +49446,7 @@
 	if (objStack == GIV(nilObj)) {
 		return 1;
 	}
-	assert(isValidObjStack(objStack));
+	eassert(isValidObjStack(objStack));
 	return (0 == (longAt((objStack + BaseHeaderSize) + (ObjStackTopx << (shiftForWord())))))
 	 && (0 == (longAt((objStack + BaseHeaderSize) + (ObjStackNextx << (shiftForWord())))));
 }
@@ -56629,6 +56661,7 @@
 			}
 		}
 	}
+	assert(GIV(classTableIndex) >= (1 << (classTableMajorIndexShift())));
 	nilUnmarkedWeaklingSlots();
 }
 
@@ -56720,7 +56753,7 @@
 		markAndTraceMachineCodeOfMarkedMethods();
 		do {
 			/* begin objStack:from:do: */
-			assert(isValidObjStack(GIV(weaklingStack)));
+			eassert(isValidObjStack(GIV(weaklingStack)));
 			size = longAt((GIV(weaklingStack) + BaseHeaderSize) + (ObjStackTopx << (shiftForWord())));
 			objStackPage = longAt((GIV(weaklingStack) + BaseHeaderSize) + (ObjStackNextx << (shiftForWord())));
 			while (objStackPage != 0) {
@@ -58059,7 +58092,7 @@
 		return;
 	}
 	/* begin objStack:from:do: */
-	assert(isValidObjStack(GIV(weaklingStack)));
+	eassert(isValidObjStack(GIV(weaklingStack)));
 	size = longAt((GIV(weaklingStack) + BaseHeaderSize) + (ObjStackTopx << (shiftForWord())));
 	objStackPage = longAt((GIV(weaklingStack) + BaseHeaderSize) + (ObjStackNextx << (shiftForWord())));
 	while (objStackPage != 0) {
@@ -58129,7 +58162,7 @@
 {
     sqInt topx;
 
-	assert(isValidObjStack(objStack));
+	eassert(isValidObjStack(objStack));
 	null;
 	topx = longAt((objStack + BaseHeaderSize) + (ObjStackTopx << (shiftForWord())));
 	if (topx >= ObjStackLimit) {
@@ -58842,7 +58875,7 @@
     sqInt top;
     sqInt topx;
 
-	assert(isValidObjStack(objStack));
+	eassert(isValidObjStack(objStack));
 	topx = longAt((objStack + BaseHeaderSize) + (ObjStackTopx << (shiftForWord())));
 	if (topx == 0) {
 		assert((fetchPointerofObject(ObjStackNextx, objStack)) == 0);
@@ -58898,10 +58931,10 @@
 			error("Case not found and no otherwise clause");
 		}
 		nextPage;
-		assert(isValidObjStack(nextPage));
+		eassert(isValidObjStack(nextPage));
 	}
 	else {
-		assert(isValidObjStack(objStack));
+		eassert(isValidObjStack(objStack));
 	}
 	return top;
 }
@@ -60368,7 +60401,8 @@
 shouldRemapObj(sqInt objOop)
 {
 	return (((longAt(objOop)) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(objOop));
+	 || ((assert(!((isInFutureSpace(objOop)))),
+	isReallyYoungObject(objOop)));
 }
 
 
@@ -60380,7 +60414,8 @@
 {
 	return ((oop & 3) == 0)
 	 && ((((longAt(oop)) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(oop)));
+	 || ((assert(!((isInFutureSpace(oop)))),
+	isReallyYoungObject(oop))));
 }
 
 
@@ -67703,7 +67738,8 @@
 	mapPrimTraceLog();
 	/* begin mapVMRegisters */
 	if ((((longAt(GIV(method))) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(GIV(method)))) {
+	 || ((assert(!((isInFutureSpace(GIV(method))))),
+	isReallyYoungObject(GIV(method))))) {
 
 		/* i.e. interpreter instructionPointer in method as opposed to machine code? */
 
@@ -67717,7 +67753,8 @@
 	}
 	if (((GIV(newMethod) & 3) == 0)
 	 && ((((longAt(GIV(newMethod))) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(GIV(newMethod))))) {
+	 || ((assert(!((isInFutureSpace(GIV(newMethod))))),
+	isReallyYoungObject(GIV(newMethod)))))) {
 
 		/* maybe oop due to object-as-method */
 
@@ -67725,15 +67762,18 @@
 	}
 	/* begin mapProfileState */
 	if ((((longAt(GIV(profileProcess))) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(GIV(profileProcess)))) {
+	 || ((assert(!((isInFutureSpace(GIV(profileProcess))))),
+	isReallyYoungObject(GIV(profileProcess))))) {
 		GIV(profileProcess) = remapObj(GIV(profileProcess));
 	}
 	if ((((longAt(GIV(profileMethod))) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(GIV(profileMethod)))) {
+	 || ((assert(!((isInFutureSpace(GIV(profileMethod))))),
+	isReallyYoungObject(GIV(profileMethod))))) {
 		GIV(profileMethod) = remapObj(GIV(profileMethod));
 	}
 	if ((((longAt(GIV(profileSemaphore))) & (0x3FFFFF - 8)) == 0)
-	 || (isReallyYoungObject(GIV(profileSemaphore)))) {
+	 || ((assert(!((isInFutureSpace(GIV(profileSemaphore))))),
+	isReallyYoungObject(GIV(profileSemaphore))))) {
 		GIV(profileSemaphore) = remapObj(GIV(profileSemaphore));
 	}
 	sqLowLevelMFence();
@@ -67743,7 +67783,8 @@
 		}
 		else {
 			if ((((longAt(GIV(longRunningPrimitiveCheckMethod))) & (0x3FFFFF - 8)) == 0)
-			 || (isReallyYoungObject(GIV(longRunningPrimitiveCheckMethod)))) {
+			 || ((assert(!((isInFutureSpace(GIV(longRunningPrimitiveCheckMethod))))),
+			isReallyYoungObject(GIV(longRunningPrimitiveCheckMethod))))) {
 				GIV(longRunningPrimitiveCheckMethod) = remapObj(GIV(longRunningPrimitiveCheckMethod));
 			}
 		}
@@ -67751,7 +67792,8 @@
 	}
 	if (!(GIV(longRunningPrimitiveCheckSemaphore) == null)) {

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list