[Vm-dev] [commit] r2585 - Cog VM source as per VMMaker.oscog-eem.201.

commits at squeakvm.org commits at squeakvm.org
Tue Aug 14 16:06:46 UTC 2012


Author: eliot
Date: 2012-08-14 09:06:45 -0700 (Tue, 14 Aug 2012)
New Revision: 2585

Modified:
   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/platforms/Cross/vm/sqSCCSVersion.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
Log:
Cog VM source as per VMMaker.oscog-eem.201.

Make sure youngReferrersList has room for every method since become/cache
implicit receiver can cause any method to gain a young reference.  Do so
by counting methods in the zone.  Make overflowing the youngReferrers list
a hard error (appears to happen quite often in Newspeak code).

Fix assert in interpretMethodFromMachineCode.


Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/nscogsrc/vm/cogit.c	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGenerator VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	StackToRegisterMappingCogit VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -555,6 +555,7 @@
 static void freeMethod(CogMethod *cogMethod);
 static void freeOlderMethodsForCompaction(void);
 static void freePICsWithFreedTargets(void);
+static usqInt freeStart(void);
 static sqInt genActiveContextTrampoline(void);
 static sqInt genAddSmallIntegerTagsTo(sqInt aRegister);
 static sqInt genAlignCStackSavingRegistersnumArgswordAlignment(AbstractInstruction * self_in_genAlignCStackSavingRegistersnumArgswordAlignment, sqInt saveRegs, sqInt numArgs, sqInt alignment);
@@ -810,7 +811,7 @@
 static sqInt jumpLongConditionalByteSize(AbstractInstruction * self_in_jumpLongConditionalByteSize);
 static sqInt jumpLongTargetBeforeFollowingAddress(AbstractInstruction * self_in_jumpLongTargetBeforeFollowingAddress, sqInt mcpc);
 static sqInt jumpShortByteSize(AbstractInstruction * self_in_jumpShortByteSize);
-static sqInt jumpTargetAddress(AbstractInstruction * self_in_jumpTargetAddress);
+static AbstractInstruction * jumpTargetAddress(AbstractInstruction * self_in_jumpTargetAddress);
 static sqInt jumpTargetAt(AbstractInstruction * self_in_jumpTargetAt, sqInt pc);
 static sqInt kosherYoungReferrers(void);
 static AbstractInstruction * gLabel(void);
@@ -824,7 +825,7 @@
 static sqInt loadLiteralByteSize(AbstractInstruction * self_in_loadLiteralByteSize);
 static sqInt longBranchDistance(unsigned char byteZero, unsigned char byteOne);
 static sqInt longForwardBranchDistance(unsigned char byteZero, unsigned char byteOne);
-static sqInt longJumpTargetAddress(AbstractInstruction * self_in_longJumpTargetAddress);
+static AbstractInstruction * longJumpTargetAddress(AbstractInstruction * self_in_longJumpTargetAddress);
 static AbstractInstruction * gMoveAwR(sqInt address, sqInt reg);
 static AbstractInstruction * gMoveCwR(sqInt wordConstant, sqInt reg);
 static AbstractInstruction * gMoveMwrR(sqInt offset, sqInt baseReg, sqInt destReg);
@@ -877,6 +878,7 @@
 static sqInt numCheckFeaturesOpcodes(AbstractInstruction * self_in_numCheckFeaturesOpcodes);
 static sqInt numICacheFlushOpcodes(AbstractInstruction * self_in_numICacheFlushOpcodes);
 static sqInt numLowLevelLockOpcodes(AbstractInstruction * self_in_numLowLevelLockOpcodes);
+static sqInt numMethods(void);
 sqInt numMethodsOfType(sqInt cogMethodType);
 static sqInt numSmallIntegerBits(void);
 static sqInt occurrencesInYoungReferrers(CogMethod *cogMethod);
@@ -996,8 +998,6 @@
 void voidCogCompiledCode(void);
 static void voidYoungReferrersPostTenureAll(void);
 static AbstractInstruction * gXorCwR(sqInt wordConstant, sqInt reg);
-static sqInt zoneEnd(void);
-static usqInt zoneLimit(void);
 
 
 /*** Variables ***/
@@ -1359,6 +1359,7 @@
 static CogBlockMethod * maxMethodBefore;
 static sqInt methodAbortTrampolines[4];
 static sqInt methodBytesFreedSinceLastCompaction;
+static sqInt methodCount;
 static AbstractInstruction *methodLabel = &aMethodLabel;
 static sqInt methodObj;
 static sqInt methodOrBlockNumArgs;
@@ -1668,7 +1669,6 @@
 #define haltmsg(msg) warning("halt: " msg)
 #define limitZony() ((CogMethod *)mzFreeStart)
 #define maybeConstant(sse) ((sse)->constant)
-#define methodBytesFreedSinceLastCompaction() methodBytesFreedSinceLastCompaction
 #define minCallAddress() minValidCallAddress
 #define nextOpenPIC methodObject
 #define nextOpenPICHack hack hack hack i.e. the getter macro does all the work
@@ -1945,11 +1945,13 @@
     sqInt roundedBytes;
 
 	roundedBytes = (numBytes + 7) & -8;
-	if ((mzFreeStart + roundedBytes) > (youngReferrers - BytesPerWord)) {
+	if ((mzFreeStart + roundedBytes) >= (limitAddress - (methodCount * BytesPerWord))) {
 		return 0;
 	}
 	allocation = mzFreeStart;
 	mzFreeStart += roundedBytes;
+	methodCount += 1;
+	assert(roomOnYoungReferrersList());
 	;
 	return allocation;
 }
@@ -2376,7 +2378,7 @@
 	innerReturn = popStack();
 	targetMethod = ((CogMethod *) (innerReturn - missOffset));
 	outerReturn = stackTop();
-	assert(((outerReturn >= methodZoneBase) && (outerReturn <= (zoneLimit()))));
+	assert(((outerReturn >= methodZoneBase) && (outerReturn <= (freeStart()))));
 	entryPoint = callTargetFromReturnAddress(backEnd, outerReturn);
 	assert(((targetMethod->selector)) != (nilObject()));
 	
