[Vm-dev] [commit][3195] CogVM source as per VMMaker.oscog-eem.1001

commits at squeakvm.org commits at squeakvm.org
Sat Dec 27 01:37:22 UTC 2014


Revision: 3195
Author:   eliot
Date:     2014-12-26 17:37:21 -0800 (Fri, 26 Dec 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.1001

Mark externalInstVar:ofContext: as not to be inlined
(otherwise it is inined into 64-bit primitiveSlotAtPut !!).

Remove useless initPrimCalls from primitiveFloatAt[Put]
and fix latter for potentially immediate receivers.

Spur:
Fix argument count slips in three primitives.
Check for sufficient memory in two-way become.

All:
Fix checking of boolean arg in primitiveArrayBecomeOneWayCopyHash.

Make primitiveSlotAt[Put] cope with non-pointer objects.

Replace primitiveCharacterValue with primitiveImmediateAsInteger which provides
SmallFloat64>>identityHash as well as Character>>asInteger.

Refactor small float manipulations to introduce smallFloatBitsOf:.

Provide printStackReferencesTo:.

Fix slip in StackToRegisterMappingCogit>>genBinaryConstOpVarInlinePrimitive:

Fix slip in shortPrint:.

Change the pixel-touch-pixel prim to allow LPI arguments for the color values

Sista:

Added inlined primitive code for:
	byteNumByte
	pointerAt:
	byteAt:
	pointerAt:put:
	byteAt:put:

Modified Paths:
--------------
    branches/Cog/nscogsrc/plugins/BitBltPlugin/BitBltPlugin.c
    branches/Cog/nscogsrc/vm/cogit.c
    branches/Cog/nscogsrc/vm/cogit.h
    branches/Cog/nscogsrc/vm/cointerp.c
    branches/Cog/nscogsrc/vm/cointerp.h
    branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
    branches/Cog/nsspursrc/vm/cogit.c
    branches/Cog/nsspursrc/vm/cogit.h
    branches/Cog/nsspursrc/vm/cointerp.c
    branches/Cog/nsspursrc/vm/cointerp.h
    branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
    branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c
    branches/Cog/nsspurstacksrc/vm/interp.c
    branches/Cog/sistasrc/vm/cogit.c
    branches/Cog/sistasrc/vm/cogit.h
    branches/Cog/sistasrc/vm/cointerp.c
    branches/Cog/sistasrc/vm/cointerp.h
    branches/Cog/sistasrc/vm/gcc3x-cointerp.c
    branches/Cog/spursistasrc/vm/cogit.c
    branches/Cog/spursistasrc/vm/cogit.h
    branches/Cog/spursistasrc/vm/cointerp.c
    branches/Cog/spursistasrc/vm/cointerp.h
    branches/Cog/spursistasrc/vm/gcc3x-cointerp.c
    branches/Cog/spursrc/vm/cogit.c
    branches/Cog/spursrc/vm/cogit.h
    branches/Cog/spursrc/vm/cointerp.c
    branches/Cog/spursrc/vm/cointerp.h
    branches/Cog/spursrc/vm/gcc3x-cointerp.c
    branches/Cog/spurstack64src/vm/gcc3x-interp.c
    branches/Cog/spurstack64src/vm/interp.c
    branches/Cog/spurstacksrc/vm/gcc3x-interp.c
    branches/Cog/spurstacksrc/vm/interp.c
    branches/Cog/src/plugins/BitBltPlugin/BitBltPlugin.c
    branches/Cog/src/vm/cogit.c
    branches/Cog/src/vm/cogit.h
    branches/Cog/src/vm/cointerp.c
    branches/Cog/src/vm/cointerp.h
    branches/Cog/src/vm/cointerpmt.c
    branches/Cog/src/vm/cointerpmt.h
    branches/Cog/src/vm/gcc3x-cointerp.c
    branches/Cog/src/vm/gcc3x-cointerpmt.c
    branches/Cog/stacksrc/vm/gcc3x-interp.c
    branches/Cog/stacksrc/vm/interp.c

Added Paths:
-----------
    branches/Cog/platforms/Plan9/
    branches/Cog/platforms/Plan9/README
    branches/Cog/platforms/Plan9/mkfile
    branches/Cog/platforms/Plan9/plugins/
    branches/Cog/platforms/Plan9/plugins/FilePlugin/
    branches/Cog/platforms/Plan9/plugins/FilePlugin/sqPlan9file.c
    branches/Cog/platforms/Plan9/plugins/SocketPlugin/
    branches/Cog/platforms/Plan9/plugins/SocketPlugin/sqPlan9socket.c
    branches/Cog/platforms/Plan9/vm/
    branches/Cog/platforms/Plan9/vm/config.h
    branches/Cog/platforms/Plan9/vm/errno.h
    branches/Cog/platforms/Plan9/vm/libc_wrapper.h
    branches/Cog/platforms/Plan9/vm/math.h
    branches/Cog/platforms/Plan9/vm/osExports.c
    branches/Cog/platforms/Plan9/vm/p9display.c
    branches/Cog/platforms/Plan9/vm/p9iface.h
    branches/Cog/platforms/Plan9/vm/setjmp.h
    branches/Cog/platforms/Plan9/vm/sqConfig.h
    branches/Cog/platforms/Plan9/vm/sqPlan9ExternalPrims.c
    branches/Cog/platforms/Plan9/vm/sqPlan9clip.c
    branches/Cog/platforms/Plan9/vm/sqPlan9io.c
    branches/Cog/platforms/Plan9/vm/sqPlan9main.c
    branches/Cog/platforms/Plan9/vm/sqPlan9prof.c
    branches/Cog/platforms/Plan9/vm/sqPlatformSpecific.h
    branches/Cog/platforms/Plan9/vm/stdio.h
    branches/Cog/platforms/Plan9/vm/stdlib.h
    branches/Cog/platforms/Plan9/vm/string.h
    branches/Cog/platforms/Plan9/vm/time.h

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

Modified: branches/Cog/nscogsrc/plugins/BitBltPlugin/BitBltPlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/BitBltPlugin/BitBltPlugin.c	2014-12-27 01:29:52 UTC (rev 3194)
+++ branches/Cog/nscogsrc/plugins/BitBltPlugin/BitBltPlugin.c	2014-12-27 01:37:21 UTC (rev 3195)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.990 uuid: f4a22308-891c-4542-b6a4-10fe174bc82a
+	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.998 uuid: 20a6acb3-9a01-4219-b650-8966301ffe11
    from
-	BitBltSimulation VMMaker.oscog-eem.990 uuid: f4a22308-891c-4542-b6a4-10fe174bc82a
+	BitBltSimulation VMMaker.oscog-eem.998 uuid: 20a6acb3-9a01-4219-b650-8966301ffe11
  */
-static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.990 uuid: f4a22308-891c-4542-b6a4-10fe174bc82a " __DATE__ ;
+static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.998 uuid: 20a6acb3-9a01-4219-b650-8966301ffe11 " __DATE__ ;
 
 
 
@@ -290,6 +290,8 @@
 static sqInt (*pop)(sqInt nItems);
 static sqInt (*popthenPush)(sqInt nItems, sqInt oop);
 static sqInt (*positive32BitIntegerFor)(sqInt integerValue);
+static usqInt (*positive32BitValueOf)(sqInt oop);
+static usqLong (*positive64BitValueOf)(sqInt oop);
 static sqInt (*primitiveFail)(void);
 static sqInt (*pushInteger)(sqInt integerValue);
 static sqInt (*showDisplayBitsLeftTopRightBottom)(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b);
@@ -321,6 +323,8 @@
 extern sqInt pop(sqInt nItems);
 extern sqInt popthenPush(sqInt nItems, sqInt oop);
 extern sqInt positive32BitIntegerFor(sqInt integerValue);
+extern usqInt positive32BitValueOf(sqInt oop);
+extern usqLong positive64BitValueOf(sqInt oop);
 extern sqInt primitiveFail(void);
 extern sqInt pushInteger(sqInt integerValue);
 extern sqInt showDisplayBitsLeftTopRightBottom(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b);
@@ -342,9 +346,9 @@
 };
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"BitBltPlugin VMMaker.oscog-eem.990 (i)"
+	"BitBltPlugin VMMaker.oscog-eem.998 (i)"
 #else
