[Vm-dev] [commit][2880] CogVM source as per VMMaker.oscog-eem.640

commits at squeakvm.org commits at squeakvm.org
Thu Mar 13 22:38:54 UTC 2014


Revision: 2880
Author:   eliot
Date:     2014-03-13 15:38:52 -0700 (Thu, 13 Mar 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.640
Author: eem
Time: 13 March 2014, 3:29:13.957 pm
UUID: b52d099d-350b-40ce-8ef3-0bbf96ca7539
Ancestors: VMMaker.oscog-eem.639

Now that Slang inline block support is better rewrite the
machine-code scanning routines to use two new control structures,
offsetCacheTagAndCouldBeObjectAt:annotation:into: &
targetMethodAndSendTableFor:annotation:into:.

Hence eliminate all the duplication between Newspeak and Squeak
in the scanning routines, such as markNSYoungObjects:pc:method:.

Inline methodAfter: & roundUpLength: (the latter via a macro, sigh).

Spur: Update primitiveSizeInBytesOfInstance to work with CompiledMethods.

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

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

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2014-03-13 17:26:37 UTC (rev 2879)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-03-13 22:38:52 UTC (rev 2880)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.638 uuid: 4c01acdf-1273-4319-aef5-fd3591c3dbe9
+	CCodeGenerator VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.638 uuid: 4c01acdf-1273-4319-aef5-fd3591c3dbe9
+	StackToRegisterMappingCogit VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.638 uuid: 4c01acdf-1273-4319-aef5-fd3591c3dbe9 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -920,10 +920,8 @@
 void markAndTraceObjectsOrFreeMachineCode(sqInt inFullGC);
 static sqInt markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit);
 static void markAndTraceOrFreeMachineCodeForFullGC(void);
-static sqInt markLiteralsAndUnlinkIfUnmarkedSendOrPushImplicitpcmethod(sqInt annotation, char *mcpc, sqInt cogMethod);
 static sqInt markLiteralsAndUnlinkIfUnmarkedSendpcmethod(sqInt annotation, char *mcpc, sqInt cogMethod);
 void markMethodAndReferents(CogBlockMethod *aCogMethod);
-static sqInt markNSYoungObjectspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod);
 static sqInt markYoungObjectspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod);
 static void marshallImplicitReceiverSendArguments(sqInt numArgs);
 static void marshallSendArguments(sqInt numArgs);
@@ -935,7 +933,6 @@
 static CogSimStackEntry * mergeAtfrom(CogSimStackEntry * self_in_mergeAtfrom, sqInt baseOffset, sqInt baseRegister);
 static void mergeafterContinuation(BytecodeFixup *fixup, sqInt mergeWithContinuation);
 static sqInt methodAbortTrampolineFor(sqInt numArgs);
-static CogMethod * methodAfter(CogMethod *cogMethod);
 CogMethod * methodFor(void *address);
 static sqInt methodhasSameCodeAscheckPenultimate(sqInt methodA, sqInt methodB, sqInt comparePenultimateLiteral);
 sqInt minCogMethodAddress(void);
@@ -1006,7 +1003,6 @@
 static AbstractInstruction * relocateMethodReferenceBeforeAddressby(AbstractInstruction * self_in_relocateMethodReferenceBeforeAddressby, sqInt pc, sqInt delta);
 static sqInt relocateMethodsPreCompaction(void);
 static sqInt remapIfObjectRefpchasYoung(sqInt annotation, char *mcpc, sqInt hasYoungPtr);
-static sqInt remapNSIfObjectRefpchasYoung(sqInt annotation, char *mcpc, sqInt hasYoungPtr);
 static sqInt remapObject(sqInt oop);
 static sqInt remapOop(sqInt oop);
 static sqInt removeFromOpenPICList(CogMethod *anOpenPIC);
@@ -1019,7 +1015,6 @@
 static sqInt rewriteJumpLongAttarget(AbstractInstruction * self_in_rewriteJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 void rewritePrimInvocationInto(CogMethod *cogMethod, void (*primFunctionPointer)(void));
 static sqInt roomOnYoungReferrersList(void);
-static sqInt roundUpLength(sqInt numBytes);
 static AbstractInstruction * gSubCqR(sqInt quickConstant, sqInt reg);
 static AbstractInstruction * gSubCwR(sqInt wordConstant, sqInt reg);
 static void scanBlock(BlockStart *blockStart);
@@ -2057,6 +2052,7 @@
 #define recordPrimTrace() (traceFlags & 8)
 #define recordSendTrace() (traceFlags & 2)
 #define reportError(n) warning("compilation error")
+#define roundUpLength(numBytes) ((numBytes) + 7 & -8)
 #define setCFramePointer(theFP) (CFramePointer = (void *)(theFP))
 #define setCStackPointer(theSP) (CStackPointer = (void *)(theSP))
 #define simStackAt(index) (simStack + (index))
@@ -2210,7 +2206,7 @@
 		if (((cogMethod->cmType)) == CMMethod) {
 			heapMapAtWordPut(cogMethod, 1);
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 }
 
@@ -2316,7 +2312,7 @@
 				ok = 0;
 			}
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	return ok;
 }
@@ -2333,7 +2329,7 @@
 				return 0;
 			}
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	return 1;
 }
@@ -2945,10 +2941,10 @@
     sqInt cacheTag;
     sqInt entryPoint;
     sqInt literal;
-    sqInt off;
-    sqInt offset;
-    sqInt table;
-    CogMethod *targetMethod;
+    sqInt sendTable;
+    sqInt *sendTable1;
+    sqInt targetMethod;
+    CogMethod *targetMethod1;
 
 	if (annotation == IsObjectReference) {
 		literal = literalBeforeFollowingAddress(backEnd, ((sqInt)mcpc));
@@ -2982,31 +2978,31 @@
 
 			/* It's a linked send; find which kind. */
 
-			/* begin offsetAndSendTableFor:annotation:into: */
+			/* begin targetMethodAndSendTableFor:annotation:into: */
 			if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
 				assert(annotation == IsSendCall);
-				offset = cmEntryOffset;
-
+				targetMethod1 = ((CogMethod *) (entryPoint - cmEntryOffset));
+				sendTable1 = sendTrampolines;
 			}
 			else {
 				if ((entryPoint & entryPointMask) == dynSuperEntryAlignment) {
 					assert(annotation == IsNSSendCall);
-					offset = cmDynSuperEntryOffset;
-
+					targetMethod1 = ((CogMethod *) (entryPoint - cmDynSuperEntryOffset));
+					sendTable1 = dynamicSuperSendTrampolines;
 				}
 				else {
 					assert(annotation == IsSendCall);
-					offset = cmNoCheckEntryOffset;
-
+					targetMethod1 = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset));
+					sendTable1 = superSendTrampolines;
 				}
 			}
 
