[Vm-dev] [commit][3125] CogVM source as per VMMaker.oscog-eem.923

commits at squeakvm.org commits at squeakvm.org
Wed Nov 5 01:12:33 UTC 2014


Revision: 3125
Author:   eliot
Date:     2014-11-04 17:12:31 -0800 (Tue, 04 Nov 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.923

Back out of Ryan's recent absent receiver changes, while accumulating the other
recent fixes.  There's some incompatibility with the working classes machinery
at Cadence and Ryan's recent changes which we don't have time to resolve now.

The kept changes are:
Fix asserts in addFreeSubTree: & addToFreeTree:bytes:.

Fix possible forwarding of the receiver in implicit receiver sends.

Eliminate some compiler warnings in the refactored instVar:ofContext: changes.

Modified Paths:
--------------
    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/spurstacksrc/vm/gcc3x-interp.c
    branches/Cog/spurstacksrc/vm/interp.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

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

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2014-11-04 22:36:20 UTC (rev 3124)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-11-05 01:12:31 UTC (rev 3125)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.921 uuid: ab06d6ee-a8c8-47db-80cc-7530c9a4b945
+	CCodeGenerator VMMaker.oscog-eem.923 uuid: b4a88a08-47d9-4173-9d8d-a2c11886c5fb
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.921 uuid: ab06d6ee-a8c8-47db-80cc-7530c9a4b945
+	StackToRegisterMappingCogit VMMaker.oscog-eem.923 uuid: b4a88a08-47d9-4173-9d8d-a2c11886c5fb
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.921 uuid: ab06d6ee-a8c8-47db-80cc-7530c9a4b945 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.923 uuid: b4a88a08-47d9-4173-9d8d-a2c11886c5fb " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -924,8 +924,6 @@
 static sqInt genExtReturnTopFromBlock(void);
 static sqInt genExtSendAbsentDynamicSuperBytecode(void);
 static sqInt genExtSendAbsentImplicitBytecode(void);
-static sqInt genExtSendAbsentOuterBytecode(void);
-static sqInt genExtSendAbsentSelfBytecode(void);
 static sqInt genExtSendBytecode(void);
 static sqInt genExtSendSuperBytecode(void);
 static sqInt genExtStoreAndPopLiteralVariableBytecode(void);
@@ -1090,8 +1088,6 @@
 static sqInt genReturnTopFromMethod(void);
 static sqInt genSendAbsentDynamicSupernumArgs(sqInt selector, sqInt numArgs) NoDbgRegParms;
 static sqInt genSendAbsentImplicitnumArgs(sqInt selector, sqInt numArgs) NoDbgRegParms;
-static sqInt genSendAbsentOuternumArgsdepth(sqInt selector, sqInt numArgs, sqInt depth) NoDbgRegParms;
-static sqInt genSendAbsentSelfnumArgs(sqInt selector, sqInt numArgs) NoDbgRegParms;
 static sqInt genSendDynamicSupernumArgs(sqInt selector, sqInt numArgs) NoDbgRegParms;
 static sqInt genSendSupernumArgs(sqInt selector, sqInt numArgs) NoDbgRegParms;
 static sqInt genSendTrampolineFornumArgscalledargargarg(void *aRoutine, sqInt numArgs, char *aString, sqInt regOrConst0, sqInt regOrConst1, sqInt regOrConst2) NoDbgRegParms;
@@ -1114,7 +1110,7 @@
 static void initSimStackForFramelessBlock(sqInt startpc) NoDbgRegParms;
 static void initSimStackForFramelessMethod(sqInt startpc) NoDbgRegParms;
 static sqInt liveRegisters(void);
-static void marshallAbsentReceiverSendArguments(sqInt numArgs) NoDbgRegParms;
+static void marshallImplicitReceiverSendArguments(sqInt numArgs) NoDbgRegParms;
 static void marshallSendArguments(sqInt numArgs) NoDbgRegParms;
 static void mergeafterContinuation(BytecodeFixup *fixup, sqInt mergeWithContinuation) NoDbgRegParms;
 static sqInt methodAbortTrampolineFor(sqInt numArgs) NoDbgRegParms;
@@ -1753,16 +1749,16 @@
 	{ genExtUnconditionalJump, v4LongBranchDistance, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0 },
 	{ genExtJumpIfTrue, v4LongBranchDistance, 0, 0, 0, 2, 1, 0, 0, 0, 1, 0, 0, 0 },
 	{ genExtJumpIfFalse, v4LongBranchDistance, 0, 0, 0, 2, 0, 1, 0, 0, 1, 0, 0, 0 },
-	{ genExtSendAbsentSelfBytecode, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0 },
 	{ unknownBytecode, 0, 0, 0, Nop, 2, 0, 0, 0, 0, 0, 0, 1, 0 },
 	{ unknownBytecode, 0, 0, 0, Nop, 2, 0, 0, 0, 0, 0, 0, 1, 0 },
 	{ unknownBytecode, 0, 0, 0, Nop, 2, 0, 0, 0, 0, 0, 0, 1, 0 },
+	{ unknownBytecode, 0, 0, 0, Nop, 2, 0, 0, 0, 0, 0, 0, 1, 0 },
 	{ callPrimitiveBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 },
 	{ genPushRemoteTempLongBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 },
 	{ genStoreRemoteTempLongBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 },
 	{ genStoreAndPopRemoteTempLongBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 },
 	{ genExtPushClosureBytecode, v4BlockCodeSize, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0 },
-	{ genExtSendAbsentOuterBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0 },
+	{ unknownBytecode, 0, 0, 0, Nop, 3, 0, 0, 0, 0, 0, 0, 1, 0 },
 	{ unknownBytecode, 0, 0, 0, Nop, 3, 0, 0, 0, 0, 0, 0, 1, 0 }
 };
 static sqInt guardPageSize;
@@ -17448,45 +17444,6 @@
 }
 
 
-/*	254		 11111110	i i i i i j j j kkkkkkkk	Send To Absent Outer Literal
-	Selector #iiiii (+ Extend A * 32) with jjj (+ Extend B * 8) Arguments at
-	Depth kkkkkkkk
- */
-
-static sqInt
-genExtSendAbsentOuterBytecode(void)
-{
-    sqInt depth;
-    sqInt litIndex;
-    sqInt nArgs;
-
-	litIndex = (((usqInt) byte1) >> 3) + (extA << 5);
-	extA = 0;
-	nArgs = (byte1 & 7) + (extB << 3);
-	extB = 0;
-	depth = byte2;
-	return genSendAbsentOuternumArgsdepth(getLiteral(litIndex), nArgs, depth);
-}
-
-
-/*	245		11110101	i i i i i j j j	Send To Absent Self Literal Selector #iiiii
-	(+ Extend A * 32) with jjj (+ Extend B * 8) Arguments
- */
-
-static sqInt
-genExtSendAbsentSelfBytecode(void)
-{
-    sqInt litIndex;
-    sqInt nArgs;
-
-	litIndex = (((usqInt) byte1) >> 3) + (extA << 5);
-	extA = 0;
-	nArgs = (byte1 & 7) + (extB << 3);
-	extB = 0;
-	return genSendAbsentSelfnumArgs(getLiteral(litIndex), nArgs);
-}
-
-
 /*	238		11101110	i i i i i j j j	Send Literal Selector #iiiii (+ Extend A *
 	32) with jjj (+ Extend B * 8) Arguments
  */
