[Vm-dev] [commit][3072] CogVM source as per VMMaker.oscog-eem.876

commits at squeakvm.org commits at squeakvm.org
Mon Sep 8 22:20:21 UTC 2014


Revision: 3072
Author:   eliot
Date:     2014-09-08 15:20:18 -0700 (Mon, 08 Sep 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.876

Regenerate sources after refactoring Slang code to ask classes what methods
they want to include based on their initializationOptions inst var instead
of the centralized VMMaker.

Generate Spur Newspeak VMs with the new CompiledMethod header format.  This will
break the Newspeak Spur bootstrap until NOF generation and/or loading is fixed.

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

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

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2014-09-07 03:45:50 UTC (rev 3071)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-09-08 22:20:18 UTC (rev 3072)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
+	CCodeGenerator VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
+	StackToRegisterMappingCogit VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -595,7 +595,6 @@
 void callCogCodePopReceiverAndClassRegs(void);
 sqInt ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver);
 static sqInt ceImplicitReceiverForreceiver(sqInt selector, sqInt receiver) NoDbgRegParms;
-static sqInt ceImplicitReceiverForreceivercache(sqInt selector, sqInt receiver, usqInt cacheAddress) NoDbgRegParms;
 sqInt ceSICMiss(sqInt receiver);
 void checkAssertsEnabledInCogit(void);
 static sqInt checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, sqInt cogMethod) NoDbgRegParms;
@@ -648,7 +647,6 @@
 CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod);
 static sqInt findIsBackwardBranchMcpcBcpcMatchingMcpc(BytecodeDescriptor *descriptor, sqInt isBackwardBranch, char *mcpc, sqInt bcpc, void *targetMcpc) NoDbgRegParms;
 static void freePICsWithFreedTargets(void);
-void freeUnmarkedMachineCode(void);
 static void (*genCallEnilopmartForandcalled(sqInt regArg1, sqInt regArg2, char *trampolineName))(void)  NoDbgRegParms;
 static void (*genCallEnilopmartForcalled(sqInt regArg1, char *trampolineName))(void)  NoDbgRegParms;
 static sqInt genCheckForInterruptsTrampoline(void);
@@ -721,13 +719,11 @@
 static void mapObjectReferencesInMachineCodeForYoungGC(void);
 void mapObjectReferencesInMachineCode(sqInt gcMode);
 static void markAndTraceMachineCodeForNewSpaceGC(void);
-void markAndTraceMachineCodeOfMarkedMethods(void);
 static void markAndTraceObjectReferencesInGeneratedRuntime(void);
 void markAndTraceObjectsOrFreeMachineCode(sqInt inFullGC);
 static sqInt markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit) NoDbgRegParms;
 static void markAndTraceOrFreeMachineCodeForFullGC(void);
 static sqInt markLiteralsAndUnlinkIfUnmarkedSendpcmethod(sqInt annotation, char *mcpc, sqInt cogMethod) NoDbgRegParms;
-static sqInt markLiteralspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod) NoDbgRegParms;
 void markMethodAndReferents(CogBlockMethod *aCogMethod);
 static sqInt markYoungObjectspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod) NoDbgRegParms;
 usqInt maxCogMethodAddress(void);
@@ -8933,44 +8929,6 @@
 }
 
 
