[Vm-dev] [commit][2701] CogVM source as per VMMaker.oscog-eem.272.

commits at squeakvm.org commits at squeakvm.org
Fri Mar 8 23:43:48 UTC 2013


Revision: 2701
Author:   eliot
Date:     2013-03-08 15:43:09 -0800 (Fri, 08 Mar 2013)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.272.

Fix unknownBytecode processing to leave pc at unknown bytecode.
Fix case of process switch to an interior frame.
Fix some assert function signatures in the stack vm.
Use symbols for types instead of strings in stack page funcs.

Integrate VMMaker-oscog-EstebanLorenzano.235.
- it is possible to build stackvm again

Modified Paths:
--------------
    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/scripts/uploadvms
    branches/Cog/src/vm/cointerp.c
    branches/Cog/src/vm/cointerp.h
    branches/Cog/src/vm/cointerpmt.c
    branches/Cog/src/vm/cointerpmt.h
    branches/Cog/src/vm/gcc3x-cointerp.c
    branches/Cog/src/vm/gcc3x-cointerpmt.c
    branches/Cog/src/vm/interp.h
    branches/Cog/src/vm/vmCallback.h
    branches/Cog/stacksrc/vm/gcc3x-interp.c
    branches/Cog/stacksrc/vm/interp.c
    branches/Cog/stacksrc/vm/interp.h
    branches/Cog/stacksrc/vm/vmCallback.h

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

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2013-03-08 23:43:09 UTC (rev 2701)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
    from
-	CoInterpreter VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CoInterpreter VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1950,7 +1950,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.270";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.272";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -11629,13 +11629,13 @@
 			/* respondToUnknownBytecode */
 			{
 				sqInt ourContext;
-				sqInt unknownBytecodeSelector;
 
 				VM_LABEL(0respondToUnknownBytecode);
-				unknownBytecodeSelector = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
+				GIV(messageSelector) = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
 					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorUnknownBytecode << ShiftForWord))
 					: 0);
-				if (unknownBytecodeSelector == null) {
+				if ((GIV(messageSelector) == null)
+				 || (GIV(messageSelector) == GIV(nilObj))) {
 					error("Unknown bytecode");
 				}
 				/* begin ensureFrameIsMarried:SP: */
@@ -11649,11 +11649,11 @@
 				}
 				ourContext = marryFrameSP(localFP, localSP);
 			l283:	/* end ensureFrameIsMarried:SP: */;
+				localIP -= 1;
 				/* begin internalPush: */
 				longAtPointerput((localSP -= BytesPerOop), ourContext);
-				GIV(messageSelector) = unknownBytecodeSelector;
 				GIV(argumentCount) = 0;
-				goto commonSend;
+				goto normalSend;
 			}
 			break;
 		case 480: /*224*/
@@ -51767,7 +51767,10 @@
     sqInt aMethodObj;
     sqInt aProcess;
     sqInt index;
+    StackPage *lastUsedPage;
+    StackPage *lruOrFree;
     sqInt newContext;
+    StackPage *newPage;
     sqInt object;
     sqInt oldProc;
     sqInt sched;
@@ -51852,12 +51855,46 @@
 		assert((((((char *) theFrame)) >= (GIV(stackBasePlus1) - 1)) && ((((char *) theFrame)) <= (((char *) GIV(pages))))));
 		index = pageIndexForstackBasePlus1bytesPerPage(theFrame, GIV(stackBasePlus1), GIV(bytesPerPage));
 		thePage = stackPageAtpages(index, GIV(pages));
+		if (theFrame != ((thePage->headFP))) {
+
+			/* explicit assignment of suspendedContext can cause switch to interior frame. */
+
+			/* begin newStackPage */
+			lruOrFree = (mostRecentlyUsedPage()->nextPage);
+			if (isFree(lruOrFree)) {
+				newPage = lruOrFree;
+				goto l3;
+			}
+			divorceFramesIn(lruOrFree);
+			newPage = lruOrFree;
+		l3:	/* end newStackPage */;
+			moveFramesInthroughtoPage(thePage, findFrameAboveinPage(theFrame, thePage), newPage);
+			/* begin markStackPageLeastMostRecentlyUsed: */
+			VM_LABEL(0markStackPageLeastMostRecentlyUsed);
+			assert(newPage == ((GIV(mostRecentlyUsedPage)->nextPage)));
+			lastUsedPage = (newPage->nextPage);
+			while (((lastUsedPage->baseFP)) == 0) {
+				lastUsedPage = (lastUsedPage->nextPage);
+			}
+			if (((lastUsedPage->nextPage)) == newPage) {
+				null;
+				goto l2;
+			}
+			((newPage->prevPage)->nextPage = (newPage->nextPage));
+			((newPage->nextPage)->prevPage = (newPage->prevPage));
+			((lastUsedPage->prevPage)->nextPage = newPage);
+			(newPage->prevPage = (lastUsedPage->prevPage));
+			(newPage->nextPage = lastUsedPage);
+			(lastUsedPage->prevPage = newPage);
+			assert(pageListIsWellFormed());
+		l2:	/* end markStackPageLeastMostRecentlyUsed: */;
+		}
+		assert(((thePage->headFP)) == theFrame);
 	}
 	else {
 		thePage = makeBaseFrameFor(newContext);
 		theFrame = (thePage->baseFP);
 	}
-	assert(((thePage->headFP)) == theFrame);
 	/* begin setStackPageAndLimit: */
 	GIV(stackPage) = thePage;
 	if (GIV(stackLimit) != (((char *) (((usqInt) -1))))) {

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2013-03-08 23:43:09 UTC (rev 2701)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
 
 

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2013-03-08 23:43:09 UTC (rev 2701)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
    from
-	CoInterpreter VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CoInterpreter VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1953,7 +1953,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.270";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.272";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -11638,13 +11638,13 @@
 			/* respondToUnknownBytecode */
 			{
 				sqInt ourContext;
-				sqInt unknownBytecodeSelector;
 
 				VM_LABEL(0respondToUnknownBytecode);
-				unknownBytecodeSelector = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
+				GIV(messageSelector) = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
 					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorUnknownBytecode << ShiftForWord))
 					: 0);
-				if (unknownBytecodeSelector == null) {
+				if ((GIV(messageSelector) == null)
+				 || (GIV(messageSelector) == GIV(nilObj))) {
 					error("Unknown bytecode");
 				}
 				/* begin ensureFrameIsMarried:SP: */
@@ -11658,11 +11658,11 @@
 				}
 				ourContext = marryFrameSP(localFP, localSP);
 			l283:	/* end ensureFrameIsMarried:SP: */;
+				localIP -= 1;
 				/* begin internalPush: */
 				longAtPointerput((localSP -= BytesPerOop), ourContext);