@@ -20977,7 +20934,7 @@
 	ssAllocateCallReg(ReceiverResultReg);
 	/* begin MoveMw:r:R: */
 	genoperandoperandoperand(MoveMwrR, FoxMFReceiver, FPReg, ReceiverResultReg);
-	marshallAbsentReceiverSendArguments(numArgs);
+	marshallImplicitReceiverSendArguments(numArgs);
 	return genMarshalledSendDynamicSupernumArgs(selector, numArgs);
 }
 
@@ -20995,53 +20952,11 @@
 	if (result != 0) {
 		return result;
 	}
-	marshallAbsentReceiverSendArguments(numArgs);
+	marshallImplicitReceiverSendArguments(numArgs);
 	return genMarshalledSendnumArgs(selector, numArgs);
 }
 
-
-/*	OK, we could do better and avoid spilling ReceiverResultReg if we
-	refactored marshallAbsentReceiverSendArguments: to take a flag saying
-	whether the
-	receiver was in ReceiverResultReg (absent receiver send) or on the stack
-	(absent dynamic super send) and in the latter case loading
-	ReceiverResultReg from the stack after marshalling. But this is a rare
-	bytecode so for the moment
-	don't bother. */
-
 static sqInt
-genSendAbsentOuternumArgsdepth(sqInt selector, sqInt numArgs, sqInt depth)
-{
-	(optStatus.isReceiverResultRegLive = 0);
-	ssAllocateCallReg(SendNumArgsReg);
-	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, depth, SendNumArgsReg);
-	CallRT(ceEnclosingObjectTrampoline);
-	marshallAbsentReceiverSendArguments(numArgs);
-	return genMarshalledSendnumArgs(selector, numArgs);
-}
-
-
-/*	OK, we could do better and avoid spilling ReceiverResultReg if we
-	refactored marshallAbsentReceiverSendArguments: to take a flag saying
-	whether the
-	receiver was in ReceiverResultReg (absent receiver send) or on the stack
-	(absent dynamic super send) and in the latter case loading
-	ReceiverResultReg from the stack after marshalling. But this is a rare
-	bytecode so for the moment
-	don't bother. */
-
-static sqInt
-genSendAbsentSelfnumArgs(sqInt selector, sqInt numArgs)
-{
-	ssAllocateCallReg(ReceiverResultReg);
-	/* begin MoveMw:r:R: */
-	genoperandoperandoperand(MoveMwrR, FoxMFReceiver, FPReg, ReceiverResultReg);
-	marshallAbsentReceiverSendArguments(numArgs);
-	return genMarshalledSendnumArgs(selector, numArgs);
-}
-
-static sqInt
 genSendDynamicSupernumArgs(sqInt selector, sqInt numArgs)
 {
 	marshallSendArguments(numArgs);
@@ -22029,7 +21944,7 @@
 	necessary.  */
 
 static void
-marshallAbsentReceiverSendArguments(sqInt numArgs)
+marshallImplicitReceiverSendArguments(sqInt numArgs)
 {
     sqInt index;
     sqInt numSpilled;

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-11-04 22:36:20 UTC (rev 3124)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-11-05 01:12:31 UTC (rev 3125)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.921 uuid: ab06d6ee-a8c8-47db-80cc-7530c9a4b945
+	CCodeGenerator VMMaker.oscog-eem.923 uuid: b4a88a08-47d9-4173-9d8d-a2c11886c5fb
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2014-11-04 22:36:20 UTC (rev 3124)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2014-11-05 01:12:31 UTC (rev 3125)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.922 uuid: 52f1b50e-005d-4035-ad57-953a3790260e
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.923 uuid: b4a88a08-47d9-4173-9d8d-a2c11886c5fb
    from
-	CoInterpreter VMMaker.oscog-eem.922 uuid: 52f1b50e-005d-4035-ad57-953a3790260e
+	CoInterpreter VMMaker.oscog-eem.923 uuid: b4a88a08-47d9-4173-9d8d-a2c11886c5fb
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.922 uuid: 52f1b50e-005d-4035-ad57-953a3790260e " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.923 uuid: b4a88a08-47d9-4173-9d8d-a2c11886c5fb " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -20,8 +20,8 @@
 #endif
 
 #include <stddef.h> /* for e.g. alloca */
-#include <wchar.h>
 #include <setjmp.h>
+#include <wchar.h> /* for wint_t */
 #include "sq.h"
 #include "vmCallback.h"
 #include "sqMemoryFence.h"
@@ -463,7 +463,7 @@
 static sqInt iframeReceiver(char *theFP) NoDbgRegParms;
 static sqInt iframeSavedIP(char *theFP) NoDbgRegParms;
 void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP);
-sqInt implicitReceiverFormixinimplementing(sqInt methodReceiver, sqInt methodMixin, sqInt selector);
+sqInt implicitReceiverFormixinimplementing(sqInt rcvr, sqInt mixin, sqInt selector);
 usqInt instructionPointerAddress(void);
 static sqInt instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr) NoDbgRegParms;
 usqInt interpretAddress(void);
@@ -853,7 +853,7 @@
 void printWronglySizedContexts(sqInt printContexts);
 static void restoreHeadersFromtofromandtofrom(sqInt firstIn, sqInt lastIn, sqInt hdrBaseIn, sqInt firstOut, sqInt lastOut, sqInt hdrBaseOut) NoDbgRegParms;
 static void runLeakCheckerForFullGC(sqInt fullGCFlag) NoDbgRegParms;
-static usqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
+static sqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
 static sqInt safePrintStringOf(sqInt oop) NoDbgRegParms;
 static sqInt shortentoIndexableSize(sqInt obj, sqInt nSlots) NoDbgRegParms;
 static sqInt sizeBitsOfSafe(sqInt oop) NoDbgRegParms;
@@ -1055,7 +1055,7 @@
 sqInt doSignalSemaphoreWithIndex(sqInt index);
 static void dummyReferToProxy(void);
 EXPORT(sqInt) dumpImage(sqInt fileName);
-static sqInt enclosingObjectAtwithObjectwithMixin(sqInt depth, sqInt methodReceiver, sqInt methodMixin) NoDbgRegParms;
+static sqInt enclosingObjectAtwithObjectwithMixin(sqInt n, sqInt anObject, sqInt mixin) NoDbgRegParms;
 static sqInt ensureCallerContext(char *theFP) NoDbgRegParms;
 static void ensureImageFormatIsUpToDate(sqInt swapBytes) NoDbgRegParms;
 static char * establishFrameForContextToReturnTo(sqInt contextToReturnTo) NoDbgRegParms;
@@ -1069,6 +1069,8 @@
 sqInt fetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer);
 static sqInt fetchPointerofMarriedContext(sqInt offset, sqInt aContext) NoDbgRegParms;
 static sqInt fetchStackPointerOf(sqInt aContext) NoDbgRegParms;