-			targetMethod = ((CogMethod *) (entryPoint - offset));
-			if (!(asserta((((targetMethod->cmType)) == CMMethod)
-				 || ((((targetMethod->cmType)) == CMClosedPIC)
-				 || (((targetMethod->cmType)) == CMOpenPIC))))) {
+			if (!(asserta((((targetMethod1->cmType)) == CMMethod)
+				 || ((((targetMethod1->cmType)) == CMClosedPIC)
+				 || (((targetMethod1->cmType)) == CMOpenPIC))))) {
 				return 6;
 			}
+
 		}
 	}
 	return 0;
@@ -3020,7 +3016,6 @@
     sqInt off;
     sqInt offset;
     sqInt selectorOrCacheTag;
-    sqInt *sendTable;
     sqInt table;
 
 	if (annotation == IsObjectReference) {
@@ -3045,20 +3040,17 @@
 			if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
 				assert(annotation == IsSendCall);
 				offset = cmEntryOffset;
-				sendTable = sendTrampolines;
 
 			}
 			else {
 				if ((entryPoint & entryPointMask) == dynSuperEntryAlignment) {
 					assert(annotation == IsNSSendCall);
 					offset = cmDynSuperEntryOffset;
-					sendTable = dynamicSuperSendTrampolines;
 
 				}
 				else {
 					assert(annotation == IsSendCall);
 					offset = cmNoCheckEntryOffset;
-					sendTable = superSendTrampolines;
 
 				}
 			}
@@ -3174,7 +3166,7 @@
 				}
 			}
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	return ok;
 }
@@ -3284,7 +3276,7 @@
 		if (((cogMethod->cmType)) == CMMethod) {
 			freeMethod(cogMethod);
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	manageFromto(baseAddress, limitAddress);
 }
@@ -3408,7 +3400,7 @@
 		if (((cogMethod->cmType)) != CMFree) {
 			count += 1;
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	constituents = instantiateClassindexableSize(classArray(), count * 2);
 	if (constituents == null) {
@@ -3444,7 +3436,7 @@
 			storePointerUncheckedofObjectwithValue(count + 1, topRemappableOop(), value);
 			count += 2;
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	if ((((label = stringForCString("CCFree"))) == null)
 	 || (((value = cePositive32BitIntegerFor(freeStart()))) == null)) {
@@ -3816,7 +3808,7 @@
 			openPICList = source;
 		}
 		methodCount += 1;
-		source = methodAfter(source);
+		source = ((CogMethod *) (roundUpLength((((sqInt)source)) + ((source->blockSize)))));
 	}
 	if (source >= (limitZony())) {
 		haltmsg("no free methods; cannot compact.");
@@ -10301,7 +10293,7 @@
 				freeMethod(cogMethod);
 				freedSoFar += (cogMethod->blockSize);
 			}
-			cogMethod = methodAfter(cogMethod);
+			cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 		}
 	} while((freedSoFar < amountToFree)
  && (((freeableUsage += 1)) < CMMaxUsageCount));
@@ -10321,7 +10313,7 @@
 		 && (cPICHasFreedTargets(cogMethod))) {
 			(cogMethod->cmType = CMFree);
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 		count += 1;
 	}
 	assert(count == (numMethods()));
@@ -16153,10 +16145,10 @@
 incrementUsageOfTargetIfLinkedSendmcpcignored(sqInt annotation, char *mcpc, sqInt superfluity)
 {
     sqInt entryPoint;
-    sqInt off;
-    sqInt offset;
-    sqInt table;
-    CogMethod *targetMethod;
+    sqInt sendTable;
+    sqInt *sendTable1;
+    sqInt targetMethod;
+    CogMethod *targetMethod1;
 
 	if ((annotation == IsSendCall)
 			 || (annotation == IsNSSendCall)) {
@@ -16165,29 +16157,29 @@
 
 			/* It's a linked send. */
 
-			/* begin offsetAndSendTableFor:annotation:into: */
+			/* begin targetMethodAndSendTableFor:annotation:into: */
 			if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
 				assert(annotation == IsSendCall);
-				offset = cmEntryOffset;
-
+				targetMethod1 = ((CogMethod *) (entryPoint - cmEntryOffset));
+				sendTable1 = sendTrampolines;
 			}
 			else {
 				if ((entryPoint & entryPointMask) == dynSuperEntryAlignment) {
 					assert(annotation == IsNSSendCall);
-					offset = cmDynSuperEntryOffset;
-
+					targetMethod1 = ((CogMethod *) (entryPoint - cmDynSuperEntryOffset));
+					sendTable1 = dynamicSuperSendTrampolines;
 				}
 				else {
 					assert(annotation == IsSendCall);
-					offset = cmNoCheckEntryOffset;
-
+					targetMethod1 = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset));
+					sendTable1 = superSendTrampolines;
 				}
 			}
 
-			targetMethod = ((CogMethod *) (entryPoint - offset));
-			if (((targetMethod->cmUsageCount)) < (((sqInt) CMMaxUsageCount >> 1))) {
-				(targetMethod->cmUsageCount = ((targetMethod->cmUsageCount)) + 1);
+			if (((targetMethod1->cmUsageCount)) < (((sqInt) CMMaxUsageCount >> 1))) {
+				(targetMethod1->cmUsageCount = ((targetMethod1->cmUsageCount)) + 1);
 			}
+
 		}
 	}
 	return 0;
@@ -17426,7 +17418,7 @@
 						hasYoungObj = 1;
 					}
 				}
-				mapForperformUntilarg(cogMethod, remapNSIfObjectRefpchasYoung, hasYoungObjPtr);
+				mapForperformUntilarg(cogMethod, remapIfObjectRefpchasYoung, hasYoungObjPtr);
 				if (hasYoungObj) {
 					if (!((cogMethod->cmRefersToYoung))) {
 						(cogMethod->cmRefersToYoung = 1);
@@ -17439,7 +17431,7 @@
 				}
 			}
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	pruneYoungReferrers();
 	if (freedPIC) {
@@ -17480,14 +17472,14 @@
 					assert(((cogMethod->objectHeader)) == (nullHeaderForMachineCodeMethod()));
 					(cogMethod->methodObject = remapOop((cogMethod->methodObject)));
 				}
-				mapForperformUntilarg(cogMethod, remapNSIfObjectRefpchasYoung, 0);
+				mapForperformUntilarg(cogMethod, remapIfObjectRefpchasYoung, 0);
 				if (((cogMethod->cmRefersToYoung))
 				 && (allYoungObjectsAgeInFullGC())) {
 					(cogMethod->cmRefersToYoung = 0);
 				}
 			}
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	pruneYoungReferrers();
 	if (codeModified) {
@@ -17542,7 +17534,7 @@
 						hasYoungObj = 1;
 					}
 				}
-				mapForperformUntilarg(cogMethod, remapNSIfObjectRefpchasYoung, hasYoungObjPtr);
+				mapForperformUntilarg(cogMethod, remapIfObjectRefpchasYoung, hasYoungObjPtr);
 				if (hasYoungObj) {
 					hasYoungObj = 0;
 				}
@@ -17646,7 +17638,7 @@
 				 && (isYoung((cogMethod->methodObject)))) {
 					markAndTrace((cogMethod->methodObject));
 				}
