[Vm-dev] [commit][2881] CogVM source as per VMMaker.oscog-eem.641

commits at squeakvm.org commits at squeakvm.org
Fri Mar 14 00:45:41 UTC 2014


Revision: 2881
Author:   eliot
Date:     2014-03-13 17:45:37 -0700 (Thu, 13 Mar 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.641

Spur: Revise interface between GC and machine-code for Spur's
ephemerons.  We can't mark and free in a single pass with
ephemerons because a machine-code method reachable only from
the stack could refer to something referred to from an ephemeron.
So all machine code must be marked before freeing.

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/platforms/Mac OS/vm/sqMacMemory.c
    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 22:38:52 UTC (rev 2880)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGenerator VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	StackToRegisterMappingCogit VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -571,6 +571,7 @@
 static void freeMethod(CogMethod *cogMethod);
 static void freeOlderMethodsForCompaction(void);
 static void freePICsWithFreedTargets(void);
+void freeUnmarkedMachineCode(void);
 static sqInt genActiveContextTrampoline(void);
 static sqInt genAddSmallIntegerTagsTo(sqInt aRegister);
 static sqInt genAlignCStackSavingRegistersnumArgswordAlignment(AbstractInstruction * self_in_genAlignCStackSavingRegistersnumArgswordAlignment, sqInt saveRegs, sqInt numArgs, sqInt alignment);
@@ -916,11 +917,13 @@
 static void markAndTraceLiteralIfYoung(sqInt literal);
 static void markAndTraceLiteral(sqInt literal);
 static void markAndTraceMachineCodeForNewSpaceGC(void);
+void markAndTraceMachineCodeOfMarkedMethods(void);
 static void markAndTraceObjectReferencesInGeneratedRuntime(void);
 void markAndTraceObjectsOrFreeMachineCode(sqInt inFullGC);
 static sqInt markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit);
 static void markAndTraceOrFreeMachineCodeForFullGC(void);
 static sqInt markLiteralsAndUnlinkIfUnmarkedSendpcmethod(sqInt annotation, char *mcpc, sqInt cogMethod);
+static sqInt markLiteralspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod);
 void markMethodAndReferents(CogBlockMethod *aCogMethod);
 static sqInt markYoungObjectspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod);
 static void marshallImplicitReceiverSendArguments(sqInt numArgs);
@@ -10320,6 +10323,31 @@
 }
 
 
+/*	Free machine-code methods whose compiled methods are unmarked
+	and open PICs whose selectors are not marked. */
+
+void
+freeUnmarkedMachineCode(void)
+{
+    CogMethod *cogMethod;
+
+	cogMethod = ((CogMethod *) methodZoneBase);
+	while (cogMethod < (limitZony())) {
+		if ((((cogMethod->cmType)) == CMMethod)
+		 && (!(isMarked((cogMethod->methodObject))))) {
+			freeMethod(cogMethod);
+		}
+		if ((((cogMethod->cmType)) == CMOpenPIC)
+		 && ((!(isImmediate((cogMethod->selector))))
+		 && (!(isMarked((cogMethod->selector)))))) {
+			freeMethod(cogMethod);
+		}
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
+	}
+	unlinkSendsToFree();
+}
+
+
 /*	Short-circuit the interpreter call if a frame is already married. */
 
 static sqInt
@@ -17655,6 +17683,59 @@
 }
 
 
+/*	Mark objects in machine-code of marked methods (or open PICs with marked
+	selectors). 
+ */
+
+void
+markAndTraceMachineCodeOfMarkedMethods(void)
+{
+    CogMethod *cogMethod;
+
+	if (leakCheckFullGC()) {
+		assert(allMachineCodeObjectReferencesValid());
+	}
+	codeModified = 0;
+	markAndTraceObjectReferencesInGeneratedRuntime();
+	cogMethod = ((CogMethod *) methodZoneBase);
+	while (cogMethod < (limitZony())) {
+		if ((((cogMethod->cmType)) == CMMethod)
+		 && (isMarked((cogMethod->methodObject)))) {
+			/* begin markAndTraceLiteralsIn: */
+			assert(((((cogMethod->cmType)) == CMMethod)
+ && (isMarked((cogMethod->methodObject))))
+			 || ((((cogMethod->cmType)) == CMOpenPIC)
+			 && ((isImmediate((cogMethod->selector)))
+			 || (isMarked((cogMethod->selector))))));
+			markAndTraceLiteral((cogMethod->selector));
+			mapForperformUntilarg(cogMethod, markLiteralspcmethod, ((sqInt)cogMethod));
+		}
+		if ((((cogMethod->cmType)) == CMOpenPIC)
+		 && ((isImmediate((cogMethod->selector)))
+		 || (isMarked((cogMethod->selector))))) {
+			/* begin markAndTraceLiteralsIn: */
+			assert(((((cogMethod->cmType)) == CMMethod)
+ && (isMarked((cogMethod->methodObject))))
+			 || ((((cogMethod->cmType)) == CMOpenPIC)
+			 && ((isImmediate((cogMethod->selector)))
+			 || (isMarked((cogMethod->selector))))));
+			markAndTraceLiteral((cogMethod->selector));
+			mapForperformUntilarg(cogMethod, markLiteralspcmethod, ((sqInt)cogMethod));
+		}
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
+	}
+	if (leakCheckFullGC()) {
+		assert(allMachineCodeObjectReferencesValid());
+	}
+	if (codeModified) {
+
+		/* After updating oops in inline caches we need to flush the icache. */
+
+		flushICacheFromto(processor, methodZoneBase, ((sqInt)(limitZony())));
+	}
+}
+
+
 /*	Mark and trace any object references in the generated run-time. */
 
 static void
