[Vm-dev] [commit][3023] CogVM source as per VMMaker.oscog-eem.790

commits at squeakvm.org commits at squeakvm.org
Tue Jul 1 03:10:00 UTC 2014


Revision: 3023
Author:   eliot
Date:     2014-06-30 20:09:58 -0700 (Mon, 30 Jun 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.790

Implement following forwarders on primitive failure in machine code interpreter
primitives (still have to implement this in sideways calls of named primitives).

Allow the JIT to not compile primitiveDoNamedPrimitiveWithArgs
to avoid any potential complications.

Rewrite all the semaphore installing primitives to fail if the semaphore arg is
neither a semaphore or nil instead of assuming if its not a semaphore it must be
nil, so as to fail and retry when semaphores are forwarded (as they are when
Semaphore is redefined).

Implement isSemaphoreOop:/Obj: in the object memories to abstract away the code.
Base Spur's on the class index of splObj: ClassSemaphore, avoiding the table
lookup to derive the class.  Make checkForEventsMayContextSwitch: treat all its
semaphores consistently.

Have spur's fetchClassOfNonImm: answer nilObj for
forwarders to avoid assert fails.

On Spur add read barriers to primitiveSuspend and synchronousSignal:'s myList
access, because the process list manipulation routines do no checking.  Add
assert checks for forwarders in the process list manipulation routines.

Fix slip in StackInterpreter>>actuallyFollowNecessaryForwardingInMethod:literalCount:
that corrupts the methodClassAssociation.

Abstract out the call machinery from compileTrampolineFor:numArgs:arg:arg:arg:-
arg:saveRegs:pushLinkReg:resultReg: so it can be used by
maybeCompileRetry:onPrimitiveFail: in implementing following forwarders on
primitive failure in machine code, and the Open PIC miss call.

Have bytecodePCFor:cogMethod:startBcpc: map any pc before the stackCheckOffset
to the initialPC, which applies to primitives in progress.

Fix assert fails in updateStateOfSpouseContextForFrame:WithSP:
and elsewhere with forwarders.

LargeIntegers Plugin:
Fix a latent signed shift bug in cDigitSub:len:with:len:into:
caused by VMMaker.oscog-eem.785's eliminating the
divide-via-shift optimization.

These changes allow Cog Spur to redefine Process and/or Semaphore and not hang.

Modified Paths:
--------------
    branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c
    branches/Cog/nscogsrc/vm/cogit.c
    branches/Cog/nscogsrc/vm/cogit.h
    branches/Cog/nscogsrc/vm/cogmethod.h
    branches/Cog/nscogsrc/vm/cointerp.c
    branches/Cog/nscogsrc/vm/cointerp.h
    branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
    branches/Cog/nscogsrc/vm/interp.h
    branches/Cog/nscogsrc/vm/vmCallback.h
    branches/Cog/nsspursrc/vm/cogit.c
    branches/Cog/nsspursrc/vm/cogit.h
    branches/Cog/nsspursrc/vm/cogmethod.h
    branches/Cog/nsspursrc/vm/cointerp.c
    branches/Cog/nsspursrc/vm/cointerp.h
    branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
    branches/Cog/nsspursrc/vm/interp.h
    branches/Cog/nsspursrc/vm/vmCallback.h
    branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c
    branches/Cog/nsspurstacksrc/vm/interp.c
    branches/Cog/nsspurstacksrc/vm/interp.h
    branches/Cog/nsspurstacksrc/vm/vmCallback.h
    branches/Cog/scripts/uploadvms
    branches/Cog/sistasrc/vm/cogit.c
    branches/Cog/sistasrc/vm/cogit.h
    branches/Cog/sistasrc/vm/cogmethod.h
    branches/Cog/sistasrc/vm/cointerp.c
    branches/Cog/sistasrc/vm/cointerp.h
    branches/Cog/sistasrc/vm/gcc3x-cointerp.c
    branches/Cog/sistasrc/vm/interp.h
    branches/Cog/sistasrc/vm/vmCallback.h
    branches/Cog/spursistasrc/vm/cogit.c
    branches/Cog/spursistasrc/vm/cogit.h
    branches/Cog/spursistasrc/vm/cogmethod.h
    branches/Cog/spursistasrc/vm/cointerp.c
    branches/Cog/spursistasrc/vm/cointerp.h
    branches/Cog/spursistasrc/vm/gcc3x-cointerp.c
    branches/Cog/spursistasrc/vm/interp.h
    branches/Cog/spursistasrc/vm/vmCallback.h
    branches/Cog/spursrc/vm/cogit.c
    branches/Cog/spursrc/vm/cogit.h
    branches/Cog/spursrc/vm/cogmethod.h
    branches/Cog/spursrc/vm/cointerp.c
    branches/Cog/spursrc/vm/cointerp.h
    branches/Cog/spursrc/vm/gcc3x-cointerp.c
    branches/Cog/spursrc/vm/interp.h
    branches/Cog/spursrc/vm/vmCallback.h
    branches/Cog/spurstacksrc/vm/gcc3x-interp.c
    branches/Cog/spurstacksrc/vm/interp.c
    branches/Cog/spurstacksrc/vm/interp.h
    branches/Cog/spurstacksrc/vm/vmCallback.h
    branches/Cog/src/plugins/LargeIntegers/LargeIntegers.c
    branches/Cog/src/vm/cogit.c
    branches/Cog/src/vm/cogit.h
    branches/Cog/src/vm/cogmethod.h
    branches/Cog/src/vm/cointerp.c
    branches/Cog/src/vm/cointerp.h
    branches/Cog/src/vm/cointerpmt.c
    branches/Cog/src/vm/cointerpmt.h
    branches/Cog/src/vm/gcc3x-cointerp.c
    branches/Cog/src/vm/gcc3x-cointerpmt.c
    branches/Cog/src/vm/interp.h
    branches/Cog/src/vm/vmCallback.h
    branches/Cog/stacksrc/vm/gcc3x-interp.c
    branches/Cog/stacksrc/vm/interp.c
    branches/Cog/stacksrc/vm/interp.h
    branches/Cog/stacksrc/vm/vmCallback.h

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

Modified: branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c
===================================================================
--- branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c	2014-06-29 06:02:05 UTC (rev 3022)
+++ branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c	2014-07-01 03:09:58 UTC (rev 3023)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.787 uuid: 4b38ebc1-339f-4523-a9fc-047923108211
+	SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59
    from
-	LargeIntegersPlugin VMMaker.oscog-eem.787 uuid: 4b38ebc1-339f-4523-a9fc-047923108211
+	LargeIntegersPlugin VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59
  */
-static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.787 uuid: 4b38ebc1-339f-4523-a9fc-047923108211 " __DATE__ ;
+static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 " __DATE__ ;
 
 
 
@@ -172,9 +172,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"LargeIntegers v1.5 VMMaker.oscog-eem.787 (i)"
+	"LargeIntegers v1.5 VMMaker.oscog-eem.790 (i)"
 #else
-	"LargeIntegers v1.5 VMMaker.oscog-eem.787 (e)"
+	"LargeIntegers v1.5 VMMaker.oscog-eem.790 (e)"
 #endif
 ;
 static const int  orOpIndex = 1;
@@ -950,24 +950,21 @@
 cDigitSublenwithleninto(unsigned char *  pByteSmall, sqInt smallLen, unsigned char *  pByteLarge, sqInt largeLen, unsigned char *  pByteRes)
 {
 	sqInt i;
-	sqInt limit;
 	sqInt z;
 
 
 	/* Loop invariant is -1<=z<=1 */
 
 	z = 0;
-	limit = smallLen - 1;
-	for (i = 0; i <= limit; i += 1) {
+	for (i = 0; i < smallLen; i += 1) {
 		z = (z + (pByteLarge[i])) - (pByteSmall[i]);
 		pByteRes[i] = (z - ((z / 256) * 256));
-		z = z / 256;
+		z = ((signed)z >> 8);
 	}
-	limit = largeLen - 1;
-	for (i = smallLen; i <= limit; i += 1) {
+	for (i = smallLen; i < largeLen; i += 1) {
 		z += pByteLarge[i];
 		pByteRes[i] = (z - ((z / 256) * 256));
-		z = z / 256;
+		z = ((signed)z >> 8);
 	}
 }
 
@@ -1856,7 +1853,6 @@
 	sqInt i;
 	sqInt larger;
 	sqInt largerLen;
-	sqInt limit;
 	sqInt neg;
 	unsigned char *  pByteLarge;
 	unsigned char *  pByteRes;
@@ -1910,17 +1906,15 @@
 	/* Loop invariant is -1<=z<=1 */
 
 	z = 0;
-	limit = smallerLen - 1;
-	for (i = 0; i <= limit; i += 1) {
+	for (i = 0; i < smallerLen; i += 1) {
 		z = (z + (pByteLarge[i])) - (pByteSmall[i]);
 		pByteRes[i] = (z - ((z / 256) * 256));
-		z = z / 256;
+		z = ((signed)z >> 8);
 	}
-	limit = largerLen - 1;
-	for (i = smallerLen; i <= limit; i += 1) {
+	for (i = smallerLen; i < largerLen; i += 1) {
 		z += pByteLarge[i];
 		pByteRes[i] = (z - ((z / 256) * 256));
-		z = z / 256;
+		z = ((signed)z >> 8);
 	}
 	return (neg
 		? normalizeNegative(res)

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2014-06-29 06:02:05 UTC (rev 3022)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-07-01 03:09:58 UTC (rev 3023)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.786 uuid: 425c25e8-f3f6-4f06-b2eb-392c5da0ed44
+	CCodeGenerator VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.786 uuid: 425c25e8-f3f6-4f06-b2eb-392c5da0ed44
+	StackToRegisterMappingCogit VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.786 uuid: 425c25e8-f3f6-4f06-b2eb-392c5da0ed44 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -252,7 +252,7 @@
 #define MapEnd 0
 #define MaxCompiledPrimitiveIndex 222
 #define MaxMethodSize 65535
-#define MaxNegativeErrorCode -7
+#define MaxNegativeErrorCode -8
 #define MaxNumArgs 15
 #define MaxStackAllocSize 1572864
 #define MaxStackCheckOffset 0xFFF
@@ -304,6 +304,7 @@
 #define PopR 69
 #define PrefetchAw 72
 #define PrimCallCollectsProfileSamples 8
+#define PrimCallDoNotJIT 32
 #define PrimCallMayCallBack 4
 #define PrimCallNeedsNewMethod 1
 #define PrimCallNeedsPrimitiveFunction 2
@@ -321,6 +322,7 @@
 #define SendNumArgsReg -6
 #define SFENCE 116
 #define ShiftForWord 2
+#define ShouldNotJIT -8
 #define SIB1 0
 #define SIB4 2
 #define Size4Bit 0
@@ -450,6 +452,7 @@
 static void compileBlockEntry(BlockStart *blockStart) NoDbgRegParms;
 static void compileBlockFrameBuild(BlockStart *blockStart) NoDbgRegParms;
 static void compileBlockFramelessEntry(BlockStart *blockStart) NoDbgRegParms;
+static void compileCallFornumArgsargargargargresultRegsaveRegs(void *aRoutine, sqInt numArgs, sqInt regOrConst0, sqInt regOrConst1, sqInt regOrConst2, sqInt regOrConst3, sqInt resultRegOrNil, sqInt saveRegs) NoDbgRegParms;
 static sqInt compileClosedPICPrototype(void);
 static CogMethod * compileCogMethod(sqInt selector) NoDbgRegParms;
 static AbstractInstruction * compileCPICEntry(void);
@@ -953,6 +956,7 @@
 static void marshallSendArguments(sqInt numArgs) NoDbgRegParms;
 usqInt maxCogMethodAddress(void);
 static void maybeCompileAllocFillerCheck(void);
+static void maybeCompileRetryonPrimitiveFail(sqInt retryInst, sqInt primIndex) NoDbgRegParms;
 static sqInt maybeFreeCogMethodDoesntLookKosher(CogMethod *cogMethod) NoDbgRegParms;
 static sqInt maybeGenerateCheckFeatures(void);
 static sqInt maybeGenerateICacheFlush(void);
@@ -1193,7 +1197,6 @@
 static sqInt compilationTrace;
 static sqInt cPICCaseSize;
 static sqInt cPICEndSize;
-static const int cStackAlignment = STACK_ALIGN_BYTES;
 static sqInt deadCode;
 static sqInt debugFixupBreaks;
 unsigned long debugPrimCallStackOffset;
@@ -4490,6 +4493,73 @@
 }
 
 
+/*	Generate a call to aRoutine with up to 4 arguments. If resultRegOrNil is
+	non-zero assign the C result to resultRegOrNil. If saveRegs, save all
+	registers. Hack: a negative arg value indicates an abstract register, a
+	non-negative value
+	indicates a constant. */
+
+static void
+compileCallFornumArgsargargargargresultRegsaveRegs(void *aRoutine, sqInt numArgs, sqInt regOrConst0, sqInt regOrConst1, sqInt regOrConst2, sqInt regOrConst3, sqInt resultRegOrNil, sqInt saveRegs)
+{
+    const int cStackAlignment = STACK_ALIGN_BYTES;
+
+	if (cStackAlignment > BytesPerWord) {
+		genAlignCStackSavingRegistersnumArgswordAlignment(backEnd, saveRegs, numArgs, cStackAlignment / BytesPerWord);
+	}
+	if (saveRegs) {
+		genSaveRegisters(backEnd);
+	}
+	if (numArgs > 0) {
+		if (numArgs > 1) {
+			if (numArgs > 2) {
+				if (numArgs > 3) {
+					if (regOrConst3 < 0) {
+						genPassRegasArgument(backEnd, regOrConst3, 3);
+					}
+					else {
+						genPassConstasArgument(backEnd, regOrConst3, 3);
+					}
+				}
+				if (regOrConst2 < 0) {
+					genPassRegasArgument(backEnd, regOrConst2, 2);
+				}
+				else {
+					genPassConstasArgument(backEnd, regOrConst2, 2);
+				}
+			}
+			if (regOrConst1 < 0) {
+				genPassRegasArgument(backEnd, regOrConst1, 1);
+			}
+			else {
+				genPassConstasArgument(backEnd, regOrConst1, 1);
+			}
+		}
+		if (regOrConst0 < 0) {
+			genPassRegasArgument(backEnd, regOrConst0, 0);
+		}
+		else {
+			genPassConstasArgument(backEnd, regOrConst0, 0);
+		}
+	}
+	CallRT(((usqInt)aRoutine));
+	if (!(resultRegOrNil == null)) {
+		genWriteCResultIntoReg(backEnd, resultRegOrNil);
+	}
+	if (saveRegs) {
+		if (numArgs > 0) {
+			genRemoveNArgsFromStack(backEnd, numArgs);
+		}
+		if (resultRegOrNil == null) {
+			genRestoreRegs(backEnd);
+		}
+		else {
+			genRestoreRegsExcept(backEnd, resultRegOrNil);
+		}
+	}
+}
+
+
 /*	Compile the abstract instructions for a full closed PIC used to initialize
 	closedPICSize. The loads into SendNumArgsReg are those for optional method
 	objects which may be
@@ -4886,6 +4956,7 @@
     sqInt offset1;
     sqInt reg;
     sqInt retpc;
+    AbstractInstruction *retry;
 
 
 	/* Save processor fp, sp and return pc in the interpreter's frame stack and instruction pointers */
@@ -4893,7 +4964,10 @@
 	genExternalizePointersForPrimitiveCall();
 	genLoadCStackPointersForPrimCall();
 	flags = primitivePropertyFlags(primitiveIndex);
-	if ((flags & PrimCallCollectsProfileSamples) != 0) {
+	if (flags & PrimCallDoNotJIT) {
+		return ShouldNotJIT;
+	}
+	if (flags & PrimCallCollectsProfileSamples) {
 
 		/* Test nextProfileTick for being non-zero and call checkProfileTick if so */
 
@@ -4911,8 +4985,11 @@
 		/* begin Label */
 		continuePostSampleNonPrim = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
 	}
+	if (recordPrimTrace()) {
+		genFastPrimTraceUsingand(ClassReg, SendNumArgsReg);
+	}
 	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, 0, TempReg);
+	retry = genoperandoperand(MoveCqR, 0, TempReg);
 	/* begin MoveR:Aw: */
 	address11 = primFailCodeAddress();
 	genoperandoperand(MoveRAw, TempReg, address11);
@@ -4923,21 +5000,18 @@
 	/* begin MoveR:Aw: */
 	address12 = argumentCountAddress();
 	genoperandoperand(MoveRAw, TempReg, address12);
-	if ((flags & PrimCallNeedsPrimitiveFunction) != 0) {
+	if (flags & PrimCallNeedsPrimitiveFunction) {
 		/* begin MoveCw:R: */
 		genoperandoperand(MoveCwR, ((sqInt)primitiveRoutine), TempReg);
 		/* begin MoveR:Aw: */
 		address3 = primitiveFunctionPointerAddress();
 		genoperandoperand(MoveRAw, TempReg, address3);
 	}
-	if (recordPrimTrace()) {
-		genFastPrimTraceUsingand(ClassReg, SendNumArgsReg);
-	}
-	if ((flags & (PrimCallNeedsNewMethod + PrimCallMayCallBack)) != 0) {
+	if (flags & (PrimCallNeedsNewMethod + PrimCallMayCallBack)) {
 
 		/* The ceActivateFailingPrimitiveMethod: machinery can't handle framelessness. */
 
-		if ((flags & PrimCallMayCallBack) != 0) {
+		if (flags & PrimCallMayCallBack) {
 			needsFrame = 1;
 		}
 		addDependent(methodLabel, annotateAbsolutePCRef(gMoveCwR(((sqInt)methodLabel), ClassReg)));
@@ -4951,12 +5025,12 @@
 	/* begin PrefetchAw: */
 	address13 = primFailCodeAddress();
 	genoperand(PrefetchAw, address13);
-	if ((flags & PrimCallMayCallBack) != 0) {
+	if (flags & PrimCallMayCallBack) {
 
 		/* Sideways call the C primitive routine so that we return through cePrimReturnEnterCogCode. */
 
 		/* begin genSubstituteReturnAddress: */
-		retpc = ((flags & PrimCallCollectsProfileSamples) != 0
+		retpc = (flags & PrimCallCollectsProfileSamples
 			? cePrimReturnEnterCogCodeProfiling
 			: cePrimReturnEnterCogCode);
 		/* begin PushCw: */
@@ -4973,8 +5047,8 @@
 		CallRT(((sqInt)primitiveRoutine));
 		/* begin Label */
 		primInvokeLabel = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
-		if ((flags & PrimCallCollectsProfileSamples) != 0) {
-			assert((flags & PrimCallNeedsNewMethod) != 0);
+		if (flags & PrimCallCollectsProfileSamples) {
+			assert(flags & PrimCallNeedsNewMethod);
 			/* begin MoveAw:R: */
 			address5 = nextProfileTickAddress();
 			genoperandoperand(MoveAwR, address5, TempReg);
@@ -4989,6 +5063,7 @@
 			/* begin Label */
 			continuePostSamplePrim = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
 		}
+		maybeCompileRetryonPrimitiveFail(retry, primitiveIndex);
 		maybeCompileAllocFillerCheck();
 		/* begin MoveAw:R: */
 		address8 = instructionPointerAddress();
@@ -5012,7 +5087,7 @@
 		/* begin RetN: */
 		genoperand(RetN, BytesPerWord);
 	}
-	if ((flags & PrimCallCollectsProfileSamples) != 0) {
+	if (flags & PrimCallCollectsProfileSamples) {
 
 		/* The sample is collected by cePrimReturnEnterCogCode for external calls */
 
@@ -5021,8 +5096,8 @@
 			/* Call ceCheckProfileTick: to record sample and then continue. */
 
 			jmpTarget(jmpSamplePrim, gLabel());
-			assert((flags & PrimCallNeedsNewMethod) != 0);
-			CallRT((unsigned long)ceCheckProfileTick);
+			assert(flags & PrimCallNeedsNewMethod);
+			CallRT(((unsigned long)ceCheckProfileTick));
 			/* begin Jump: */
 			genoperand(Jump, ((sqInt)continuePostSamplePrim));
 		}
@@ -5032,7 +5107,7 @@
 		/* begin MoveR:Aw: */
 		address10 = newMethodAddress();
 		genoperandoperand(MoveRAw, TempReg, address10);
-		CallRT((unsigned long)ceCheckProfileTick);
+		CallRT(((unsigned long)ceCheckProfileTick));
 		/* begin Jump: */
 		genoperand(Jump, ((sqInt)continuePostSampleNonPrim));
 	}
@@ -5094,7 +5169,6 @@
 static void
 compileOpenPICnumArgs(sqInt selector, sqInt numArgs)
 {
-    AbstractInstruction *abstractInstruction;
     AbstractInstruction *itsAHit;
     AbstractInstruction *jumpBCMethod;
     AbstractInstruction *jumpClassMiss;
@@ -5106,7 +5180,6 @@
     sqInt offset4;
     sqInt offset5;
     sqInt offset6;
-    sqInt routine;
 
 	compilePICProlog(numArgs);
 	/* begin Nop */
@@ -5198,15 +5271,7 @@
 	genPushRegisterArgsForNumArgs(backEnd, numArgs);
 	genSmalltalkToCStackSwitch();
 	addDependent(methodLabel, annotateAbsolutePCRef(gMoveCwR(((sqInt)methodLabel), SendNumArgsReg)));
-	if (cStackAlignment > BytesPerWord) {
-		genAlignCStackSavingRegistersnumArgswordAlignment(backEnd, 0, 1, cStackAlignment / BytesPerWord);
-	}
-	genPassRegasArgument(backEnd, SendNumArgsReg, 0);
-	routine = (sqInt)ceSendFromInLineCacheMiss;
-	/* begin annotateCall: */
-	/* begin Call: */
-	abstractInstruction = genoperand(Call, routine);
-	annotatewith(abstractInstruction, IsRelativeCall);
+	compileCallFornumArgsargargargargresultRegsaveRegs(ceSendFromInLineCacheMiss, 1, SendNumArgsReg, null, null, null, null, 0);
 }
 
 
@@ -5287,60 +5352,7 @@
 		genoperand(PushR, LinkReg);
 	}
 	genSmalltalkToCStackSwitch();
-	if (cStackAlignment > BytesPerWord) {
-		genAlignCStackSavingRegistersnumArgswordAlignment(backEnd, saveRegs, numArgs, cStackAlignment / BytesPerWord);
-	}
-	if (saveRegs) {
-		genSaveRegisters(backEnd);
-	}
-	if (numArgs > 0) {
-		if (numArgs > 1) {
-			if (numArgs > 2) {
-				if (numArgs > 3) {
-					if (regOrConst3 < 0) {
-						genPassRegasArgument(backEnd, regOrConst3, 3);
-					}
-					else {
-						genPassConstasArgument(backEnd, regOrConst3, 3);
-					}
-				}
-				if (regOrConst2 < 0) {
-					genPassRegasArgument(backEnd, regOrConst2, 2);
-				}
-				else {
-					genPassConstasArgument(backEnd, regOrConst2, 2);
-				}
-			}
-			if (regOrConst1 < 0) {
-				genPassRegasArgument(backEnd, regOrConst1, 1);
-			}
-			else {
-				genPassConstasArgument(backEnd, regOrConst1, 1);
-			}
-		}
-		if (regOrConst0 < 0) {
-			genPassRegasArgument(backEnd, regOrConst0, 0);
-		}
-		else {
-			genPassConstasArgument(backEnd, regOrConst0, 0);
-		}
-	}
-	/* begin Call: */
-	genoperand(Call, ((usqInt)aRoutine));
-	if (!(resultRegOrNil == null)) {
-		genWriteCResultIntoReg(backEnd, resultRegOrNil);
-	}
-	if (saveRegs) {
-		if (numArgs > 0) {
-			genRemoveNArgsFromStack(backEnd, numArgs);
-		}
-		if (resultRegOrNil == null) {
-			genRestoreRegs(backEnd);
-		}
-		else {
-			genRestoreRegsExcept(backEnd, resultRegOrNil);
-		}
-	}
+	compileCallFornumArgsargargargargresultRegsaveRegs(aRoutine, numArgs, regOrConst0, regOrConst1, regOrConst2, regOrConst3, resultRegOrNil, saveRegs);
 	genLoadStackPointers(backEnd);
 	
 	/* begin RetN: */
@@ -12238,7 +12250,6 @@
 	for (numArgs = 0, numArgsLimiT = (1 + 1); numArgs <= numArgsLimiT; numArgs += 1) {
 		picMissTrampolines[numArgs] = (genPICMissTrampolineFor(numArgs));
 	}
-	
 }
 
 static void
@@ -12425,9 +12436,7 @@
 static void
 generateTrampolines(void)
 {
-    sqInt addr;
     sqInt methodZoneStart;
-    sqInt selector;
 
 	methodZoneStart = methodZoneBase;
 	allocateOpcodesbytecodes(80, 0);
@@ -12444,7 +12453,6 @@
 	generateTracingTrampolines();
 	recordGeneratedRunTimeaddress("methodZoneBase", methodZoneBase);
 	flushICacheFromto(processor, methodZoneStart, methodZoneBase);
-	
 }
 
 static void
@@ -14816,11 +14824,7 @@
 	/* begin MoveAw:R: */
 	address6 = cStackPointerAddress();
 	genoperandoperand(MoveAwR, address6, SPReg);
-	if (cStackAlignment > BytesPerWord) {
-		genAlignCStackSavingRegistersnumArgswordAlignment(backEnd, 0, 1, cStackAlignment / BytesPerWord);
-	}
-	genPassRegasArgument(backEnd, SendNumArgsReg, 0);
-	CallRT((unsigned long)ceActivateFailingPrimitiveMethod);
+	compileCallFornumArgsargargargargresultRegsaveRegs(ceActivateFailingPrimitiveMethod, 1, SendNumArgsReg, null, null, null, null, 0);
 	if (profiling) {
 
 		/* Call ceCheckProfileTick: to record sample and then continue.  newMethod
@@ -18988,6 +18992,16 @@
 }
 
 
+/*	Object representations with lazy forwarding will want to check for
+	forwarding pointers on primitive failure and retry the primitive if found.
+	By default do nothing. */
+
+static void
+maybeCompileRetryonPrimitiveFail(sqInt retryInst, sqInt primIndex)
+{
+}
+
+
 /*	Check that the header fields are consistent with the type.
 	Answer 0 if it is ok, otherwise answer a code for the error. */
 

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-06-29 06:02:05 UTC (rev 3022)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-07-01 03:09:58 UTC (rev 3023)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.786 uuid: 425c25e8-f3f6-4f06-b2eb-392c5da0ed44
+	CCodeGenerator VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h	2014-06-29 06:02:05 UTC (rev 3022)
+++ branches/Cog/nscogsrc/vm/cogmethod.h	2014-07-01 03:09:58 UTC (rev 3023)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.786 uuid: 425c25e8-f3f6-4f06-b2eb-392c5da0ed44
+	CCodeGenerator VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59
  */
 
 typedef struct {

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2014-06-29 06:02:05 UTC (rev 3022)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2014-07-01 03:09:58 UTC (rev 3023)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.787 uuid: 4b38ebc1-339f-4523-a9fc-047923108211
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59
    from
-	CoInterpreter VMMaker.oscog-eem.787 uuid: 4b38ebc1-339f-4523-a9fc-047923108211
+	CoInterpreter VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.787 uuid: 4b38ebc1-339f-4523-a9fc-047923108211 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -267,6 +267,7 @@
 #define NextLinkIndex 0
 #define NilObject 0
 #define PrimCallCollectsProfileSamples 8
+#define PrimCallDoNotJIT 32
 #define PrimCallMayCallBack 4
 #define PrimCallNeedsNewMethod 1
 #define PrimCallNeedsPrimitiveFunction 2
@@ -363,6 +364,7 @@
 #endif
 
 sqInt interpret(void);
+sqInt accessorDepthForPrimitiveIndex(sqInt primIndex);
 static void activateCoggedNewMethod(sqInt inInterpreter) NoDbgRegParms;
 static void activateNewMethod(void);
 sqInt activeProcess(void);
@@ -553,7 +555,6 @@
 sqInt falseObject(void);
 void * fetchArrayofObject(sqInt fieldIndex, sqInt objectPointer);
 sqInt fetchByteofObject(sqInt byteIndex, sqInt oop);
-static sqInt fetchClassOfNonImm(sqInt oop) NoDbgRegParms;
 sqInt fetchClassOf(sqInt oop);
 double fetchFloatofObject(sqInt fieldIndex, sqInt objectPointer);
 sqInt fetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer);
@@ -587,6 +588,7 @@
 sqInt floatObjectOf(double aFloat);
 double floatValueOf(sqInt oop);
 sqInt flushExternalPrimitiveOf(sqInt methodObj);
+static void followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth) NoDbgRegParms;
 static sqInt followForwarded(sqInt objOop) NoDbgRegParms;
 static void followForwardingPointersInStackZone(sqInt theBecomeEffectsFlags) NoDbgRegParms;
 static void followNecessaryForwardingInMethod(sqInt methodObj) NoDbgRegParms;
@@ -673,13 +675,13 @@
 sqInt isBytes(sqInt oop);
 sqInt isCharacterObject(sqInt oop);
 sqInt isCharacterValue(sqInt anInteger);
-static sqInt isClassOfNonImmequalTo(sqInt oop, sqInt classOop) NoDbgRegParms;
 sqInt isCogMethodReference(sqInt methodHeader);
 static sqInt isCompiledMethodHeader(sqInt objHeader) NoDbgRegParms;
 sqInt isCompiledMethod(sqInt oop);
 static sqInt isContextHeader(sqInt aHeader) NoDbgRegParms;
 static sqInt isContextNonImm(sqInt oop) NoDbgRegParms;
 static sqInt isContext(sqInt oop) NoDbgRegParms;
+static sqInt isEmptyList(sqInt aLinkedList) NoDbgRegParms;
 sqInt isFloatObject(sqInt oop);
 static sqInt isFrameonPage(char *aFrame, StackPage *aPage) NoDbgRegParms;
 static sqInt isFree(StackPage * self_in_isFree) NoDbgRegParms;
@@ -706,6 +708,7 @@
 sqInt isQuickPrimitiveIndex(sqInt anInteger);
 sqInt isReadMediatedContextInstVarIndex(sqInt index);
 sqInt isReallyYoungObject(sqInt obj);
+static sqInt isSemaphoreOop(sqInt anOop) NoDbgRegParms;
 static sqInt isSingleContext(sqInt aContext) NoDbgRegParms;
 static sqInt isStillMarriedContext(sqInt aContext) NoDbgRegParms;
 static sqInt isWeakNonImm(sqInt oop) NoDbgRegParms;
@@ -1325,21 +1328,21 @@
 _iss StackPage * mostRecentlyUsedPage;
 _iss sqInt numStackPages;
 _iss sqInt needGCFlag;
+_iss sqInt profileProcess;
 _iss sqInt jmpDepth;
 _iss sqLong nextProfileTick;
-_iss usqInt fwdTableNext;
 _iss sqInt longRunningPrimitiveCheckSemaphore;
-_iss sqInt tempOop;
 _iss sqInt profileSemaphore;
+_iss sqInt profileMethod;
+_iss usqInt fwdTableNext;
+_iss sqInt tempOop;
+_iss sqInt longRunningPrimitiveCheckMethod;
 _iss usqInt compStart;
 _iss sqInt extraRootCount;
-_iss sqInt profileProcess;
 _iss sqInt classNameIndex;
 _iss sqInt statGrowMemory;
 _iss sqInt weakRootCount;
 _iss sqInt growHeadroom;
-_iss sqInt longRunningPrimitiveCheckMethod;
-_iss sqInt profileMethod;
 _iss sqInt backwardJumpCount;
 _iss sqInt lastMethodCacheProbeWrite;
 _iss sqInt lkupClass;
@@ -2062,7 +2065,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.787";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.790";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -13072,7 +13075,13 @@
 	return null;
 }
 
+sqInt
+accessorDepthForPrimitiveIndex(sqInt primIndex)
+{
+	return primitiveAccessorDepthTable[primIndex];
+}
 
+
 /*	Activate newMethod when newMethod has been cogged, i.e. create a
 	machine-code frame and (re)enter machine-code.
  */
@@ -13350,8 +13359,9 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt lastLink;
 
+	assert(!(isForwarded(aList)));
 	assert((fetchPointerofObject(NextLinkIndex, proc)) == (nilObject()));
-	if ((longAt((aList + BaseHeaderSize) + (FirstLinkIndex << ShiftForWord))) == GIV(nilObj)) {
+	if (isEmptyList(aList)) {
 		/* begin storePointer:ofObject:withValue: */
 		if ((((usqInt) aList)) < (((usqInt) GIV(youngStart)))) {
 			possibleRootStoreIntovalue(aList, proc);
@@ -14380,13 +14390,20 @@
     sqInt headerPointer;
     sqInt i;
     sqInt i1;
+    sqInt i2;
     sqInt iLimiT;
+    sqInt iLimiT1;
     sqInt last;
     sqInt list;
     sqInt m;
     sqInt methodHeader;
     sqInt next;
     sqInt numLiterals;
+    sqInt obj;
+    sqInt obj1;
+    sqInt obj2;
+    sqInt obj3;
+    sqInt obj4;
     sqInt objHeader;
     sqInt objHeader1;
     sqInt objHeader11;
@@ -14404,6 +14421,7 @@
     sqInt schedAssoc;
     sqInt sp;
     usqInt start;
+    sqInt xArray;
 
 	if ((checkForLeaks & 4) != 0) {
 		runLeakCheckerForFullGC(1);
@@ -16782,6 +16800,7 @@
 		   must be done before any of the synchronousSignals below or else we will
 		   attribute a pause in ioRelinquishProcessor to the newly activated process. */
 
+		GIV(nextProfileTick) = 0;
 		if (GIV(profileProcess) == GIV(nilObj)) {
 			GIV(profileProcess) = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
 			GIV(profileMethod) = GIV(nilObj);
@@ -16790,7 +16809,6 @@
 		 && (synchronousSignal(GIV(profileSemaphore)))) {
 			switched = 1;
 		}
-		GIV(nextProfileTick) = 0;
 	}
 	if (checkDeliveryOfLongRunningPrimitiveSignal()) {
 		switched = 1;
@@ -16839,12 +16857,12 @@
 		}
 	}
 	if (GIV(pendingFinalizationSignals) > 0) {
+		GIV(pendingFinalizationSignals) = 0;
 		sema = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (TheFinalizationSemaphore << ShiftForWord));
-		if ((isClassOfNonImmequalTo(sema, longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord))))
+		if ((sema != GIV(nilObj))
 		 && (synchronousSignal(sema))) {
 			switched = 1;
 		}
-		GIV(pendingFinalizationSignals) = 0;
 	}
 	if (signalExternalSemaphores()) {
 		switched = 1;
@@ -19315,20 +19333,19 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
     sqInt sema;
-    sqInt semaphoreClass;
     sqInt xArray;
 
 	xArray = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ExternalObjectsArray << ShiftForWord));
-	semaphoreClass = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord));
 
 	/* Note: semaphore indices are 1-based */
 
 	sema = longAt((xArray + BaseHeaderSize) + ((index - 1) << ShiftForWord));
-	return ((sema & 1) == 0)
-	 && ((((((ccIndex = (((usqInt) (longAt(sema))) >> 12) & 0x1F)) == 0
+	assert(!(isOopForwarded(sema)));
+	return (((sema & 1) == 0)
+	 && (((((ccIndex = (((usqInt) (longAt(sema))) >> 12) & 0x1F)) == 0
 	? (longAt(sema - BaseHeaderSize)) & AllButTypeMask
-	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == semaphoreClass)
-	 && (synchronousSignal(sema)));
+	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord)))))
+	 && (synchronousSignal(sema));
 }
 
 static void
@@ -21179,16 +21196,6 @@
 	return byteAt((oop + BaseHeaderSize) + byteIndex);
 }
 
-static sqInt
-fetchClassOfNonImm(sqInt oop)
-{   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt ccIndex;
-
-	return (((ccIndex = (((usqInt) (longAt(oop))) >> 12) & 0x1F)) == 0
-		? (longAt(oop - BaseHeaderSize)) & AllButTypeMask
-		: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
-}
-
 sqInt
 fetchClassOf(sqInt oop)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -22351,6 +22358,12 @@
 	}
 }
 
+static void
+followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth)
+{
+	error("shouldNotImplement");
+}
+
 static sqInt
 followForwarded(sqInt objOop)
 {
@@ -24987,26 +25000,6 @@
 	return ((anInteger >= 0) && (anInteger <= 0xFF));
 }
 
-
-/*	Answer if the given (non-immediate) object is an instance of the given
-	class. 
- */
-
-static sqInt
-isClassOfNonImmequalTo(sqInt oop, sqInt classOop)
-{   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt ccIndex;
-    sqInt cl;
-
-	if ((oop & 1)) {
-		return 0;
-	}
-	cl = (((ccIndex = (((usqInt) (longAt(oop))) >> 12) & 0x1F)) == 0
-		? (longAt(oop - BaseHeaderSize)) & AllButTypeMask
-		: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)));
-	return cl == classOop;
-}
-
 sqInt
 isCogMethodReference(sqInt methodHeader)
 {
@@ -25058,6 +25051,13 @@
 	 && (((((usqInt) (longAt(oop))) >> 12) & 0x1F) == ClassMethodContextCompactIndex);
 }
 
+static sqInt
+isEmptyList(sqInt aLinkedList)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+	assert(!(isForwarded(aLinkedList)));
+	return (longAt((aLinkedList + BaseHeaderSize) + (FirstLinkIndex << ShiftForWord))) == GIV(nilObj);
+}
+
 sqInt
 isFloatObject(sqInt oop)
 {
@@ -25358,6 +25358,17 @@
 }
 
 static sqInt
