[Vm-dev] [commit][3057] CogVM source as per VMMaker.oscog-eem.841

commits at squeakvm.org commits at squeakvm.org
Tue Aug 5 01:55:37 UTC 2014


Revision: 3057
Author:   eliot
Date:     2014-08-04 18:55:33 -0700 (Mon, 04 Aug 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.841

Spur:
Provide unpinObject: for InterpreterProxy.

Fix initialization of the heap-resident remembered set added by
VMMaker.oscog-eem.827.  It must be created /after/ old space is initialized.

Fix two become bugs surfaced when adding/removing inst vars to/from Association,
Binding et al.  First, the class table must be scanned to ensure there are no
forwarders to classes (much cheaper than the full hierarchy walk to follow
method dictionaries etc that was done).  Second, machine code methods that gain
a new reference through become must get added to the youngReferrers.  Add a new
become effect flag, OldBecameNew that captures this and respond to it in
CoInterpreter>>postBecomeAction: by adding all methods to youngReferrers so
that on the next scavenge all will be made right.

Fix GC of machine code, which must follow forwarders when doing
markAndTraceLiteral: and again add to youngReferrers if following
gains a new ref.  Refactoring of markAndTraceLiteral: into
markAndTraceLiteral:in:at: et al required.

Fix assert in addFreeSubTree:.

General:
Support the alternate bytecode set header in all VMs to ease testing of
multiple bytecode sets.  This means methods with the sign bit set have
no primitive field and a larger num literals field, but no more.

Fix longPrintOop: (actually printOopShortInner:) for
global variable printing in face of new Environments.

Cogit:
Clean up adding to the youngReferrers by providing ensureInYoungReferrers:.
Since there always is room on youngReferrers, nuke roomOnYoungReferrersList,
canLinkToYoungClasses and caller code, simplifying ceSend:super:to:numArgs: etc.

Fix assert in followForwardedLiteralsIn:

General:
Change the scanning for initial nils scheme in the StackToRegisterMappingCogit
to answer the number of push nils in a bytecode, instead of whether the
bytecode is a push nil.  Refactor genReturnTopFromBlock into genBlockReturn.
These changes accomodate Sista.

Rationalize the length functions, deleting byteLengthOf:, fetchLong32LengthOf:
& fetchWordLengthOf: and providing numBytesOf:, num16BitUnitsOf:,
num32BitUnitsOf:, num64BitUnitsOf: and numBytesOf:.

Provide fetch/storeShort16:ofObject:[withValue:] and
fetch/storeLong64:ofObject:[withValue:].

Sista:
Fix slip in CoInterpreter>>ceCounterTripped: that would
break Spur (classForClassTag: instead of classTagForClass:).

Modified Paths:
--------------
    branches/Cog/build.win32x86/HowToBuild
    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/Cross/vm/sqVirtualMachine.c
    branches/Cog/platforms/Cross/vm/sqVirtualMachine.h
    branches/Cog/sistasrc/vm/cogit.c
    branches/Cog/sistasrc/vm/cogit.h
    branches/Cog/sistasrc/vm/cogmethod.h
    branches/Cog/sistasrc/vm/cointerp.c
    branches/Cog/sistasrc/vm/cointerp.h
    branches/Cog/sistasrc/vm/gcc3x-cointerp.c
    branches/Cog/sistasrc/vm/interp.h
    branches/Cog/sistasrc/vm/vmCallback.h
    branches/Cog/spursistasrc/vm/cogit.c
    branches/Cog/spursistasrc/vm/cogit.h
    branches/Cog/spursistasrc/vm/cogmethod.h
    branches/Cog/spursistasrc/vm/cointerp.c
    branches/Cog/spursistasrc/vm/cointerp.h
    branches/Cog/spursistasrc/vm/gcc3x-cointerp.c
    branches/Cog/spursistasrc/vm/interp.h
    branches/Cog/spursistasrc/vm/vmCallback.h
    branches/Cog/spursrc/vm/cogit.c
    branches/Cog/spursrc/vm/cogit.h
    branches/Cog/spursrc/vm/cogmethod.h
    branches/Cog/spursrc/vm/cointerp.c
    branches/Cog/spursrc/vm/cointerp.h
    branches/Cog/spursrc/vm/gcc3x-cointerp.c
    branches/Cog/spursrc/vm/interp.h
    branches/Cog/spursrc/vm/vmCallback.h
    branches/Cog/spurstacksrc/vm/gcc3x-interp.c
    branches/Cog/spurstacksrc/vm/interp.c
    branches/Cog/spurstacksrc/vm/interp.h
    branches/Cog/spurstacksrc/vm/vmCallback.h
    branches/Cog/src/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

Added Paths:
-----------
    branches/Cog/build.macos32x86/makesista
    branches/Cog/build.macos32x86/makespur

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

Added: branches/Cog/build.macos32x86/makesista
===================================================================
--- branches/Cog/build.macos32x86/makesista	                        (rev 0)
+++ branches/Cog/build.macos32x86/makesista	2014-08-05 01:55:33 UTC (rev 3057)
@@ -0,0 +1,14 @@
+#!/bin/bash
+trap 'exit 2' HUP INT PIPE TERM
+DIRS="squeak.sista.spur squeak.sista.v3"
+for d in $DIRS; do
+	if test -d "$d"; then
+		(cd $d;./mvm -A)
+	else
+		echo no $d directory found
+	fi
+done
+echo no news is good news...
+for d in $DIRS; do
+	test -d $d && grep 'BUILD FAILED' $d/LOG*
+done


Property changes on: branches/Cog/build.macos32x86/makesista
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/Cog/build.macos32x86/makespur
===================================================================
--- branches/Cog/build.macos32x86/makespur	                        (rev 0)
+++ branches/Cog/build.macos32x86/makespur	2014-08-05 01:55:33 UTC (rev 3057)
@@ -0,0 +1,14 @@
+#!/bin/bash
+trap 'exit 2' HUP INT PIPE TERM
+DIRS="newspeak.cog.spur newspeak.stack.spur squeak.cog.spur squeak.sista.spur squeak.stack.spur"
+for d in $DIRS; do
+	if test -d "$d"; then
+		(cd $d;./mvm -A)
+	else
+		echo no $d directory found
+	fi
+done
+echo no news is good news...
+for d in $DIRS; do
+	test -d $d && grep 'BUILD FAILED' $d/LOG*
+done


Property changes on: branches/Cog/build.macos32x86/makespur
___________________________________________________________________
Added: svn:executable
   + *

Modified: branches/Cog/build.win32x86/HowToBuild
===================================================================
--- branches/Cog/build.win32x86/HowToBuild	2014-07-24 17:12:40 UTC (rev 3056)
+++ branches/Cog/build.win32x86/HowToBuild	2014-08-05 01:55:33 UTC (rev 3057)
@@ -10,6 +10,7 @@
 	- Building the Bochs Support Libraries
 	- Building an MSI installer (Newspeak)
 	- Optimization level and gcc version (please read!)
+	- Debugging with gdb
 
 
 Overview
@@ -144,3 +145,14 @@
 -fcaller-saves
 
 See http://smallissimo.blogspot.fr/2013/02/compiling-squeak-cog-virtual-machine-on.html
+
+Debugging with gdb
+------------------
+
+Note that even the stripped production VM can be used for debug using the
+unstripped VM to provide symbols, e.g.
+	U:\ gdb bin/Squeak.exe
+	...
+	(no debugging symbols found)
+	(gdb) file SqueakUnstripped.exe
+	(gdb) run trunk.image

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2014-07-24 17:12:40 UTC (rev 3056)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-08-05 01:55:33 UTC (rev 3057)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.823 uuid: 2d337398-d2dd-4715-9476-9a463c29efad
+	CCodeGenerator VMMaker.oscog-eem.841 uuid: 6b9e05e0-8058-4d62-9349-faff621ab0e6
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.823 uuid: 2d337398-d2dd-4715-9476-9a463c29efad
+	StackToRegisterMappingCogit VMMaker.oscog-eem.841 uuid: 6b9e05e0-8058-4d62-9349-faff621ab0e6
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.823 uuid: 2d337398-d2dd-4715-9476-9a463c29efad " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.841 uuid: 6b9e05e0-8058-4d62-9349-faff621ab0e6 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -328,6 +328,7 @@
 #define ShouldNotJIT -8
 #define SIB1 0
 #define SIB4 2
+#define SistaVM 0
 #define Size4Bit 0
 #define SizeMask 0xFC
 #define SPReg -2
@@ -788,12 +789,14 @@
 static void voidImplicitReceiverCacheAt(sqInt mcpc) NoDbgRegParms;
 static AbstractInstruction * gXorCwR(sqInt wordConstant, sqInt reg) NoDbgRegParms;
 static void zeroOpcodeIndex(void);
+void addAllToYoungReferrers(void);
 static void addToOpenPICList(CogMethod *anOpenPIC) NoDbgRegParms;
 static void addToUnpairedMethodList(CogMethod *aCogMethod) NoDbgRegParms;
 static void addToYoungReferrers(CogMethod *cogMethod) NoDbgRegParms;
 static sqInt allocate(sqInt numBytes) NoDbgRegParms;
 static void clearCogCompiledCode(void);
 static void compactCompiledCode(void);
+static void ensureInYoungReferrers(CogMethod *cogMethod) NoDbgRegParms;
 static CogMethod * findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop) NoDbgRegParms;
 static void freeMethod(CogMethod *cogMethod) NoDbgRegParms;
 static void freeOlderMethodsForCompaction(void);
