[Vm-dev] [commit][2819] CogVM source as per VMMaker.oscog-eem.537.

commits at squeakvm.org commits at squeakvm.org
Thu Dec 5 23:21:35 UTC 2013


Revision: 2819
Author:   eliot
Date:     2013-12-05 15:21:33 -0800 (Thu, 05 Dec 2013)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.537.

Fix ObjectMemory's isForwarded:/isOopForwarded: macros, rescuing compilation
of the "classic" VMs.

Modified Paths:
--------------
    branches/Cog/nscogsrc/vm/cointerp.c
    branches/Cog/nscogsrc/vm/cointerp.h
    branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
    branches/Cog/nscogsrc/vm/interp.h
    branches/Cog/nscogsrc/vm/vmCallback.h
    branches/Cog/src/vm/cointerp.c
    branches/Cog/src/vm/cointerp.h
    branches/Cog/src/vm/cointerpmt.c
    branches/Cog/src/vm/cointerpmt.h
    branches/Cog/src/vm/gcc3x-cointerp.c
    branches/Cog/src/vm/gcc3x-cointerpmt.c
    branches/Cog/src/vm/interp.h
    branches/Cog/src/vm/vmCallback.h
    branches/Cog/stacksrc/vm/gcc3x-interp.c
    branches/Cog/stacksrc/vm/interp.c
    branches/Cog/stacksrc/vm/interp.h
    branches/Cog/stacksrc/vm/vmCallback.h

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

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2013-12-05 20:14:48 UTC (rev 2818)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2013-12-05 23:21:33 UTC (rev 2819)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b
    from
-	CoInterpreter VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c
+	CoInterpreter VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -2033,7 +2033,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.536";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.537";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -2062,8 +2062,8 @@
 #define initialEnterSmalltalkExecutive() enterSmalltalkExecutiveImplementation()
 #define instFormatFieldLSB() 8
 #define instFormatFieldWidth() 4
-#define isForwarded() false
-#define isOopForwarded() false
+#define isForwarded(oop) false
+#define isOopForwarded(oop) false
 #define memory() memory
 #define mostRecentlyUsedPage() GIV(mostRecentlyUsedPage)
 #define nextOpenPIC methodObject

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2013-12-05 20:14:48 UTC (rev 2818)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2013-12-05 23:21:33 UTC (rev 2819)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b
  */
 
 
@@ -262,6 +262,6 @@
 } while (0)
 #define instFormatFieldLSB() 8
 #define instFormatFieldWidth() 4
-#define isForwarded() false
-#define isOopForwarded() false
+#define isForwarded(oop) false
+#define isOopForwarded(oop) false
 

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2013-12-05 20:14:48 UTC (rev 2818)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2013-12-05 23:21:33 UTC (rev 2819)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b
    from
-	CoInterpreter VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c
+	CoInterpreter VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -2036,7 +2036,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.536";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.537";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -2065,8 +2065,8 @@
 #define initialEnterSmalltalkExecutive() enterSmalltalkExecutiveImplementation()
 #define instFormatFieldLSB() 8
 #define instFormatFieldWidth() 4
-#define isForwarded() false
-#define isOopForwarded() false
+#define isForwarded(oop) false
+#define isOopForwarded(oop) false
 #define memory() memory
 #define mostRecentlyUsedPage() GIV(mostRecentlyUsedPage)
 #define nextOpenPIC methodObject

Modified: branches/Cog/nscogsrc/vm/interp.h
===================================================================
--- branches/Cog/nscogsrc/vm/interp.h	2013-12-05 20:14:48 UTC (rev 2818)
+++ branches/Cog/nscogsrc/vm/interp.h	2013-12-05 23:21:33 UTC (rev 2819)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/nscogsrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nscogsrc/vm/vmCallback.h	2013-12-05 20:14:48 UTC (rev 2818)
+++ branches/Cog/nscogsrc/vm/vmCallback.h	2013-12-05 23:21:33 UTC (rev 2819)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b
  */
 
 #define VM_CALLBACK_INC 1


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Thu Dec  5 12:10:12 PST 2013
   + Thu Dec  5 15:20:31 PST 2013

Modified: branches/Cog/src/vm/cointerp.c
===================================================================
--- branches/Cog/src/vm/cointerp.c	2013-12-05 20:14:48 UTC (rev 2818)
+++ branches/Cog/src/vm/cointerp.c	2013-12-05 23:21:33 UTC (rev 2819)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b
    from
-	CoInterpreter VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c
+	CoInterpreter VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -2023,7 +2023,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.536]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.537]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -2052,8 +2052,8 @@
 #define initialEnterSmalltalkExecutive() enterSmalltalkExecutiveImplementation()
 #define instFormatFieldLSB() 8
 #define instFormatFieldWidth() 4
-#define isForwarded() false
-#define isOopForwarded() false
+#define isForwarded(oop) false
+#define isOopForwarded(oop) false
 #define memory() memory
 #define mostRecentlyUsedPage() GIV(mostRecentlyUsedPage)
 #define nextOpenPIC methodObject
@@ -5607,7 +5607,6 @@
 						/* begin internalPush: */
 						longAtPointerput((localSP -= BytesPerOop), longAt((rcvr + BaseHeaderSize) + (byte3 << ShiftForWord)));
 					}
-					null;
 					goto l4;
 				}
 				if (opType == 3) {
@@ -5617,7 +5616,6 @@
 					assert(GIV(method) == (iframeMethod(localFP)));
 					object = longAt((GIV(method) + BaseHeaderSize) + ((byte3 + LiteralStart) << ShiftForWord));
 					longAtPointerput((localSP -= BytesPerOop), object);
-					null;
 					goto l4;
 				}
 				if (opType == 4) {
@@ -5631,7 +5629,6 @@
 					object2 = longAt((oop + BaseHeaderSize) + (ValueIndex << ShiftForWord));
 					longAtPointerput((localSP -= BytesPerOop), object2);
 
-					null;
 					goto l4;
 				}
 				top = longAtPointer(localSP);

Modified: branches/Cog/src/vm/cointerp.h
===================================================================
--- branches/Cog/src/vm/cointerp.h	2013-12-05 20:14:48 UTC (rev 2818)
+++ branches/Cog/src/vm/cointerp.h	2013-12-05 23:21:33 UTC (rev 2819)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.536 uuid: c021f329-3f3a-469b-a838-24e74c1be39c
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b
  */
 
 
@@ -258,6 +258,6 @@
 } while (0)
 #define instFormatFieldLSB() 8
 #define instFormatFieldWidth() 4
-#define isForwarded() false
-#define isOopForwarded() false
+#define isForwarded(oop) false
+#define isOopForwarded(oop) false
 

Modified: branches/Cog/src/vm/cointerpmt.c
===================================================================
--- branches/Cog/src/vm/cointerpmt.c	2013-12-05 20:14:48 UTC (rev 2818)
+++ branches/Cog/src/vm/cointerpmt.c	2013-12-05 23:21:33 UTC (rev 2819)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.517 uuid: 14ff7126-70ec-4cc4-9f55-70256e6a3d35
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b
    from
-	CoInterpreterMT VMMaker.oscog-eem.517 uuid: 14ff7126-70ec-4cc4-9f55-70256e6a3d35
+	CoInterpreterMT VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b
  */