-/*	Cached implicit receiver implementation. Caller looks like
-	mov Lclass, Arg1Reg
-	mov selector, SendNumArgsReg
-	call ceImplicitReceiver
-	and Lclass: .word; Lmixin: .word is somewhere on the heap.
-	The trampoline has already fetched the class and probed the cache and
-	found that the cache missed. Compute the implicit receiver for the
-	receiver's class
-	and reload the class tag. If either the class tag or the mixin are young
-	then the
-	method needs to be added to the youngReferrers list to ensure correct GC. */
-
-static sqInt
-ceImplicitReceiverForreceivercache(sqInt selector, sqInt receiver, usqInt cacheAddress)
-{
-    CogMethod *cogMethod;
-    sqInt mixin;
-    sqInt rcvrClass;
-
-	mixin = implicitReceiverFormixinimplementing(receiver, mMethodClass(), selector);
-	rcvrClass = fetchClassOf(receiver);
-	cogMethod = mframeHomeMethodExport();
-	if (!((cogMethod->cmRefersToYoung))) {
-		if (((inlineCacheTagsMayBeObjects())
-		 && (isYoung(rcvrClass)))
-		 || ((mixin != receiver)
-		 && (isYoung(mixin)))) {
-			ensureInYoungReferrers(cogMethod);
-		}
-	}
-	unalignedLongAtput(backEnd, cacheAddress, inlineCacheTagForClass(rcvrClass));
-	unalignedLongAtput(backEnd, cacheAddress + BytesPerOop, (mixin == receiver
-		? 0
-		: mixin));
-	return mixin;
-}
-
-
 /*	An in-line cache check in a method has failed. The failing entry check has
 	jumped to the ceMethodAbort abort call at the start of the method which
 	has called this routine.
@@ -10846,39 +10804,6 @@
 }
 
 
-/*	Free machine-code methods whose compiled methods are unmarked
-	and open PICs whose selectors are not marked. */
-
-void
-freeUnmarkedMachineCode(void)
-{
-    CogMethod *cogMethod;
-    sqInt freedMethod;
-
-	freedMethod = 0;
-	cogMethod = ((CogMethod *) methodZoneBase);
-	while (cogMethod < (limitZony())) {
-		if ((((cogMethod->cmType)) == CMMethod)
-		 && (!(isMarked((cogMethod->methodObject))))) {
-			freedMethod = 1;
-			freeMethod(cogMethod);
-		}
-		if ((((cogMethod->cmType)) == CMOpenPIC)
-		 && ((!(isImmediate((cogMethod->selector))))
-		 && (!(isMarked((cogMethod->selector)))))) {
-			freedMethod = 1;
-			freeMethod(cogMethod);
-		}
-		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
-	}
-	if (freedMethod) {
-		unlinkSendsToFree();
-		pruneYoungReferrers();
-		flushICacheFromto(processor, codeBase, ((sqInt)(limitZony())));
-	}
-}
-
-
 /*	An enilopmart (the reverse of a trampoline) is a piece of code that makes
 	the system-call-like transition from the C runtime into generated machine
 	code. This version is for entering code as if from a call. The desired
@@ -12713,135 +12638,6 @@
 }
 
 
-/*	Mark objects in machine-code of marked methods (or open PICs with marked
-	selectors). 
- */
-
-void
-markAndTraceMachineCodeOfMarkedMethods(void)
-{
-    sqInt *address;
-    sqInt *address1;
-    CogMethod *cogMethod;
-    sqInt literal;
-    sqInt literal1;
-    sqInt map;
-    sqInt map1;
-    sqInt mapByte;
-    sqInt mapByte1;
-    sqInt mcpc;
-    sqInt mcpc1;
-    sqInt result;
-    sqInt result1;
-    sqInt val;
-    sqInt val1;
-
-	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))))));
-			/* begin markAndTraceLiteral:in:at: */
-			literal = (cogMethod->selector);
-			address = (&((cogMethod->selector)));
-			markAndTraceLiteral(literal);
-			maybeMarkCountersIn(cogMethod);
-			/* begin maybeMarkIRCsIn: */
-			
-#      if NewspeakVM
-			;
-
-#      endif /* NewspeakVM */
-
-			/* begin mapFor:performUntil:arg: */
-			mcpc = (((sqInt)cogMethod)) + cmNoCheckEntryOffset;
-			map = ((((usqInt)cogMethod)) + ((cogMethod->blockSize))) - 1;
-			while (((mapByte = byteAt(map))) != MapEnd) {
-				if (mapByte >= FirstAnnotation) {
-					mcpc += mapByte & DisplacementMask;
-					result = markLiteralspcmethod((((usqInt) mapByte) >> AnnotationShift), (((char *) mcpc)), (((sqInt)cogMethod)));
-					if (result != 0) {
-						result;
-						goto l1;
-					}
-				}
-				else {
-					mcpc += (mapByte >= DisplacementX2N
-						? (mapByte - DisplacementX2N) << AnnotationShift
-						: mapByte);
-				}
-				map -= 1;
-			}
-			0;
-		l1:	/* end mapFor:performUntil:arg: */;
-		}
-		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))))));
-			/* begin markAndTraceLiteral:in:at: */
-			literal1 = (cogMethod->selector);
-			address1 = (&((cogMethod->selector)));
-			markAndTraceLiteral(literal1);
-			maybeMarkCountersIn(cogMethod);
-			/* begin maybeMarkIRCsIn: */
-			
-#      if NewspeakVM
-			;
-
-#      endif /* NewspeakVM */
-
-			/* begin mapFor:performUntil:arg: */
-			mcpc1 = (((sqInt)cogMethod)) + cmNoCheckEntryOffset;
-			map1 = ((((usqInt)cogMethod)) + ((cogMethod->blockSize))) - 1;
-			while (((mapByte1 = byteAt(map1))) != MapEnd) {
-				if (mapByte1 >= FirstAnnotation) {
-					mcpc1 += mapByte1 & DisplacementMask;
-					result1 = markLiteralspcmethod((((usqInt) mapByte1) >> AnnotationShift), (((char *) mcpc1)), (((sqInt)cogMethod)));
-					if (result1 != 0) {
-						result1;
-						goto l2;
-					}
-				}
-				else {
-					mcpc1 += (mapByte1 >= DisplacementX2N
-						? (mapByte1 - DisplacementX2N) << AnnotationShift
-						: mapByte1);
-				}
-				map1 -= 1;
-			}
-			0;
-		l2:	/* end mapFor:performUntil:arg: */;
-		}
-		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
@@ -13006,7 +12802,7 @@
 {
     sqInt *address;
     sqInt *address1;
-    sqInt cacheAddress;
+    usqInt cacheAddress;
     sqInt cacheTag;
     sqInt cacheTag1;
     sqInt cacheTagMarked;
@@ -13131,86 +12927,6 @@
 	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 *address;
-    sqInt cacheAddress;
-    sqInt cacheTag;
-    sqInt cacheTag1;
-    sqInt class;
-    sqInt entryPoint;
-    sqInt entryPoint1;
-    sqInt literal;
-    sqInt mixin;
-    sqInt tagCouldBeObj;
-    sqInt tagCouldBeObj1;
-    sqInt val;
-
-	if (annotation == IsObjectReference) {
-		literal = literalBeforeFollowingAddress(backEnd, ((usqInt)mcpc));
-		markAndTraceLiteral(literal);
-		goto l1;
-		codeModified = 1;
-	l1:	;
-
-	}
-	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),
-		   the selectors of open PIC sends (entry offset = cmEntryOffset, target is an Open PIC)
-		   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) == uncheckedEntryAlignment)
-		 || (((entryPoint1 & entryPointMask) == checkedEntryAlignment)
-		 && ((((((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));
-			if (((class = unalignedLongAt(backEnd, cacheAddress))) != 0) {
-				if (cacheTagIsMarked(class)) {
-					if (((mixin = unalignedLongAt(backEnd, cacheAddress + BytesPerOop))) != 0) {
-						/* begin markAndTraceLiteral:in:at: */
-						address = (cacheAddress + BytesPerOop);
-						markAndTraceLiteral(mixin);
-					}
-				}
-				else {
-					unalignedLongAtput(backEnd, cacheAddress, 0);
-					unalignedLongAtput(backEnd, cacheAddress + BytesPerOop, 0);
-					codeModified = 1;
-				}
-			}
-			else {
-				assert((unalignedLongAt(backEnd, cacheAddress + BytesPerOop)) == 0);
-			}
-		}
-
-
-	}
-	return 0;
-}
-
 void
 markMethodAndReferents(CogBlockMethod *aCogMethod)
 {
@@ -13255,7 +12971,7 @@
 static sqInt
 markYoungObjectspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
 {
-    sqInt cacheAddress;
+    usqInt cacheAddress;
     sqInt cacheTag;
     sqInt cacheTag1;
     sqInt class;
@@ -14101,7 +13817,7 @@
 static sqInt
 remapIfObjectRefpchasYoung(sqInt annotation, char *mcpc, sqInt hasYoungPtr)
 {
-    sqInt cacheAddress;
+    usqInt cacheAddress;
     sqInt cacheTag;
     sqInt cacheTag1;
     sqInt entryPoint;
@@ -14865,7 +14581,7 @@
 static void
 voidImplicitReceiverCacheAt(sqInt mcpc)
 {
-    sqInt cacheAddress;
+    usqInt cacheAddress;
 
 	assert(NumOopsPerIRC == 2);
 	cacheAddress = (((usqInt)mcpc)) + (jumpShortByteSize(backEnd));

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-09-07 03:45:50 UTC (rev 3071)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-09-08 22:20:18 UTC (rev 3072)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
+	CCodeGenerator VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
  */
 
 
@@ -44,13 +44,11 @@
 void compactCogCompiledCode(void);
 void enterCogCodePopReceiver(void);
 CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod);
-void freeUnmarkedMachineCode(void);
 void initializeCodeZoneFromupTo(sqInt startAddress, sqInt endAddress);
 sqInt isPCWithinMethodZone(char *address);
 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/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2014-09-07 03:45:50 UTC (rev 3071)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2014-09-08 22:20:18 UTC (rev 3072)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
    from
-	CoInterpreter VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
+	CoInterpreter VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -2088,7 +2088,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.865";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.876";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -4883,6 +4883,7 @@
 							GIV(framePointer) = localFP;
 							
 							ceEnterCogCodePopReceiverReg();
+							null;
 							goto l303;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -4900,7 +4901,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-					/* return self */
+					null;
 				l303:	/* end baseFrameReturn */;
 					goto l302;
 				}
@@ -54361,7 +54362,7 @@
 	assert(pageListIsWellFormed());
 	
 	if (GIV(fullGCLock) > 0) {
-		GIV(primFailCode) = PrimErrInappropriate;
+		(GIV(primFailCode) = PrimErrInappropriate);
 		return;
 	}
 	incrementalGC();

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2014-09-07 03:45:50 UTC (rev 3071)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2014-09-08 22:20:18 UTC (rev 3072)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
  */
 
 

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-09-07 03:45:50 UTC (rev 3071)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-09-08 22:20:18 UTC (rev 3072)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
    from
-	CoInterpreter VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
+	CoInterpreter VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -2091,7 +2091,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.865";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.876";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -4892,6 +4892,7 @@
 							GIV(framePointer) = localFP;
 							
 							ceEnterCogCodePopReceiverReg();
+							null;
 							goto l303;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -4909,7 +4910,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-					/* return self */
+					null;
 				l303:	/* end baseFrameReturn */;
 					goto l302;
 				}
@@ -54370,7 +54371,7 @@
 	assert(pageListIsWellFormed());
 	
 	if (GIV(fullGCLock) > 0) {
-		GIV(primFailCode) = PrimErrInappropriate;
+		(GIV(primFailCode) = PrimErrInappropriate);
 		return;
 	}
 	incrementalGC();

Modified: branches/Cog/nsspursrc/vm/cogit.c
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.c	2014-09-07 03:45:50 UTC (rev 3071)
+++ branches/Cog/nsspursrc/vm/cogit.c	2014-09-08 22:20:18 UTC (rev 3072)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648
+	CCodeGenerator VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648
+	StackToRegisterMappingCogit VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -119,6 +119,7 @@
 #define AddRR 84
 #define AlignmentNops 2
 #define AltBlockCreationBytecodeSize 3
+#define AltFirstSpecialSelector 80
 #define AltNSSendIsPCAnnotated 0
 #define AndCqR 93
 #define AndCwR 100
@@ -184,6 +185,7 @@
 #define FirstAnnotation 64
 #define FirstJump 12
 #define FirstShortJump 15
+#define FirstSpecialSelector 176
 #define FoxCallerSavedIP 4
 #define FoxMethod -4
 #define FoxMFReceiver -12
@@ -380,6 +382,7 @@
 
 static sqInt abstractRegisterForConcreteRegister(AbstractInstruction * self_in_abstractRegisterForConcreteRegister, sqInt reg) NoDbgRegParms;
 static AbstractInstruction * addDependent(AbstractInstruction * self_in_addDependent, AbstractInstruction *anInstruction) NoDbgRegParms;
+static sqInt availableRegisterOrNilFor(AbstractInstruction * self_in_availableRegisterOrNilFor, sqInt liveRegsMask) NoDbgRegParms;
 static sqInt computeJumpTargetOffsetPlus(AbstractInstruction * self_in_computeJumpTargetOffsetPlus, sqInt anPCOffset) NoDbgRegParms;
 static sqInt concretizeLabel(AbstractInstruction * self_in_concretizeLabel) NoDbgRegParms;
 static sqInt genAlignCStackSavingRegistersnumArgswordAlignment(AbstractInstruction * self_in_genAlignCStackSavingRegistersnumArgswordAlignment, sqInt saveRegs, sqInt numArgs, sqInt alignment) NoDbgRegParms;
@@ -487,7 +490,6 @@
 static sqInt concretizeXCHGRR(AbstractInstruction * self_in_concretizeXCHGRR) NoDbgRegParms;
 static sqInt concretizeXorCwR(AbstractInstruction * self_in_concretizeXorCwR) NoDbgRegParms;
 static sqInt concretizeXorRR(AbstractInstruction * self_in_concretizeXorRR) NoDbgRegParms;
-static sqInt counterTargetFromFollowingAddress(AbstractInstruction * self_in_counterTargetFromFollowingAddress, sqInt nextInstructionAddress) NoDbgRegParms;
 static sqInt cResultRegister(AbstractInstruction * self_in_cResultRegister) NoDbgRegParms;
 static void dispatchConcretize(AbstractInstruction * self_in_dispatchConcretize) NoDbgRegParms;
 static AbstractInstruction * genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder) NoDbgRegParms;
@@ -975,7 +977,6 @@
 static sqInt genPushConstantOneBytecode(void);
 static sqInt genPushConstantTrueBytecode(void);
 static sqInt genPushConstantZeroBytecode(void);
-static sqInt genPushExplicitOuterReceiverBytecode(void);
 static sqInt genPushLiteralConstantBytecode(void);
 static sqInt genPushLiteralIndex(sqInt literalIndex) NoDbgRegParms;
 static sqInt genPushLiteralVariable16CasesBytecode(void);
@@ -1398,7 +1399,7 @@
 	{ duplicateTopBytecode, 0, needsFrameNever, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
 	{ genPushActiveContextBytecode, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
 	{ genPushNewArrayBytecode, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0 },
-	{ genPushExplicitOuterReceiverBytecode, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0 },
+	{ callPrimitiveBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 },
 	{ genPushRemoteTempLongBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 },
 	{ genStoreRemoteTempLongBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 },
 	{ genStoreAndPopRemoteTempLongBytecode, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 },
@@ -2106,6 +2107,7 @@
 #define ceCheckFeatures() ceCheckFeaturesFunction()
 #define ceReturnToInterpreterPC() ((usqInt)ceReturnToInterpreterTrampoline)
 #define cFramePointerAddress() ((unsigned long)&CFramePointer)
+#define compileSendTrace() (traceFlags & 2)
 #define cr() putchar('\n')
 #define cStackPointerAddress() ((unsigned long)&CStackPointer)
 #define dynSuperEntryOffset() cmDynSuperEntryOffset
@@ -2195,6 +2197,31 @@
 }
 
 
+/*	Answer an unused abstract register in the liveRegMask.
+	Subclasses with more registers can override to answer them. */
+
+static sqInt
+availableRegisterOrNilFor(AbstractInstruction * self_in_availableRegisterOrNilFor, sqInt liveRegsMask)
+{
+	if (!(liveRegsMask & (registerMaskFor(Arg1Reg)))) {
+		return Arg1Reg;
+	}
+	if (!(liveRegsMask & (registerMaskFor(Arg0Reg)))) {
+		return Arg0Reg;
+	}
+	if (!(liveRegsMask & (registerMaskFor(SendNumArgsReg)))) {
+		return SendNumArgsReg;
+	}
+	if (!(liveRegsMask & (registerMaskFor(ClassReg)))) {
+		return ClassReg;
+	}
+	if (!(liveRegsMask & (registerMaskFor(ReceiverResultReg)))) {
+		return ReceiverResultReg;
+	}
+	return null;
+}
+
+
 /*	Since it's an extraction from other methods. */
 
 static sqInt
@@ -4687,17 +4714,6 @@
 }
 
 
-/*	Answer the address of the MoveAw:R or MoveR:Aw: instruction preceeding
-	nextInstructionAddress 
- */
-
-static sqInt
-counterTargetFromFollowingAddress(AbstractInstruction * self_in_counterTargetFromFollowingAddress, sqInt nextInstructionAddress)
-{
-	return literalBeforeFollowingAddress(self_in_counterTargetFromFollowingAddress, nextInstructionAddress);
-}
-
-
 /*	Answer the abstract register for the C result register.
 	Only partially implemented. Works on x86 since TempReg = EAX = C result
 	reg.  */
@@ -8675,7 +8691,6 @@
 					? nExts + 1
 					: 0);
 			}
