[Vm-dev] [commit][2756] CogVM source as per VMMaker.oscog-eem.309.

commits at squeakvm.org commits at squeakvm.org
Wed Jul 24 19:46:14 UTC 2013


Revision: 2756
Author:   eliot
Date:     2013-07-24 12:46:12 -0700 (Wed, 24 Jul 2013)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.309.

Use assertValidStackedInstructionPointers: in primitiveTerminateTo.
Fix the assert to use framePointer when on current page and
instructionPointer ~= 0.
Fix assertValidStackedInstructionPointersIn:line: usage in
commenceCogCompiledCodeCompaction.

Simplify relocateCallBeforeReturnPC:by: and elide bogus use of
signedIntToLong there-in.

Add a guard to findClassOfMethod:forReceiver:.

Modified Paths:
--------------
    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/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

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

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/nscogsrc/vm/cogit.c	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CCodeGenerator VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	StackToRegisterMappingCogit VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -16792,14 +16792,9 @@
 		byteAtput(retpc - 2, (((usqInt) distance) >> 16) & 255);
 		byteAtput(retpc - 3, (((usqInt) distance) >> 8) & 255);
 		byteAtput(retpc - 4, distance & 255);
-		if (0) {
-			assert((((usqInt) (callTargetFromReturnAddress(self_in_relocateCallBeforeReturnPCby, retpc)))) >= (minCallAddress()));
+		if (!(asserta((callTargetFromReturnAddress(self_in_relocateCallBeforeReturnPCby, retpc)) >= (minCallAddress())))) {
+			error("relocating call to invalid address");
 		}
-		else {
-			if (!((((usqInt) (callTargetFromReturnAddress(self_in_relocateCallBeforeReturnPCby, retpc)))) >= (minCallAddress()))) {
-				error("relocating call to invalid address");
-			}
-		}
 	}
 }
 

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/nscogsrc/vm/cogit.h	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CCodeGenerator VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/nscogsrc/vm/cogmethod.h	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CCodeGenerator VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
 
 typedef struct {

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
    from
-	CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CoInterpreter VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1978,7 +1978,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.308";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.309";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -13491,22 +13491,36 @@
 
 static sqInt
 assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     char *callerFP;
     sqInt methodField;
     sqInt methodObj;
     sqInt prevFrameWasCogged;
     char *theFP;
     usqInt theIP;
-    char *theIPPtr;
     CogMethod *theMethod;
 
 	if (!(assertal(!(isFree(aStackPage)), ln))) {
 		return 0;
 	}
+
+	/* The top of stack of an inactive page is always the instructionPointer.
+	   The top of stack of the active page may be the instructionPointer if it has been pushed,
+	   which is indicated by a 0 instructionPointer. */
+
 	prevFrameWasCogged = 0;
-	theIPPtr = (aStackPage->headSP);
-	theFP = (aStackPage->headFP);
+	if ((GIV(stackPage) == aStackPage)
+	 && (GIV(instructionPointer) != 0)) {
+		theIP = GIV(instructionPointer);
+		theFP = GIV(framePointer);
+	}
+	else {
+		theIP = ((usqInt)(longAt((aStackPage->headSP))));
+		theFP = (aStackPage->headFP);
+		if (GIV(stackPage) == aStackPage) {
+			assert(GIV(framePointer) == theFP);
+		}
+	}
 	while (1) {
 		if ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())) {
 			/* begin mframeHomeMethod: */
@@ -13517,7 +13531,6 @@
 			}
 			theMethod = ((CogMethod *) (methodField & MFMethodMask));
 		l1:	/* end mframeHomeMethod: */;
-			theIP = ((usqInt)(longAt(theIPPtr)));
 			assertl((theIP == (ceCannotResumePC()))
 			 || (asserta((theIP >= (((usqInt)theMethod)))
 			 && (theIP < ((((usqInt)theMethod)) + ((theMethod->blockSize)))))), ln);
@@ -13527,7 +13540,6 @@
 
 			/* assert-check the interpreter frame. */
 
-			theIP = ((usqInt)(longAt(theIPPtr)));
 			/* begin iframeMethod: */
 			methodObj = ((usqInt) (longAt(theFP + FoxMethod)));
 			if (prevFrameWasCogged) {
@@ -13540,10 +13552,11 @@
 			 && (theIP < ((methodObj + (byteLengthOf(methodObj))) + BaseHeaderSize)), ln);
 			prevFrameWasCogged = 0;
 		}
+		theIP = ((usqInt)(longAt(theFP + FoxCallerSavedIP)));
 		if (!(((callerFP = frameCallerFP(theFP))) != 0)) break;
-		theIPPtr = theFP + FoxCallerSavedIP;
 		theFP = callerFP;
 	}
+	assertl(theIP == (ceBaseFrameReturnPC()), ln);
 	return 1;
 }
 
@@ -17579,7 +17592,6 @@
 	}
 	assertValidStackedInstructionPointers(__LINE__);
 	compactCogCompiledCode();
-	assertValidStackedInstructionPointers(__LINE__);
 	if (GIV(instructionPointer) != 0) {
 		/* begin popStack */
 		top = longAt(GIV(stackPointer));
@@ -17590,6 +17602,7 @@
 		 && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize)));
 		(GIV(stackPage)->headSP = GIV(stackPointer));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	GIV(statCodeCompactionCount) += 1;
 	GIV(statCodeCompactionUsecs) += (ioUTCMicrosecondsNow()) - startTime;
 	if (checkForLeaks != 0) {
@@ -21198,10 +21211,11 @@
 			}
 		}
 	}