-				mapForperformUntilarg(cogMethod, markNSYoungObjectspcmethod, ((sqInt)cogMethod));
+				mapForperformUntilarg(cogMethod, markYoungObjectspcmethod, ((sqInt)cogMethod));
 			}
 		}
 		pointer += BytesPerWord;
@@ -17721,7 +17713,7 @@
 			assert(((cogMethod->cmType)) == CMMethod);
 			assert(isMarked((cogMethod->methodObject)));
 			markAndTraceLiteral((cogMethod->selector));
-			mapForperformUntilarg(cogMethod, markLiteralsAndUnlinkIfUnmarkedSendOrPushImplicitpcmethod, ((sqInt)cogMethod));
+			mapForperformUntilarg(cogMethod, markLiteralsAndUnlinkIfUnmarkedSendpcmethod, ((sqInt)cogMethod));
 		}
 		return 0;
 	}
@@ -17763,7 +17755,7 @@
 	cogMethod = ((CogMethod *) methodZoneBase);
 	while (cogMethod < (limitZony())) {
 		markAndTraceOrFreeCogMethodfirstVisit(cogMethod, 1);
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	if (leakCheckFullGC()) {
 		assert(allMachineCodeObjectReferencesValid());
@@ -17782,21 +17774,24 @@
  */
 
 static sqInt
-markLiteralsAndUnlinkIfUnmarkedSendOrPushImplicitpcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
+markLiteralsAndUnlinkIfUnmarkedSendpcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
 {
     sqInt cacheTag;
+    sqInt cacheTag1;
     sqInt cacheTagMarked;
     sqInt class;
     sqInt classpc;
     sqInt entryPoint;
+    sqInt entryPoint1;
     sqInt literal;
     sqInt mixin;
     sqInt mixinpc;
-    sqInt off;
-    sqInt offset;
-    sqInt *sendTable;
-    sqInt table;
-    CogMethod *targetMethod;
+    sqInt sendTable;
+    sqInt *sendTable1;
+    sqInt tagCouldBeObj;
+    sqInt tagCouldBeObj1;
+    sqInt targetMethod;
+    CogMethod *targetMethod1;
     sqInt unlinkedRoutine;
 
 	if (annotation == IsObjectReference) {
@@ -17805,162 +17800,84 @@
 	}
 	if ((annotation == IsSendCall)
 			 || (annotation == IsNSSendCall)) {
-		entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
-		cacheTag = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
-		cacheTagMarked = cacheTagIsMarked(cacheTag);
-		if (entryPoint == ceImplicitReceiverTrampoline) {
-			markAndTraceLiteral(cacheTag);
-			classpc = (((sqInt)mcpc)) + (jumpShortByteSize(backEnd));
-			mixinpc = ((((sqInt)mcpc)) + (jumpShortByteSize(backEnd))) + BytesPerOop;
-			class = unalignedLongAt(backEnd, classpc);
-			if (class != 0) {
-				assert(addressCouldBeObj(class));
-				if (cacheTagIsMarked(class)) {
-					if (((mixin = unalignedLongAt(backEnd, mixinpc))) != 0) {
-						markAndTraceLiteral(mixin);
-					}
-				}
-				else {
-					unalignedLongAtput(backEnd, classpc, 0);
-					unalignedLongAtput(backEnd, mixinpc, 0);
-					codeModified = 1;
-				}
-			}
-			else {
-				assert((unalignedLongAt(backEnd, mixinpc)) == 0);
-			}
-		}
-		else {
-			if (entryPoint > methodZoneBase) {
+		/* begin offsetCacheTagAndCouldBeObjectAt:annotation:into: */
+		cacheTag1 = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
 
-				/* It's a linked send. */
+		/* in-line cache tags are the selectors of sends if sends are unlinked,
+		   the selectors of super sends (entry offset = cmNoCheckEntryOffset)
+		   or in-line cache tags (classes, class indices, immediate bit patterns, etc).
+		   Note that selectors can be immediate so there is no guarantee that they
+		   are markable/remappable objects. */
 
-				/* begin offsetAndSendTableFor:annotation:into: */
-				if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
-					assert(annotation == IsSendCall);
-					offset = cmEntryOffset;
-					sendTable = sendTrampolines;
+		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
+		tagCouldBeObj1 = (inlineCacheTagsMayBeObjects())
+		 || ((entryPoint1 < methodZoneBase)
+		 || ((entryPoint1 & entryPointMask) == cmNoCheckEntryOffset));
+		cacheTagMarked = tagCouldBeObj1
+		 && (cacheTagIsMarked(cacheTag1));
+		if (entryPoint1 > methodZoneBase) {
 
-				}
-				else {
-					if ((entryPoint & entryPointMask) == dynSuperEntryAlignment) {
-						assert(annotation == IsNSSendCall);
-						offset = cmDynSuperEntryOffset;
-						sendTable = dynamicSuperSendTrampolines;
-
-					}
-					else {
-						assert(annotation == IsSendCall);
-						offset = cmNoCheckEntryOffset;
-						sendTable = superSendTrampolines;
-
-					}
-				}
-
-				if (offset == cmNoCheckEntryOffset) {
-					markAndTraceLiteral(cacheTag);
-					cacheTagMarked = 1;
-				}
-				else {
-					cacheTagMarked = cacheTagIsMarked(cacheTag);
-				}
-				targetMethod = ((CogMethod *) (entryPoint - offset));
-				if ((!cacheTagMarked)
-				 || (markAndTraceOrFreeCogMethodfirstVisit(targetMethod, (((usqInt)targetMethod)) > (((usqInt)mcpc))))) {
-
-					/* Either the cacheTag is unmarked (e.g. new class) or the target
-					   has been freed (because it is unmarked) so unlink the send. */
-
-					unlinkedRoutine = sendTable[((((targetMethod->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod->cmNumArgs)) : (NumSendTrampolines - 1))];
-					rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod->selector), unlinkedRoutine);
-					codeModified = 1;
-					markAndTraceLiteral((targetMethod->selector));
-				}
-			}
-			else {
-				markAndTraceLiteral(cacheTag);
-			}
-		}
-	}
-	return 0;
-}
-
-
-/*	Mark and trace literals. Unlink sends that have unmarked cache tags or
-	targets. 
- */
-
-static sqInt
-markLiteralsAndUnlinkIfUnmarkedSendpcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
-{
-    sqInt cacheTag;
-    sqInt cacheTagMarked;
-    sqInt entryPoint;
-    sqInt literal;
-    sqInt off;
-    sqInt offset;
-    sqInt *sendTable;
-    sqInt table;
-    CogMethod *targetMethod;
-    sqInt unlinkedRoutine;
-
-	if (annotation == IsObjectReference) {
-		literal = literalBeforeFollowingAddress(backEnd, ((sqInt)mcpc));
-		markAndTraceLiteral(literal);
-	}
-	if ((annotation == IsSendCall)
-			 || (annotation == IsNSSendCall)) {
-		cacheTag = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
-		entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
-		if (entryPoint > methodZoneBase) {
-
 			/* It's a linked send. */
 
-			/* begin offsetAndSendTableFor:annotation:into: */
-			if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
+			/* begin targetMethodAndSendTableFor:annotation:into: */
+			if ((entryPoint1 & entryPointMask) == checkedEntryAlignment) {
 				assert(annotation == IsSendCall);
-				offset = cmEntryOffset;
-				sendTable = sendTrampolines;
-
+				targetMethod1 = ((CogMethod *) (entryPoint1 - cmEntryOffset));
+				sendTable1 = sendTrampolines;
 			}
 			else {
-				if ((entryPoint & entryPointMask) == dynSuperEntryAlignment) {
+				if ((entryPoint1 & entryPointMask) == dynSuperEntryAlignment) {
 					assert(annotation == IsNSSendCall);
-					offset = cmDynSuperEntryOffset;
-					sendTable = dynamicSuperSendTrampolines;
-
+					targetMethod1 = ((CogMethod *) (entryPoint1 - cmDynSuperEntryOffset));
+					sendTable1 = dynamicSuperSendTrampolines;
 				}
 				else {
 					assert(annotation == IsSendCall);
-					offset = cmNoCheckEntryOffset;
-					sendTable = superSendTrampolines;
-
+					targetMethod1 = ((CogMethod *) (entryPoint1 - cmNoCheckEntryOffset));
+					sendTable1 = superSendTrampolines;
 				}
 			}
 
-			targetMethod = ((CogMethod *) (entryPoint - offset));
-			if (offset == cmNoCheckEntryOffset) {
-				markAndTraceLiteral(cacheTag);
-				cacheTagMarked = 1;
-			}
-			else {
-				cacheTagMarked = cacheTagIsMarked(cacheTag);
-			}
 			if ((!cacheTagMarked)
-			 || (markAndTraceOrFreeCogMethodfirstVisit(targetMethod, (((usqInt)targetMethod)) > (((usqInt)mcpc))))) {
+			 || (markAndTraceOrFreeCogMethodfirstVisit(targetMethod1, (((usqInt)targetMethod1)) > (((usqInt)mcpc))))) {
 
 				/* Either the cacheTag is unmarked (e.g. new class) or the target
-				   has been freed (because it is unmarked) so unlink the send. */
+				   has been freed (because it is unmarked), so unlink the send. */
 
-				unlinkedRoutine = sendTable[((((targetMethod->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod->cmNumArgs)) : (NumSendTrampolines - 1))];
-				rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod->selector), unlinkedRoutine);
+				unlinkedRoutine = sendTable1[((((targetMethod1->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod1->cmNumArgs)) : (NumSendTrampolines - 1))];
+				rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod1->selector), unlinkedRoutine);
 				codeModified = 1;
-				markAndTraceLiteral((targetMethod->selector));
+				markAndTraceLiteral((targetMethod1->selector));
 			}
+
 		}
 		else {
-			markAndTraceLiteral(cacheTag);
+			markAndTraceLiteral(cacheTag1);
+			if (entryPoint1 == ceImplicitReceiverTrampoline) {
+				markAndTraceLiteral(cacheTag1);
+				classpc = (((sqInt)mcpc)) + (jumpShortByteSize(backEnd));
+				mixinpc = ((((sqInt)mcpc)) + (jumpShortByteSize(backEnd))) + BytesPerOop;
+				class = unalignedLongAt(backEnd, classpc);
+				if (class != 0) {
+					assert(addressCouldBeObj(class));
+					if (cacheTagIsMarked(class)) {
+						if (((mixin = unalignedLongAt(backEnd, mixinpc))) != 0) {
+							markAndTraceLiteral(mixin);
+						}
+					}
+					else {
+						unalignedLongAtput(backEnd, classpc, 0);
+						unalignedLongAtput(backEnd, mixinpc, 0);
+						codeModified = 1;
+					}
+				}
+				else {
+					assert((unalignedLongAt(backEnd, mixinpc)) == 0);
+				}
+			}
+
 		}
+
 	}
 	return 0;
 }