+static sqInt findApplicationOfTargetMixinstartingAtBehavior(sqInt targetMixin, sqInt aBehavior) NoDbgRegParms;
+static sqInt findApplicationOfTargetMixinstartingAtNonMetaClass(sqInt targetMixin, sqInt aClass) NoDbgRegParms;
 static sqInt findClassContainingMethodstartingAt(sqInt meth, sqInt classObj) NoDbgRegParms;
 sqInt findClassOfMethodforReceiver(sqInt meth, sqInt rcvr);
 static char * findFrameAboveinPage(char *theFP, StackPage *thePage) NoDbgRegParms;
@@ -1401,6 +1403,7 @@
 _iss sqInt tenuringThreshold;
 _iss sqInt forceTenureFlag;
 _iss sqInt longRunningPrimitiveCheckSequenceNumber;
+_iss sqInt methodDictLinearSearchLimit;
 _iss sqInt signalLowSpace;
 _iss usqLong statFullGCUsecs;
 _iss sqInt statFullGCs;
@@ -1416,7 +1419,6 @@
 _iss sqInt interruptKeycode;
 _iss sqInt interruptPending;
 _iss usqInt memory;
-_iss sqInt methodDictLinearSearchLimit;
 _iss usqLong nextPollUsecs;
 _iss usqLong statForceInterruptCheck;
 _iss usqLong statIGCDeltaUsecs;
@@ -2086,7 +2088,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.922";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.923";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -4951,12 +4953,9 @@
 		case 126:
 			/* dynamicSuperSendBytecode */
 			{
-				sqInt aBehavior;
 				sqInt ccIndex;
 				sqInt mClassMixin;
-				sqInt mixin;
 				sqInt mixinApplication;
-				sqInt mixinApplication1;
 				sqInt rcvr;
 
 				VM_LABEL(0dynamicSuperSendBytecode);
@@ -4966,19 +4965,11 @@
 				GIV(messageSelector) = longAt((GIV(method) + BaseHeaderSize) + (((byteAtPointer(++localIP)) + LiteralStart) << ShiftForWord));
 				rcvr = longAtPointer(localSP + (GIV(argumentCount) * BytesPerOop));
 				mClassMixin = methodClassOf(GIV(method));
-				/* begin findApplicationOfTargetMixin:startingAtBehavior: */
-				aBehavior = ((rcvr & 1)
+				mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mClassMixin, ((rcvr & 1)
 					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << ShiftForWord))
 					: (((ccIndex = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0
 							? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask
-							: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))));
-				mixinApplication1 = aBehavior;
-				while (!((mixinApplication1 == GIV(nilObj))
-				 || ((mixinApplication1 == mClassMixin)
-				 || (((mixin = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << ShiftForWord)))) == mClassMixin)))) {
-					mixinApplication1 = longAt((mixinApplication1 + BaseHeaderSize) + (SuperclassIndex << ShiftForWord));
-				}
-				mixinApplication = mixinApplication1;
+							: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))));
 				lkupClassTag = longAt((mixinApplication + BaseHeaderSize) + (SuperclassIndex << ShiftForWord));
 				goto commonSend;
 			}
@@ -12767,14 +12758,11 @@
 		case 497: /*241*/
 			/* extSendAbsentDynamicSuperBytecode */
 			{
-				sqInt aBehavior;
 				sqInt byte;
 				sqInt ccIndex;
 				sqInt i;
 				sqInt mClassMixin;
-				sqInt mixin;
 				sqInt mixinApplication;
-				sqInt mixinApplication1;
 				sqInt oop;
 
 				VM_LABEL(0extSendAbsentDynamicSuperBytecode);
@@ -12796,19 +12784,11 @@
 				}
 				longAtPointerput(localSP + (GIV(argumentCount) * BytesPerOop), longAt(localFP + FoxIFReceiver));
 				mClassMixin = methodClassOf(GIV(method));
-				/* begin findApplicationOfTargetMixin:startingAtBehavior: */
-				aBehavior = (((longAt(localFP + FoxIFReceiver)) & 1)
+				mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mClassMixin, (((longAt(localFP + FoxIFReceiver)) & 1)
 					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << ShiftForWord))
 					: (((ccIndex = (((usqInt) (longAt(longAt(localFP + FoxIFReceiver)))) >> (compactClassFieldLSB())) & 0x1F)) == 0
 							? (longAt((longAt(localFP + FoxIFReceiver)) - BaseHeaderSize)) & AllButTypeMask
-							: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))));
-				mixinApplication1 = aBehavior;
-				while (!((mixinApplication1 == GIV(nilObj))
-				 || ((mixinApplication1 == mClassMixin)
-				 || (((mixin = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << ShiftForWord)))) == mClassMixin)))) {
-					mixinApplication1 = longAt((mixinApplication1 + BaseHeaderSize) + (SuperclassIndex << ShiftForWord));
-				}
-				mixinApplication = mixinApplication1;
+							: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))));
 				lkupClassTag = longAt((mixinApplication + BaseHeaderSize) + (SuperclassIndex << ShiftForWord));
 				goto commonSend;
 			}
@@ -12957,45 +12937,10 @@
 			}
 			break;
 		case 501: /*245*/
-			/* extSendAbsentSelfBytecode */
-			{
-				sqInt byte;
-				sqInt ccIndex;
-				sqInt classObj;
-				sqInt i;
-				sqInt oop;
-
-				VM_LABEL(0extSendAbsentSelfBytecode);
-				byte = byteAtPointer(++localIP);
-				/* begin literal: */
-				assert(GIV(method) == (iframeMethod(localFP)));
-				GIV(messageSelector) = longAt((GIV(method) + BaseHeaderSize) + ((((((usqInt) byte) >> 3) + (extA << 5)) + LiteralStart) << ShiftForWord));
-				extA = 0;
-				GIV(argumentCount) = (byte & 7) + (extB << 3);
-				extB = 0;
-				/* begin shuffleArgumentsAndStoreAbsentReceiver: */
-
-				/* a.k.a. self internalPush: anything */
-
-				localSP -= BytesPerOop;
-				for (i = 1; i <= GIV(argumentCount); i += 1) {
-					oop = longAtPointer(localSP + (i * BytesPerOop));
-					longAtPointerput(localSP + ((i - 1) * BytesPerOop), oop);
-				}
-				longAtPointerput(localSP + (GIV(argumentCount) * BytesPerOop), longAt(localFP + FoxIFReceiver));
-				/* begin classTagForClass: */
-				classObj = (((longAt(localFP + FoxIFReceiver)) & 1)
-					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << ShiftForWord))
-					: (((ccIndex = (((usqInt) (longAt(longAt(localFP + FoxIFReceiver)))) >> (compactClassFieldLSB())) & 0x1F)) == 0
-							? (longAt((longAt(localFP + FoxIFReceiver)) - BaseHeaderSize)) & AllButTypeMask
-							: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))));
-				lkupClassTag = classObj;
-				goto commonSend;
-			}
-			break;
 		case 502: /*246*/
 		case 503: /*247*/
 		case 504: /*248*/