-	"BitBltPlugin VMMaker.oscog-eem.990 (e)"
+	"BitBltPlugin VMMaker.oscog-eem.998 (e)"
 #endif
 ;
 static sqInt noHalftone;
@@ -5022,15 +5026,19 @@
 EXPORT(sqInt)
 primitiveCompareColors(void)
 {
-	sqInt colorA;
-	sqInt colorB;
+	unsigned long colorA;
+	unsigned long colorB;
 	sqInt rcvr;
 	sqInt testID;
 	sqInt val;
 	sqInt _return_value;
 
-	colorA = stackIntegerValue(2);
-	colorB = stackIntegerValue(1);
+	colorA = (BytesPerOop == 4
+		? positive32BitValueOf(stackValue(2))
+		: positive64BitValueOf(stackValue(2)));
+	colorB = (BytesPerOop == 4
+		? positive32BitValueOf(stackValue(1))
+		: positive64BitValueOf(stackValue(1)));
 	testID = stackIntegerValue(0);
 	rcvr = stackValue(3);
 	if (failed()) {
@@ -6666,6 +6674,8 @@
 		pop = interpreterProxy->pop;
 		popthenPush = interpreterProxy->popthenPush;
 		positive32BitIntegerFor = interpreterProxy->positive32BitIntegerFor;
+		positive32BitValueOf = interpreterProxy->positive32BitValueOf;
+		positive64BitValueOf = interpreterProxy->positive64BitValueOf;
 		primitiveFail = interpreterProxy->primitiveFail;
 		pushInteger = interpreterProxy->pushInteger;
 		showDisplayBitsLeftTopRightBottom = interpreterProxy->showDisplayBitsLeftTopRightBottom;

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2014-12-27 01:29:52 UTC (rev 3194)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-12-27 01:37:21 UTC (rev 3195)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.990 uuid: f4a22308-891c-4542-b6a4-10fe174bc82a
+	CCodeGenerator VMMaker.oscog-eem.1001 uuid: fef56678-07b1-4fca-8300-17d6afc0c6e4
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.990 uuid: f4a22308-891c-4542-b6a4-10fe174bc82a
+	StackToRegisterMappingCogit VMMaker.oscog-eem.1001 uuid: fef56678-07b1-4fca-8300-17d6afc0c6e4
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.990 uuid: f4a22308-891c-4542-b6a4-10fe174bc82a " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1001 uuid: fef56678-07b1-4fca-8300-17d6afc0c6e4 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-12-27 01:29:52 UTC (rev 3194)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-12-27 01:37:21 UTC (rev 3195)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.990 uuid: f4a22308-891c-4542-b6a4-10fe174bc82a
+	CCodeGenerator VMMaker.oscog-eem.1001 uuid: fef56678-07b1-4fca-8300-17d6afc0c6e4
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2014-12-27 01:29:52 UTC (rev 3194)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2014-12-27 01:37:21 UTC (rev 3195)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.992 uuid: bbbe8c5f-97d3-42fe-b068-76c6890a1733
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1001 uuid: fef56678-07b1-4fca-8300-17d6afc0c6e4
    from
-	CoInterpreter VMMaker.oscog-eem.992 uuid: bbbe8c5f-97d3-42fe-b068-76c6890a1733
+	CoInterpreter VMMaker.oscog-eem.1001 uuid: fef56678-07b1-4fca-8300-17d6afc0c6e4
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.992 uuid: bbbe8c5f-97d3-42fe-b068-76c6890a1733 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1001 uuid: fef56678-07b1-4fca-8300-17d6afc0c6e4 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -517,7 +517,6 @@
 static void printFrameMethodFor(char *theFP) NoDbgRegParms;
 static void printFrameThingatextraString(char *name, char *address, char *extraStringOrNil) NoDbgRegParms;
 static void printFrameThingatextra(char *name, char *address, sqInt extraValue) NoDbgRegParms;
-sqInt printFrame(char *theFP);
 void printFrameWithSP(char *theFP, char *theSP);
 static void printLogEntryAt(sqInt i) NoDbgRegParms;
 void printMethodCacheFor(sqInt thing);
@@ -626,7 +625,6 @@
 static void primitiveBytesLeft(void);
 static void primitiveCalloutToFFI(void);
 static void primitiveChangeClass(void);
-static void primitiveCharacterValue(void);
 static void primitiveClass(void);
 static void primitiveClearVMProfile(void);
 static void primitiveClipboardText(void);
@@ -1199,6 +1197,7 @@
 EXPORT(void) printFramesOnStackPageListInUse(void);
 static void printFrameThingandFrameat(char *name, char *theFP, char *address) NoDbgRegParms;
 static void printFrameThingat(char *name, char *address) NoDbgRegParms;
+sqInt printFrame(char *theFP);
 void printHex(sqInt n);
 void printLikelyImplementorsOfSelector(sqInt selector);
 void printMethodCache(void);
@@ -1216,6 +1215,7 @@
 void printStackPages(void);
 void printStackPagesInUse(void);
 static void printStackPage(StackPage *page) NoDbgRegParms;
+void printStackReferencesTo(sqInt oop);
 static void printStringOf(sqInt oop) NoDbgRegParms;
 void print(char *s);
 void pushBool(sqInt trueOrFalse);
@@ -1266,6 +1266,7 @@
 static sqInt stackLimitBytes(void);
 sqInt stackObjectValue(sqInt offset);
 static sqInt stackPageByteSize(void);
+static sqInt stackPointerForMaybeMarriedContext(sqInt aContext) NoDbgRegParms;
 static sqInt stackPointerIndexForFrame(char *theFP) NoDbgRegParms;
 unsigned long stackPositiveMachineIntegerValue(sqInt offset);
 long stackSignedMachineIntegerValue(sqInt offset);
@@ -1503,8 +1504,8 @@
 sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */;
 jmp_buf reenterInterpreter; /* private export */;
 sqInt checkAllocFiller;
+sqInt breakSelectorLength = MinSmallInteger;
 sqInt inIOProcessEvents;
-sqInt breakSelectorLength = MinSmallInteger;
 sqInt checkForLeaks;
 sqInt desiredEdenBytes;
 sqInt desiredNumStackPages;
@@ -1693,7 +1694,7 @@
 	/* 168 */ primitiveCopyObject,
 	/* 169 */ primitiveNotIdentical,
 	/* 170 */ primitiveAsCharacter,
-	/* 171 */ primitiveCharacterValue,
+	/* 171 */ (void (*)(void))0,
 	/* 172 */ (void (*)(void))0,
 	/* 173 */ primitiveSlotAt,
 	/* 174 */ primitiveSlotAtPut,
@@ -2099,7 +2100,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.992";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1001";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -4843,6 +4844,7 @@
 							GIV(framePointer) = localFP;
 							
 							ceEnterCogCodePopReceiverReg();
+							null;
 							goto l300;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -4860,7 +4862,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-					/* return self */
+					null;
 				l300:	/* end baseFrameReturn */;
 					goto l299;
 				}
@@ -7963,7 +7965,7 @@
 			/* bytecodePrimBitShift */
 			{
 				sqInt integerArgument;
-				sqLong integerReceiver;
+				usqInt integerReceiver;
 				sqInt shifted;
 				char *sp;
 
@@ -8023,7 +8025,7 @@
 							null;
 							goto l108;
 						}
-						shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
+						shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
 					}
 					shifted = positive32BitIntegerFor(shifted);
 					/* begin pop:thenPush: */
@@ -10917,7 +10919,7 @@
 			/* bytecodePrimBitShift */
 			{
 				sqInt integerArgument;
-				sqLong integerReceiver;
+				usqInt integerReceiver;
 				sqInt shifted;
 				char *sp;
 
@@ -10977,7 +10979,7 @@
 							null;
 							goto l243;
 						}
-						shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
+						shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
 					}
 					shifted = positive32BitIntegerFor(shifted);
 					/* begin pop:thenPush: */