+isSemaphoreOop(sqInt anOop)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt ccIndex;
+
+	return ((anOop & 1) == 0)
+	 && (((((ccIndex = (((usqInt) (longAt(anOop))) >> 12) & 0x1F)) == 0
+	? (longAt(anOop - BaseHeaderSize)) & AllButTypeMask
+	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord))));
+}
+
+static sqInt
 isSingleContext(sqInt aContext)
 {
 	return ((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1) == 0;
@@ -27809,15 +27820,18 @@
 		markAndTrace(GIV(newMethod));
 	}
 	/* begin traceProfileState */
+	;
 	markAndTrace(GIV(profileProcess));
 	markAndTrace(GIV(profileMethod));
 	markAndTrace(GIV(profileSemaphore));
 	sqLowLevelMFence();
 	if ((GIV(longRunningPrimitiveCheckMethod) != null)
 	 && (GIV(longRunningPrimitiveCheckSequenceNumber) != GIV(statCheckForEvents))) {
+		;
 		markAndTrace(GIV(longRunningPrimitiveCheckMethod));
 	}
 	if (GIV(longRunningPrimitiveCheckSemaphore) != null) {
+		;
 		markAndTrace(GIV(longRunningPrimitiveCheckSemaphore));
 	}
 	if (!(GIV(tempOop) == 0)) {
@@ -29424,10 +29438,18 @@
 	else {
 		cogMethodForIP = ((CogBlockMethod *) cogMethod);
 		assert(((cogMethodForIP->cmType)) == CMMethod);
+
+		/* map any pcs in primitive code (i.e. return addresses for interpreter primitive calls) to the initial pc */
+
 		mcpc = (((sqInt)cogMethod)) - theIP;
+		if ((((usqInt)mcpc)) < ((cogMethod->stackCheckOffset))) {
+			bcpc = startBcpc;
+			goto l2;
+		}
 	}
 	assert(((mcpc >= (((sqInt)cogMethod))) && (mcpc <= ((((sqInt)cogMethod)) + ((cogMethod->blockSize))))));
 	bcpc = bytecodePCForstartBcpcin(mcpc, startBcpc, cogMethodForIP);
+l2:	/* end bytecodePCFor:cogMethod:startBcpc: */;
 	assert(bcpc >= (startPCOfMethod(methodObj)));
 	
 	/* If there's a CallPrimitive we need to skip it. */
@@ -35563,7 +35585,7 @@
 	/* CriticalSections are laid out like Semaphores */
 
 	owningProcessIndex = ExcessSignalsIndex;
-	if ((longAt((criticalSection + BaseHeaderSize) + (FirstLinkIndex << ShiftForWord))) == GIV(nilObj)) {
+	if (isEmptyList(criticalSection)) {
 		longAtput((criticalSection + BaseHeaderSize) + (owningProcessIndex << ShiftForWord), GIV(nilObj));
 	}
 	else {
@@ -38377,7 +38399,6 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt arg;
     sqInt ccIndex;
-    sqInt top;
 
 	arg = longAt(GIV(stackPointer));
 	if ((arg & 1)) {
@@ -38401,23 +38422,24 @@
 		}
 		return;
 	}
-	/* begin popStack */
-	top = longAt(GIV(stackPointer));
-	GIV(stackPointer) += BytesPerWord;
-	arg = top;
-	if (!((((arg & 1)
-	? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord))
-	: (((ccIndex = (((usqInt) (longAt(arg))) >> 12) & 0x1F)) == 0
-			? (longAt(arg - BaseHeaderSize)) & AllButTypeMask
-			: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord))))) {
-		arg = GIV(nilObj);
+	if ((arg == GIV(nilObj))
+	 || (((arg & 1) == 0)
+	 && (((((ccIndex = (((usqInt) (longAt(arg))) >> 12) & 0x1F)) == 0
+	? (longAt(arg - BaseHeaderSize)) & AllButTypeMask
+	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord)))))) {
+		/* begin splObj:put: */
+		/* begin storePointer:ofObject:withValue: */
+		if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
+			possibleRootStoreIntovalue(GIV(specialObjectsOop), arg);
+		}
+		longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheInputSemaphore << ShiftForWord), arg);
+		/* begin pop: */
+		GIV(stackPointer) += 1 * BytesPerWord;
+		null;
 	}