+		case 510: /*254*/
 		case 511: /*255*/
 			/* unknownBytecode */
 			{
@@ -13113,47 +13058,6 @@
 				longAtPointerput((localSP -= BytesPerOop), newClosure);
 			}
 			break;
-		case 510: /*254*/
-			/* extSendAbsentOuterBytecode */
-			{
-				sqInt absentReceiver;
-				sqInt byte;
-				sqInt ccIndex;
-				sqInt classObj;
-				sqInt depth;
-				sqInt i;
-				sqInt oop;
-
-				VM_LABEL(0extSendAbsentOuterBytecode);
-				byte = byteAtPointer(++localIP);
-				/* begin literal: */
-				assert(GIV(method) == (iframeMethod(localFP)));
-				GIV(messageSelector) = longAt((GIV(method) + BaseHeaderSize) + ((((((usqInt) byte) >> 3) + (extA << 5)) + LiteralStart) << ShiftForWord));
-				extA = 0;
-				GIV(argumentCount) = (byte & 7) + (extB << 3);
-				extB = 0;
-				depth = byteAtPointer(++localIP);
-				absentReceiver = enclosingObjectAtwithObjectwithMixin(depth, longAt(localFP + FoxIFReceiver), methodClassOf(GIV(method)));
-				/* begin shuffleArgumentsAndStoreAbsentReceiver: */
-
-				/* a.k.a. self internalPush: anything */
-
-				localSP -= BytesPerOop;
-				for (i = 1; i <= GIV(argumentCount); i += 1) {
-					oop = longAtPointer(localSP + (i * BytesPerOop));
-					longAtPointerput(localSP + ((i - 1) * BytesPerOop), oop);
-				}
-				longAtPointerput(localSP + (GIV(argumentCount) * BytesPerOop), absentReceiver);
-				/* begin classTagForClass: */
-				classObj = ((absentReceiver & 1)
-					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << ShiftForWord))
-					: (((ccIndex = (((usqInt) (longAt(absentReceiver))) >> (compactClassFieldLSB())) & 0x1F)) == 0
-							? (longAt(absentReceiver - BaseHeaderSize)) & AllButTypeMask
-							: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))));
-				lkupClassTag = classObj;
-				goto commonSend;
-			}
-			break;
 		}
 	}
 
@@ -14286,7 +14190,6 @@
 sqInt
 ceDynamicSuperSendtonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt aBehavior;
     sqInt ccIndex;
     sqInt classTag;
     CogMethod *cogMethod;
@@ -14295,9 +14198,7 @@
     sqInt mClassMixin;
     sqInt methodHeader;
     sqInt methodHeader1;
-    sqInt mixin;
     sqInt mixinApplication;
-    sqInt mixinApplication1;
     CogMethod *newCogMethod;
     sqInt top;
     sqInt top1;
@@ -14311,19 +14212,11 @@
 	/* begin sendBreakpoint:receiver: */
 	sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(selector), lengthOfMaybeImmediate(selector), rcvr);
 	mClassMixin = methodClassOf(((mframeHomeMethod(GIV(framePointer)))->methodObject));
-	/* begin findApplicationOfTargetMixin:startingAtBehavior: */
-	aBehavior = ((rcvr & 1)
+	mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mClassMixin, ((rcvr & 1)
 		? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << ShiftForWord))
 		: (((ccIndex = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0
 				? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask
-				: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))));
-	mixinApplication1 = aBehavior;
-	while (!((mixinApplication1 == GIV(nilObj))
-	 || ((mixinApplication1 == mClassMixin)
-	 || (((mixin = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << ShiftForWord)))) == mClassMixin)))) {
-		mixinApplication1 = longAt((mixinApplication1 + BaseHeaderSize) + (SuperclassIndex << ShiftForWord));
-	}
-	mixinApplication = mixinApplication1;
+				: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))));
 	assert((lengthOf(mixinApplication)) > (InstanceSpecificationIndex + 1));
 	classTag = longAt((mixinApplication + BaseHeaderSize) + (SuperclassIndex << ShiftForWord));
 	GIV(argumentCount) = numArgs;
@@ -16726,145 +16619,245 @@
 }
 
 
-/*	This is used to implement implicit receiver sends in Newspeak. Find the
-	nearest lexically-enclosing implementation of selector by searching up the
-	static chain of the
-	method's receiver, starting at mixin's application. This implementation is
+/*	This is used to implement the innards of the pushImplicitReceiverBytecode,
+	used for implicit receiver sends in NS2/NS3. Find the nearest
+	lexically-enclosing implementation of selector by searching up the static
+	chain of anObject,
+	starting at mixin's application. This is an iterative implementation
 	derived from
 	
-	<ContextPart> implicitReceiverFor: methodReceiver <Object>
-	in: methodMixin <Mixin>
+	<ContextPart> implicitReceiverFor: obj <Object>
+	withMixin: mixin <Mixin>
 	implementing: selector <Symbol> ^<Object> */
-/*	This is used to implement implicit receiver sends in Newspeak. Find the
-	nearest lexically-enclosing implementation of selector by searching up the
-	static chain of the
-	method's receiver, starting at mixin's application. This implementation is
+/*	This is used to implement the innards of the pushImplicitReceiverBytecode,
+	used for implicit receiver sends in NS2/NS3. Find the nearest
+	lexically-enclosing implementation of selector by searching up the static
+	chain of anObject,
+	starting at mixin's application. This is an iterative implementation
 	derived from
 	
-	<ContextPart> implicitReceiverFor: methodReceiver <Object>
-	in: methodMixin <Mixin>
+	<ContextPart> implicitReceiverFor: obj <Object>
+	withMixin: mixin <Mixin>
 	implementing: selector <Symbol> ^<Object> */
 
 sqInt
-implicitReceiverFormixinimplementing(sqInt methodReceiver, sqInt methodMixin, sqInt selector)
+implicitReceiverFormixinimplementing(sqInt rcvr, sqInt mixin, sqInt selector)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt aBehavior;
-    sqInt candidateMixin;
-    sqInt candidateMixinApplication;
-    sqInt candidateReceiver;
     sqInt ccIndex;
+    sqInt ccIndex1;
     sqInt dictionary;
+    sqInt dictionary1;
     sqInt found;
+    sqInt found1;
     sqInt header;
+    sqInt header1;
+    sqInt implicitReceiver;
+    sqInt implicitReceiverOrNil;
     sqInt index;
+    sqInt index1;
     sqInt length;
+    sqInt length1;
     sqInt mask;
+    sqInt mask1;
     sqInt methodArray;
-    sqInt mixin;
+    sqInt methodArray1;
     sqInt mixinApplication;
+    sqInt mixinApplication1;
     sqInt nextSelector;
+    sqInt nextSelector1;
     sqInt sz;
+    sqInt sz1;
+    sqInt targetMixin;
+    sqInt theMixin;
+    sqInt theMixin1;
     sqInt wrapAround;
+    sqInt wrapAround1;
 
 	if (breakOnImplicitReceiver()) {
 		/* begin sendBreakpoint:receiver: */
 		sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(selector), lengthOfMaybeImmediate(selector), null);
 	}