@@ -17882,6 +17963,74 @@
 	return 0;
 }
 
+
+/*	Mark and trace literals.
+	Additionally in Newspeak, void push implicits that have unmarked classes. */
+
+static sqInt
+markLiteralspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
+{
+    sqInt cacheTag;
+    sqInt cacheTag1;
+    sqInt class;
+    sqInt classpc;
+    sqInt entryPoint;
+    sqInt entryPoint1;
+    sqInt literal;
+    sqInt mixin;
+    sqInt mixinpc;
+    sqInt tagCouldBeObj;
+    sqInt tagCouldBeObj1;
+
+	if (annotation == IsObjectReference) {
+		literal = literalBeforeFollowingAddress(backEnd, ((sqInt)mcpc));
+		markAndTraceLiteral(literal);
+	}
+	if ((annotation == IsSendCall)
+			 || (annotation == IsNSSendCall)) {
+		/* 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) {
+			markAndTraceLiteral(cacheTag1);
+		}
+		if (entryPoint1 == ceImplicitReceiverTrampoline) {
+			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;
+}
+
 void
 markMethodAndReferents(CogBlockMethod *aCogMethod)
 {

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGenerator VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
 
 
@@ -34,6 +34,7 @@
 void enterCogCodePopReceiverArg0Regs(void);
 void enterCogCodePopReceiverArg1Arg0Regs(void);
 CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod);
+void freeUnmarkedMachineCode(void);
 sqInt genQuickReturnConst(void);
 sqInt genQuickReturnInstVar(void);
 sqInt genQuickReturnSelf(void);
@@ -43,6 +44,7 @@
 sqInt isSendReturnPC(sqInt retpc);
 void linkSendAtintooffsetreceiver(sqInt callSiteReturnAddress, CogMethod *sendingMethod, CogMethod *targetMethod, sqInt theEntryOffset, sqInt receiver);
 void mapObjectReferencesInMachineCode(sqInt gcMode);
+void markAndTraceMachineCodeOfMarkedMethods(void);
 void markAndTraceObjectsOrFreeMachineCode(sqInt inFullGC);
 void markMethodAndReferents(CogBlockMethod *aCogMethod);
 usqInt maxCogMethodAddress(void);

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nscogsrc/vm/cogmethod.h	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGenerator VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
 
 typedef struct {

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
    from
-	CoInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CoInterpreter VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1150,7 +1150,7 @@
 static void rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)(void));
 static sqInt roomToPushNArgs(sqInt n);
 static void runLeakCheckerForFullGC(sqInt fullGCFlag);
-static usqInt safeObjectAfter(sqInt oop);
+static sqInt safeObjectAfter(sqInt oop);
 static sqInt safePrintStringOf(sqInt oop);
 usqInt scavengeThresholdAddress(void);
 EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext);
@@ -2037,7 +2037,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.640";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.641";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -4831,7 +4831,6 @@
 							GIV(framePointer) = localFP;
 							
 							ceEnterCogCodePopReceiverReg();
-							null;
 							goto l307;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -4849,7 +4848,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-					null;
+					/* return self */
 				l307:	/* end baseFrameReturn */;
 					goto l304;
 				}
@@ -23936,15 +23935,17 @@
     sqInt header1;
     sqInt header2;
     sqInt header3;
+    sqInt header4;
     usqInt lastWord;
     sqInt newFreeChunk;
     sqInt newOop;
-    usqInt next;
+    sqInt next;
     sqInt oop;
     sqInt realHeader;
     sqInt sz;
     sqInt sz1;
     sqInt sz2;
+    sqInt sz3;
     sqInt target;
     usqInt w;
 
@@ -23955,7 +23956,21 @@
 		/* begin objectAfterWhileForwarding: */
 		header2 = longAt(oop);
 		if ((header2 & MarkBit) == 0) {
-			next = ((sqInt) (objectAfter(oop)));
+			/* begin objectAfter: */
+			if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
+				error("no objects after the end of memory");
+			}
+			if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
+				sz2 = (longAt(oop)) & AllButTypeMask;
+			}
+			else {
+				/* begin sizeBitsOf: */
+				header3 = longAt(oop);
+				sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
+					? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
+					: header3 & SizeMask);
+			}
+			next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
 			goto l1;
 		}
 		fwdBlock1 = (header2 & AllButMarkBitAndTypeMask) << 1;
@@ -23970,7 +23985,7 @@
 		else {
 			sz1 = realHeader & SizeMask;
 		}
-		next = ((sqInt) ((oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask])));
+		next = (oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask]);
 	l1:	/* end objectAfterWhileForwarding: */;
 		if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
 
@@ -24024,18 +24039,18 @@
 	}
 	/* begin safeObjectAfter: */
 	if (((longAt(newFreeChunk)) & TypeMask) == HeaderTypeFree) {
-		sz2 = (longAt(newFreeChunk)) & AllButTypeMask;
+		sz3 = (longAt(newFreeChunk)) & AllButTypeMask;
 	}
 	else {
 		/* begin sizeBitsOf: */
-		header3 = longAt(newFreeChunk);
-		sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
+		header4 = longAt(newFreeChunk);
+		sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
 			? (longAt(newFreeChunk - (BytesPerWord * 2))) & LongSizeMask
-			: header3 & SizeMask);
+			: header4 & SizeMask);
 	}