@@ -18634,91 +18636,6 @@
 	printf("\n");
 }
 
-sqInt
-printFrame(char *theFP)
-{   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    char *aFrame;
-    sqInt index;
-    char *prevFrame;
-    char *startFrame;
-    StackPage *thePage;
-    char *theSP;
-
-	if (theFP == GIV(framePointer)) {
-		theSP = GIV(stackPointer);
-	}
-	else {
-		/* begin stackPageFor: */
-		/* begin stackPageAt: */
-		/* begin pageIndexFor: */
-		assert((((((char *) theFP)) >= (GIV(stackBasePlus1) - 1)) && ((((char *) theFP)) <= (((char *) GIV(pages))))));
-		index = pageIndexForstackBasePlus1bytesPerPage(theFP, GIV(stackBasePlus1), GIV(bytesPerPage));
-		thePage = stackPageAtpages(index, GIV(pages));
-		if (isFree(thePage)) {
-			/* begin printHexPtr: */
-			printHex(oopForPointer(theFP));
-			print(" is on a free page?!");
-			/* begin cr */
-			printf("\n");
-			return null;
-		}
-		if ((thePage != GIV(stackPage))
-		 && (theFP == ((thePage->headFP)))) {
-			theSP = (thePage->headSP);
-		}
-		else {
-			/* begin findSPOrNilOf:on:startingFrom: */
-			startFrame = ((thePage == GIV(stackPage))
-			 && (((GIV(framePointer) >= ((thePage->realStackLimit))) && (GIV(framePointer) <= ((thePage->baseAddress)))))
-				? GIV(framePointer)
-				: (thePage->headFP));
-			assert(!(isFree(thePage)));
-			if (startFrame == theFP) {
-				if (((thePage->headSP)) >= startFrame) {
-
-					/* If the SP is invalid return the pointer to the receiver field. */
-
-					/* begin frameReceiverOffset: */
-					theSP = ((((usqInt)(longAt(aFrame + FoxMethod)))) < (startOfMemory())
-						? aFrame + FoxMFReceiver
-						: aFrame + FoxIFReceiver);
-					goto l1;
-				}
-				theSP = (thePage == GIV(stackPage)
-					? (thePage->headSP)
-					: ((thePage->headSP)) + BytesPerWord);
-				goto l1;
-			}
-			aFrame = startFrame;
-			while (1) {
-				prevFrame = aFrame;
-				/* begin frameCallerFP: */
-				aFrame = pointerForOop(longAt(aFrame + FoxSavedFP));
-				if (!(aFrame != 0)) break;
-				if (theFP == aFrame) {
-					/* begin frameCallerSP: */
-					assert(!(isBaseFrame(prevFrame)));
-					theSP = (prevFrame + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(prevFrame + FoxMethod)))) < (startOfMemory())
-	? ((mframeCogMethod(prevFrame))->cmNumArgs)
-	: byteAt((prevFrame + FoxIFrameFlags) + 1))))) + BytesPerWord;
-					goto l1;
-				}
-			}
-			theSP = null;
-		l1:	/* end findSPOrNilOf:on:startingFrom: */;
-		}
-	}
-	if (theSP == null) {
-		print("could not find sp; using bogus value");
-		/* begin cr */
-		printf("\n");
-		theSP = theFP + (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
-	? FoxMFReceiver
-	: FoxIFReceiver));
-	}
-	printFrameWithSP(theFP, theSP);
-}
-
 void
 printFrameWithSP(char *theFP, char *theSP)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -23650,44 +23567,34 @@
 }
 
 
-/*	Similar to primitiveArrayBecomeOneWay but accepts a third argument whether
-	to copy
-	the receiver's identity hash over the argument's identity hash.
+/*	Similar to primitiveArrayBecomeOneWay but accepts a third argument
+	deciding whether to
+	copy the receiver's element's identity hash over the argument's elementy's
+	identity hash.
  */
 
 static void
 primitiveArrayBecomeOneWayCopyHash(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt arg;
     sqInt copyHashFlag;
     sqInt ec;
-    sqInt rcvr;
 
-	/* begin booleanValueOf: */
 	if ((longAt(GIV(stackPointer))) == GIV(trueObj)) {
 		copyHashFlag = 1;
-		goto l1;
 	}
-	if ((longAt(GIV(stackPointer))) == GIV(falseObj)) {
-		copyHashFlag = 0;
-		goto l1;
+	else {
+		if ((longAt(GIV(stackPointer))) == GIV(falseObj)) {
+			copyHashFlag = 0;
+		}
+		else {
+			GIV(primFailCode) = PrimErrBadArgument;
+			return;
+		}
 	}
-	/* begin success: */
-	
-	/* Don't overwrite an error code that has already been set. */
-
-	if (!GIV(primFailCode)) {
-		GIV(primFailCode) = 1;
-	}
-
-	copyHashFlag = null;
-l1:	/* end booleanValueOf: */;
-	arg = longAt(GIV(stackPointer) + (1 * BytesPerWord));
-	rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
-	ec = becomewithtwoWaycopyHash(rcvr, arg, 0, copyHashFlag);
+	ec = becomewithtwoWaycopyHash(longAt(GIV(stackPointer) + (2 * BytesPerWord)), longAt(GIV(stackPointer) + (1 * BytesPerWord)), 0, copyHashFlag);
 	if (ec == PrimNoErr) {
 		/* begin pop: */
-		GIV(stackPointer) += 2 * BytesPerWord;
+		GIV(stackPointer) += GIV(argumentCount) * BytesPerWord;
 		null;
 	}
 	else {
@@ -24525,7 +24432,7 @@
 primitiveBitShift(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt integerArgument;
-    sqLong integerReceiver;
+    usqInt integerReceiver;
     sqInt shifted;
     char *sp;
 
@@ -24572,7 +24479,7 @@
 				}
 				return;
 			}
-			shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
+			shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
 		}
 		shifted = positive32BitIntegerFor(shifted);
 		/* begin pop:thenPush: */
@@ -24891,25 +24798,6 @@
 }
 
 static void
-primitiveCharacterValue(void)
-{   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt characterCode;
-    sqInt characterObject;
-    char *sp;
-
-	characterObject = longAt(GIV(stackPointer));
-
-	/* the Character must be the receiver for safety */
-
-	characterCode = (CharacterTable == null
-		? (((characterValueOf(characterObject)) << 1) | 1)
-		: longAt((characterObject + BaseHeaderSize) + (CharacterValueIndex << (shiftForWord()))));
-	/* begin pop:thenPush: */
-	longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), characterCode);
-	GIV(stackPointer) = sp;
-}
-
-static void
 primitiveClass(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
@@ -26770,8 +26658,6 @@
     char *sp;
     char *sp1;
 
-	/* begin initPrimCall */
-	GIV(primFailCode) = 0;
 	rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
 	index = longAt(GIV(stackPointer));
 	if (index == ConstOne) {
@@ -26817,8 +26703,6 @@
     char *sp1;
     usqInt valueToStore;
 
-	/* begin initPrimCall */
-	GIV(primFailCode) = 0;
 	oopToStore = longAt(GIV(stackPointer));
 	valueToStore = positive32BitValueOf(oopToStore);
 	if (GIV(primFailCode)) {
@@ -26827,6 +26711,7 @@
 	}
 	rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
 	index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+	
 	if (index == ConstOne) {
 		/* begin storeLong32:ofObject:withValue: */
 		fieldIndex = (VMBIGENDIAN
@@ -29151,8 +29036,9 @@
 static void
 primitiveIsPinned(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt aValue;
     sqInt obj;
+    char *sp;
+    sqInt trueOrFalse;
 
 	obj = longAt(GIV(stackPointer));
 	if (((obj & 1))
@@ -29160,12 +29046,13 @@
 		(GIV(primFailCode) = PrimErrBadReceiver);
 		return;
 	}
-	/* begin pop: */
-	GIV(stackPointer) += (GIV(argumentCount) - 1) * BytesPerWord;
-	null;
-	/* begin stackTopPut: */
-	aValue = GIV(falseObj);
-	longAtPointerput(GIV(stackPointer), aValue);
+	/* begin pop:thenPushBool: */
+	trueOrFalse = 0
+	 && (GIV(falseObj));
+	longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (trueOrFalse
+		? GIV(trueObj)
+		: GIV(falseObj)));
+	GIV(stackPointer) = sp;
 }
 
 
@@ -31042,7 +30929,7 @@
 	}
 
 	/* begin pop:thenPush: */
-	longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) - 1) - 1) * BytesPerWord)), wasPinned);
+	longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), wasPinned);
 	GIV(stackPointer) = sp;
 }
 