@@ -17983,13 +17900,17 @@
 /*	Mark and trace young literals. */
 
 static sqInt
-markNSYoungObjectspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
+markYoungObjectspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
 {
     sqInt cacheTag;
+    sqInt cacheTag1;
     sqInt class;
     sqInt entryPoint;
+    sqInt entryPoint1;
     sqInt literal;
     sqInt mixin;
+    sqInt tagCouldBeObj;
+    sqInt tagCouldBeObj1;
 
 	if (annotation == IsObjectReference) {
 		literal = literalBeforeFollowingAddress(backEnd, ((sqInt)mcpc));
@@ -17997,38 +17918,32 @@
 	}
 	if ((annotation == IsSendCall)
 			 || (annotation == IsNSSendCall)) {
-		cacheTag = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
-		markAndTraceLiteralIfYoung(cacheTag);
-		entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
-		if (entryPoint == ceImplicitReceiverTrampoline) {
+		/* begin offsetCacheTagAndCouldBeObjectAt:annotation:into: */
+		cacheTag1 = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
+
+		/* in-line cache tags are the selectors of sends if sends are unlinked,
+		   the selectors of super sends (entry offset = cmNoCheckEntryOffset)
+		   or in-line cache tags (classes, class indices, immediate bit patterns, etc).
+		   Note that selectors can be immediate so there is no guarantee that they
+		   are markable/remappable objects. */
+
+		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
+		tagCouldBeObj1 = (inlineCacheTagsMayBeObjects())
+		 || ((entryPoint1 < methodZoneBase)
+		 || ((entryPoint1 & entryPointMask) == cmNoCheckEntryOffset));
+		if (tagCouldBeObj1) {
+			markAndTraceLiteralIfYoung(cacheTag1);
+		}
+		if (entryPoint1 == ceImplicitReceiverTrampoline) {
 			if (((class = unalignedLongAt(backEnd, (((sqInt)mcpc)) + (jumpShortByteSize(backEnd))))) != 0) {
 				markAndTraceLiteralIfYoung(class);
 				mixin = unalignedLongAt(backEnd, ((((sqInt)mcpc)) + (jumpShortByteSize(backEnd))) + BytesPerOop);
 				markAndTraceLiteralIfYoung(mixin);
 			}
 		}
-	}
-	return 0;
-}
 
 
-/*	Mark and trace young literals. */
-
-static sqInt
-markYoungObjectspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
-{
-    sqInt cacheTag;
-    sqInt literal;
-
-	if (annotation == IsObjectReference) {
-		literal = literalBeforeFollowingAddress(backEnd, ((sqInt)mcpc));
-		markAndTraceLiteralIfYoung(literal);
 	}
-	if ((annotation == IsSendCall)
-			 || (annotation == IsNSSendCall)) {
-		cacheTag = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
-		markAndTraceLiteralIfYoung(cacheTag);
-	}
 	return 0;
 }
 
@@ -18282,12 +18197,6 @@
 	return methodAbortTrampolines[((numArgs < ((numRegArgs()) + 1)) ? numArgs : ((numRegArgs()) + 1))];
 }
 