@@ -816,7 +819,6 @@
 static sqInt relocateAndPruneYoungReferrers(void);
 static sqInt removeFromOpenPICList(CogMethod *anOpenPIC) NoDbgRegParms;
 static sqInt removeFromUnpairedMethodList(CogMethod *aCogMethod) NoDbgRegParms;
-static sqInt roomOnYoungReferrersList(void);
 static void voidYoungReferrersPostTenureAll(void);
 char * whereIsMaybeCodeThing(sqInt anOop);
 static sqInt checkValidObjectReference(sqInt anOop) NoDbgRegParms;
@@ -836,7 +838,6 @@
 static void maybeCompileRetryonPrimitiveFail(AbstractInstruction *retryInst, sqInt primIndex) NoDbgRegParms;
 static sqInt allYoungObjectsAgeInFullGC(void);
 static sqInt cacheTagIsMarked(sqInt cacheTag) NoDbgRegParms;
-sqInt canLinkToYoungClasses(void);
 static sqInt checkValidInlineCacheTag(sqInt cacheTag) NoDbgRegParms;
 static sqInt checkValidOopReference(sqInt anOop) NoDbgRegParms;
 static sqInt compactClassFieldMask(void);
@@ -905,6 +906,7 @@
 static sqInt extendedStoreAndPopBytecode(void);
 static sqInt extendedStoreBytecode(void);
 static sqInt frameOffsetOfTemporary(sqInt index) NoDbgRegParms;
+static sqInt genBlockReturn(void);
 static AbstractInstruction * genDoubleFailIfZeroArgRcvrarg(sqInt rcvrReg, sqInt argReg) NoDbgRegParms;
 static sqInt genDynamicSuperSendBytecode(void);
 static sqInt genExtendedSendBytecode(void);
@@ -1144,7 +1146,7 @@
 static CogSimStackEntry * ssValue(sqInt n) NoDbgRegParms;
 static sqInt tryCollapseTempVectorInitializationOfSize(sqInt slots) NoDbgRegParms;
 static sqInt v3or4PushNilSize(sqInt aMethodObj) NoDbgRegParms;
-static sqInt v3or4IsPushNil(BytecodeDescriptor *descriptor, sqInt pc, sqInt nExts, sqInt aMethodObj) NoDbgRegParms;
+static sqInt v3or4NumPushNils(BytecodeDescriptor *descriptor, sqInt pc, sqInt nExts, sqInt aMethodObj) NoDbgRegParms;
 static sqInt oopisGreaterThanOrEqualTo(sqInt anOop, sqInt otherOop) NoDbgRegParms;
 static sqInt oopisGreaterThan(sqInt anOop, sqInt otherOop) NoDbgRegParms;
 static sqInt oopisLessThan(sqInt anOop, sqInt otherOop) NoDbgRegParms;
@@ -2134,6 +2136,7 @@
 #define traceMerge(ign) 0
 #define traceSimStack() 0
 #define traceSpill(ign) 0
+#define allocatype(numElements, elementType) alloca((numElements)*sizeof(elementType))
 #define numElementsIn(anArray) (sizeof(anArray)/sizeof(anArray[0]))
 
 
@@ -8553,7 +8556,7 @@
 		 || ((((usqInt) (byteAt(map))) >> AnnotationShift) == IsDisplacementX2N))));
 		latestContinuation = startbcpc;
 		aMethodObj = (homeMethod->methodObject);
-		endbcpc = (byteLengthOf(aMethodObj)) - 1;
+		endbcpc = (numBytesOf(aMethodObj)) - 1;
 		/* begin bytecodeSetOffsetForHeader: */
 		methodHeader = (homeMethod->methodHeader);
 		bsOffset = (headerIndicatesAlternateBytecodeSet(methodHeader)
@@ -8901,12 +8904,7 @@
 		 && (isYoung(rcvrClass)))
 		 || ((mixin != receiver)
 		 && (isYoung(mixin)))) {
-			if (!(roomOnYoungReferrersList())) {
-				callForCogCompiledCodeCompaction();
-				return mixin;
-			}
-			(cogMethod->cmRefersToYoung = 1);
-			addToYoungReferrers(cogMethod);
+			ensureInYoungReferrers(cogMethod);
 		}
 	}
 	unalignedLongAtput(backEnd, classpc, inlineCacheTagForClass(rcvrClass));
@@ -8944,12 +8942,7 @@
 		 && (isYoung(rcvrClass)))
 		 || ((mixin != receiver)
 		 && (isYoung(mixin)))) {
-			if (!(roomOnYoungReferrersList())) {
-				callForCogCompiledCodeCompaction();
-				return mixin;
-			}
-			(cogMethod->cmRefersToYoung = 1);
-			addToYoungReferrers(cogMethod);
+			ensureInYoungReferrers(cogMethod);
 		}
 	}
 	unalignedLongAtput(backEnd, cacheAddress, inlineCacheTagForClass(rcvrClass));
@@ -10545,7 +10538,7 @@
 				? 256
 				: 0);
 	nExts = 0;