-				GIV(messageSelector) = unknownBytecodeSelector;
 				GIV(argumentCount) = 0;
-				goto commonSend;
+				goto normalSend;
 			}
 			BREAK;
 		CASE(480) /*224*/
@@ -51776,7 +51776,10 @@
     sqInt aMethodObj;
     sqInt aProcess;
     sqInt index;
+    StackPage *lastUsedPage;
+    StackPage *lruOrFree;
     sqInt newContext;
+    StackPage *newPage;
     sqInt object;
     sqInt oldProc;
     sqInt sched;
@@ -51861,12 +51864,46 @@
 		assert((((((char *) theFrame)) >= (GIV(stackBasePlus1) - 1)) && ((((char *) theFrame)) <= (((char *) GIV(pages))))));
 		index = pageIndexForstackBasePlus1bytesPerPage(theFrame, GIV(stackBasePlus1), GIV(bytesPerPage));
 		thePage = stackPageAtpages(index, GIV(pages));
+		if (theFrame != ((thePage->headFP))) {
+
+			/* explicit assignment of suspendedContext can cause switch to interior frame. */
+
+			/* begin newStackPage */
+			lruOrFree = (mostRecentlyUsedPage()->nextPage);
+			if (isFree(lruOrFree)) {
+				newPage = lruOrFree;
+				goto l3;
+			}
+			divorceFramesIn(lruOrFree);
+			newPage = lruOrFree;
+		l3:	/* end newStackPage */;
+			moveFramesInthroughtoPage(thePage, findFrameAboveinPage(theFrame, thePage), newPage);
+			/* begin markStackPageLeastMostRecentlyUsed: */
+			VM_LABEL(0markStackPageLeastMostRecentlyUsed);
+			assert(newPage == ((GIV(mostRecentlyUsedPage)->nextPage)));
+			lastUsedPage = (newPage->nextPage);
+			while (((lastUsedPage->baseFP)) == 0) {
+				lastUsedPage = (lastUsedPage->nextPage);
+			}
+			if (((lastUsedPage->nextPage)) == newPage) {
+				null;
+				goto l2;
+			}
+			((newPage->prevPage)->nextPage = (newPage->nextPage));
+			((newPage->nextPage)->prevPage = (newPage->prevPage));
+			((lastUsedPage->prevPage)->nextPage = newPage);
+			(newPage->prevPage = (lastUsedPage->prevPage));
+			(newPage->nextPage = lastUsedPage);
+			(lastUsedPage->prevPage = newPage);
+			assert(pageListIsWellFormed());
+		l2:	/* end markStackPageLeastMostRecentlyUsed: */;
+		}
+		assert(((thePage->headFP)) == theFrame);
 	}
 	else {
 		thePage = makeBaseFrameFor(newContext);
 		theFrame = (thePage->baseFP);
 	}
-	assert(((thePage->headFP)) == theFrame);
 	/* begin setStackPageAndLimit: */
 	GIV(stackPage) = thePage;
 	if (GIV(stackLimit) != (((char *) (((usqInt) -1))))) {

Modified: branches/Cog/nscogsrc/vm/interp.h
===================================================================
--- branches/Cog/nscogsrc/vm/interp.h	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/nscogsrc/vm/interp.h	2013-03-08 23:43:09 UTC (rev 2701)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/nscogsrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nscogsrc/vm/vmCallback.h	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/nscogsrc/vm/vmCallback.h	2013-03-08 23:43:09 UTC (rev 2701)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
 
 #define VM_CALLBACK_INC 1


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Fri Mar  1 17:20:58 PST 2013
   + Fri Mar  8 15:40:04 PST 2013

Modified: branches/Cog/scripts/uploadvms
===================================================================
--- branches/Cog/scripts/uploadvms	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/scripts/uploadvms	2013-03-08 23:43:09 UTC (rev 2701)
@@ -110,4 +110,5 @@
 ssh -x eliotmiranda at bugsy.dreamhost.com mkdir mirandabanda.org/files/Cog/VM/VM.r$REV
 echo scp -p ChangeHistory README.$REV $ARCHIVES "$@" eliotmiranda at bugsy.dreamhost.com:mirandabanda.org/files/Cog/VM/VM.r$REV
 scp -p ChangeHistory README.$REV $ARCHIVES "$@" eliotmiranda at bugsy.dreamhost.com:mirandabanda.org/files/Cog/VM/VM.r$REV
-ssh eliotmiranda at bugsy.dreamhost.com chmod a-w mirandabanda.org/files/Cog/VM/VM.r$REV "mirandabanda.org/files/Cog/VM/VM.r$REV/*"
+echo ssh eliotmiranda at bugsy.dreamhost.com chmod a-w mirandabanda.org/files/Cog/VM/VM.r$REV mirandabanda.org/files/Cog/VM/VM.r$REV/* \\\; ls -al mirandabanda.org/files/Cog/VM/VM.r$REV
+ssh eliotmiranda at bugsy.dreamhost.com chmod a-w mirandabanda.org/files/Cog/VM/VM.r$REV \"mirandabanda.org/files/Cog/VM/VM.r$REV/*\" \; ls -al mirandabanda.org/files/Cog/VM/VM.r$REV

Modified: branches/Cog/src/vm/cointerp.c
===================================================================
--- branches/Cog/src/vm/cointerp.c	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/src/vm/cointerp.c	2013-03-08 23:43:09 UTC (rev 2701)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
    from
-	CoInterpreter VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CoInterpreter VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1940,7 +1940,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.270]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.272]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -4616,13 +4616,13 @@
 			/* respondToUnknownBytecode */
 			{
 				sqInt ourContext;
-				sqInt unknownBytecodeSelector;
 
 				VM_LABEL(0respondToUnknownBytecode);
-				unknownBytecodeSelector = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
+				GIV(messageSelector) = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
 					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorUnknownBytecode << ShiftForWord))
 					: 0);
-				if (unknownBytecodeSelector == null) {
+				if ((GIV(messageSelector) == null)
+				 || (GIV(messageSelector) == GIV(nilObj))) {
 					error("Unknown bytecode");
 				}
 				/* begin ensureFrameIsMarried:SP: */
@@ -4636,11 +4636,11 @@
 				}
 				ourContext = marryFrameSP(localFP, localSP);
 			l142:	/* end ensureFrameIsMarried:SP: */;
+				localIP -= 1;
 				/* begin internalPush: */
 				longAtPointerput((localSP -= BytesPerOop), ourContext);
-				GIV(messageSelector) = unknownBytecodeSelector;
 				GIV(argumentCount) = 0;
-				goto commonSend;
+				goto normalSend;
 			}
 			break;
 		case 128:
