[Vm-dev] [commit][2754] CogVM source as per VMMaker.oscog-eem.308

commits at squeakvm.org commits at squeakvm.org
Wed Jul 24 00:31:57 UTC 2013


Revision: 2754
Author:   eliot
Date:     2013-07-23 17:31:56 -0700 (Tue, 23 Jul 2013)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.308

Add an assert that checks all the instructionPointers in all stack
pages.  Use the assert in code compaction.  (tracking down a rare
crash at Cadence).

Beef up the assertValidExecutionPointe:r:s:imbar:line: assert for
interpreted frames (i.e. check savedIP if pc is ceRetrnToInterpreter)

Freshen the translation of some of the VM plugins (for loop limit issue).

Add new run & single-step prims to the processor sumlator plugins so access to
memory past freeStart can be checked if needed.

Modified Paths:
--------------
    branches/Cog/nscogsrc/plugins/B2DPlugin/B2DPlugin.c
    branches/Cog/nscogsrc/plugins/FilePlugin/FilePlugin.c
    branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c
    branches/Cog/nscogsrc/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c
    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/plugins/B2DPlugin/B2DPlugin.c
    branches/Cog/src/plugins/BochsIA32Plugin/BochsIA32Plugin.c
    branches/Cog/src/plugins/FilePlugin/FilePlugin.c
    branches/Cog/src/plugins/GdbARMPlugin/GdbARMPlugin.c
    branches/Cog/src/plugins/LargeIntegers/LargeIntegers.c
    branches/Cog/src/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c
    branches/Cog/src/vm/cointerp.c
    branches/Cog/src/vm/cointerp.h
    branches/Cog/src/vm/cointerpmt.c
    branches/Cog/src/vm/cointerpmt.h
    branches/Cog/src/vm/gcc3x-cointerp.c
    branches/Cog/src/vm/gcc3x-cointerpmt.c
    branches/Cog/src/vm/interp.h
    branches/Cog/src/vm/vmCallback.h

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

Modified: branches/Cog/nscogsrc/plugins/B2DPlugin/B2DPlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/B2DPlugin/B2DPlugin.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/nscogsrc/plugins/B2DPlugin/B2DPlugin.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	VMPluginCodeGenerator VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
    from
-	BalloonEnginePlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	BalloonEnginePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
  */
-static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ;
+static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9 " __DATE__ ;
 
 
 
@@ -835,9 +835,9 @@
 static void * loadBBFn;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"B2DPlugin VMMaker.oscog-eem.235 (i)"
+	"B2DPlugin VMMaker.oscog-eem.307 (i)"
 #else
-	"B2DPlugin VMMaker.oscog-eem.235 (e)"
+	"B2DPlugin VMMaker.oscog-eem.307 (e)"
 #endif
 ;
 static int* objBuffer;
@@ -7188,13 +7188,14 @@
     sqInt bmWidth;
     sqInt formOop;
     sqInt i;
+    sqInt iLimiT;
     sqInt ppw;
 
 	if (!(isArray(arrayOop))) {
 		return 0;
 	}
 	formArray = arrayOop;