-	next = ((newFreeChunk + sz2) >= GIV(freeStart)
+	next = ((newFreeChunk + sz3) >= GIV(freeStart)
 		? GIV(freeStart)
-		: (newFreeChunk + sz2) + (headerTypeBytes[(longAt(newFreeChunk + sz2)) & TypeMask]));
+		: (newFreeChunk + sz3) + (headerTypeBytes[(longAt(newFreeChunk + sz3)) & TypeMask]));
 	assert((next == GIV(freeStart))
 	 || (next == (oopFromChunk(GIV(compEnd)))));
 	if (next == GIV(freeStart)) {
@@ -50437,7 +50452,7 @@
 	given object or free chunk in memory. Return freeStart when
 	enumeration is complete. This is for assertion checking only. */
 
-static usqInt
+static sqInt
 safeObjectAfter(sqInt oop)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt header;

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
 
 

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-03-14 00:45:37 UTC (rev 2881)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
    from
-	CoInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CoInterpreter VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1153,7 +1153,7 @@
 static void rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)(void));
 static sqInt roomToPushNArgs(sqInt n);
 static void runLeakCheckerForFullGC(sqInt fullGCFlag);
-static usqInt safeObjectAfter(sqInt oop);
+static sqInt safeObjectAfter(sqInt oop);
 static sqInt safePrintStringOf(sqInt oop);
 usqInt scavengeThresholdAddress(void);
 EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext);
@@ -2040,7 +2040,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.640";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.641";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -4840,7 +4840,6 @@
 							GIV(framePointer) = localFP;
 							
 							ceEnterCogCodePopReceiverReg();
-							null;
 							goto l307;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -4858,7 +4857,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-					null;
+					/* return self */
 				l307:	/* end baseFrameReturn */;
 					goto l304;
 				}
@@ -23945,15 +23944,17 @@
     sqInt header1;
     sqInt header2;
     sqInt header3;
+    sqInt header4;
     usqInt lastWord;
     sqInt newFreeChunk;
     sqInt newOop;
-    usqInt next;
+    sqInt next;
     sqInt oop;
     sqInt realHeader;
     sqInt sz;
     sqInt sz1;
     sqInt sz2;
+    sqInt sz3;
     sqInt target;
     usqInt w;
 
@@ -23964,7 +23965,21 @@
 		/* begin objectAfterWhileForwarding: */
 		header2 = longAt(oop);
 		if ((header2 & MarkBit) == 0) {
-			next = ((sqInt) (objectAfter(oop)));
+			/* begin objectAfter: */
+			if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) {
+				error("no objects after the end of memory");
+			}
+			if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
+				sz2 = (longAt(oop)) & AllButTypeMask;
+			}
+			else {
+				/* begin sizeBitsOf: */
+				header3 = longAt(oop);
+				sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
+					? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask
+					: header3 & SizeMask);
+			}
+			next = (oop + sz2) + (headerTypeBytes[(longAt(oop + sz2)) & TypeMask]);
 			goto l1;
 		}
 		fwdBlock1 = (header2 & AllButMarkBitAndTypeMask) << 1;
@@ -23979,7 +23994,7 @@
 		else {
 			sz1 = realHeader & SizeMask;
 		}
-		next = ((sqInt) ((oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask])));
+		next = (oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask]);
 	l1:	/* end objectAfterWhileForwarding: */;
 		if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
 
@@ -24033,18 +24048,18 @@
 	}
 	/* begin safeObjectAfter: */
 	if (((longAt(newFreeChunk)) & TypeMask) == HeaderTypeFree) {
-		sz2 = (longAt(newFreeChunk)) & AllButTypeMask;
+		sz3 = (longAt(newFreeChunk)) & AllButTypeMask;
 	}
 	else {
 		/* begin sizeBitsOf: */
-		header3 = longAt(newFreeChunk);
-		sz2 = ((header3 & TypeMask) == HeaderTypeSizeAndClass
+		header4 = longAt(newFreeChunk);
+		sz3 = ((header4 & TypeMask) == HeaderTypeSizeAndClass
 			? (longAt(newFreeChunk - (BytesPerWord * 2))) & LongSizeMask
-			: header3 & SizeMask);
+			: header4 & SizeMask);
 	}