-	end = byteLengthOf(aMethod);
+	end = numBytesOf(aMethod);
 	while (pc <= end) {
 		byte = fetchByteofObject(pc, aMethod);
 		descriptor = generatorAt(byte + bsOffset);
@@ -11500,6 +11493,7 @@
 	generateRunTimeTrampolines();
 	generateNewspeakRuntime();
 
+	
 	generateEnilopmarts();
 	generateTracingTrampolines();
 	recordGeneratedRunTimeaddress("methodZoneBase", methodZoneBase);
@@ -12170,11 +12164,8 @@
 	inlineCacheTag = (theEntryOffset == cmNoCheckEntryOffset
 		? (targetMethod->selector)
 		: inlineCacheTagForInstance(receiver));
-	if ((!((sendingMethod->cmRefersToYoung)))
-	 && (inlineCacheTagIsYoung(inlineCacheTag))) {
-		assert((occurrencesInYoungReferrers(sendingMethod)) == 0);
-		(sendingMethod->cmRefersToYoung = 1);
-		addToYoungReferrers(sendingMethod);
+	if (inlineCacheTagIsYoung(inlineCacheTag)) {
+		ensureInYoungReferrers(sendingMethod);
 	}
 	address = (((sqInt)targetMethod)) + theEntryOffset;
 	extent = rewriteInlineCacheAttagtarget(backEnd, callSiteReturnAddress, inlineCacheTag, address);
@@ -12419,10 +12410,7 @@
 				0;
 			l1:	/* end mapFor:performUntil:arg: */;
 				if (hasYoungObj) {
-					if (!((cogMethod->cmRefersToYoung))) {
-						(cogMethod->cmRefersToYoung = 1);
-						addToYoungReferrers(cogMethod);
-					}
+					ensureInYoungReferrers(cogMethod);
 					hasYoungObj = 0;
 				}
 				else {
@@ -12714,7 +12702,11 @@
 void
 markAndTraceMachineCodeOfMarkedMethods(void)
 {
+    sqInt *address;
+    sqInt *address1;
     CogMethod *cogMethod;
+    sqInt literal;
+    sqInt literal1;
     sqInt map;
     sqInt map1;
     sqInt mapByte;
@@ -12723,6 +12715,8 @@
     sqInt mcpc1;
     sqInt result;
     sqInt result1;
+    sqInt val;
+    sqInt val1;
 
 	if (leakCheckFullGC()) {
 		assert(allMachineCodeObjectReferencesValid());
@@ -12739,7 +12733,10 @@
 			 || ((((cogMethod->cmType)) == CMOpenPIC)
 			 && ((isImmediate((cogMethod->selector)))
 			 || (isMarked((cogMethod->selector))))));
-			markAndTraceLiteral((cogMethod->selector));
+			/* begin markAndTraceLiteral:in:at: */
+			literal = (cogMethod->selector);
+			address = (&((cogMethod->selector)));
+			markAndTraceLiteral(literal);
 			maybeMarkCountersIn(cogMethod);
 			/* begin maybeMarkIRCsIn: */
 			
@@ -12779,7 +12776,10 @@
 			 || ((((cogMethod->cmType)) == CMOpenPIC)
 			 && ((isImmediate((cogMethod->selector)))
 			 || (isMarked((cogMethod->selector))))));
-			markAndTraceLiteral((cogMethod->selector));
+			/* begin markAndTraceLiteral:in:at: */
+			literal1 = (cogMethod->selector);
+			address1 = (&((cogMethod->selector)));
+			markAndTraceLiteral(literal1);
 			maybeMarkCountersIn(cogMethod);
 			/* begin maybeMarkIRCsIn: */
 			
@@ -12835,8 +12835,10 @@
 
 	for (i = 0; i < runtimeObjectRefIndex; i += 1) {
 		mcpc = objectReferencesInRuntime[i];
-		literal = literalBeforeFollowingAddress(backEnd, ((sqInt)mcpc));
+		literal = literalBeforeFollowingAddress(backEnd, ((usqInt)mcpc));
+		/* begin markAndTraceLiteral:in:atpc: */
 		markAndTraceLiteral(literal);
+		0;
 	}
 }
 
@@ -12868,10 +12870,13 @@
 static sqInt
 markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit)
 {
+    sqInt *address;
+    sqInt literal;
     sqInt map;
     sqInt mapByte;
     sqInt mcpc;
     sqInt result;
+    sqInt val;
 
 	if (((cogMethod->cmType)) == CMFree) {
 		return 1;
@@ -12886,7 +12891,10 @@
 			/* begin markLiteralsAndUnlinkUnmarkedSendsIn: */
 			assert(((cogMethod->cmType)) == CMMethod);
 			assert(isMarked((cogMethod->methodObject)));
-			markAndTraceLiteral((cogMethod->selector));
+			/* begin markAndTraceLiteral:in:at: */
+			literal = (cogMethod->selector);
+			address = (&((cogMethod->selector)));
+			markAndTraceLiteral(literal);
 			maybeMarkCountersIn(cogMethod);
 			/* begin maybeMarkIRCsIn: */
 			
@@ -12978,6 +12986,8 @@
 static sqInt
 markLiteralsAndUnlinkIfUnmarkedSendpcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
 {
+    sqInt *address;
+    sqInt *address1;
     usqInt cacheAddress;
     sqInt cacheTag;
     sqInt cacheTag1;
@@ -12986,6 +12996,7 @@
     sqInt entryPoint;
     sqInt entryPoint1;
     sqInt literal;
+    sqInt literal1;
     sqInt mixin;
     sqInt sendTable;
     sqInt *sendTable1;
@@ -12994,10 +13005,15 @@
     sqInt targetMethod;
     CogMethod *targetMethod1;
     sqInt unlinkedRoutine;
+    sqInt val;
 
 	if (annotation == IsObjectReference) {
-		literal = literalBeforeFollowingAddress(backEnd, ((sqInt)mcpc));
+		literal = literalBeforeFollowingAddress(backEnd, ((usqInt)mcpc));
 		markAndTraceLiteral(literal);
+		goto l1;
+		codeModified = 1;
+	l1:	;
+
 	}
 	if ((annotation == IsSendCall)
 			 || (annotation == IsNSSendCall)) {
@@ -13048,20 +13064,35 @@
 				unlinkedRoutine = sendTable1[((((targetMethod1->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod1->cmNumArgs)) : (NumSendTrampolines - 1))];
 				rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod1->selector), unlinkedRoutine);
 				codeModified = 1;
-				markAndTraceLiteral((targetMethod1->selector));
+				/* begin markAndTraceLiteral:in:at: */
+				literal1 = (targetMethod1->selector);
+				address = (&((targetMethod1->selector)));
+				markAndTraceLiteral(literal1);
 			}
 
 		}
 		else {
+
+			/* cacheTag is selector */
+
 			markAndTraceLiteral(cacheTag1);
+			goto l5;
+			codeModified = 1;
+		l5:	;
+
 			if (entryPoint1 == ceImplicitReceiverTrampoline) {
 				markAndTraceLiteral(cacheTag1);
+				goto l4;
+				codeModified = 1;
+				l4:	;
+
 				assert(NumOopsPerIRC == 2);
 				cacheAddress = (((usqInt)mcpc)) + (jumpShortByteSize(backEnd));
-				class = unalignedLongAt(backEnd, cacheAddress);
-				if (class != 0) {
+				if (((class = unalignedLongAt(backEnd, cacheAddress))) != 0) {
 					if (cacheTagIsMarked(class)) {
 						if (((mixin = unalignedLongAt(backEnd, cacheAddress + BytesPerOop))) != 0) {
+							/* begin markAndTraceLiteral:in:at: */
+							address1 = asAddressput(cacheAddress + BytesPerOop, unalignedLongAtput(backEnd, cacheAddress + BytesPerOop, val));
 							markAndTraceLiteral(mixin);
 						}
 					}
@@ -13089,6 +13120,7 @@
 static sqInt
 markLiteralspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
 {
+    sqInt *address;
     usqInt cacheAddress;
     sqInt cacheTag;
     sqInt cacheTag1;
@@ -13099,10 +13131,15 @@
     sqInt mixin;
     sqInt tagCouldBeObj;
     sqInt tagCouldBeObj1;
+    sqInt val;
 
 	if (annotation == IsObjectReference) {
-		literal = literalBeforeFollowingAddress(backEnd, ((sqInt)mcpc));
+		literal = literalBeforeFollowingAddress(backEnd, ((usqInt)mcpc));
 		markAndTraceLiteral(literal);
+		goto l1;
+		codeModified = 1;
+	l1:	;
+
 	}
 	if ((annotation == IsSendCall)
 			 || (annotation == IsNSSendCall)) {
@@ -13124,14 +13161,19 @@
 		 && ((((((CogMethod *) (entryPoint1 - cmEntryOffset)))->cmType)) == CMOpenPIC))));
 		if (tagCouldBeObj1) {
 			markAndTraceLiteral(cacheTag1);
+			goto l3;
+			codeModified = 1;
+		l3:	;
+
 		}
 		if (entryPoint1 == ceImplicitReceiverTrampoline) {
 			assert(NumOopsPerIRC == 2);
 			cacheAddress = (((usqInt)mcpc)) + (jumpShortByteSize(backEnd));
-			class = unalignedLongAt(backEnd, cacheAddress);
-			if (class != 0) {
+			if (((class = unalignedLongAt(backEnd, cacheAddress))) != 0) {
 				if (cacheTagIsMarked(class)) {
 					if (((mixin = unalignedLongAt(backEnd, cacheAddress + BytesPerOop))) != 0) {
+						/* begin markAndTraceLiteral:in:at: */
+						address = asAddressput(cacheAddress + BytesPerOop, unalignedLongAtput(backEnd, cacheAddress + BytesPerOop, val));
 						markAndTraceLiteral(mixin);
 					}
 				}
@@ -13378,7 +13420,7 @@
 		 || ((((usqInt) (byteAt(map))) >> AnnotationShift) == IsDisplacementX2N))));
 		latestContinuation = startbcpc;
 		aMethodObj = (homeMethod->methodObject);
-		endbcpc = (byteLengthOf(aMethodObj)) - 1;
+		endbcpc = (numBytesOf(aMethodObj)) - 1;
 		/* begin bytecodeSetOffsetForHeader: */
 		methodHeader = (homeMethod->methodHeader);
 		bsOffset = (headerIndicatesAlternateBytecodeSet(methodHeader)
@@ -13523,7 +13565,7 @@
 	 || (((temporaryCountOfMethodHeader(headerA)) != (temporaryCountOfMethodHeader(headerB)))
 	 || (((primitiveIndexOfMethodheader(methodA, headerA)) != (primitiveIndexOfMethodheader(methodB, headerB)))
 	 || ((numLitsA != (literalCountOfHeader(headerB)))
-	 || (endPCA > (byteLengthOf(methodB))))))) {
+	 || (endPCA > (numBytesOf(methodB))))))) {
 		return 0;
 	}
 	for (li = 1; li < numLitsA; li += 1) {
@@ -14235,11 +14277,8 @@
 	compilationBreakpoint(aSelectorOop, lengthOf(aSelectorOop));
 	assert(((cogMethod->cmType)) == CMMethod);
 	(cogMethod->selector = aSelectorOop);
-	if ((!((cogMethod->cmRefersToYoung)))
-	 && (isYoung(aSelectorOop))) {
-		assert((occurrencesInYoungReferrers(cogMethod)) == 0);
-		(cogMethod->cmRefersToYoung = 1);
-		addToYoungReferrers(cogMethod);
+	if (isYoung(aSelectorOop)) {
+		ensureInYoungReferrers(cogMethod);
 	}
 }
 
@@ -14251,7 +14290,7 @@
     sqInt pc;
 
 	pc = startPC;
-	end = byteLengthOf(methodObj);
+	end = numBytesOf(methodObj);
 	while (pc <= end) {
 		descriptor = generatorAt((fetchByteofObject(pc, methodObj)) + bytecodeSetOffset);
 		pc += (descriptor->numBytes);
@@ -14834,6 +14873,21 @@
 	opcodeIndex = 0;
 }
 
+void
+addAllToYoungReferrers(void)
+{
+    CogMethod *cogMethod;
+
+	cogMethod = ((CogMethod *) baseAddress);
+	while (cogMethod < (limitZony())) {
+		if ((((cogMethod->cmType)) == CMMethod)
+		 || (((cogMethod->cmType)) == CMOpenPIC)) {
+			ensureInYoungReferrers(cogMethod);
+		}
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
+	}
+}
+
 static void
 addToOpenPICList(CogMethod *anOpenPIC)
 {
@@ -14861,7 +14915,9 @@
 	assert(youngReferrers <= limitAddress);
 	assert((occurrencesInYoungReferrers(cogMethod)) == 0);
 	assert((cogMethod->cmRefersToYoung));
-	if (!(asserta(roomOnYoungReferrersList()))) {
+	assert((youngReferrers <= limitAddress)
+	 && (youngReferrers >= (limitAddress - (methodCount * BytesPerWord))));
+	if (!(asserta((limitAddress - (methodCount * BytesPerWord)) >= mzFreeStart))) {
 		error("no room on youngReferrers list");
 	}
 	youngReferrers -= BytesPerWord;
@@ -14881,7 +14937,6 @@
 	allocation = mzFreeStart;
 	mzFreeStart += roundedBytes;
 	methodCount += 1;
-	assert(roomOnYoungReferrersList());
 	
 	return allocation;
 }
@@ -14985,7 +15040,17 @@
 	methodBytesFreedSinceLastCompaction = 0;
 }
 
+static void
+ensureInYoungReferrers(CogMethod *cogMethod)
+{
+	if (!((cogMethod->cmRefersToYoung))) {
+		assert((occurrencesInYoungReferrers(cogMethod)) == 0);
+		(cogMethod->cmRefersToYoung = 1);
+		addToYoungReferrers(cogMethod);
+	}
+}
 
+
 /*	Newspeak uses a set of methods to implement accessors, a setter and a
 	getter for
 	each inst var offset (e.g. 0 to 255). These accessors are installed under
@@ -15461,26 +15526,6 @@
 	}
 }
 
-
-/*	The youngReferrers list holds methods that may contain a reference to a
-	young object and hence need to be visited during young-space garbage
-	collection. The
-	list saves walking through all of code space to do so, as in typical
-	circumstances there are no methods that refer to young objects.However,
-	events like become:
-	can potentially cause every method to refer to a new object (becomming
-	true for
-	example). So there needs to be room on the list for as many methods as
-	exist.  */
-
-static sqInt
-roomOnYoungReferrersList(void)
-{
-	assert((youngReferrers <= limitAddress)
-	 && (youngReferrers >= (limitAddress - (methodCount * BytesPerWord))));
-	return (limitAddress - (methodCount * BytesPerWord)) >= mzFreeStart;
-}
-
 static void
 voidYoungReferrersPostTenureAll(void)
 {
@@ -15679,12 +15724,6 @@
 	return isMarked(cacheTag);
 }
 
-sqInt
-canLinkToYoungClasses(void)
-{
-	return roomOnYoungReferrersList();
-}
-
 static sqInt
 checkValidInlineCacheTag(sqInt cacheTag)
 {
@@ -17387,6 +17426,24 @@
 		: (FoxMFReceiver - BytesPerWord) + ((methodOrBlockNumArgs - index) * BytesPerWord));
 }
 
+
+/*	Return from block, assuming result already loaded into ReceiverResultReg. */
+
+static sqInt
+genBlockReturn(void)
+{
+	if (needsFrame) {
+		/* begin MoveR:R: */
+		genoperandoperand(MoveRR, FPReg, SPReg);
+		/* begin PopR: */
+		genoperand(PopR, FPReg);
+	}
+	
+	/* begin RetN: */
+	genoperand(RetN, (methodOrBlockNumArgs + 1) * BytesPerWord);
+	return 0;
+}
+
 static AbstractInstruction *
 genDoubleFailIfZeroArgRcvrarg(sqInt rcvrReg, sqInt argReg)
 {
@@ -17467,7 +17524,8 @@
 }
 
 
-/*	221		11011101		Nop */
+/*	NewspeakV4: 221		11011101		Nop */
+/*	SistaV1:		 91		01011011'		Nop */
 
 static sqInt
 genExtNopBytecode(void)
@@ -17477,7 +17535,9 @@
 }
 
 
-/*	229		11100101	i i i i i i i i	Push Integer #iiiiiiii (+ Extend B * 256,
+/*	NewsqueakV4:	229		11100101	iiiiiiii	Push Integer #iiiiiiii (+ Extend B *
+	256, where bbbbbbbb = sddddddd, e.g. -32768 = i=0, a=0, s=1)
+	SistaV1:		232		11101000	iiiiiiii	Push Integer #iiiiiiii (+ Extend B * 256,
 	where bbbbbbbb = sddddddd, e.g. -32768 = i=0, a=0, s=1)
  */
 
@@ -19046,7 +19106,7 @@
 	initialPC = startPCOfMethod(methodObj);
 	endPC = (isQuickPrimitiveIndex(primitiveIndex)
 		? initialPC - 1
-		: byteLengthOf(methodObj));
+		: numBytesOf(methodObj));
 	numBytecodes = (endPC - initialPC) + 1;
 	allocateOpcodesbytecodesifFail((numBytecodes + extra) * 10, numBytecodes, return ((CogMethod *) MethodTooBig));
 	if (((numBlocks = scanMethod())) < 0) {
@@ -21092,16 +21152,7 @@
 	assert(inBlock);
 	popToReg(ssTop(), ReceiverResultReg);
 	ssPop(1);
-	if (needsFrame) {
-		/* begin MoveR:R: */
-		genoperandoperand(MoveRR, FPReg, SPReg);
-		/* begin PopR: */
-		genoperand(PopR, FPReg);
-	}
-	
-	/* begin RetN: */
-	genoperand(RetN, (methodOrBlockNumArgs + 1) * BytesPerWord);
-	return 0;
+	return genBlockReturn();
 }
 
 static sqInt