-	if (!(((meth & 3) == 0)
-		 && (((((usqInt)meth)) >= (startOfMemory()))
-		 && (((((usqInt)meth)) < GIV(freeStart))
-		 && (((longAt(meth)) & TypeMask) != HeaderTypeGC))))) {
+	if (!((((meth & 3) == 0)
+ && (((((usqInt)meth)) >= (startOfMemory()))
+ && (((((usqInt)meth)) < GIV(freeStart))
+ && (((longAt(meth)) & TypeMask) != HeaderTypeGC))))
+		 && (((((usqInt) (longAt(meth))) >> 8) & 15) >= 12))) {
 		return GIV(nilObj);
 	}
 	return findClassContainingMethodstartingAt(meth, methodClassOf(meth));
@@ -43264,6 +43278,7 @@
 		theFP = pointerForOop(value2 - 1);
 		if ((theFP == GIV(framePointer))
 		 && (pageToStopOn == GIV(stackPage))) {
+			assertValidStackedInstructionPointersInline(GIV(stackPage), __LINE__);
 			if ((frameCallerFP(theFP)) != contextsFP) {
 				/* begin frameStackedReceiverOffsetNumArgs: */
 				numArgs = ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -43325,6 +43340,7 @@
 			/* begin pop: */
 			GIV(stackPointer) += 1 * BytesPerWord;
 			null;
+			assertValidStackedInstructionPointersInline(GIV(stackPage), __LINE__);
 			assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 			return;
 		}
@@ -43367,6 +43383,7 @@
 	else {
 		currentCtx = longAt((thisCtx + BaseHeaderSize) + (SenderIndex << ShiftForWord));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	if (contexthasSender(thisCtx, aContextOrNil)) {
 
 		/* Need to walk the stack freeing stack pages and nilling contexts. */
@@ -43517,6 +43534,7 @@
 	/* begin pop: */
 	GIV(stackPointer) += 1 * BytesPerWord;
 	null;
+	assertValidStackedInstructionPointers(__LINE__);
 	assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 }
 
@@ -45018,10 +45036,11 @@
 			}
 		}
 	}
-	if (!(((aMethod & 3) == 0)
-		 && (((((usqInt)aMethod)) >= (startOfMemory()))
-		 && (((((usqInt)aMethod)) < GIV(freeStart))
-		 && (((longAt(aMethod)) & TypeMask) != HeaderTypeGC))))) {
+	if (!((((aMethod & 3) == 0)
+ && (((((usqInt)aMethod)) >= (startOfMemory()))
+ && (((((usqInt)aMethod)) < GIV(freeStart))
+ && (((longAt(aMethod)) & TypeMask) != HeaderTypeGC))))
+		 && (((((usqInt) (longAt(aMethod))) >> 8) & 15) >= 12))) {
 		methClass = GIV(nilObj);
 		goto l1;
 	}

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
 
 

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2013-07-24 19:46:12 UTC (rev 2756)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
    from
-	CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CoInterpreter VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1981,7 +1981,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.308";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.309";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -13500,22 +13500,36 @@
 
 static sqInt
 assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     char *callerFP;
     sqInt methodField;
     sqInt methodObj;
     sqInt prevFrameWasCogged;
     char *theFP;
     usqInt theIP;
-    char *theIPPtr;
     CogMethod *theMethod;
 
 	if (!(assertal(!(isFree(aStackPage)), ln))) {
 		return 0;
 	}
+
+	/* The top of stack of an inactive page is always the instructionPointer.
+	   The top of stack of the active page may be the instructionPointer if it has been pushed,
+	   which is indicated by a 0 instructionPointer. */
+
 	prevFrameWasCogged = 0;
-	theIPPtr = (aStackPage->headSP);
-	theFP = (aStackPage->headFP);
+	if ((GIV(stackPage) == aStackPage)
+	 && (GIV(instructionPointer) != 0)) {
+		theIP = GIV(instructionPointer);
+		theFP = GIV(framePointer);
+	}
+	else {
+		theIP = ((usqInt)(longAt((aStackPage->headSP))));
+		theFP = (aStackPage->headFP);
+		if (GIV(stackPage) == aStackPage) {
+			assert(GIV(framePointer) == theFP);
+		}
+	}
 	while (1) {
 		if ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())) {
 			/* begin mframeHomeMethod: */
@@ -13526,7 +13540,6 @@
 			}
 			theMethod = ((CogMethod *) (methodField & MFMethodMask));
 		l1:	/* end mframeHomeMethod: */;
-			theIP = ((usqInt)(longAt(theIPPtr)));
 			assertl((theIP == (ceCannotResumePC()))
 			 || (asserta((theIP >= (((usqInt)theMethod)))
 			 && (theIP < ((((usqInt)theMethod)) + ((theMethod->blockSize)))))), ln);
@@ -13536,7 +13549,6 @@
 
 			/* assert-check the interpreter frame. */
 
-			theIP = ((usqInt)(longAt(theIPPtr)));
 			/* begin iframeMethod: */
 			methodObj = ((usqInt) (longAt(theFP + FoxMethod)));
 			if (prevFrameWasCogged) {
@@ -13549,10 +13561,11 @@
 			 && (theIP < ((methodObj + (byteLengthOf(methodObj))) + BaseHeaderSize)), ln);
 			prevFrameWasCogged = 0;
 		}
+		theIP = ((usqInt)(longAt(theFP + FoxCallerSavedIP)));
 		if (!(((callerFP = frameCallerFP(theFP))) != 0)) break;
-		theIPPtr = theFP + FoxCallerSavedIP;
 		theFP = callerFP;
 	}
+	assertl(theIP == (ceBaseFrameReturnPC()), ln);
 	return 1;
 }
 