@@ -49753,7 +49640,93 @@
 	printf("\n");
 }
 
+sqInt
+printFrame(char *theFP)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    char *aFrame;
+    sqInt index;
+    char *prevFrame;
+    char *startFrame;
+    StackPage *thePage;
+    char *theSP;
 
+	if (theFP == GIV(framePointer)) {
+		theSP = GIV(stackPointer);
+	}
+	else {
+		/* begin stackPageFor: */
+		/* begin stackPageAt: */
+		/* begin pageIndexFor: */
+		assert((((((char *) theFP)) >= (GIV(stackBasePlus1) - 1)) && ((((char *) theFP)) <= (((char *) GIV(pages))))));
+		index = pageIndexForstackBasePlus1bytesPerPage(theFP, GIV(stackBasePlus1), GIV(bytesPerPage));
+		thePage = stackPageAtpages(index, GIV(pages));
+		if (isFree(thePage)) {
+			/* begin printHexPtr: */
+			printHex(oopForPointer(theFP));
+			print(" is on a free page?!");
+			/* begin cr */
+			printf("\n");
+			return null;
+		}
+		if ((thePage != GIV(stackPage))
+		 && (theFP == ((thePage->headFP)))) {
+			theSP = (thePage->headSP);
+		}
+		else {
+			/* begin findSPOrNilOf:on:startingFrom: */
+			startFrame = ((thePage == GIV(stackPage))
+			 && (((GIV(framePointer) >= ((thePage->realStackLimit))) && (GIV(framePointer) <= ((thePage->baseAddress)))))
+				? GIV(framePointer)
+				: (thePage->headFP));
+			assert(!(isFree(thePage)));
+			if (startFrame == theFP) {
+				if (((thePage->headSP)) >= startFrame) {
+
+					/* If the SP is invalid return the pointer to the receiver field. */
+
+					/* begin frameReceiverOffset: */
+					theSP = ((((usqInt)(longAt(aFrame + FoxMethod)))) < (startOfMemory())
+						? aFrame + FoxMFReceiver
+						: aFrame + FoxIFReceiver);
+					goto l1;
+				}
+				theSP = (thePage == GIV(stackPage)
+					? (thePage->headSP)
+					: ((thePage->headSP)) + BytesPerWord);
+				goto l1;
+			}
+			aFrame = startFrame;
+			while (1) {
+				prevFrame = aFrame;
+				/* begin frameCallerFP: */
+				aFrame = pointerForOop(longAt(aFrame + FoxSavedFP));
+				if (!(aFrame != 0)) break;
+				if (theFP == aFrame) {
+					/* begin frameCallerSP: */
+					assert(!(isBaseFrame(prevFrame)));
+					theSP = (prevFrame + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(prevFrame + FoxMethod)))) < (startOfMemory())
+	? ((mframeCogMethod(prevFrame))->cmNumArgs)
+	: byteAt((prevFrame + FoxIFrameFlags) + 1))))) + BytesPerWord;
+					goto l1;
+				}
+			}
+			theSP = null;
+		l1:	/* end findSPOrNilOf:on:startingFrom: */;
+		}
+	}
+	if (!(theSP)) {
+		print("could not find sp; using bogus value");
+		/* begin cr */
+		printf("\n");
+		/* begin frameReceiverOffset: */
+		theSP = ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
+			? theFP + FoxMFReceiver
+			: theFP + FoxIFReceiver);
+	}
+	printFrameWithSP(theFP, theSP);
+}
+
+
 /*	Print n in hex, in the form ' 0x1234', padded to a width of 10 characters
 	in 32-bits ('0x' + 8 nibbles) or 18 characters in 64-bits ('0x' + 16
 	nibbles)  */
@@ -50687,6 +50660,86 @@
 	printf("\n");
 }
 
+void
+printStackReferencesTo(sqInt oop)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    char *callerFP;
+    sqInt i;
+    char *theFP;
+    StackPage *thePage;
+    char *theSP;
+
+	for (i = 0; i < GIV(numStackPages); i += 1) {
+		/* begin stackPageAt: */
+		thePage = stackPageAtpages(i, GIV(pages));
+		if (!(((thePage->baseFP)) == 0)) {
+			theSP = (thePage->headSP);
+
+			/* Skip the instruction pointer on top of stack of inactive pages. */
+
+			theFP = (thePage->headFP);
+			if (!(thePage == GIV(stackPage))) {
+				theSP += BytesPerWord;
+			}
+			while (1) {
+				while (theSP <= (frameReceiverOffset(theFP))) {
+					if (oop == (longAt(theSP))) {
+						print("FP: ");
+						/* begin printHexnp: */
+						printf("0x%lx", theFP);
+						print(" @ ");
+						/* begin printHexnp: */
+						printf("0x%lx", theSP);
+						/* begin cr */
+						printf("\n");
+					}
+					theSP += BytesPerWord;
+				}
+				if (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
+					? ((longAt(theFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
+					: (byteAt((theFP + FoxIFrameFlags) + 2)) != 0)) {
+					if (oop == (longAt(theFP + FoxThisContext))) {
+						print("FP: ");
+						/* begin printHexnp: */
+						printf("0x%lx", theFP);
+						print(" CTXT");
+						/* begin cr */
+						printf("\n");
+					}
+				}
+				if (oop == (longAt(theFP + FoxMethod))) {
+					print("FP: ");
+					/* begin printHexnp: */
+					printf("0x%lx", theFP);
+					print(" MTHD");
+					/* begin cr */
+					printf("\n");
+				}
+				if (!(((callerFP = frameCallerFP(theFP))) != 0)) break;
+				theSP = (theFP + FoxCallerSavedIP) + BytesPerWord;
+				theFP = callerFP;
+			}
+
+			/* a.k.a. FoxCallerContext */
+
+			theSP = theFP + FoxCallerSavedIP;
+			while (theSP <= ((thePage->baseAddress))) {
+				if (oop == (longAt(theSP))) {
+					print("FP: ");
+					/* begin printHexnp: */
+					printf("0x%lx", theFP);
+					print(" @ ");
+					/* begin printHexnp: */
+					printf("0x%lx", theSP);
+					/* begin cr */
+					printf("\n");
+				}
+				theSP += BytesPerWord;
+			}
+		}
+	}
+}
+
 static void
 printStringOf(sqInt oop)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -52201,6 +52254,30 @@
 }
 
 
+/*	Return the stackPointer of a Context or BlockContext. */
+
+static sqInt
+stackPointerForMaybeMarriedContext(sqInt aContext)
+{
+    sqInt sp;
+    sqInt sp1;
+
+	if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << (shiftForWord())))) & 1))
+	 && (!(isWidowedContext(aContext)))) {
+		sp = stackPointerIndexForFrame(frameOfMarriedContext(aContext));
+		assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(aContext)));
+		return sp;
+	}
+	/* begin fetchStackPointerOf: */
+	sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << (shiftForWord())));
+	if (!((sp1 & 1))) {
+		return 0;
+	}
+	assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext)));
+	return (sp1 >> 1);
+}
+
+
 /*	Return the 0-based index rel to the given frame.
 	(This is what stackPointer used to be before conversion to pointer) */
 /*	In the StackInterpreter stacks grow down. */
@@ -55538,14 +55615,34 @@
 	GIV(primFailCode) = PrimErrBadArgument;
 }
 