-static CogMethod *
-methodAfter(CogMethod *cogMethod)
-{
-	return ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
-}
-
 CogMethod *
 methodFor(void *address)
 {
@@ -18297,7 +18206,7 @@
 	cogMethod = ((CogMethod *) baseAddress);
 	while ((cogMethod < (limitZony()))
 	 && ((((usqInt)cogMethod)) <= (((usqInt)address)))) {
-		nextMethod = methodAfter(cogMethod);
+		nextMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 		if (nextMethod == cogMethod) {
 			return 0;
 		}
@@ -18436,7 +18345,7 @@
 		 && (((cogMethod->cmUsageCount)) == CMMaxUsageCount)) {
 			return 0;
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	return 1;
 }
@@ -18558,7 +18467,7 @@
 		if (((cogMethod->cmType)) == cogMethodType) {
 			n += 1;
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	return n;
 }
@@ -18772,7 +18681,7 @@
 			assert((cogMethodDoesntLookKosher(cogMethod)) == 0);
 			(cogMethod->objectHeader = delta);
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 }
 
@@ -18900,7 +18809,7 @@
 	cogMethod = ((CogMethod *) baseAddress);
 	while (cogMethod < (limitZony())) {
 		printCogMethod(cogMethod);
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 }
 
@@ -18914,7 +18823,7 @@
 		if (((cogMethod->cmType)) == cmType) {
 			printCogMethod(cogMethod);
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 }
 
@@ -18929,7 +18838,7 @@
 		 && (((cogMethod->methodObject)) == methodOop)) {
 			printCogMethod(cogMethod);
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 }
 
@@ -18944,7 +18853,7 @@
 		 && (primIdx == (primitiveIndexOfMethodheader((cogMethod->methodObject), (cogMethod->methodHeader))))) {
 			printCogMethod(cogMethod);
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 }
 
@@ -18959,7 +18868,7 @@
 		 && (((cogMethod->selector)) == selectorOop)) {
 			printCogMethod(cogMethod);
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 }
 
@@ -19423,7 +19332,7 @@
 				relocateCallsAndSelfReferencesInMethod(cogMethod);
 			}
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	relocateAndPruneYoungReferrers();
 	return 1;
@@ -19433,77 +19342,18 @@
 remapIfObjectRefpchasYoung(sqInt annotation, char *mcpc, sqInt hasYoungPtr)
 {
     sqInt cacheTag;
+    sqInt cacheTag1;
     sqInt entryPoint;
+    sqInt entryPoint1;
     sqInt literal;
     sqInt mappedCacheTag;
     sqInt mappedLiteral;
-    sqInt offset;
-    CogMethod *targetMethod;
-
-	if (annotation == IsObjectReference) {
-		literal = literalBeforeFollowingAddress(backEnd, ((sqInt)mcpc));
-		if (couldBeObject(literal)) {
-			mappedLiteral = remapObject(literal);
-			if (literal != mappedLiteral) {
-				storeLiteralbeforeFollowingAddress(backEnd, mappedLiteral, ((sqInt)mcpc));
-				codeModified = 1;
-			}
-			if ((hasYoungPtr != 0)
-			 && (isYoung(mappedLiteral))) {
-				(((sqInt *) hasYoungPtr))[0] = 1;
-			}
-		}
-	}
-	if ((annotation == IsSendCall)
-			 || (annotation == IsNSSendCall)) {
-		cacheTag = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
-		if (couldBeObject(cacheTag)) {
-			mappedCacheTag = remapObject(cacheTag);
-			if (cacheTag != mappedCacheTag) {
-				rewriteInlineCacheTagat(backEnd, mappedCacheTag, ((sqInt)mcpc));
-				codeModified = 1;
-			}
-			if ((hasYoungPtr != 0)
-			 && (isYoung(mappedCacheTag))) {
-				(((sqInt *) hasYoungPtr))[0] = 1;
-			}
-		}
-		if (hasYoungPtr != 0) {
-
-			/* Since the unlinking routines may rewrite the cacheTag to the send's selector, and
-			   since they don't have the cogMethod to hand and can't add it to youngReferrers,
-			   the method must remain in youngReferrers if the targetMethod's selector is young. */
-
-			entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
-			if (entryPoint > methodZoneBase) {
-
-				/* It's a linked send. */
-
-				offset = ((entryPoint & entryPointMask) == checkedEntryAlignment
-					? cmEntryOffset
-					: cmNoCheckEntryOffset);
-				targetMethod = ((CogMethod *) (entryPoint - offset));
-				if (isYoung((targetMethod->selector))) {
-					(((sqInt *) hasYoungPtr))[0] = 1;
-				}
-			}
-		}
-	}
-	return 0;
-}
-
-static sqInt
-remapNSIfObjectRefpchasYoung(sqInt annotation, char *mcpc, sqInt hasYoungPtr)
-{
-    sqInt cacheTag;
-    sqInt entryPoint;
-    sqInt literal;
-    sqInt mappedCacheTag;
-    sqInt mappedLiteral;
     sqInt mappedOop;
     sqInt offset;
     sqInt oop;
     sqInt pc;
+    sqInt tagCouldBeObj;
+    sqInt tagCouldBeObj1;
     CogMethod *targetMethod;
 
 	if (annotation == IsObjectReference) {
@@ -19522,10 +19372,23 @@
 	}
 	if ((annotation == IsSendCall)
 			 || (annotation == IsNSSendCall)) {
-		cacheTag = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
-		if (couldBeObject(cacheTag)) {
-			mappedCacheTag = remapObject(cacheTag);
-			if (cacheTag != mappedCacheTag) {
+		/* begin offsetCacheTagAndCouldBeObjectAt:annotation:into: */
+		cacheTag1 = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
+
+		/* in-line cache tags are the selectors of sends if sends are unlinked,
+		   the selectors of super sends (entry offset = cmNoCheckEntryOffset)
+		   or in-line cache tags (classes, class indices, immediate bit patterns, etc).
+		   Note that selectors can be immediate so there is no guarantee that they
+		   are markable/remappable objects. */
+
+		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
+		tagCouldBeObj1 = (inlineCacheTagsMayBeObjects())
+		 || ((entryPoint1 < methodZoneBase)
+		 || ((entryPoint1 & entryPointMask) == cmNoCheckEntryOffset));
+		if (tagCouldBeObj1
+		 && (couldBeObject(cacheTag1))) {
+			mappedCacheTag = remapObject(cacheTag1);
+			if (cacheTag1 != mappedCacheTag) {
 				rewriteInlineCacheTagat(backEnd, mappedCacheTag, ((sqInt)mcpc));
 				codeModified = 1;
 			}
@@ -19534,8 +19397,7 @@
 				(((sqInt *) hasYoungPtr))[0] = 1;
 			}
 		}
-		entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
-		if (entryPoint == ceImplicitReceiverTrampoline) {
+		if (entryPoint1 == ceImplicitReceiverTrampoline) {
 			pc = (((sqInt)mcpc)) + (jumpShortByteSize(backEnd));
 			if (((oop = unalignedLongAt(backEnd, pc))) != 0) {
 				mappedOop = remapOop(oop);
@@ -19566,20 +19428,21 @@
 				   since they don't have the cogMethod to hand and can't add it to youngReferrers,
 				   the method must remain in youngReferrers if the targetMethod's selector is young. */
 
-				if (entryPoint > methodZoneBase) {
+				if (entryPoint1 > methodZoneBase) {
 
 					/* It's a linked send. */
 
-					offset = ((entryPoint & entryPointMask) == checkedEntryAlignment
+					offset = ((entryPoint1 & entryPointMask) == checkedEntryAlignment
 						? cmEntryOffset
 						: cmNoCheckEntryOffset);
-					targetMethod = ((CogMethod *) (entryPoint - offset));
+					targetMethod = ((CogMethod *) (entryPoint1 - offset));
 					if (isYoung((targetMethod->selector))) {
 						(((sqInt *) hasYoungPtr))[0] = 1;
 					}
 				}
 			}
 		}
+
 	}
 	return 0;
 }
@@ -19809,12 +19672,6 @@
 	return (limitAddress - (methodCount * BytesPerWord)) >= mzFreeStart;
 }
 
-static sqInt
-roundUpLength(sqInt numBytes)
-{
-	return (numBytes + 7) & -8;
-}
-
 static AbstractInstruction *
 gSubCqR(sqInt quickConstant, sqInt reg)
 {
@@ -20712,7 +20569,7 @@
 				freeMethod(cogMethod);
 			}
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	flushICacheFromto(processor, methodZoneBase, ((sqInt)(limitZony())));
 }
@@ -20721,11 +20578,10 @@
 unlinkIfFreeOrLinkedSendpcof(sqInt annotation, char *mcpc, sqInt theSelector)
 {
     sqInt entryPoint;
-    sqInt off;
-    sqInt offset;
-    sqInt *sendTable;
-    sqInt table;
-    CogMethod *targetMethod;
+    sqInt sendTable;
+    sqInt *sendTable1;
+    sqInt targetMethod;
+    CogMethod *targetMethod1;
     sqInt unlinkedRoutine;
 
 	if ((annotation == IsSendCall)
@@ -20735,42 +20591,38 @@
 
 			/* It's a linked send. */
 
-			/* begin offsetAndSendTableFor:annotation:into: */
+			/* begin targetMethodAndSendTableFor:annotation:into: */
 			if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
 				assert(annotation == IsSendCall);
-				offset = cmEntryOffset;
-				sendTable = sendTrampolines;
-
+				targetMethod1 = ((CogMethod *) (entryPoint - cmEntryOffset));
+				sendTable1 = sendTrampolines;
 			}
 			else {
 				if ((entryPoint & entryPointMask) == dynSuperEntryAlignment) {
 					assert(annotation == IsNSSendCall);
-					offset = cmDynSuperEntryOffset;
-					sendTable = dynamicSuperSendTrampolines;
-
+					targetMethod1 = ((CogMethod *) (entryPoint - cmDynSuperEntryOffset));
+					sendTable1 = dynamicSuperSendTrampolines;
 				}
 				else {
 					assert(annotation == IsSendCall);
-					offset = cmNoCheckEntryOffset;
-					sendTable = superSendTrampolines;
-
+					targetMethod1 = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset));
+					sendTable1 = superSendTrampolines;
 				}
 			}
 
-			targetMethod = ((CogMethod *) (entryPoint - offset));
-			if ((((targetMethod->cmType)) == CMFree)
-			 || (((targetMethod->selector)) == theSelector)) {
-				unlinkedRoutine = sendTable[((((targetMethod->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod->cmNumArgs)) : (NumSendTrampolines - 1))];
-				rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod->selector), unlinkedRoutine);
+			if ((((targetMethod1->cmType)) == CMFree)
+			 || (((targetMethod1->selector)) == theSelector)) {
+				unlinkedRoutine = sendTable1[((((targetMethod1->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod1->cmNumArgs)) : (NumSendTrampolines - 1))];
+				rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod1->selector), unlinkedRoutine);
 				codeModified = 1;
 			}