@@ -17588,7 +17601,6 @@
 	}
 	assertValidStackedInstructionPointers(__LINE__);
 	compactCogCompiledCode();
-	assertValidStackedInstructionPointers(__LINE__);
 	if (GIV(instructionPointer) != 0) {
 		/* begin popStack */
 		top = longAt(GIV(stackPointer));
@@ -17599,6 +17611,7 @@
 		 && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize)));
 		(GIV(stackPage)->headSP = GIV(stackPointer));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	GIV(statCodeCompactionCount) += 1;
 	GIV(statCodeCompactionUsecs) += (ioUTCMicrosecondsNow()) - startTime;
 	if (checkForLeaks != 0) {
@@ -21207,10 +21220,11 @@
 			}
 		}
 	}
-	if (!(((meth & 3) == 0)
-		 && (((((usqInt)meth)) >= (startOfMemory()))
-		 && (((((usqInt)meth)) < GIV(freeStart))
-		 && (((longAt(meth)) & TypeMask) != HeaderTypeGC))))) {
+	if (!((((meth & 3) == 0)
+ && (((((usqInt)meth)) >= (startOfMemory()))
+ && (((((usqInt)meth)) < GIV(freeStart))
+ && (((longAt(meth)) & TypeMask) != HeaderTypeGC))))
+		 && (((((usqInt) (longAt(meth))) >> 8) & 15) >= 12))) {
 		return GIV(nilObj);
 	}
 	return findClassContainingMethodstartingAt(meth, methodClassOf(meth));
@@ -43273,6 +43287,7 @@
 		theFP = pointerForOop(value2 - 1);
 		if ((theFP == GIV(framePointer))
 		 && (pageToStopOn == GIV(stackPage))) {
+			assertValidStackedInstructionPointersInline(GIV(stackPage), __LINE__);
 			if ((frameCallerFP(theFP)) != contextsFP) {
 				/* begin frameStackedReceiverOffsetNumArgs: */
 				numArgs = ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -43334,6 +43349,7 @@
 			/* begin pop: */
 			GIV(stackPointer) += 1 * BytesPerWord;
 			null;
+			assertValidStackedInstructionPointersInline(GIV(stackPage), __LINE__);
 			assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 			return;
 		}
@@ -43376,6 +43392,7 @@
 	else {
 		currentCtx = longAt((thisCtx + BaseHeaderSize) + (SenderIndex << ShiftForWord));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	if (contexthasSender(thisCtx, aContextOrNil)) {
 
 		/* Need to walk the stack freeing stack pages and nilling contexts. */
@@ -43526,6 +43543,7 @@
 	/* begin pop: */
 	GIV(stackPointer) += 1 * BytesPerWord;
 	null;
+	assertValidStackedInstructionPointers(__LINE__);
 	assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 }
 
@@ -45027,10 +45045,11 @@
 			}
 		}
 	}
-	if (!(((aMethod & 3) == 0)
-		 && (((((usqInt)aMethod)) >= (startOfMemory()))
-		 && (((((usqInt)aMethod)) < GIV(freeStart))
-		 && (((longAt(aMethod)) & TypeMask) != HeaderTypeGC))))) {
+	if (!((((aMethod & 3) == 0)
+ && (((((usqInt)aMethod)) >= (startOfMemory()))
+ && (((((usqInt)aMethod)) < GIV(freeStart))
+ && (((longAt(aMethod)) & TypeMask) != HeaderTypeGC))))
+		 && (((((usqInt) (longAt(aMethod))) >> 8) & 15) >= 12))) {
 		methClass = GIV(nilObj);
 		goto l1;
 	}

Modified: branches/Cog/nscogsrc/vm/interp.h
===================================================================
--- branches/Cog/nscogsrc/vm/interp.h	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/nscogsrc/vm/interp.h	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/nscogsrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nscogsrc/vm/vmCallback.h	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/nscogsrc/vm/vmCallback.h	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
 
 #define VM_CALLBACK_INC 1


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Tue Jul 23 17:29:18 PDT 2013
   + Wed Jul 24 12:45:36 PDT 2013

Modified: branches/Cog/src/vm/cogit.c
===================================================================
--- branches/Cog/src/vm/cogit.c	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/src/vm/cogit.c	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CCodeGenerator VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	StackToRegisterMappingCogit VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -15436,14 +15436,9 @@
 		byteAtput(retpc - 2, (((usqInt) distance) >> 16) & 255);
 		byteAtput(retpc - 3, (((usqInt) distance) >> 8) & 255);
 		byteAtput(retpc - 4, distance & 255);
-		if (0) {
-			assert((((usqInt) (callTargetFromReturnAddress(self_in_relocateCallBeforeReturnPCby, retpc)))) >= (minCallAddress()));
+		if (!(asserta((callTargetFromReturnAddress(self_in_relocateCallBeforeReturnPCby, retpc)) >= (minCallAddress())))) {
+			error("relocating call to invalid address");
 		}
-		else {
-			if (!((((usqInt) (callTargetFromReturnAddress(self_in_relocateCallBeforeReturnPCby, retpc)))) >= (minCallAddress()))) {
-				error("relocating call to invalid address");
-			}
-		}
 	}
 }
 

Modified: branches/Cog/src/vm/cogit.h
===================================================================
--- branches/Cog/src/vm/cogit.h	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/src/vm/cogit.h	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CCodeGenerator VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
 
 