-	for (i = 0; i <= ((slotSizeOf(formArray)) - 1); i += 1) {
+	for (i = 0, iLimiT = ((slotSizeOf(formArray)) - 1); i <= iLimiT; i += 1) {
 		formOop = fetchPointerofObject(i, formArray);
 		if (isIntegerObject(formOop)) {
 			return 0;

Modified: branches/Cog/nscogsrc/plugins/FilePlugin/FilePlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/FilePlugin/FilePlugin.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/nscogsrc/plugins/FilePlugin/FilePlugin.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	VMPluginCodeGenerator VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
    from
-	FilePlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	FilePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
  */
-static char __buildInfo[] = "FilePlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ;
+static char __buildInfo[] = "FilePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9 " __DATE__ ;
 
 
 
@@ -176,9 +176,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"FilePlugin VMMaker.oscog-eem.235 (i)"
+	"FilePlugin VMMaker.oscog-eem.307 (i)"
 #else
-	"FilePlugin VMMaker.oscog-eem.235 (e)"
+	"FilePlugin VMMaker.oscog-eem.307 (e)"
 #endif
 ;
 static void * sCCPfn;
@@ -1077,10 +1077,9 @@
 primitiveFileWrite(void)
 {
     sqInt array;
-    char *arrayIndex;
-    size_t byteSize;
     sqInt bytesWritten;
     size_t count;
+    size_t elementSize;
     SQFile *file;
     sqInt objectPointer;
     size_t startIndex;
@@ -1098,29 +1097,21 @@
 	}
 	file = firstIndexableField(objectPointer);
 l1:	/* end fileValueOf: */;
-	if (!(isWordsOrBytes(array))) {
-		return primitiveFail();
+	if ((failed())
+	 || (!(isWordsOrBytes(array)))) {
+		return primitiveFailFor(PrimErrBadArgument);
 	}
-	if (isWords(array)) {
-		byteSize = 4;
-	}
-	else {
-		byteSize = 1;
-	}
+	elementSize = (isWords(array)
+		? 4
+		: 1);
 	if (!((startIndex >= 1)
 		 && (((startIndex + count) - 1) <= (slotSizeOf(array))))) {
-		return primitiveFail();
+		return primitiveFailFor(PrimErrBadIndex);
 	}
+	bytesWritten = sqFileWriteFromAt(file, count * elementSize, ((char *) (firstIndexableField(array))), (startIndex - 1) * elementSize);
 	if (!(failed())) {
-
-		/* Note: adjust startIndex for zero-origin indexing */
-
-		arrayIndex = firstIndexableField(array);
-		bytesWritten = sqFileWriteFromAt(file, count * byteSize, arrayIndex, (startIndex - 1) * byteSize);
+		popthenPush(5, integerObjectOf(bytesWritten / elementSize));
 	}
-	if (!(failed())) {
-		popthenPush(5, integerObjectOf(bytesWritten / byteSize));
-	}
 }
 
 EXPORT(sqInt)

Modified: branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c
===================================================================
--- branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
+	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
    from
-	LargeIntegersPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
+	LargeIntegersPlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
  */
-static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022 " __DATE__ ;
+static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9 " __DATE__ ;
 
 
 
@@ -175,9 +175,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"LargeIntegers v1.5 VMMaker.oscog-eem.246 (i)"
+	"LargeIntegers v1.5 VMMaker.oscog-eem.307 (i)"
 #else
-	"LargeIntegers v1.5 VMMaker.oscog-eem.246 (e)"
+	"LargeIntegers v1.5 VMMaker.oscog-eem.307 (e)"
 #endif
 ;
 static const int  orOpIndex = 1;
@@ -264,6 +264,7 @@
 {
 	sqInt class;
 	sqInt ix;
+	sqInt ixLimiT;
 	sqInt newBytes;
 	unsigned char *   pByte;
 	sqInt val;
@@ -279,7 +280,7 @@
 		newBytes = instantiateClassindexableSize(class, len);
 		/* begin cCopyIntVal:toBytes: */
 		pByte = firstIndexableField(newBytes);
-		for (ix = 1; ix <= (cDigitLengthOfCSI(val)); ix += 1) {
+		for (ix = 1, ixLimiT = (cDigitLengthOfCSI(val)); ix <= ixLimiT; ix += 1) {
 			pByte[ix - 1] = (cDigitOfCSIat(val, ix));
 		}
 	}
@@ -638,10 +639,11 @@
 cCopyIntValtoBytes(sqInt val, sqInt bytes)
 {
 	sqInt ix;
+	sqInt ixLimiT;
 	unsigned char *   pByte;
 
 	pByte = firstIndexableField(bytes);
-	for (ix = 1; ix <= (cDigitLengthOfCSI(val)); ix += 1) {
+	for (ix = 1, ixLimiT = (cDigitLengthOfCSI(val)); ix <= ixLimiT; ix += 1) {
 		pByte[ix - 1] = (cDigitOfCSIat(val, ix));
 	}
 }

Modified: branches/Cog/nscogsrc/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/nscogsrc/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,13 +1,13 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.248 uuid: 325b96ad-3c25-438e-af36-04a93839f195
+	VMPluginCodeGenerator VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
    from
-	MiscPrimitivePlugin VMMaker.oscog-eem.248 uuid: 325b96ad-3c25-438e-af36-04a93839f195
+	MiscPrimitivePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
 	Bitmap * Graphics-ar.142 uuid: 9a11fdac-93ce-8344-877f-55d10866f795
 	ByteArray * Collections-eem.375 uuid: c9da6558-3bd7-4f0f-b0e5-bc21208275f0
 	ByteString * Collections-eem.375 uuid: c9da6558-3bd7-4f0f-b0e5-bc21208275f0
 	SampledSound * Sound-ar.30 uuid: c0c6133c-73b7-7b47-9858-99b64868d35c
  */
-static char __buildInfo[] = "MiscPrimitivePlugin VMMaker.oscog-eem.248 uuid: 325b96ad-3c25-438e-af36-04a93839f195\n\
+static char __buildInfo[] = "MiscPrimitivePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9\n\
 Bitmap * Graphics-ar.142 uuid: 9a11fdac-93ce-8344-877f-55d10866f795\n\
 ByteArray * Collections-eem.375 uuid: c9da6558-3bd7-4f0f-b0e5-bc21208275f0\n\
 ByteString * Collections-eem.375 uuid: c9da6558-3bd7-4f0f-b0e5-bc21208275f0\n\
@@ -95,9 +95,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"MiscPrimitivePlugin VMMaker.oscog-eem.248 (i)"
+	"MiscPrimitivePlugin VMMaker.oscog-eem.307 (i)"
 #else
-	"MiscPrimitivePlugin VMMaker.oscog-eem.248 (e)"
+	"MiscPrimitivePlugin VMMaker.oscog-eem.307 (e)"
 #endif
 ;
 
@@ -761,6 +761,7 @@
     sqInt rcvr;
     sqInt start;
     sqInt startIndex;
+    sqInt startIndexLimiT;
 
 	rcvr = stackValue(4);
 	if (!(isBytes(stackValue(3)))) {
@@ -790,7 +791,7 @@
 		pushInteger(0);
 		return null;
 	}
-	for (startIndex = start; startIndex <= (((sizeOfSTArrayFromCPrimitive(body + 1)) - (sizeOfSTArrayFromCPrimitive(key + 1))) + 1); startIndex += 1) {
+	for (startIndex = start, startIndexLimiT = (((sizeOfSTArrayFromCPrimitive(body + 1)) - (sizeOfSTArrayFromCPrimitive(key + 1))) + 1); startIndex <= startIndexLimiT; startIndex += 1) {
 		index = 1;
 		while ((matchTable[(asciiValue(body[(startIndex + index) - 1])) + 1]) == (matchTable[(asciiValue(key[index])) + 1])) {
 			if (index == (sizeOfSTArrayFromCPrimitive(key + 1))) {

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
    from
-	CoInterpreter VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -366,6 +366,8 @@
 void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp);
 static void assertValidExecutionPointersimbarline(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter, sqInt ln);
 void assertValidMachineCodeFrame(sqInt instrPtr);
+static sqInt assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln);
+static void assertValidStackedInstructionPointers(sqInt ln);
 static void assertValidStackLimits(sqInt ln);
 static void attemptToSwitchToMachineCode(sqInt bcpc);
 sqInt becomewith(sqInt array1, sqInt array2);
@@ -1976,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.306";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.308";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -13402,6 +13404,7 @@
     CogMethod *cogMethod;
     sqInt methodField;
     sqInt methodField1;
+    sqInt savedIP;
 
 	assertl(GIV(stackPage) == (stackPageFor(lifp)), ln);
 	assertl(GIV(stackPage) == (mostRecentlyUsedPage()), ln);
@@ -13419,7 +13422,12 @@
 
 		if ((assertal((((usqInt)methodField)) > (startOfMemory()), ln))
 		 && (assertal((((usqInt)methodField)) < (freeStart()), ln))) {
-			if (lip != (ceReturnToInterpreterPC())) {
+			if (lip == (ceReturnToInterpreterPC())) {
+				savedIP = longAt(lifp + FoxIFSavedIP);
+				assertl((savedIP >= (((methodField + (lastPointerOf(methodField))) + BaseHeaderSize) - 1))
+				 && (savedIP < ((methodField + (byteLengthOf(methodField))) + BaseHeaderSize)), ln);
+			}
+			else {
 				assertl((lip >= (((methodField + (lastPointerOf(methodField))) + BaseHeaderSize) - 1))
 				 && (lip < ((methodField + (byteLengthOf(methodField))) + BaseHeaderSize)), ln);
 			}
@@ -13478,6 +13486,88 @@
 }
 
 
+/*	Check that the stacked instruction pointers in the given page are correct.
+	Checks the interpreter sender/machine code callee contract. */
+
+static sqInt
+assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln)
+{
+    char *callerFP;
+    sqInt methodField;
+    sqInt methodObj;
+    sqInt prevFrameWasCogged;
+    char *theFP;
+    usqInt theIP;
+    char *theIPPtr;
+    CogMethod *theMethod;
+
+	if (!(assertal(!(isFree(aStackPage)), ln))) {
+		return 0;
+	}
+	prevFrameWasCogged = 0;
+	theIPPtr = (aStackPage->headSP);
+	theFP = (aStackPage->headFP);
+	while (1) {
+		if ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())) {
+			/* begin mframeHomeMethod: */
+			methodField = longAt(theFP + FoxMethod);
+			if ((methodField & MFMethodFlagIsBlockFlag) != 0) {
+				theMethod = cmHomeMethod(((CogBlockMethod *) (methodField & MFMethodMask)));
+				goto l1;
+			}
+			theMethod = ((CogMethod *) (methodField & MFMethodMask));
+		l1:	/* end mframeHomeMethod: */;
+			theIP = ((usqInt)(longAt(theIPPtr)));
+			assertl((theIP == (ceCannotResumePC()))
+			 || (asserta((theIP >= (((usqInt)theMethod)))
+			 && (theIP < ((((usqInt)theMethod)) + ((theMethod->blockSize)))))), ln);
+			prevFrameWasCogged = 1;
+		}
+		else {
+
+			/* assert-check the interpreter frame. */
+
+			theIP = ((usqInt)(longAt(theIPPtr)));
+			/* begin iframeMethod: */
+			methodObj = ((usqInt) (longAt(theFP + FoxMethod)));
+			if (prevFrameWasCogged) {
+				assertl(theIP == (ceReturnToInterpreterPC()), ln);
+			}
+			if (theIP == (ceReturnToInterpreterPC())) {
+				theIP = longAt(theFP + FoxIFSavedIP);
+			}
+			assertl((theIP >= (((methodObj + (lastPointerOf(methodObj))) + BaseHeaderSize) - 1))
+			 && (theIP < ((methodObj + (byteLengthOf(methodObj))) + BaseHeaderSize)), ln);
+			prevFrameWasCogged = 0;
+		}
+		if (!(((callerFP = frameCallerFP(theFP))) != 0)) break;
+		theIPPtr = theFP + FoxCallerSavedIP;
+		theFP = callerFP;
+	}
+	return 1;
+}
+
+
+/*	Check that the stacked instruction pointers in all pages are correct.
+	Checks the interpreter sender/machine code callee contract.
+	Written so it will be optimized away if not in an assert VM. */
+
+static void
+assertValidStackedInstructionPointers(sqInt ln)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt i;
+    StackPage *thePage;
+
+	for (i = 0; i <= (GIV(numStackPages) - 1); i += 1) {
+		/* begin stackPageAt: */
+		thePage = stackPageAtpages(i, GIV(pages));
+		if (!(isFree(thePage))) {
+			assertl(assertValidStackedInstructionPointersInline(thePage, ln), ln);
+		}
+	}
+}
+
+
 /*	Order in the stackLimit checks is important because stackLimit is smashed
 	by interrupts. So always check for unsmashed value first to avoid race
 	condition. 
@@ -14332,6 +14422,7 @@
     char *sp1;
     char *sp2;
     char *sp3;
+    char *theFP;
     StackPage *thePage;
     sqInt value;
 
@@ -14381,13 +14472,14 @@
 			   Make the interior frame the top frame. */
 
 			/* begin findFrameAbove:inPage: */
+			theFP = GIV(framePointer);
 			fp = (thePage->headFP);
-			if (fp == GIV(framePointer)) {
+			if (fp == theFP) {
 				frameAbove = 0;
 				goto l1;
 			}
 			while (((callerFP = frameCallerFP(fp))) != 0) {
-				if (callerFP == GIV(framePointer)) {
+				if (callerFP == theFP) {
 					frameAbove = fp;
 					goto l1;
 				}
@@ -17485,7 +17577,9 @@
 		 && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize)));
 		(GIV(stackPage)->headSP = GIV(stackPointer));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	compactCogCompiledCode();
+	assertValidStackedInstructionPointers(__LINE__);
 	if (GIV(instructionPointer) != 0) {
 		/* begin popStack */
 		top = longAt(GIV(stackPointer));
@@ -19659,7 +19753,6 @@
 		/* begin reverseBytesFrom:to: */
 		startAddr = startOfMemory();
 		stopAddr1 = freeStart();
-		flag("Dan");
 		addr = startAddr;
 		while ((((usqInt) addr)) < (((usqInt) stopAddr1))) {
 			longAtput(addr, byteSwapped(longAt(addr)));
@@ -19693,7 +19786,6 @@
 					}
 					/* begin reverseBytesFrom:to: */
 					stopAddr11 = oop1 + (sizeBitsOf(oop1));
-					flag("Dan");
 					addr2 = wordAddr;
 					while ((((usqInt) addr2)) < (((usqInt) stopAddr11))) {
 						longAtput(addr2, byteSwapped(longAt(addr2)));
@@ -25548,7 +25640,6 @@
 		/* Not readable -- try again with reversed bytes... */
 
 		/* begin reverseBytesFrom:to: */
-		flag("Dan");
 		addr1 = segmentWordArray + BaseHeaderSize;
 		while ((((usqInt) addr1)) < (((usqInt) (endSeg + BytesPerWord)))) {
 			longAtput(addr1, byteSwapped(longAt(addr1)));
@@ -25566,7 +25657,6 @@
 			/* Still NG -- put things back and fail */
 
 			/* begin reverseBytesFrom:to: */
-			flag("Dan");
 			addr = segmentWordArray + BaseHeaderSize;
 			while ((((usqInt) addr)) < (((usqInt) (endSeg + BytesPerWord)))) {
 				longAtput(addr, byteSwapped(longAt(addr)));
@@ -25652,7 +25742,6 @@
 					}
 					/* begin reverseBytesFrom:to: */
 					stopAddr1 = oop1 + (sizeBitsOf(oop1));
-					flag("Dan");
 					addr2 = wordAddr;
 					while ((((usqInt) addr2)) < (((usqInt) stopAddr1))) {
 						longAtput(addr2, byteSwapped(longAt(addr2)));

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
  */
 
 

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
    from
-	CoInterpreter VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -369,6 +369,8 @@
 void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp);
 static void assertValidExecutionPointersimbarline(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter, sqInt ln);
 void assertValidMachineCodeFrame(sqInt instrPtr);
+static sqInt assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln);
+static void assertValidStackedInstructionPointers(sqInt ln);
 static void assertValidStackLimits(sqInt ln);
 static void attemptToSwitchToMachineCode(sqInt bcpc);
 sqInt becomewith(sqInt array1, sqInt array2);
@@ -1979,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.306";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.308";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -13411,6 +13413,7 @@
     CogMethod *cogMethod;
     sqInt methodField;
     sqInt methodField1;
+    sqInt savedIP;
 
 	assertl(GIV(stackPage) == (stackPageFor(lifp)), ln);
 	assertl(GIV(stackPage) == (mostRecentlyUsedPage()), ln);
@@ -13428,7 +13431,12 @@
 
 		if ((assertal((((usqInt)methodField)) > (startOfMemory()), ln))
 		 && (assertal((((usqInt)methodField)) < (freeStart()), ln))) {
-			if (lip != (ceReturnToInterpreterPC())) {
+			if (lip == (ceReturnToInterpreterPC())) {
+				savedIP = longAt(lifp + FoxIFSavedIP);
+				assertl((savedIP >= (((methodField + (lastPointerOf(methodField))) + BaseHeaderSize) - 1))
+				 && (savedIP < ((methodField + (byteLengthOf(methodField))) + BaseHeaderSize)), ln);
+			}
+			else {
 				assertl((lip >= (((methodField + (lastPointerOf(methodField))) + BaseHeaderSize) - 1))
 				 && (lip < ((methodField + (byteLengthOf(methodField))) + BaseHeaderSize)), ln);
 			}
@@ -13487,6 +13495,88 @@
 }
 
 
+/*	Check that the stacked instruction pointers in the given page are correct.
+	Checks the interpreter sender/machine code callee contract. */
+
+static sqInt
+assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln)
+{
+    char *callerFP;
+    sqInt methodField;
+    sqInt methodObj;
+    sqInt prevFrameWasCogged;
+    char *theFP;
+    usqInt theIP;
+    char *theIPPtr;
+    CogMethod *theMethod;
+
+	if (!(assertal(!(isFree(aStackPage)), ln))) {
+		return 0;
+	}
+	prevFrameWasCogged = 0;
+	theIPPtr = (aStackPage->headSP);
+	theFP = (aStackPage->headFP);
+	while (1) {
+		if ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())) {
+			/* begin mframeHomeMethod: */
+			methodField = longAt(theFP + FoxMethod);
+			if ((methodField & MFMethodFlagIsBlockFlag) != 0) {
+				theMethod = cmHomeMethod(((CogBlockMethod *) (methodField & MFMethodMask)));
+				goto l1;
+			}
+			theMethod = ((CogMethod *) (methodField & MFMethodMask));
+		l1:	/* end mframeHomeMethod: */;
+			theIP = ((usqInt)(longAt(theIPPtr)));
+			assertl((theIP == (ceCannotResumePC()))
+			 || (asserta((theIP >= (((usqInt)theMethod)))
+			 && (theIP < ((((usqInt)theMethod)) + ((theMethod->blockSize)))))), ln);
+			prevFrameWasCogged = 1;
+		}
+		else {
+
+			/* assert-check the interpreter frame. */
+
+			theIP = ((usqInt)(longAt(theIPPtr)));
+			/* begin iframeMethod: */
+			methodObj = ((usqInt) (longAt(theFP + FoxMethod)));
+			if (prevFrameWasCogged) {
+				assertl(theIP == (ceReturnToInterpreterPC()), ln);
+			}
+			if (theIP == (ceReturnToInterpreterPC())) {
+				theIP = longAt(theFP + FoxIFSavedIP);
+			}
+			assertl((theIP >= (((methodObj + (lastPointerOf(methodObj))) + BaseHeaderSize) - 1))
+			 && (theIP < ((methodObj + (byteLengthOf(methodObj))) + BaseHeaderSize)), ln);
+			prevFrameWasCogged = 0;
+		}
+		if (!(((callerFP = frameCallerFP(theFP))) != 0)) break;
+		theIPPtr = theFP + FoxCallerSavedIP;
+		theFP = callerFP;
+	}
+	return 1;
+}
+
+
+/*	Check that the stacked instruction pointers in all pages are correct.
+	Checks the interpreter sender/machine code callee contract.
+	Written so it will be optimized away if not in an assert VM. */
+
+static void
+assertValidStackedInstructionPointers(sqInt ln)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt i;
+    StackPage *thePage;
+
+	for (i = 0; i <= (GIV(numStackPages) - 1); i += 1) {
+		/* begin stackPageAt: */
+		thePage = stackPageAtpages(i, GIV(pages));
+		if (!(isFree(thePage))) {
+			assertl(assertValidStackedInstructionPointersInline(thePage, ln), ln);
+		}
+	}
+}
+
+
 /*	Order in the stackLimit checks is important because stackLimit is smashed
 	by interrupts. So always check for unsmashed value first to avoid race
 	condition. 
@@ -14341,6 +14431,7 @@
     char *sp1;
     char *sp2;
     char *sp3;
+    char *theFP;
     StackPage *thePage;
     sqInt value;
 
@@ -14390,13 +14481,14 @@
 			   Make the interior frame the top frame. */
 
 			/* begin findFrameAbove:inPage: */
+			theFP = GIV(framePointer);
 			fp = (thePage->headFP);
-			if (fp == GIV(framePointer)) {
+			if (fp == theFP) {
 				frameAbove = 0;
 				goto l1;
 			}
 			while (((callerFP = frameCallerFP(fp))) != 0) {
-				if (callerFP == GIV(framePointer)) {
+				if (callerFP == theFP) {
 					frameAbove = fp;
 					goto l1;
 				}
@@ -17494,7 +17586,9 @@
 		 && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize)));
 		(GIV(stackPage)->headSP = GIV(stackPointer));
 	}
+	assertValidStackedInstructionPointers(__LINE__);
 	compactCogCompiledCode();
+	assertValidStackedInstructionPointers(__LINE__);
 	if (GIV(instructionPointer) != 0) {
 		/* begin popStack */
 		top = longAt(GIV(stackPointer));
@@ -19668,7 +19762,6 @@
 		/* begin reverseBytesFrom:to: */
 		startAddr = startOfMemory();
 		stopAddr1 = freeStart();
-		flag("Dan");
 		addr = startAddr;
 		while ((((usqInt) addr)) < (((usqInt) stopAddr1))) {
 			longAtput(addr, byteSwapped(longAt(addr)));
@@ -19702,7 +19795,6 @@
 					}
 					/* begin reverseBytesFrom:to: */
 					stopAddr11 = oop1 + (sizeBitsOf(oop1));
-					flag("Dan");
 					addr2 = wordAddr;
 					while ((((usqInt) addr2)) < (((usqInt) stopAddr11))) {
 						longAtput(addr2, byteSwapped(longAt(addr2)));
@@ -25557,7 +25649,6 @@
 		/* Not readable -- try again with reversed bytes... */
 
 		/* begin reverseBytesFrom:to: */
-		flag("Dan");
 		addr1 = segmentWordArray + BaseHeaderSize;
 		while ((((usqInt) addr1)) < (((usqInt) (endSeg + BytesPerWord)))) {
 			longAtput(addr1, byteSwapped(longAt(addr1)));
@@ -25575,7 +25666,6 @@
 			/* Still NG -- put things back and fail */
 
 			/* begin reverseBytesFrom:to: */
-			flag("Dan");
 			addr = segmentWordArray + BaseHeaderSize;
 			while ((((usqInt) addr)) < (((usqInt) (endSeg + BytesPerWord)))) {
 				longAtput(addr, byteSwapped(longAt(addr)));
@@ -25661,7 +25751,6 @@
 					}
 					/* begin reverseBytesFrom:to: */
 					stopAddr1 = oop1 + (sizeBitsOf(oop1));
-					flag("Dan");
 					addr2 = wordAddr;
 					while ((((usqInt) addr2)) < (((usqInt) stopAddr1))) {
 						longAtput(addr2, byteSwapped(longAt(addr2)));

Modified: branches/Cog/nscogsrc/vm/interp.h
===================================================================
--- branches/Cog/nscogsrc/vm/interp.h	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/nscogsrc/vm/interp.h	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/nscogsrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nscogsrc/vm/vmCallback.h	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/nscogsrc/vm/vmCallback.h	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
  */
 
 #define VM_CALLBACK_INC 1


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Thu Jul 18 12:44:57 PDT 2013
   + Tue Jul 23 17:29:18 PDT 2013

Modified: branches/Cog/src/plugins/B2DPlugin/B2DPlugin.c
===================================================================
--- branches/Cog/src/plugins/B2DPlugin/B2DPlugin.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/src/plugins/B2DPlugin/B2DPlugin.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	VMPluginCodeGenerator VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
    from
-	BalloonEnginePlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	BalloonEnginePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
  */
-static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ;
+static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9 " __DATE__ ;
 
 
 
@@ -835,9 +835,9 @@
 static void * loadBBFn;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"B2DPlugin VMMaker.oscog-eem.235 (i)"
+	"B2DPlugin VMMaker.oscog-eem.307 (i)"
 #else
-	"B2DPlugin VMMaker.oscog-eem.235 (e)"
+	"B2DPlugin VMMaker.oscog-eem.307 (e)"
 #endif
 ;
 static int* objBuffer;
@@ -7188,13 +7188,14 @@
     sqInt bmWidth;
     sqInt formOop;
     sqInt i;
+    sqInt iLimiT;
     sqInt ppw;
 
 	if (!(isArray(arrayOop))) {
 		return 0;
 	}
 	formArray = arrayOop;
-	for (i = 0; i <= ((slotSizeOf(formArray)) - 1); i += 1) {
+	for (i = 0, iLimiT = ((slotSizeOf(formArray)) - 1); i <= iLimiT; i += 1) {
 		formOop = fetchPointerofObject(i, formArray);
 		if (isIntegerObject(formOop)) {
 			return 0;

Modified: branches/Cog/src/plugins/BochsIA32Plugin/BochsIA32Plugin.c
===================================================================
--- branches/Cog/src/plugins/BochsIA32Plugin/BochsIA32Plugin.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/src/plugins/BochsIA32Plugin/BochsIA32Plugin.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,9 +1,12 @@
-/* Automatically generated from Squeak on {14 December 2012 . 1:58:06 pm} */
+/* Automatically generated by
+	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
+   from
+	BochsIA32Plugin Cog-eem.61 uuid: 3dba03de-7a41-4da2-bdf4-d8276f5665da
+ */
+static char __buildInfo[] = "BochsIA32Plugin Cog-eem.61 uuid: 3dba03de-7a41-4da2-bdf4-d8276f5665da " __DATE__ ;
 
-static char __buildInfo[] = "Generated on {14 December 2012 . 1:58:06 pm}. Compiled on "__DATE__ ;
 
 
-
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -54,7 +57,9 @@
 EXPORT(sqInt) primitiveFlushICacheFromTo(void);
 EXPORT(sqInt) primitiveNewCPU(void);
 EXPORT(sqInt) primitiveResetCPU(void);
+EXPORT(sqInt) primitiveRunInMemoryMinAddressMaxAddressReadWrite(void);
 EXPORT(sqInt) primitiveRunInMemoryMinimumAddressReadWrite(void);
+EXPORT(sqInt) primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite(void);
 EXPORT(sqInt) primitiveSingleStepInMemoryMinimumAddressReadWrite(void);
 EXPORT(sqInt) setInterpreter(struct VirtualMachine*anInterpreter);
 static sqInt sizeField(sqInt rcvr);
@@ -116,9 +121,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"BochsIA32Plugin 14 December 2012 (i)"
+	"BochsIA32Plugin Cog-eem.61 (i)"
 #else
-	"BochsIA32Plugin 14 December 2012 (e)"
+	"BochsIA32Plugin Cog-eem.61 (e)"
 #endif
 ;
 
@@ -352,12 +357,68 @@
 /*	<Bitmap|ByteArray|WordArray> */
 /*	<Integer> */
 /*	<Integer> */
+/*	<Integer> */
 /*	Run the cpu using the first argument as the memory and the following
 	arguments defining valid addresses, running until it halts or hits an
 	exception. 
  */
 
 EXPORT(sqInt)
+primitiveRunInMemoryMinAddressMaxAddressReadWrite(void)
+{
+	void *cpu;
+	sqInt cpuAlien;
+	unsigned long maxAddress;
+	sqInt maybeErr;
+	char *memory;
+	sqInt memorySize;
+	unsigned long minAddress;
+	unsigned long minWriteMaxExecAddress;
+
+	success(isWordsOrBytes(stackValue(3)));
+	memory = ((char *) (firstIndexableField(stackValue(3))));
+	minAddress = positive32BitValueOf(stackValue(2));
+	maxAddress = positive32BitValueOf(stackValue(1));
+	minWriteMaxExecAddress = positive32BitValueOf(stackValue(0));
+	cpuAlien = stackValue(4);
+	if (failed()) {
+		return null;
+	}
+	if (((cpu = ((longAt(cpuAlien + BaseHeaderSize)) > 0
+	? (cpuAlien + BaseHeaderSize) + BytesPerOop
+	: longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))) == 0) {
+		primitiveFailFor(PrimErrBadReceiver);
+		return null;
+	}
+	prevInterruptCheckChain = setInterruptCheckChain(forceStopOnInterrupt);
+	if (prevInterruptCheckChain == (forceStopOnInterrupt)) {
+		prevInterruptCheckChain == 0;
+	}
+	memorySize = byteSizeOf(((sqInt)(long)(memory) - 4));
+	maybeErr = runCPUInSizeMinAddressReadWrite(cpu, memory, ((memorySize < maxAddress) ? memorySize : maxAddress), minAddress, minWriteMaxExecAddress);
+	setInterruptCheckChain(prevInterruptCheckChain);
+	if (maybeErr != 0) {
+		primitiveFailFor(PrimErrInappropriate);
+		return null;
+	}
+	if (failed()) {
+		return null;
+	}
+	popthenPush(5, cpuAlien);
+	return null;
+}
+
+
+/*	cpuAlien <BochsIA32Alien> */
+/*	<Bitmap|ByteArray|WordArray> */
+/*	<Integer> */
+/*	<Integer> */
+/*	Run the cpu using the first argument as the memory and the following
+	arguments defining valid addresses, running until it halts or hits an
+	exception. 
+ */
+
+EXPORT(sqInt)
 primitiveRunInMemoryMinimumAddressReadWrite(void)
 {
 	void *cpu;
@@ -403,11 +464,61 @@
 /*	<Bitmap|ByteArray|WordArray> */
 /*	<Integer> */
 /*	<Integer> */
+/*	<Integer> */
 /*	Single-step the cpu using the first argument as the memory and the
 	following arguments defining valid addresses.
  */
 
 EXPORT(sqInt)
+primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite(void)
+{
+	void *cpu;
+	sqInt cpuAlien;
+	unsigned long maxAddress;
+	sqInt maybeErr;
+	char *memory;
+	sqInt memorySize;
+	unsigned long minAddress;
+	unsigned long minWriteMaxExecAddress;
+
+	success(isWordsOrBytes(stackValue(3)));
+	memory = ((char *) (firstIndexableField(stackValue(3))));
+	minAddress = positive32BitValueOf(stackValue(2));
+	maxAddress = positive32BitValueOf(stackValue(1));
+	minWriteMaxExecAddress = positive32BitValueOf(stackValue(0));
+	cpuAlien = stackValue(4);
+	if (failed()) {
+		return null;
+	}
+	if (((cpu = ((longAt(cpuAlien + BaseHeaderSize)) > 0
+	? (cpuAlien + BaseHeaderSize) + BytesPerOop
+	: longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))) == 0) {
+		primitiveFailFor(PrimErrBadReceiver);
+		return null;
+	}
+	memorySize = byteSizeOf(((sqInt)(long)(memory) - 4));
+	maybeErr = singleStepCPUInSizeMinAddressReadWrite(cpu, memory, ((memorySize < maxAddress) ? memorySize : maxAddress), minAddress, minWriteMaxExecAddress);
+	if (maybeErr != 0) {
+		primitiveFailFor(PrimErrInappropriate);
+		return null;
+	}
+	if (failed()) {
+		return null;
+	}
+	popthenPush(5, cpuAlien);
+	return null;
+}
+
+
+/*	cpuAlien <BochsIA32Alien> */
+/*	<Bitmap|ByteArray|WordArray> */
+/*	<Integer> */
+/*	<Integer> */
+/*	Single-step the cpu using the first argument as the memory and the
+	following arguments defining valid addresses.
+ */
+
+EXPORT(sqInt)
 primitiveSingleStepInMemoryMinimumAddressReadWrite(void)
 {
 	void *cpu;
@@ -525,7 +636,9 @@
 	{"BochsIA32Plugin", "primitiveFlushICacheFromTo", (void*)primitiveFlushICacheFromTo},
 	{"BochsIA32Plugin", "primitiveNewCPU", (void*)primitiveNewCPU},
 	{"BochsIA32Plugin", "primitiveResetCPU", (void*)primitiveResetCPU},
+	{"BochsIA32Plugin", "primitiveRunInMemoryMinAddressMaxAddressReadWrite", (void*)primitiveRunInMemoryMinAddressMaxAddressReadWrite},
 	{"BochsIA32Plugin", "primitiveRunInMemoryMinimumAddressReadWrite", (void*)primitiveRunInMemoryMinimumAddressReadWrite},
+	{"BochsIA32Plugin", "primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite", (void*)primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite},
 	{"BochsIA32Plugin", "primitiveSingleStepInMemoryMinimumAddressReadWrite", (void*)primitiveSingleStepInMemoryMinimumAddressReadWrite},
 	{"BochsIA32Plugin", "setInterpreter", (void*)setInterpreter},
 	{NULL, NULL, NULL}

Modified: branches/Cog/src/plugins/FilePlugin/FilePlugin.c
===================================================================
--- branches/Cog/src/plugins/FilePlugin/FilePlugin.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/src/plugins/FilePlugin/FilePlugin.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	VMPluginCodeGenerator VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
    from
-	FilePlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7
+	FilePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
  */
-static char __buildInfo[] = "FilePlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ;
+static char __buildInfo[] = "FilePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9 " __DATE__ ;
 
 
 
@@ -176,9 +176,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"FilePlugin VMMaker.oscog-eem.235 (i)"
+	"FilePlugin VMMaker.oscog-eem.307 (i)"
 #else
-	"FilePlugin VMMaker.oscog-eem.235 (e)"
+	"FilePlugin VMMaker.oscog-eem.307 (e)"
 #endif
 ;
 static void * sCCPfn;
@@ -1077,10 +1077,9 @@
 primitiveFileWrite(void)
 {
     sqInt array;
-    char *arrayIndex;
-    size_t byteSize;
     sqInt bytesWritten;
     size_t count;
+    size_t elementSize;
     SQFile *file;
     sqInt objectPointer;
     size_t startIndex;
@@ -1098,29 +1097,21 @@
 	}
 	file = firstIndexableField(objectPointer);
 l1:	/* end fileValueOf: */;
-	if (!(isWordsOrBytes(array))) {
-		return primitiveFail();
+	if ((failed())
+	 || (!(isWordsOrBytes(array)))) {
+		return primitiveFailFor(PrimErrBadArgument);
 	}
-	if (isWords(array)) {
-		byteSize = 4;
-	}
-	else {
-		byteSize = 1;
-	}
+	elementSize = (isWords(array)
+		? 4
+		: 1);
 	if (!((startIndex >= 1)
 		 && (((startIndex + count) - 1) <= (slotSizeOf(array))))) {
-		return primitiveFail();
+		return primitiveFailFor(PrimErrBadIndex);
 	}
+	bytesWritten = sqFileWriteFromAt(file, count * elementSize, ((char *) (firstIndexableField(array))), (startIndex - 1) * elementSize);
 	if (!(failed())) {
-
-		/* Note: adjust startIndex for zero-origin indexing */
-
-		arrayIndex = firstIndexableField(array);
-		bytesWritten = sqFileWriteFromAt(file, count * byteSize, arrayIndex, (startIndex - 1) * byteSize);
+		popthenPush(5, integerObjectOf(bytesWritten / elementSize));
 	}
-	if (!(failed())) {
-		popthenPush(5, integerObjectOf(bytesWritten / byteSize));
-	}
 }
 
 EXPORT(sqInt)

Modified: branches/Cog/src/plugins/GdbARMPlugin/GdbARMPlugin.c
===================================================================
--- branches/Cog/src/plugins/GdbARMPlugin/GdbARMPlugin.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/src/plugins/GdbARMPlugin/GdbARMPlugin.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,9 +1,12 @@
-/* Automatically generated from Squeak on {14 December 2012 . 1:58:09 pm} */
+/* Automatically generated by
+	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
+   from
+	GdbARMPlugin Cog-eem.61 uuid: 3dba03de-7a41-4da2-bdf4-d8276f5665da
+ */
+static char __buildInfo[] = "GdbARMPlugin Cog-eem.61 uuid: 3dba03de-7a41-4da2-bdf4-d8276f5665da " __DATE__ ;
 
-static char __buildInfo[] = "Generated on {14 December 2012 . 1:58:09 pm}. Compiled on "__DATE__ ;
 
 
-
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -54,7 +57,9 @@
 EXPORT(sqInt) primitiveFlushICacheFromTo(void);
 EXPORT(sqInt) primitiveNewCPU(void);
 EXPORT(sqInt) primitiveResetCPU(void);
+EXPORT(sqInt) primitiveRunInMemoryMinAddressMaxAddressReadWrite(void);
 EXPORT(sqInt) primitiveRunInMemoryMinimumAddressReadWrite(void);
+EXPORT(sqInt) primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite(void);
 EXPORT(sqInt) primitiveSingleStepInMemoryMinimumAddressReadWrite(void);
 EXPORT(sqInt) setInterpreter(struct VirtualMachine*anInterpreter);
 static sqInt sizeField(sqInt rcvr);
@@ -116,9 +121,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"GdbARMPlugin 14 December 2012 (i)"
+	"GdbARMPlugin Cog-eem.61 (i)"
 #else
-	"GdbARMPlugin 14 December 2012 (e)"
+	"GdbARMPlugin Cog-eem.61 (e)"
 #endif
 ;
 
@@ -352,12 +357,68 @@
 /*	<Bitmap|ByteArray|WordArray> */
 /*	<Integer> */
 /*	<Integer> */
+/*	<Integer> */
 /*	Run the cpu using the first argument as the memory and the following
 	arguments defining valid addresses, running until it halts or hits an
 	exception. 
  */
 
 EXPORT(sqInt)
+primitiveRunInMemoryMinAddressMaxAddressReadWrite(void)
+{
+	void *cpu;
+	sqInt cpuAlien;
+	unsigned long maxAddress;
+	sqInt maybeErr;
+	char *memory;
+	sqInt memorySize;
+	unsigned long minAddress;
+	unsigned long minWriteMaxExecAddress;
+
+	success(isWordsOrBytes(stackValue(3)));
+	memory = ((char *) (firstIndexableField(stackValue(3))));
+	minAddress = positive32BitValueOf(stackValue(2));
+	maxAddress = positive32BitValueOf(stackValue(1));
+	minWriteMaxExecAddress = positive32BitValueOf(stackValue(0));
+	cpuAlien = stackValue(4);
+	if (failed()) {
+		return null;
+	}
+	if (((cpu = ((longAt(cpuAlien + BaseHeaderSize)) > 0
+	? (cpuAlien + BaseHeaderSize) + BytesPerOop
+	: longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))) == 0) {
+		primitiveFailFor(PrimErrBadReceiver);
+		return null;
+	}
+	prevInterruptCheckChain = setInterruptCheckChain(forceStopOnInterrupt);
+	if (prevInterruptCheckChain == (forceStopOnInterrupt)) {
+		prevInterruptCheckChain == 0;
+	}
+	memorySize = byteSizeOf(((sqInt)(long)(memory) - 4));
+	maybeErr = runCPUInSizeMinAddressReadWrite(cpu, memory, ((memorySize < maxAddress) ? memorySize : maxAddress), minAddress, minWriteMaxExecAddress);
+	setInterruptCheckChain(prevInterruptCheckChain);
+	if (maybeErr != 0) {
+		primitiveFailFor(PrimErrInappropriate);
+		return null;
+	}
+	if (failed()) {
+		return null;
+	}
+	popthenPush(5, cpuAlien);
+	return null;
+}
+
+
+/*	cpuAlien <GdbARMAlien> */
+/*	<Bitmap|ByteArray|WordArray> */
+/*	<Integer> */
+/*	<Integer> */
+/*	Run the cpu using the first argument as the memory and the following
+	arguments defining valid addresses, running until it halts or hits an
+	exception. 
+ */
+
+EXPORT(sqInt)
 primitiveRunInMemoryMinimumAddressReadWrite(void)
 {
 	void *cpu;
@@ -403,11 +464,61 @@
 /*	<Bitmap|ByteArray|WordArray> */
 /*	<Integer> */
 /*	<Integer> */
+/*	<Integer> */
 /*	Single-step the cpu using the first argument as the memory and the
 	following arguments defining valid addresses.
  */
 
 EXPORT(sqInt)
+primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite(void)
+{
+	void *cpu;
+	sqInt cpuAlien;
+	unsigned long maxAddress;
+	sqInt maybeErr;
+	char *memory;
+	sqInt memorySize;
+	unsigned long minAddress;
+	unsigned long minWriteMaxExecAddress;
+
+	success(isWordsOrBytes(stackValue(3)));
+	memory = ((char *) (firstIndexableField(stackValue(3))));
+	minAddress = positive32BitValueOf(stackValue(2));
+	maxAddress = positive32BitValueOf(stackValue(1));
+	minWriteMaxExecAddress = positive32BitValueOf(stackValue(0));
+	cpuAlien = stackValue(4);
+	if (failed()) {
+		return null;
+	}
+	if (((cpu = ((longAt(cpuAlien + BaseHeaderSize)) > 0
+	? (cpuAlien + BaseHeaderSize) + BytesPerOop
+	: longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))) == 0) {
+		primitiveFailFor(PrimErrBadReceiver);
+		return null;
+	}
+	memorySize = byteSizeOf(((sqInt)(long)(memory) - 4));
+	maybeErr = singleStepCPUInSizeMinAddressReadWrite(cpu, memory, ((memorySize < maxAddress) ? memorySize : maxAddress), minAddress, minWriteMaxExecAddress);
+	if (maybeErr != 0) {
+		primitiveFailFor(PrimErrInappropriate);
+		return null;
+	}
+	if (failed()) {
+		return null;
+	}
+	popthenPush(5, cpuAlien);
+	return null;
+}
+
+
+/*	cpuAlien <GdbARMAlien> */
+/*	<Bitmap|ByteArray|WordArray> */
+/*	<Integer> */
+/*	<Integer> */
+/*	Single-step the cpu using the first argument as the memory and the
+	following arguments defining valid addresses.
+ */
+
+EXPORT(sqInt)
 primitiveSingleStepInMemoryMinimumAddressReadWrite(void)
 {
 	void *cpu;
@@ -525,7 +636,9 @@
 	{"GdbARMPlugin", "primitiveFlushICacheFromTo", (void*)primitiveFlushICacheFromTo},
 	{"GdbARMPlugin", "primitiveNewCPU", (void*)primitiveNewCPU},
 	{"GdbARMPlugin", "primitiveResetCPU", (void*)primitiveResetCPU},
+	{"GdbARMPlugin", "primitiveRunInMemoryMinAddressMaxAddressReadWrite", (void*)primitiveRunInMemoryMinAddressMaxAddressReadWrite},
 	{"GdbARMPlugin", "primitiveRunInMemoryMinimumAddressReadWrite", (void*)primitiveRunInMemoryMinimumAddressReadWrite},
+	{"GdbARMPlugin", "primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite", (void*)primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite},
 	{"GdbARMPlugin", "primitiveSingleStepInMemoryMinimumAddressReadWrite", (void*)primitiveSingleStepInMemoryMinimumAddressReadWrite},
 	{"GdbARMPlugin", "setInterpreter", (void*)setInterpreter},
 	{NULL, NULL, NULL}

Modified: branches/Cog/src/plugins/LargeIntegers/LargeIntegers.c
===================================================================
--- branches/Cog/src/plugins/LargeIntegers/LargeIntegers.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/src/plugins/LargeIntegers/LargeIntegers.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
+	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
    from
-	LargeIntegersPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022
+	LargeIntegersPlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
  */
-static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.246 uuid: 1e176c89-522a-4632-ba15-e12f800d1022 " __DATE__ ;
+static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9 " __DATE__ ;
 
 
 
@@ -175,9 +175,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"LargeIntegers v1.5 VMMaker.oscog-eem.246 (i)"
+	"LargeIntegers v1.5 VMMaker.oscog-eem.307 (i)"
 #else
-	"LargeIntegers v1.5 VMMaker.oscog-eem.246 (e)"
+	"LargeIntegers v1.5 VMMaker.oscog-eem.307 (e)"
 #endif
 ;
 static const int  orOpIndex = 1;
@@ -264,6 +264,7 @@
 {
 	sqInt class;
 	sqInt ix;
+	sqInt ixLimiT;
 	sqInt newBytes;
 	unsigned char *   pByte;
 	sqInt val;
@@ -279,7 +280,7 @@
 		newBytes = instantiateClassindexableSize(class, len);
 		/* begin cCopyIntVal:toBytes: */
 		pByte = firstIndexableField(newBytes);
-		for (ix = 1; ix <= (cDigitLengthOfCSI(val)); ix += 1) {
+		for (ix = 1, ixLimiT = (cDigitLengthOfCSI(val)); ix <= ixLimiT; ix += 1) {
 			pByte[ix - 1] = (cDigitOfCSIat(val, ix));
 		}
 	}
@@ -638,10 +639,11 @@
 cCopyIntValtoBytes(sqInt val, sqInt bytes)
 {
 	sqInt ix;
+	sqInt ixLimiT;
 	unsigned char *   pByte;
 
 	pByte = firstIndexableField(bytes);
-	for (ix = 1; ix <= (cDigitLengthOfCSI(val)); ix += 1) {
+	for (ix = 1, ixLimiT = (cDigitLengthOfCSI(val)); ix <= ixLimiT; ix += 1) {
 		pByte[ix - 1] = (cDigitOfCSIat(val, ix));
 	}
 }

Modified: branches/Cog/src/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c
===================================================================
--- branches/Cog/src/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/src/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,13 +1,13 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.248 uuid: 325b96ad-3c25-438e-af36-04a93839f195
+	VMPluginCodeGenerator VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
    from
-	MiscPrimitivePlugin VMMaker.oscog-eem.248 uuid: 325b96ad-3c25-438e-af36-04a93839f195
+	MiscPrimitivePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9
 	Bitmap * Graphics-ar.142 uuid: 9a11fdac-93ce-8344-877f-55d10866f795
 	ByteArray * Collections-eem.375 uuid: c9da6558-3bd7-4f0f-b0e5-bc21208275f0
 	ByteString * Collections-eem.375 uuid: c9da6558-3bd7-4f0f-b0e5-bc21208275f0
 	SampledSound * Sound-ar.30 uuid: c0c6133c-73b7-7b47-9858-99b64868d35c
  */
-static char __buildInfo[] = "MiscPrimitivePlugin VMMaker.oscog-eem.248 uuid: 325b96ad-3c25-438e-af36-04a93839f195\n\
+static char __buildInfo[] = "MiscPrimitivePlugin VMMaker.oscog-eem.307 uuid: 737feb1e-5228-463a-8f3e-0f55f10fc3c9\n\
 Bitmap * Graphics-ar.142 uuid: 9a11fdac-93ce-8344-877f-55d10866f795\n\
 ByteArray * Collections-eem.375 uuid: c9da6558-3bd7-4f0f-b0e5-bc21208275f0\n\
 ByteString * Collections-eem.375 uuid: c9da6558-3bd7-4f0f-b0e5-bc21208275f0\n\
@@ -95,9 +95,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"MiscPrimitivePlugin VMMaker.oscog-eem.248 (i)"
+	"MiscPrimitivePlugin VMMaker.oscog-eem.307 (i)"
 #else
-	"MiscPrimitivePlugin VMMaker.oscog-eem.248 (e)"
+	"MiscPrimitivePlugin VMMaker.oscog-eem.307 (e)"
 #endif
 ;
 
@@ -761,6 +761,7 @@
     sqInt rcvr;
     sqInt start;
     sqInt startIndex;
+    sqInt startIndexLimiT;
 
 	rcvr = stackValue(4);
 	if (!(isBytes(stackValue(3)))) {
@@ -790,7 +791,7 @@
 		pushInteger(0);
 		return null;
 	}
-	for (startIndex = start; startIndex <= (((sizeOfSTArrayFromCPrimitive(body + 1)) - (sizeOfSTArrayFromCPrimitive(key + 1))) + 1); startIndex += 1) {
+	for (startIndex = start, startIndexLimiT = (((sizeOfSTArrayFromCPrimitive(body + 1)) - (sizeOfSTArrayFromCPrimitive(key + 1))) + 1); startIndex <= startIndexLimiT; startIndex += 1) {
 		index = 1;
 		while ((matchTable[(asciiValue(body[(startIndex + index) - 1])) + 1]) == (matchTable[(asciiValue(key[index])) + 1])) {
 			if (index == (sizeOfSTArrayFromCPrimitive(key + 1))) {

Modified: branches/Cog/src/vm/cointerp.c
===================================================================
--- branches/Cog/src/vm/cointerp.c	2013-07-18 19:45:39 UTC (rev 2753)
+++ branches/Cog/src/vm/cointerp.c	2013-07-24 00:31:56 UTC (rev 2754)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
    from
-	CoInterpreter VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea
+	CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.306 uuid: ef4dab92-e348-4081-8041-92ae24d73bea " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.308 uuid: 66681ccb-5127-4525-a519-55ee71410844 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -363,6 +363,8 @@
 void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp);
 static void assertValidExecutionPointersimbarline(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter, sqInt ln);
 void assertValidMachineCodeFrame(sqInt instrPtr);
+static sqInt assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln);
+static void assertValidStackedInstructionPointers(sqInt ln);
 static void assertValidStackLimits(sqInt ln);
 static void attemptToSwitchToMachineCode(sqInt bcpc);
 sqInt becomewith(sqInt array1, sqInt array2);
@@ -1966,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.306]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.308]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -9508,6 +9510,7 @@
     CogMethod *cogMethod;
     sqInt methodField;
     sqInt methodField1;
+    sqInt savedIP;
 
 	assertl(GIV(stackPage) == (stackPageFor(lifp)), ln);

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list