-	next = ((newFreeChunk + sz2) >= GIV(freeStart)
+	next = ((newFreeChunk + sz3) >= GIV(freeStart)
 		? GIV(freeStart)
-		: (newFreeChunk + sz2) + (headerTypeBytes[(longAt(newFreeChunk + sz2)) & TypeMask]));
+		: (newFreeChunk + sz3) + (headerTypeBytes[(longAt(newFreeChunk + sz3)) & TypeMask]));
 	assert((next == GIV(freeStart))
 	 || (next == (oopFromChunk(GIV(compEnd)))));
 	if (next == GIV(freeStart)) {
@@ -50446,7 +50461,7 @@
 	given object or free chunk in memory. Return freeStart when
 	enumeration is complete. This is for assertion checking only. */
 
-static usqInt
+static sqInt
 safeObjectAfter(sqInt oop)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt header;

Modified: branches/Cog/nscogsrc/vm/interp.h
===================================================================
--- branches/Cog/nscogsrc/vm/interp.h	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nscogsrc/vm/interp.h	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/nscogsrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nscogsrc/vm/vmCallback.h	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nscogsrc/vm/vmCallback.h	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
 
 #define VM_CALLBACK_INC 1

Modified: branches/Cog/nsspursrc/vm/cogit.c
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.c	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nsspursrc/vm/cogit.c	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGenerator VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	StackToRegisterMappingCogit VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -402,7 +402,6 @@
 static sqInt checkValidObjectReferencesInClosedPIC(CogMethod *cPIC);
 static sqInt checkValidObjectReference(sqInt anOop);
 static void clearCogCompiledCode(void);
-static sqInt closedPICRefersToUnmarkedObject(CogMethod *cPIC);
 static CogMethod * cmHomeMethod(CogBlockMethod * self_in_cmHomeMethod);
 char * codeEntryFor(char *address);
 char * codeEntryNameFor(char *address);
@@ -563,6 +562,7 @@
 static void freeMethod(CogMethod *cogMethod);
 static void freeOlderMethodsForCompaction(void);
 static void freePICsWithFreedTargets(void);
+void freeUnmarkedMachineCode(void);
 static sqInt genActiveContextTrampoline(void);
 static sqInt genAddSmallIntegerTagsTo(sqInt aRegister);
 static sqInt genAlignCStackSavingRegistersnumArgswordAlignment(AbstractInstruction * self_in_genAlignCStackSavingRegistersnumArgswordAlignment, sqInt saveRegs, sqInt numArgs, sqInt alignment);
@@ -915,16 +915,11 @@
 static void mapObjectReferencesInMachineCodeForFullGC(void);
 static void mapObjectReferencesInMachineCodeForYoungGC(void);
 void mapObjectReferencesInMachineCode(sqInt gcMode);
-static void markAndTraceLiteralIfYoung(sqInt literal);
 static void markAndTraceLiteral(sqInt literal);
-static void markAndTraceMachineCodeForNewSpaceGC(void);
+void markAndTraceMachineCodeOfMarkedMethods(void);
 static void markAndTraceObjectReferencesInGeneratedRuntime(void);
-void markAndTraceObjectsOrFreeMachineCode(sqInt inFullGC);
-static sqInt markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit);
-static void markAndTraceOrFreeMachineCodeForFullGC(void);
-static sqInt markLiteralsAndUnlinkIfUnmarkedSendpcmethod(sqInt annotation, char *mcpc, sqInt cogMethod);
+static sqInt markLiteralspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod);
 void markMethodAndReferents(CogBlockMethod *aCogMethod);
-static sqInt markYoungObjectspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod);
 static void marshallImplicitReceiverSendArguments(sqInt numArgs);
 static void marshallSendArguments(sqInt numArgs);
 usqInt maxCogMethodAddress(void);
@@ -3280,61 +3275,6 @@
 	manageFromto(baseAddress, limitAddress);
 }
 
-
-/*	Answer if the ClosedPIC refers to any unmarked objects or freed/freeable
-	target methods,
-	applying markAndTraceOrFreeCogMethod:firstVisit: to those targets to
-	determine if freed/freeable.
- */
-
-static sqInt
-closedPICRefersToUnmarkedObject(CogMethod *cPIC)
-{
-    sqInt entryPoint;
-    sqInt i;
-    sqInt object;
-    sqInt offsetToLiteral;
-    sqInt pc;
-    CogMethod *targetMethod;
-
-	if (!(isMarked((cPIC->selector)))) {
-		return 1;
-	}
-
-	/* First jump is unconditional; subsequent ones are conditional */
-
-	pc = (((sqInt)cPIC)) + firstCPICCaseOffset;
-	offsetToLiteral = jumpLongByteSize(backEnd);
-	for (i = 1; i <= ((cPIC->cPICNumCases)); i += 1) {
-		object = literalBeforeFollowingAddress(backEnd, (pc - offsetToLiteral) - (loadLiteralByteSize(backEnd)));
-		if ((couldBeObject(object))
-		 && (!(isMarked(object)))) {
-			return 1;
-		}
-		object = literalBeforeFollowingAddress(backEnd, pc - offsetToLiteral);
-		if ((couldBeObject(object))
-		 && (!(isMarked(object)))) {
-			return 1;
-		}
-
-		/* Find target from jump.  Ignore jumps to the interpret and MNU calls within this PIC */
-
-		entryPoint = jumpLongTargetBeforeFollowingAddress(backEnd, pc);
-		if (((((usqInt)entryPoint)) < (((usqInt)cPIC)))
-		 || ((((usqInt)entryPoint)) > (((usqInt)((((usqInt)cPIC)) + ((cPIC->blockSize))))))) {
-			targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset));
-			assert((((targetMethod->cmType)) == CMMethod)
-			 || (((targetMethod->cmType)) == CMFree));
-			if (markAndTraceOrFreeCogMethodfirstVisit(targetMethod, (((usqInt)targetMethod)) > (((usqInt)pc)))) {
-				return 1;
-			}
-		}
-		offsetToLiteral = jumpLongConditionalByteSize(backEnd);
-		pc += cPICCaseSize;
-	}
-	return 0;
-}
-
 static CogMethod *
 cmHomeMethod(CogBlockMethod * self_in_cmHomeMethod)
 {
@@ -10404,6 +10344,31 @@
 }
 
 
+/*	Free machine-code methods whose compiled methods are unmarked
+	and open PICs whose selectors are not marked. */
+
+void
+freeUnmarkedMachineCode(void)
+{
+    CogMethod *cogMethod;
+
+	cogMethod = ((CogMethod *) methodZoneBase);
+	while (cogMethod < (limitZony())) {
+		if ((((cogMethod->cmType)) == CMMethod)
+		 && (!(isMarked((cogMethod->methodObject))))) {
+			freeMethod(cogMethod);
+		}
+		if ((((cogMethod->cmType)) == CMOpenPIC)
+		 && ((!(isImmediate((cogMethod->selector))))
+		 && (!(isMarked((cogMethod->selector)))))) {
+			freeMethod(cogMethod);
+		}
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
+	}
+	unlinkSendsToFree();
+}
+
+
 /*	Short-circuit the interpreter call if a frame is already married. */
 
 static sqInt