-static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.517 uuid: 14ff7126-70ec-4cc4-9f55-70256e6a3d35 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.537 uuid: 16e0cc2f-0c26-4d21-b1bf-1dde0d99b08b " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -255,7 +255,6 @@
 #define InstructionPointerIndex 1
 #define KeyIndex 0
 #define LargeContextBit 0x40000
-#define LargeContextBytes 252
 #define LargeContextSize 252
 #define LargeContextSlots 62
 #define LastLinkIndex 1
@@ -454,7 +453,7 @@
 sqInt cePositive32BitIntegerFor(usqInt anInteger);
 sqInt ceReturnToInterpreter(sqInt anOop);
 sqInt ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs);
-sqInt ceSendFromInLineCacheMiss(CogMethod *oPIC);
+sqInt ceSendFromInLineCacheMiss(CogMethod *cogMethodOrPIC);
 sqInt ceSendMustBeBoolean(sqInt anObject);
 sqInt ceSendsupertonumArgs(sqInt selector, sqInt superNormalBar, sqInt rcvr, sqInt numArgs);
 void ceStackOverflow(sqInt contextSwitchIfNotNil);
@@ -520,6 +519,7 @@
 sqInt compactClassAt(sqInt ccIndex);
 sqInt compactClassIndexOfHeader(sqInt header);
 sqInt compactClassIndexOf(sqInt oop);
+static sqInt compactIndexOfClass(sqInt aClassOop);
 static sqInt compare31or32Bitsequal(sqInt obj1, sqInt obj2);
 void compilationBreakpointFor(sqInt selectorOop);
 static sqInt containOnlyOops(sqInt array);
@@ -597,7 +597,7 @@
 static sqInt findHomeForContext(sqInt aContext);
 static sqInt findMethodWithPrimitiveFromContextUpToContext(sqInt primitive, sqInt senderContext, sqInt homeContext);
 static sqInt findMethodWithPrimitiveFromFPUpToContext(sqInt primitive, char *startFP, sqInt homeContext);
-static void findNewMethodInClassTag(sqInt classTag);
+static void findNewMethodInClassTag(sqInt classTagArg);
 sqInt findSelectorOfMethod(sqInt methArg);
 static char * findSPOfon(char *theFP, StackPage *thePage);
 void findStringBeginningWith(char *aCString);
@@ -718,7 +718,6 @@
 static sqInt isContext(sqInt oop);
 sqInt isFloatObject(sqInt oop);
 static sqInt isForwardedClassTag(sqInt classTag);
-static sqInt isForwarded(sqInt oop);
 static sqInt isFrameonPage(char *aFrame, StackPage *aPage);
 static sqInt isFree(StackPage * self_in_isFree);
 sqInt isImmediate(sqInt anOop);
@@ -735,7 +734,6 @@
 sqInt isNonIntegerObject(sqInt objectPointer);
 static sqInt isNullExternalPrimitiveCall(sqInt aMethodObj);
 sqInt isOopCompiledMethod(sqInt oop);
-static sqInt isOopForwarded(sqInt oop);
 sqInt isOopImmutable(sqInt anOop);
 sqInt isOopMutable(sqInt anOop);
 sqInt isPointers(sqInt oop);
@@ -748,7 +746,7 @@
 static sqInt isWeakNonImm(sqInt oop);
 sqInt isWeak(sqInt oop);
 static sqInt isWidowedContext(sqInt aOnceMarriedContext);
-static sqInt isWordsOrBytesNonInt(sqInt oop);
+static sqInt isWordsOrBytesNonImm(sqInt oop);
 sqInt isWordsOrBytes(sqInt oop);
 sqInt isWords(sqInt oop);
 sqInt isWriteMediatedContextInstVarIndex(sqInt index);
@@ -1141,6 +1139,7 @@
 EXPORT(void) printFramesOnStackPageListInUse(void);
 static void printFrameThingandFrameat(char *name, char *theFP, char *address);
 static void printFrameThingat(char *name, char *address);
+static void printFrameThingatextraString(char *name, char *address, char *extraStringOrNil);
 static void printFrameThingatextra(char *name, char *address, sqInt extraValue);
 sqInt printFrame(char *theFP);
 void printFrameWithSP(char *theFP, char *theSP);
@@ -1148,6 +1147,8 @@
 void printInstancesOf(sqInt aClassOop);
 static void printLogEntryAt(sqInt i);
 void printMemory(void);
+void printMethodCache(void);
+void printMethodCacheFor(sqInt thing);
 void printMethodDictionaryOf(sqInt behavior);
 void printMethodDictionary(sqInt dictionary);
 void printMethodReferencesTo(sqInt anOop);
@@ -1313,6 +1314,7 @@
 static sqInt validInstructionPointerinFrame(usqInt anInstrPointer, char *fp);
 sqInt validInstructionPointerinMethodframePointer(usqInt instrPointer, usqInt aMethod, char *fp);
 static sqInt validStackPageBaseFrames(void);
+static sqInt validStackPageBaseFrame(StackPage *aPage);
 static void verifyCleanHeaders(void);
 sqInt vmEndianness(void);
 usqInt vmOwnerLockAddress(void);
@@ -1326,6 +1328,7 @@
 sqInt withoutForwardingOnandsendToCogit(sqInt obj1, sqInt obj2, sqInt (*selector)(sqInt,sqInt));
 sqInt withoutForwardingOnandwithsendToCogit(sqInt obj1, sqInt obj2, sqInt aBool, sqInt (*selector)(sqInt,sqInt,sqInt));
 static sqInt withSmallIntegerTags(char *value);
+static sqInt wordSize(void);
 static sqInt wordSwapped(sqInt w);
 static sqInt writeImageFileIO(void);
 usqInt youngStartAddress(void);
@@ -1348,9 +1351,9 @@
 _iss usqInt instructionPointer;
 _iss sqInt argumentCount;
 _iss usqInt newMethod;
+_iss sqInt messageSelector;
 _iss usqInt youngStart;
 _iss StackPage * pages;
-_iss sqInt messageSelector;
 _iss char * stackBasePlus1;
 _iss sqInt traceLogIndex;
 _iss sqInt remapBufferCount;
@@ -1408,7 +1411,6 @@
 _iss sqInt rootTableOverflowed;
 _iss usqLong statGCEndUsecs;
 _iss sqInt statSweepCount;
-_iss sqInt cogCodeSize;
 _iss usqInt compEnd;
 _iss sqInt flagInterpretedMethods;
 _iss sqInt metaclassNumSlots;
@@ -1417,6 +1419,7 @@
 _iss sqInt statProcessSwitch;
 _iss sqInt backwardJumpCount;
 _iss sqInt checkThreadActivation;
+_iss sqInt cogCodeSize;
 _iss sqInt foreignCallbackProcessSlot;
 _iss usqInt fwdTableLast;
 _iss usqLong gcStartUsecs;
@@ -1459,7 +1462,6 @@
 _iss sqInt maxExtSemTabSizeSet;
 _iss sqInt memoryIsScarce;
 _iss usqLong statIGCDeltaUsecs;
-_iss sqInt classByteArrayCompactIndex;
 _iss sqInt deferSmash;
 _iss sqInt deferredSmash;
 _iss sqInt gcBiasToGrow;