@@ -22435,8 +22486,9 @@
     BytecodeDescriptor *descriptor;
     sqInt end;
     sqInt framelessStackDelta;
-    sqInt (* const isPushNilFunction)(struct _BytecodeDescriptor *,sqInt,sqInt,sqInt) = v3or4IsPushNil;
     sqInt nExts;
+    sqInt numPushNils;
+    sqInt (* const numPushNilsFunction)(struct _BytecodeDescriptor *,sqInt,sqInt,sqInt) = v3or4NumPushNils;
     sqInt pc;
     sqInt pushingNils;
 
@@ -22465,15 +22517,24 @@
 
 			/* Count the initial number of pushed nils acting as temp initializers.  We can't tell
 			   whether an initial pushNil is an operand reference or a temp initializer, except
-			   when the pushNil is a jump target (has a fixup) in which case it is definitely an
-			   operand reference.  So rarely we may end up over-estimating.  We will correct
-			   by checking the stack depth at the end of the block in compileBlockBodies. */
+			   when the pushNil is a jump target (has a fixup), which never happens:
+			   self systemNavigation browseAllSelect:
+			   [:m| | ebc |
+			   (ebc := m embeddedBlockClosures
+			   select: [:ea| ea decompile statements first isMessage]
+			   thenCollect: [:ea| ea decompile statements first selector]) notEmpty
+			   and: [(#(whileTrue whileFalse whileTrue: whileFalse:) intersection: ebc) notEmpty]]
+			   or if the bytecode set has a push multiple nils bytecode.  We simply count initial nils.
+			   Rarely we may end up over-estimating.  We will correct by checking the stack depth
+			   at the end of the block in compileBlockBodies. */
 
-			if ((pushingNils = (isPushNilFunction(descriptor, pc, nExts, methodObj))
-			 && ((((fixupAt(pc - initialPC))->targetInstruction)) == 0))) {
+			if (((numPushNils = numPushNilsFunction(descriptor, pc, nExts, methodObj))) > 0) {
 				assert(((descriptor->numBytes)) == 1);
-				(blockStart->numInitialNils = ((blockStart->numInitialNils)) + 1);
+				(blockStart->numInitialNils = ((blockStart->numInitialNils)) + numPushNils);
 			}
+			else {
+				pushingNils = 0;
+			}
 		}
 		pc = (pc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation)
 	? ((descriptor->spanFunction))(descriptor, pc, nExts, methodObj)
@@ -22977,13 +23038,21 @@
 }
 
 static sqInt
-v3or4IsPushNil(BytecodeDescriptor *descriptor, sqInt pc, sqInt nExts, sqInt aMethodObj)
+v3or4NumPushNils(BytecodeDescriptor *descriptor, sqInt pc, sqInt nExts, sqInt aMethodObj)
 {
-	return (((descriptor->generator)) == genPushConstantNilBytecode)
-	 || ((((descriptor->generator)) == genExtPushPseudoVariableOrOuterBytecode)
+    sqInt numNils;
+
+	if (((numNils = (((descriptor->generator)) == genPushConstantNilBytecode
+	? 1
+	: 0))) > 0) {
+		return numNils;
+	}
+	return ((((descriptor->generator)) == genExtPushPseudoVariableOrOuterBytecode)
 	 && ((assert((fetchByteofObject(pc, aMethodObj)) == 77),
 	(nExts == 1)
-		 && ((fetchByteofObject(pc - 1, aMethodObj)) == 2))));
+		 && ((fetchByteofObject(pc - 1, aMethodObj)) == 2)))
+		? 1
+		: 0);
 }
 
 

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-07-24 17:12:40 UTC (rev 3056)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-08-05 01:55:33 UTC (rev 3057)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.823 uuid: 2d337398-d2dd-4715-9476-9a463c29efad
+	CCodeGenerator VMMaker.oscog-eem.841 uuid: 6b9e05e0-8058-4d62-9349-faff621ab0e6
  */
 
 