-	/* begin splObj:put: */
-	/* begin storePointer:ofObject:withValue: */
-	if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
-		possibleRootStoreIntovalue(GIV(specialObjectsOop), arg);
+	else {
+		GIV(primFailCode) = PrimErrBadArgument;
 	}
-	longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheInputSemaphore << ShiftForWord), arg);
 }
 
 
@@ -38871,35 +38893,27 @@
 static void
 primitiveInterruptSemaphore(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt anObject;
     sqInt arg;
     sqInt ccIndex;
-    sqInt top;
 
-	/* begin popStack */
-	top = longAt(GIV(stackPointer));
-	GIV(stackPointer) += BytesPerWord;
-	arg = top;
-	if ((((arg & 1)
-	? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord))
-	: (((ccIndex = (((usqInt) (longAt(arg))) >> 12) & 0x1F)) == 0
-			? (longAt(arg - BaseHeaderSize)) & AllButTypeMask
-			: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord)))) {
+	arg = longAt(GIV(stackPointer));
+	if ((arg == GIV(nilObj))
+	 || (((arg & 1) == 0)
+	 && (((((ccIndex = (((usqInt) (longAt(arg))) >> 12) & 0x1F)) == 0
+	? (longAt(arg - BaseHeaderSize)) & AllButTypeMask
+	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord)))))) {
 		/* begin splObj:put: */
 		/* begin storePointer:ofObject:withValue: */
 		if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
 			possibleRootStoreIntovalue(GIV(specialObjectsOop), arg);
 		}
 		longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheInterruptSemaphore << ShiftForWord), arg);