@@ -1473,6 +1475,7 @@
 _iss usqLong statCodeCompactionUsecs;
 _iss sqInt statRootTableCount;
 _iss sqInt statSurvivorCount;
+_iss sqInt classByteArrayCompactIndex;
 _iss sqInt gcSemaphoreIndex;
 _iss sqInt imageHeaderFlags;
 _iss usqLong longRunningPrimitiveGCUsecs;
@@ -1523,11 +1526,11 @@
 sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */;
 sqInt inIOProcessEvents;
 sqInt checkForLeaks;
-static usqInt heapBase;
 sqInt desiredEdenBytes;
 sqInt desiredNumStackPages;
 sqInt extraVMMemory;
 sqInt desiredCogCodeSize;
+static usqInt heapBase;
 sqInt breakSelectorLength = -1;
 sqInt deferDisplayUpdates;
 sqInt disownCount;
@@ -2118,7 +2121,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.517]";
+const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.537]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 sqInt willNotThreadWarnCount;
@@ -2149,6 +2152,8 @@
 #define getNumThreads() GIV(numThreads)
 #define instFormatFieldLSB() 8
 #define instFormatFieldWidth() 4
+#define isForwarded(oop) false
+#define isOopForwarded(oop) false
 #define memory() memory
 #define mostRecentlyUsedPage() GIV(mostRecentlyUsedPage)
 #define nextOpenPIC methodObject
@@ -4811,6 +4816,7 @@
 							GIV(framePointer) = localFP;
 							
 							ceEnterCogCodePopReceiverReg();
+							null;
 							goto l158;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -4825,7 +4831,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = byteAtPointer(++localIP);
 
-					/* return self */
+					null;
 				l158:	/* end baseFrameReturn */;
 					goto l155;
 				}
@@ -5009,7 +5015,9 @@
 					/* begin literal: */
 					assert(GIV(method) == (iframeMethod(localFP)));
 					litVar = longAt((GIV(method) + BaseHeaderSize) + ((variableIndex + LiteralStart) << ShiftForWord));
-					
+					if (isForwarded(litVar)) {
+						litVar = followForwarded(litVar);
+					}
 					/* begin storePointer:ofObject:withValue: */
 					if ((((usqInt) litVar)) < (((usqInt) GIV(youngStart)))) {
 						possibleRootStoreIntovalue(litVar, longAtPointer(localSP));
@@ -5061,7 +5069,9 @@
 					/* begin literal: */
 					assert(GIV(method) == (iframeMethod(localFP)));
 					litVar = longAt((GIV(method) + BaseHeaderSize) + ((variableIndex + LiteralStart) << ShiftForWord));
-					
+					if (isForwarded(litVar)) {
+						litVar = followForwarded(litVar);
+					}
 					/* begin storePointer:ofObject:withValue: */
 					if ((((usqInt) litVar)) < (((usqInt) GIV(youngStart)))) {
 						possibleRootStoreIntovalue(litVar, longAtPointer(localSP));
@@ -5214,7 +5224,73 @@
 					GIV(instructionPointer) = oopForPointer(localIP);
 					GIV(stackPointer) = localSP;
 					GIV(framePointer) = localFP;
-					
+					if ((isOopForwarded(GIV(messageSelector)))
+					 || (0)) {
+						if (isOopForwarded(GIV(messageSelector))) {
+							GIV(messageSelector) = handleForwardedSelectorFaultFor(GIV(messageSelector));
+						}
+						
+						/* begin lookupInMethodCacheSel:classTag: */
+
+						/* shift drops two low-order zeros from addresses */
+
+						hash = GIV(messageSelector) ^ lkupClassTag;
+
+						/* first probe */
+
+						probe = hash & MethodCacheMask;
+						if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
+						 && ((GIV(methodCache)[probe + MethodCacheClass]) == lkupClassTag)) {
+							GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
+							primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
+							ok = 1;
+							goto l163;
+						}
+
+						/* second probe */
+
+						probe = (((usqInt) hash) >> 1) & MethodCacheMask;
+						if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
+						 && ((GIV(methodCache)[probe + MethodCacheClass]) == lkupClassTag)) {
+							GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
+							primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
+							ok = 1;
+							goto l163;
+						}
+						probe = (((usqInt) hash) >> 2) & MethodCacheMask;
+						if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
+						 && ((GIV(methodCache)[probe + MethodCacheClass]) == lkupClassTag)) {
+							GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
+							primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
+							ok = 1;
+							goto l163;
+						}
+						ok = 0;
+					l163:	/* end lookupInMethodCacheSel:classTag: */;
+						if (ok) {
+							/* begin ifAppropriateCompileToNativeCode:selector: */
+							VM_LABEL(1ifAppropriateCompileToNativeCodeselector);
+							methodHeader1 = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+							if (isCogMethodReference(methodHeader1)) {
+
+								/* makeBaseFrame: can create cog methods with nil selectors. */
+
+								cogMethod1 = ((CogMethod *) methodHeader1);
+								if (((cogMethod1->selector)) == GIV(nilObj)) {
+									setSelectorOfto(cogMethod1, GIV(messageSelector));
+								}
+							}
+							else {
+								if (((((usqInt) methodHeader1) >> 10) & 0xFF) <= maxLiteralCountForCompile) {
+									cogselector(GIV(newMethod), GIV(messageSelector));
+								}
+								else {
+									maybeFlagMethodAsInterpreted(GIV(newMethod));
+								}
+							}
+							goto l165;
+						}
+					}
 					GIV(lkupClass) = lkupClassTag;
 					lookupMethodInClass(GIV(lkupClass));
 					/* begin internalizeIPandSP */
@@ -5661,7 +5737,9 @@
 					/* begin literal: */
 					assert(GIV(method) == (iframeMethod(localFP)));
 					litVar = longAt((GIV(method) + BaseHeaderSize) + ((byte3 + LiteralStart) << ShiftForWord));