Modified: branches/Cog/src/vm/cogmethod.h
===================================================================
--- branches/Cog/src/vm/cogmethod.h	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/src/vm/cogmethod.h	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CCodeGenerator VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
 
 typedef struct {

Modified: branches/Cog/src/vm/cointerp.c
===================================================================
--- branches/Cog/src/vm/cointerp.c	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/src/vm/cointerp.c	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
    from
-	CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CoInterpreter VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1968,7 +1968,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.308]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.309]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -9596,22 +9596,36 @@
 
 static sqInt
 assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     char *callerFP;
     sqInt methodField;
     sqInt methodObj;
     sqInt prevFrameWasCogged;
     char *theFP;
     usqInt theIP;
-    char *theIPPtr;
     CogMethod *theMethod;
 
 	if (!(assertal(!(isFree(aStackPage)), ln))) {
 		return 0;
 	}
+
+	/* The top of stack of an inactive page is always the instructionPointer.
+	   The top of stack of the active page may be the instructionPointer if it has been pushed,
+	   which is indicated by a 0 instructionPointer. */
+
 	prevFrameWasCogged = 0;
-	theIPPtr = (aStackPage->headSP);
-	theFP = (aStackPage->headFP);
+	if ((GIV(stackPage) == aStackPage)
+	 && (GIV(instructionPointer) != 0)) {
+		theIP = GIV(instructionPointer);
+		theFP = GIV(framePointer);
+	}
+	else {
+		theIP = ((usqInt)(longAt((aStackPage->headSP))));
+		theFP = (aStackPage->headFP);
+		if (GIV(stackPage) == aStackPage) {
+			assert(GIV(framePointer) == theFP);
+		}
+	}
 	while (1) {
 		if ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())) {
 			/* begin mframeHomeMethod: */
@@ -9622,7 +9636,6 @@
 			}
 			theMethod = ((CogMethod *) (methodField & MFMethodMask));
 		l1:	/* end mframeHomeMethod: */;
-			theIP = ((usqInt)(longAt(theIPPtr)));
 			assertl((theIP == (ceCannotResumePC()))
 			 || (asserta((theIP >= (((usqInt)theMethod)))
 			 && (theIP < ((((usqInt)theMethod)) + ((theMethod->blockSize)))))), ln);
@@ -9632,7 +9645,6 @@
 
 			/* assert-check the interpreter frame. */
 
-			theIP = ((usqInt)(longAt(theIPPtr)));
 			/* begin iframeMethod: */
 			methodObj = ((usqInt) (longAt(theFP + FoxMethod)));
 			if (prevFrameWasCogged) {
@@ -9645,10 +9657,11 @@
 			 && (theIP < ((methodObj + (byteLengthOf(methodObj))) + BaseHeaderSize)), ln);
 			prevFrameWasCogged = 0;
 		}
+		theIP = ((usqInt)(longAt(theFP + FoxCallerSavedIP)));
 		if (!(((callerFP = frameCallerFP(theFP))) != 0)) break;
-		theIPPtr = theFP + FoxCallerSavedIP;
 		theFP = callerFP;
 	}
+	assertl(theIP == (ceBaseFrameReturnPC()), ln);
 	return 1;
 }
 
@@ -13504,7 +13517,6 @@
 	}
 	assertValidStackedInstructionPointers(__LINE__);
 	compactCogCompiledCode();
-	assertValidStackedInstructionPointers(__LINE__);
 	if (GIV(instructionPointer) != 0) {
 		/* begin popStack */
 		top = longAt(GIV(stackPointer));
@@ -13515,6 +13527,7 @@
 		 && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize)));
 		(GIV(stackPage)->headSP = GIV(stackPointer));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	GIV(statCodeCompactionCount) += 1;
 	GIV(statCodeCompactionUsecs) += (ioUTCMicrosecondsNow()) - startTime;
 	if (checkForLeaks != 0) {
@@ -17029,10 +17042,11 @@
 			}
 		}
 	}
-	if (!(((meth & 3) == 0)
-		 && (((((usqInt)meth)) >= (startOfMemory()))
-		 && (((((usqInt)meth)) < GIV(freeStart))
-		 && (((longAt(meth)) & TypeMask) != HeaderTypeGC))))) {
+	if (!((((meth & 3) == 0)
+ && (((((usqInt)meth)) >= (startOfMemory()))
+ && (((((usqInt)meth)) < GIV(freeStart))
+ && (((longAt(meth)) & TypeMask) != HeaderTypeGC))))
+		 && (((((usqInt) (longAt(meth))) >> 8) & 15) >= 12))) {
 		return GIV(nilObj);
 	}
 	return findClassContainingMethodstartingAt(meth, methodClassOf(meth));
@@ -38751,6 +38765,7 @@
 		theFP = pointerForOop(value2 - 1);
 		if ((theFP == GIV(framePointer))
 		 && (pageToStopOn == GIV(stackPage))) {
+			assertValidStackedInstructionPointersInline(GIV(stackPage), __LINE__);
 			if ((frameCallerFP(theFP)) != contextsFP) {
 				/* begin frameStackedReceiverOffsetNumArgs: */
 				numArgs = ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -38812,6 +38827,7 @@
 			/* begin pop: */
 			GIV(stackPointer) += 1 * BytesPerWord;
 			null;
+			assertValidStackedInstructionPointersInline(GIV(stackPage), __LINE__);
 			assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 			return;
 		}
@@ -38854,6 +38870,7 @@
 	else {
 		currentCtx = longAt((thisCtx + BaseHeaderSize) + (SenderIndex << ShiftForWord));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	if (contexthasSender(thisCtx, aContextOrNil)) {
 
 		/* Need to walk the stack freeing stack pages and nilling contexts. */
@@ -39004,6 +39021,7 @@
 	/* begin pop: */
 	GIV(stackPointer) += 1 * BytesPerWord;
 	null;
+	assertValidStackedInstructionPointers(__LINE__);
 	assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 }
 
@@ -40500,10 +40518,11 @@
 			}
 		}
 	}