+		/* begin pop: */
+		GIV(stackPointer) += 1 * BytesPerWord;
+		null;
 	}
 	else {
-		/* begin splObj:put: */
-		anObject = GIV(nilObj);
-		/* begin storePointer:ofObject:withValue: */
-		if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
-			possibleRootStoreIntovalue(GIV(specialObjectsOop), anObject);
-		}
-		longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheInterruptSemaphore << ShiftForWord), anObject);
+		GIV(primFailCode) = PrimErrBadArgument;
 	}
 }
 
@@ -39658,29 +39672,21 @@
     sqInt sema;
     char *sp;
 
-	sema = longAt(GIV(stackPointer) + (0 * BytesPerWord));
-	if (((sema & 1))
-	 || (GIV(argumentCount) != 1)) {
-		/* begin primitiveFail */
-		if (!GIV(primFailCode)) {
-			GIV(primFailCode) = 1;
-		}
-		return null;
+	if (GIV(argumentCount) != 1) {
+		return (GIV(primFailCode) = PrimErrBadNumArgs);
 	}
+	sema = longAt(GIV(stackPointer) + (0 * BytesPerWord));
 	if (sema == GIV(nilObj)) {
 		flushState = GIV(longRunningPrimitiveCheckSemaphore) != null;
 		GIV(longRunningPrimitiveCheckSemaphore) = null;
 	}
 	else {
 		flushState = GIV(longRunningPrimitiveCheckSemaphore) == null;
-		if (!(((((ccIndex = (((usqInt) (longAt(sema))) >> 12) & 0x1F)) == 0
+		if (!(((sema & 1) == 0)
+			 && (((((ccIndex = (((usqInt) (longAt(sema))) >> 12) & 0x1F)) == 0
 	? (longAt(sema - BaseHeaderSize)) & AllButTypeMask
-	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord))))) {
-			/* begin primitiveFail */
-			if (!GIV(primFailCode)) {
-				GIV(primFailCode) = 1;
-			}
-			return null;
+	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord)))))) {
+			return (GIV(primFailCode) = PrimErrBadArgument);
 		}
 		GIV(longRunningPrimitiveCheckSemaphore) = sema;
 	}