-			/* begin maybeRememberPrevMap:absPCMcpc: */
 		}
 		else {
 			mcpc1 += (mapByte >= DisplacementX2N
@@ -10181,7 +10196,7 @@
 	genoperand(JumpNonZero, ((sqInt)sendMiss));
 	/* begin Label */
 	noCheckEntry = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
-	if (recordSendTrace()) {
+	if (compileSendTrace()) {
 		CallRT(ceTraceLinkedSendTrampoline);
 	}
 }
@@ -10607,7 +10622,7 @@
 	}
 	(method->cmUsageCount = initialMethodUsageCount());
 	(method->cpicHasMNUCase = 0);
-	(method->cmUsesPenultimateLit = maxLitIndex >= ((literalCountOfHeader(methodHeader)) - 2));
+	(method->cmUsesPenultimateLit = maxLitIndex >= ((literalCountOfMethodHeader(methodHeader)) - 2));
 	(method->blockEntryOffset = (blockEntryLabel != null
 		? ((blockEntryLabel->address)) - (((sqInt)method))
 		: 0));
@@ -13146,7 +13161,6 @@
 					? nExts + 1
 					: 0);
 			}
-			/* begin maybeRememberPrevMap:absPCMcpc: */
 		}
 		else {
 			mcpc += (mapByte >= DisplacementX2N
@@ -13175,14 +13189,14 @@
     sqInt li;
     sqInt numLitsA;
 
-	headerA = headerOf(methodA);
-	headerB = headerOf(methodB);
-	numLitsA = literalCountOfHeader(headerA);
+	headerA = methodHeaderOf(methodA);
+	headerB = methodHeaderOf(methodB);
+	numLitsA = literalCountOfMethodHeader(headerA);
 	endPCA = endPCOf(methodA);
 	if (((argumentCountOfMethodHeader(headerA)) != (argumentCountOfMethodHeader(headerB)))
 	 || (((temporaryCountOfMethodHeader(headerA)) != (temporaryCountOfMethodHeader(headerB)))
 	 || (((primitiveIndexOfMethodheader(methodA, headerA)) != (primitiveIndexOfMethodheader(methodB, headerB)))
-	 || ((numLitsA != (literalCountOfHeader(headerB)))
+	 || ((numLitsA != (literalCountOfMethodHeader(headerB)))
 	 || (endPCA > (numBytesOf(methodB))))))) {
 		return 0;
 	}
@@ -13235,7 +13249,7 @@
 static sqInt
 noAssertMethodClassAssociationOf(sqInt methodPointer)
 {
-	return literalofMethod((literalCountOfHeader(noAssertHeaderOf(methodPointer))) - 1, methodPointer);
+	return literalofMethod((literalCountOfMethodHeader(noAssertHeaderOf(methodPointer))) - 1, methodPointer);
 }
 
 
@@ -18440,9 +18454,13 @@
 }
 
 
-/*	249		11111001	i i i i i i i i	jjjjjjjj		Call Primitive #iiiiiiii +
+/*	V3PlusClosures:	139 10001011	iiiiiiii jjjjjjjj Call Primitive #iiiiiiii +
 	(jjjjjjjj * 256)
- */
+	NewsqueakV4:		249 11111001	iiiiiiii jjjjjjjj Call Primitive #iiiiiiii +
+	(jjjjjjjj * 256)
+	SistaV1:			248 11111000 iiiiiiii mjjjjjjj Call Primitive #iiiiiiii + (
+	jjjjjjj * 256)
+	m=1 means inlined primitive, no hard return after execution. */
 
 static sqInt
 callPrimitiveBytecode(void)
@@ -19561,20 +19579,7 @@
 	return genPushLiteral(((0 << 1) | 1));
 }
 