-					
+					if (isForwarded(litVar)) {
+						litVar = followForwarded(litVar);
+					}
 					/* begin storePointer:ofObject:withValue: */
 					if ((((usqInt) litVar)) < (((usqInt) GIV(youngStart)))) {
 						possibleRootStoreIntovalue(litVar, top);
@@ -5885,7 +5963,7 @@
 				localSP = pointerForOop(GIV(stackPointer));
 				localFP = pointerForOop(GIV(framePointer));
 				if (popValues) {
-					for (i = 0; i <= (size - 1); i += 1) {
+					for (i = 0; i < size; i += 1) {
 
 						/* Assume: have just allocated a new Array; it must be young. Thus, can use unchecked stores. */
 
@@ -5895,7 +5973,7 @@
 					localSP += size * BytesPerOop;
 				}
 				else {
-					for (i = 0; i <= (size - 1); i += 1) {
+					for (i = 0; i < size; i += 1) {
 						longAtput((array + BaseHeaderSize) + (i << ShiftForWord), GIV(nilObj));
 					}
 				}
@@ -6038,7 +6116,7 @@
 					GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize;
 				}
 				if (numCopied > 0) {
-					for (i = 0; i <= (numCopied - 1); i += 1) {
+					for (i = 0; i < numCopied; i += 1) {
 
 						/* Assume: have just allocated a new BlockClosure; it must be young.
 						   Thus, can use unchecked stores. */
@@ -8743,9 +8821,13 @@
 
 				VM_LABEL(0bytecodePrimIdentical);
 				rcvr = longAtPointer(localSP + (1 * BytesPerOop));
-				
+				if (isOopForwarded(rcvr)) {
+					rcvr = handleSpecialSelectorSendFaultForfpsp(rcvr, localFP, localSP);
+				}
 				arg = longAtPointer(localSP + (0 * BytesPerOop));
-				
+				if (isOopForwarded(arg)) {
+					arg = handleSpecialSelectorSendFaultForfpsp(arg, localFP, localSP);
+				}
 				/* begin booleanCheat: */
 				if (rcvr == arg) {
 					goto booleanCheatTrue;
@@ -8764,7 +8846,9 @@
 
 				VM_LABEL(0bytecodePrimClass);
 				rcvr = longAtPointer(localSP);
-				
+				if (isOopForwarded(rcvr)) {
+					rcvr = handleSpecialSelectorSendFaultForfpsp(rcvr, localFP, localSP);
+				}
 				/* begin internalStackTopPut: */
 				aValue = ((rcvr & 1)
 					? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord))
@@ -9482,7 +9566,7 @@
 	else {
 		primitiveFunctionPointer = primitiveInvokeObjectAsMethod;
 	}
-	for (p = 0; p <= (CacheProbeMax - 1); p += 1) {
+	for (p = 0; p < CacheProbeMax; p += 1) {
 		probe = (((usqInt) hash) >> p) & MethodCacheMask;
 		if ((GIV(methodCache)[probe + MethodCacheSelector]) == 0) {
 
@@ -9512,7 +9596,7 @@
 	/* ...and zap the following entries */
 
 	GIV(lastMethodCacheProbeWrite) = probe;
-	for (p = 1; p <= (CacheProbeMax - 1); p += 1) {
+	for (p = 1; p < CacheProbeMax; p += 1) {
 		probe = (((usqInt) hash) >> p) & MethodCacheMask;
 		GIV(methodCache)[probe + MethodCacheSelector] = 0;
 	}
@@ -9798,7 +9882,7 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
 	if (((arrayOop & 1) == 0)
 	 && (((arrayOop & 1) == 0)
-	 && (isWordsOrBytesNonInt(arrayOop)))) {
+	 && (isWordsOrBytesNonImm(arrayOop)))) {
 		return ((void *) (pointerForOop(arrayOop + BaseHeaderSize)));
 	}
 	/* begin primitiveFail */
@@ -10003,7 +10087,7 @@
     sqInt i;
     StackPage *thePage;
 
-	for (i = 0; i <= (GIV(numStackPages) - 1); i += 1) {
+	for (i = 0; i < GIV(numStackPages); i += 1) {
 		/* begin stackPageAt: */
 		thePage = stackPageAtpages(i, GIV(pages));
 		if (!(isFree(thePage))) {
@@ -10186,12 +10270,6 @@
     sqInt objHeader2;
     sqInt objHeaderBytes;
     sqInt objHeaderType;
-    sqInt objOop;
-    sqInt objOop1;
-    sqInt objOop2;
-    sqInt objOop3;
-    sqInt objOop4;
-    sqInt objOop5;
     sqInt objSize;
     sqInt oop1;
     sqInt oop11;
@@ -11892,12 +11970,13 @@
 
 /*	Send from an Open PIC when the first-level method lookup probe has failed,
 	or to continue when PIC creation has failed (e.g. because we're out of
-	code space). */
+	code space),
+	or when a send has failed due to a forwarded receiver. */
 /*	self printFrame: stackPage headFP WithSP: stackPage headSP */
 /*	self printStringOf: selector */
 
 sqInt
-ceSendFromInLineCacheMiss(CogMethod *oPIC)
+ceSendFromInLineCacheMiss(CogMethod *cogMethodOrPIC)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
     sqInt classTag;
@@ -11909,7 +11988,7 @@
     sqInt selector;
     sqInt top;
 
-	numArgs = (oPIC->cmNumArgs);
+	numArgs = (cogMethodOrPIC->cmNumArgs);
 
 	/* skip return pc */
 
@@ -11921,12 +12000,12 @@
 				? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask
 				: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))));
 	GIV(argumentCount) = numArgs;
-	if (lookupInMethodCacheSelclassTag((oPIC->selector), classTag)) {
+	if (lookupInMethodCacheSelclassTag((cogMethodOrPIC->selector), classTag)) {
 
 		/* check for coggability because method is in the cache */
 
 		/* begin ifAppropriateCompileToNativeCode:selector: */
-		selector = (oPIC->selector);
+		selector = (cogMethodOrPIC->selector);
 		methodHeader = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
 		if (isCogMethodReference(methodHeader)) {
 
@@ -11947,7 +12026,14 @@
 		}
 	}
 	else {
-		GIV(messageSelector) = (oPIC->selector);
+		GIV(messageSelector) = (cogMethodOrPIC->selector);
+		if ((isOopForwarded(GIV(messageSelector)))
+		 || (0)) {
+			if (isOopForwarded(GIV(messageSelector))) {
+				GIV(messageSelector) = handleForwardedSelectorFaultFor(GIV(messageSelector));
+			}
+			
+		}
 		if (((errSelIdx = lookupMethodNoMNUEtcInClass(classTag))) != 0) {
 			handleMNUInMachineCodeToclassForMessage(errSelIdx, rcvr, classTag);
 			assert(0);
@@ -12045,9 +12131,8 @@
 		classObj = longAt((classPointer + BaseHeaderSize) + (SuperclassIndex << ShiftForWord));
 		classTag = classObj;
 	}
-	canLinkCacheTag = 0
-	 || ((!(isYoungObject(classTag)))
-	 || (canLinkToYoungClasses()));
+	canLinkCacheTag = (canLinkToYoungClasses())
+	 || (!(isYoungObject(classTag)));
 	GIV(argumentCount) = numArgs;
 	if (lookupInMethodCacheSelclassTag(selector, classTag)) {
 
@@ -12409,7 +12494,7 @@
 static sqInt
 cheapAddressCouldBeInHeap(sqInt address)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
-	return ((address & ((BytesPerWord) - 1)) == 0)
+	return ((address & (4 - 1)) == 0)
 	 && ((oopisGreaterThanOrEqualTo(address, startOfMemory()))
 	 && ((((usqInt) address)) < (((usqInt) GIV(freeStart)))));
 }
@@ -13098,7 +13183,9 @@
 		return 0;
 	}
 	frameCtxt = longAt(theFP + FoxThisContext);
-	
+	if (isForwarded(frameCtxt)) {
+		frameCtxt = followForwarded(frameCtxt);
+	}
 	return frameCtxt == aContext;
 }
 
@@ -13259,7 +13346,7 @@
 	ok = ok && (checkOkayFields(GIV(messageSelector)));
 	ok = ok && (checkOkayFields(GIV(newMethod)));
 	ok = ok && (checkOkayFields(GIV(lkupClass)));
-	for (i = 0; i <= (MethodCacheEntries - 1); i += MethodCacheEntrySize) {
+	for (i = 0; i < MethodCacheEntries; i += MethodCacheEntrySize) {
 		oopOrZero = GIV(methodCache)[i + MethodCacheSelector];
 		if (!(oopOrZero == 0)) {
 			ok = ok && (checkOkayFields(GIV(methodCache)[i + MethodCacheSelector]));
@@ -13377,7 +13464,7 @@
 		printf("\n");
 		return 0;
 	}
-	unusedBit = 536870912;
+	unusedBit = 0x20000000;
 	
 	if (!(((longAt(oop)) & unusedBit) == 0)) {
 		print("oop ");
@@ -13482,7 +13569,7 @@
 		assert(pageListIsWellFormed());
 	}
 	ok = 1;
-	for (i = 0; i <= (GIV(numStackPages) - 1); i += 1) {
+	for (i = 0; i < GIV(numStackPages); i += 1) {
 		/* begin stackPageAt: */
 		thePage = stackPageAtpages(i, GIV(pages));
 		if (!(isFree(thePage))) {
@@ -13628,7 +13715,7 @@
     char *theSP;
 
 	ok = 1;
-	for (i = 0; i <= (GIV(numStackPages) - 1); i += 1) {
+	for (i = 0; i < GIV(numStackPages); i += 1) {
 		/* begin stackPageAt: */
 		thePage = stackPageAtpages(i, GIV(pages));
 		if (!(isFree(thePage))) {
@@ -13900,7 +13987,7 @@
 	}
 	length = stSizeOf(name);
 	srcName = ((char *) (arrayValueOf(name)));
-	for (i = 0; i <= (length - 1); i += 1) {
+	for (i = 0; i < length; i += 1) {
 		if (!((srcName[i]) == (className[i]))) {
 			return 0;
 		}
@@ -14004,7 +14091,7 @@
     sqInt i;
 
 	GIV(traceLogIndex) = 0;
-	for (i = 0; i <= (TraceBufferSize - 1); i += 1) {
+	for (i = 0; i < TraceBufferSize; i += 1) {
 		GIV(traceLog)[i] = 0;
 	}
 }
@@ -14209,6 +14296,24 @@
 }
 
 
+/*	Check that a class the VM assumes is compact has the right index. */
+
+static sqInt
+compactIndexOfClass(sqInt aClassOop)
+{   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt cct;
+    sqInt index;
+
+	cct = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord));
+	for (index = ((lengthOf(cct)) - 1); index >= 0; index += -2) {
+		if ((longAt((cct + BaseHeaderSize) + (index << ShiftForWord))) == aClassOop) {
+			return index + 1;
+		}
+	}
+	return 0;
+}
+
+
 /*	May set success to false */
 /*	First compare two ST integers... */
 
@@ -14625,7 +14730,7 @@
 
 		/* N.B. the expression ((numCopied - i) * BytesPerWord)) skips the return address */
 
-		for (i = 0; i <= (numCopied - 1); i += 1) {
+		for (i = 0; i < numCopied; i += 1) {
 
 			/* Assume: have just allocated a new BlockClosure; it must be young.
 			   Thus, can use unchecked stores. */
@@ -15068,7 +15173,7 @@
 	}
 	activeContext = marryFrameSP(GIV(framePointer), GIV(stackPointer));
 l1:	/* end ensureFrameIsMarried:SP: */;
-	for (i = 0; i <= (GIV(numStackPages) - 1); i += 1) {
+	for (i = 0; i < GIV(numStackPages); i += 1) {
 		/* begin stackPageAt: */
 		aPage = stackPageAtpages(i, GIV(pages));
 		if (!(isFree(aPage))) {
@@ -15412,13 +15517,13 @@
 		return null;
 	}
 	if ((GIV(primTraceLog)[GIV(primTraceLogIndex)]) != 0) {
-		for (i = GIV(primTraceLogIndex); i <= (PrimTraceLogSize - 1); i += 1) {
+		for (i = GIV(primTraceLogIndex); i < PrimTraceLogSize; i += 1) {
 			printPrimLogEntryAt(i);
 			/* begin cr */
 			printf("\n");
 		}
 	}
-	for (i = 0; i <= (GIV(primTraceLogIndex) - 1); i += 1) {
+	for (i = 0; i < GIV(primTraceLogIndex); i += 1) {
 		printPrimLogEntryAt(i);
 		/* begin cr */
 		printf("\n");
@@ -17262,7 +17367,7 @@
 	/* begin arrayValueOf: */
 	if (((arrayOop & 1) == 0)
 	 && (((arrayOop & 1) == 0)
-	 && (isWordsOrBytesNonInt(arrayOop)))) {
+	 && (isWordsOrBytesNonImm(arrayOop)))) {
 		return ((void *) (pointerForOop(arrayOop + BaseHeaderSize)));
 	}
 	/* begin primitiveFail */
@@ -17693,7 +17798,7 @@
  && (((((usqInt)rcvr)) >= (startOfMemory()))
  && (((((usqInt)rcvr)) < GIV(freeStart))
  && (((longAt(rcvr)) & TypeMask) != HeaderTypeGC)))))
-	 && (!0)) {
+	 && (!(isOopForwarded(rcvr)))) {
 		rclass = ((rcvr & 1)
 			? longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord))
 			: (((ccIndex = (((usqInt) (longAt(rcvr))) >> 12) & 0x1F)) == 0
@@ -17888,54 +17993,57 @@
  */
 
 static void
-findNewMethodInClassTag(sqInt classTag)
+findNewMethodInClassTag(sqInt classTagArg)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt class;
+    sqInt classTag;
     CogMethod *cogMethod;
+    CogMethod *cogMethod1;
     sqInt hash;
+    sqInt hash1;
     sqInt methodHeader;
+    sqInt methodHeader1;
     sqInt ok;
-    sqInt oop;
-    sqInt oop1;
     sqInt probe;
+    sqInt probe1;
 
 	/* begin lookupInMethodCacheSel:classTag: */
 
 	/* shift drops two low-order zeros from addresses */
 
-	hash = GIV(messageSelector) ^ classTag;
+	hash1 = GIV(messageSelector) ^ classTagArg;
 
 	/* first probe */
 
-	probe = hash & MethodCacheMask;
-	if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
-	 && ((GIV(methodCache)[probe + MethodCacheClass]) == classTag)) {
-		GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
-		primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
+	probe1 = hash1 & MethodCacheMask;
+	if (((GIV(methodCache)[probe1 + MethodCacheSelector]) == GIV(messageSelector))
+	 && ((GIV(methodCache)[probe1 + MethodCacheClass]) == classTagArg)) {
+		GIV(newMethod) = GIV(methodCache)[probe1 + MethodCacheMethod];
+		primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe1 + MethodCachePrimFunction]));
 		ok = 1;
-		goto l1;
+		goto l2;
 	}
 
 	/* second probe */
 
-	probe = (((usqInt) hash) >> 1) & MethodCacheMask;
-	if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
-	 && ((GIV(methodCache)[probe + MethodCacheClass]) == classTag)) {
-		GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
-		primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
+	probe1 = (((usqInt) hash1) >> 1) & MethodCacheMask;
+	if (((GIV(methodCache)[probe1 + MethodCacheSelector]) == GIV(messageSelector))
+	 && ((GIV(methodCache)[probe1 + MethodCacheClass]) == classTagArg)) {
+		GIV(newMethod) = GIV(methodCache)[probe1 + MethodCacheMethod];
+		primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe1 + MethodCachePrimFunction]));
 		ok = 1;
-		goto l1;
+		goto l2;
 	}
-	probe = (((usqInt) hash) >> 2) & MethodCacheMask;
-	if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
-	 && ((GIV(methodCache)[probe + MethodCacheClass]) == classTag)) {
-		GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
-		primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
+	probe1 = (((usqInt) hash1) >> 2) & MethodCacheMask;
+	if (((GIV(methodCache)[probe1 + MethodCacheSelector]) == GIV(messageSelector))
+	 && ((GIV(methodCache)[probe1 + MethodCacheClass]) == classTagArg)) {
+		GIV(newMethod) = GIV(methodCache)[probe1 + MethodCacheMethod];
+		primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe1 + MethodCachePrimFunction]));
 		ok = 1;
-		goto l1;
+		goto l2;
 	}
 	ok = 0;
-l1:	/* end lookupInMethodCacheSel:classTag: */;
+l2:	/* end lookupInMethodCacheSel:classTag: */;
 	if (ok) {
 		/* begin ifAppropriateCompileToNativeCode:selector: */
 		methodHeader = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
@@ -17959,10 +18067,76 @@
 	}
 	else {
 
-		/* entry was not found in the cache; look it up the hard way */
+		/* entry was not found in the cache; perhaps soemthing was forwarded. */
 
+		classTag = classTagArg;
+		if ((isOopForwarded(GIV(messageSelector)))
+		 || (0)) {
+			if (isOopForwarded(GIV(messageSelector))) {
+				GIV(messageSelector) = handleForwardedSelectorFaultFor(GIV(messageSelector));
+			}
+			
+			/* begin lookupInMethodCacheSel:classTag: */
+
+			/* shift drops two low-order zeros from addresses */
+
+			hash = GIV(messageSelector) ^ classTag;
+
+			/* first probe */
+
+			probe = hash & MethodCacheMask;
+			if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
+			 && ((GIV(methodCache)[probe + MethodCacheClass]) == classTag)) {
+				GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
+				primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
+				ok = 1;
+				goto l1;
+			}
+
+			/* second probe */
+
+			probe = (((usqInt) hash) >> 1) & MethodCacheMask;
+			if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
+			 && ((GIV(methodCache)[probe + MethodCacheClass]) == classTag)) {
+				GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
+				primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
+				ok = 1;
+				goto l1;
+			}
+			probe = (((usqInt) hash) >> 2) & MethodCacheMask;
+			if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
+			 && ((GIV(methodCache)[probe + MethodCacheClass]) == classTag)) {
+				GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
+				primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
+				ok = 1;
+				goto l1;
+			}
+			ok = 0;
+		l1:	/* end lookupInMethodCacheSel:classTag: */;
+			if (ok) {
+				/* begin ifAppropriateCompileToNativeCode:selector: */
+				methodHeader1 = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+				if (isCogMethodReference(methodHeader1)) {
+
+					/* makeBaseFrame: can create cog methods with nil selectors. */
+
+					cogMethod1 = ((CogMethod *) methodHeader1);
+					if (((cogMethod1->selector)) == GIV(nilObj)) {
+						setSelectorOfto(cogMethod1, GIV(messageSelector));
+					}
+				}
+				else {
+					if (((((usqInt) methodHeader1) >> 10) & 0xFF) <= maxLiteralCountForCompile) {
+						cogselector(GIV(newMethod), GIV(messageSelector));
+					}
+					else {
+						maybeFlagMethodAsInterpreted(GIV(newMethod));
+					}
+				}
+				return;
+			}
+		}
 		class = classTag;
-		
 		lookupMethodInClass(class);
 		addNewMethodToCache(class);
 	}
@@ -17986,8 +18160,12 @@
 		 && (((longAt(methArg)) & TypeMask) != HeaderTypeGC))))) {
 		return GIV(nilObj);
 	}