+
+/*	Answer a slot in an object. This numbers all slots from 1, ignoring the
+	distinction between
+	named and indexed inst vars. In objects with both named and indexed inst
+	vars, the named
+	inst vars preceed the indexed ones. In non-object indexed objects (objects
+	that contain
+	bits, not object references) this primitive answers the raw integral value
+	at each slot. 
+	e.g. for Strings it answers the character code, not the Character object
+	at each slot. */
+
 static void
 primitiveSlotAt(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt fmt;
     sqInt header;
     sqInt index;
+    sqInt numLiveSlots;
     sqInt numSlots;
+    sqInt oop;
+    sqInt oop1;
     sqInt rcvr;
     char *sp;
+    char *sp1;
+    char *sp2;
+    char *sp3;
+    char *sp4;
     sqInt sz;
     sqInt value;
 
@@ -55559,8 +55656,9 @@
 		(GIV(primFailCode) = PrimErrBadReceiver);
 		return;
 	}
-	index = (index >> 1);
-	if (((((usqInt) (longAt(rcvr))) >> (instFormatFieldLSB())) & 15) <= 4) {
+	fmt = (((usqInt) (longAt(rcvr))) >> (instFormatFieldLSB())) & 15;
+	index = ((index >> 1)) - 1;
+	if (fmt <= 4) {
 		/* begin numSlotsOf: */
 		header = longAt(rcvr);
 		sz = ((header & TypeMask) == HeaderTypeSizeAndClass
@@ -55569,7 +55667,22 @@
 		numSlots = ((usqInt) (sz - BaseHeaderSize)) >> (shiftForWord());
 		if ((asUnsigned(index)) < numSlots) {
 			if (((((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F) == ClassMethodContextCompactIndex) {
-				value = externalInstVarofContext(index, rcvr);
+				/* begin externalWriteBackHeadFramePointers */
+				assert((GIV(framePointer) - GIV(stackPointer)) < (LargeContextSlots * BytesPerOop));
+				assert(GIV(stackPage) == (mostRecentlyUsedPage()));
+				/* begin setHeadFP:andSP:inPage: */
+				assert(GIV(stackPointer) < GIV(framePointer));
+				assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress)))
+				 && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - (LargeContextSlots * BytesPerOop))));
+				assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress)))
+				 && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - ((LargeContextSlots * BytesPerOop) / 2))));
+				(GIV(stackPage)->headFP = GIV(framePointer));
+				(GIV(stackPage)->headSP = GIV(stackPointer));
+				assert(pageListIsWellFormed());
+				numLiveSlots = (stackPointerForMaybeMarriedContext(rcvr)) + CtxtTempFrameStart;
+				value = ((asUnsigned(index)) < numLiveSlots
+					? externalInstVarofContext(index, rcvr)
+					: GIV(nilObj));
 			}
 			else {
 				value = longAt((rcvr + BaseHeaderSize) + (index << (shiftForWord())));
@@ -55582,20 +55695,81 @@
 		(GIV(primFailCode) = PrimErrBadIndex);
 		return;
 	}
+	if (fmt >= 8) {
+		if (fmt >= 12) {
+			(GIV(primFailCode) = PrimErrUnsupported);
+			return;
+		}
+		numSlots = numBytesOf(rcvr);
+		if ((asUnsigned(index)) < numSlots) {
+			/* begin pop:thenPushInteger: */
+			longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((byteAt((rcvr + BaseHeaderSize) + index)) << 1) | 1));
+			GIV(stackPointer) = sp1;
+			return;
+		}
+		(GIV(primFailCode) = PrimErrBadIndex);
+		return;
+	}
+	
+	if (fmt == 7) {
+		numSlots = ((usqInt) (numBytesOf(rcvr))) >> 3;
+		if ((asUnsigned(index)) < numSlots) {
+			/* begin pop:thenPush: */
+			oop = positive64BitIntegerFor(long64At((rcvr + BaseHeaderSize) + (index << 3)));
+			longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), oop);
+			GIV(stackPointer) = sp3;
+			return;
+		}
+		(GIV(primFailCode) = PrimErrBadIndex);
+		return;
+	}
+	if (fmt >= 6) {
+		numSlots = ((usqInt) (numBytesOf(rcvr))) >> 2;
+		if ((asUnsigned(index)) < numSlots) {
+			/* begin pop:thenPush: */
+			oop1 = positive32BitIntegerFor(long32At((rcvr + BaseHeaderSize) + (index << 2)));
+			longAtput((sp4 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), oop1);
+			GIV(stackPointer) = sp4;
+			return;
+		}
+		(GIV(primFailCode) = PrimErrBadIndex);
+		return;
+	}
 	(GIV(primFailCode) = PrimErrBadReceiver);
 	return;
 }
 
+
+/*	Assign a slot in an object. This numbers all slots from 1, ignoring the
+	distinction between
+	named and indexed inst vars. In objects with both named and indexed inst
+	vars, the named
+	inst vars preceed the indexed ones. In non-object indexed objects (objects
+	that contain
+	bits, not object references) this primitive assigns a raw integral value
+	at each slot. */
+
 static void
 primitiveSlotAtPut(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt bs;
+    sqInt ccIndex;
+    sqInt classOop;
+    sqInt fmt;
     sqInt header;
     sqInt index;
     sqInt newValue;
     sqInt numSlots;
+    sqInt ok;
     sqInt rcvr;
     char *sp;
+    char *sp1;
+    char *sp2;
+    char *sp3;
+    char *sp4;
     sqInt sz;
+    unsigned long value;
+    sqInt value1;
 
 	newValue = longAt(GIV(stackPointer));
 	index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
@@ -55608,8 +55782,9 @@
 		(GIV(primFailCode) = PrimErrBadReceiver);
 		return;
 	}