-
-/*	Uncached push explicit outer send receiver */
-
 static sqInt
-genPushExplicitOuterReceiverBytecode(void)
-{
-    sqInt levelOop;
-
-	levelOop = getLiteral(byte1);
-	assert((levelOop & 1));
-	return genPushExplicitOuterReceiver((levelOop >> 1));
-}
-
-static sqInt
 genPushLiteralConstantBytecode(void)
 {
 	return genPushLiteralIndex(byte0 & 0x1F);
@@ -19783,8 +19788,8 @@
     sqInt selector;
 
 	index = byte0 - ((bytecodeSetOffset == 256
-		? 80 + 256
-		: 176));
+		? AltFirstSpecialSelector + 256
+		: FirstSpecialSelector));
 	selector = specialSelector(index);
 	numArgs = specialSelectorNumArgs(index);
 	return genSendnumArgs(selector, numArgs);
@@ -20575,7 +20580,7 @@
 	if (!needsFrame) {
 		return 0;
 	}
-	methodHeader = headerOf(methodObj);
+	methodHeader = methodHeaderOf(methodObj);
 	
 	/* begin PushR: */
 	genoperand(PushR, FPReg);
@@ -22903,8 +22908,8 @@
 		genoperandoperand(MoveCqR, argInt, Arg0Reg);
 	}
 	genMarshalledSendnumArgs(specialSelector(byte0 - ((bytecodeSetOffset == 256
-		? 80 + 256
-		: 176))), 1);
+		? AltFirstSpecialSelector + 256
+		: FirstSpecialSelector))), 1);
 	jmpTarget(jumpContinue, gLabel());
 	return 0;
 }