+
 		}
 		else {
-			if (entryPoint == ceImplicitReceiverTrampoline) {
-				if ((inlineCacheTagAt(backEnd, ((sqInt)mcpc))) == theSelector) {
-					unalignedLongAtput(backEnd, (((sqInt)mcpc)) + (jumpShortByteSize(backEnd)), 0);
-					unalignedLongAtput(backEnd, ((((sqInt)mcpc)) + (jumpShortByteSize(backEnd))) + BytesPerOop, 0);
-				}
+			if ((entryPoint == ceImplicitReceiverTrampoline)
+			 && ((inlineCacheTagAt(backEnd, ((sqInt)mcpc))) == theSelector)) {
+				unalignedLongAtput(backEnd, (((sqInt)mcpc)) + (jumpShortByteSize(backEnd)), 0);
+				unalignedLongAtput(backEnd, ((((sqInt)mcpc)) + (jumpShortByteSize(backEnd))) + BytesPerOop, 0);
 			}
 
 		}
@@ -20782,11 +20634,10 @@
 unlinkIfLinkedSendToFreepcignored(sqInt annotation, char *mcpc, sqInt superfluity)
 {
     sqInt entryPoint;
-    sqInt off;
-    sqInt offset;
-    sqInt *sendTable;
-    sqInt table;
-    CogMethod *targetMethod;
+    sqInt sendTable;
+    sqInt *sendTable1;
+    sqInt targetMethod;
+    CogMethod *targetMethod1;
     sqInt unlinkedRoutine;
 
 	if ((annotation == IsSendCall)
@@ -20796,34 +20647,31 @@
 
 			/* It's a linked send. */
 
-			/* begin offsetAndSendTableFor:annotation:into: */
+			/* begin targetMethodAndSendTableFor:annotation:into: */
 			if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
 				assert(annotation == IsSendCall);
-				offset = cmEntryOffset;
-				sendTable = sendTrampolines;
-
+				targetMethod1 = ((CogMethod *) (entryPoint - cmEntryOffset));
+				sendTable1 = sendTrampolines;
 			}
 			else {
 				if ((entryPoint & entryPointMask) == dynSuperEntryAlignment) {
 					assert(annotation == IsNSSendCall);
-					offset = cmDynSuperEntryOffset;
-					sendTable = dynamicSuperSendTrampolines;
-
+					targetMethod1 = ((CogMethod *) (entryPoint - cmDynSuperEntryOffset));
+					sendTable1 = dynamicSuperSendTrampolines;
 				}
 				else {
 					assert(annotation == IsSendCall);
-					offset = cmNoCheckEntryOffset;
-					sendTable = superSendTrampolines;
-
+					targetMethod1 = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset));
+					sendTable1 = superSendTrampolines;
 				}
 			}
 