@@ -47198,7 +47198,10 @@
     sqInt aMethodObj;
     sqInt aProcess;
     sqInt index;
+    StackPage *lastUsedPage;
+    StackPage *lruOrFree;
     sqInt newContext;
+    StackPage *newPage;
     sqInt object;
     sqInt oldProc;
     sqInt sched;
@@ -47283,12 +47286,46 @@
 		assert((((((char *) theFrame)) >= (GIV(stackBasePlus1) - 1)) && ((((char *) theFrame)) <= (((char *) GIV(pages))))));
 		index = pageIndexForstackBasePlus1bytesPerPage(theFrame, GIV(stackBasePlus1), GIV(bytesPerPage));
 		thePage = stackPageAtpages(index, GIV(pages));
+		if (theFrame != ((thePage->headFP))) {
+
+			/* explicit assignment of suspendedContext can cause switch to interior frame. */
+
+			/* begin newStackPage */
+			lruOrFree = (mostRecentlyUsedPage()->nextPage);
+			if (isFree(lruOrFree)) {
+				newPage = lruOrFree;
+				goto l3;
+			}
+			divorceFramesIn(lruOrFree);
+			newPage = lruOrFree;
+		l3:	/* end newStackPage */;
+			moveFramesInthroughtoPage(thePage, findFrameAboveinPage(theFrame, thePage), newPage);
+			/* begin markStackPageLeastMostRecentlyUsed: */
+			VM_LABEL(0markStackPageLeastMostRecentlyUsed);
+			assert(newPage == ((GIV(mostRecentlyUsedPage)->nextPage)));
+			lastUsedPage = (newPage->nextPage);
+			while (((lastUsedPage->baseFP)) == 0) {
+				lastUsedPage = (lastUsedPage->nextPage);
+			}
+			if (((lastUsedPage->nextPage)) == newPage) {
+				null;
+				goto l2;
+			}
+			((newPage->prevPage)->nextPage = (newPage->nextPage));
+			((newPage->nextPage)->prevPage = (newPage->prevPage));
+			((lastUsedPage->prevPage)->nextPage = newPage);
+			(newPage->prevPage = (lastUsedPage->prevPage));
+			(newPage->nextPage = lastUsedPage);
+			(lastUsedPage->prevPage = newPage);
+			assert(pageListIsWellFormed());
+		l2:	/* end markStackPageLeastMostRecentlyUsed: */;
+		}
+		assert(((thePage->headFP)) == theFrame);
 	}
 	else {
 		thePage = makeBaseFrameFor(newContext);
 		theFrame = (thePage->baseFP);
 	}
-	assert(((thePage->headFP)) == theFrame);
 	/* begin setStackPageAndLimit: */
 	GIV(stackPage) = thePage;
 	if (GIV(stackLimit) != (((char *) (((usqInt) -1))))) {

Modified: branches/Cog/src/vm/cointerp.h
===================================================================
--- branches/Cog/src/vm/cointerp.h	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/src/vm/cointerp.h	2013-03-08 23:43:09 UTC (rev 2701)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
 
 

Modified: branches/Cog/src/vm/cointerpmt.c
===================================================================
--- branches/Cog/src/vm/cointerpmt.c	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/src/vm/cointerpmt.c	2013-03-08 23:43:09 UTC (rev 2701)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
    from
-	CoInterpreterMT VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CoInterpreterMT VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
-static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1278,8 +1278,8 @@
 _iss usqInt method;
 _iss sqInt argumentCount;
 _iss usqInt newMethod;
+_iss sqInt messageSelector;
 _iss usqInt youngStart;
-_iss sqInt messageSelector;
 _iss StackPage * pages;
 _iss char * stackBasePlus1;
 _iss sqInt traceLogIndex;
@@ -2039,7 +2039,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.270]";
+const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.272]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 sqInt willNotThreadWarnCount;
@@ -4717,13 +4717,13 @@
 			/* respondToUnknownBytecode */
 			{
 				sqInt ourContext;
-				sqInt unknownBytecodeSelector;
 
 				VM_LABEL(0respondToUnknownBytecode);
-				unknownBytecodeSelector = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
+				GIV(messageSelector) = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
 					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorUnknownBytecode << ShiftForWord))
 					: 0);
-				if (unknownBytecodeSelector == null) {
+				if ((GIV(messageSelector) == null)
+				 || (GIV(messageSelector) == GIV(nilObj))) {
 					error("Unknown bytecode");
 				}
 				/* begin ensureFrameIsMarried:SP: */
@@ -4737,11 +4737,11 @@
 				}
 				ourContext = marryFrameSP(localFP, localSP);
 			l142:	/* end ensureFrameIsMarried:SP: */;
+				localIP -= 1;
 				/* begin internalPush: */
 				longAtPointerput((localSP -= BytesPerOop), ourContext);
-				GIV(messageSelector) = unknownBytecodeSelector;
 				GIV(argumentCount) = 0;
-				goto commonSend;
+				goto normalSend;
 			}
 			break;
 		case 128:
@@ -17001,7 +17001,10 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt aMethodObj;
     sqInt index;
+    StackPage *lastUsedPage;
+    StackPage *lruOrFree;
     sqInt newContext;
+    StackPage *newPage;
     char *theFrame;
     StackPage *thePage;
     sqInt value;
@@ -17025,12 +17028,46 @@
 		assert((((((char *) theFrame)) >= (GIV(stackBasePlus1) - 1)) && ((((char *) theFrame)) <= (((char *) GIV(pages))))));
 		index = pageIndexForstackBasePlus1bytesPerPage(theFrame, GIV(stackBasePlus1), GIV(bytesPerPage));
 		thePage = stackPageAtpages(index, GIV(pages));
+		if (theFrame != ((thePage->headFP))) {
+
+			/* explicit assignment of suspendedContext can cause switch to interior frame. */
+
+			/* begin newStackPage */
+			lruOrFree = (mostRecentlyUsedPage()->nextPage);
+			if (isFree(lruOrFree)) {
+				newPage = lruOrFree;
+				goto l1;
+			}
+			divorceFramesIn(lruOrFree);
+			newPage = lruOrFree;
+		l1:	/* end newStackPage */;
+			moveFramesInthroughtoPage(thePage, findFrameAboveinPage(theFrame, thePage), newPage);
+			/* begin markStackPageLeastMostRecentlyUsed: */
+			VM_LABEL(0markStackPageLeastMostRecentlyUsed);
+			assert(newPage == ((GIV(mostRecentlyUsedPage)->nextPage)));
+			lastUsedPage = (newPage->nextPage);
+			while (((lastUsedPage->baseFP)) == 0) {
+				lastUsedPage = (lastUsedPage->nextPage);
+			}
+			if (((lastUsedPage->nextPage)) == newPage) {
+				null;
+				goto l2;
+			}
+			((newPage->prevPage)->nextPage = (newPage->nextPage));
+			((newPage->nextPage)->prevPage = (newPage->prevPage));
+			((lastUsedPage->prevPage)->nextPage = newPage);
+			(newPage->prevPage = (lastUsedPage->prevPage));
+			(newPage->nextPage = lastUsedPage);
+			(lastUsedPage->prevPage = newPage);
+			assert(pageListIsWellFormed());
+		l2:	/* end markStackPageLeastMostRecentlyUsed: */;
+		}
+		assert(((thePage->headFP)) == theFrame);
 	}
 	else {
 		thePage = makeBaseFrameFor(newContext);
 		theFrame = (thePage->baseFP);
 	}