@@ -70,6 +70,7 @@
 void unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector);
 void unlinkSendsToFree(void);
 void unlinkSendsToandFreeIf(sqInt targetMethodObject, sqInt freeIfTrue);
+void addAllToYoungReferrers(void);
 CogMethod * methodFor(void *address);
 sqInt numMethodsOfType(sqInt cogMethodType);
 void printCogMethods(void);
@@ -80,7 +81,6 @@
 void printCogYoungReferrers(void);
 void printOpenPICList(void);
 char * whereIsMaybeCodeThing(sqInt anOop);
-sqInt canLinkToYoungClasses(void);
 sqInt numRegArgs(void);
 sqInt genQuickReturnConst(void);
 sqInt genQuickReturnInstVar(void);

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h	2014-07-24 17:12:40 UTC (rev 3056)
+++ branches/Cog/nscogsrc/vm/cogmethod.h	2014-08-05 01:55:33 UTC (rev 3057)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.823 uuid: 2d337398-d2dd-4715-9476-9a463c29efad
+	CCodeGenerator VMMaker.oscog-eem.841 uuid: 6b9e05e0-8058-4d62-9349-faff621ab0e6
  */
 
 typedef struct {

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2014-07-24 17:12:40 UTC (rev 3056)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2014-08-05 01:55:33 UTC (rev 3057)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.830 uuid: ad7e3584-5924-4500-be7c-ea7ebac3f71c
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.841 uuid: 6b9e05e0-8058-4d62-9349-faff621ab0e6
    from
-	CoInterpreter VMMaker.oscog-eem.830 uuid: ad7e3584-5924-4500-be7c-ea7ebac3f71c
+	CoInterpreter VMMaker.oscog-eem.841 uuid: 6b9e05e0-8058-4d62-9349-faff621ab0e6
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.830 uuid: ad7e3584-5924-4500-be7c-ea7ebac3f71c " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.841 uuid: 6b9e05e0-8058-4d62-9349-faff621ab0e6 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -39,7 +39,7 @@
 void
 warning(char *s) { /* Print an error message but don't exit. */
 	if (warnpid)
-		printf("\n%s pid %ld\n", s, warnpid);
+		printf("\n%s pid %ld\n", s, (long)warnpid);
 	else
 		printf("\n%s\n", s);
 }
@@ -271,6 +271,7 @@
 #define NewspeakVM 1
 #define NextLinkIndex 0
 #define NilObject 0
+#define OldBecameNewFlag 4
 #define PrimCallCollectsProfileSamples 8
 #define PrimCallDoNotJIT 32
 #define PrimCallMayCallBack 4
@@ -315,6 +316,7 @@
 #define SelectorUnknownBytecode 57
 #define SenderIndex 0
 #define ShiftForWord 2
+#define SistaVM 0
 #define Size4Bit 0
 #define SizeMask 0xFC
 #define SmallContextSlots 22
@@ -819,7 +821,6 @@
 void fullGC(void);
 static sqInt fwdTableInit(sqInt blkSize) NoDbgRegParms;
 static sqInt fwdTableSize(sqInt blkSize) NoDbgRegParms;
-static sqInt goodContextSize(sqInt oop) NoDbgRegParms;
 static sqInt imageSegmentVersion(void);
 static sqInt incCompBody(void);
 static sqInt incCompMakeFwd(void);
@@ -838,7 +839,6 @@
 void longPrintReferencesTo(sqInt anOop);
 static void mapPointersInObjectsFromto(sqInt memStart, sqInt memEnd) NoDbgRegParms;
 static void markPhase(sqInt fullGCFlag) NoDbgRegParms;
-sqInt numSlotsOf(sqInt obj);
 sqInt objectAfter(sqInt oop);
 static sqInt okayOop(sqInt signedOop) NoDbgRegParms;
 static sqInt oopHasAcceptableClass(sqInt signedOop) NoDbgRegParms;
@@ -850,7 +850,7 @@
 void printWronglySizedContexts(sqInt printContexts);
 static void restoreHeadersFromtofromandtofrom(sqInt firstIn, sqInt lastIn, sqInt hdrBaseIn, sqInt firstOut, sqInt lastOut, sqInt hdrBaseOut) NoDbgRegParms;
 static void runLeakCheckerForFullGC(sqInt fullGCFlag) NoDbgRegParms;
-static usqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
+static sqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
 static sqInt safePrintStringOf(sqInt oop) NoDbgRegParms;
 static sqInt shortentoIndexableSize(sqInt obj, sqInt nSlots) NoDbgRegParms;
 static sqInt sizeBitsOfSafe(sqInt oop) NoDbgRegParms;
@@ -860,6 +860,7 @@
 static sqInt sufficientSpaceToAllocate(sqInt bytes) NoDbgRegParms;
 static sqInt sweepPhase(void);
 static sqInt sweepPhaseForFullGC(void);
+void unpinObject(sqInt objOop);
 static void verifyCleanHeaders(void);
 EXPORT(sqInt) addGCRoot(sqInt *varLoc);
 sqInt addressCouldBeOop(sqInt address);
@@ -870,7 +871,6 @@
 void beRootIfOld(sqInt oop);
 static void beRootWhileForwarding(sqInt oop) NoDbgRegParms;
 static sqInt byteFormatMask(void);
-sqInt byteLengthOf(sqInt obj);
 sqInt byteSizeOf(sqInt oop);
 sqInt byteSwapped(sqInt w);
 static sqInt changeClassOfto(sqInt rcvr, sqInt argClass) NoDbgRegParms;
@@ -901,6 +901,7 @@
 sqInt classUnsafeAlien(void);
 static void clearRootsTable(void);
 sqInt compactClassAt(sqInt ccIndex);
+sqInt compactClassIndexOfClass(sqInt classObj);
 sqInt compactClassIndexOfHeader(sqInt header);
 sqInt compactClassIndexOf(sqInt oop);
 static sqInt compactIndexOfClass(sqInt aClassOop) NoDbgRegParms;
@@ -912,7 +913,6 @@
 sqInt fetchClassOf(sqInt oop);
 sqInt fetchLong32ofObject(sqInt fieldIndex, sqInt oop);
 sqInt fetchPointerofObject(sqInt fieldIndex, sqInt oop);
-static sqInt fetchWordLengthOf(sqInt objectPointer) NoDbgRegParms;
 static void finalizeReference(usqInt oop) NoDbgRegParms;
 sqInt firstByteFormat(void);
 sqInt firstCompiledMethodFormat(void);
@@ -925,6 +925,7 @@
 static sqInt followForwarded(sqInt objOop) NoDbgRegParms;
 sqInt formatOfClass(sqInt classPointer);
 static sqInt fwdBlockValid(sqInt addr) NoDbgRegParms;
+static sqInt goodContextSize(sqInt oop) NoDbgRegParms;
 static sqInt headerWhileForwardingOf(sqInt oop) NoDbgRegParms;
 sqInt indexablePointersFormat(void);
 sqInt instanceSizeOf(sqInt classObj);
@@ -932,6 +933,7 @@
 static sqInt instSpecOfClass(sqInt classPointer) NoDbgRegParms;
 sqInt integerObjectOf(sqInt value);
 sqInt integerValueOf(sqInt objectPointer);
+sqInt isArrayNonImm(sqInt oop);
 sqInt isArray(sqInt oop);
 sqInt isBytes(sqInt oop);
 sqInt isCharacterObject(sqInt oop);
@@ -972,6 +974,8 @@
 sqInt maybeSplObj(sqInt index);
 sqInt nilObject(void);
 sqInt noShiftCompactClassIndexOfHeader(sqInt header);
+sqInt numBytesOf(sqInt objOop);
+sqInt numSlotsOf(sqInt obj);
 sqInt objectBefore(sqInt address);
 sqInt objectExactlyBefore(sqInt oop);
 sqInt obsoleteDontUseThisFetchWordofObject(sqInt fieldIndex, sqInt oop);
@@ -1200,7 +1204,7 @@
 void printStackPages(void);
 void printStackPagesInUse(void);
 static void printStackPage(StackPage *page) NoDbgRegParms;
-static sqInt printStringOf(sqInt oop) NoDbgRegParms;
+static void printStringOf(sqInt oop) NoDbgRegParms;
 void print(char *s);
 void pushBool(sqInt trueOrFalse);
 static sqInt pushedReceiverOrClosureOfFrame(char *theFP) NoDbgRegParms;
@@ -2078,7 +2082,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.830";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.841";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -2121,6 +2125,7 @@
 #define dispatchFunctionPointer(aFunctionPointer) (aFunctionPointer)()
 #define flush() fflush(stdout)
 #define printFloat(f) printf("%g", f)
+#define allocatype(numElements, elementType) alloca((numElements)*sizeof(elementType))
 #define numElementsIn(anArray) (sizeof(anArray)/sizeof(anArray[0]))
 
 
@@ -4871,7 +4876,6 @@
 							GIV(framePointer) = localFP;
 							
 							ceEnterCogCodePopReceiverReg();
-							null;
 							goto l301;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -4889,7 +4893,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-					null;
+					/* return self */
 				l301:	/* end baseFrameReturn */;
 					goto l300;
 				}