@@ -2800,10 +2802,7 @@
 		}
 		cogMethod = methodAfter(cogMethod);
 	}
-	mzFreeStart = baseAddress;
-	youngReferrers = limitAddress;
-	openPICList = null;
-	methodBytesFreedSinceLastCompaction = 0;
+	manageFromto(baseAddress, limitAddress);
 }
 
 
@@ -2964,14 +2963,14 @@
 		cogMethod = methodAfter(cogMethod);
 	}
 	if ((((label = stringForCString("CCFree"))) == null)
-	 || (((value = cePositive32BitIntegerFor(zoneLimit()))) == null)) {
+	 || (((value = cePositive32BitIntegerFor(freeStart()))) == null)) {
 		popRemappableOop();
 		return null;
 	}
 	storePointerUncheckedofObjectwithValue(count, topRemappableOop(), label);
 	storePointerUncheckedofObjectwithValue(count + 1, topRemappableOop(), value);
 	if ((((label = stringForCString("CCEnd"))) == null)
-	 || (((value = cePositive32BitIntegerFor(zoneEnd()))) == null)) {
+	 || (((value = cePositive32BitIntegerFor(limitAddress))) == null)) {
 		popRemappableOop();
 		return null;
 	}
@@ -3090,7 +3089,7 @@
 		if ((((sqInt) ((cogMethod->objectHeader)))) >= 0) {
 			if ((((cogMethod->methodObject)) != 0)
 			 && ((((cogMethod->methodObject)) < methodZoneBase)
-			 || ((((cogMethod->methodObject)) > ((zoneLimit()) - openPICSize))
+			 || ((((cogMethod->methodObject)) > ((freeStart()) - openPICSize))
 			 || (((((cogMethod->methodObject)) & (BytesPerWord - 1)) != 0)
 			 || (((((CogMethod *) ((cogMethod->methodObject)))->cmType)) != CMOpenPIC))))) {
 				return 23;
@@ -3303,7 +3302,7 @@
 	compactCompiledCode(nullHeaderForMachineCodeMethod());
 	assert(allMethodsHaveCorrectHeader());
 	assert(kosherYoungReferrers());
-	flushICacheFromto(processor, methodZoneBase, zoneLimit());
+	flushICacheFromto(processor, methodZoneBase, freeStart());
 }
 
 static void
@@ -3315,6 +3314,7 @@
 
 	source = ((CogMethod *) baseAddress);
 	openPICList = null;
+	methodCount = 0;
 	while ((source < (limitZony()))
 	 && (((source->cmType)) != CMFree)) {
 		assert((cogMethodDoesntLookKosher(source)) == 0);
@@ -3326,6 +3326,7 @@
 			(source->nextOpenPIC = ((usqInt)openPICList));
 			openPICList = source;
 		}
+		methodCount += 1;
 		source = methodAfter(source);
 	}
 	if (source >= (limitZony())) {
@@ -3336,6 +3337,7 @@
 		assert((maybeFreeCogMethodDoesntLookKosher(source)) == 0);
 		bytes = (source->blockSize);
 		if (((source->cmType)) != CMFree) {
+			methodCount += 1;
 			memmove(dest, source, bytes);
 			(dest->objectHeader = objectHeaderValue);
 			if (((dest->cmType)) == CMMethod) {
@@ -7766,18 +7768,28 @@
 freePICsWithFreedTargets(void)
 {
     CogMethod *cogMethod;
+    sqInt count;
 
 	cogMethod = ((CogMethod *) methodZoneBase);
+	count = 0;
 	while (cogMethod < (limitZony())) {
 		if ((((cogMethod->cmType)) == CMClosedPIC)
 		 && (cPICHasFreedTargets(cogMethod))) {
 			(cogMethod->cmType = CMFree);
 		}
 		cogMethod = methodAfter(cogMethod);
+		count += 1;
 	}
+	assert(count == (numMethods()));
 }
 
+static usqInt
+freeStart(void)
+{
+	return mzFreeStart;
+}
 
+
 /*	Short-circuit the interpreter call if a frame is already married. */
 
 static sqInt
@@ -8497,7 +8509,7 @@
 	headerSize = sizeof(CogMethod);
 	(methodLabel->address = -headerSize);
 	computeMaximumSizes();
-	concretizeAt(methodLabel, allocate(0));
+	concretizeAt(methodLabel, freeStart());
 	codeSize = generateInstructionsAt(((methodLabel->address)) + headerSize);
 	mapSize = generateMapAtstart(0, ((methodLabel->address)) + cmNoCheckEntryOffset);
 	totalSize = roundUpLength((headerSize + codeSize) + mapSize);
@@ -13288,7 +13300,7 @@
 sqInt
 isPCWithinMethodZone(char *address)
 {
-	return (((((usqInt)address)) >= methodZoneBase) && ((((usqInt)address)) <= (zoneLimit())));
+	return (((((usqInt)address)) >= methodZoneBase) && ((((usqInt)address)) <= (freeStart())));
 }
 
 static sqInt
@@ -13310,7 +13322,7 @@
 	}
 	target = callTargetFromReturnAddress(backEnd, retpc);
 	return (((target >= firstSend) && (target <= lastSend)))
-	 || (((target >= methodZoneBase) && (target <= (zoneLimit()))));
+	 || (((target >= methodZoneBase) && (target <= (freeStart()))));
 }
 
 static sqInt
@@ -13433,7 +13445,7 @@
 
 /*	Since it's an extraction from other methods. */
 
-static sqInt
+static AbstractInstruction *
 jumpTargetAddress(AbstractInstruction * self_in_jumpTargetAddress)
 {
     AbstractInstruction *jumpTarget;
@@ -13563,7 +13575,7 @@
 
 #  endif /* NewspeakVM */
 
-	assert(((callSiteReturnAddress >= methodZoneBase) && (callSiteReturnAddress <= (zoneLimit()))));
+	assert(((callSiteReturnAddress >= methodZoneBase) && (callSiteReturnAddress <= (freeStart()))));
 	inlineCacheTag = (theEntryOffset == cmNoCheckEntryOffset
 		? (targetMethod->selector)
 		: inlineCacheTagForInstance(receiver));
@@ -13649,7 +13661,7 @@
 	sane. 
  */
 
-static sqInt
+static AbstractInstruction *
 longJumpTargetAddress(AbstractInstruction * self_in_longJumpTargetAddress)
 {
     AbstractInstruction *jumpTarget;
@@ -13715,6 +13727,7 @@
 	youngReferrers = (limitAddress = theLimitAddress);
 	openPICList = null;
 	methodBytesFreedSinceLastCompaction = 0;
+	methodCount = 0;
 }
 
 
@@ -14093,7 +14106,7 @@
 	hasYoungObjPtr = ((sqInt)((&hasYoungObj)));
 	codeModified = 0;
 	pointer = youngReferrers();
-	while (pointer < (zoneEnd())) {
+	while (pointer < limitAddress) {
 		assert(!hasYoungObj);
 		cogMethod = ((CogMethod *) (longAt(pointer)));
 		if (((cogMethod->cmType)) == CMFree) {
@@ -14158,6 +14171,9 @@
 	default:
 		error("Case not found and no otherwise clause");
 	}
+	if (!(asserta((freeStart()) <= (youngReferrers())))) {
+		error("youngReferrers list overflowed");
+	}
 }
 
 static void
@@ -14195,7 +14211,7 @@
 	}
 	codeModified = 0;
 	pointer = youngReferrers();
-	while (pointer < (zoneEnd())) {
+	while (pointer < limitAddress) {
 		cogMethod = ((CogMethod *) (longAt(pointer)));
 		if ((cogMethod->cmRefersToYoung)) {
 			assert((cogMethodDoesntLookKosher(cogMethod)) == 0);
@@ -15024,6 +15040,12 @@
 	return 14;
 }
 
+static sqInt
+numMethods(void)
+{
+	return methodCount;
+}
+
 sqInt
 numMethodsOfType(sqInt cogMethodType)
 {
@@ -16161,19 +16183,33 @@
 	flags = primitivePropertyFlags(primIndex);
 	if ((flags & PrimCallMayCallBack) != 0) {
 		address = (((usqInt)cogMethod)) + (externalPrimJumpOffsets[(cogMethod->cmNumArgs)]);
-		extent = rewriteJumpLongAttarget(backEnd, address, ((sqInt)primFunctionPointer));
+		extent = rewriteJumpLongAttarget(backEnd, address, ((usqInt)primFunctionPointer));
 	}
 	else {
 		address = (((usqInt)cogMethod)) + (externalPrimCallOffsets[(cogMethod->cmNumArgs)]);
-		extent = rewriteCallAttarget(backEnd, address, ((sqInt)primFunctionPointer));
+		extent = rewriteCallAttarget(backEnd, address, ((usqInt)primFunctionPointer));
 	}
 	flushICacheFromto(processor, address, address + extent);
 }
 
+
+/*	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)
 {
-	return (youngReferrers - BytesPerWord) >= mzFreeStart;
+	assert((youngReferrers <= limitAddress)
+	 && (youngReferrers >= (limitAddress - (methodCount * BytesPerWord))));
+	return (limitAddress - (methodCount * BytesPerWord)) >= mzFreeStart;
 }
 
 static sqInt
@@ -17595,15 +17631,3 @@
 {
 	return genoperandoperand(XorCwR, wordConstant, reg);
 }
-
-static sqInt
-zoneEnd(void)
-{
-	return limitAddress;
-}
-
-static usqInt
-zoneLimit(void)
-{
-	return mzFreeStart;
-}

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/nscogsrc/vm/cogit.h	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGenerator VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/nscogsrc/vm/cogmethod.h	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGenerator VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
 
 typedef struct {

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
    from
-	CoInterpreter VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CoInterpreter VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -619,6 +619,7 @@
 sqInt isMarked(sqInt oop);
 static sqInt isMarriedOrWidowedContext(sqInt aContext);
 sqInt isNonIntegerObject(sqInt objectPointer);
+static sqInt isNullExternalPrimitiveCall(sqInt aMethodObj);
 sqInt isOopCompiledMethod(sqInt oop);
 sqInt isPointers(sqInt oop);
 static sqInt isPrimitiveFunctionPointerAnIndex(void);
@@ -1915,7 +1916,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.199";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.201";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -20973,8 +20974,10 @@
 		}
 	}
 	else {
-		assert(((primitiveIndexOf(GIV(newMethod))) == 0)
-		 || ((functionPointerForinClass(primitiveIndexOf(GIV(newMethod)), nilObject())) == 0));
+		assert((isOopCompiledMethod(GIV(newMethod)))
+		 && (((primitiveIndexOf(GIV(newMethod))) == 0)
+		 || (((functionPointerForinClass(primitiveIndexOf(GIV(newMethod)), nilObject())) == 0)
+		 || (isNullExternalPrimitiveCall(GIV(newMethod))))));
 	}
 	activateNewMethod();
 	siglongjmp(reenterInterpreter, ReturnToInterpreter);
@@ -21196,6 +21199,27 @@
 }
 
 
+/*	Answer if the method is an external primtiive call (prim 117) with a null
+	external primtiive.
+	This is just for an assert in the CoInterpreter. */
+
+static sqInt
+isNullExternalPrimitiveCall(sqInt aMethodObj)
+{
+    sqInt lit;
+
+	if (!(((primitiveIndexOf(aMethodObj)) == 117)
+		 && ((literalCountOfHeader(headerOf(aMethodObj))) > 0))) {
+		return 0;
+	}
+	lit = longAt((aMethodObj + BaseHeaderSize) + ((0 + LiteralStart) << ShiftForWord));
+	return (((lit & 1) == 0)
+ && (((((usqInt) (longAt(lit))) >> 8) & 15) == 2))
+	 && (((lengthOf(lit)) == 4)
+	 && ((longAt((lit + BaseHeaderSize) + (3 << ShiftForWord))) == ConstZero));
+}
+
+
 /*	Answer whether the oop is an object of compiled method format */
 
 sqInt

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
 
 

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2012-08-14 16:06:45 UTC (rev 2585)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
    from
-	CoInterpreter VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CoInterpreter VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -622,6 +622,7 @@
 sqInt isMarked(sqInt oop);
 static sqInt isMarriedOrWidowedContext(sqInt aContext);
 sqInt isNonIntegerObject(sqInt objectPointer);
+static sqInt isNullExternalPrimitiveCall(sqInt aMethodObj);
 sqInt isOopCompiledMethod(sqInt oop);
 sqInt isPointers(sqInt oop);
 static sqInt isPrimitiveFunctionPointerAnIndex(void);
@@ -1918,7 +1919,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.199";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.201";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -20977,8 +20978,10 @@
 		}
 	}
 	else {
-		assert(((primitiveIndexOf(GIV(newMethod))) == 0)
-		 || ((functionPointerForinClass(primitiveIndexOf(GIV(newMethod)), nilObject())) == 0));
+		assert((isOopCompiledMethod(GIV(newMethod)))
+		 && (((primitiveIndexOf(GIV(newMethod))) == 0)
+		 || (((functionPointerForinClass(primitiveIndexOf(GIV(newMethod)), nilObject())) == 0)
+		 || (isNullExternalPrimitiveCall(GIV(newMethod))))));
 	}
 	activateNewMethod();
 	siglongjmp(reenterInterpreter, ReturnToInterpreter);
@@ -21200,6 +21203,27 @@
 }
 
 
+/*	Answer if the method is an external primtiive call (prim 117) with a null
+	external primtiive.
+	This is just for an assert in the CoInterpreter. */
+
+static sqInt
+isNullExternalPrimitiveCall(sqInt aMethodObj)
+{
+    sqInt lit;
+
+	if (!(((primitiveIndexOf(aMethodObj)) == 117)
+		 && ((literalCountOfHeader(headerOf(aMethodObj))) > 0))) {
+		return 0;
+	}
+	lit = longAt((aMethodObj + BaseHeaderSize) + ((0 + LiteralStart) << ShiftForWord));
+	return (((lit & 1) == 0)
+ && (((((usqInt) (longAt(lit))) >> 8) & 15) == 2))
+	 && (((lengthOf(lit)) == 4)
+	 && ((longAt((lit + BaseHeaderSize) + (3 << ShiftForWord))) == ConstZero));
+}
+
+
 /*	Answer whether the oop is an object of compiled method format */
 
 sqInt

Modified: branches/Cog/nscogsrc/vm/interp.h
===================================================================
--- branches/Cog/nscogsrc/vm/interp.h	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/nscogsrc/vm/interp.h	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/nscogsrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nscogsrc/vm/vmCallback.h	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/nscogsrc/vm/vmCallback.h	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
 
 #define VM_CALLBACK_INC 1


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Fri Aug 10 16:59:08 PDT 2012
   + Tue Aug 14 09:01:26 PDT 2012

Modified: branches/Cog/src/vm/cogit.c
===================================================================
--- branches/Cog/src/vm/cogit.c	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/src/vm/cogit.c	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGenerator VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	StackToRegisterMappingCogit VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -553,6 +553,7 @@
 static void freeMethod(CogMethod *cogMethod);
 static void freeOlderMethodsForCompaction(void);
 static void freePICsWithFreedTargets(void);
+static usqInt freeStart(void);
 static sqInt genActiveContextTrampoline(void);
 static sqInt genAddSmallIntegerTagsTo(sqInt aRegister);
 static sqInt genAlignCStackSavingRegistersnumArgswordAlignment(AbstractInstruction * self_in_genAlignCStackSavingRegistersnumArgswordAlignment, sqInt saveRegs, sqInt numArgs, sqInt alignment);
@@ -803,7 +804,7 @@
 static sqInt jumpLongConditionalByteSize(AbstractInstruction * self_in_jumpLongConditionalByteSize);
 static sqInt jumpLongTargetBeforeFollowingAddress(AbstractInstruction * self_in_jumpLongTargetBeforeFollowingAddress, sqInt mcpc);
 static sqInt jumpShortByteSize(AbstractInstruction * self_in_jumpShortByteSize);
-static sqInt jumpTargetAddress(AbstractInstruction * self_in_jumpTargetAddress);
+static AbstractInstruction * jumpTargetAddress(AbstractInstruction * self_in_jumpTargetAddress);
 static sqInt jumpTargetAt(AbstractInstruction * self_in_jumpTargetAt, sqInt pc);
 static sqInt kosherYoungReferrers(void);
 static AbstractInstruction * gLabel(void);
@@ -817,7 +818,7 @@
 static sqInt loadLiteralByteSize(AbstractInstruction * self_in_loadLiteralByteSize);
 static sqInt longBranchDistance(unsigned char byteZero, unsigned char byteOne);
 static sqInt longForwardBranchDistance(unsigned char byteZero, unsigned char byteOne);
-static sqInt longJumpTargetAddress(AbstractInstruction * self_in_longJumpTargetAddress);
+static AbstractInstruction * longJumpTargetAddress(AbstractInstruction * self_in_longJumpTargetAddress);
 static AbstractInstruction * gMoveAwR(sqInt address, sqInt reg);
 static AbstractInstruction * gMoveCwR(sqInt wordConstant, sqInt reg);
 static AbstractInstruction * gMoveMwrR(sqInt offset, sqInt baseReg, sqInt destReg);
@@ -868,6 +869,7 @@
 static sqInt numCheckFeaturesOpcodes(AbstractInstruction * self_in_numCheckFeaturesOpcodes);
 static sqInt numICacheFlushOpcodes(AbstractInstruction * self_in_numICacheFlushOpcodes);
 static sqInt numLowLevelLockOpcodes(AbstractInstruction * self_in_numLowLevelLockOpcodes);
+static sqInt numMethods(void);
 sqInt numMethodsOfType(sqInt cogMethodType);
 static sqInt numSmallIntegerBits(void);
 static sqInt occurrencesInYoungReferrers(CogMethod *cogMethod);
@@ -985,8 +987,6 @@
 void voidCogCompiledCode(void);
 static void voidYoungReferrersPostTenureAll(void);
 static AbstractInstruction * gXorCwR(sqInt wordConstant, sqInt reg);
-static sqInt zoneEnd(void);
-static usqInt zoneLimit(void);
 
 
 /*** Variables ***/
@@ -1342,6 +1342,7 @@
 static CogBlockMethod * maxMethodBefore;
 static sqInt methodAbortTrampolines[4];
 static sqInt methodBytesFreedSinceLastCompaction;
+static sqInt methodCount;
 static AbstractInstruction *methodLabel = &aMethodLabel;
 static sqInt methodObj;
 static sqInt methodOrBlockNumArgs;
@@ -1651,7 +1652,6 @@
 #define haltmsg(msg) warning("halt: " msg)
 #define limitZony() ((CogMethod *)mzFreeStart)
 #define maybeConstant(sse) ((sse)->constant)
-#define methodBytesFreedSinceLastCompaction() methodBytesFreedSinceLastCompaction
 #define minCallAddress() minValidCallAddress
 #define nextOpenPIC methodObject
 #define nextOpenPICHack hack hack hack i.e. the getter macro does all the work
@@ -1928,11 +1928,13 @@
     sqInt roundedBytes;
 
 	roundedBytes = (numBytes + 7) & -8;
-	if ((mzFreeStart + roundedBytes) > (youngReferrers - BytesPerWord)) {
+	if ((mzFreeStart + roundedBytes) >= (limitAddress - (methodCount * BytesPerWord))) {
 		return 0;
 	}
 	allocation = mzFreeStart;
 	mzFreeStart += roundedBytes;
+	methodCount += 1;
+	assert(roomOnYoungReferrersList());
 	;
 	return allocation;
 }
@@ -2299,7 +2301,7 @@
 	innerReturn = popStack();
 	targetMethod = ((CogMethod *) (innerReturn - missOffset));
 	outerReturn = stackTop();
-	assert(((outerReturn >= methodZoneBase) && (outerReturn <= (zoneLimit()))));
+	assert(((outerReturn >= methodZoneBase) && (outerReturn <= (freeStart()))));
 	entryPoint = callTargetFromReturnAddress(backEnd, outerReturn);
 	assert(((targetMethod->selector)) != (nilObject()));
 	
@@ -2723,10 +2725,7 @@
 		}
 		cogMethod = methodAfter(cogMethod);
 	}