-	assert(((thePage->headFP)) == theFrame);
 	/* begin setStackPageAndLimit: */
 	GIV(stackPage) = thePage;
 	if (GIV(stackLimit) != (((char *) (((usqInt) -1))))) {

Modified: branches/Cog/src/vm/cointerpmt.h
===================================================================
--- branches/Cog/src/vm/cointerpmt.h	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/src/vm/cointerpmt.h	2013-03-08 23:43:09 UTC (rev 2701)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
 
 

Modified: branches/Cog/src/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/src/vm/gcc3x-cointerp.c	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/src/vm/gcc3x-cointerp.c	2013-03-08 23:43:09 UTC (rev 2701)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
    from
-	CoInterpreter VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CoInterpreter VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1943,7 +1943,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.270]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.272]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -4625,13 +4625,13 @@
 			/* respondToUnknownBytecode */
 			{
 				sqInt ourContext;
-				sqInt unknownBytecodeSelector;
 
 				VM_LABEL(0respondToUnknownBytecode);
-				unknownBytecodeSelector = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
+				GIV(messageSelector) = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
 					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorUnknownBytecode << ShiftForWord))
 					: 0);
-				if (unknownBytecodeSelector == null) {
+				if ((GIV(messageSelector) == null)
+				 || (GIV(messageSelector) == GIV(nilObj))) {
 					error("Unknown bytecode");
 				}
 				/* begin ensureFrameIsMarried:SP: */
@@ -4645,11 +4645,11 @@
 				}
 				ourContext = marryFrameSP(localFP, localSP);
 			l142:	/* end ensureFrameIsMarried:SP: */;
+				localIP -= 1;
 				/* begin internalPush: */
 				longAtPointerput((localSP -= BytesPerOop), ourContext);
-				GIV(messageSelector) = unknownBytecodeSelector;
 				GIV(argumentCount) = 0;
-				goto commonSend;
+				goto normalSend;
 			}
 			BREAK;
 		CASE(128)
@@ -47207,7 +47207,10 @@
     sqInt aMethodObj;
     sqInt aProcess;
     sqInt index;
+    StackPage *lastUsedPage;
+    StackPage *lruOrFree;
     sqInt newContext;
+    StackPage *newPage;
     sqInt object;
     sqInt oldProc;
     sqInt sched;
@@ -47292,12 +47295,46 @@
 		assert((((((char *) theFrame)) >= (GIV(stackBasePlus1) - 1)) && ((((char *) theFrame)) <= (((char *) GIV(pages))))));
 		index = pageIndexForstackBasePlus1bytesPerPage(theFrame, GIV(stackBasePlus1), GIV(bytesPerPage));
 		thePage = stackPageAtpages(index, GIV(pages));
+		if (theFrame != ((thePage->headFP))) {
+
+			/* explicit assignment of suspendedContext can cause switch to interior frame. */
+
+			/* begin newStackPage */
+			lruOrFree = (mostRecentlyUsedPage()->nextPage);
+			if (isFree(lruOrFree)) {
+				newPage = lruOrFree;
+				goto l3;
+			}
+			divorceFramesIn(lruOrFree);
+			newPage = lruOrFree;
+		l3:	/* end newStackPage */;
+			moveFramesInthroughtoPage(thePage, findFrameAboveinPage(theFrame, thePage), newPage);
+			/* begin markStackPageLeastMostRecentlyUsed: */
+			VM_LABEL(0markStackPageLeastMostRecentlyUsed);
+			assert(newPage == ((GIV(mostRecentlyUsedPage)->nextPage)));
+			lastUsedPage = (newPage->nextPage);
+			while (((lastUsedPage->baseFP)) == 0) {
+				lastUsedPage = (lastUsedPage->nextPage);
+			}
+			if (((lastUsedPage->nextPage)) == newPage) {
+				null;
+				goto l2;
+			}
+			((newPage->prevPage)->nextPage = (newPage->nextPage));
+			((newPage->nextPage)->prevPage = (newPage->prevPage));
+			((lastUsedPage->prevPage)->nextPage = newPage);
+			(newPage->prevPage = (lastUsedPage->prevPage));
+			(newPage->nextPage = lastUsedPage);
+			(lastUsedPage->prevPage = newPage);
+			assert(pageListIsWellFormed());
+		l2:	/* end markStackPageLeastMostRecentlyUsed: */;
+		}
+		assert(((thePage->headFP)) == theFrame);
 	}
 	else {
 		thePage = makeBaseFrameFor(newContext);
 		theFrame = (thePage->baseFP);
 	}
-	assert(((thePage->headFP)) == theFrame);
 	/* begin setStackPageAndLimit: */
 	GIV(stackPage) = thePage;
 	if (GIV(stackLimit) != (((char *) (((usqInt) -1))))) {

Modified: branches/Cog/src/vm/gcc3x-cointerpmt.c
===================================================================
--- branches/Cog/src/vm/gcc3x-cointerpmt.c	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/src/vm/gcc3x-cointerpmt.c	2013-03-08 23:43:09 UTC (rev 2701)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
    from
-	CoInterpreterMT VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CoInterpreterMT VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
-static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1281,8 +1281,8 @@
 _iss usqInt method;
 _iss sqInt argumentCount;
 _iss usqInt newMethod;
+_iss sqInt messageSelector;
 _iss usqInt youngStart;
-_iss sqInt messageSelector;
 _iss StackPage * pages;
 _iss char * stackBasePlus1;
 _iss sqInt traceLogIndex;
@@ -2042,7 +2042,7 @@
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
 static usqInt heapBase;
-const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.270]";
+const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.272]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 sqInt willNotThreadWarnCount;
@@ -4726,13 +4726,13 @@
 			/* respondToUnknownBytecode */
 			{
 				sqInt ourContext;
-				sqInt unknownBytecodeSelector;
 
 				VM_LABEL(0respondToUnknownBytecode);
-				unknownBytecodeSelector = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
+				GIV(messageSelector) = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
 					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorUnknownBytecode << ShiftForWord))
 					: 0);