@@ -5173,338 +5177,337 @@
 							? (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask
 							: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))));
 				assert(lkupClassTag != (nilObject()));
-				/* goto commonSend */
-			}
-			
-		commonSend:
-			/* commonSend */
-			{
-				CogMethod *cogMethod;
-				CogMethod *cogMethod1;
-				sqInt errorCode;
-				sqInt hash;
-				sqInt i;
-				sqInt localPrimIndex;
-				sqInt methodHeader;
-				sqInt methodHeader1;
-				sqInt methodHeader2;
-				sqInt nArgs;
-				sqInt numTemps;
-				sqInt object;
-				sqInt ok;
-				sqInt probe;
-				sqInt rcvr;
-				char *savedFramePointer;
-				char *savedStackPointer;
-				sqInt succeeded;
-				sqInt switched;
-				sqInt table;
+				
+			commonSend:
+				/* commonSend */
+				{
+					CogMethod *cogMethod;
+					CogMethod *cogMethod1;
+					sqInt errorCode;
+					sqInt hash;
+					sqInt i;
+					sqInt localPrimIndex;
+					sqInt methodHeader;
+					sqInt methodHeader1;
+					sqInt methodHeader2;
+					sqInt nArgs;
+					sqInt numTemps;
+					sqInt object;
+					sqInt ok;
+					sqInt probe;
+					sqInt rcvr;
+					char *savedFramePointer;
+					char *savedStackPointer;
+					sqInt succeeded;
+					sqInt switched;
+					sqInt table;
 
-				VM_LABEL(0commonSend);
-				/* begin sendBreakpoint:receiver: */
-				sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(GIV(messageSelector)), lengthOfMaybeImmediate(GIV(messageSelector)), longAtPointer(localSP + (GIV(argumentCount) * BytesPerOop)));
-				if (recordSendTrace()) {
-					/* begin recordTrace:thing:source: */
-					GIV(traceLog)[GIV(traceLogIndex)] = lkupClassTag;
-					GIV(traceLog)[GIV(traceLogIndex) + 1] = GIV(messageSelector);
-					GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromInterpreter;
-					GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize;
-					if (printOnTrace()) {
-						printActivationNameForSelectorstartClass(GIV(messageSelector), lkupClassTag);
-						/* begin cr */
-						printf("\n");
+					VM_LABEL(0commonSend);
+					/* begin sendBreakpoint:receiver: */
+					sendBreakpointreceiver(firstFixedFieldOfMaybeImmediate(GIV(messageSelector)), lengthOfMaybeImmediate(GIV(messageSelector)), longAtPointer(localSP + (GIV(argumentCount) * BytesPerOop)));
+					if (recordSendTrace()) {
+						/* begin recordTrace:thing:source: */
+						GIV(traceLog)[GIV(traceLogIndex)] = lkupClassTag;
+						GIV(traceLog)[GIV(traceLogIndex) + 1] = GIV(messageSelector);
+						GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromInterpreter;
+						GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize;
+						if (printOnTrace()) {
+							printActivationNameForSelectorstartClass(GIV(messageSelector), lkupClassTag);
+							/* begin cr */
+							printf("\n");
+						}
 					}
-				}
-				/* begin internalFindNewMethod */
-				VM_LABEL(0internalFindNewMethod);
-				/* begin inlineLookupInMethodCacheSel:classTag: */
+					/* begin internalFindNewMethod */
+					VM_LABEL(0internalFindNewMethod);
+					/* begin inlineLookupInMethodCacheSel:classTag: */
 
-				/* shift drops two low-order zeros from addresses */
+					/* shift drops two low-order zeros from addresses */
 
-				hash = GIV(messageSelector) ^ lkupClassTag;
+					hash = GIV(messageSelector) ^ lkupClassTag;
 
-				/* first probe */
+					/* first probe */
 
-				probe = hash & MethodCacheMask;
-				if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
-				 && ((GIV(methodCache)[probe + MethodCacheClass]) == lkupClassTag)) {
-					GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
-					primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
-					ok = 1;
-					goto l307;
-				}
+					probe = hash & MethodCacheMask;
+					if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
+					 && ((GIV(methodCache)[probe + MethodCacheClass]) == lkupClassTag)) {
+						GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
+						primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
+						ok = 1;
+						goto l307;
+					}
 