-	index = (index >> 1);
-	if (((((usqInt) (longAt(rcvr))) >> (instFormatFieldLSB())) & 15) <= 4) {
+	fmt = (((usqInt) (longAt(rcvr))) >> (instFormatFieldLSB())) & 15;
+	index = ((index >> 1)) - 1;
+	if (fmt <= 4) {
 		/* begin numSlotsOf: */
 		header = longAt(rcvr);
 		sz = ((header & TypeMask) == HeaderTypeSizeAndClass
@@ -55635,6 +55810,89 @@
 		(GIV(primFailCode) = PrimErrBadIndex);
 		return;
 	}
+	/* begin positiveMachineIntegerValueOf: */
+	if ((newValue & 1)) {
+		value1 = (newValue >> 1);
+		if (value1 < 0) {
+			/* begin primitiveFail */
+			if (!GIV(primFailCode)) {
+				GIV(primFailCode) = 1;
+			}
+			value = null;
+			goto l2;
+		}
+		value = value1;
+		goto l2;
+	}
+	
+	/* begin isClassOfNonImm:equalTo:compactClassIndex: */
+	classOop = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassLargePositiveInteger << (shiftForWord())));
+	assert(!((newValue & 1)));
+	ccIndex = (((usqInt) (longAt(newValue))) >> (compactClassFieldLSB())) & 0x1F;
+	if (ccIndex == 0) {
+		ok = ((longAt(newValue - BaseHeaderSize)) & AllButTypeMask) == classOop;
+		goto l1;
+	}
+	ok = ClassLargePositiveIntegerCompactIndex == ccIndex;
+	goto l1;
+
+	ok = classOop == (fetchPointerofObject(ccIndex - 1, longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << (shiftForWord())))));
+l1:	/* end isClassOfNonImm:equalTo:compactClassIndex: */;
+	if (!(ok
+		 && (((bs = numBytesOf(newValue))) <= (sizeof(unsigned long))))) {
+		/* begin primitiveFail */
+		if (!GIV(primFailCode)) {
+			GIV(primFailCode) = 1;
+		}
+		value = null;
+		goto l2;
+	}
+	if (((sizeof(unsigned long)) == 8)
+	 && (bs > 4)) {
+		value = (((((((byteAt((newValue + BaseHeaderSize) + 0)) + ((byteAt((newValue + BaseHeaderSize) + 1)) << 8)) + ((byteAt((newValue + BaseHeaderSize) + 2)) << 16)) + ((byteAt((newValue + BaseHeaderSize) + 3)) << 24)) + ((byteAt((newValue + BaseHeaderSize) + 4)) << 32)) + ((byteAt((newValue + BaseHeaderSize) + 5)) << 40)) + ((byteAt((newValue + BaseHeaderSize) + 6)) << 48)) + ((byteAt((newValue + BaseHeaderSize) + 7)) << 56);
+		goto l2;
+	}
+	value = (((byteAt((newValue + BaseHeaderSize) + 0)) + ((byteAt((newValue + BaseHeaderSize) + 1)) << 8)) + ((byteAt((newValue + BaseHeaderSize) + 2)) << 16)) + ((byteAt((newValue + BaseHeaderSize) + 3)) << 24);
+l2:	/* end positiveMachineIntegerValueOf: */;
+	if (GIV(primFailCode)) {
+		GIV(primFailCode) = PrimErrBadArgument;
+		return;
+	}
+	if (fmt >= 8) {
+		if (fmt >= 12) {
+			(GIV(primFailCode) = PrimErrUnsupported);
+			return;
+		}
+		if ((asUnsigned(value)) > 0xFF) {
+			(GIV(primFailCode) = PrimErrBadArgument);
+			return;
+		}
+		numSlots = numBytesOf(rcvr);
+		if ((asUnsigned(index)) < numSlots) {
+			byteAtput((rcvr + BaseHeaderSize) + index, value);
+			/* begin pop:thenPush: */
+			longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), newValue);
+			GIV(stackPointer) = sp1;
+			return;
+		}
+		(GIV(primFailCode) = PrimErrBadIndex);
+		return;
+	}
+	
+	
+	if (fmt >= 6) {
+		;
+		numSlots = ((usqInt) (numBytesOf(rcvr))) >> 2;
+		if ((asUnsigned(index)) < numSlots) {
+			long32Atput((rcvr + BaseHeaderSize) + (index << 2), value);
+			/* begin pop:thenPush: */
+			longAtput((sp4 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), newValue);
+			GIV(stackPointer) = sp4;
+			return;
+		}
+		(GIV(primFailCode) = PrimErrBadIndex);
+		return;
+	}
 	(GIV(primFailCode) = PrimErrBadReceiver);
 	return;
 }

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2014-12-27 01:29:52 UTC (rev 3194)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2014-12-27 01:37:21 UTC (rev 3195)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.992 uuid: bbbe8c5f-97d3-42fe-b068-76c6890a1733
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1001 uuid: fef56678-07b1-4fca-8300-17d6afc0c6e4
  */
 
 
@@ -254,6 +254,7 @@
 void printProcessStack(sqInt aProcess);
 sqInt printProcsOnList(sqInt procList);
 sqInt printStackCallStackOf(sqInt frameOrContext);
+void printStackReferencesTo(sqInt oop);
 void print(char *s);
 void setBreakMNUSelector(char *aString);
 void setBreakSelector(char *aString);

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-12-27 01:29:52 UTC (rev 3194)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-12-27 01:37:21 UTC (rev 3195)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.992 uuid: bbbe8c5f-97d3-42fe-b068-76c6890a1733
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1001 uuid: fef56678-07b1-4fca-8300-17d6afc0c6e4
    from
-	CoInterpreter VMMaker.oscog-eem.992 uuid: bbbe8c5f-97d3-42fe-b068-76c6890a1733
+	CoInterpreter VMMaker.oscog-eem.1001 uuid: fef56678-07b1-4fca-8300-17d6afc0c6e4
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.992 uuid: bbbe8c5f-97d3-42fe-b068-76c6890a1733 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1001 uuid: fef56678-07b1-4fca-8300-17d6afc0c6e4 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -520,7 +520,6 @@
 static void printFrameMethodFor(char *theFP) NoDbgRegParms;
 static void printFrameThingatextraString(char *name, char *address, char *extraStringOrNil) NoDbgRegParms;
 static void printFrameThingatextra(char *name, char *address, sqInt extraValue) NoDbgRegParms;
-sqInt printFrame(char *theFP);
 void printFrameWithSP(char *theFP, char *theSP);
 static void printLogEntryAt(sqInt i) NoDbgRegParms;
 void printMethodCacheFor(sqInt thing);
@@ -629,7 +628,6 @@
 static void primitiveBytesLeft(void);
 static void primitiveCalloutToFFI(void);
 static void primitiveChangeClass(void);
-static void primitiveCharacterValue(void);
 static void primitiveClass(void);
 static void primitiveClearVMProfile(void);
 static void primitiveClipboardText(void);
@@ -1202,6 +1200,7 @@
 EXPORT(void) printFramesOnStackPageListInUse(void);
 static void printFrameThingandFrameat(char *name, char *theFP, char *address) NoDbgRegParms;
 static void printFrameThingat(char *name, char *address) NoDbgRegParms;
+sqInt printFrame(char *theFP);
 void printHex(sqInt n);
 void printLikelyImplementorsOfSelector(sqInt selector);
 void printMethodCache(void);
@@ -1219,6 +1218,7 @@
 void printStackPages(void);
 void printStackPagesInUse(void);
 static void printStackPage(StackPage *page) NoDbgRegParms;
+void printStackReferencesTo(sqInt oop);
 static void printStringOf(sqInt oop) NoDbgRegParms;
 void print(char *s);
 void pushBool(sqInt trueOrFalse);
@@ -1269,6 +1269,7 @@
 static sqInt stackLimitBytes(void);
 sqInt stackObjectValue(sqInt offset);
 static sqInt stackPageByteSize(void);
+static sqInt stackPointerForMaybeMarriedContext(sqInt aContext) NoDbgRegParms;
 static sqInt stackPointerIndexForFrame(char *theFP) NoDbgRegParms;
 unsigned long stackPositiveMachineIntegerValue(sqInt offset);
 long stackSignedMachineIntegerValue(sqInt offset);
@@ -1506,8 +1507,8 @@
 sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */;
 jmp_buf reenterInterpreter; /* private export */;
 sqInt checkAllocFiller;
+sqInt breakSelectorLength = MinSmallInteger;
 sqInt inIOProcessEvents;
-sqInt breakSelectorLength = MinSmallInteger;
 sqInt checkForLeaks;
 sqInt desiredEdenBytes;
 sqInt desiredNumStackPages;
@@ -1696,7 +1697,7 @@
 	/* 168 */ primitiveCopyObject,
 	/* 169 */ primitiveNotIdentical,
 	/* 170 */ primitiveAsCharacter,
-	/* 171 */ primitiveCharacterValue,
+	/* 171 */ (void (*)(void))0,
 	/* 172 */ (void (*)(void))0,
 	/* 173 */ primitiveSlotAt,
 	/* 174 */ primitiveSlotAtPut,
@@ -2102,7 +2103,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.992";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1001";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -4852,6 +4853,7 @@
 							GIV(framePointer) = localFP;
 							
 							ceEnterCogCodePopReceiverReg();
+							null;
 							goto l300;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -4869,7 +4871,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-					/* return self */
+					null;
 				l300:	/* end baseFrameReturn */;
 					goto l299;
 				}
@@ -7972,7 +7974,7 @@
 			/* bytecodePrimBitShift */
 			{
 				sqInt integerArgument;
-				sqLong integerReceiver;
+				usqInt integerReceiver;
 				sqInt shifted;
 				char *sp;
 
@@ -8032,7 +8034,7 @@
 							null;
 							goto l108;
 						}
-						shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
+						shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
 					}
 					shifted = positive32BitIntegerFor(shifted);
 					/* begin pop:thenPush: */
@@ -10926,7 +10928,7 @@
 			/* bytecodePrimBitShift */
 			{
 				sqInt integerArgument;
-				sqLong integerReceiver;
+				usqInt integerReceiver;
 				sqInt shifted;
 				char *sp;
 
@@ -10986,7 +10988,7 @@
 							null;
 							goto l243;
 						}
-						shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
+						shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
 					}
 					shifted = positive32BitIntegerFor(shifted);
 					/* begin pop:thenPush: */
@@ -18643,91 +18645,6 @@
 	printf("\n");
 }
 