-	if (!(((aMethod & 3) == 0)
-		 && (((((usqInt)aMethod)) >= (startOfMemory()))
-		 && (((((usqInt)aMethod)) < GIV(freeStart))
-		 && (((longAt(aMethod)) & TypeMask) != HeaderTypeGC))))) {
+	if (!((((aMethod & 3) == 0)
+ && (((((usqInt)aMethod)) >= (startOfMemory()))
+ && (((((usqInt)aMethod)) < GIV(freeStart))
+ && (((longAt(aMethod)) & TypeMask) != HeaderTypeGC))))
+		 && (((((usqInt) (longAt(aMethod))) >> 8) & 15) >= 12))) {
 		methClass = GIV(nilObj);
 		goto l1;
 	}

Modified: branches/Cog/src/vm/cointerp.h
===================================================================
--- branches/Cog/src/vm/cointerp.h	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/src/vm/cointerp.h	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
 
 

Modified: branches/Cog/src/vm/cointerpmt.c
===================================================================
--- branches/Cog/src/vm/cointerpmt.c	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/src/vm/cointerpmt.c	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
    from
-	CoInterpreterMT VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CoInterpreterMT VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
-static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1290,8 +1290,8 @@
 _iss char * framePointer;
 _iss StackPage * stackPage;
 _iss sqInt nilObj;
+_iss usqInt instructionPointer;
 _iss usqInt freeStart;
-_iss usqInt instructionPointer;
 _iss usqInt method;
 _iss sqInt argumentCount;
 _iss usqInt newMethod;
@@ -2067,7 +2067,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.308]";
+const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.309]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 sqInt willNotThreadWarnCount;
@@ -9697,22 +9697,36 @@
 
 static sqInt
 assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     char *callerFP;
     sqInt methodField;
     sqInt methodObj;
     sqInt prevFrameWasCogged;
     char *theFP;
     usqInt theIP;
-    char *theIPPtr;
     CogMethod *theMethod;
 
 	if (!(assertal(!(isFree(aStackPage)), ln))) {
 		return 0;
 	}
+
+	/* The top of stack of an inactive page is always the instructionPointer.
+	   The top of stack of the active page may be the instructionPointer if it has been pushed,
+	   which is indicated by a 0 instructionPointer. */
+
 	prevFrameWasCogged = 0;
-	theIPPtr = (aStackPage->headSP);
-	theFP = (aStackPage->headFP);
+	if ((GIV(stackPage) == aStackPage)
+	 && (GIV(instructionPointer) != 0)) {
+		theIP = GIV(instructionPointer);
+		theFP = GIV(framePointer);
+	}
+	else {
+		theIP = ((usqInt)(longAt((aStackPage->headSP))));
+		theFP = (aStackPage->headFP);
+		if (GIV(stackPage) == aStackPage) {
+			assert(GIV(framePointer) == theFP);
+		}
+	}
 	while (1) {
 		if ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())) {
 			/* begin mframeHomeMethod: */
@@ -9723,7 +9737,6 @@
 			}
 			theMethod = ((CogMethod *) (methodField & MFMethodMask));
 		l1:	/* end mframeHomeMethod: */;
-			theIP = ((usqInt)(longAt(theIPPtr)));
 			assertl((theIP == (ceCannotResumePC()))
 			 || (asserta((theIP >= (((usqInt)theMethod)))
 			 && (theIP < ((((usqInt)theMethod)) + ((theMethod->blockSize)))))), ln);
@@ -9733,7 +9746,6 @@
 
 			/* assert-check the interpreter frame. */
 
-			theIP = ((usqInt)(longAt(theIPPtr)));
 			/* begin iframeMethod: */
 			methodObj = ((usqInt) (longAt(theFP + FoxMethod)));
 			if (prevFrameWasCogged) {
@@ -9746,10 +9758,11 @@
 			 && (theIP < ((methodObj + (byteLengthOf(methodObj))) + BaseHeaderSize)), ln);
 			prevFrameWasCogged = 0;
 		}
+		theIP = ((usqInt)(longAt(theFP + FoxCallerSavedIP)));
 		if (!(((callerFP = frameCallerFP(theFP))) != 0)) break;
-		theIPPtr = theFP + FoxCallerSavedIP;
 		theFP = callerFP;
 	}
+	assertl(theIP == (ceBaseFrameReturnPC()), ln);
 	return 1;
 }
 
@@ -13931,7 +13944,6 @@
 	}
 	assertValidStackedInstructionPointers(__LINE__);
 	compactCogCompiledCode();
-	assertValidStackedInstructionPointers(__LINE__);
 	if (GIV(instructionPointer) != 0) {
 		/* begin popStack */
 		top = longAt(GIV(stackPointer));
@@ -13942,6 +13954,7 @@
 		 && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize)));
 		(GIV(stackPage)->headSP = GIV(stackPointer));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	GIV(statCodeCompactionCount) += 1;
 	GIV(statCodeCompactionUsecs) += (ioUTCMicrosecondsNow()) - startTime;
 	if (checkForLeaks != 0) {
@@ -17711,10 +17724,11 @@
 			}
 		}
 	}