@@ -23060,8 +23065,8 @@
 		genoperandoperand(MoveCqR, argInt, Arg0Reg);
 	}
 	return genMarshalledSendnumArgs(specialSelector(byte0 - ((bytecodeSetOffset == 256
-		? 80 + 256
-		: 176))), 1);
+		? AltFirstSpecialSelector + 256
+		: FirstSpecialSelector))), 1);
 }
 
 static sqInt

Modified: branches/Cog/nsspursrc/vm/cogit.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.h	2014-09-07 03:45:50 UTC (rev 3071)
+++ branches/Cog/nsspursrc/vm/cogit.h	2014-09-08 22:20:18 UTC (rev 3072)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648
+	CCodeGenerator VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
  */
 
 
@@ -135,6 +135,7 @@
 #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline
 #define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline)
 #define ceReturnToInterpreterPC() ((usqInt)ceReturnToInterpreterTrampoline)
+#define compileSendTrace() (traceFlags & 2)
 #define dynSuperEntryOffset() cmDynSuperEntryOffset
 #define entryOffset() cmEntryOffset
 #define getCFramePointer() CFramePointer

Modified: branches/Cog/nsspursrc/vm/cointerp.c
===================================================================
--- branches/Cog/nsspursrc/vm/cointerp.c	2014-09-07 03:45:50 UTC (rev 3071)
+++ branches/Cog/nsspursrc/vm/cointerp.c	2014-09-08 22:20:18 UTC (rev 3072)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
    from
-	CoInterpreter VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648
+	CoInterpreter VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.876 uuid: 85989927-97e3-4111-a351-b242bf444291 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -469,7 +469,6 @@
 sqInt getCurrentBytecode(void);
 static sqInt handleForwardedSendFaultForReceiverstackDelta(sqInt forwardedReceiver, sqInt stackDelta) NoDbgRegParms;
 static sqInt handleMNUInMachineCodeToclassForMessage(sqInt selectorIndex, sqInt rcvr, sqInt classForMessage) NoDbgRegParms;
-sqInt headerOf(sqInt methodPointer);
 static sqInt iframeIsBlockActivation(char *theFP) NoDbgRegParms;
 static sqInt iframeReceiver(char *theFP) NoDbgRegParms;
 static sqInt iframeSavedIP(char *theFP) NoDbgRegParms;
@@ -804,6 +803,7 @@
 static sqLong headerWhileForwardingOf(sqInt aCompiledMethodObjOop) NoDbgRegParms;
 sqInt isImmediateClass(sqInt classObj);
 sqInt isReallyYoungObject(sqInt objOop);
+sqInt methodHeaderOf(sqInt methodObj);
 sqLong nullHeaderForMachineCodeMethod(void);
 usqInt scavengeThresholdAddress(void);
 sqInt smallIntegerTag(void);
@@ -1062,6 +1062,8 @@
 static sqInt lengthOfMaybeImmediate(sqInt oop) NoDbgRegParms;
 sqInt lengthOf(sqInt objOop);
 static sqInt lengthOfformat(sqInt objOop, sqInt fmt) NoDbgRegParms;
+sqInt literalCountOfMethodHeader(sqInt header);
+sqInt literalCountOf(sqInt methodPointer);
 void longPrintInstancesOf(sqInt aClassOop);
 void longPrintInstancesWithClassIndex(sqInt classIndex);
 void longPrintReferencesTo(sqInt anOop);
@@ -1080,6 +1082,7 @@
 static void nilUnmarkedWeaklingSlots(void) NeverInline;
 static sqInt noCheckClassAtIndex(sqInt classIndex) NoDbgRegParms;
 static sqInt noCheckPushonObjStack(sqInt objOop, sqInt objStack) NoDbgRegParms;
+static sqInt noFixupFollowFieldofObject(sqInt fieldIndex, sqInt anObject) NoDbgRegParms;
 sqInt nonIndexablePointerFormat(void);
 static sqInt noUnscannedEphemerons(void);
 sqInt numBytesOf(sqInt objOop);
@@ -1130,7 +1133,6 @@
 void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress);
 sqInt shouldRemapObj(sqInt objOop);
 sqInt shouldRemapOop(sqInt oop);
-static sqInt sixtyFourBitIndexableFormat(void);
 static usqInt sizeOfFree(sqInt objOop) NoDbgRegParms;
 static sqInt sizeOfObjStack(sqInt objStack) NoDbgRegParms;
 sqInt slotSizeOf(sqInt oop);
@@ -1283,7 +1285,7 @@
 static usqInt iframeMethod(char *theFP) NoDbgRegParms;
 static sqInt imageFormatVersion(void);
 sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass);
-sqInt initialPCForHeadermethod(sqInt methodHeader, sqInt theMethod);
+static sqInt initialPCForHeadermethod(sqInt methodHeader, sqInt theMethod) NoDbgRegParms;
 sqInt integerArg(sqInt index);
 void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean);
 static sqInt isBaseFrame(char *theFP) NoDbgRegParms;
@@ -1302,8 +1304,6 @@
 sqInt isKindOf(sqInt oop, char *className);
 sqInt isMemberOf(sqInt oop, char *className);
 static sqInt lengthOfNameOfClass(sqInt classOop) NoDbgRegParms;
-sqInt literalCountOfHeader(sqInt headerPointer);
-sqInt literalCountOf(sqInt methodPointer);
 sqInt literalofMethod(sqInt offset, sqInt methodPointer);
 sqInt loadBitBltFrom(sqInt bb);
 void loadInitialContext(void);
@@ -1324,6 +1324,7 @@
 sqInt methodClassAssociationOf(sqInt methodPointer);
 sqInt methodClassOf(sqInt methodPointer);
 static sqInt methodHeaderHasPrimitive(sqInt methodHeader) NoDbgRegParms;
+static sqInt methodHeaderIndicatesLargeFrame(sqInt methodHeader) NoDbgRegParms;
 sqInt methodPrimitiveIndex(void);
 sqInt methodReturnValue(sqInt oop);
 sqInt methodUsesAlternateBytecodeSet(sqInt aMethodObj);
@@ -1396,6 +1397,8 @@
 static sqInt removeFirstLinkOfList(sqInt aList) NoDbgRegParms;
 EXPORT(sqInt) returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext);
 static sqInt reverseDisplayFromto(sqInt startIndex, sqInt endIndex) NoDbgRegParms;
+static sqInt safeMethodClassOf(sqInt methodPointer) NoDbgRegParms;
+static sqInt saneMethodClassAssociationInnumLiterals(sqInt methodObj, sqInt numLiterals) NoDbgRegParms;
 void setBreakSelector(char *aString);
 void setFullScreenFlag(sqInt value);
 EXPORT(void (*setInterruptCheckChain(void (*aFunction)(void)))()) ;