-			targetMethod = ((CogMethod *) (entryPoint - offset));
-			if (((targetMethod->cmType)) == CMFree) {
-				unlinkedRoutine = sendTable[((((targetMethod->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod->cmNumArgs)) : (NumSendTrampolines - 1))];
-				rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod->selector), unlinkedRoutine);
+			if (((targetMethod1->cmType)) == CMFree) {
+				unlinkedRoutine = sendTable1[((((targetMethod1->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod1->cmNumArgs)) : (NumSendTrampolines - 1))];
+				rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod1->selector), unlinkedRoutine);
 				codeModified = 1;
 			}
+
 		}
 	}
 	return 0;
@@ -20833,11 +20681,10 @@
 unlinkIfLinkedSendpcignored(sqInt annotation, char *mcpc, sqInt superfluity)
 {
     sqInt entryPoint;
-    sqInt off;
-    sqInt offset;
-    sqInt *sendTable;
-    sqInt table;
-    CogMethod *targetMethod;
+    sqInt sendTable;
+    sqInt *sendTable1;
+    sqInt targetMethod;
+    CogMethod *targetMethod1;
     sqInt unlinkedRoutine;
 
 	if ((annotation == IsSendCall)
@@ -20847,31 +20694,28 @@
 
 			/* It's a linked send. */
 
-			/* begin offsetAndSendTableFor:annotation:into: */
+			/* begin targetMethodAndSendTableFor:annotation:into: */
 			if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
 				assert(annotation == IsSendCall);
-				offset = cmEntryOffset;
-				sendTable = sendTrampolines;
-
+				targetMethod1 = ((CogMethod *) (entryPoint - cmEntryOffset));
+				sendTable1 = sendTrampolines;
 			}
 			else {
 				if ((entryPoint & entryPointMask) == dynSuperEntryAlignment) {
 					assert(annotation == IsNSSendCall);
-					offset = cmDynSuperEntryOffset;
-					sendTable = dynamicSuperSendTrampolines;
-
+					targetMethod1 = ((CogMethod *) (entryPoint - cmDynSuperEntryOffset));
+					sendTable1 = dynamicSuperSendTrampolines;
 				}
 				else {
 					assert(annotation == IsSendCall);
-					offset = cmNoCheckEntryOffset;
-					sendTable = superSendTrampolines;
-
+					targetMethod1 = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset));
+					sendTable1 = superSendTrampolines;
 				}
 			}
 
-			targetMethod = ((CogMethod *) (entryPoint - offset));
-			unlinkedRoutine = sendTable[((((targetMethod->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod->cmNumArgs)) : (NumSendTrampolines - 1))];
-			rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod->selector), unlinkedRoutine);
+			unlinkedRoutine = sendTable1[((((targetMethod1->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod1->cmNumArgs)) : (NumSendTrampolines - 1))];
+			rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod1->selector), unlinkedRoutine);
+
 		}
 		else {
 			if (entryPoint == ceImplicitReceiverTrampoline) {
@@ -20888,11 +20732,10 @@
 unlinkIfLinkedSendpcto(sqInt annotation, char *mcpc, sqInt theCogMethod)
 {
     sqInt entryPoint;
-    sqInt off;
-    sqInt offset;
-    sqInt *sendTable;
-    sqInt table;
-    CogMethod *targetMethod;
+    sqInt sendTable;
+    sqInt *sendTable1;
+    sqInt targetMethod;
+    CogMethod *targetMethod1;
     sqInt unlinkedRoutine;
 
 	if ((annotation == IsSendCall)
@@ -20902,34 +20745,31 @@
 
 			/* It's a linked send. */
 
-			/* begin offsetAndSendTableFor:annotation:into: */
+			/* begin targetMethodAndSendTableFor:annotation:into: */
 			if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
 				assert(annotation == IsSendCall);
-				offset = cmEntryOffset;
-				sendTable = sendTrampolines;
-
+				targetMethod1 = ((CogMethod *) (entryPoint - cmEntryOffset));
+				sendTable1 = sendTrampolines;
 			}
 			else {
 				if ((entryPoint & entryPointMask) == dynSuperEntryAlignment) {
 					assert(annotation == IsNSSendCall);
-					offset = cmDynSuperEntryOffset;
-					sendTable = dynamicSuperSendTrampolines;
-
+					targetMethod1 = ((CogMethod *) (entryPoint - cmDynSuperEntryOffset));
+					sendTable1 = dynamicSuperSendTrampolines;
 				}
 				else {
 					assert(annotation == IsSendCall);
-					offset = cmNoCheckEntryOffset;
-					sendTable = superSendTrampolines;
-
+					targetMethod1 = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset));
+					sendTable1 = superSendTrampolines;
 				}
 			}
 
-			targetMethod = ((CogMethod *) (entryPoint - offset));
-			if ((((sqInt)targetMethod)) == theCogMethod) {
-				unlinkedRoutine = sendTable[((((targetMethod->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod->cmNumArgs)) : (NumSendTrampolines - 1))];
-				rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod->selector), unlinkedRoutine);
+			if ((((sqInt)targetMethod1)) == theCogMethod) {
+				unlinkedRoutine = sendTable1[((((targetMethod1->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod1->cmNumArgs)) : (NumSendTrampolines - 1))];
+				rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod1->selector), unlinkedRoutine);
 				codeModified = 1;
 			}
+
 		}
 		else {
 
@@ -20971,7 +20811,7 @@
 		 || (((cogMethod->selector)) == selector))) {
 			freeMethod(cogMethod);
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	if ((cogMethod >= (limitZony()))
 	 && (freeSpace == (methodBytesFreedSinceLastCompaction()))) {
@@ -20983,7 +20823,7 @@
 		if (((cogMethod->cmType)) == CMMethod) {
 			mapForperformUntilarg(cogMethod, unlinkIfFreeOrLinkedSendpcof, selector);
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	if (codeModified) {
 
@@ -21015,7 +20855,7 @@
 				assert(noTargetsFreeInClosedPIC(cogMethod));
 			}
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	if (codeModified) {
 
@@ -21058,7 +20898,7 @@
 				freedPIC = 1;
 			}
 		}
-		cogMethod = methodAfter(cogMethod);
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
 	if (freeIfTrue) {
 		freeMethod(targetMethod);

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-03-13 17:26:37 UTC (rev 2879)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-03-13 22:38:52 UTC (rev 2880)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.638 uuid: 4c01acdf-1273-4319-aef5-fd3591c3dbe9
+	CCodeGenerator VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h	2014-03-13 17:26:37 UTC (rev 2879)
+++ branches/Cog/nscogsrc/vm/cogmethod.h	2014-03-13 22:38:52 UTC (rev 2880)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.638 uuid: 4c01acdf-1273-4319-aef5-fd3591c3dbe9
+	CCodeGenerator VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
  */
 
 typedef struct {

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2014-03-13 17:26:37 UTC (rev 2879)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2014-03-13 22:38:52 UTC (rev 2880)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.638 uuid: 4c01acdf-1273-4319-aef5-fd3591c3dbe9
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
    from
-	CoInterpreter VMMaker.oscog-eem.638 uuid: 4c01acdf-1273-4319-aef5-fd3591c3dbe9
+	CoInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.638 uuid: 4c01acdf-1273-4319-aef5-fd3591c3dbe9 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -808,6 +808,7 @@
 static sqInt oopisLessThan(sqInt anOop, sqInt otherOop);
 static sqInt pageIndexFor(void *pointer);
 static sqInt pageListIsWellFormed(void);
+sqInt penultimateLiteralOf(sqInt aMethodOop);
 sqInt popRemappableOop(void);
 sqInt popStack(void);
 sqInt pop(sqInt nItems);
@@ -1149,7 +1150,7 @@
 static void rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)(void));
 static sqInt roomToPushNArgs(sqInt n);
 static void runLeakCheckerForFullGC(sqInt fullGCFlag);
-static sqInt safeObjectAfter(sqInt oop);
+static usqInt safeObjectAfter(sqInt oop);
 static sqInt safePrintStringOf(sqInt oop);
 usqInt scavengeThresholdAddress(void);
 EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext);
@@ -2036,7 +2037,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.638";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.640";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -4830,6 +4831,7 @@
 							GIV(framePointer) = localFP;
 							
 							ceEnterCogCodePopReceiverReg();
+							null;
 							goto l307;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -4847,7 +4849,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-					/* return self */
+					null;
 				l307:	/* end baseFrameReturn */;
 					goto l304;
 				}