-	if (!(((meth & 3) == 0)
-		 && (((((usqInt)meth)) >= (startOfMemory()))
-		 && (((((usqInt)meth)) < GIV(freeStart))
-		 && (((longAt(meth)) & TypeMask) != HeaderTypeGC))))) {
+	if (!((((meth & 3) == 0)
+ && (((((usqInt)meth)) >= (startOfMemory()))
+ && (((((usqInt)meth)) < GIV(freeStart))
+ && (((longAt(meth)) & TypeMask) != HeaderTypeGC))))
+		 && (((((usqInt) (longAt(meth))) >> 8) & 15) >= 12))) {
 		return GIV(nilObj);
 	}
 	return findClassContainingMethodstartingAt(meth, methodClassOf(meth));
@@ -40120,6 +40134,7 @@
 		theFP = pointerForOop(value2 - 1);
 		if ((theFP == GIV(framePointer))
 		 && (pageToStopOn == GIV(stackPage))) {
+			assertValidStackedInstructionPointersInline(GIV(stackPage), __LINE__);
 			if ((frameCallerFP(theFP)) != contextsFP) {
 				/* begin frameStackedReceiverOffsetNumArgs: */
 				numArgs = ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -40181,6 +40196,7 @@
 			/* begin pop: */
 			GIV(stackPointer) += 1 * BytesPerWord;
 			null;
+			assertValidStackedInstructionPointersInline(GIV(stackPage), __LINE__);
 			assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 			return;
 		}
@@ -40223,6 +40239,7 @@
 	else {
 		currentCtx = longAt((thisCtx + BaseHeaderSize) + (SenderIndex << ShiftForWord));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	if (contexthasSender(thisCtx, aContextOrNil)) {
 
 		/* Need to walk the stack freeing stack pages and nilling contexts. */
@@ -40373,6 +40390,7 @@
 	/* begin pop: */
 	GIV(stackPointer) += 1 * BytesPerWord;
 	null;
+	assertValidStackedInstructionPointers(__LINE__);
 	assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 }
 
@@ -41887,10 +41905,11 @@
 			}
 		}
 	}
-	if (!(((aMethod & 3) == 0)
-		 && (((((usqInt)aMethod)) >= (startOfMemory()))
-		 && (((((usqInt)aMethod)) < GIV(freeStart))
-		 && (((longAt(aMethod)) & TypeMask) != HeaderTypeGC))))) {
+	if (!((((aMethod & 3) == 0)
+ && (((((usqInt)aMethod)) >= (startOfMemory()))
+ && (((((usqInt)aMethod)) < GIV(freeStart))
+ && (((longAt(aMethod)) & TypeMask) != HeaderTypeGC))))
+		 && (((((usqInt) (longAt(aMethod))) >> 8) & 15) >= 12))) {
 		methClass = GIV(nilObj);
 		goto l1;
 	}

Modified: branches/Cog/src/vm/cointerpmt.h
===================================================================
--- branches/Cog/src/vm/cointerpmt.h	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/src/vm/cointerpmt.h	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
 
 

Modified: branches/Cog/src/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/src/vm/gcc3x-cointerp.c	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/src/vm/gcc3x-cointerp.c	2013-07-24 19:46:12 UTC (rev 2756)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
    from
-	CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CoInterpreter VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1971,7 +1971,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.308]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.309]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -9605,22 +9605,36 @@
 
 static sqInt
 assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     char *callerFP;
     sqInt methodField;
     sqInt methodObj;
     sqInt prevFrameWasCogged;
     char *theFP;
     usqInt theIP;
-    char *theIPPtr;
     CogMethod *theMethod;
 
 	if (!(assertal(!(isFree(aStackPage)), ln))) {
 		return 0;
 	}
+
+	/* The top of stack of an inactive page is always the instructionPointer.
+	   The top of stack of the active page may be the instructionPointer if it has been pushed,
+	   which is indicated by a 0 instructionPointer. */
+
 	prevFrameWasCogged = 0;
-	theIPPtr = (aStackPage->headSP);
-	theFP = (aStackPage->headFP);
+	if ((GIV(stackPage) == aStackPage)
+	 && (GIV(instructionPointer) != 0)) {
+		theIP = GIV(instructionPointer);
+		theFP = GIV(framePointer);
+	}
+	else {
+		theIP = ((usqInt)(longAt((aStackPage->headSP))));
+		theFP = (aStackPage->headFP);
+		if (GIV(stackPage) == aStackPage) {
+			assert(GIV(framePointer) == theFP);
+		}
+	}
 	while (1) {
 		if ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())) {
 			/* begin mframeHomeMethod: */
@@ -9631,7 +9645,6 @@
 			}
 			theMethod = ((CogMethod *) (methodField & MFMethodMask));
 		l1:	/* end mframeHomeMethod: */;
-			theIP = ((usqInt)(longAt(theIPPtr)));
 			assertl((theIP == (ceCannotResumePC()))
 			 || (asserta((theIP >= (((usqInt)theMethod)))
 			 && (theIP < ((((usqInt)theMethod)) + ((theMethod->blockSize)))))), ln);
@@ -9641,7 +9654,6 @@
 
 			/* assert-check the interpreter frame. */
 
-			theIP = ((usqInt)(longAt(theIPPtr)));
 			/* begin iframeMethod: */
 			methodObj = ((usqInt) (longAt(theFP + FoxMethod)));
 			if (prevFrameWasCogged) {
@@ -9654,10 +9666,11 @@
 			 && (theIP < ((methodObj + (byteLengthOf(methodObj))) + BaseHeaderSize)), ln);
 			prevFrameWasCogged = 0;
 		}
+		theIP = ((usqInt)(longAt(theFP + FoxCallerSavedIP)));
 		if (!(((callerFP = frameCallerFP(theFP))) != 0)) break;
-		theIPPtr = theFP + FoxCallerSavedIP;
 		theFP = callerFP;
 	}
+	assertl(theIP == (ceBaseFrameReturnPC()), ln);
 	return 1;
 }
 