-	meth = methArg;
-
+	if (isForwarded(methArg)) {
+		meth = followForwarded(methArg);
+	}
+	else {
+		meth = methArg;
+	}
 	if (!(((meth & 1) == 0)
 		 && (((((usqInt) (longAt(meth))) >> (instFormatFieldLSB())) & 15) >= 12))) {
 		return GIV(nilObj);
@@ -18338,7 +18516,7 @@
 {
     sqInt newFloatObj;
 
-	newFloatObj = eeInstantiateClassIndexformatnumSlots(ClassFloatCompactIndex, 6, 8 / (BytesPerWord));
+	newFloatObj = eeInstantiateClassIndexformatnumSlots(ClassFloatCompactIndex, 6, ((sqInt) 8 >> 2));
 	storeFloatAtfrom(newFloatObj + (BaseHeaderSize), aFloat);
 	return newFloatObj;
 }
@@ -18428,14 +18606,14 @@
 	: byteAt((theFP + FoxIFrameFlags) + 1))))); ptr <= ((theFP + FoxCallerSavedIP) + BytesPerWord); ptr += BytesPerWord) {
 		oop = longAt(ptr);
 		if (((oop & 1) == 0)
-		 && (0)) {
+		 && (isForwarded(oop))) {
 			longAtput(ptr, followForwarded(oop));
 		}
 	}
 	for (ptr = theSP; ptr <= (frameReceiverOffset(theFP)); ptr += BytesPerWord) {
 		oop = longAt(ptr);
 		if (((oop & 1) == 0)
-		 && (0)) {
+		 && (isForwarded(oop))) {
 			longAtput(ptr, followForwarded(oop));
 		}
 	}