-	mzFreeStart = baseAddress;
-	youngReferrers = limitAddress;
-	openPICList = null;
-	methodBytesFreedSinceLastCompaction = 0;
+	manageFromto(baseAddress, limitAddress);
 }
 
 
@@ -2887,14 +2886,14 @@
 		cogMethod = methodAfter(cogMethod);
 	}
 	if ((((label = stringForCString("CCFree"))) == null)
-	 || (((value = cePositive32BitIntegerFor(zoneLimit()))) == null)) {
+	 || (((value = cePositive32BitIntegerFor(freeStart()))) == null)) {
 		popRemappableOop();
 		return null;
 	}
 	storePointerUncheckedofObjectwithValue(count, topRemappableOop(), label);
 	storePointerUncheckedofObjectwithValue(count + 1, topRemappableOop(), value);
 	if ((((label = stringForCString("CCEnd"))) == null)
-	 || (((value = cePositive32BitIntegerFor(zoneEnd()))) == null)) {
+	 || (((value = cePositive32BitIntegerFor(limitAddress))) == null)) {
 		popRemappableOop();
 		return null;
 	}
@@ -3013,7 +3012,7 @@
 		if ((((sqInt) ((cogMethod->objectHeader)))) >= 0) {
 			if ((((cogMethod->methodObject)) != 0)
 			 && ((((cogMethod->methodObject)) < methodZoneBase)
-			 || ((((cogMethod->methodObject)) > ((zoneLimit()) - openPICSize))
+			 || ((((cogMethod->methodObject)) > ((freeStart()) - openPICSize))
 			 || (((((cogMethod->methodObject)) & (BytesPerWord - 1)) != 0)
 			 || (((((CogMethod *) ((cogMethod->methodObject)))->cmType)) != CMOpenPIC))))) {
 				return 23;
@@ -3226,7 +3225,7 @@
 	compactCompiledCode(nullHeaderForMachineCodeMethod());
 	assert(allMethodsHaveCorrectHeader());
 	assert(kosherYoungReferrers());
-	flushICacheFromto(processor, methodZoneBase, zoneLimit());
+	flushICacheFromto(processor, methodZoneBase, freeStart());
 }
 
 static void
@@ -3238,6 +3237,7 @@
 
 	source = ((CogMethod *) baseAddress);
 	openPICList = null;
+	methodCount = 0;
 	while ((source < (limitZony()))
 	 && (((source->cmType)) != CMFree)) {
 		assert((cogMethodDoesntLookKosher(source)) == 0);
@@ -3249,6 +3249,7 @@
 			(source->nextOpenPIC = ((usqInt)openPICList));
 			openPICList = source;
 		}
+		methodCount += 1;
 		source = methodAfter(source);
 	}
 	if (source >= (limitZony())) {
@@ -3259,6 +3260,7 @@
 		assert((maybeFreeCogMethodDoesntLookKosher(source)) == 0);
 		bytes = (source->blockSize);
 		if (((source->cmType)) != CMFree) {
+			methodCount += 1;
 			memmove(dest, source, bytes);
 			(dest->objectHeader = objectHeaderValue);
 			if (((dest->cmType)) == CMMethod) {
@@ -7689,18 +7691,28 @@
 freePICsWithFreedTargets(void)
 {
     CogMethod *cogMethod;
+    sqInt count;
 
 	cogMethod = ((CogMethod *) methodZoneBase);
+	count = 0;
 	while (cogMethod < (limitZony())) {
 		if ((((cogMethod->cmType)) == CMClosedPIC)
 		 && (cPICHasFreedTargets(cogMethod))) {
 			(cogMethod->cmType = CMFree);
 		}
 		cogMethod = methodAfter(cogMethod);
+		count += 1;
 	}
+	assert(count == (numMethods()));
 }
 
+static usqInt
+freeStart(void)
+{
+	return mzFreeStart;
+}
 
+
 /*	Short-circuit the interpreter call if a frame is already married. */
 
 static sqInt
@@ -8408,7 +8420,7 @@
 	headerSize = sizeof(CogMethod);
 	(methodLabel->address = -headerSize);
 	computeMaximumSizes();
-	concretizeAt(methodLabel, allocate(0));
+	concretizeAt(methodLabel, freeStart());
 	codeSize = generateInstructionsAt(((methodLabel->address)) + headerSize);
 	mapSize = generateMapAtstart(0, ((methodLabel->address)) + cmNoCheckEntryOffset);
 	totalSize = roundUpLength((headerSize + codeSize) + mapSize);
@@ -13076,7 +13088,7 @@
 sqInt
 isPCWithinMethodZone(char *address)
 {
-	return (((((usqInt)address)) >= methodZoneBase) && ((((usqInt)address)) <= (zoneLimit())));
+	return (((((usqInt)address)) >= methodZoneBase) && ((((usqInt)address)) <= (freeStart())));
 }
 
 static sqInt
@@ -13098,7 +13110,7 @@
 	}
 	target = callTargetFromReturnAddress(backEnd, retpc);
 	return (((target >= firstSend) && (target <= lastSend)))
-	 || (((target >= methodZoneBase) && (target <= (zoneLimit()))));
+	 || (((target >= methodZoneBase) && (target <= (freeStart()))));
 }
 
 static sqInt
@@ -13221,7 +13233,7 @@
 
 /*	Since it's an extraction from other methods. */
 
-static sqInt
+static AbstractInstruction *
 jumpTargetAddress(AbstractInstruction * self_in_jumpTargetAddress)
 {
     AbstractInstruction *jumpTarget;
@@ -13351,7 +13363,7 @@
 
 #  endif /* NewspeakVM */
 
-	assert(((callSiteReturnAddress >= methodZoneBase) && (callSiteReturnAddress <= (zoneLimit()))));
+	assert(((callSiteReturnAddress >= methodZoneBase) && (callSiteReturnAddress <= (freeStart()))));
 	inlineCacheTag = (theEntryOffset == cmNoCheckEntryOffset
 		? (targetMethod->selector)
 		: inlineCacheTagForInstance(receiver));
@@ -13437,7 +13449,7 @@
 	sane. 
  */
 
-static sqInt
+static AbstractInstruction *
 longJumpTargetAddress(AbstractInstruction * self_in_longJumpTargetAddress)
 {
     AbstractInstruction *jumpTarget;
@@ -13503,6 +13515,7 @@
 	youngReferrers = (limitAddress = theLimitAddress);
 	openPICList = null;
 	methodBytesFreedSinceLastCompaction = 0;
+	methodCount = 0;
 }
 
 
@@ -13881,7 +13894,7 @@
 	hasYoungObjPtr = ((sqInt)((&hasYoungObj)));
 	codeModified = 0;
 	pointer = youngReferrers();
-	while (pointer < (zoneEnd())) {
+	while (pointer < limitAddress) {
 		assert(!hasYoungObj);
 		cogMethod = ((CogMethod *) (longAt(pointer)));
 		if (((cogMethod->cmType)) == CMFree) {
@@ -13946,6 +13959,9 @@
 	default:
 		error("Case not found and no otherwise clause");
 	}
+	if (!(asserta((freeStart()) <= (youngReferrers())))) {
+		error("youngReferrers list overflowed");
+	}
 }
 
 static void
@@ -13983,7 +13999,7 @@
 	}
 	codeModified = 0;
 	pointer = youngReferrers();
-	while (pointer < (zoneEnd())) {
+	while (pointer < limitAddress) {
 		cogMethod = ((CogMethod *) (longAt(pointer)));
 		if ((cogMethod->cmRefersToYoung)) {
 			assert((cogMethodDoesntLookKosher(cogMethod)) == 0);
@@ -14639,6 +14655,12 @@
 	return 14;
 }
 
+static sqInt
+numMethods(void)
+{
+	return methodCount;
+}
+
 sqInt
 numMethodsOfType(sqInt cogMethodType)
 {
@@ -15680,19 +15702,33 @@
 	flags = primitivePropertyFlags(primIndex);
 	if ((flags & PrimCallMayCallBack) != 0) {
 		address = (((usqInt)cogMethod)) + (externalPrimJumpOffsets[(cogMethod->cmNumArgs)]);
-		extent = rewriteJumpLongAttarget(backEnd, address, ((sqInt)primFunctionPointer));
+		extent = rewriteJumpLongAttarget(backEnd, address, ((usqInt)primFunctionPointer));
 	}
 	else {
 		address = (((usqInt)cogMethod)) + (externalPrimCallOffsets[(cogMethod->cmNumArgs)]);
-		extent = rewriteCallAttarget(backEnd, address, ((sqInt)primFunctionPointer));
+		extent = rewriteCallAttarget(backEnd, address, ((usqInt)primFunctionPointer));
 	}
 	flushICacheFromto(processor, address, address + extent);
 }
 
+
+/*	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)
 {
-	return (youngReferrers - BytesPerWord) >= mzFreeStart;
+	assert((youngReferrers <= limitAddress)
+	 && (youngReferrers >= (limitAddress - (methodCount * BytesPerWord))));
+	return (limitAddress - (methodCount * BytesPerWord)) >= mzFreeStart;
 }
 
 static sqInt
@@ -17114,15 +17150,3 @@
 {
 	return genoperandoperand(XorCwR, wordConstant, reg);
 }
-
-static sqInt
-zoneEnd(void)
-{
-	return limitAddress;
-}
-
-static usqInt
-zoneLimit(void)
-{
-	return mzFreeStart;
-}

Modified: branches/Cog/src/vm/cogit.h
===================================================================
--- branches/Cog/src/vm/cogit.h	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/src/vm/cogit.h	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGenerator VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
 
 

Modified: branches/Cog/src/vm/cogmethod.h
===================================================================
--- branches/Cog/src/vm/cogmethod.h	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/src/vm/cogmethod.h	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGenerator VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
 
 typedef struct {

Modified: branches/Cog/src/vm/cointerp.c
===================================================================
--- branches/Cog/src/vm/cointerp.c	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/src/vm/cointerp.c	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
    from
-	CoInterpreter VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CoInterpreter VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -610,6 +610,7 @@
 sqInt isMarked(sqInt oop);
 static sqInt isMarriedOrWidowedContext(sqInt aContext);
 sqInt isNonIntegerObject(sqInt objectPointer);
+static sqInt isNullExternalPrimitiveCall(sqInt aMethodObj);
 sqInt isOopCompiledMethod(sqInt oop);
 sqInt isPointers(sqInt oop);
 static sqInt isPrimitiveFunctionPointerAnIndex(void);
@@ -1905,7 +1906,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.199]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.201]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -20281,8 +20282,10 @@
 		}
 	}
 	else {
-		assert(((primitiveIndexOf(GIV(newMethod))) == 0)
-		 || ((functionPointerForinClass(primitiveIndexOf(GIV(newMethod)), nilObject())) == 0));
+		assert((isOopCompiledMethod(GIV(newMethod)))
+		 && (((primitiveIndexOf(GIV(newMethod))) == 0)
+		 || (((functionPointerForinClass(primitiveIndexOf(GIV(newMethod)), nilObject())) == 0)
+		 || (isNullExternalPrimitiveCall(GIV(newMethod))))));
 	}
 	activateNewMethod();
 	siglongjmp(reenterInterpreter, ReturnToInterpreter);
@@ -20504,6 +20507,27 @@
 }
 
 
+/*	Answer if the method is an external primtiive call (prim 117) with a null
+	external primtiive.
+	This is just for an assert in the CoInterpreter. */
+
+static sqInt
+isNullExternalPrimitiveCall(sqInt aMethodObj)
+{
+    sqInt lit;
+
+	if (!(((primitiveIndexOf(aMethodObj)) == 117)
+		 && ((literalCountOfHeader(headerOf(aMethodObj))) > 0))) {
+		return 0;
+	}
+	lit = longAt((aMethodObj + BaseHeaderSize) + ((0 + LiteralStart) << ShiftForWord));
+	return (((lit & 1) == 0)
+ && (((((usqInt) (longAt(lit))) >> 8) & 15) == 2))
+	 && (((lengthOf(lit)) == 4)
+	 && ((longAt((lit + BaseHeaderSize) + (3 << ShiftForWord))) == ConstZero));
+}
+
+
 /*	Answer whether the oop is an object of compiled method format */
 
 sqInt

Modified: branches/Cog/src/vm/cointerp.h
===================================================================
--- branches/Cog/src/vm/cointerp.h	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/src/vm/cointerp.h	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
 
 

Modified: branches/Cog/src/vm/cointerpmt.c
===================================================================
--- branches/Cog/src/vm/cointerpmt.c	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/src/vm/cointerpmt.c	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.200 uuid: 5a8e1270-adca-4f75-9712-0c0deda989d2
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
    from
-	CoInterpreterMT VMMaker.oscog-eem.200 uuid: 5a8e1270-adca-4f75-9712-0c0deda989d2
+	CoInterpreterMT VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
-static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.200 uuid: 5a8e1270-adca-4f75-9712-0c0deda989d2 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -666,6 +666,7 @@
 sqInt isMarked(sqInt oop);
 static sqInt isMarriedOrWidowedContext(sqInt aContext);
 sqInt isNonIntegerObject(sqInt objectPointer);
+static sqInt isNullExternalPrimitiveCall(sqInt aMethodObj);
 sqInt isOopCompiledMethod(sqInt oop);
 sqInt isPointers(sqInt oop);
 static sqInt isPrimitiveFunctionPointerAnIndex(void);
@@ -2004,7 +2005,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.200]";
+const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.201]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 sqInt willNotThreadWarnCount;
@@ -20987,8 +20988,10 @@
 		}
 	}
 	else {
-		assert(((primitiveIndexOf(GIV(newMethod))) == 0)
-		 || ((functionPointerForinClass(primitiveIndexOf(GIV(newMethod)), nilObject())) == 0));
+		assert((isOopCompiledMethod(GIV(newMethod)))
+		 && (((primitiveIndexOf(GIV(newMethod))) == 0)
+		 || (((functionPointerForinClass(primitiveIndexOf(GIV(newMethod)), nilObject())) == 0)
+		 || (isNullExternalPrimitiveCall(GIV(newMethod))))));
 	}
 	activateNewMethod();
 	siglongjmp(reenterInterpreter, ReturnToInterpreter);
@@ -21235,6 +21238,27 @@
 }
 
 