@@ -1504,8 +1507,8 @@
 _iss usqInt freeStart;
 _iss sqInt argumentCount;
 _iss usqInt instructionPointer;
+_iss usqInt newMethod;
 _iss sqInt messageSelector;
-_iss usqInt newMethod;
 _iss usqInt newSpaceLimit;
 _iss StackPage * pages;
 _iss sqInt hiddenRootsObj;
@@ -1517,6 +1520,7 @@
 _iss sqInt falseObj;
 _iss sqInt remapBufferCount;
 _iss usqInt totalFreeOldSpace;
+_iss usqInt newSpaceStart;
 _iss sqInt bytesPerPage;
 _iss sqInt numSegments;
 _iss sqInt traceLogIndex;
@@ -1534,7 +1538,6 @@
 _iss StackPage * mostRecentlyUsedPage;
 _iss sqInt numStackPages;
 _iss SpurNewSpaceSpace pastSpace;
-_iss usqInt newSpaceStart;
 _iss sqInt classTableFirstPage;
 _iss usqInt oldSpaceStart;
 _iss sqInt markStack;
@@ -1585,6 +1588,7 @@
 _iss sqInt externalPrimitiveTableFirstFreeIndex;
 _iss sqInt flagInterpretedMethods;
 _iss sqInt gcMode;
+_iss sqInt thisClassIndex;
 _iss sqInt firstSegmentSize;
 _iss usqLong gcStartUsecs;
 _iss sqInt noThreadingOfGUIThread;
@@ -1592,7 +1596,6 @@
 _iss sqInt processHasThreadId;
 _iss sqInt shrinkThreshold;
 _iss usqLong statIOProcessEvents;
-_iss sqInt thisClassIndex;
 _iss sqInt lastHash;
 _iss sqInt longRunningPrimitiveCheckSequenceNumber;
 _iss sqInt marking;
@@ -1704,10 +1707,10 @@
 sqInt extraVMMemory;
 sqInt desiredCogCodeSize;
 sqInt breakSelectorLength = -1;
+usqInt heapBase;
 void * showSurfaceFn;
 char * breakSelector;
 sqInt deferDisplayUpdates;
-usqInt heapBase;
 struct VirtualMachine* interpreterProxy;
 static void (*interruptCheckChain)(void) = 0;
 sqInt suppressHeartbeatFlag;
@@ -2301,7 +2304,7 @@
 /*140*/	-1, 1,-1, 1, 0, 0,-1,-1, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
 /*160*/	0, 0,-1,-1,-1, 1, 1,-1, 1, 0, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1,
 /*180*/	0,-1,-1, 0, 1, 0, 1, 1, 1, 0,-1,-1,-1,-1,-1, 1, 2,-1,-1,-1,
-/*200*/	0, 2, 2, 2, 2, 2, 2,-1,-1,-1, 1, 1, 1, 0,-1,-1,-1,-1, 3,-1,
+/*200*/	-1, 2, 2, 2, 2, 2, 2,-1,-1,-1, 1, 1, 1, 1,-1, 1,-1,-1, 3,-1,
 /*220*/	-1, 2, 2,-1,-1,-1,-1,-1,-1,-1, 0,-1, 2, 0,-1,-1,-1,-1,-1,-1,
 /*240*/	-1,-1, 0,-1,-1,-1,-1,-1,-1, 0,-1, 0, 1,-1, 0,-1,-1,-1,-1,-1,
 /*260*/	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
@@ -2321,7 +2324,7 @@
 /*540*/	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
 /*560*/	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1
 	};
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.848";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.876";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -2343,6 +2346,7 @@
 #define getCodeCompactionMSecs() integerObjectOf((GIV(statCodeCompactionUsecs) + 500) / 1000)
 #define getCogCodeSize() integerObjectOf(GIV(cogCodeSize))
 #define getDesiredCogCodeSize() integerObjectOf(desiredCogCodeSize)
+#define heapBase() heapBase
 #define initialEnterSmalltalkExecutive() enterSmalltalkExecutiveImplementation()
 #define primTraceLogIndex(aValue) (GIV(primTraceLogIndex) = (aValue))
 #define setDesiredCogCodeSize(dccs) (desiredCogCodeSize = (dccs))
@@ -5147,7 +5151,7 @@
 				ctxtOrNilOrZero = findMethodWithPrimitiveFromFPUpToContext(198, GIV(framePointer), home);
 				if (ctxtOrNilOrZero == 0) {
 					theMethod = longAt((home + (BaseHeaderSize)) + (MethodIndex << 2));
-					if ((primitiveIndexOfMethodheader(theMethod, headerOf(theMethod))) == 198) {
+					if ((primitiveIndexOfMethodheader(theMethod, methodHeaderOf(theMethod))) == 198) {
 						unwindContextOrNilOrZero = home;
 						goto l288;
 					}
@@ -5400,7 +5404,7 @@
 				assert((((usqInt)(longAt(localFP + FoxMethod)))) >= (startOfMemory()));
 				GIV(method) = longAt(localFP + FoxMethod);
 				assert(isOopCompiledMethod(GIV(method)));
-				GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(headerOf(GIV(method)))
+				GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(methodHeaderOf(GIV(method)))
 					? 256
 					: 0);
 
@@ -5612,6 +5616,7 @@
 							GIV(framePointer) = localFP;
 							
 							ceEnterCogCodePopReceiverReg();
+							null;
 							goto l292;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -5621,7 +5626,7 @@
 					assert((((usqInt)(longAt(localFP + FoxMethod)))) >= (startOfMemory()));
 					GIV(method) = longAt(localFP + FoxMethod);
 					assert(isOopCompiledMethod(GIV(method)));
-					GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(headerOf(GIV(method)))
+					GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(methodHeaderOf(GIV(method)))
 						? 256
 						: 0);
 
@@ -5629,7 +5634,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-					/* return self */
+					null;
 				l292:	/* end baseFrameReturn */;
 					goto l291;
 				}
@@ -5668,7 +5673,7 @@
 				assert((((usqInt)(longAt(localFP + FoxMethod)))) >= (startOfMemory()));
 				GIV(method) = longAt(localFP + FoxMethod);
 				assert(isOopCompiledMethod(GIV(method)));
-				GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(headerOf(GIV(method)))
+				GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(methodHeaderOf(GIV(method)))
 					? 256
 					: 0);
 