@@ -18464,15 +18642,15 @@
 /*	Spur's become: is lazy, turning the becommed object into a forwarding
 	object to the other.
 	The read-barrier is minimised by arranging that forwarding pointers will
-	fail a method cache probe,
-	since notionally objects' internals are accessed only via sending messages
-	to them (the exception
-	is primitives that access the internals of the non-receiver argument(s).
-	To avoid a read barrier on bytecode, literal and inst var fetch we scan
-	the receivers and methods
-	in the stack zone and follow any forwarded ones. This is of course way
-	cheaper than scanning all
-	of memory as in the old become. */
+	fail a method cache
+	probe, since notionally objects' internals are accessed only via sending
+	messages to them,
+	the exception is primitives that access the internals of the non-receiver
+	argument(s). To avoid a read barrier on bytecode, literal and inst var
+	fetch we scan the receivers and
+	methods in the stack zone and follow any forwarded ones. This is of course
+	way cheaper
+	than scanning all of memory as in the old become. */
 
 static void
 followForwardingPointersInStackZone(sqInt theBecomeEffectsFlags)
@@ -18483,6 +18661,7 @@
     sqInt delta;
     sqInt fieldIndex;
     sqInt i;
+    sqInt numArgs;
     sqInt offset;
     sqInt offset1;
     sqInt oop;