-	assert(!((isOopForwarded(methodReceiver))));
-	assert(!((isForwarded(methodMixin))));
+	assert(!((isOopForwarded(rcvr))));
+	assert(!((isForwarded(mixin))));
 	GIV(messageSelector) = selector;
-	candidateReceiver = methodReceiver;
-	candidateMixin = methodMixin;
-	while (1) {
-		/* begin findApplicationOfTargetMixin:startingAtBehavior: */
-		aBehavior = ((candidateReceiver & 1)
-			? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << ShiftForWord))
-			: (((ccIndex = (((usqInt) (longAt(candidateReceiver))) >> (compactClassFieldLSB())) & 0x1F)) == 0
-					? (longAt(candidateReceiver - BaseHeaderSize)) & AllButTypeMask
-					: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))));
-		mixinApplication = aBehavior;
-		while (!((mixinApplication == GIV(nilObj))
-		 || ((mixinApplication == candidateMixin)
-		 || (((mixin = longAt((mixinApplication + BaseHeaderSize) + (MixinIndex << ShiftForWord)))) == candidateMixin)))) {
-			mixinApplication = longAt((mixinApplication + BaseHeaderSize) + (SuperclassIndex << ShiftForWord));
-		}
-		candidateMixinApplication = mixinApplication;
-		if (candidateMixinApplication == GIV(nilObj)) {
-			return methodReceiver;
-		}
-		dictionary = longAt((candidateMixinApplication + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord));
-		/* begin lookupMethodInDictionary: */
-		/* begin numSlotsOf: */
-		header = longAt(dictionary);
-		sz = ((header & TypeMask) == HeaderTypeSizeAndClass
-			? (longAt(dictionary - (BytesPerWord * 2))) & AllButTypeMask
-			: header & SizeMask);
-		length = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+	mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mixin, ((rcvr & 1)
+		? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << ShiftForWord))
+		: (((ccIndex = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0
+				? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask
+				: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))));
+	if (mixinApplication == GIV(nilObj)) {
+		return rcvr;
+	}
+	dictionary = longAt((mixinApplication + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord));
+	/* begin lookupMethodInDictionary: */
+	/* begin numSlotsOf: */
+	header = longAt(dictionary);
+	sz = ((header & TypeMask) == HeaderTypeSizeAndClass
+		? (longAt(dictionary - (BytesPerWord * 2))) & AllButTypeMask
+		: header & SizeMask);
+	length = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
 
-		/* Use linear search on small dictionaries; its cheaper.
-		   Also the limit can be set to force linear search of all dictionaries, which supports the
-		   booting of images that need rehashing (e.g. because a tracer has generated an image
-		   with different hashes but hasn't rehashed it yet.) */
+	/* Use linear search on small dictionaries; its cheaper.
+	   Also the limit can be set to force linear search of all dictionaries, which supports the
+	   booting of images that need rehashing (e.g. because a tracer has generated an image
+	   with different hashes but hasn't rehashed it yet.) */
 