@@ -13513,7 +13526,6 @@
 	}
 	assertValidStackedInstructionPointers(__LINE__);
 	compactCogCompiledCode();
-	assertValidStackedInstructionPointers(__LINE__);
 	if (GIV(instructionPointer) != 0) {
 		/* begin popStack */
 		top = longAt(GIV(stackPointer));
@@ -13524,6 +13536,7 @@
 		 && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize)));
 		(GIV(stackPage)->headSP = GIV(stackPointer));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	GIV(statCodeCompactionCount) += 1;
 	GIV(statCodeCompactionUsecs) += (ioUTCMicrosecondsNow()) - startTime;
 	if (checkForLeaks != 0) {
@@ -17038,10 +17051,11 @@
 			}
 		}
 	}
-	if (!(((meth & 3) == 0)
-		 && (((((usqInt)meth)) >= (startOfMemory()))
-		 && (((((usqInt)meth)) < GIV(freeStart))
-		 && (((longAt(meth)) & TypeMask) != HeaderTypeGC))))) {
+	if (!((((meth & 3) == 0)
+ && (((((usqInt)meth)) >= (startOfMemory()))
+ && (((((usqInt)meth)) < GIV(freeStart))
+ && (((longAt(meth)) & TypeMask) != HeaderTypeGC))))
+		 && (((((usqInt) (longAt(meth))) >> 8) & 15) >= 12))) {
 		return GIV(nilObj);
 	}
 	return findClassContainingMethodstartingAt(meth, methodClassOf(meth));
@@ -38760,6 +38774,7 @@
 		theFP = pointerForOop(value2 - 1);
 		if ((theFP == GIV(framePointer))
 		 && (pageToStopOn == GIV(stackPage))) {
+			assertValidStackedInstructionPointersInline(GIV(stackPage), __LINE__);
 			if ((frameCallerFP(theFP)) != contextsFP) {
 				/* begin frameStackedReceiverOffsetNumArgs: */
 				numArgs = ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -38821,6 +38836,7 @@
 			/* begin pop: */
 			GIV(stackPointer) += 1 * BytesPerWord;
 			null;
+			assertValidStackedInstructionPointersInline(GIV(stackPage), __LINE__);
 			assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 			return;
 		}
@@ -38863,6 +38879,7 @@
 	else {
 		currentCtx = longAt((thisCtx + BaseHeaderSize) + (SenderIndex << ShiftForWord));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	if (contexthasSender(thisCtx, aContextOrNil)) {
 
 		/* Need to walk the stack freeing stack pages and nilling contexts. */
@@ -39013,6 +39030,7 @@
 	/* begin pop: */
 	GIV(stackPointer) += 1 * BytesPerWord;
 	null;
+	assertValidStackedInstructionPointers(__LINE__);
 	assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 }
 
@@ -40509,10 +40527,11 @@
 			}
 		}
 	}
-	if (!(((aMethod & 3) == 0)
-		 && (((((usqInt)aMethod)) >= (startOfMemory()))
-		 && (((((usqInt)aMethod)) < GIV(freeStart))
-		 && (((longAt(aMethod)) & TypeMask) != HeaderTypeGC))))) {
+	if (!((((aMethod & 3) == 0)
+ && (((((usqInt)aMethod)) >= (startOfMemory()))
+ && (((((usqInt)aMethod)) < GIV(freeStart))
+ && (((longAt(aMethod)) & TypeMask) != HeaderTypeGC))))
+		 && (((((usqInt) (longAt(aMethod))) >> 8) & 15) >= 12))) {
 		methClass = GIV(nilObj);
 		goto l1;
 	}

Modified: branches/Cog/src/vm/gcc3x-cointerpmt.c
===================================================================
--- branches/Cog/src/vm/gcc3x-cointerpmt.c	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/src/vm/gcc3x-cointerpmt.c	2013-07-24 19:46:12 UTC (rev 2756)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
    from
-	CoInterpreterMT VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CoInterpreterMT VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
-static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1293,8 +1293,8 @@
 _iss char * framePointer;
 _iss StackPage * stackPage;
 _iss sqInt nilObj;
+_iss usqInt instructionPointer;
 _iss usqInt freeStart;
-_iss usqInt instructionPointer;
 _iss usqInt method;
 _iss sqInt argumentCount;
 _iss usqInt newMethod;
@@ -2070,7 +2070,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.308]";
+const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.309]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 sqInt willNotThreadWarnCount;
@@ -9706,22 +9706,36 @@
 
 static sqInt
 assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln)
-{
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
     char *callerFP;
     sqInt methodField;
     sqInt methodObj;
     sqInt prevFrameWasCogged;
     char *theFP;
     usqInt theIP;
-    char *theIPPtr;
     CogMethod *theMethod;
 
 	if (!(assertal(!(isFree(aStackPage)), ln))) {
 		return 0;
 	}
+
+	/* The top of stack of an inactive page is always the instructionPointer.
+	   The top of stack of the active page may be the instructionPointer if it has been pushed,
+	   which is indicated by a 0 instructionPointer. */
+
 	prevFrameWasCogged = 0;
-	theIPPtr = (aStackPage->headSP);
-	theFP = (aStackPage->headFP);
+	if ((GIV(stackPage) == aStackPage)
+	 && (GIV(instructionPointer) != 0)) {
+		theIP = GIV(instructionPointer);
+		theFP = GIV(framePointer);
+	}
+	else {
+		theIP = ((usqInt)(longAt((aStackPage->headSP))));
+		theFP = (aStackPage->headFP);
+		if (GIV(stackPage) == aStackPage) {
+			assert(GIV(framePointer) == theFP);
+		}
+	}
 	while (1) {
 		if ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())) {
 			/* begin mframeHomeMethod: */
@@ -9732,7 +9746,6 @@
 			}
 			theMethod = ((CogMethod *) (methodField & MFMethodMask));
 		l1:	/* end mframeHomeMethod: */;