+/*	Answer if the method is an external primtiive call (prim 117) with a null
+	external primtiive.
+	This is just for an assert in the CoInterpreter. */
+
+static sqInt
+isNullExternalPrimitiveCall(sqInt aMethodObj)
+{
+    sqInt lit;
+
+	if (!(((primitiveIndexOf(aMethodObj)) == 117)
+		 && ((literalCountOfHeader(headerOf(aMethodObj))) > 0))) {
+		return 0;
+	}
+	lit = longAt((aMethodObj + BaseHeaderSize) + ((0 + LiteralStart) << ShiftForWord));
+	return (((lit & 1) == 0)
+ && (((((usqInt) (longAt(lit))) >> 8) & 15) == 2))
+	 && (((lengthOf(lit)) == 4)
+	 && ((longAt((lit + BaseHeaderSize) + (3 << ShiftForWord))) == ConstZero));
+}
+
+
 /*	Answer whether the oop is an object of compiled method format */
 
 sqInt

Modified: branches/Cog/src/vm/cointerpmt.h
===================================================================
--- branches/Cog/src/vm/cointerpmt.h	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/src/vm/cointerpmt.h	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.200 uuid: 5a8e1270-adca-4f75-9712-0c0deda989d2
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
 
 

Modified: branches/Cog/src/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/src/vm/gcc3x-cointerp.c	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/src/vm/gcc3x-cointerp.c	2012-08-14 16:06:45 UTC (rev 2585)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
    from