@@ -18492,11 +18671,17 @@
     char *theSP;
 
 	if (theBecomeEffectsFlags & BecameCompiledMethodFlag) {
-		;
-		
+		if (isForwarded(GIV(method))) {
+			theIPPtr = GIV(instructionPointer) - GIV(method);
+			GIV(method) = followForwarded(GIV(method));
+			GIV(instructionPointer) = GIV(method) + theIPPtr;
+		}
+		if (isForwarded(GIV(newMethod))) {
+			GIV(newMethod) = followForwarded(GIV(newMethod));
+		}
 	}
 	assert(GIV(stackPage) != 0);
-	for (i = 0; i <= (GIV(numStackPages) - 1); i += 1) {
+	for (i = 0; i < GIV(numStackPages); i += 1) {
 		/* begin stackPageAt: */
 		thePage = stackPageAtpages(i, GIV(pages));
 		if (!(((thePage->baseFP)) == 0)) {
@@ -18516,24 +18701,26 @@
 				assert(addressIsInPage(thePage, theFP));
 				assert((theIPPtr == 0)
 				 || (addressIsInPage(thePage, ((void *)theIPPtr))));
-				offset = theFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
-	? ((mframeCogMethod(theFP))->cmNumArgs)
-	: byteAt((theFP + FoxIFrameFlags) + 1))));
-				oop = longAt(offset);
+				/* begin frameStackedReceiverOffsetNumArgs: */
+				numArgs = ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
+					? ((mframeCogMethod(theFP))->cmNumArgs)
+					: byteAt((theFP + FoxIFrameFlags) + 1));
+				offset = (FoxCallerSavedIP + BytesPerWord) + (numArgs << ShiftForWord);
+				oop = longAt(theFP + offset);
 				if (((oop & 1) == 0)
-				 && (0)) {
-					longAtput(offset, followForwarded(oop));
+				 && (isForwarded(oop))) {
+					longAtput(theFP + offset, followForwarded(oop));
 				}
 				if ((((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
 	? ((longAt(theFP + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
 	: (byteAt((theFP + FoxIFrameFlags) + 2)) != 0))
-				 && (0)) {
+				 && (isForwarded(longAt(theFP + FoxThisContext)))) {
 					longAtput(theFP + FoxThisContext, followForwarded(longAt(theFP + FoxThisContext)));
 				}
 				if ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())) {
 					oop = longAt(theFP + FoxIFReceiver);
 					if (((oop & 1) == 0)
-					 && (0)) {
+					 && (isForwarded(oop))) {
 						longAtput(theFP + FoxIFReceiver, followForwarded(oop));
 					}
 					assert(!(isForwarded(frameMethodObject(theFP))));
@@ -18541,19 +18728,43 @@
 				else {
 					oop = longAt(theFP + FoxIFReceiver);
 					if (((oop & 1) == 0)
-					 && (0)) {
+					 && (isForwarded(oop))) {
 						longAtput(theFP + FoxIFReceiver, followForwarded(oop));
 					}
 					oop = longAt(theFP + FoxMethod);
-					
+					if (isForwarded(oop)) {
+						delta = (followForwarded(oop)) - oop;
+						if ((theIPPtr != 0)
+						 && ((longAt(theIPPtr)) > (longAt(theFP + FoxMethod)))) {
+							longAtput(theIPPtr, (longAt(theIPPtr)) + delta);
+						}
+						longAtput(theFP + FoxIFSavedIP, (longAt(theFP + FoxIFSavedIP)) + delta);
+						longAtput(theFP + FoxMethod, followForwarded(oop));
+					}
 				}
 				/* begin followNecessaryForwardingInMethod: */
 				/* begin literal:ofMethod: */
 				offset1 = (literalCountOfHeader(headerOf(longAt(theFP + FoxMethod)))) - 1;
 				assoc = longAt(((longAt(theFP + FoxMethod)) + BaseHeaderSize) + ((offset1 + LiteralStart) << ShiftForWord));
-				
+				if (isForwarded(assoc)) {
+					assoc = followForwarded(assoc);
+					/* begin setMethodClassAssociationOf:to: */
+					/* begin storePointer:ofObject:withValue: */
+					fieldIndex = ((literalCountOfHeader(headerOf(longAt(theFP + FoxMethod)))) + LiteralStart) - 1;
+					if ((((usqInt) (longAt(theFP + FoxMethod)))) < (((usqInt) GIV(youngStart)))) {
+						possibleRootStoreIntovalue(longAt(theFP + FoxMethod), assoc);
+					}
+					longAtput(((longAt(theFP + FoxMethod)) + BaseHeaderSize) + (fieldIndex << ShiftForWord), assoc);
+				}
 				classObj = longAt((assoc + BaseHeaderSize) + (ValueIndex << ShiftForWord));
-				
+				if (isForwarded(classObj)) {
+					classObj = followForwarded(assoc);
+					/* begin storePointer:ofObject:withValue: */
+					if ((((usqInt) assoc)) < (((usqInt) GIV(youngStart)))) {
+						possibleRootStoreIntovalue(assoc, classObj);
+					}
+					longAtput((assoc + BaseHeaderSize) + (ValueIndex << ShiftForWord), classObj);
+				}
 				if (!(((callerFP = frameCallerFP(theFP))) != 0)) break;
 				theIPPtr = ((usqInt)(theFP + FoxCallerSavedIP));
 				theFP = callerFP;
@@ -18905,7 +19116,7 @@
     sqInt i;
     StackPage *thePage;
 
-	for (i = 0; i <= (GIV(numStackPages) - 1); i += 1) {
+	for (i = 0; i < GIV(numStackPages); i += 1) {
 		/* begin stackPageAt: */
 		thePage = stackPageAtpages(i, GIV(pages));
 		if ((!(isFree(thePage)))
@@ -19728,7 +19939,7 @@
 	bitNo = 0;
 	
 #  if BytesPerWord > 4
-	if (!(shifted < (1 << 32))) {
+	if (!(shifted < (1LL << 32))) {
 		shifted = ((usqInt) shifted) >> 32;
 		bitNo += 32;
 	}
@@ -20480,7 +20691,7 @@
 
 	GIV(pages) = ((StackPage *) pageStructBase);
 	assert((((stackPageByteSize()) - (stackLimitBytes())) - (stackLimitOffset())) >= (stackPageHeadroom()));
-	for (index = 0; index <= (numPages - 1); index += 1) {
+	for (index = 0; index < numPages; index += 1) {
 		/* begin stackPageAt: */
 		page = stackPageAtpages(index, GIV(pages));
 		(page->lastAddress = theStackPages + (index * GIV(bytesPerPage)));
@@ -20500,7 +20711,7 @@
 	/* begin stackPageAt: */
 	page = stackPageAtpages(0, GIV(pages));
 	GIV(overflowLimit) = ((((page->baseAddress)) - ((page->realStackLimit))) * 3) / 5;
-	for (index = 0; index <= (numPages - 1); index += 1) {
+	for (index = 0; index < numPages; index += 1) {
 		/* begin stackPageAt: */
 		page = stackPageAtpages(index, GIV(pages));
 		assert((pageIndexFor((page->baseAddress))) == index);
@@ -20841,7 +21052,7 @@
 sqInt
 integerValueOf(sqInt objectPointer)
 {
-	if ((objectPointer & 2147483648UL) != 0) {
+	if ((objectPointer & 0x80000000UL) != 0) {
 
 		/* negative */
 
@@ -21091,7 +21302,7 @@
 isCogMethodReference(sqInt methodHeader)
 {
 	assert(((methodHeader & 1))
-	 || (((((usqInt)methodHeader)) < (maxCogMethodAddress()))
+	 || (((((usqInt)methodHeader)) < (startOfMemory()))
 	 && ((((usqInt)methodHeader)) >= (minCogMethodAddress()))));
 	return (methodHeader & 1) == 0;
 }
@@ -21155,17 +21366,7 @@
 	return 0;
 }
 
-
-/*	Compatibility wth SpurMemoryManager. In ObjectMemory, no forwarding
-	pointers are visible to the VM. */
-
 static sqInt
-isForwarded(sqInt oop)
-{
-	return 0;
-}
-
-static sqInt
 isFrameonPage(char *aFrame, StackPage *aPage)
 {
     char *theFP;
@@ -21367,16 +21568,6 @@
 	 && (((((usqInt) (longAt(oop))) >> (instFormatFieldLSB())) & 15) >= 12);
 }
 
-
-/*	Compatibility wth SpurMemoryManager. In ObjectMemory, no forwarding
-	pointers are visible to the VM. */
-
-static sqInt
-isOopForwarded(sqInt oop)
-{
-	return 0;
-}
-
 sqInt
 isOopImmutable(sqInt anOop)
 {
@@ -21540,7 +21731,11 @@
 			? ((longAt(theFrame + FoxMethod)) & MFMethodFlagHasContextFlag) != 0
 			: (byteAt((theFrame + FoxIFrameFlags) + 2)) != 0))) {
 			frameCtxt = longAt(theFrame + FoxThisContext);
-			
+			if (isForwarded(frameCtxt)) {
+				frameCtxt = followForwarded(frameCtxt);
+				/* begin setFrameContext:to: */
+				longAtput(theFrame + FoxThisContext, frameCtxt);
+			}
 			if (frameCtxt == aOnceMarriedContext) {
 
 				/* It is still married! */
@@ -21557,13 +21752,13 @@
 }
 
 
-/*	Answer true if the contains only indexable words or bytes (no oops). See
+/*	Answer if the contains only indexable words or bytes (no oops). See
 	comment in formatOf:
  */
 /*	Note: Excludes CompiledMethods. */
 
 static sqInt
-isWordsOrBytesNonInt(sqInt oop)
+isWordsOrBytesNonImm(sqInt oop)
 {
     sqInt fmt;
 
@@ -21574,7 +21769,7 @@
 }
 
 
-/*	Answer true if the contains only indexable words or bytes (no oops). See
+/*	Answer if the contains only indexable words or bytes (no oops). See
 	comment in formatOf:
  */
 /*	Note: Excludes CompiledMethods. */
@@ -21583,11 +21778,11 @@
 isWordsOrBytes(sqInt oop)
 {
 	return ((oop & 1) == 0)
-	 && (isWordsOrBytesNonInt(oop));
+	 && (isWordsOrBytesNonImm(oop));
 }
 
 
-/*	Answer true if the argument contains only indexable words (no oops). See
+/*	Answer if the argument contains only indexable words (no oops). See
 	comment in formatOf:
  */
 
@@ -22226,7 +22421,7 @@
 				if (!((fieldOop & 3) == 0)) {
 					return 0;
 				}
-				if ((fieldOop & 2147483648UL) == 0) {
+				if ((fieldOop & 0x80000000UL) == 0) {
 
 					/* Internal pointer -- add segment offset */
 
@@ -22374,7 +22569,7 @@
  && (((longAt(oop)) & TypeMask) != HeaderTypeGC)))))
 	 || (((oop & (BytesPerWord - 1)) != 0)
 	 || ((((longAt(oop)) & TypeMask) == HeaderTypeFree)
-	 || (0))))) {
+	 || (isForwarded(oop)))))) {
 		printOop(oop);
 		return;
 	}
@@ -23057,8 +23252,8 @@
     sqInt sz;
 
 	isSmall = (isNegative
-		? magnitude <= 1073741824
-		: magnitude < 1073741824);
+		? magnitude <= 0x40000000
+		: magnitude < 0x40000000);
 	if (isSmall) {
 		smallVal = ((sqInt) magnitude);
 		if (isNegative) {
@@ -23086,7 +23281,7 @@
 		}
 	}
 	newLargeInteger = instantiateClassindexableSize(largeClass, sz);
-	for (i = 0; i <= (sz - 1); i += 1) {
+	for (i = 0; i < sz; i += 1) {
 		intValue = (magnitude >> (i * 8)) & 0xFF;
 		byteAtput((newLargeInteger + BaseHeaderSize) + i, intValue);
 	}
@@ -23180,7 +23375,7 @@
 		return null;
 	}
 	value = 0;
-	for (i = 0; i <= (sz - 1); i += 1) {
+	for (i = 0; i < sz; i += 1) {
 		value += (((sqLong) (byteAt((oop + BaseHeaderSize) + i)))) << (i * 8);
 	}
 	return value;
@@ -23211,6 +23406,7 @@
     StackPage *page;
     char *pointer;
     sqInt rawHeader;
+    sqInt rcvr;
     sqInt stackPtrIndex;
     sqInt theIP;
     sqInt theMethod;
@@ -23218,6 +23414,9 @@
     sqInt valuePointer;
     sqInt valuePointer1;
 
+
+	/* theIP must be typed as signed because it is assigned ceCannotResumePC and so maybe implicitly typed as unsigned. */
+
 	assert(isSingleContext(aContext));
 	assert(goodContextSize(aContext));
 	theIP = longAt((aContext + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord));
@@ -23237,6 +23436,12 @@
 l2:	/* end newStackPage */;
 	longAtput((pointer = (page->baseAddress)), longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord)));
 	longAtput((pointer -= BytesPerWord), aContext);
+
+	/* If the frame is a closure activation then the closure should be on the stack in
+	   the pushed receiver position (closures receiver the value[:value:] messages).
+	   Otherwise it should be the receiver proper. */
+
+	rcvr = longAt((aContext + BaseHeaderSize) + (ReceiverIndex << ShiftForWord));
 	maybeClosure = longAt((aContext + BaseHeaderSize) + (ClosureIndex << ShiftForWord));
 	if (maybeClosure != GIV(nilObj)) {
 		/* begin quickFetchInteger:ofObject: */
@@ -23254,7 +23459,7 @@
 			: methodHeader);
 		numArgs = (((usqInt) header) >> 25) & 15;
 		
-		longAtput((pointer -= BytesPerWord), longAt((aContext + BaseHeaderSize) + (ReceiverIndex << ShiftForWord)));
+		longAtput((pointer -= BytesPerWord), rcvr);
 	}
 	for (i = 1; i <= numArgs; i += 1) {
 		longAtput((pointer -= BytesPerWord), longAt((aContext + BaseHeaderSize) + ((ReceiverIndex + i) << ShiftForWord)));
@@ -23327,7 +23532,7 @@
 	(page->baseFP = (page->headFP));
 	assert(frameHasContext((page->baseFP)));
 	assert((frameNumArgs((page->baseFP))) == numArgs);

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list