-sqInt
-printFrame(char *theFP)
-{   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    char *aFrame;
-    sqInt index;
-    char *prevFrame;
-    char *startFrame;
-    StackPage *thePage;
-    char *theSP;
-
-	if (theFP == GIV(framePointer)) {
-		theSP = GIV(stackPointer);
-	}
-	else {
-		/* begin stackPageFor: */
-		/* begin stackPageAt: */
-		/* begin pageIndexFor: */
-		assert((((((char *) theFP)) >= (GIV(stackBasePlus1) - 1)) && ((((char *) theFP)) <= (((char *) GIV(pages))))));
-		index = pageIndexForstackBasePlus1bytesPerPage(theFP, GIV(stackBasePlus1), GIV(bytesPerPage));
-		thePage = stackPageAtpages(index, GIV(pages));
-		if (isFree(thePage)) {
-			/* begin printHexPtr: */
-			printHex(oopForPointer(theFP));
-			print(" is on a free page?!");
-			/* begin cr */
-			printf("\n");
-			return null;
-		}
-		if ((thePage != GIV(stackPage))
-		 && (theFP == ((thePage->headFP)))) {
-			theSP = (thePage->headSP);
-		}
-		else {
-			/* begin findSPOrNilOf:on:startingFrom: */
-			startFrame = ((thePage == GIV(stackPage))
-			 && (((GIV(framePointer) >= ((thePage->realStackLimit))) && (GIV(framePointer) <= ((thePage->baseAddress)))))
-				? GIV(framePointer)
-				: (thePage->headFP));
-			assert(!(isFree(thePage)));
-			if (startFrame == theFP) {
-				if (((thePage->headSP)) >= startFrame) {
-
-					/* If the SP is invalid return the pointer to the receiver field. */
-
-					/* begin frameReceiverOffset: */
-					theSP = ((((usqInt)(longAt(aFrame + FoxMethod)))) < (startOfMemory())
-						? aFrame + FoxMFReceiver
-						: aFrame + FoxIFReceiver);
-					goto l1;
-				}
-				theSP = (thePage == GIV(stackPage)
-					? (thePage->headSP)
-					: ((thePage->headSP)) + BytesPerWord);
-				goto l1;
-			}
-			aFrame = startFrame;
-			while (1) {
-				prevFrame = aFrame;
-				/* begin frameCallerFP: */
-				aFrame = pointerForOop(longAt(aFrame + FoxSavedFP));
-				if (!(aFrame != 0)) break;
-				if (theFP == aFrame) {
-					/* begin frameCallerSP: */
-					assert(!(isBaseFrame(prevFrame)));
-					theSP = (prevFrame + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(prevFrame + FoxMethod)))) < (startOfMemory())
-	? ((mframeCogMethod(prevFrame))->cmNumArgs)
-	: byteAt((prevFrame + FoxIFrameFlags) + 1))))) + BytesPerWord;
-					goto l1;
-				}
-			}
-			theSP = null;
-		l1:	/* end findSPOrNilOf:on:startingFrom: */;
-		}
-	}
-	if (theSP == null) {
-		print("could not find sp; using bogus value");
-		/* begin cr */
-		printf("\n");
-		theSP = theFP + (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
-	? FoxMFReceiver
-	: FoxIFReceiver));
-	}
-	printFrameWithSP(theFP, theSP);
-}
-
 void
 printFrameWithSP(char *theFP, char *theSP)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -23659,44 +23576,34 @@
 }
 
 
-/*	Similar to primitiveArrayBecomeOneWay but accepts a third argument whether
-	to copy
-	the receiver's identity hash over the argument's identity hash.
+/*	Similar to primitiveArrayBecomeOneWay but accepts a third argument
+	deciding whether to
+	copy the receiver's element's identity hash over the argument's elementy's
+	identity hash.
  */
 
 static void
 primitiveArrayBecomeOneWayCopyHash(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt arg;
     sqInt copyHashFlag;
     sqInt ec;
-    sqInt rcvr;
 
-	/* begin booleanValueOf: */
 	if ((longAt(GIV(stackPointer))) == GIV(trueObj)) {
 		copyHashFlag = 1;
-		goto l1;
 	}
-	if ((longAt(GIV(stackPointer))) == GIV(falseObj)) {
-		copyHashFlag = 0;
-		goto l1;
+	else {
+		if ((longAt(GIV(stackPointer))) == GIV(falseObj)) {
+			copyHashFlag = 0;
+		}
+		else {
+			GIV(primFailCode) = PrimErrBadArgument;
+			return;
+		}
 	}
-	/* begin success: */
-	
-	/* Don't overwrite an error code that has already been set. */
-
-	if (!GIV(primFailCode)) {
-		GIV(primFailCode) = 1;
-	}
-
-	copyHashFlag = null;
-l1:	/* end booleanValueOf: */;
-	arg = longAt(GIV(stackPointer) + (1 * BytesPerWord));
-	rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
-	ec = becomewithtwoWaycopyHash(rcvr, arg, 0, copyHashFlag);
+	ec = becomewithtwoWaycopyHash(longAt(GIV(stackPointer) + (2 * BytesPerWord)), longAt(GIV(stackPointer) + (1 * BytesPerWord)), 0, copyHashFlag);
 	if (ec == PrimNoErr) {
 		/* begin pop: */
-		GIV(stackPointer) += 2 * BytesPerWord;
+		GIV(stackPointer) += GIV(argumentCount) * BytesPerWord;
 		null;
 	}
 	else {
@@ -24534,7 +24441,7 @@
 primitiveBitShift(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt integerArgument;
-    sqLong integerReceiver;
+    usqInt integerReceiver;
     sqInt shifted;
     char *sp;
 
@@ -24581,7 +24488,7 @@
 				}
 				return;
 			}
-			shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
+			shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
 		}
 		shifted = positive32BitIntegerFor(shifted);
 		/* begin pop:thenPush: */
@@ -24900,25 +24807,6 @@
 }
 
 static void
-primitiveCharacterValue(void)
-{   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt characterCode;
-    sqInt characterObject;
-    char *sp;
-
-	characterObject = longAt(GIV(stackPointer));
-
-	/* the Character must be the receiver for safety */
-
-	characterCode = (CharacterTable == null
-		? (((characterValueOf(characterObject)) << 1) | 1)
-		: longAt((characterObject + BaseHeaderSize) + (CharacterValueIndex << (shiftForWord()))));
-	/* begin pop:thenPush: */
-	longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), characterCode);
-	GIV(stackPointer) = sp;
-}
-
-static void
 primitiveClass(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
@@ -26779,8 +26667,6 @@
     char *sp;
     char *sp1;
 
-	/* begin initPrimCall */
-	GIV(primFailCode) = 0;
 	rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
 	index = longAt(GIV(stackPointer));
 	if (index == ConstOne) {
@@ -26826,8 +26712,6 @@
     char *sp1;
     usqInt valueToStore;
 
-	/* begin initPrimCall */
-	GIV(primFailCode) = 0;
 	oopToStore = longAt(GIV(stackPointer));
 	valueToStore = positive32BitValueOf(oopToStore);
 	if (GIV(primFailCode)) {
@@ -26836,6 +26720,7 @@
 	}
 	rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
 	index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+	
 	if (index == ConstOne) {
 		/* begin storeLong32:ofObject:withValue: */
 		fieldIndex = (VMBIGENDIAN
@@ -29160,8 +29045,9 @@
 static void
 primitiveIsPinned(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt aValue;
     sqInt obj;
+    char *sp;
+    sqInt trueOrFalse;
 
 	obj = longAt(GIV(stackPointer));
 	if (((obj & 1))
@@ -29169,12 +29055,13 @@
 		(GIV(primFailCode) = PrimErrBadReceiver);
 		return;
 	}
-	/* begin pop: */
-	GIV(stackPointer) += (GIV(argumentCount) - 1) * BytesPerWord;
-	null;
-	/* begin stackTopPut: */
-	aValue = GIV(falseObj);
-	longAtPointerput(GIV(stackPointer), aValue);
+	/* begin pop:thenPushBool: */
+	trueOrFalse = 0
+	 && (GIV(falseObj));
+	longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (trueOrFalse
+		? GIV(trueObj)
+		: GIV(falseObj)));
+	GIV(stackPointer) = sp;
 }
 
 
@@ -31051,7 +30938,7 @@
 	}
 
 	/* begin pop:thenPush: */
-	longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) - 1) - 1) * BytesPerWord)), wasPinned);
+	longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), wasPinned);
 	GIV(stackPointer) = sp;
 }
 