-	CoInterpreter VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CoInterpreter VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -613,6 +613,7 @@
 sqInt isMarked(sqInt oop);
 static sqInt isMarriedOrWidowedContext(sqInt aContext);
 sqInt isNonIntegerObject(sqInt objectPointer);
+static sqInt isNullExternalPrimitiveCall(sqInt aMethodObj);
 sqInt isOopCompiledMethod(sqInt oop);
 sqInt isPointers(sqInt oop);
 static sqInt isPrimitiveFunctionPointerAnIndex(void);
@@ -1908,7 +1909,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.199]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.201]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -20285,8 +20286,10 @@
 		}
 	}
 	else {
-		assert(((primitiveIndexOf(GIV(newMethod))) == 0)
-		 || ((functionPointerForinClass(primitiveIndexOf(GIV(newMethod)), nilObject())) == 0));
+		assert((isOopCompiledMethod(GIV(newMethod)))
+		 && (((primitiveIndexOf(GIV(newMethod))) == 0)
+		 || (((functionPointerForinClass(primitiveIndexOf(GIV(newMethod)), nilObject())) == 0)
+		 || (isNullExternalPrimitiveCall(GIV(newMethod))))));
 	}
 	activateNewMethod();
 	siglongjmp(reenterInterpreter, ReturnToInterpreter);