-				/* second probe */
+					/* second probe */
 
-				probe = (((usqInt) hash) >> 1) & MethodCacheMask;
-				if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
-				 && ((GIV(methodCache)[probe + MethodCacheClass]) == lkupClassTag)) {
-					GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
-					primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
-					ok = 1;
-					goto l307;
-				}
-				probe = (((usqInt) hash) >> 2) & MethodCacheMask;
-				if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
-				 && ((GIV(methodCache)[probe + MethodCacheClass]) == lkupClassTag)) {
-					GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
-					primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
-					ok = 1;
-					goto l307;
-				}
-				ok = 0;
-			l307:	/* end inlineLookupInMethodCacheSel:classTag: */;
-				if (ok) {
-					/* begin ifAppropriateCompileToNativeCode:selector: */
-					VM_LABEL(0ifAppropriateCompileToNativeCodeselector);
-					methodHeader2 = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
-					if (isCogMethodReference(methodHeader2)) {
+					probe = (((usqInt) hash) >> 1) & MethodCacheMask;
+					if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
+					 && ((GIV(methodCache)[probe + MethodCacheClass]) == lkupClassTag)) {
+						GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
+						primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
+						ok = 1;
+						goto l307;
+					}
+					probe = (((usqInt) hash) >> 2) & MethodCacheMask;
+					if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
+					 && ((GIV(methodCache)[probe + MethodCacheClass]) == lkupClassTag)) {
+						GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
+						primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
+						ok = 1;
+						goto l307;
+					}
+					ok = 0;
+				l307:	/* end inlineLookupInMethodCacheSel:classTag: */;
+					if (ok) {
+						/* begin ifAppropriateCompileToNativeCode:selector: */
+						VM_LABEL(0ifAppropriateCompileToNativeCodeselector);
+						methodHeader2 = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+						if (isCogMethodReference(methodHeader2)) {
 
-						/* makeBaseFrame: can create cog methods with nil selectors. */
+							/* makeBaseFrame: can create cog methods with nil selectors. */
 
-						cogMethod = ((CogMethod *) methodHeader2);
-						if (((cogMethod->selector)) == GIV(nilObj)) {
-							setSelectorOfto(cogMethod, GIV(messageSelector));
+							cogMethod = ((CogMethod *) methodHeader2);
+							if (((cogMethod->selector)) == GIV(nilObj)) {
+								setSelectorOfto(cogMethod, GIV(messageSelector));
+							}
 						}
-					}
-					else {
-						if ((((((sqInt) methodHeader2)) < 0
-		? (((usqInt) methodHeader2) >> 1) & 0xFFFF
-		: (((usqInt) methodHeader2) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
-							cogselector(GIV(newMethod), GIV(messageSelector));
-						}
 						else {
-							maybeFlagMethodAsInterpreted(GIV(newMethod));
+							if ((((((sqInt) methodHeader2)) < 0
+	? (((usqInt) methodHeader2) >> 1) & 0xFFFF
+	: (((usqInt) methodHeader2) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
+								cogselector(GIV(newMethod), GIV(messageSelector));
+							}
+							else {
+								maybeFlagMethodAsInterpreted(GIV(newMethod));
+							}
 						}
 					}
-				}
-				else {
-					/* begin externalizeIPandSP */
-					assert((((usqInt)localIP)) != (ceReturnToInterpreterPC()));
-					GIV(instructionPointer) = oopForPointer(localIP);
-					GIV(stackPointer) = localSP;
-					GIV(framePointer) = localFP;
-					
-					GIV(lkupClass) = lkupClassTag;
-					lookupMethodInClass(GIV(lkupClass));
-					/* begin internalizeIPandSP */
-					assert(GIV(instructionPointer) != (ceReturnToInterpreterPC()));
-					localIP = pointerForOop(GIV(instructionPointer));
-					localSP = pointerForOop(GIV(stackPointer));
-					localFP = pointerForOop(GIV(framePointer));
-					addNewMethodToCache(GIV(lkupClass));
-				}
-			l304:	/* end internalFindNewMethod */;
-				/* begin internalExecuteNewMethod */
-				VM_LABEL(0internalExecuteNewMethod);
-				if (primitiveFunctionPointer != 0) {
-					if ((((unsigned long) primitiveFunctionPointer)) <= MaxQuickPrimitiveIndex) {
-						/* begin internalQuickPrimitiveResponse */
-						VM_LABEL(0internalQuickPrimitiveResponse);
-						assert(isPrimitiveFunctionPointerAnIndex());
-						localPrimIndex = ((sqInt) primitiveFunctionPointer);
-						assert((localPrimIndex > 0xFF)
-						 && (localPrimIndex < 520));
-						if (localPrimIndex >= 264) {
-							longAtPointerput(localSP, longAt(((longAtPointer(localSP)) + BaseHeaderSize) + ((localPrimIndex - 264) << ShiftForWord)));
+					else {
+						/* begin externalizeIPandSP */
+						assert((((usqInt)localIP)) != (ceReturnToInterpreterPC()));
+						GIV(instructionPointer) = oopForPointer(localIP);
+						GIV(stackPointer) = localSP;
+						GIV(framePointer) = localFP;
+						
+						GIV(lkupClass) = lkupClassTag;
+						lookupMethodInClass(GIV(lkupClass));
+						/* begin internalizeIPandSP */
+						assert(GIV(instructionPointer) != (ceReturnToInterpreterPC()));
+						localIP = pointerForOop(GIV(instructionPointer));
+						localSP = pointerForOop(GIV(stackPointer));
+						localFP = pointerForOop(GIV(framePointer));
+						addNewMethodToCache(GIV(lkupClass));
+					}
+				l304:	/* end internalFindNewMethod */;
+					/* begin internalExecuteNewMethod */
+					VM_LABEL(0internalExecuteNewMethod);
+					if (primitiveFunctionPointer != 0) {
+						if ((((unsigned long) primitiveFunctionPointer)) <= MaxQuickPrimitiveIndex) {
+							/* begin internalQuickPrimitiveResponse */
+							VM_LABEL(0internalQuickPrimitiveResponse);
+							assert(isPrimitiveFunctionPointerAnIndex());
+							localPrimIndex = ((sqInt) primitiveFunctionPointer);
+							assert((localPrimIndex > 0xFF)
+							 && (localPrimIndex < 520));
+							if (localPrimIndex >= 264) {
+								longAtPointerput(localSP, longAt(((longAtPointer(localSP)) + BaseHeaderSize) + ((localPrimIndex - 264) << ShiftForWord)));
+								1;
+								goto l308;
+							}
+							if (localPrimIndex == 256) {
+								1;
+								goto l308;
+							}
+							if (localPrimIndex == 257) {
+								longAtPointerput(localSP, GIV(trueObj));
+								1;
+								goto l308;
+							}
+							if (localPrimIndex == 258) {
+								longAtPointerput(localSP, GIV(falseObj));
+								1;
+								goto l308;
+							}
+							if (localPrimIndex == 259) {
+								longAtPointerput(localSP, GIV(nilObj));
+								1;
+								goto l308;
+							}
+							longAtPointerput(localSP, (((localPrimIndex - 261) << 1) | 1));
 							1;
-							goto l308;
+						l308:	/* end internalQuickPrimitiveResponse */;
+							goto l306;
 						}
-						if (localPrimIndex == 256) {
-							1;
-							goto l308;
+						/* begin externalizeIPandSP */
+						assert((((usqInt)localIP)) != (ceReturnToInterpreterPC()));
+						GIV(instructionPointer) = oopForPointer(localIP);
+						GIV(stackPointer) = localSP;
+						GIV(framePointer) = localFP;
+						/* begin slowPrimitiveResponse */
+						if (recordPrimTrace()) {
+							/* begin fastLogPrim: */
+							GIV(primTraceLog)[GIV(primTraceLogIndex)] = GIV(messageSelector);
+							primTraceLogIndex(GIV(primTraceLogIndex) + 1);
 						}
-						if (localPrimIndex == 257) {
-							longAtPointerput(localSP, GIV(trueObj));
-							1;
-							goto l308;
-						}
-						if (localPrimIndex == 258) {
-							longAtPointerput(localSP, GIV(falseObj));
-							1;
-							goto l308;
-						}
-						if (localPrimIndex == 259) {
-							longAtPointerput(localSP, GIV(nilObj));
-							1;
-							goto l308;
-						}
-						longAtPointerput(localSP, (((localPrimIndex - 261) << 1) | 1));
-						1;
-					l308:	/* end internalQuickPrimitiveResponse */;
-						goto l306;
-					}
-					/* begin externalizeIPandSP */
-					assert((((usqInt)localIP)) != (ceReturnToInterpreterPC()));
-					GIV(instructionPointer) = oopForPointer(localIP);
-					GIV(stackPointer) = localSP;
-					GIV(framePointer) = localFP;
-					/* begin slowPrimitiveResponse */
-					if (recordPrimTrace()) {
-						/* begin fastLogPrim: */
-						GIV(primTraceLog)[GIV(primTraceLogIndex)] = GIV(messageSelector);
-						primTraceLogIndex(GIV(primTraceLogIndex) + 1);
-					}
-					assert(!(isOopForwarded(stackValue(GIV(argumentCount)))));
-					nArgs = GIV(argumentCount);
-					savedStackPointer = GIV(stackPointer);
-					savedFramePointer = GIV(framePointer);
+						assert(!(isOopForwarded(stackValue(GIV(argumentCount)))));
+						nArgs = GIV(argumentCount);
+						savedStackPointer = GIV(stackPointer);
+						savedFramePointer = GIV(framePointer);
 
-					/* begin initPrimCall */
-					GIV(primFailCode) = 0;
-					dispatchFunctionPointer(primitiveFunctionPointer);
-					
-					/* begin maybeFailForLastObjectOverwrite */
-					if (checkAllocFiller) {
-						if (((freeStart()) < GIV(scavengeThreshold))
-						 && ((longAt(freeStart())) != (freeStart()))) {
-							GIV(primFailCode) = PrimErrWritePastObject;
+						/* begin initPrimCall */
+						GIV(primFailCode) = 0;
+						dispatchFunctionPointer(primitiveFunctionPointer);
+						
+						/* begin maybeFailForLastObjectOverwrite */
+						if (checkAllocFiller) {
+							if (((freeStart()) < GIV(scavengeThreshold))
+							 && ((longAt(freeStart())) != (freeStart()))) {
+								GIV(primFailCode) = PrimErrWritePastObject;
+							}
 						}
-					}
-					if (FailImbalancedPrimitives
-					 && ((!GIV(primFailCode))
-					 && ((GIV(framePointer) == savedFramePointer)
-					 && (!((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())))))) {
+						if (FailImbalancedPrimitives
+						 && ((!GIV(primFailCode))
+						 && ((GIV(framePointer) == savedFramePointer)
+						 && (!((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())))))) {
 
-						/* Don't fail if primitive has done something radical, e.g. perform: */
+							/* Don't fail if primitive has done something radical, e.g. perform: */
 
-						if (GIV(stackPointer) != (savedStackPointer + (nArgs * BytesPerWord))) {
-							flag("Would be nice to make this a message send of e.g. unbalancedPrimitive to the current process or context");
-							GIV(stackPointer) = savedStackPointer;
-							failUnbalancedPrimitive();
+							if (GIV(stackPointer) != (savedStackPointer + (nArgs * BytesPerWord))) {
+								flag("Would be nice to make this a message send of e.g. unbalancedPrimitive to the current process or context");
+								GIV(stackPointer) = savedStackPointer;
+								failUnbalancedPrimitive();
+							}
 						}
+						if (GIV(nextProfileTick) > 0) {
+							checkProfileTick(GIV(newMethod));
+						}
+						succeeded = !GIV(primFailCode);
+						if (GIV(instructionPointer) == (ceReturnToInterpreterPC())) {
+							GIV(instructionPointer) = longAt(GIV(framePointer) + FoxIFSavedIP);
+						}
+						/* begin internalizeIPandSP */
+						assert(GIV(instructionPointer) != (ceReturnToInterpreterPC()));
+						localIP = pointerForOop(GIV(instructionPointer));
+						localSP = pointerForOop(GIV(stackPointer));
+						localFP = pointerForOop(GIV(framePointer));
+						if (succeeded) {
+							returntoExecutive(popStack(), 1);
+							browserPluginReturnIfNeeded();
+							null;
+							goto l306;
+						}
 					}
-					if (GIV(nextProfileTick) > 0) {
-						checkProfileTick(GIV(newMethod));
+					if (methodHasCogMethod(GIV(newMethod))) {
+						/* begin iframeSavedIP:put: */
+						assert(!(isMachineCodeFrame(localFP)));
+						longAtput(localFP + FoxIFSavedIP, ((sqInt)localIP));
+						GIV(instructionPointer) = ceReturnToInterpreterPC();
+						/* begin externalizeFPandSP */
+						assert((localSP < ((GIV(stackPage)->baseAddress)))
+						 && (localSP > (((GIV(stackPage)->realStackLimit)) - LargeContextSize)));
+						GIV(stackPointer) = localSP;
+						GIV(framePointer) = localFP;
+						activateCoggedNewMethod(1);
+						/* begin internalizeIPandSP */
+						assert(GIV(instructionPointer) != (ceReturnToInterpreterPC()));
+						localIP = pointerForOop(GIV(instructionPointer));
+						localSP = pointerForOop(GIV(stackPointer));
+						localFP = pointerForOop(GIV(framePointer));
 					}
-					succeeded = !GIV(primFailCode);
-					if (GIV(instructionPointer) == (ceReturnToInterpreterPC())) {
-						GIV(instructionPointer) = longAt(GIV(framePointer) + FoxIFSavedIP);
-					}
-					/* begin internalizeIPandSP */
-					assert(GIV(instructionPointer) != (ceReturnToInterpreterPC()));
-					localIP = pointerForOop(GIV(instructionPointer));
-					localSP = pointerForOop(GIV(stackPointer));
-					localFP = pointerForOop(GIV(framePointer));
-					if (succeeded) {
-						returntoExecutive(popStack(), 1);
-						browserPluginReturnIfNeeded();
-						null;
-						goto l306;
-					}
-				}
-				if (methodHasCogMethod(GIV(newMethod))) {
-					/* begin iframeSavedIP:put: */
-					assert(!(isMachineCodeFrame(localFP)));
-					longAtput(localFP + FoxIFSavedIP, ((sqInt)localIP));
-					GIV(instructionPointer) = ceReturnToInterpreterPC();
-					/* begin externalizeFPandSP */
-					assert((localSP < ((GIV(stackPage)->baseAddress)))
-					 && (localSP > (((GIV(stackPage)->realStackLimit)) - LargeContextSize)));
-					GIV(stackPointer) = localSP;
-					GIV(framePointer) = localFP;
-					activateCoggedNewMethod(1);
-					/* begin internalizeIPandSP */
-					assert(GIV(instructionPointer) != (ceReturnToInterpreterPC()));
-					localIP = pointerForOop(GIV(instructionPointer));
-					localSP = pointerForOop(GIV(stackPointer));
-					localFP = pointerForOop(GIV(framePointer));
-				}
-				else {
-					/* begin internalActivateNewMethod */
-					VM_LABEL(0internalActivateNewMethod);
-					methodHeader = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list