@@ -18608,16 +18573,6 @@
 }
 
 static void
-markAndTraceLiteralIfYoung(sqInt literal)
-{
-	if ((couldBeObject(literal))
-	 && (isYoungObject(literal))) {
-		assert(addressCouldBeObj(literal));
-		markAndTrace(literal);
-	}
-}
-
-static void
 markAndTraceLiteral(sqInt literal)
 {
 	if (couldBeObject(literal)) {
@@ -18627,50 +18582,48 @@
 }
 
 
-/*	Free any methods that refer to unmarked objects, unlinking sends to freed
-	methods. 
+/*	Mark objects in machine-code of marked methods (or open PICs with marked
+	selectors). 
  */
 
-static void
-markAndTraceMachineCodeForNewSpaceGC(void)
+void
+markAndTraceMachineCodeOfMarkedMethods(void)
 {
     CogMethod *cogMethod;
-    usqInt pointer;
 
-	if (leakCheckNewSpaceGC()) {
+	if (leakCheckFullGC()) {
 		assert(allMachineCodeObjectReferencesValid());
 	}
 	codeModified = 0;
-	pointer = youngReferrers();
-	while (pointer < limitAddress) {
-		cogMethod = ((CogMethod *) (longAt(pointer)));
-		if ((cogMethod->cmRefersToYoung)) {
-			assert((cogMethodDoesntLookKosher(cogMethod)) == 0);
-			assert((((cogMethod->cmType)) == CMMethod)
-			 || (((cogMethod->cmType)) == CMOpenPIC));
-			if (isYoung((cogMethod->selector))) {
-				markAndTrace((cogMethod->selector));
-			}
-			if (((cogMethod->cmType)) == CMMethod) {
-				if (isYoung((cogMethod->methodObject))) {
-					markAndTrace((cogMethod->methodObject));
-				}
-				/* begin markYoungObjectsIn: */
-				assert((((cogMethod->cmType)) == CMMethod)
-				 || (((cogMethod->cmType)) == CMOpenPIC));
-				if (isYoung((cogMethod->selector))) {
-					markAndTrace((cogMethod->selector));
-				}
-				if ((((cogMethod->cmType)) == CMMethod)
-				 && (isYoung((cogMethod->methodObject)))) {
-					markAndTrace((cogMethod->methodObject));
-				}
-				mapForperformUntilarg(cogMethod, markYoungObjectspcmethod, ((sqInt)cogMethod));
-			}
+	markAndTraceObjectReferencesInGeneratedRuntime();
+	cogMethod = ((CogMethod *) methodZoneBase);
+	while (cogMethod < (limitZony())) {
+		if ((((cogMethod->cmType)) == CMMethod)
+		 && (isMarked((cogMethod->methodObject)))) {
+			/* begin markAndTraceLiteralsIn: */
+			assert(((((cogMethod->cmType)) == CMMethod)
+ && (isMarked((cogMethod->methodObject))))
+			 || ((((cogMethod->cmType)) == CMOpenPIC)
+			 && ((isImmediate((cogMethod->selector)))
+			 || (isMarked((cogMethod->selector))))));
+			markAndTraceLiteral((cogMethod->selector));
+			mapForperformUntilarg(cogMethod, markLiteralspcmethod, ((sqInt)cogMethod));
 		}
-		pointer += BytesPerWord;
+		if ((((cogMethod->cmType)) == CMOpenPIC)
+		 && ((isImmediate((cogMethod->selector)))
+		 || (isMarked((cogMethod->selector))))) {
+			/* begin markAndTraceLiteralsIn: */
+			assert(((((cogMethod->cmType)) == CMMethod)
+ && (isMarked((cogMethod->methodObject))))
+			 || ((((cogMethod->cmType)) == CMOpenPIC)
+			 && ((isImmediate((cogMethod->selector)))
+			 || (isMarked((cogMethod->selector))))));
+			markAndTraceLiteral((cogMethod->selector));
+			mapForperformUntilarg(cogMethod, markLiteralspcmethod, ((sqInt)cogMethod));
+		}
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
-	if (leakCheckIncrementalGC()) {
+	if (leakCheckFullGC()) {
 		assert(allMachineCodeObjectReferencesValid());
 	}
 	if (codeModified) {
@@ -18698,114 +18651,15 @@
 	}
 }
 
-void
-markAndTraceObjectsOrFreeMachineCode(sqInt inFullGC)
-{
-	if (inFullGC) {
-		markAndTraceOrFreeMachineCodeForFullGC();
-	}
-	else {
-		markAndTraceMachineCodeForNewSpaceGC();
-	}
-}
 
+/*	Mark and trace literals.
+	Additionally in Newspeak, void push implicits that have unmarked classes. */
 
-/*	Mark and trace objects in the argument and free if it is appropriate.
-	Answer if the method has been freed. firstVisit is a hint used to avoid
-	scanning methods we've already seen. False positives are fine.
-	For a CMMethod this
-	frees if the bytecode method isnt marked,
-	marks and traces object literals and selectors,
-	unlinks sends to targets that should be freed.
-	For a CMClosedPIC this
-	frees if it refers to anything that should be freed or isn't marked.
-	For a CMOpenPIC this
-	frees if the selector isn't marked. */
-/*	this recurses at most one level down */
-
 static sqInt
-markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit)
+markLiteralspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
 {
-	if (((cogMethod->cmType)) == CMFree) {
-		return 1;
-	}
-	assert((cogMethodDoesntLookKosher(cogMethod)) == 0);
-	if (((cogMethod->cmType)) == CMMethod) {
-		if (!(isMarked((cogMethod->methodObject)))) {
-			freeMethod(cogMethod);
-			return 1;
-		}
-		if (firstVisit) {
-			/* begin markLiteralsAndUnlinkUnmarkedSendsIn: */
-			assert(((cogMethod->cmType)) == CMMethod);
-			assert(isMarked((cogMethod->methodObject)));
-			markAndTraceLiteral((cogMethod->selector));
-			mapForperformUntilarg(cogMethod, markLiteralsAndUnlinkIfUnmarkedSendpcmethod, ((sqInt)cogMethod));
-		}
-		return 0;
-	}
-	if (((cogMethod->cmType)) == CMClosedPIC) {
-		if (!(closedPICRefersToUnmarkedObject(cogMethod))) {
-			return 0;
-		}
-		freeMethod(cogMethod);
-		return 1;
-	}
-	if (((cogMethod->cmType)) == CMOpenPIC) {
-		if (isMarked((cogMethod->selector))) {
-			return 0;
-		}
-		freeMethod(cogMethod);
-		return 1;
-	}
-	assert((((cogMethod->cmType)) == CMMethod)
-	 || ((((cogMethod->cmType)) == CMClosedPIC)
-	 || (((cogMethod->cmType)) == CMOpenPIC)));
-	return 0;
-}
-
-
-/*	Free any methods that refer to unmarked objects, unlinking sends to freed
-	methods. 
- */
-
-static void
-markAndTraceOrFreeMachineCodeForFullGC(void)
-{
-    CogMethod *cogMethod;
-
-	if (leakCheckFullGC()) {
-		assert(allMachineCodeObjectReferencesValid());
-	}
-	codeModified = 0;
-	markAndTraceObjectReferencesInGeneratedRuntime();
-	cogMethod = ((CogMethod *) methodZoneBase);
-	while (cogMethod < (limitZony())) {
-		markAndTraceOrFreeCogMethodfirstVisit(cogMethod, 1);
-		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
-	}
-	if (leakCheckFullGC()) {
-		assert(allMachineCodeObjectReferencesValid());
-	}
-	if (codeModified) {
-
-		/* After updating oops in inline caches we need to flush the icache. */
-
-		flushICacheFromto(processor, methodZoneBase, ((sqInt)(limitZony())));
-	}
-}
-
-
-/*	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 cacheTag1;
-    sqInt cacheTagMarked;
     sqInt class;
     sqInt classpc;
     sqInt entryPoint;
@@ -18813,13 +18667,8 @@
     sqInt literal;
     sqInt mixin;
     sqInt mixinpc;
-    sqInt sendTable;
-    sqInt *sendTable1;
     sqInt tagCouldBeObj;
     sqInt tagCouldBeObj1;
-    sqInt targetMethod;
-    CogMethod *targetMethod1;
-    sqInt unlinkedRoutine;
 
 	if (annotation == IsObjectReference) {
 		literal = literalBeforeFollowingAddress(backEnd, ((sqInt)mcpc));
@@ -18840,65 +18689,26 @@
 		tagCouldBeObj1 = (inlineCacheTagsMayBeObjects())
 		 || ((entryPoint1 < methodZoneBase)
 		 || ((entryPoint1 & entryPointMask) == cmNoCheckEntryOffset));
-		cacheTagMarked = tagCouldBeObj1
-		 && (cacheTagIsMarked(cacheTag1));
-		if (entryPoint1 > methodZoneBase) {
+		if (tagCouldBeObj1) {
+			markAndTraceLiteral(cacheTag1);
+		}
+		if (entryPoint1 == ceImplicitReceiverTrampoline) {
+			classpc = (((sqInt)mcpc)) + (jumpShortByteSize(backEnd));
+			mixinpc = ((((sqInt)mcpc)) + (jumpShortByteSize(backEnd))) + BytesPerOop;
+			class = unalignedLongAt(backEnd, classpc);
+			if (class != 0) {
+				assert(addressCouldBeObj(class));
+				if (((mixin = unalignedLongAt(backEnd, mixinpc))) != 0) {
+					markAndTraceLiteral(mixin);
+				}
 
-			/* It's a linked send. */
-
-			/* begin targetMethodAndSendTableFor:annotation:into: */
-			if ((entryPoint1 & entryPointMask) == checkedEntryAlignment) {
-				assert(annotation == IsSendCall);
-				targetMethod1 = ((CogMethod *) (entryPoint1 - cmEntryOffset));
-				sendTable1 = sendTrampolines;
 			}
 			else {
-				if ((entryPoint1 & entryPointMask) == dynSuperEntryAlignment) {
-					assert(annotation == IsNSSendCall);
-					targetMethod1 = ((CogMethod *) (entryPoint1 - cmDynSuperEntryOffset));
-					sendTable1 = dynamicSuperSendTrampolines;
-				}
-				else {
-					assert(annotation == IsSendCall);
-					targetMethod1 = ((CogMethod *) (entryPoint1 - cmNoCheckEntryOffset));
-					sendTable1 = superSendTrampolines;
-				}
+				assert((unalignedLongAt(backEnd, mixinpc)) == 0);
 			}
-
-			if ((!cacheTagMarked)
-			 || (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. */
-
-				unlinkedRoutine = sendTable1[((((targetMethod1->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod1->cmNumArgs)) : (NumSendTrampolines - 1))];
-				rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod1->selector), unlinkedRoutine);
-				codeModified = 1;
-				markAndTraceLiteral((targetMethod1->selector));
-			}
-
 		}
-		else {
-			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 (((mixin = unalignedLongAt(backEnd, mixinpc))) != 0) {
-						markAndTraceLiteral(mixin);
-					}
 
-				}
-				else {
-					assert((unalignedLongAt(backEnd, mixinpc)) == 0);
-				}
-			}
 
-		}
-
 	}
 	return 0;
 }