@@ -20508,6 +20511,27 @@
 }
 
 
+/*	Answer if the method is an external primtiive call (prim 117) with a null
+	external primtiive.
+	This is just for an assert in the CoInterpreter. */
+
+static sqInt
+isNullExternalPrimitiveCall(sqInt aMethodObj)
+{
+    sqInt lit;
+
+	if (!(((primitiveIndexOf(aMethodObj)) == 117)
+		 && ((literalCountOfHeader(headerOf(aMethodObj))) > 0))) {
+		return 0;
+	}
+	lit = longAt((aMethodObj + BaseHeaderSize) + ((0 + LiteralStart) << ShiftForWord));
+	return (((lit & 1) == 0)
+ && (((((usqInt) (longAt(lit))) >> 8) & 15) == 2))
+	 && (((lengthOf(lit)) == 4)
+	 && ((longAt((lit + BaseHeaderSize) + (3 << ShiftForWord))) == ConstZero));
+}
+
+
 /*	Answer whether the oop is an object of compiled method format */
 
 sqInt

Modified: branches/Cog/src/vm/gcc3x-cointerpmt.c
===================================================================
--- branches/Cog/src/vm/gcc3x-cointerpmt.c	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/src/vm/gcc3x-cointerpmt.c	2012-08-14 16:06:45 UTC (rev 2585)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.200 uuid: 5a8e1270-adca-4f75-9712-0c0deda989d2
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
    from