-				if (unknownBytecodeSelector == null) {
+				if ((GIV(messageSelector) == null)
+				 || (GIV(messageSelector) == GIV(nilObj))) {
 					error("Unknown bytecode");
 				}
 				/* begin ensureFrameIsMarried:SP: */
@@ -4746,11 +4746,11 @@
 				}
 				ourContext = marryFrameSP(localFP, localSP);
 			l142:	/* end ensureFrameIsMarried:SP: */;
+				localIP -= 1;
 				/* begin internalPush: */
 				longAtPointerput((localSP -= BytesPerOop), ourContext);
-				GIV(messageSelector) = unknownBytecodeSelector;
 				GIV(argumentCount) = 0;
-				goto commonSend;
+				goto normalSend;
 			}
 			BREAK;
 		CASE(128)
@@ -17010,7 +17010,10 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt aMethodObj;
     sqInt index;
+    StackPage *lastUsedPage;
+    StackPage *lruOrFree;
     sqInt newContext;
+    StackPage *newPage;
     char *theFrame;
     StackPage *thePage;
     sqInt value;
@@ -17034,12 +17037,46 @@
 		assert((((((char *) theFrame)) >= (GIV(stackBasePlus1) - 1)) && ((((char *) theFrame)) <= (((char *) GIV(pages))))));
 		index = pageIndexForstackBasePlus1bytesPerPage(theFrame, GIV(stackBasePlus1), GIV(bytesPerPage));
 		thePage = stackPageAtpages(index, GIV(pages));
+		if (theFrame != ((thePage->headFP))) {
+
+			/* explicit assignment of suspendedContext can cause switch to interior frame. */
+
+			/* begin newStackPage */
+			lruOrFree = (mostRecentlyUsedPage()->nextPage);
+			if (isFree(lruOrFree)) {
+				newPage = lruOrFree;
+				goto l1;
+			}
+			divorceFramesIn(lruOrFree);
+			newPage = lruOrFree;
+		l1:	/* end newStackPage */;
+			moveFramesInthroughtoPage(thePage, findFrameAboveinPage(theFrame, thePage), newPage);
+			/* begin markStackPageLeastMostRecentlyUsed: */
+			VM_LABEL(0markStackPageLeastMostRecentlyUsed);
+			assert(newPage == ((GIV(mostRecentlyUsedPage)->nextPage)));
+			lastUsedPage = (newPage->nextPage);
+			while (((lastUsedPage->baseFP)) == 0) {
+				lastUsedPage = (lastUsedPage->nextPage);
+			}
+			if (((lastUsedPage->nextPage)) == newPage) {
+				null;
+				goto l2;
+			}
+			((newPage->prevPage)->nextPage = (newPage->nextPage));
+			((newPage->nextPage)->prevPage = (newPage->prevPage));
+			((lastUsedPage->prevPage)->nextPage = newPage);
+			(newPage->prevPage = (lastUsedPage->prevPage));
+			(newPage->nextPage = lastUsedPage);
+			(lastUsedPage->prevPage = newPage);
+			assert(pageListIsWellFormed());
+		l2:	/* end markStackPageLeastMostRecentlyUsed: */;
+		}
+		assert(((thePage->headFP)) == theFrame);
 	}
 	else {
 		thePage = makeBaseFrameFor(newContext);
 		theFrame = (thePage->baseFP);
 	}
-	assert(((thePage->headFP)) == theFrame);
 	/* begin setStackPageAndLimit: */
 	GIV(stackPage) = thePage;
 	if (GIV(stackLimit) != (((char *) (((usqInt) -1))))) {

Modified: branches/Cog/src/vm/interp.h
===================================================================
--- branches/Cog/src/vm/interp.h	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/src/vm/interp.h	2013-03-08 23:43:09 UTC (rev 2701)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/src/vm/vmCallback.h
===================================================================
--- branches/Cog/src/vm/vmCallback.h	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/src/vm/vmCallback.h	2013-03-08 23:43:09 UTC (rev 2701)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.270 uuid: 014f0153-bb02-49b7-b544-d8f3ac2deef6
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
 
 #define VM_CALLBACK_INC 1

Modified: branches/Cog/stacksrc/vm/gcc3x-interp.c
===================================================================
--- branches/Cog/stacksrc/vm/gcc3x-interp.c	2013-03-07 22:33:19 UTC (rev 2700)
+++ branches/Cog/stacksrc/vm/gcc3x-interp.c	2013-03-08 23:43:09 UTC (rev 2701)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure * VMMaker.oscog-lw.263 uuid: bf23be20-f2a7-1040-a675-76e097a7f431
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
    from
-	StackInterpreter * VMMaker.oscog-lw.263 uuid: bf23be20-f2a7-1040-a675-76e097a7f431
+	StackInterpreter VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f
  */
-static char __buildInfo[] = "StackInterpreter * VMMaker.oscog-lw.263 uuid: bf23be20-f2a7-1040-a675-76e097a7f431 " __DATE__ ;
+static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.272 uuid: 8f4167f2-5bf0-4d90-9b7f-5355c741c68f " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -219,7 +219,7 @@
 #define MillisecondClockMask 0x1FFFFFFF
 #define MULTIPLEBYTECODESETS 0
 #define MyListIndex 3
-#define NewspeakVM 0
+#define NewspeakVM 1
 #define NextLinkIndex 0
 #define NilObject 0
 #define PrimErrBadArgument 3
@@ -255,6 +255,7 @@
 #define SelectorMustBeBoolean 25
 #define SelectorRunWithIn 49
 #define SelectorStart 2
+#define SelectorUnknownBytecode 57
 #define SenderIndex 0
 #define ShiftForWord 2
 #define Size4Bit 0
@@ -302,12 +303,13 @@
 void * arrayValueOf(sqInt arrayOop);
 static sqInt asciiOfCharacter(sqInt characterObj);
 void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp);
+static void assertValidExecutionPointersimbar(usqInt lip, char *lfp, char *lsp, sqInt inInterpreter);
 sqInt becomewith(sqInt array1, sqInt array2);
 static sqInt becomewithtwoWaycopyHash(sqInt array1, sqInt array2, sqInt twoWayFlag, sqInt copyHashFlag);
 void beRootIfOld(sqInt oop);
 static void beRootWhileForwarding(sqInt oop);
 sqInt booleanValueOf(sqInt obj);
-static sqInt byteLengthOf(sqInt oop);
+sqInt byteLengthOf(sqInt obj);
 sqInt byteSizeOf(sqInt oop);
 sqInt byteSwapped(sqInt w);
 EXPORT(sqInt) callbackEnter(sqInt *callbackID);