-		mask = (length - SelectorStart) - 1;
-		if (mask <= GIV(methodDictLinearSearchLimit)) {
-			index = 0;
-			while (index <= mask) {
-				nextSelector = longAt((dictionary + BaseHeaderSize) + ((index + SelectorStart) << ShiftForWord));
-				
-				if (nextSelector == GIV(messageSelector)) {
-					methodArray = longAt((dictionary + BaseHeaderSize) + (MethodArrayIndex << ShiftForWord));
-					GIV(newMethod) = longAt((methodArray + BaseHeaderSize) + (index << ShiftForWord));
-					found = 1;
-					goto l1;
-				}
-				index += 1;
+	mask = (length - SelectorStart) - 1;
+	if (mask <= GIV(methodDictLinearSearchLimit)) {
+		index = 0;
+		while (index <= mask) {
+			nextSelector = longAt((dictionary + BaseHeaderSize) + ((index + SelectorStart) << ShiftForWord));
+			
+			if (nextSelector == GIV(messageSelector)) {
+				methodArray = longAt((dictionary + BaseHeaderSize) + (MethodArrayIndex << ShiftForWord));
+				GIV(newMethod) = longAt((methodArray + BaseHeaderSize) + (index << ShiftForWord));
+				found = 1;
+				goto l1;
 			}
-			found = 0;
-			goto l1;
+			index += 1;
 		}
+		found = 0;
+		goto l1;
+	}
 
-		/* It is assumed that there are some nils in this dictionary, and search will
-		   stop when one is encountered. However, if there are no nils, then wrapAround
-		   will be detected the second time the loop gets to the end of the table. */
+	/* It is assumed that there are some nils in this dictionary, and search will
+	   stop when one is encountered. However, if there are no nils, then wrapAround
+	   will be detected the second time the loop gets to the end of the table. */
 
-		index = SelectorStart + (mask & (((GIV(messageSelector) & 1)
+	index = SelectorStart + (mask & (((GIV(messageSelector) & 1)
 	? (GIV(messageSelector) >> 1)
 	: (((usqInt) (longAt(GIV(messageSelector)))) >> HashBitsOffset) & HashMaskUnshifted)));
-		wrapAround = 0;
-		while (1) {
-			nextSelector = longAt((dictionary + BaseHeaderSize) + (index << ShiftForWord));
-			if (nextSelector == GIV(nilObj)) {
+	wrapAround = 0;
+	while (1) {
+		nextSelector = longAt((dictionary + BaseHeaderSize) + (index << ShiftForWord));
+		if (nextSelector == GIV(nilObj)) {
+			found = 0;
+			goto l1;
+		}
+		
+		if (nextSelector == GIV(messageSelector)) {
+			methodArray = longAt((dictionary + BaseHeaderSize) + (MethodArrayIndex << ShiftForWord));
+			GIV(newMethod) = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
+			found = 1;
+			goto l1;
+		}
+		index += 1;
+		if (index == length) {
+			if (wrapAround) {
 				found = 0;
 				goto l1;
 			}
-			
-			if (nextSelector == GIV(messageSelector)) {
-				methodArray = longAt((dictionary + BaseHeaderSize) + (MethodArrayIndex << ShiftForWord));
-				GIV(newMethod) = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
-				found = 1;
-				goto l1;
+			wrapAround = 1;
+			index = SelectorStart;
+		}
+	}
+	found = 0;
+l1:	/* end lookupMethodInDictionary: */;
+	if (!found) {
+		theMixin = longAt((mixinApplication + BaseHeaderSize) + (MixinIndex << ShiftForWord));
+		/* begin nextImplicitReceiverFor:withMixin: */
+		assert(!((isOopForwarded(longAt((mixinApplication + BaseHeaderSize) + (EnclosingObjectIndex << ShiftForWord))))));
+		assert(!((isForwarded(longAt((theMixin + BaseHeaderSize) + (EnclosingMixinIndex << ShiftForWord))))));
+		implicitReceiver = longAt((mixinApplication + BaseHeaderSize) + (EnclosingObjectIndex << ShiftForWord));
+		targetMixin = longAt((theMixin + BaseHeaderSize) + (EnclosingMixinIndex << ShiftForWord));
+		while (1) {
+			if (targetMixin == GIV(nilObj)) {
+
+				/* or: [implicitReceiver = objectMemory nilObject] */
+
+				implicitReceiverOrNil = GIV(nilObj);
+				goto l3;
 			}
-			index += 1;
-			if (index == length) {
-				if (wrapAround) {
-					found = 0;
-					goto l1;
+			mixinApplication1 = findApplicationOfTargetMixinstartingAtNonMetaClass(targetMixin, ((implicitReceiver & 1)
+				? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << ShiftForWord))
+				: (((ccIndex1 = (((usqInt) (longAt(implicitReceiver))) >> (compactClassFieldLSB())) & 0x1F)) == 0
+						? (longAt(implicitReceiver - BaseHeaderSize)) & AllButTypeMask
+						: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex1 - 1) << ShiftForWord)))));
+			if (mixinApplication1 == GIV(nilObj)) {
+				implicitReceiverOrNil = GIV(nilObj);
+				goto l3;
+			}
+			dictionary1 = longAt((mixinApplication1 + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord));
+			/* begin lookupMethodInDictionary: */
+			/* begin numSlotsOf: */
+			header1 = longAt(dictionary1);
+			sz1 = ((header1 & TypeMask) == HeaderTypeSizeAndClass
+				? (longAt(dictionary1 - (BytesPerWord * 2))) & AllButTypeMask
+				: header1 & SizeMask);
+			length1 = ((usqInt) (sz1 - BaseHeaderSize)) >> ShiftForWord;
+
+			/* Use linear search on small dictionaries; its cheaper.
+			   Also the limit can be set to force linear search of all dictionaries, which supports the
+			   booting of images that need rehashing (e.g. because a tracer has generated an image
+			   with different hashes but hasn't rehashed it yet.) */
+
+			mask1 = (length1 - SelectorStart) - 1;
+			if (mask1 <= GIV(methodDictLinearSearchLimit)) {
+				index1 = 0;
+				while (index1 <= mask1) {
+					nextSelector1 = longAt((dictionary1 + BaseHeaderSize) + ((index1 + SelectorStart) << ShiftForWord));
+					
+					if (nextSelector1 == GIV(messageSelector)) {
+						methodArray1 = longAt((dictionary1 + BaseHeaderSize) + (MethodArrayIndex << ShiftForWord));
+						GIV(newMethod) = longAt((methodArray1 + BaseHeaderSize) + (index1 << ShiftForWord));
+						found1 = 1;
+						goto l2;
+					}
+					index1 += 1;
 				}
-				wrapAround = 1;
-				index = SelectorStart;
+				found1 = 0;
+				goto l2;
 			}
+
+			/* It is assumed that there are some nils in this dictionary, and search will
+			   stop when one is encountered. However, if there are no nils, then wrapAround
+			   will be detected the second time the loop gets to the end of the table. */
+
+			index1 = SelectorStart + (mask1 & (((GIV(messageSelector) & 1)
+	? (GIV(messageSelector) >> 1)
+	: (((usqInt) (longAt(GIV(messageSelector)))) >> HashBitsOffset) & HashMaskUnshifted)));
+			wrapAround1 = 0;
+			while (1) {
+				nextSelector1 = longAt((dictionary1 + BaseHeaderSize) + (index1 << ShiftForWord));
+				if (nextSelector1 == GIV(nilObj)) {
+					found1 = 0;
+					goto l2;
+				}
+				
+				if (nextSelector1 == GIV(messageSelector)) {
+					methodArray1 = longAt((dictionary1 + BaseHeaderSize) + (MethodArrayIndex << ShiftForWord));
+					GIV(newMethod) = longAt((methodArray1 + BaseHeaderSize) + ((index1 - SelectorStart) << ShiftForWord));
+					found1 = 1;
+					goto l2;
+				}
+				index1 += 1;
+				if (index1 == length1) {
+					if (wrapAround1) {
+						found1 = 0;
+						goto l2;
+					}
+					wrapAround1 = 1;
+					index1 = SelectorStart;
+				}
+			}
+			found1 = 0;
+		l2:	/* end lookupMethodInDictionary: */;
+			if (found1) break;
+			implicitReceiver = longAt((mixinApplication1 + BaseHeaderSize) + (EnclosingObjectIndex << ShiftForWord));
+			theMixin1 = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << ShiftForWord));
+			if (theMixin1 == GIV(nilObj)) {
+				implicitReceiverOrNil = GIV(nilObj);
+				goto l3;
+			}
+			targetMixin = longAt((theMixin1 + BaseHeaderSize) + (EnclosingMixinIndex << ShiftForWord));
 		}
-		found = 0;
-	l1:	/* end lookupMethodInDictionary: */;
-		if (found) {
-			return candidateReceiver;
+		implicitReceiverOrNil = implicitReceiver;
+	l3:	/* end nextImplicitReceiverFor:withMixin: */;
+		if (implicitReceiverOrNil != GIV(nilObj)) {
+			return implicitReceiverOrNil;
 		}
-		candidateMixin = longAt((candidateMixin + BaseHeaderSize) + (EnclosingMixinIndex << ShiftForWord));
-		if (candidateMixin == GIV(nilObj)) break;
-		candidateReceiver = longAt((candidateMixinApplication + BaseHeaderSize) + (EnclosingObjectIndex << ShiftForWord));
 	}
-	return methodReceiver;
+	return rcvr;
 }
 
 usqInt
@@ -36647,15 +36640,17 @@
     sqInt header1;
     sqInt header2;
     sqInt header3;
+    sqInt header4;
     usqInt lastWord;
     sqInt newFreeChunk;
     sqInt newOop;
-    usqInt next;
+    sqInt next;
     sqInt oop;
     sqInt realHeader;
     sqInt sz;
     sqInt sz1;
     sqInt sz2;
+    sqInt sz3;
     sqInt target;
     usqInt w;
 
@@ -36666,7 +36661,21 @@
 		/* begin objectAfterWhileForwarding: */
 		header2 = longAt(oop);
 		if ((header2 & MarkBit) == 0) {
-			next = ((sqInt) (objectAfter(oop)));
+			/* begin objectAfter: */
+			if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
+				error("no objects after the end of memory");
+			}
+			if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
+				sz2 = (longAt(oop)) & AllButTypeMask;
+			}
+			else {
+				/* begin sizeBitsOf: */
+				header3 = longAt(oop);
+				sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
+					? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
+					: header3 & SizeMask);
+			}
+			next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
 			goto l1;
 		}
 		fwdBlock1 = (header2 & AllButMarkBitAndTypeMask) << 1;
@@ -36681,7 +36690,7 @@
 		else {
 			sz1 = realHeader & SizeMask;
 		}
-		next = ((sqInt) ((oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask])));
+		next = (oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask]);
 	l1:	/* end objectAfterWhileForwarding: */;
 		if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
 