@@ -49762,7 +49649,93 @@
 	printf("\n");
 }
 
+sqInt
+printFrame(char *theFP)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    char *aFrame;
+    sqInt index;
+    char *prevFrame;
+    char *startFrame;
+    StackPage *thePage;
+    char *theSP;
 
+	if (theFP == GIV(framePointer)) {
+		theSP = GIV(stackPointer);
+	}
+	else {
+		/* begin stackPageFor: */
+		/* begin stackPageAt: */
+		/* begin pageIndexFor: */
+		assert((((((char *) theFP)) >= (GIV(stackBasePlus1) - 1)) && ((((char *) theFP)) <= (((char *) GIV(pages))))));
+		index = pageIndexForstackBasePlus1bytesPerPage(theFP, GIV(stackBasePlus1), GIV(bytesPerPage));
+		thePage = stackPageAtpages(index, GIV(pages));
+		if (isFree(thePage)) {
+			/* begin printHexPtr: */
+			printHex(oopForPointer(theFP));
+			print(" is on a free page?!");
+			/* begin cr */
+			printf("\n");
+			return null;
+		}
+		if ((thePage != GIV(stackPage))
+		 && (theFP == ((thePage->headFP)))) {
+			theSP = (thePage->headSP);
+		}
+		else {
+			/* begin findSPOrNilOf:on:startingFrom: */
+			startFrame = ((thePage == GIV(stackPage))
+			 && (((GIV(framePointer) >= ((thePage->realStackLimit))) && (GIV(framePointer) <= ((thePage->baseAddress)))))
+				? GIV(framePointer)
+				: (thePage->headFP));
+			assert(!(isFree(thePage)));
+			if (startFrame == theFP) {
+				if (((thePage->headSP)) >= startFrame) {
+
+					/* If the SP is invalid return the pointer to the receiver field. */
+
+					/* begin frameReceiverOffset: */
+					theSP = ((((usqInt)(longAt(aFrame + FoxMethod)))) < (startOfMemory())
+						? aFrame + FoxMFReceiver
+						: aFrame + FoxIFReceiver);
+					goto l1;
+				}
+				theSP = (thePage == GIV(stackPage)
+					? (thePage->headSP)
+					: ((thePage->headSP)) + BytesPerWord);
+				goto l1;
+			}
+			aFrame = startFrame;
+			while (1) {
+				prevFrame = aFrame;
+				/* begin frameCallerFP: */
+				aFrame = pointerForOop(longAt(aFrame + FoxSavedFP));
+				if (!(aFrame != 0)) break;
+				if (theFP == aFrame) {
+					/* begin frameCallerSP: */
+					assert(!(isBaseFrame(prevFrame)));
+					theSP = (prevFrame + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(prevFrame + FoxMethod)))) < (startOfMemory())
+	? ((mframeCogMethod(prevFrame))->cmNumArgs)
+	: byteAt((prevFrame + FoxIFrameFlags) + 1))))) + BytesPerWord;
+					goto l1;
+				}
+			}
+			theSP = null;
+		l1:	/* end findSPOrNilOf:on:startingFrom: */;
+		}
+	}
+	if (!(theSP)) {
+		print("could not find sp; using bogus value");
+		/* begin cr */
+		printf("\n");
+		/* begin frameReceiverOffset: */
+		theSP = ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
+			? theFP + FoxMFReceiver
+			: theFP + FoxIFReceiver);
+	}
+	printFrameWithSP(theFP, theSP);
+}
+
+
 /*	Print n in hex, in the form ' 0x1234', padded to a width of 10 characters
 	in 32-bits ('0x' + 8 nibbles) or 18 characters in 64-bits ('0x' + 16
 	nibbles)  */
@@ -50696,6 +50669,86 @@
 	printf("\n");
 }
 
+void
+printStackReferencesTo(sqInt oop)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    char *callerFP;
+    sqInt i;
+    char *theFP;
+    StackPage *thePage;
+    char *theSP;
+
+	for (i = 0; i < GIV(numStackPages); i += 1) {
+		/* begin stackPageAt: */
+		thePage = stackPageAtpages(i, GIV(pages));
+		if (!(((thePage->baseFP)) == 0)) {
+			theSP = (thePage->headSP);
+
+			/* Skip the instruction pointer on top of stack of inactive pages. */
+
+			theFP = (thePage->headFP);
+			if (!(thePage == GIV(stackPage))) {
+				theSP += BytesPerWord;
+			}
+			while (1) {
+				while (theSP <= (frameReceiverOffset(theFP))) {
+					if (oop == (longAt(theSP))) {
+						print("FP: ");
+						/* begin printHexnp: */
+						printf("0x%lx", theFP);
+						print(" @ ");
+						/* begin printHexnp: */
+						printf("0x%lx", theSP);
+						/* begin cr */
+						printf("\n");
+					}
+					theSP += BytesPerWord;
+				}
+				if (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
+					? ((longAt(theFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
+					: (byteAt((theFP + FoxIFrameFlags) + 2)) != 0)) {
+					if (oop == (longAt(theFP + FoxThisContext))) {
+						print("FP: ");
+						/* begin printHexnp: */
+						printf("0x%lx", theFP);
+						print(" CTXT");
+						/* begin cr */
+						printf("\n");
+					}
+				}
+				if (oop == (longAt(theFP + FoxMethod))) {
+					print("FP: ");
+					/* begin printHexnp: */
+					printf("0x%lx", theFP);
+					print(" MTHD");
+					/* begin cr */
+					printf("\n");
+				}
+				if (!(((callerFP = frameCallerFP(theFP))) != 0)) break;
+				theSP = (theFP + FoxCallerSavedIP) + BytesPerWord;
+				theFP = callerFP;
+			}
+
+			/* a.k.a. FoxCallerContext */
+
+			theSP = theFP + FoxCallerSavedIP;
+			while (theSP <= ((thePage->baseAddress))) {
+				if (oop == (longAt(theSP))) {
+					print("FP: ");
+					/* begin printHexnp: */
+					printf("0x%lx", theFP);
+					print(" @ ");
+					/* begin printHexnp: */
+					printf("0x%lx", theSP);
+					/* begin cr */
+					printf("\n");
+				}
+				theSP += BytesPerWord;
+			}
+		}
+	}
+}
+
 static void
 printStringOf(sqInt oop)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -52210,6 +52263,30 @@
 }
 
 
+/*	Return the stackPointer of a Context or BlockContext. */
+
+static sqInt
+stackPointerForMaybeMarriedContext(sqInt aContext)
+{
+    sqInt sp;
+    sqInt sp1;
+
+	if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << (shiftForWord())))) & 1))
+	 && (!(isWidowedContext(aContext)))) {
+		sp = stackPointerIndexForFrame(frameOfMarriedContext(aContext));
+		assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(aContext)));
+		return sp;
+	}
+	/* begin fetchStackPointerOf: */
+	sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << (shiftForWord())));
+	if (!((sp1 & 1))) {
+		return 0;
+	}
+	assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext)));
+	return (sp1 >> 1);
+}
+
+
 /*	Return the 0-based index rel to the given frame.
 	(This is what stackPointer used to be before conversion to pointer) */
 /*	In the StackInterpreter stacks grow down. */
@@ -55547,14 +55624,34 @@
 	GIV(primFailCode) = PrimErrBadArgument;
 }
 
+
+/*	Answer a slot in an object. This numbers all slots from 1, ignoring the
+	distinction between
+	named and indexed inst vars. In objects with both named and indexed inst
+	vars, the named
+	inst vars preceed the indexed ones. In non-object indexed objects (objects

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list