-			theIP = ((usqInt)(longAt(theIPPtr)));
 			assertl((theIP == (ceCannotResumePC()))
 			 || (asserta((theIP >= (((usqInt)theMethod)))
 			 && (theIP < ((((usqInt)theMethod)) + ((theMethod->blockSize)))))), ln);
@@ -9742,7 +9755,6 @@
 
 			/* assert-check the interpreter frame. */
 
-			theIP = ((usqInt)(longAt(theIPPtr)));
 			/* begin iframeMethod: */
 			methodObj = ((usqInt) (longAt(theFP + FoxMethod)));
 			if (prevFrameWasCogged) {
@@ -9755,10 +9767,11 @@
 			 && (theIP < ((methodObj + (byteLengthOf(methodObj))) + BaseHeaderSize)), ln);
 			prevFrameWasCogged = 0;
 		}
+		theIP = ((usqInt)(longAt(theFP + FoxCallerSavedIP)));
 		if (!(((callerFP = frameCallerFP(theFP))) != 0)) break;
-		theIPPtr = theFP + FoxCallerSavedIP;
 		theFP = callerFP;
 	}
+	assertl(theIP == (ceBaseFrameReturnPC()), ln);
 	return 1;
 }
 
@@ -13940,7 +13953,6 @@
 	}
 	assertValidStackedInstructionPointers(__LINE__);
 	compactCogCompiledCode();
-	assertValidStackedInstructionPointers(__LINE__);
 	if (GIV(instructionPointer) != 0) {
 		/* begin popStack */
 		top = longAt(GIV(stackPointer));
@@ -13951,6 +13963,7 @@
 		 && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize)));
 		(GIV(stackPage)->headSP = GIV(stackPointer));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	GIV(statCodeCompactionCount) += 1;
 	GIV(statCodeCompactionUsecs) += (ioUTCMicrosecondsNow()) - startTime;
 	if (checkForLeaks != 0) {
@@ -17720,10 +17733,11 @@
 			}
 		}
 	}
-	if (!(((meth & 3) == 0)
-		 && (((((usqInt)meth)) >= (startOfMemory()))
-		 && (((((usqInt)meth)) < GIV(freeStart))
-		 && (((longAt(meth)) & TypeMask) != HeaderTypeGC))))) {
+	if (!((((meth & 3) == 0)
+ && (((((usqInt)meth)) >= (startOfMemory()))
+ && (((((usqInt)meth)) < GIV(freeStart))
+ && (((longAt(meth)) & TypeMask) != HeaderTypeGC))))
+		 && (((((usqInt) (longAt(meth))) >> 8) & 15) >= 12))) {
 		return GIV(nilObj);
 	}
 	return findClassContainingMethodstartingAt(meth, methodClassOf(meth));
@@ -40129,6 +40143,7 @@
 		theFP = pointerForOop(value2 - 1);
 		if ((theFP == GIV(framePointer))
 		 && (pageToStopOn == GIV(stackPage))) {
+			assertValidStackedInstructionPointersInline(GIV(stackPage), __LINE__);
 			if ((frameCallerFP(theFP)) != contextsFP) {
 				/* begin frameStackedReceiverOffsetNumArgs: */
 				numArgs = ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -40190,6 +40205,7 @@
 			/* begin pop: */
 			GIV(stackPointer) += 1 * BytesPerWord;
 			null;
+			assertValidStackedInstructionPointersInline(GIV(stackPage), __LINE__);
 			assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 			return;
 		}
@@ -40232,6 +40248,7 @@
 	else {
 		currentCtx = longAt((thisCtx + BaseHeaderSize) + (SenderIndex << ShiftForWord));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	if (contexthasSender(thisCtx, aContextOrNil)) {
 
 		/* Need to walk the stack freeing stack pages and nilling contexts. */
@@ -40382,6 +40399,7 @@
 	/* begin pop: */
 	GIV(stackPointer) += 1 * BytesPerWord;
 	null;
+	assertValidStackedInstructionPointers(__LINE__);
 	assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 }
 
@@ -41896,10 +41914,11 @@
 			}
 		}
 	}
-	if (!(((aMethod & 3) == 0)
-		 && (((((usqInt)aMethod)) >= (startOfMemory()))
-		 && (((((usqInt)aMethod)) < GIV(freeStart))
-		 && (((longAt(aMethod)) & TypeMask) != HeaderTypeGC))))) {
+	if (!((((aMethod & 3) == 0)
+ && (((((usqInt)aMethod)) >= (startOfMemory()))
+ && (((((usqInt)aMethod)) < GIV(freeStart))
+ && (((longAt(aMethod)) & TypeMask) != HeaderTypeGC))))
+		 && (((((usqInt) (longAt(aMethod))) >> 8) & 15) >= 12))) {
 		methClass = GIV(nilObj);
 		goto l1;
 	}

Modified: branches/Cog/src/vm/interp.h
===================================================================
--- branches/Cog/src/vm/interp.h	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/src/vm/interp.h	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/src/vm/vmCallback.h
===================================================================
--- branches/Cog/src/vm/vmCallback.h	2013-07-24 17:31:47 UTC (rev 2755)
+++ branches/Cog/src/vm/vmCallback.h	2013-07-24 19:46:12 UTC (rev 2756)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.309 uuid: 2ee24067-8c61-4855-b4b3-4bb419b4fe7f
  */
 
 #define VM_CALLBACK_INC 1



More information about the Vm-dev mailing list