@@ -36735,18 +36744,18 @@
 	}
 	/* begin safeObjectAfter: */
 	if (((longAt(newFreeChunk)) & TypeMask) == HeaderTypeFree) {
-		sz2 = (longAt(newFreeChunk)) & AllButTypeMask;
+		sz3 = (longAt(newFreeChunk)) & AllButTypeMask;
 	}
 	else {
 		/* begin sizeBitsOf: */
-		header3 = longAt(newFreeChunk);
-		sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
+		header4 = longAt(newFreeChunk);
+		sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
 			? (longAt(newFreeChunk - (BytesPerWord * 2))) & LongSizeMask
-			: header3 & SizeMask);
+			: header4 & SizeMask);
 	}
-	next = ((((usqInt)(newFreeChunk + sz2))) >= GIV(freeStart)
+	next = ((((usqInt)(newFreeChunk + sz3))) >= GIV(freeStart)
 		? GIV(freeStart)
-		: (newFreeChunk + sz2) + (headerTypeBytes[(longAt(newFreeChunk + sz2)) & TypeMask]));
+		: (newFreeChunk + sz3) + (headerTypeBytes[(longAt(newFreeChunk + sz3)) & TypeMask]));
 	assert((next == GIV(freeStart))
 	 || (next == (oopFromChunk(GIV(compEnd)))));
 	if (next == GIV(freeStart)) {
@@ -38622,7 +38631,7 @@
 	given object or free chunk in memory. Return freeStart when
 	enumeration is complete. This is for assertion checking only. */
 
-static usqInt
+static sqInt
 safeObjectAfter(sqInt oop)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt header;
@@ -44572,40 +44581,35 @@
 }
 
 
-/*	This is used to implement outer sends and outer expressions in Newspeak. */
+/*	This is used to implement the innards of the pushEnclosingObjectBytecode,
+	used for explicit outer sends in NS2/NS3.  */
 
 static sqInt
-enclosingObjectAtwithObjectwithMixin(sqInt depth, sqInt methodReceiver, sqInt methodMixin)
+enclosingObjectAtwithObjectwithMixin(sqInt n, sqInt anObject, sqInt mixin)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-    sqInt aBehavior;
     sqInt ccIndex;
     sqInt count;
     sqInt enclosingObject;
-    sqInt mixin;
     sqInt mixinApplication;
-    sqInt mixinApplication1;
     sqInt targetMixin;
 
-	enclosingObject = methodReceiver;
-	targetMixin = methodMixin;
+	enclosingObject = anObject;
+	targetMixin = mixin;
 	count = 0;
-	while (count < depth) {
+	while (count < n) {
 		count += 1;
-		assert(!((targetMixin == (nilObject()))));
-		/* begin findApplicationOfTargetMixin:startingAtBehavior: */
-		aBehavior = ((enclosingObject & 1)
+		if ((targetMixin == GIV(nilObj))
+		 || (enclosingObject == GIV(nilObj))) {
+			return GIV(nilObj);
+		}
+		mixinApplication = findApplicationOfTargetMixinstartingAtNonMetaClass(targetMixin, ((enclosingObject & 1)
 			? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << ShiftForWord))
 			: (((ccIndex = (((usqInt) (longAt(enclosingObject))) >> (compactClassFieldLSB())) & 0x1F)) == 0
 					? (longAt(enclosingObject - BaseHeaderSize)) & AllButTypeMask
-					: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))));
-		mixinApplication1 = aBehavior;
-		while (!((mixinApplication1 == GIV(nilObj))
-		 || ((mixinApplication1 == targetMixin)
-		 || (((mixin = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << ShiftForWord)))) == targetMixin)))) {
-			mixinApplication1 = longAt((mixinApplication1 + BaseHeaderSize) + (SuperclassIndex << ShiftForWord));
+					: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))));
+		if (mixinApplication == GIV(nilObj)) {
+			return GIV(nilObj);
 		}
-		mixinApplication = mixinApplication1;
-		assert(!((mixinApplication == (nilObject()))));
 		enclosingObject = longAt((mixinApplication + BaseHeaderSize) + (EnclosingObjectIndex << ShiftForWord));
 		targetMixin = longAt((targetMixin + BaseHeaderSize) + (EnclosingMixinIndex << ShiftForWord));
 	}
@@ -45365,7 +45369,62 @@
 	return (sp >> 1);
 }
 
+
+/*	This is used to implement the innards of the pushImplicitReceiverBytecode,
+	used for outer sends in NS2/NS3. Find the MixinApplcation of which
+	aBehavior is a subclass that is an application of targetMixin. This is an
+	implementation derived from
+	
+	<ContextPart> findApplicationOfTargetMixin: targetMixin
+	startingAtBehavior: aBehavior
+	 */
+
 static sqInt
+findApplicationOfTargetMixinstartingAtBehavior(sqInt targetMixin, sqInt aBehavior)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt ccIndex;
+    sqInt mixin;
+    sqInt mixinOrMixinApplication;
+
+	mixinOrMixinApplication = aBehavior;
+	while (!((mixinOrMixinApplication == GIV(nilObj))
+	 || ((mixinOrMixinApplication == targetMixin)
+	 || ((((mixin = longAt((mixinOrMixinApplication + BaseHeaderSize) + (MixinIndex << ShiftForWord)))) == targetMixin)
+	 || (((((ccIndex = (((usqInt) (longAt(mixin))) >> (compactClassFieldLSB())) & 0x1F)) == 0
+	? (longAt(mixin - BaseHeaderSize)) & AllButTypeMask
+	: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))) == targetMixin))))) {
+		mixinOrMixinApplication = longAt((mixinOrMixinApplication + BaseHeaderSize) + (SuperclassIndex << ShiftForWord));
+	}
+	return mixinOrMixinApplication;
+}
+
+
+/*	This is used to implement the innards of the pushImplicitReceiverBytecode,
+	used for outer sends in NS2/NS3. Find the MixinApplcation of which aClass
+	is a subclass that is an application of targetMixin. This is an
+	implementation derived from
+	
+	<ContextPart> findApplicationOfTargetMixin: targetMixin
+	startingAtNonMetaClass: aClass
+	 */
+
+static sqInt
+findApplicationOfTargetMixinstartingAtNonMetaClass(sqInt targetMixin, sqInt aClass)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt mixinOrMixinApplication;
+
+	assert(!((isForwarded(targetMixin))));
+	assert(!((isForwarded(aClass))));
+	mixinOrMixinApplication = aClass;
+	while (!((mixinOrMixinApplication == GIV(nilObj))
+	 || ((mixinOrMixinApplication == targetMixin)
+	 || ((longAt((mixinOrMixinApplication + BaseHeaderSize) + (MixinIndex << ShiftForWord))) == targetMixin)))) {
+		mixinOrMixinApplication = longAt((mixinOrMixinApplication + BaseHeaderSize) + (SuperclassIndex << ShiftForWord));
+	}
+	return mixinOrMixinApplication;
+}
+
+static sqInt
 findClassContainingMethodstartingAt(sqInt meth, sqInt classObj)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt classDict;

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2014-11-04 22:36:20 UTC (rev 3124)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2014-11-05 01:12:31 UTC (rev 3125)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.922 uuid: 52f1b50e-005d-4035-ad57-953a3790260e
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.923 uuid: b4a88a08-47d9-4173-9d8d-a2c11886c5fb
  */
 
 