@@ -18918,57 +18728,6 @@
 }
 
 
-/*	Mark and trace young literals. */
-
-static sqInt
-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));
-		markAndTraceLiteralIfYoung(literal);
-	}
-	if ((annotation == IsSendCall)
-			 || (annotation == IsNSSendCall)) {
-		/* 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;
-}
-
-
 /*	Spill everything on the simulated stack that needs spilling (that below
 	arguments). Marshall arguments to stack and/or registers depending on arg
 	count. If the args don't fit in registers push receiver and args (spill

Modified: branches/Cog/nsspursrc/vm/cogit.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.h	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nsspursrc/vm/cogit.h	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGenerator VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
 
 
@@ -35,6 +35,7 @@
 CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod);
 void followForwardedLiteralsIn(CogMethod *cogMethod);
 void followForwardedMethods(void);
+void freeUnmarkedMachineCode(void);
 sqInt genQuickReturnConst(void);
 sqInt genQuickReturnInstVar(void);
 sqInt genQuickReturnSelf(void);
@@ -44,7 +45,7 @@
 sqInt isSendReturnPC(sqInt retpc);
 void linkSendAtintooffsetreceiver(sqInt callSiteReturnAddress, CogMethod *sendingMethod, CogMethod *targetMethod, sqInt theEntryOffset, sqInt receiver);
 void mapObjectReferencesInMachineCode(sqInt gcMode);
-void markAndTraceObjectsOrFreeMachineCode(sqInt inFullGC);
+void markAndTraceMachineCodeOfMarkedMethods(void);
 void markMethodAndReferents(CogBlockMethod *aCogMethod);
 usqInt maxCogMethodAddress(void);
 sqInt mcPCForstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *cogMethod);

Modified: branches/Cog/nsspursrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogmethod.h	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nsspursrc/vm/cogmethod.h	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGenerator VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
 
 typedef struct {

Modified: branches/Cog/nsspursrc/vm/cointerp.c
===================================================================
--- branches/Cog/nsspursrc/vm/cointerp.c	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nsspursrc/vm/cointerp.c	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
    from
-	CoInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CoInterpreter VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -2196,7 +2196,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 usqInt heapBase;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.640";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.641";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -6551,7 +6551,6 @@
 						/* begin internalPush: */
 						longAtPointerput((localSP -= BytesPerOop), longAt((rcvr1 + (BaseHeaderSize)) + (byte3 << 2)));
 					}