@@ -457,6 +459,7 @@
 static sqInt getShortFromFileswap(sqImageFile aFile, sqInt swapFlag);
 sqInt * getStackPointer(void);
 sqInt getThisSessionID(void);
+static sqInt goodContextSize(sqInt oop);
 static void handleStackOverflow(void);
 static sqInt handleStackOverflowOrEventAllowContextSwitch(sqInt mayContextSwitch);
 sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader);
@@ -492,7 +495,7 @@
 static sqInt isContextNonInt(sqInt oop);
 static sqInt isContext(sqInt oop);
 sqInt isFloatObject(sqInt oop);
-static sqInt isFree(StackPage *thePage);
+static sqInt isFree(StackPage * self_in_isFree);
 sqInt isIndexable(sqInt oop);
 sqInt isInMemory(sqInt address);
 sqInt isIntegerObject(sqInt objectPointer);
@@ -510,6 +513,7 @@
 static sqInt isPrimitiveFunctionPointerAnIndex(void);
 sqInt isQuickPrimitiveIndex(sqInt anInteger);
 static sqInt isSingleContext(sqInt aContext);
+static sqInt isStillMarriedContext(sqInt aContext);
 static sqInt isWeakNonInt(sqInt oop);
 sqInt isWeak(sqInt oop);
 static sqInt isWidowedContext(sqInt aOnceMarriedContext);
@@ -866,6 +870,7 @@
 void printStackPagesInUse(void);
 static void printStackPage(StackPage *page);
 static void printStringOf(sqInt oop);
+void printWronglySizedContexts(sqInt printContexts);
 void print(char *s);
 void pushBool(sqInt trueOrFalse);
 static sqInt pushedReceiverOrClosureOfFrame(char *theFP);
@@ -960,6 +965,7 @@
 static sqInt sweepPhase(void);
 static sqInt sweepPhaseForFullGC(void);
 static sqInt synchronousSignal(sqInt aSemaphore);
+sqInt temporaryCountOfMethodHeader(sqInt header);
 void tenuringIncrementalGC(void);
 sqInt topRemappableOop(void);
 static void transferTo(sqInt newProc);
@@ -968,7 +974,7 @@
 static void updatePointersInRootObjectsFromto(sqInt memStart, sqInt memEnd);
 static void updateStateOfSpouseContextForFrameWithSP(char *theFP, char *theSP);
 static sqInt validInstructionPointerinFrame(usqInt anInstrPointer, char *fp);
-sqInt validInstructionPointerinMethodframePointer(usqInt theInstrPointer, usqInt aMethod, sqInt fp);
+sqInt validInstructionPointerinMethodframePointer(usqInt theInstrPointer, usqInt aMethod, char *fp);
 static sqInt validStackPageBaseFrames(void);
 static void verifyCleanHeaders(void);
 sqInt vmEndianness(void);
@@ -986,8 +992,8 @@
 #else
 # define _iss static
 #endif
+_iss sqInt objectMemory;
 _iss char * stackPointer;
-_iss sqInt objectMemory;
 _iss sqInt primFailCode;
 _iss sqInt specialObjectsOop;
 _iss StackPage * stackPage;
@@ -1005,8 +1011,8 @@
 _iss sqInt falseObj;
 _iss StackPage * pages;
 _iss usqInt reserveStart;
+_iss char * stackMemory;
 _iss char * stackLimit;
-_iss char * stackMemory;
 _iss sqInt rootTableCount;
 _iss sqInt lkupClass;
 _iss sqInt bytesPerPage;
@@ -1014,12 +1020,12 @@
 _iss usqInt memoryLimit;
 _iss StackPage * mostRecentlyUsedPage;
 _iss usqInt scavengeThreshold;
+_iss sqInt coInterpreter;
 _iss sqInt jmpDepth;
 _iss usqInt fwdTableNext;
 _iss sqInt numStackPages;
 _iss sqInt needGCFlag;
 _iss sqLong nextProfileTick;
-_iss sqInt coInterpreter;
 _iss usqInt compStart;
 _iss sqInt numPages;
 _iss sqInt growHeadroom;
@@ -1046,6 +1052,7 @@
 _iss usqLong statGCEndUsecs;
 _iss sqInt statSweepCount;
 _iss usqInt compEnd;
+_iss sqInt heapMap;
 _iss sqInt metaclassSizeBits;
 _iss sqInt pendingFinalizationSignals;
 _iss sqInt shrinkThreshold;
@@ -1718,7 +1725,7 @@
  0 };
 char * breakSelector;
 sqInt breakSelectorLength = -1;
-const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreter * VMMaker.oscog-lw.263]";
+const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreter VMMaker.oscog-eem.272]";
 volatile int sendTrace;
 sqInt suppressHeartbeatFlag;
 
@@ -1729,6 +1736,7 @@
 #define compactClassFieldWidth() 5
 #define dispatchFunctionPointer(aFunctionPointer) (aFunctionPointer)()
 #define flush() fflush(stdout)
+#define freeStart() freeStart
 #define instFormatFieldLSB() 8
 #define instFormatFieldWidth() 4
 #define memory() memory
@@ -5076,12 +5084,39 @@
 			BREAK;
 		CASE(126)
 		CASE(127)
-		CASE(139)
 			/* unknownBytecode */
 			{
 				VM_LABEL(0unknownBytecode);
-				error("Unknown bytecode");
+				/* goto respondToUnknownBytecode */
 			}
+			
+		respondToUnknownBytecode:
+			/* respondToUnknownBytecode */
+			{
+				sqInt ourContext;
+
+				VM_LABEL(0respondToUnknownBytecode);
+				GIV(messageSelector) = (SelectorUnknownBytecode < (lengthOf(GIV(specialObjectsOop)))
+					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorUnknownBytecode << ShiftForWord))
+					: 0);
+				if ((GIV(messageSelector) == null)
+				 || (GIV(messageSelector) == GIV(nilObj))) {
+					error("Unknown bytecode");
+				}
+				/* begin ensureFrameIsMarried:SP: */
+				if ((byteAt((localFP + FoxFrameFlags) + 2)) != 0) {
+					assert(isContext(frameContext(localFP)));
+					ourContext = longAt(localFP + FoxThisContext);
+					goto l143;
+				}
+				ourContext = marryFrameSP(localFP, localSP);
+			l143:	/* end ensureFrameIsMarried:SP: */;
+				localIP -= 1;
+				/* begin internalPush: */
+				longAtPointerput((localSP -= BytesPerOop), ourContext);
+				GIV(argumentCount) = 0;
+				goto normalSend;
+			}
 			BREAK;
 		CASE(128)
 			/* extendedPushBytecode */