@@ -39693,7 +39699,7 @@
 		assert((((stackValue(0)) == (nilObject()))
 		 && (GIV(longRunningPrimitiveCheckSemaphore) == null))
 		 || (((stackValue(0)) == GIV(longRunningPrimitiveCheckSemaphore))
-		 && ((fetchClassOfNonImm(sema)) == (splObj(ClassSemaphore)))));
+		 && (isSemaphoreOop(sema))));
 	}
 	voidLongRunningPrimitive("install");
 	/* begin pop: */
@@ -39711,35 +39717,27 @@
 static void
 primitiveLowSpaceSemaphore(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt anObject;
     sqInt arg;
     sqInt ccIndex;
-    sqInt top;
 
-	/* begin popStack */
-	top = longAt(GIV(stackPointer));
-	GIV(stackPointer) += BytesPerWord;
-	arg = top;
-	if ((((arg & 1)
-	? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord))
-	: (((ccIndex = (((usqInt) (longAt(arg))) >> 12) & 0x1F)) == 0
-			? (longAt(arg - BaseHeaderSize)) & AllButTypeMask
-			: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord)))) {
+	arg = longAt(GIV(stackPointer));
+	if ((arg == GIV(nilObj))
+	 || (((arg & 1) == 0)
+	 && (((((ccIndex = (((usqInt) (longAt(arg))) >> 12) & 0x1F)) == 0
+	? (longAt(arg - BaseHeaderSize)) & AllButTypeMask
+	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord)))))) {
 		/* begin splObj:put: */
 		/* begin storePointer:ofObject:withValue: */
 		if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
 			possibleRootStoreIntovalue(GIV(specialObjectsOop), arg);
 		}
 		longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheLowSpaceSemaphore << ShiftForWord), arg);