@@ -6112,7 +6117,6 @@
 				l297:	/* end inlineLookupInMethodCacheSel:classTag: */;
 					if (ok) {
 						/* begin ifAppropriateCompileToNativeCode:selector: */
-						VM_LABEL(0ifAppropriateCompileToNativeCodeselector);
 						methodHeader2 = longAt((GIV(newMethod) + (BaseHeaderSize)) + (HeaderIndex << 2));
 						if (isCogMethodReference(methodHeader2)) {
 
@@ -6124,9 +6128,7 @@
 							}
 						}
 						else {
-							if ((((((sqInt) methodHeader2)) < 0
-	? (((usqInt) methodHeader2) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader2) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
+							if ((literalCountOfMethodHeader(methodHeader2)) <= maxLiteralCountForCompile) {
 								cogselector(GIV(newMethod), GIV(messageSelector));
 							}
 							else {
@@ -6152,7 +6154,6 @@
 							}
 							if (lookupInMethodCacheSelclassTag(GIV(messageSelector), lkupClassTag)) {
 								/* begin ifAppropriateCompileToNativeCode:selector: */
-								VM_LABEL(1ifAppropriateCompileToNativeCodeselector);
 								methodHeader1 = longAt((GIV(newMethod) + (BaseHeaderSize)) + (HeaderIndex << 2));
 								if (isCogMethodReference(methodHeader1)) {
 
@@ -6164,9 +6165,7 @@
 									}
 								}
 								else {
-									if ((((((sqInt) methodHeader1)) < 0
-	? (((usqInt) methodHeader1) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader1) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
+									if ((literalCountOfMethodHeader(methodHeader1)) <= maxLiteralCountForCompile) {
 										cogselector(GIV(newMethod), GIV(messageSelector));
 									}
 									else {
@@ -6260,7 +6259,7 @@
 						 && ((!(!GIV(primFailCode)))
 						 && ((((GIV(newMethod) & 3) == 0)
 						 && (((((usqInt) (longAt(GIV(newMethod)))) >> 24) & 0x1F) >= 24))
-						 && (checkForAndFollowForwardedPrimitiveStateFor(primitiveIndexOfMethodheader(GIV(newMethod), headerOf(GIV(newMethod)))))))) {
+						 && (checkForAndFollowForwardedPrimitiveStateFor(primitiveIndexOfMethodheader(GIV(newMethod), methodHeaderOf(GIV(newMethod)))))))) {
 							/* begin initPrimCall */
 							GIV(primFailCode) = 0;
 							dispatchFunctionPointer(primitiveFunctionPointer);
@@ -6342,7 +6341,7 @@
 						/* begin setMethod:methodHeader: */
 						GIV(method) = GIV(newMethod);
 						assert(isOopCompiledMethod(GIV(method)));
-						assert((headerOf(GIV(method))) == methodHeader);
+						assert((methodHeaderOf(GIV(method))) == methodHeader);
 						GIV(bytecodeSetSelector) = ((((sqInt) methodHeader)) < 0
 							? 256
 							: 0);
@@ -6362,19 +6361,13 @@
 							/* begin internalPush: */
 							longAtPointerput((localSP -= BytesPerOop), GIV(nilObj));
 						}
-						localIP = pointerForOop(((GIV(newMethod) + ((LiteralStart + (((((sqInt) methodHeader)) < 0
-	? (((usqInt) methodHeader) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader) >> 10) & 0xFF))) * BytesPerOop)) + (BaseHeaderSize)) - 1);
-						if (((((sqInt) methodHeader)) < 0
-														? methodHeader & (65536 << SmallIntegerShift)
-														: (methodHeader & 536871934) != 0)) {
+						localIP = pointerForOop((initialPCForHeadermethod(methodHeader, GIV(newMethod))) - 1);
+						if (methodHeader & (65536 << SmallIntegerShift)) {
 
 							/* Skip the CallPrimitive bytecode, if it's there, and store the error code if the method starts
 							   with a long store temp.  Strictly no need to skip the store because it's effectively a noop. */
 
-							localIP += ((((sqInt) methodHeader)) < 0
-																? 3
-																: 0);
+							localIP += 3;
 							if (GIV(primFailCode) != 0) {
 								if ((byteAt(localIP + 1)) == (((((sqInt) methodHeader)) < 0
 		? AltLongStoreBytecode
@@ -7481,7 +7474,7 @@
 	? (FoxIFrameFlags + BytesPerWord) - 1
 	: FoxIFrameFlags)));
 				if (((backwardJumpCountByte -= 2)) == 1) {
-					if (methodWithHeaderShouldBeCogged(headerOf(GIV(method)))) {
+					if (methodWithHeaderShouldBeCogged(methodHeaderOf(GIV(method)))) {
 						/* begin externalizeIPandSP */
 						assert((((usqInt)localIP)) != (ceReturnToInterpreterPC()));
 						GIV(instructionPointer) = oopForPointer(localIP);
@@ -9569,11 +9562,11 @@
 							if ((fmt >= 9)
 							 || (fmt == 2)) {
 								fixedFields = 0;
-								goto l112;
+								goto l108;
 							}
 							if (fmt < 2) {
 								fixedFields = totalLength;
-								goto l112;
+								goto l108;
 							}
 							/* begin fetchClassOfNonImm: */
 							VM_LABEL(0fetchClassOfNonImm);
@@ -9581,11 +9574,11 @@
 							if (classIndex <= 0x1F) {
 								if (classIndex == 0x1F) {
 									class = rcvr;
-									goto l105;
+									goto l112;
 								}
 								if (classIndex == 8) {
 									class = GIV(nilObj);
-									goto l105;
+									goto l112;
 								}
 							}
 							assert(classIndex >= (arrayClassIndexPun()));
@@ -9596,12 +9589,12 @@
 							classTablePage = longAt((GIV(hiddenRootsObj) + (BaseHeaderSize)) + ((((usqInt) classIndex) >> 10) << 2));
 							if (classTablePage == GIV(nilObj)) {
 								class = GIV(nilObj);
-								goto l105;
+								goto l112;
 							}
 							class = longAt((classTablePage + (BaseHeaderSize)) + ((classIndex & ((1 << 10) - 1)) << 2));
-						l105:	/* end fetchClassOfNonImm: */;
+						l112:	/* end fetchClassOfNonImm: */;
 							fixedFields = (((longAt((class + (BaseHeaderSize)) + (InstanceSpecificationIndex << 2))) >> 1)) & ((1 << 16) - 1);
-						l112:	/* end fixedFieldsOf:format:length: */;
+						l108:	/* end fixedFieldsOf:format:length: */;
 
 							GIV(atCache)[atIx + AtCacheOop] = rcvr;
 							GIV(atCache)[atIx + AtCacheFmt] = fmt;
@@ -9671,7 +9664,7 @@
 								assert(!(isContextNonImm(rcvr)));
 								fixedFields2 = GIV(atCache)[atIx + AtCacheFixedFields];
 								result = longAt((rcvr + (BaseHeaderSize)) + (((((index >> 1)) + fixedFields2) - 1) << 2));
-								goto l111;
+								goto l105;
 							}
 							if (fmt2 < 16) {
 
@@ -9679,7 +9672,7 @@
 
 								result1 = long32At((rcvr + (BaseHeaderSize)) + ((((index >> 1)) - 1) << 2));
 								result = positive32BitIntegerFor(result1);
-								goto l111;
+								goto l105;
 							}
 							if (fmt2 >= 32) {
 
@@ -9697,13 +9690,13 @@
 										/* begin characterTable */
 										error("shouldNotImplement"),
 										longAt((objOop + (BaseHeaderSize)) + (result1 << 2))));
-								goto l111;
+								goto l105;
 							}
 							else {
 								if ((fmt2 < 24)
-								 || (((index >> 1)) >= ((((literalCountOfHeader(headerOf(rcvr))) + LiteralStart) * BytesPerOop) + 1))) {
+								 || (((index >> 1)) >= ((((literalCountOf(rcvr)) + LiteralStart) * BytesPerOop) + 1))) {
 									result = (((byteAt((rcvr + (BaseHeaderSize)) + (((index >> 1)) - 1))) << 1) | 1);
-									goto l111;
+									goto l105;
 								}
 							}
 						}
@@ -9712,7 +9705,7 @@
 							? PrimErrBadIndex
 							: PrimErrBadReceiver);
 						result = (GIV(primFailCode) = reasonCode);
-					l111:	/* end commonVariable:at:cacheIndex: */;
+					l105:	/* end commonVariable:at:cacheIndex: */;
 					}
 					if (!GIV(primFailCode)) {
 						/* begin fetchNextBytecode */
@@ -9977,7 +9970,7 @@
 							}
 							else {
 								if ((fmt2 >= 24)
-								 && (((index >> 1)) < ((((literalCountOfHeader(headerOf(rcvr))) + LiteralStart) * BytesPerOop) + 1))) {
+								 && (((index >> 1)) < ((((literalCountOf(rcvr)) + LiteralStart) * BytesPerOop) + 1))) {
 									GIV(primFailCode) = PrimErrBadIndex;
 									goto l117;
 								}
@@ -12603,11 +12596,11 @@
 							if ((fmt >= 9)
 							 || (fmt == 2)) {
 								fixedFields = 0;
-								goto l237;
+								goto l233;
 							}
 							if (fmt < 2) {
 								fixedFields = totalLength;
-								goto l237;
+								goto l233;
 							}
 							/* begin fetchClassOfNonImm: */
 							VM_LABEL(2fetchClassOfNonImm);
@@ -12615,11 +12608,11 @@
 							if (classIndex <= 0x1F) {
 								if (classIndex == 0x1F) {
 									class = rcvr;
-									goto l230;
+									goto l237;
 								}
 								if (classIndex == 8) {
 									class = GIV(nilObj);
-									goto l230;
+									goto l237;
 								}
 							}
 							assert(classIndex >= (arrayClassIndexPun()));
@@ -12630,12 +12623,12 @@
 							classTablePage = longAt((GIV(hiddenRootsObj) + (BaseHeaderSize)) + ((((usqInt) classIndex) >> 10) << 2));
 							if (classTablePage == GIV(nilObj)) {
 								class = GIV(nilObj);
-								goto l230;
+								goto l237;
 							}
 							class = longAt((classTablePage + (BaseHeaderSize)) + ((classIndex & ((1 << 10) - 1)) << 2));
-						l230:	/* end fetchClassOfNonImm: */;
+						l237:	/* end fetchClassOfNonImm: */;
 							fixedFields = (((longAt((class + (BaseHeaderSize)) + (InstanceSpecificationIndex << 2))) >> 1)) & ((1 << 16) - 1);
-						l237:	/* end fixedFieldsOf:format:length: */;
+						l233:	/* end fixedFieldsOf:format:length: */;
 
 							GIV(atCache)[atIx + AtCacheOop] = rcvr;
 							GIV(atCache)[atIx + AtCacheFmt] = fmt;
@@ -12705,7 +12698,7 @@
 								assert(!(isContextNonImm(rcvr)));
 								fixedFields2 = GIV(atCache)[atIx + AtCacheFixedFields];
 								result = longAt((rcvr + (BaseHeaderSize)) + (((((index >> 1)) + fixedFields2) - 1) << 2));
-								goto l236;
+								goto l230;
 							}
 							if (fmt2 < 16) {
 
@@ -12713,7 +12706,7 @@
 
 								result1 = long32At((rcvr + (BaseHeaderSize)) + ((((index >> 1)) - 1) << 2));
 								result = positive32BitIntegerFor(result1);
-								goto l236;
+								goto l230;
 							}
 							if (fmt2 >= 32) {
 
@@ -12731,13 +12724,13 @@
 										/* begin characterTable */
 										error("shouldNotImplement"),
 										longAt((objOop + (BaseHeaderSize)) + (result1 << 2))));
-								goto l236;
+								goto l230;
 							}
 							else {
 								if ((fmt2 < 24)
-								 || (((index >> 1)) >= ((((literalCountOfHeader(headerOf(rcvr))) + LiteralStart) * BytesPerOop) + 1))) {
+								 || (((index >> 1)) >= ((((literalCountOf(rcvr)) + LiteralStart) * BytesPerOop) + 1))) {
 									result = (((byteAt((rcvr + (BaseHeaderSize)) + (((index >> 1)) - 1))) << 1) | 1);
-									goto l236;
+									goto l230;
 								}
 							}
 						}
@@ -12746,7 +12739,7 @@
 							? PrimErrBadIndex
 							: PrimErrBadReceiver);
 						result = (GIV(primFailCode) = reasonCode);
-					l236:	/* end commonVariable:at:cacheIndex: */;
+					l230:	/* end commonVariable:at:cacheIndex: */;
 					}
 					if (!GIV(primFailCode)) {
 						/* begin fetchNextBytecode */
@@ -13011,7 +13004,7 @@
 							}
 							else {
 								if ((fmt2 >= 24)
-								 && (((index >> 1)) < ((((literalCountOfHeader(headerOf(rcvr))) + LiteralStart) * BytesPerOop) + 1))) {
+								 && (((index >> 1)) < ((((literalCountOf(rcvr)) + LiteralStart) * BytesPerOop) + 1))) {
 									GIV(primFailCode) = PrimErrBadIndex;
 									goto l242;
 								}
@@ -14707,7 +14700,7 @@
 	? (FoxIFrameFlags + BytesPerWord) - 1
 	: FoxIFrameFlags)));
 				if (((backwardJumpCountByte -= 2)) == 1) {
-					if (methodWithHeaderShouldBeCogged(headerOf(GIV(method)))) {
+					if (methodWithHeaderShouldBeCogged(methodHeaderOf(GIV(method)))) {
 						/* begin externalizeIPandSP */

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list