@@ -5340,7 +5375,7 @@
 					GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
 					primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
 					ok = 1;
-					goto l143;
+					goto l144;
 				}
 
 				/* second probe */
@@ -5351,7 +5386,7 @@
 					GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
 					primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
 					ok = 1;
-					goto l143;
+					goto l144;
 				}
 				probe = (((usqInt) hash) >> 2) & MethodCacheMask;
 				if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
@@ -5359,10 +5394,10 @@
 					GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
 					primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
 					ok = 1;
-					goto l143;
+					goto l144;
 				}
 				ok = 0;
-			l143:	/* end lookupInMethodCacheSel:class: */;
+			l144:	/* end lookupInMethodCacheSel:class: */;
 				if (!ok) {
 
 					/* entry was not found in the cache; look it up the hard way */
@@ -5390,31 +5425,31 @@
 						if (localPrimIndex >= 264) {
 							longAtPointerput(localSP, longAt(((longAtPointer(localSP)) + BaseHeaderSize) + ((localPrimIndex - 264) << ShiftForWord)));
 							1;
-							goto l145;
+							goto l146;
 						}
 						if (localPrimIndex == 256) {
 							1;
-							goto l145;
+							goto l146;
 						}
 						if (localPrimIndex == 257) {
 							longAtPointerput(localSP, GIV(trueObj));
 							1;
-							goto l145;
+							goto l146;
 						}
 						if (localPrimIndex == 258) {
 							longAtPointerput(localSP, GIV(falseObj));
 							1;
-							goto l145;
+							goto l146;
 						}
 						if (localPrimIndex == 259) {
 							longAtPointerput(localSP, GIV(nilObj));
 							1;
-							goto l145;
+							goto l146;
 						}
 						longAtPointerput(localSP, (((localPrimIndex - 261) << 1) | 1));
 						1;
-					l145:	/* end internalQuickPrimitiveResponse */;
-						goto l144;
+					l146:	/* end internalQuickPrimitiveResponse */;
+						goto l145;
 					}
 					/* begin externalizeIPandSP */
 					GIV(instructionPointer) = oopForPointer(localIP);
@@ -5452,7 +5487,7 @@
 					if (succeeded) {
 						browserPluginReturnIfNeeded();
 						null;
-						goto l144;
+						goto l145;
 					}
 				}
 				/* begin internalActivateNewMethod */
@@ -5549,11 +5584,11 @@
 								table = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (PrimErrTableIndex << ShiftForWord));
 								if (GIV(primFailCode) <= (((sqInt) (lastPointerOf(table)) >> 2))) {
 									errorCode = longAt((table + BaseHeaderSize) + ((GIV(primFailCode) - 1) << ShiftForWord));
-									goto l146;
+									goto l147;
 								}
 							}
 							errorCode = ((GIV(primFailCode) << 1) | 1);
-						l146:	/* end getErrorObjectFromPrimFailCode */;
+						l147:	/* end getErrorObjectFromPrimFailCode */;
 							longAtPointerput(localSP, errorCode);
 						}
 						GIV(primFailCode) = 0;
@@ -5573,7 +5608,7 @@
 					localSP = pointerForOop(GIV(stackPointer));
 					localFP = pointerForOop(GIV(framePointer));
 				}
-			l144:	/* end internalExecuteNewMethod */;
+			l145:	/* end internalExecuteNewMethod */;
 				/* begin fetchNextBytecode */
 				
 #        if MULTIPLEBYTECODESETS
@@ -5867,6 +5902,8 @@
 					localIP = pointerForOop(GIV(instructionPointer));
 					localSP = pointerForOop(GIV(stackPointer));
 					localFP = pointerForOop(GIV(framePointer));
+					markStackPageMostRecentlyUsed(GIV(stackPage));
+					assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 1);
 				l5:	/* end instVar:ofContext:put: */;
 				}
 				else {
@@ -6038,6 +6075,13 @@
 				longAtPointerput((localSP -= BytesPerOop), array);
 			}
 			BREAK;
+		CASE(139)
+			/* unknownBytecode */
+			{
+				VM_LABEL(1unknownBytecode);
+				goto respondToUnknownBytecode;
+			}
+			BREAK;
 		CASE(140)
 			/* pushRemoteTempLongBytecode */
 			{
@@ -7030,7 +7074,7 @@
 #            endif /* MULTIPLEBYTECODESETS */
 
 						null;
-						goto l147;
+						goto l148;
 					}
 					if (bytecode == 172) {
 
@@ -7048,7 +7092,7 @@
 #            endif /* MULTIPLEBYTECODESETS */
 
 						null;
-						goto l147;
+						goto l148;
 					}
 					if (bytecode > 167) {
 
@@ -7067,7 +7111,7 @@
 #            endif /* MULTIPLEBYTECODESETS */
 
 						null;
-						goto l147;
+						goto l148;
 					}
 				}
 				
@@ -7082,7 +7126,7 @@
 				/* begin internalPush: */
 				longAtPointerput((localSP -= BytesPerOop), GIV(trueObj));
 			}
-		l147:	/* end case */;
+		l148:	/* end case */;
 			BREAK;
 		CASE(179)
 			/* bytecodePrimGreaterThan */
@@ -7244,7 +7288,7 @@
 #          endif /* MULTIPLEBYTECODESETS */
 
 					null;
-					goto l148;
+					goto l149;
 				}
 				if (bytecode == 172) {
 
@@ -7263,7 +7307,7 @@
 #          endif /* MULTIPLEBYTECODESETS */
 
 					null;
-					goto l148;
+					goto l149;
 				}
 				
 #        if MULTIPLEBYTECODESETS
@@ -7277,7 +7321,7 @@
 				/* begin internalPush: */
 				longAtPointerput((localSP -= BytesPerOop), GIV(falseObj));
 			}
-		l148:	/* end case */;
+		l149:	/* end case */;
 			BREAK;
 		CASE(180)
 			/* bytecodePrimLessOrEqual */
@@ -9643,7 +9687,7 @@
 		l1:	/* end adjustFieldsAndClassOf:by: */;
 		}
 		/* begin objectAfter: */
-		if (!(asserta((((usqInt) oop)) < (((usqInt) GIV(freeStart)))))) {
+		if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
 			error("no objects after the end of memory");
 		}
 		if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
@@ -9822,26 +9866,30 @@
 
 void
 assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp)