+		/* begin pop: */
+		GIV(stackPointer) += 1 * BytesPerWord;
+		null;
 	}
 	else {
-		/* begin splObj:put: */
-		anObject = GIV(nilObj);
-		/* begin storePointer:ofObject:withValue: */
-		if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
-			possibleRootStoreIntovalue(GIV(specialObjectsOop), anObject);
-		}
-		longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheLowSpaceSemaphore << ShiftForWord), anObject);
+		GIV(primFailCode) = PrimErrBadArgument;
 	}
 }
 
@@ -41532,28 +41530,20 @@
     sqInt sema;
     char *sp;
 
-	sema = longAt(GIV(stackPointer) + (0 * BytesPerWord));
-	if (((sema & 1))
-	 || (GIV(argumentCount) != 1)) {
-		/* begin primitiveFail */
-		if (!GIV(primFailCode)) {
-			GIV(primFailCode) = 1;
-		}
-		return null;
+	if (GIV(argumentCount) != 1) {
+		return (GIV(primFailCode) = PrimErrBadNumArgs);
 	}
+	sema = longAt(GIV(stackPointer) + (0 * BytesPerWord));
 	if (sema == GIV(nilObj)) {
 		flushState = GIV(profileSemaphore) != GIV(nilObj);
 	}
 	else {
 		flushState = GIV(profileSemaphore) == GIV(nilObj);
-		if (!(((((ccIndex = (((usqInt) (longAt(sema))) >> 12) & 0x1F)) == 0
+		if (!(((sema & 1) == 0)
+			 && (((((ccIndex = (((usqInt) (longAt(sema))) >> 12) & 0x1F)) == 0
 	? (longAt(sema - BaseHeaderSize)) & AllButTypeMask
-	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord))))) {
-			/* begin primitiveFail */
-			if (!GIV(primFailCode)) {
-				GIV(primFailCode) = 1;
-			}
-			return null;
+	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord)))))) {
+			return (GIV(primFailCode) = PrimErrBadArgument);
 		}
 	}
 