-					null;
 					goto l5;
 				}
 				if (opType == 3) {
@@ -6561,7 +6560,6 @@
 					assert(GIV(method) == (iframeMethod(localFP)));
 					object = longAt((GIV(method) + (BaseHeaderSize)) + ((byte3 + LiteralStart) << 2));
 					longAtPointerput((localSP -= BytesPerOop), object);
-					null;
 					goto l5;
 				}
 				if (opType == 4) {
@@ -6589,7 +6587,6 @@
 					/* begin internalPush: */
 					longAtPointerput((localSP -= BytesPerOop), longAt((litVar1 + (BaseHeaderSize)) + (ValueIndex << 2)));
 
-					null;
 					goto l5;
 				}
 				top = longAtPointer(localSP);
@@ -36190,8 +36187,6 @@
 			markAndTrace(oop1);
 		}
 	}
-	/* begin markAndTraceOrFreeMachineCode: */
-	markAndTraceObjectsOrFreeMachineCode(1);
 	assert(validObjStacks());
 	markWeaklingsAndMarkAndFireEphemerons();
 	assert(validObjStacks());
@@ -36289,6 +36284,7 @@
 	numTracedWeaklings = 0;
 	while(1) {
 		markAndTraceUntracedReachableStackPages();
+		markAndTraceMachineCodeOfMarkedMethods();
 		/* begin objStack:from:do: */
 		assert(isValidObjStack(GIV(weaklingStack)));
 		size = longAt((GIV(weaklingStack) + (BaseHeaderSize)) + (ObjStackTopx << 2));
@@ -36322,7 +36318,9 @@
 		numTracedWeaklings = size;
 		if (((GIV(unscannedEphemerons).top)) == ((GIV(unscannedEphemerons).start))) {
 			markAndTraceUntracedReachableStackPages();
+			markAndTraceMachineCodeOfMarkedMethods();
 			freeUntracedStackPages();
+			freeUnmarkedMachineCode();
 			return;
 		}
 		if (!(markInactiveEphemerons())) {

Modified: branches/Cog/nsspursrc/vm/cointerp.h
===================================================================
--- branches/Cog/nsspursrc/vm/cointerp.h	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nsspursrc/vm/cointerp.h	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
 
 

Modified: branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nsspursrc/vm/gcc3x-cointerp.c	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nsspursrc/vm/gcc3x-cointerp.c	2014-03-14 00:45:37 UTC (rev 2881)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
    from
-	CoInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CoInterpreter VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -2199,7 +2199,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 usqInt heapBase;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.640";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.641";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -6560,7 +6560,6 @@
 						/* begin internalPush: */
 						longAtPointerput((localSP -= BytesPerOop), longAt((rcvr1 + (BaseHeaderSize)) + (byte3 << 2)));
 					}
-					null;
 					goto l5;
 				}
 				if (opType == 3) {
@@ -6570,7 +6569,6 @@
 					assert(GIV(method) == (iframeMethod(localFP)));
 					object = longAt((GIV(method) + (BaseHeaderSize)) + ((byte3 + LiteralStart) << 2));
 					longAtPointerput((localSP -= BytesPerOop), object);
-					null;
 					goto l5;
 				}
 				if (opType == 4) {
@@ -6598,7 +6596,6 @@
 					/* begin internalPush: */
 					longAtPointerput((localSP -= BytesPerOop), longAt((litVar1 + (BaseHeaderSize)) + (ValueIndex << 2)));
 
-					null;
 					goto l5;
 				}
 				top = longAtPointer(localSP);