+{
+	assertValidExecutionPointersimbar(lip, lifp, lisp, !0);
+}
+
+static void
+assertValidExecutionPointersimbar(usqInt lip, char *lfp, char *lsp, sqInt inInterpreter)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-	/* begin assertValidExecutionPointe:r:s:imbar: */
-	VM_LABEL(0assertValidExecutionPointersimbar);
-	assert(!0);
-	assert(GIV(stackPage) == (stackPageFor(lifp)));
+	assert(inInterpreter);
+	assert(GIV(stackPage) == (stackPageFor(lfp)));
 	assert(GIV(stackPage) == (mostRecentlyUsedPage()));
 	/* begin assertValidStackLimits */
 	assert((GIV(stackLimit) == ((GIV(stackPage)->realStackLimit)))
 	 || (GIV(stackLimit) == (((char *) (((usqInt) -1))))));
 	assert((((GIV(stackPage)->stackLimit)) == ((GIV(stackPage)->realStackLimit)))
 	 || (((GIV(stackPage)->stackLimit)) == (((char *) (((usqInt) -1))))));
-	assert(lifp < ((GIV(stackPage)->baseAddress)));
-	assert(lisp < lifp);
-	assert(lifp > lisp);
-	assert(lisp >= (((GIV(stackPage)->realStackLimit)) - (stackLimitOffset())));
-	assert((lifp - lisp) < LargeContextSize);
-	assert(validInstructionPointerinFrame(lip, lifp));
-	assert((frameIsBlockActivation(lifp))
-	 || ((pushedReceiverOrClosureOfFrame(lifp)) == (frameReceiver(lifp))));
-	assert(GIV(method) == (frameMethod(lifp)));
+	assert(lfp < ((GIV(stackPage)->baseAddress)));
+	assert(lsp < lfp);
+	assert(lfp > lsp);
+	assert(lsp >= (((GIV(stackPage)->realStackLimit)) - (stackLimitOffset())));
+	assert((lfp - lsp) < LargeContextSize);
+	assert(validInstructionPointerinFrame(lip, lfp));
+	assert((frameIsBlockActivation(lfp))
+	 || ((pushedReceiverOrClosureOfFrame(lfp)) == (frameReceiver(lfp))));
+	assert(GIV(method) == (frameMethod(lfp)));
 	
 #  if MULTIPLEBYTECODESETS
 	assert((methodUsesAlternateBytecodeSet(GIV(method))) == (bytecodeSetSelector == 256));
@@ -9887,6 +9935,9 @@
     sqInt header;
     sqInt numLiterals;
     sqInt objHeader;
+    sqInt objHeader1;
+    sqInt objHeader11;
+    sqInt objHeader2;
     sqInt objHeaderBytes;
     sqInt objHeaderType;
     sqInt objSize;
@@ -10003,13 +10054,27 @@
 				fwdBlock = (fwdHeader & AllButMarkBitAndTypeMask) << 1;
 				assert((fwdHeader & MarkBit) != 0);
 				assert(fwdBlockValid(fwdBlock));
-				longAtput(oop1, longAt(fwdBlock + BytesPerWord));
+				objHeader = longAt(fwdBlock + BytesPerWord);
+				/* begin restoreHeaderOf:to: */
+				longAtput(oop1, objHeader);
+				if (((((usqInt) objHeader) >> 12) & 31) == ClassMethodContextCompactIndex) {
+					if (!(asserta(!(isStillMarriedContext(oop1))))) {
+						error("attempt to become married context");
+					}
+				}
 				/* begin restoreHeaderOf: */
 				fwdHeader1 = longAt(oop2);
 				fwdBlock1 = (fwdHeader1 & AllButMarkBitAndTypeMask) << 1;
 				assert((fwdHeader1 & MarkBit) != 0);
 				assert(fwdBlockValid(fwdBlock1));
-				longAtput(oop2, longAt(fwdBlock1 + BytesPerWord));
+				objHeader1 = longAt(fwdBlock1 + BytesPerWord);
+				/* begin restoreHeaderOf:to: */
+				longAtput(oop2, objHeader1);
+				if (((((usqInt) objHeader1) >> 12) & 31) == ClassMethodContextCompactIndex) {
+					if (!(asserta(!(isStillMarriedContext(oop2))))) {
+						error("attempt to become married context");
+					}
+				}
 				hdr1 = longAt(oop1);
 				hdr2 = longAt(oop2);
 				longAtput(oop1, (hdr1 & AllButHashBits) | (hdr2 & HashBits));
@@ -10038,7 +10103,14 @@
 			fwdBlock11 = (fwdHeader2 & AllButMarkBitAndTypeMask) << 1;
 			assert((fwdHeader2 & MarkBit) != 0);
 			assert(fwdBlockValid(fwdBlock11));
-			longAtput(oop11, longAt(fwdBlock11 + BytesPerWord));
+			objHeader2 = longAt(fwdBlock11 + BytesPerWord);
+			/* begin restoreHeaderOf:to: */
+			longAtput(oop11, objHeader2);
+			if (((((usqInt) objHeader2) >> 12) & 31) == ClassMethodContextCompactIndex) {
+				if (!(asserta(!(isStillMarriedContext(oop11))))) {
+					error("attempt to become married context");
+				}
+			}
 			if (copyHashFlag) {
 
 				/* Change the hash of the new oop (oop2) to be that of the old (oop1)
@@ -10049,18 +10121,24 @@
 				longAtput(oop21, (hdr21 & AllButHashBits) | (hdr11 & HashBits));
 			}
 			/* begin freeObject: */
-			VM_LABEL(0freeObject);
-			objHeader = longAt(oop11);
-			if ((objHeader & RootBit) != 0) {
+			objHeader11 = longAt(oop11);
+			/* begin freeObject:header: */
+			VM_LABEL(0freeObjectheader);
+			if (((((usqInt) objHeader11) >> 12) & 31) == ClassMethodContextCompactIndex) {
+				if (!(asserta(!(isStillMarriedContext(oop11))))) {
+					error("attempt to free married context");
+				}
+			}
+			if ((objHeader11 & RootBit) != 0) {
 				removeYoungRoot(oop11);
 			}
-			objHeaderType = objHeader & TypeMask;
+			objHeaderType = objHeader11 & TypeMask;
 			objHeaderBytes = headerTypeBytes[objHeaderType];
 			if ((objHeaderType & 1) == 1) {
 
 				/* HeaderTypeClass or HeaderTypeShort */
 
-				objSize = objHeader & SizeMask;
+				objSize = objHeader11 & SizeMask;
 			}
 			else {
 				if (objHeaderType == HeaderTypeFree) {
@@ -10071,7 +10149,7 @@
 			}
 			assert(((objSize + objHeaderBytes) & AllButTypeMask) == (objSize + objHeaderBytes));
 			longAtput(oop11 - objHeaderBytes, (objSize + objHeaderBytes) | HeaderTypeFree);
-		l1:	/* end freeObject: */;
+		l1:	/* end freeObject:header: */;

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list