@@ -41572,7 +41562,7 @@
 		assert((((stackValue(0)) == (nilObject()))
 		 && (GIV(profileSemaphore) == (nilObject())))
 		 || (((stackValue(0)) == GIV(profileSemaphore))
-		 && ((fetchClassOfNonImm(sema)) == (splObj(ClassSemaphore)))));
+		 && (isSemaphoreOop(sema))));
 	}
 	GIV(profileProcess) = (GIV(profileMethod) = GIV(nilObj));
 	/* begin pop: */
@@ -41650,6 +41640,7 @@
 	functionPointer = ((void (*)(void)) ((primIndex > MaxPrimitiveIndex
 	? 0
 	: primitiveTable[primIndex])));
+	
 	baseFlags = (GIV(profileSemaphore) != GIV(nilObj)
 		? PrimCallNeedsNewMethod + PrimCallCollectsProfileSamples
 		: 0);
@@ -43155,40 +43146,39 @@
 	msecsObj = longAt(GIV(stackPointer));
 	sema = longAt(GIV(stackPointer) + (1 * BytesPerWord));
 	msecs = positive32BitValueOf(msecsObj);
-	if (GIV(primFailCode)
-	 || ((sema & 1))) {
-		/* begin primitiveFail */
-		if (!GIV(primFailCode)) {
-			GIV(primFailCode) = 1;
-		}
-		return;
-	}
-	if (((((ccIndex = (((usqInt) (longAt(sema))) >> 12) & 0x1F)) == 0
+	if (!GIV(primFailCode)) {
+		if (((sema & 1) == 0)
+		 && (((((ccIndex = (((usqInt) (longAt(sema))) >> 12) & 0x1F)) == 0
 	? (longAt(sema - BaseHeaderSize)) & AllButTypeMask
-	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord)))) {
-		/* begin splObj:put: */
-		/* begin storePointer:ofObject:withValue: */
-		if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
-			possibleRootStoreIntovalue(GIV(specialObjectsOop), sema);
+	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord))))) {
+			/* begin splObj:put: */
+			/* begin storePointer:ofObject:withValue: */
+			if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
+				possibleRootStoreIntovalue(GIV(specialObjectsOop), sema);
+			}
+			longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheTimerSemaphore << ShiftForWord), sema);
+			deltaMsecs = msecs - ((ioMSecs()) & MillisecondClockMask);
+			if (deltaMsecs < 0) {
+				deltaMsecs = (deltaMsecs + MillisecondClockMask) + 1;
+			}
+			GIV(nextWakeupUsecs) = (ioUTCMicroseconds()) + (deltaMsecs * 1000);
+			/* begin pop: */
+			GIV(stackPointer) += 2 * BytesPerWord;
+			return;
 		}
-		longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheTimerSemaphore << ShiftForWord), sema);
-		deltaMsecs = msecs - ((ioMSecs()) & MillisecondClockMask);
-		if (deltaMsecs < 0) {
-			deltaMsecs = (deltaMsecs + MillisecondClockMask) + 1;
+		if (sema == GIV(nilObj)) {
+			/* begin storePointer:ofObject:withValue: */
+			if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
+				possibleRootStoreIntovalue(GIV(specialObjectsOop), GIV(nilObj));
+			}
+			longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheTimerSemaphore << ShiftForWord), GIV(nilObj));
+			GIV(nextWakeupUsecs) = 0;
+			/* begin pop: */
+			GIV(stackPointer) += 2 * BytesPerWord;
+			return;
 		}
-		GIV(nextWakeupUsecs) = (ioUTCMicroseconds()) + (deltaMsecs * 1000);
 	}
-	else {
-		/* begin storePointer:ofObject:withValue: */
-		if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
-			possibleRootStoreIntovalue(GIV(specialObjectsOop), GIV(nilObj));
-		}
-		longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheTimerSemaphore << ShiftForWord), GIV(nilObj));
-		GIV(nextWakeupUsecs) = 0;
-	}
-	/* begin pop: */
-	GIV(stackPointer) += 2 * BytesPerWord;
-	null;
+	GIV(primFailCode) = PrimErrBadArgument;
 }
 
 
@@ -43207,36 +43197,35 @@
 	usecsObj = longAt(GIV(stackPointer));
 	sema = longAt(GIV(stackPointer) + (1 * BytesPerWord));
 	usecs = positive64BitValueOf(usecsObj);