@@ -64,7 +64,7 @@
 void (*functionPointerForCompiledMethodprimitiveIndex(sqInt methodObj, sqInt primIndex))(void) ;
 sqInt getCheckAllocFiller(void);
 void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP);
-sqInt implicitReceiverFormixinimplementing(sqInt methodReceiver, sqInt methodMixin, sqInt selector);
+sqInt implicitReceiverFormixinimplementing(sqInt rcvr, sqInt mixin, sqInt selector);
 usqInt instructionPointerAddress(void);
 usqInt interpretAddress(void);
 sqInt isCogMethodReference(sqInt methodHeader);

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-11-04 22:36:20 UTC (rev 3124)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-11-05 01:12:31 UTC (rev 3125)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.922 uuid: 52f1b50e-005d-4035-ad57-953a3790260e
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.923 uuid: b4a88a08-47d9-4173-9d8d-a2c11886c5fb
    from
-	CoInterpreter VMMaker.oscog-eem.922 uuid: 52f1b50e-005d-4035-ad57-953a3790260e
+	CoInterpreter VMMaker.oscog-eem.923 uuid: b4a88a08-47d9-4173-9d8d-a2c11886c5fb
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.922 uuid: 52f1b50e-005d-4035-ad57-953a3790260e " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.923 uuid: b4a88a08-47d9-4173-9d8d-a2c11886c5fb " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -23,8 +23,8 @@
 #endif
 
 #include <stddef.h> /* for e.g. alloca */
-#include <wchar.h>
 #include <setjmp.h>
+#include <wchar.h> /* for wint_t */
 #include "sqGnu.h"
 #include "vmCallback.h"
 #include "sqMemoryFence.h"
@@ -466,7 +466,7 @@
 static sqInt iframeReceiver(char *theFP) NoDbgRegParms;
 static sqInt iframeSavedIP(char *theFP) NoDbgRegParms;
 void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP);
-sqInt implicitReceiverFormixinimplementing(sqInt methodReceiver, sqInt methodMixin, sqInt selector);
+sqInt implicitReceiverFormixinimplementing(sqInt rcvr, sqInt mixin, sqInt selector);
 usqInt instructionPointerAddress(void);
 static sqInt instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr) NoDbgRegParms;
 usqInt interpretAddress(void);
@@ -856,7 +856,7 @@
 void printWronglySizedContexts(sqInt printContexts);
 static void restoreHeadersFromtofromandtofrom(sqInt firstIn, sqInt lastIn, sqInt hdrBaseIn, sqInt firstOut, sqInt lastOut, sqInt hdrBaseOut) NoDbgRegParms;
 static void runLeakCheckerForFullGC(sqInt fullGCFlag) NoDbgRegParms;
-static usqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
+static sqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
 static sqInt safePrintStringOf(sqInt oop) NoDbgRegParms;
 static sqInt shortentoIndexableSize(sqInt obj, sqInt nSlots) NoDbgRegParms;
 static sqInt sizeBitsOfSafe(sqInt oop) NoDbgRegParms;
@@ -1058,7 +1058,7 @@
 sqInt doSignalSemaphoreWithIndex(sqInt index);
 static void dummyReferToProxy(void);
 EXPORT(sqInt) dumpImage(sqInt fileName);
-static sqInt enclosingObjectAtwithObjectwithMixin(sqInt depth, sqInt methodReceiver, sqInt methodMixin) NoDbgRegParms;
+static sqInt enclosingObjectAtwithObjectwithMixin(sqInt n, sqInt anObject, sqInt mixin) NoDbgRegParms;
 static sqInt ensureCallerContext(char *theFP) NoDbgRegParms;
 static void ensureImageFormatIsUpToDate(sqInt swapBytes) NoDbgRegParms;
 static char * establishFrameForContextToReturnTo(sqInt contextToReturnTo) NoDbgRegParms;
@@ -1072,6 +1072,8 @@
 sqInt fetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer);
 static sqInt fetchPointerofMarriedContext(sqInt offset, sqInt aContext) NoDbgRegParms;
 static sqInt fetchStackPointerOf(sqInt aContext) NoDbgRegParms;
+static sqInt findApplicationOfTargetMixinstartingAtBehavior(sqInt targetMixin, sqInt aBehavior) NoDbgRegParms;
+static sqInt findApplicationOfTargetMixinstartingAtNonMetaClass(sqInt targetMixin, sqInt aClass) NoDbgRegParms;
 static sqInt findClassContainingMethodstartingAt(sqInt meth, sqInt classObj) NoDbgRegParms;
 sqInt findClassOfMethodforReceiver(sqInt meth, sqInt rcvr);
 static char * findFrameAboveinPage(char *theFP, StackPage *thePage) NoDbgRegParms;
@@ -1404,6 +1406,7 @@
 _iss sqInt tenuringThreshold;
 _iss sqInt forceTenureFlag;
 _iss sqInt longRunningPrimitiveCheckSequenceNumber;
+_iss sqInt methodDictLinearSearchLimit;
 _iss sqInt signalLowSpace;
 _iss usqLong statFullGCUsecs;
 _iss sqInt statFullGCs;
@@ -1419,7 +1422,6 @@
 _iss sqInt interruptKeycode;
 _iss sqInt interruptPending;
 _iss usqInt memory;
-_iss sqInt methodDictLinearSearchLimit;
 _iss usqLong nextPollUsecs;
 _iss usqLong statForceInterruptCheck;
 _iss usqLong statIGCDeltaUsecs;
@@ -2089,7 +2091,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.922";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.923";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -4960,12 +4962,9 @@
 		CASE(126)
 			/* dynamicSuperSendBytecode */
 			{
-				sqInt aBehavior;
 				sqInt ccIndex;
 				sqInt mClassMixin;
-				sqInt mixin;
 				sqInt mixinApplication;
-				sqInt mixinApplication1;
 				sqInt rcvr;
 
 				VM_LABEL(0dynamicSuperSendBytecode);
@@ -4975,19 +4974,11 @@
 				GIV(messageSelector) = longAt((GIV(method) + BaseHeaderSize) + (((byteAtPointer(++localIP)) + LiteralStart) << ShiftForWord));
 				rcvr = longAtPointer(localSP + (GIV(argumentCount) * BytesPerOop));
 				mClassMixin = methodClassOf(GIV(method));
-				/* begin findApplicationOfTargetMixin:startingAtBehavior: */
-				aBehavior = ((rcvr & 1)
+				mixinApplication = findApplicationOfTargetMixinstartingAtBehavior(mClassMixin, ((rcvr & 1)
 					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassSmallInteger << ShiftForWord))
 					: (((ccIndex = (((usqInt) (longAt(rcvr))) >> (compactClassFieldLSB())) & 0x1F)) == 0
 							? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask
-							: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))));
-				mixinApplication1 = aBehavior;
-				while (!((mixinApplication1 == GIV(nilObj))
-				 || ((mixinApplication1 == mClassMixin)
-				 || (((mixin = longAt((mixinApplication1 + BaseHeaderSize) + (MixinIndex << ShiftForWord)))) == mClassMixin)))) {

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list