@@ -36199,8 +36196,6 @@
 			markAndTrace(oop1);
 		}
 	}
-	/* begin markAndTraceOrFreeMachineCode: */
-	markAndTraceObjectsOrFreeMachineCode(1);
 	assert(validObjStacks());
 	markWeaklingsAndMarkAndFireEphemerons();
 	assert(validObjStacks());
@@ -36298,6 +36293,7 @@
 	numTracedWeaklings = 0;
 	while(1) {
 		markAndTraceUntracedReachableStackPages();
+		markAndTraceMachineCodeOfMarkedMethods();
 		/* begin objStack:from:do: */
 		assert(isValidObjStack(GIV(weaklingStack)));
 		size = longAt((GIV(weaklingStack) + (BaseHeaderSize)) + (ObjStackTopx << 2));
@@ -36331,7 +36327,9 @@
 		numTracedWeaklings = size;
 		if (((GIV(unscannedEphemerons).top)) == ((GIV(unscannedEphemerons).start))) {
 			markAndTraceUntracedReachableStackPages();
+			markAndTraceMachineCodeOfMarkedMethods();
 			freeUntracedStackPages();
+			freeUnmarkedMachineCode();
 			return;
 		}
 		if (!(markInactiveEphemerons())) {

Modified: branches/Cog/nsspursrc/vm/interp.h
===================================================================
--- branches/Cog/nsspursrc/vm/interp.h	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nsspursrc/vm/interp.h	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/nsspursrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nsspursrc/vm/vmCallback.h	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nsspursrc/vm/vmCallback.h	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
 
 #define VM_CALLBACK_INC 1

Modified: branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c
===================================================================
--- branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c	2014-03-14 00:45:37 UTC (rev 2881)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
    from
-	StackInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	StackInterpreter VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
-static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539 " __DATE__ ;
+static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1986,7 +1986,7 @@
  0 };
 char * breakSelector;
 sqInt breakSelectorLength = -1;
-const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreter_VMMaker.oscog-eem.640";
+const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreter_VMMaker.oscog-eem.641";
 volatile int sendTrace;
 sqInt suppressHeartbeatFlag;
 
@@ -31252,7 +31252,6 @@
 			markAndTrace(oop1);
 		}
 	}
-	/* begin markAndTraceOrFreeMachineCode: */
 	assert(validObjStacks());
 	markWeaklingsAndMarkAndFireEphemerons();
 	assert(validObjStacks());
@@ -31350,6 +31349,7 @@
 	numTracedWeaklings = 0;
 	while(1) {
 		markAndTraceUntracedReachableStackPages();
+		/* begin markAndTraceMachineCodeOfMarkedMethods */
 		/* begin objStack:from:do: */
 		assert(isValidObjStack(GIV(weaklingStack)));
 		size = longAt((GIV(weaklingStack) + (BaseHeaderSize)) + (ObjStackTopx << 2));
@@ -31383,7 +31383,9 @@
 		numTracedWeaklings = size;
 		if (((GIV(unscannedEphemerons).top)) == ((GIV(unscannedEphemerons).start))) {
 			markAndTraceUntracedReachableStackPages();
+			/* begin markAndTraceMachineCodeOfMarkedMethods */
 			freeUntracedStackPages();
+			/* begin freeUnmarkedMachineCode */
 			return;
 		}
 		if (!(markInactiveEphemerons())) {

Modified: branches/Cog/nsspurstacksrc/vm/interp.c
===================================================================
--- branches/Cog/nsspurstacksrc/vm/interp.c	2014-03-13 22:38:52 UTC (rev 2880)
+++ branches/Cog/nsspurstacksrc/vm/interp.c	2014-03-14 00:45:37 UTC (rev 2881)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
    from
-	StackInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539
+	StackInterpreter VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784
  */
-static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.640 uuid: b52d099d-350b-40ce-8ef3-0bbf96ca7539 " __DATE__ ;
+static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.641 uuid: c0305b66-db2d-45aa-8d25-267732aa1784 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -1983,7 +1983,7 @@
  0 };
 char * breakSelector;
 sqInt breakSelectorLength = -1;
-const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreter_VMMaker.oscog-eem.640";
+const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreter_VMMaker.oscog-eem.641";
 volatile int sendTrace;

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list