-	if (GIV(primFailCode)
-	 || ((sema & 1))) {
-		/* begin primitiveFail */
-		if (!GIV(primFailCode)) {
-			GIV(primFailCode) = 1;
-		}
-		return;
-	}
-	if (((((ccIndex = (((usqInt) (longAt(sema))) >> 12) & 0x1F)) == 0
+	if (!GIV(primFailCode)) {
+		if (((sema & 1) == 0)
+		 && (((((ccIndex = (((usqInt) (longAt(sema))) >> 12) & 0x1F)) == 0
 	? (longAt(sema - BaseHeaderSize)) & AllButTypeMask
-	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord)))) {
-		/* begin splObj:put: */
-		/* begin storePointer:ofObject:withValue: */
-		if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
-			possibleRootStoreIntovalue(GIV(specialObjectsOop), sema);
+	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == (longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSemaphore << ShiftForWord))))) {
+			/* begin splObj:put: */
+			/* begin storePointer:ofObject:withValue: */
+			if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
+				possibleRootStoreIntovalue(GIV(specialObjectsOop), sema);
+			}
+			longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheTimerSemaphore << ShiftForWord), sema);
+			GIV(nextWakeupUsecs) = usecs;
+			/* begin pop: */
+			GIV(stackPointer) += 2 * BytesPerWord;
+			return;
 		}
-		longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheTimerSemaphore << ShiftForWord), sema);
-		GIV(nextWakeupUsecs) = usecs;
-	}
-	else {
-		/* begin storePointer:ofObject:withValue: */
-		if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
-			possibleRootStoreIntovalue(GIV(specialObjectsOop), GIV(nilObj));
+		if (sema == GIV(nilObj)) {
+			/* begin storePointer:ofObject:withValue: */
+			if ((((usqInt) GIV(specialObjectsOop))) < (((usqInt) GIV(youngStart)))) {
+				possibleRootStoreIntovalue(GIV(specialObjectsOop), GIV(nilObj));
+			}
+			longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheTimerSemaphore << ShiftForWord), GIV(nilObj));
+			GIV(nextWakeupUsecs) = 0;
+			/* begin pop: */
+			GIV(stackPointer) += 2 * BytesPerWord;
+			return;
 		}
-		longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (TheTimerSemaphore << ShiftForWord), GIV(nilObj));
-		GIV(nextWakeupUsecs) = 0;
 	}
-	/* begin pop: */
-	GIV(stackPointer) += 2 * BytesPerWord;
-	null;
+	GIV(primFailCode) = PrimErrBadArgument;
 }
 
 static void
@@ -44519,13 +44508,12 @@
 
 	myList = longAt((process + BaseHeaderSize) + (MyListIndex << ShiftForWord));
 	if (myList == GIV(nilObj)) {
-		/* begin primitiveFail */
-		if (!GIV(primFailCode)) {
-			GIV(primFailCode) = 1;
-		}
+		(GIV(primFailCode) = PrimErrBadReceiver);
 		return;
 	}
+	
 	/* begin removeProcess:fromList: */
+	assert(!(isForwarded(myList)));
 	firstLink = longAt((myList + BaseHeaderSize) + (FirstLinkIndex << ShiftForWord));
 	lastLink = longAt((myList + BaseHeaderSize) + (LastLinkIndex << ShiftForWord));
 	if (process == firstLink) {
@@ -46470,7 +46458,7 @@
 	priority = (oop >> 1);
 	processLists = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ProcessListsIndex << ShiftForWord));
 	processList = longAt((processLists + BaseHeaderSize) + ((priority - 1) << ShiftForWord));
-	if ((longAt((processList + BaseHeaderSize) + (FirstLinkIndex << ShiftForWord))) == GIV(nilObj)) {
+	if (isEmptyList(processList)) {
 		return;
 	}
 	inInterpreter = GIV(instructionPointer) >= (startOfMemory());
@@ -46747,7 +46735,7 @@
 		: GIV(highestRunnableProcessPriority));
 	for (pri = (p - 1); pri >= 0; pri += -1) {
 		processList = longAt((schedLists + BaseHeaderSize) + (pri << ShiftForWord));
-		if (!((longAt((processList + BaseHeaderSize) + (FirstLinkIndex << ShiftForWord))) == GIV(nilObj))) {
+		if (!(isEmptyList(processList))) {
 			/* begin cr */
 			printf("\n");
 			print("processes at priority ");
@@ -49714,6 +49702,7 @@
 	}
 	else {
 		/* begin addFirstLink:toList: */
+		assert(!(isForwarded(processList)));
 		assert((fetchPointerofObject(NextLinkIndex, aProcess)) == (nilObject()));
 		firstLink = longAt((processList + BaseHeaderSize) + (FirstLinkIndex << ShiftForWord));
 		assert(firstLink != aProcess);
@@ -50362,6 +50351,7 @@
     sqInt last;
     sqInt next;
 
+	assert(!(isForwarded(aList)));
 	first = longAt((aList + BaseHeaderSize) + (FirstLinkIndex << ShiftForWord));
 	last = longAt((aList + BaseHeaderSize) + (LastLinkIndex << ShiftForWord));
 	if (first == last) {
@@ -51998,7 +51988,7 @@
     sqInt xArray;
 
 	xArray = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ExternalObjectsArray << ShiftForWord));
-	return doSignalExternalSemaphores(stSizeOf(xArray));
+	return doSignalExternalSemaphores(numSlotsOf(xArray));
 }
 
 
@@ -52011,6 +52001,8 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt empty;
 
+	/* begin isEmptyList: */
+	assert(!(isForwarded(aSemaphore)));
 	empty = (longAt((aSemaphore + BaseHeaderSize) + (FirstLinkIndex << ShiftForWord))) == GIV(nilObj);
 	if (!empty) {
 		putToSleepyieldingIf(removeFirstLinkOfList(aSemaphore), 1);
@@ -54431,8 +54423,9 @@
 synchronousSignal(sqInt aSemaphore)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt excessSignals;
+    sqInt firstLink;
 
-	if ((longAt((aSemaphore + BaseHeaderSize) + (FirstLinkIndex << ShiftForWord))) == GIV(nilObj)) {
+	if (isEmptyList(aSemaphore)) {
 
 		/* no process is waiting on this semaphore */
 
@@ -54450,6 +54443,7 @@
 		null;
 		return 0;
 	}
+	
 	return resumepreemptedYieldingIffrom(removeFirstLinkOfList(aSemaphore), GIV(preemptionYields), CSSignal);
 }
 
@@ -55169,6 +55163,7 @@
 	theContext = longAt(theFP + FoxThisContext);
 	assert(isContext(theContext));
 	assert((frameReceiver(theFP)) == (fetchPointerofObject(ReceiverIndex, theContext)));
+
 	if ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())) {
 		tempIndex = ((mframeCogMethod(theFP))->cmNumArgs);
 		pointer = (theFP + FoxMFReceiver) - BytesPerWord;
@@ -55532,7 +55527,7 @@
 		: GIV(highestRunnableProcessPriority));
 	while (((p -= 1)) >= 0) {
 		processList = longAt((schedLists + BaseHeaderSize) + (p << ShiftForWord));
-		while (!((longAt((processList + BaseHeaderSize) + (FirstLinkIndex << ShiftForWord))) == GIV(nilObj))) {
+		while (!(isEmptyList(processList))) {
 
 			/* Only answer processes with a runnable suspendedContext.
 			   Discard those that aren't; the VM would crash otherwise. */

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2014-06-29 06:02:05 UTC (rev 3022)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2014-07-01 03:09:58 UTC (rev 3023)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.787 uuid: 4b38ebc1-339f-4523-a9fc-047923108211
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59
  */
 
 
@@ -14,6 +14,7 @@
 # define NoDbgRegParms /*empty*/
 #endif
 
+sqInt accessorDepthForPrimitiveIndex(sqInt primIndex);
 sqInt activeProcess(void);
 sqInt addressCouldBeObj(sqInt address);
 sqInt addressCouldBeOop(sqInt address);

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list