@@ -13939,8 +13941,7 @@
 {
 	return (((aCogMethod->cmType)) == CMMethod
 		? ((CogMethod *) aCogMethod)
-		: (/* begin cmHomeMethod */
-			((CogMethod *) ((((usqInt)aCogMethod)) - ((aCogMethod->homeOffset))))));
+		: ((CogMethod *) ((((usqInt)aCogMethod)) - ((aCogMethod->homeOffset)))));
 }
 
 
@@ -14003,7 +14004,6 @@
 			/* begin mframeHomeMethod: */
 			methodField1 = longAt(lifp + FoxMethod);
 			if ((methodField1 & MFMethodFlagIsBlockFlag) != 0) {
-				/* begin cmHomeMethod */
 				cogMethod = ((CogMethod *) ((((usqInt)(((CogBlockMethod *) (methodField1 & MFMethodMask))))) - (((((CogBlockMethod *) (methodField1 & MFMethodMask)))->homeOffset))));
 				goto l1;
 			}
@@ -14032,11 +14032,9 @@
 	assert(isMachineCodeFrame(GIV(framePointer)));
 	/* begin mframeCogMethod: */
 	cogMethod = ((CogBlockMethod *) ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodMask));
-	/* begin asCogHomeMethod: */
 	homeMethod = (((cogMethod->cmType)) == CMMethod
 		? ((CogMethod *) cogMethod)
-		: (/* begin cmHomeMethod */
-			((CogMethod *) ((((usqInt)cogMethod)) - ((cogMethod->homeOffset))))));
+		: ((CogMethod *) ((((usqInt)cogMethod)) - ((cogMethod->homeOffset)))));
 	assert((methodFor(cogMethod)) == homeMethod);
 	assert((instrPtr > (((sqInt)cogMethod)))
 	 && (instrPtr < ((((sqInt)homeMethod)) + ((homeMethod->blockSize)))));
@@ -14083,7 +14081,6 @@
 			/* begin mframeHomeMethod: */
 			methodField = longAt(theFP + FoxMethod);
 			if ((methodField & MFMethodFlagIsBlockFlag) != 0) {
-				/* begin cmHomeMethod */
 				theMethod = ((CogMethod *) ((((usqInt)(((CogBlockMethod *) (methodField & MFMethodMask))))) - (((((CogBlockMethod *) (methodField & MFMethodMask)))->homeOffset))));
 				goto l1;
 			}
@@ -14228,11 +14225,9 @@
 		assert(isMachineCodeFrame(GIV(framePointer)));
 		/* begin mframeCogMethod: */
 		cogMethod1 = ((CogBlockMethod *) ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodMask));
-		/* begin asCogHomeMethod: */
 		homeMethod = (((cogMethod1->cmType)) == CMMethod
 			? ((CogMethod *) cogMethod1)
-			: (/* begin cmHomeMethod */
-				((CogMethod *) ((((usqInt)cogMethod1)) - ((cogMethod1->homeOffset))))));
+			: ((CogMethod *) ((((usqInt)cogMethod1)) - ((cogMethod1->homeOffset)))));
 		assert((methodFor(cogMethod1)) == homeMethod);
 		assert((pc > (((sqInt)cogMethod1)))
 		 && (pc < ((((sqInt)homeMethod)) + ((homeMethod->blockSize)))));
@@ -17734,7 +17729,6 @@
 					/* begin mframeHomeMethod: */
 					methodField = longAt(theFP + FoxMethod);
 					if ((methodField & MFMethodFlagIsBlockFlag) != 0) {
-						/* begin cmHomeMethod */
 						cogMethod = ((CogMethod *) ((((usqInt)(((CogBlockMethod *) (methodField & MFMethodMask))))) - (((((CogBlockMethod *) (methodField & MFMethodMask)))->homeOffset))));
 						goto l1;
 					}
@@ -18406,7 +18400,6 @@
 		if (((cogMethod->cmType)) == CMMethod) {
 			return ((((((sqInt)cogMethod)) - theIP) << 1) | 1);
 		}
-		/* begin cmHomeMethod */
 		homeMethod = ((CogMethod *) ((((usqInt)cogMethod)) - ((cogMethod->homeOffset))));
 		blockOffset = ((((sqInt)homeMethod)) - (((sqInt)cogMethod))) / (blockAlignment());
 		return ((((((usqInt) blockOffset << 16)) | (((((sqInt)cogMethod)) - theIP) & 0xFFFF)) << 1) | 1);
@@ -23943,17 +23936,15 @@
     sqInt header1;
     sqInt header2;
     sqInt header3;
-    sqInt header4;
     usqInt lastWord;
     sqInt newFreeChunk;
     sqInt newOop;
-    sqInt next;
+    usqInt next;
     sqInt oop;
     sqInt realHeader;
     sqInt sz;
     sqInt sz1;
     sqInt sz2;
-    sqInt sz3;
     sqInt target;
     usqInt w;
 
@@ -23964,21 +23955,7 @@
 		/* begin objectAfterWhileForwarding: */
 		header2 = longAt(oop);
 		if ((header2 & MarkBit) == 0) {
-			/* 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]);
+			next = ((sqInt) (objectAfter(oop)));
 			goto l1;
 		}
 		fwdBlock1 = (header2 & AllButMarkBitAndTypeMask) << 1;
@@ -23993,7 +23970,7 @@
 		else {
 			sz1 = realHeader & SizeMask;
 		}
-		next = (oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask]);
+		next = ((sqInt) ((oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask])));
 	l1:	/* end objectAfterWhileForwarding: */;

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list