-	CoInterpreterMT VMMaker.oscog-eem.200 uuid: 5a8e1270-adca-4f75-9712-0c0deda989d2
+	CoInterpreterMT VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
-static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.200 uuid: 5a8e1270-adca-4f75-9712-0c0deda989d2 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -669,6 +669,7 @@
 sqInt isMarked(sqInt oop);
 static sqInt isMarriedOrWidowedContext(sqInt aContext);
 sqInt isNonIntegerObject(sqInt objectPointer);
+static sqInt isNullExternalPrimitiveCall(sqInt aMethodObj);
 sqInt isOopCompiledMethod(sqInt oop);
 sqInt isPointers(sqInt oop);
 static sqInt isPrimitiveFunctionPointerAnIndex(void);
@@ -2007,7 +2008,7 @@
 	/* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.200]";
+const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.201]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 sqInt willNotThreadWarnCount;
@@ -20991,8 +20992,10 @@
 		}
 	}
 	else {
-		assert(((primitiveIndexOf(GIV(newMethod))) == 0)
-		 || ((functionPointerForinClass(primitiveIndexOf(GIV(newMethod)), nilObject())) == 0));
+		assert((isOopCompiledMethod(GIV(newMethod)))
+		 && (((primitiveIndexOf(GIV(newMethod))) == 0)
+		 || (((functionPointerForinClass(primitiveIndexOf(GIV(newMethod)), nilObject())) == 0)
+		 || (isNullExternalPrimitiveCall(GIV(newMethod))))));
 	}
 	activateNewMethod();
 	siglongjmp(reenterInterpreter, ReturnToInterpreter);
@@ -21239,6 +21242,27 @@
 }
 
 
+/*	Answer if the method is an external primtiive call (prim 117) with a null
+	external primtiive.
+	This is just for an assert in the CoInterpreter. */
+
+static sqInt
+isNullExternalPrimitiveCall(sqInt aMethodObj)
+{
+    sqInt lit;
+
+	if (!(((primitiveIndexOf(aMethodObj)) == 117)
+		 && ((literalCountOfHeader(headerOf(aMethodObj))) > 0))) {
+		return 0;
+	}
+	lit = longAt((aMethodObj + BaseHeaderSize) + ((0 + LiteralStart) << ShiftForWord));
+	return (((lit & 1) == 0)
+ && (((((usqInt) (longAt(lit))) >> 8) & 15) == 2))
+	 && (((lengthOf(lit)) == 4)
+	 && ((longAt((lit + BaseHeaderSize) + (3 << ShiftForWord))) == ConstZero));
+}
+
+
 /*	Answer whether the oop is an object of compiled method format */
 
 sqInt

Modified: branches/Cog/src/vm/interp.h
===================================================================
--- branches/Cog/src/vm/interp.h	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/src/vm/interp.h	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/src/vm/vmCallback.h
===================================================================
--- branches/Cog/src/vm/vmCallback.h	2012-08-10 23:59:57 UTC (rev 2584)
+++ branches/Cog/src/vm/vmCallback.h	2012-08-14 16:06:45 UTC (rev 2585)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.199 uuid: 1b0cff66-2042-49a7-ae74-5fa119256732
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.201 uuid: 56cdd078-6771-401a-8bed-68402a0e283d
  */
 
 #define VM_CALLBACK_INC 1



More information about the Vm-dev mailing list