[Vm-dev] [commit][3368] CogVM source as per VMMaker.oscog-eem.1336.

commits at squeakvm.org commits at squeakvm.org
Thu Jun 4 05:19:36 UTC 2015


Revision: 3368
Author:   eliot
Date:     2015-06-03 22:19:31 -0700 (Wed, 03 Jun 2015)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.1336.

Fix the hack introduced in VMMaker.oscog-eem.1199 for Sista which merely stopped
reclaiming closed PICs.  In non-Sista VMs do the usual thing of decaying usage
counts on PICs, as with methods, and reclaiming those least used.  In Sista,
retain PICs until the next cycle, identifying unused PICs as part of the
compaction scan, reminiscent of tri-colour incremental GC.

Move defaultCogCodeSize into the CogAbstractInstruction hierarchy so that
e.g.  CogARMCompiler can specify a larger default code zone.

Merge with VMMaker.oscog-tpr.1335, keeping the -1's
in the cache flush extent calculations.

Enable the magic MULL instruction on ARM.  Clean up flushICache usage

Spur:
Since the invariant is that the receiver is never forwarded, Spur must check for
forwarding on block activation.  A become between closure creation and closure
evaluation can forward the receiver, and it must be unforwarded.  Here we do so
by checking for a forwarded receiver in the value[:] primitives. This is a
major blow to block performance; e.g. the nfib block
	b := [:n| n <= 1
				ifTrue: [1]
				ifFalse: [1 + (b value: n - 1) + (b value: n - 2)]].
slows down by 11%.  So we can and will do better.  We should scan for receiver
usage in the JIT and optionally compile unforwarding code in the prolog
depending on whether self is used or not.

Cogit:
Use the Tst-based generators for immediate and SmallInteger tests more widely
to save a few more instructions.

Modified Paths:
--------------
    branches/Cog/nsspursrc/vm/cogit.h
    branches/Cog/nsspursrc/vm/cogitARMv5.c
    branches/Cog/nsspursrc/vm/cogitIA32.c
    branches/Cog/nsspursrc/vm/cointerp.c
    branches/Cog/nsspursrc/vm/cointerp.h
    branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
    branches/Cog/nsspurstack64src/vm/gcc3x-interp.c
    branches/Cog/nsspurstack64src/vm/interp.c
    branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c
    branches/Cog/nsspurstacksrc/vm/interp.c
    branches/Cog/spursistasrc/vm/cogit.h
    branches/Cog/spursistasrc/vm/cogitARMv5.c
    branches/Cog/spursistasrc/vm/cogitIA32.c
    branches/Cog/spursistasrc/vm/cointerp.c
    branches/Cog/spursistasrc/vm/cointerp.h
    branches/Cog/spursistasrc/vm/gcc3x-cointerp.c
    branches/Cog/spursrc/vm/cogit.h
    branches/Cog/spursrc/vm/cogitARMv5.c
    branches/Cog/spursrc/vm/cogitIA32.c
    branches/Cog/spursrc/vm/cointerp.c
    branches/Cog/spursrc/vm/cointerp.h
    branches/Cog/spursrc/vm/gcc3x-cointerp.c
    branches/Cog/spurstack64src/vm/gcc3x-interp.c
    branches/Cog/spurstack64src/vm/interp.c
    branches/Cog/spurstacksrc/vm/gcc3x-interp.c
    branches/Cog/spurstacksrc/vm/interp.c
    branches/Cog/src/vm/cogit.h
    branches/Cog/src/vm/cogitARMv5.c
    branches/Cog/src/vm/cogitIA32.c
    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/nsspursrc/vm/cogit.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.h	2015-06-03 16:00:39 UTC (rev 3367)
+++ branches/Cog/nsspursrc/vm/cogit.h	2015-06-04 05:19:31 UTC (rev 3368)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1333 uuid: bc9001c2-8816-4b4e-bf91-8e11cad6ed6b
+	CCodeGenerator VMMaker.oscog-eem.1336 uuid: a8254ed3-d450-4a8a-aa78-7ae88f6aae1a
  */
 
 
@@ -20,6 +20,7 @@
 # define NeverInline /*empty*/
 #endif
 
+sqInt defaultCogCodeSize(AbstractInstruction * self_in_defaultCogCodeSize);
 sqInt abortOffset(void);
 void addCogMethodsToHeapMap(void);
 sqInt bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod);

Modified: branches/Cog/nsspursrc/vm/cogitARMv5.c
===================================================================
--- branches/Cog/nsspursrc/vm/cogitARMv5.c	2015-06-03 16:00:39 UTC (rev 3367)
+++ branches/Cog/nsspursrc/vm/cogitARMv5.c	2015-06-04 05:19:31 UTC (rev 3368)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1333 uuid: bc9001c2-8816-4b4e-bf91-8e11cad6ed6b
+	CCodeGenerator VMMaker.oscog-eem.1336 uuid: a8254ed3-d450-4a8a-aa78-7ae88f6aae1a
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.1333 uuid: bc9001c2-8816-4b4e-bf91-8e11cad6ed6b
+	StackToRegisterMappingCogit VMMaker.oscog-eem.1336 uuid: a8254ed3-d450-4a8a-aa78-7ae88f6aae1a
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1333 uuid: bc9001c2-8816-4b4e-bf91-8e11cad6ed6b " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1336 uuid: a8254ed3-d450-4a8a-aa78-7ae88f6aae1a " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -450,6 +450,7 @@
 static AbstractInstruction * concretizeSubRdRd(AbstractInstruction * self_in_concretizeSubRdRd) NoDbgRegParms;
 static sqInt cResultRegister(AbstractInstruction * self_in_cResultRegister) NoDbgRegParms;
 static sqInt dataOpTyperdrnrmlsr(AbstractInstruction * self_in_dataOpTyperdrnrmlsr, sqInt armOpcode, sqInt destReg, sqInt srcReg, sqInt addReg, sqInt shft) NoDbgRegParms;
+sqInt defaultCogCodeSize(AbstractInstruction * self_in_defaultCogCodeSize);
 static void dispatchConcretize(AbstractInstruction * self_in_dispatchConcretize) NoDbgRegParms;
 static sqInt extract32BitOperandFrom4InstructionsPreceeding(AbstractInstruction * self_in_extract32BitOperandFrom4InstructionsPreceeding, sqInt addr) NoDbgRegParms;
 static sqInt fullCallsAreRelative(AbstractInstruction * self_in_fullCallsAreRelative) NoDbgRegParms;
@@ -751,7 +752,6 @@
 static void relocateCallsAndSelfReferencesInMethod(CogMethod *cogMethod) NoDbgRegParms;
 static void relocateCallsInClosedPIC(CogMethod *cPIC) NoDbgRegParms;
 static sqInt relocateIfCallOrMethodReferencemcpcdelta(sqInt annotation, char *mcpc, sqInt delta) NoDbgRegParms;
-static sqInt relocateMethodsPreCompaction(void);
 static sqInt remapIfObjectRefpchasYoung(sqInt annotation, char *mcpc, sqInt hasYoungPtr) NoDbgRegParms;
 static AbstractInstruction * gSubCwR(sqInt wordConstant, sqInt reg) NoDbgRegParms;
 static sqInt scanForCleanBlocks(void);
@@ -805,6 +805,7 @@
 void printOpenPICList(void);
 static sqInt pruneYoungReferrers(void);
 static sqInt relocateAndPruneYoungReferrers(void);
+static sqInt relocateMethodsPreCompaction(void);
 static sqInt removeFromOpenPICList(CogMethod *anOpenPIC) NoDbgRegParms;
 static sqInt removeFromUnpairedMethodList(CogMethod *aCogMethod) NoDbgRegParms;
 static void voidYoungReferrersPostTenureAll(void);
@@ -813,6 +814,8 @@
 static AbstractInstruction * genCmpClassFloatCompactIndexR(sqInt reg) NoDbgRegParms;
 static AbstractInstruction * genCmpClassMethodContextCompactIndexR(sqInt reg) NoDbgRegParms;
 static sqInt genInnerPrimitiveNewMethod(sqInt retNoffset) NoDbgRegParms;
+static AbstractInstruction * genJumpNotSmallIntegerscratchReg(sqInt aRegister, sqInt scratch) NoDbgRegParms;
+static sqInt genLoadSlotsourceRegdestReg(sqInt index, sqInt sourceReg, sqInt destReg) NoDbgRegParms;
 static sqInt isUnannotatableConstant(CogSimStackEntry *simStackEntry) NoDbgRegParms;
 static sqInt genAddSmallIntegerTagsTo(sqInt aRegister) NoDbgRegParms;
 static void genConvertCharacterToSmallIntegerInReg(sqInt reg) NoDbgRegParms;
@@ -840,7 +843,6 @@
 static sqInt genInnerPrimitiveStringAt(sqInt retNoffset) NoDbgRegParms;
 static AbstractInstruction * genJumpNotSmallIntegerInScratchReg(sqInt aRegister) NoDbgRegParms;
 static AbstractInstruction * genJumpNotSmallInteger(sqInt aRegister) NoDbgRegParms;
-static AbstractInstruction * genJumpSmallIntegerInScratchReg(sqInt aRegister) NoDbgRegParms;
 static AbstractInstruction * genJumpSmallInteger(sqInt aRegister) NoDbgRegParms;
 static sqInt genNewArrayOfSizeinitialized(sqInt size, sqInt initialized) NoDbgRegParms;
 static sqInt genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock) NoDbgRegParms;
@@ -864,9 +866,9 @@
 static sqInt genConvertCharacterToCodeInReg(sqInt reg) NoDbgRegParms;
 static sqInt genConvertIntegerToCharacterInReg(sqInt reg) NoDbgRegParms;
 static sqInt genEnsureObjInRegNotForwardedscratchReg(sqInt reg, sqInt scratch) NoDbgRegParms;
-static sqInt genEnsureObjInRegNotForwardedscratchRegupdatingMwr(sqInt reg, sqInt scratch, sqInt offset, sqInt baseReg) NoDbgRegParms;
 static sqInt genEnsureOopInRegNotForwardedscratchReg(sqInt reg, sqInt scratch) NoDbgRegParms;
 static sqInt genEnsureOopInRegNotForwardedscratchRegjumpBackTo(sqInt reg, sqInt scratch, AbstractInstruction *instruction) NoDbgRegParms;
+static sqInt genEnsureOopInRegNotForwardedscratchRegupdatingMwr(sqInt reg, sqInt scratch, sqInt offset, sqInt baseReg) NoDbgRegParms;
 static void generateObjectRepresentationTrampolines(void);
 static sqInt genGetActiveContextNumArgslargeinBlock(sqInt numArgs, sqInt isLargeContext, sqInt isInBlock) NoDbgRegParms;
 static sqInt genGetBitsofFormatByteOfintobaseHeaderIntoScratch(sqInt mask, sqInt sourceReg, sqInt destReg, sqInt scratchReg) NoDbgRegParms;
@@ -882,10 +884,8 @@
 static sqInt genInnerPrimitiveCharacterValue(sqInt retNOffset) NoDbgRegParms;
 static sqInt genInnerPrimitiveIdenticalorNotIf(sqInt retNoffset, sqInt orNot) NoDbgRegParms;
 static sqInt genInnerPrimitiveSize(sqInt retNoffset) NoDbgRegParms;
-static AbstractInstruction * genJumpImmediateInScratchReg(sqInt aRegister) NoDbgRegParms;
 static AbstractInstruction * genJumpImmediate(sqInt aRegister) NoDbgRegParms;
 static AbstractInstruction * genJumpNotCharacterInScratchReg(sqInt reg) NoDbgRegParms;
-static sqInt genLoadSlotsourceRegdestReg(sqInt index, sqInt sourceReg, sqInt destReg) NoDbgRegParms;
 static sqInt genStoreCheckReceiverRegvalueRegscratchReginFrame(sqInt destReg, sqInt valueReg, sqInt scratchReg, sqInt inFrame) NoDbgRegParms;
 static sqInt genStoreImmediateInSourceRegslotIndexdestReg(sqInt sourceReg, sqInt index, sqInt destReg) NoDbgRegParms;
 static sqInt genStoreSourceRegslotIndexdestRegscratchReginFrame(sqInt sourceReg, sqInt index, sqInt destReg, sqInt scratchReg, sqInt inFrame) NoDbgRegParms;
@@ -2959,6 +2959,18 @@
 }
 
 
+/*	Return the default number of bytes to allocate for native code at startup.
+	The actual value can be set via vmParameterAt: and/or a preference in the
+	ini file. */
+
+	/* CogARMCompiler>>#defaultCogCodeSize */
+sqInt
+defaultCogCodeSize(AbstractInstruction * self_in_defaultCogCodeSize)
+{
+	return 1024 * 1400;
+}
+
+
 /*	Attempt to generate concrete machine code for the instruction at address.
 	This is the inner dispatch of concretizeAt: actualAddress which exists
 	only to get around the branch size limits in the SqueakV3 (blue book
@@ -8350,12 +8362,12 @@
 			}
 			return ceSendFromInLineCacheMiss(targetMethod);
 		}
-		flushICacheFromto(processor, ((sqInt)pic), (((sqInt)pic)) + closedPICSize);
+		flushICacheFromto(processor, ((usqInt)pic), (((usqInt)pic)) + closedPICSize);
 	}
 	extent = (((pic->cmType)) == CMOpenPIC
 		? rewriteInlineCacheAttagtarget(backEnd, outerReturn, (targetMethod->selector), (((sqInt)pic)) + cmEntryOffset)
 		: rewriteCallAttarget(backEnd, outerReturn, (((sqInt)pic)) + cmEntryOffset));
-	flushICacheFromto(processor, (outerReturn - 1) - extent, outerReturn - 1);
+	flushICacheFromto(processor, ((((usqInt)outerReturn)) - 1) - extent, (((usqInt)outerReturn)) - 1);
 	executeCogPICfromLinkedSendWithReceiverandCacheTag(pic, receiver, inlineCacheTagAt(backEnd, outerReturn));
 	return null;
 }
@@ -9020,7 +9032,7 @@
 	address = addressOfEndOfCaseinCPIC(((cPIC->cPICNumCases)) - 1, cPIC);
 	size = generateInstructionsAt(address);
 	end = outputInstructionsAt(address);
-	flushICacheFromto(processor, ((sqInt)cPIC), (((sqInt)cPIC)) + closedPICSize);
+	flushICacheFromto(processor, ((usqInt)cPIC), (((usqInt)cPIC)) + closedPICSize);
 	(cPIC->cPICNumCases = ((cPIC->cPICNumCases)) + 1);
 	return 0;
 }
@@ -9367,7 +9379,7 @@
 	compactCompiledCode();
 	assert(allMethodsHaveCorrectHeader());
 	assert(kosherYoungReferrers());
-	flushICacheFromto(processor, methodZoneBase, freeStart());
+	flushICacheFromto(processor, ((usqInt)methodZoneBase), ((usqInt)(freeStart())));
 }
 
 
@@ -9914,7 +9926,7 @@
 {
     sqInt classIndex;
     sqInt i;
-    sqInt pc;
+    usqInt pc;
 
 	pc = (((((usqInt)cPIC)) + firstCPICCaseOffset) + cPICCaseSize) - (jumpLongConditionalByteSize(backEnd));
 	for (i = 2; i <= ((cPIC->cPICNumCases)); i += 1) {
@@ -10582,7 +10594,7 @@
 	/* begin RetN: */
 	genoperand(RetN, 0);
 	outputInstructionsForGeneratedRuntimeAt(startAddress);
-	flushICacheFromto(processor, startAddress, methodZoneBase);
+	flushICacheFromto(processor, ((usqInt)startAddress), ((usqInt)methodZoneBase));
 	recordGeneratedRunTimeaddress("ceCaptureCStackPointers", startAddress);
 	ceCaptureCStackPointers = ((void (*)(void)) startAddress);
 }
@@ -10931,7 +10943,7 @@
 	generateEnilopmarts();
 	generateTracingTrampolines();
 	recordGeneratedRunTimeaddress("methodZoneBase", methodZoneBase);
-	flushICacheFromto(processor, methodZoneStart, methodZoneBase);
+	flushICacheFromto(processor, ((usqInt)methodZoneStart), ((usqInt)methodZoneBase));
 }
 
 	/* Cogit>>#generateVMOwnerLockFunctions */
@@ -11116,7 +11128,7 @@
 	/* begin JumpR: */
 	genoperand(JumpR, TempReg);
 	jmpTarget(jumpMiss, gLabel());
-	genEnsureObjInRegNotForwardedscratchRegupdatingMwr(ReceiverResultReg, TempReg, FoxMFReceiver, FPReg);
+	genEnsureOopInRegNotForwardedscratchRegupdatingMwr(ReceiverResultReg, TempReg, FoxMFReceiver, FPReg);
 	genPushRegisterArgsForNumArgsscratchReg(backEnd, numArgs, TempReg);
 
 	return genTrampolineForcallednumArgsargargargargsaveRegspushLinkRegresultRegappendOpcodes(aRoutine, aString, 2, SendNumArgsReg, ReceiverResultReg, null, null, 0, 1, ReceiverResultReg, 1);
@@ -11744,7 +11756,7 @@
 	
 	address = (((sqInt)targetMethod)) + theEntryOffset;
 	extent = rewriteInlineCacheAttagtarget(backEnd, callSiteReturnAddress, inlineCacheTag, address);
-	flushICacheFromto(processor, (callSiteReturnAddress - 1) - extent, callSiteReturnAddress - 1);
+	flushICacheFromto(processor, ((((usqInt)callSiteReturnAddress)) - 1) - extent, (((usqInt)callSiteReturnAddress)) - 1);
 }
 
 	/* Cogit>>#loadSubsequentBytesForDescriptor:at: */
@@ -12038,7 +12050,7 @@
 
 		/* After updating oops in inline caches we need to flush the icache. */
 
-		flushICacheFromto(processor, codeBase, ((sqInt)(limitZony())));
+		flushICacheFromto(processor, ((usqInt)codeBase), ((usqInt)(limitZony())));
 	}
 }
 
@@ -12113,7 +12125,7 @@
 
 		/* After updating oops in inline caches we need to flush the icache. */
 
-		flushICacheFromto(processor, codeBase, ((sqInt)(limitZony())));
+		flushICacheFromto(processor, ((usqInt)codeBase), ((usqInt)(limitZony())));
 	}
 }
 
@@ -12212,7 +12224,7 @@
 
 		/* After updating oops in inline caches we need to flush the icache. */
 
-		flushICacheFromto(processor, methodZoneBase, ((sqInt)(limitZony())));
+		flushICacheFromto(processor, ((usqInt)methodZoneBase), ((usqInt)(limitZony())));
 	}
 }
 
@@ -12380,7 +12392,7 @@
 
 		/* After updating oops in inline caches we need to flush the icache. */
 
-		flushICacheFromto(processor, methodZoneBase, ((sqInt)(limitZony())));
+		flushICacheFromto(processor, ((usqInt)methodZoneBase), ((usqInt)(limitZony())));
 	}
 }
 
@@ -13309,8 +13321,8 @@
 		}
 	}
 	extent = rewriteInlineCacheAttagtarget(backEnd, outerReturn, selector, (((sqInt)oPIC)) + cmEntryOffset);
-	flushICacheFromto(processor, (outerReturn - 1) - extent, outerReturn - 1);
-	flushICacheFromto(processor, ((sqInt)oPIC), (((sqInt)oPIC)) + openPICSize);
+	flushICacheFromto(processor, ((((usqInt)outerReturn)) - 1) - extent, (((usqInt)outerReturn)) - 1);
+	flushICacheFromto(processor, ((usqInt)oPIC), (((usqInt)oPIC)) + openPICSize);
 	executeCogMethodfromLinkedSendWithReceiver(oPIC, receiver);
 	return 1;
 }
@@ -13649,14 +13661,14 @@
 static sqInt
 processorHasMultiplyAndMClassIsSmallInteger(sqInt ignoredPrimIndex)
 {
-	return 0;
+	return mclassIsSmallInteger(ignoredPrimIndex);
 }
 
 	/* Cogit>>#processorHasMultiply: */
 static sqInt
 processorHasMultiply(sqInt ignoredPrimIndex)
 {
-	return 0;
+	return 1;
 }
 
 	/* Cogit>>#RetN: */
@@ -13904,11 +13916,12 @@
 
 		}
 		targetMethod = ((CogMethod *) (entryPoint - offset1));
-		if (((targetMethod->cmType)) == CMMethod) {
+		if (((targetMethod->cmType)) != CMFree) {
 
 			/* send target not freed; just relocate. */
 
 			relocateCallBeforeReturnPCby(backEnd, ((sqInt)mcpc), -(delta - ((targetMethod->objectHeader))));
+			
 			return 0;
 		}
 		unlinkedRoutine = sendTable1[((((targetMethod->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod->cmNumArgs)) : (NumSendTrampolines - 1))];
@@ -13927,34 +13940,6 @@
 	return 0;
 }
 
-
-/*	All surviving methods have had the amount they are going to relocate by
-	stored in their objectHeader fields. Relocate all relative calls so that
-	after the compaction of both the method containing each call and the call
-	target the calls invoke the same target. */
-
-	/* Cogit>>#relocateMethodsPreCompaction */
-static sqInt
-relocateMethodsPreCompaction(void)
-{
-    CogMethod *cogMethod;
-
-	cogMethod = ((CogMethod *) methodZoneBase);
-	while (cogMethod < (limitZony())) {
-		if (((cogMethod->cmType)) != CMFree) {
-			if (((cogMethod->cmType)) == CMClosedPIC) {
-				relocateCallsInClosedPIC(cogMethod);
-			}
-			else {
-				relocateCallsAndSelfReferencesInMethod(cogMethod);
-			}
-		}
-		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
-	}
-	relocateAndPruneYoungReferrers();
-	return 1;
-}
-
 	/* Cogit>>#remapIfObjectRef:pc:hasYoung: */
 static sqInt
 remapIfObjectRefpchasYoung(sqInt annotation, char *mcpc, sqInt hasYoungPtr)
@@ -14289,7 +14274,7 @@
 		}
 		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
-	flushICacheFromto(processor, methodZoneBase, ((sqInt)(limitZony())));
+	flushICacheFromto(processor, ((usqInt)methodZoneBase), ((usqInt)(limitZony())));
 }
 
 	/* Cogit>>#unlinkIfFreeOrLinkedSend:pc:of: */
@@ -14749,7 +14734,7 @@
 
 			/* After possibly updating inline caches we need to flush the icache. */
 
-			flushICacheFromto(processor, methodZoneBase, ((sqInt)(limitZony())));
+			flushICacheFromto(processor, ((usqInt)methodZoneBase), ((usqInt)(limitZony())));
 		}
 	}
 }
@@ -14853,7 +14838,7 @@
 
 		/* After possibly updating inline caches we need to flush the icache. */
 
-		flushICacheFromto(processor, methodZoneBase, ((sqInt)(limitZony())));
+		flushICacheFromto(processor, ((usqInt)methodZoneBase), ((usqInt)(limitZony())));
 	}
 }
 
@@ -14919,7 +14904,7 @@
 
 		/* After possibly updating inline caches we need to flush the icache. */
 
-		flushICacheFromto(processor, methodZoneBase, ((sqInt)(limitZony())));
+		flushICacheFromto(processor, ((usqInt)methodZoneBase), ((usqInt)(limitZony())));
 	}
 }
 
@@ -15003,7 +14988,7 @@
 
 			/* After possibly updating inline caches we need to flush the icache. */
 
-			flushICacheFromto(processor, methodZoneBase, ((sqInt)(limitZony())));
+			flushICacheFromto(processor, ((usqInt)methodZoneBase), ((usqInt)(limitZony())));
 		}
 	}
 }
@@ -15173,6 +15158,7 @@
 			unpairedMethodList = ((usqInt)source);
 		}
 
+		
 		if (((source->cmType)) == CMOpenPIC) {
 			(source->nextOpenPIC = ((usqInt)openPICList));
 			openPICList = source;
@@ -15209,6 +15195,7 @@
 				}
 			}
 			else {
+				;
 				if (((dest->cmType)) == CMOpenPIC) {
 					(dest->nextOpenPIC = ((usqInt)openPICList));
 					openPICList = dest;
@@ -15320,7 +15307,7 @@
 
 
 /*	Free methods, preferring older methods for compaction, up to some
-	fraction. 
+	fraction, currently a quarter.
  */
 
 	/* CogMethodZone>>#freeOlderMethodsForCompaction */
@@ -15349,7 +15336,7 @@
 		cogMethod = ((CogMethod *) baseAddress);
 		while (((((usqInt)cogMethod)) < mzFreeStart)
 		 && (freedSoFar < amountToFree)) {
-			if ((((cogMethod->cmType)) == CMMethod)
+			if ((((cogMethod->cmType)) != CMFree)
 			 && (((cogMethod->cmUsageCount)) <= freeableUsage)) {
 				freeMethod(cogMethod);
 				freedSoFar += (cogMethod->blockSize);
@@ -15486,9 +15473,20 @@
 }
 
 
-/*	Some metods have been freed. Compute how much each survivor needs to
+/*	Some methods have been freed. Compute how much each survivor needs to
 	move during the ensuing compaction and record it in the objectHeader
-	field.  */
+	field. 
+	For Sista, where we want PICs to last so they can be observed, we need to
+	keep PICs unless
+	they are definitely unused. So we need to identify unused PICs. So in
+	planCompact, zero the
+	usage counts of all PICs, saving the actual usage count in
+	blockEntryOffset. Then in
+	relocateMethodsPreCompaction (actually in
+	relocateIfCallOrMethodReference:mcpc:delta:) restore the usage counts of
+	used PICs. Finally in compactCompiledCode, clear the blockEntryOffset
+	of the unused PICs; they will then have a zero count and be reclaimed in
+	the next code compaction. */
 
 	/* CogMethodZone>>#planCompaction */
 static void
@@ -15506,6 +15504,7 @@
 		else {
 			assert((cogMethodDoesntLookKosher(cogMethod)) == 0);
 			(cogMethod->objectHeader = delta);
+			
 		}
 		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
 	}
@@ -15698,6 +15697,34 @@
 	youngReferrers = dest;
 }
 
+
+/*	All surviving methods have had the amount they are going to relocate by
+	stored in their objectHeader fields. Relocate all relative calls so that
+	after the compaction of both the method containing each call and the call
+	target the calls invoke the same target. */
+
+	/* CogMethodZone>>#relocateMethodsPreCompaction */
+static sqInt
+relocateMethodsPreCompaction(void)
+{
+    CogMethod *cogMethod;
+
+	cogMethod = ((CogMethod *) baseAddress);
+	while (cogMethod < mzFreeStart) {
+		if (((cogMethod->cmType)) != CMFree) {
+			if (((cogMethod->cmType)) == CMClosedPIC) {
+				relocateCallsInClosedPIC(cogMethod);
+			}
+			else {
+				relocateCallsAndSelfReferencesInMethod(cogMethod);
+			}
+		}
+		cogMethod = ((CogMethod *) (roundUpLength((((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
+	}
+	relocateAndPruneYoungReferrers();
+	return 1;
+}
+
 	/* CogMethodZone>>#removeFromOpenPICList: */
 static sqInt
 removeFromOpenPICList(CogMethod *anOpenPIC)
@@ -15820,6 +15847,27 @@
 	return unimplementedPrimitive();
 }
 
+
+/*	Generate a compare and branch to test if aRegister contains other than a
+	SmallInteger. Answer the jump. Use scratch if required. Subclasses will
+	override if scratch is needed. */
+
+	/* CogObjectRepresentation>>#genJumpNotSmallInteger:scratchReg: */
+static AbstractInstruction *
+genJumpNotSmallIntegerscratchReg(sqInt aRegister, sqInt scratch)
+{
+	return genJumpNotSmallInteger(aRegister);
+}
+
+	/* CogObjectRepresentation>>#genLoadSlot:sourceReg:destReg: */
+static sqInt
+genLoadSlotsourceRegdestReg(sqInt index, sqInt sourceReg, sqInt destReg)
+{
+	/* begin MoveMw:r:R: */
+	genoperandoperandoperand(MoveMwrR, (index * BytesPerWord) + BaseHeaderSize, sourceReg, destReg);
+	return 0;
+}
+
 	/* CogObjectRepresentation>>#isUnannotatableConstant: */
 static sqInt
 isUnannotatableConstant(CogSimStackEntry *simStackEntry)
@@ -16405,7 +16453,7 @@
 	/* c.f. StackInterpreter>>stSizeOf: SpurMemoryManager>>lengthOf:format: fixedFieldsOf:format:length: */
 
 	jumpImmediate = genJumpImmediate(ReceiverResultReg);
-	jumpBadIndex = genJumpNotSmallInteger(Arg0Reg);
+	jumpBadIndex = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	genConvertSmallIntegerToIntegerInReg(Arg0Reg);
 	/* begin SubCq:R: */
 	genoperandoperand(SubCqR, 1, Arg0Reg);
@@ -16471,9 +16519,7 @@
 	jmpTarget(jumpNotPointers, gCmpCqR(firstCompiledMethodFormat(), formatReg));
 	/* begin JumpAboveOrEqual: */
 	jumpIsCompiledMethod = genoperand(JumpAboveOrEqual, ((sqInt)0));
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg1Reg, TempReg);
-	jumpNonSmallIntegerValue = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNonSmallIntegerValue = genJumpNotSmallIntegerscratchReg(Arg1Reg, TempReg);
 	/* begin CmpCq:R: */
 	quickConstant3 = firstByteFormat();
 	genoperandoperand(CmpCqR, quickConstant3, formatReg);
@@ -16797,15 +16843,11 @@
 	/* check size and fail if not a +ve integer */
 
 	maxSlots = (numSlotsMask()) - 1;
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg1Reg, TempReg);
 
 	/* Is the class arg pointers with at least 3 fields? */
 
-	jumpNElementsNonInt = genJumpNotSmallIntegerInScratchReg(TempReg);
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
-	jumpImmediate = genJumpImmediateInScratchReg(TempReg);
+	jumpNElementsNonInt = genJumpNotSmallIntegerscratchReg(Arg1Reg, TempReg);
+	jumpImmediate = genJumpImmediate(Arg0Reg);
 	genGetFormatOfintoleastSignificantHalfOfBaseHeaderIntoScratch(Arg0Reg, TempReg, null);
 	/* begin CmpCq:R: */
 	quickConstant = nonIndexablePointerFormat();
@@ -17025,12 +17067,10 @@
 	/* begin MoveAw:R: */
 	address = freeStartAddress();
 	genoperandoperand(MoveAwR, address, Arg1Reg);
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
 
 	/* Is the class arg pointers with at least 3 fields? */
 
-	jumpImmediate = genJumpImmediateInScratchReg(TempReg);
+	jumpImmediate = genJumpImmediate(Arg0Reg);
 	genGetFormatOfintoleastSignificantHalfOfBaseHeaderIntoScratch(Arg0Reg, TempReg, null);
 	/* begin CmpCq:R: */
 	quickConstant = nonIndexablePointerFormat();
@@ -17046,10 +17086,10 @@
 	/* begin JumpZero: */
 	jumpUnhashed = genoperand(JumpZero, ((sqInt)0));
 	genLoadSlotsourceRegdestReg(InstanceSpecificationIndex, Arg0Reg, instSpecReg);
+	jumpBadFormat = genJumpNotSmallIntegerscratchReg(instSpecReg, TempReg);
+	genConvertSmallIntegerToIntegerInReg(instSpecReg);
 	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, instSpecReg, TempReg);
-	jumpBadFormat = genJumpNotSmallIntegerInScratchReg(TempReg);
-	genConvertSmallIntegerToIntegerInReg(instSpecReg);
 	/* begin LogicalShiftRightCq:R: */
 	quickConstant1 = fixedFieldsFieldWidth();
 	genoperandoperand(LogicalShiftRightCqR, quickConstant1, TempReg);
@@ -17695,16 +17735,6 @@
 	return genoperand(JumpZero, ((sqInt)0));
 }
 
-	/* CogObjectRepresentationFor32BitSpur>>#genJumpSmallIntegerInScratchReg: */
-static AbstractInstruction *
-genJumpSmallIntegerInScratchReg(sqInt aRegister)
-{
-	/* begin AndCq:R: */
-	genoperandoperand(AndCqR, 1, aRegister);
-	/* begin JumpNonZero: */
-	return genoperand(JumpNonZero, ((sqInt)0));
-}
-
 	/* CogObjectRepresentationFor32BitSpur>>#genJumpSmallInteger: */
 static AbstractInstruction *
 genJumpSmallInteger(sqInt aRegister)
@@ -18119,34 +18149,31 @@
 	return 0;
 }
 
+	/* CogObjectRepresentationForSpur>>#genEnsureOopInRegNotForwarded:scratchReg: */
+static sqInt
+genEnsureOopInRegNotForwardedscratchReg(sqInt reg, sqInt scratch)
+{
+	return genEnsureOopInRegNotForwardedscratchRegjumpBackTo(reg, scratch, gLabel());
+}
 
-/*	Make sure that the object in reg is not forwarded, and the field
-	reg[offset] is updated
-	if the object in reg is forwarded. Use the fact that
-	isForwardedObjectClassIndexPun is
-	a power of two to save an instruction. */
-
-	/* CogObjectRepresentationForSpur>>#genEnsureObjInRegNotForwarded:scratchReg:updatingMw:r: */
+	/* CogObjectRepresentationForSpur>>#genEnsureOopInRegNotForwarded:scratchReg:jumpBackTo: */
 static sqInt
-genEnsureObjInRegNotForwardedscratchRegupdatingMwr(sqInt reg, sqInt scratch, sqInt offset, sqInt baseReg)
+genEnsureOopInRegNotForwardedscratchRegjumpBackTo(sqInt reg, sqInt scratch, AbstractInstruction *instruction)
 {
+    AbstractInstruction *finished;
     AbstractInstruction *imm;
-    AbstractInstruction *loop;
     AbstractInstruction *ok;
     sqInt quickConstant;
 
+	/* begin genEnsureOopInRegNotForwarded:scratchReg:ifForwarder:ifNotForwarder: */
 	assert(reg != scratch);
-	/* begin Label */
-	loop = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, reg, scratch);
 
 	/* notionally
 	   self genGetClassIndexOfNonImm: reg into: scratch.
 	   cogit CmpCq: objectMemory isForwardedObjectClassIndexPun R: TempReg.
 	   but the following is an instruction shorter: */
 
-	imm = genJumpImmediateInScratchReg(scratch);
+	imm = genJumpImmediate(reg);
 	/* begin MoveMw:r:R: */
 	genoperandoperandoperand(MoveMwrR, 0, reg, scratch);
 	/* begin AndCq:R: */
@@ -18155,41 +18182,41 @@
 	/* begin JumpNonZero: */
 	ok = genoperand(JumpNonZero, ((sqInt)0));
 	genLoadSlotsourceRegdestReg(0, reg, reg);
-	/* begin MoveR:Mw:r: */
-	genoperandoperandoperand(MoveRMwr, reg, offset, baseReg);
 	/* begin Jump: */
-	genoperand(Jump, ((sqInt)loop));
-	jmpTarget(ok, jmpTarget(imm, gLabel()));
+	genoperand(Jump, ((sqInt)(((void *) instruction))));
+	/* begin Label */
+	finished = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
+
+	jmpTarget(imm, jmpTarget(ok, finished));
 	return 0;
 }
 
-	/* CogObjectRepresentationForSpur>>#genEnsureOopInRegNotForwarded:scratchReg: */
-static sqInt
-genEnsureOopInRegNotForwardedscratchReg(sqInt reg, sqInt scratch)
-{
-	return genEnsureOopInRegNotForwardedscratchRegjumpBackTo(reg, scratch, gLabel());
-}
 
-	/* CogObjectRepresentationForSpur>>#genEnsureOopInRegNotForwarded:scratchReg:jumpBackTo: */
+/*	Make sure that the oop in reg is not forwarded, and the field reg[offset]
+	is updated
+	if the object in reg is forwarded. Use the fact that
+	isForwardedObjectClassIndexPun is
+	a power of two to save an instruction. */
+
+	/* CogObjectRepresentationForSpur>>#genEnsureOopInRegNotForwarded:scratchReg:updatingMw:r: */
 static sqInt
-genEnsureOopInRegNotForwardedscratchRegjumpBackTo(sqInt reg, sqInt scratch, AbstractInstruction *instruction)
+genEnsureOopInRegNotForwardedscratchRegupdatingMwr(sqInt reg, sqInt scratch, sqInt offset, sqInt baseReg)
 {
-    AbstractInstruction *finished;
+    AbstractInstruction *imm;
+    AbstractInstruction *loop;
     AbstractInstruction *ok;
     sqInt quickConstant;
-    AbstractInstruction *skip;
 
-	/* begin genEnsureOopInRegNotForwarded:scratchReg:ifForwarder:ifNotForwarder: */
 	assert(reg != scratch);
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, reg, scratch);
+	/* begin Label */
+	loop = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
 
 	/* notionally
 	   self genGetClassIndexOfNonImm: reg into: scratch.
 	   cogit CmpCq: objectMemory isForwardedObjectClassIndexPun R: TempReg.
 	   but the following is an instruction shorter: */
 
-	skip = genJumpImmediateInScratchReg(scratch);
+	imm = genJumpImmediate(reg);
 	/* begin MoveMw:r:R: */
 	genoperandoperandoperand(MoveMwrR, 0, reg, scratch);
 	/* begin AndCq:R: */
@@ -18198,12 +18225,11 @@
 	/* begin JumpNonZero: */
 	ok = genoperand(JumpNonZero, ((sqInt)0));
 	genLoadSlotsourceRegdestReg(0, reg, reg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, reg, offset, baseReg);
 	/* begin Jump: */
-	genoperand(Jump, ((sqInt)(((void *) instruction))));
-	/* begin Label */
-	finished = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
-
-	jmpTarget(skip, jmpTarget(ok, finished));
+	genoperand(Jump, ((sqInt)loop));
+	jmpTarget(ok, jmpTarget(imm, gLabel()));
 	return 0;
 }
 
@@ -18656,19 +18682,6 @@
 	return 0;
 }
 
-	/* CogObjectRepresentationForSpur>>#genJumpImmediateInScratchReg: */
-static AbstractInstruction *
-genJumpImmediateInScratchReg(sqInt aRegister)
-{
-    sqInt quickConstant;
-
-	/* begin AndCq:R: */
-	quickConstant = tagMask();
-	genoperandoperand(AndCqR, quickConstant, aRegister);
-	/* begin JumpNonZero: */
-	return genoperand(JumpNonZero, ((sqInt)0));
-}
-
 	/* CogObjectRepresentationForSpur>>#genJumpImmediate: */
 static AbstractInstruction *
 genJumpImmediate(sqInt aRegister)
@@ -18699,16 +18712,7 @@
 	return genoperand(JumpNonZero, ((sqInt)0));
 }
 
-	/* CogObjectRepresentationForSpur>>#genLoadSlot:sourceReg:destReg: */
-static sqInt
-genLoadSlotsourceRegdestReg(sqInt index, sqInt sourceReg, sqInt destReg)
-{
-	/* begin MoveMw:r:R: */
-	genoperandoperandoperand(MoveMwrR, (index * BytesPerWord) + BaseHeaderSize, sourceReg, destReg);
-	return 0;
-}
 
-
 /*	Generate the code for a store check of valueReg into destReg. */
 
 	/* CogObjectRepresentationForSpur>>#genStoreCheckReceiverReg:valueReg:scratchReg:inFrame: */
@@ -20920,7 +20924,7 @@
 		address = (((usqInt)cogMethod)) + (externalPrimCallOffsets[(cogMethod->cmNumArgs)]);
 		extent = rewriteFullTransferAttargetexpectedInstruction(backEnd, address, ((usqInt)primFunctionPointer), 3778019132UL);
 	}
-	flushICacheFromto(processor, address, address + extent);
+	flushICacheFromto(processor, ((usqInt)address), (((usqInt)address)) + extent);
 }
 
 	/* SimpleStackBasedCogit>>#v3:Block:Code:Size: */
@@ -21802,10 +21806,8 @@
 	/* begin MoveMw:r:R: */
 	offset2 = (((usqInt)(methodCacheAddress()))) + (MethodCacheMethod << (shiftForWord()));
 	genoperandoperandoperand(MoveMwrR, offset2, ClassReg, SendNumArgsReg);
-	genLoadSlotsourceRegdestReg(HeaderIndex, SendNumArgsReg, TempReg);
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, TempReg, ClassReg);
-	jumpBCMethod = genJumpSmallIntegerInScratchReg(TempReg);
+	genLoadSlotsourceRegdestReg(HeaderIndex, SendNumArgsReg, ClassReg);
+	jumpBCMethod = genJumpImmediate(ClassReg);
 	jmpTarget(jumpBCMethod, picInterpretAbort);
 	/* begin AddCq:R: */
 	genoperandoperand(AddCqR, cmNoCheckEntryOffset, ClassReg);
@@ -22598,12 +22600,10 @@
     AbstractInstruction *jumpImmediate;
     AbstractInstruction *jumpNonInt;
 
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
 	genGetDoubleValueOfinto(ReceiverResultReg, DPFPReg0);
 	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, Arg0Reg, ClassReg);
-	jumpImmediate = genJumpImmediateInScratchReg(TempReg);
+	jumpImmediate = genJumpImmediate(Arg0Reg);
 	genGetCompactClassIndexNonImmOfinto(Arg0Reg, SendNumArgsReg);
 	genCmpClassFloatCompactIndexR(SendNumArgsReg);
 	/* begin JumpNonZero: */
@@ -22629,7 +22629,7 @@
 	/* begin Jump: */
 	jumpFailClass = genoperand(Jump, ((sqInt)0));
 	jmpTarget(jumpImmediate, gLabel());
-	jumpNonInt = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNonInt = genJumpNotSmallInteger(Arg0Reg);
 
 	genConvertSmallIntegerToIntegerInReg(ClassReg);
 	/* begin ConvertR:Rd: */
@@ -22660,10 +22660,8 @@
     AbstractInstruction *jumpImmediate;
     AbstractInstruction *jumpNonInt;
 
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
 	genGetDoubleValueOfinto(ReceiverResultReg, DPFPReg0);
-	jumpImmediate = genJumpImmediateInScratchReg(TempReg);
+	jumpImmediate = genJumpImmediate(Arg0Reg);
 	genGetCompactClassIndexNonImmOfinto(Arg0Reg, SendNumArgsReg);
 	genCmpClassFloatCompactIndexR(SendNumArgsReg);
 	/* begin JumpNonZero: */
@@ -22700,7 +22698,7 @@
 	/* begin RetN: */
 	genoperand(RetN, 0);
 	jmpTarget(jumpImmediate, gLabel());
-	jumpNonInt = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNonInt = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 
 	genConvertSmallIntegerToIntegerInReg(Arg0Reg);
 	/* begin ConvertR:Rd: */
@@ -23313,10 +23311,8 @@
     AbstractInstruction *jumpOvfl;
 
 	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
-	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, Arg0Reg, ClassReg);
-	jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNotSI = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	genRemoveSmallIntegerTagsInScratchReg(ClassReg);
 	/* begin AddR:R: */
 	genoperandoperand(AddRR, ReceiverResultReg, ClassReg);
@@ -23400,12 +23396,10 @@
 {
     AbstractInstruction *jumpNotSI;
 
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
 
 	/* Whether the SmallInteger tags are zero or non-zero, oring them together will preserve them. */
 
-	jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNotSI = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	/* begin AndR:R: */
 	genoperandoperand(AndRR, Arg0Reg, ReceiverResultReg);
 	/* begin RetN: */
@@ -23420,12 +23414,10 @@
 {
     AbstractInstruction *jumpNotSI;
 
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
 
 	/* Whether the SmallInteger tags are zero or non-zero, oring them together will preserve them. */
 
-	jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNotSI = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	/* begin OrR:R: */
 	genoperandoperand(OrRR, Arg0Reg, ReceiverResultReg);
 	/* begin RetN: */
@@ -23487,10 +23479,8 @@
 
 	assert((numRegArgs()) >= 1);
 	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
-	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, Arg0Reg, ClassReg);
-	jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNotSI = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	genConvertSmallIntegerToIntegerInReg(ClassReg);
 	if (!(setsConditionCodesFor(lastOpcode(), JumpNegative))) {
 		/* begin CmpCq:R: */
@@ -23542,12 +23532,10 @@
 {
     AbstractInstruction *jumpNotSI;
 
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
 
 	/* Clear one or the other tag so that xoring will preserve them. */
 
-	jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNotSI = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	genRemoveSmallIntegerTagsInScratchReg(Arg0Reg);
 	/* begin XorR:R: */
 	genoperandoperand(XorRR, Arg0Reg, ReceiverResultReg);
@@ -23641,6 +23629,9 @@
 	genCmpClassMethodContextCompactIndexR(TempReg);
 	/* begin JumpNonZero: */
 	jumpFail2 = genoperand(JumpNonZero, ((sqInt)0));
+	genLoadSlotsourceRegdestReg(ReceiverIndex, ClassReg, SendNumArgsReg);
+	genEnsureOopInRegNotForwardedscratchRegupdatingMwr(SendNumArgsReg, TempReg, (ReceiverIndex * BytesPerWord) + BaseHeaderSize, ClassReg);
+
 	genLoadSlotsourceRegdestReg(MethodIndex, ClassReg, SendNumArgsReg);
 	jumpFail3 = genJumpImmediate(SendNumArgsReg);
 	genGetFormatOfinto(SendNumArgsReg, TempReg);
@@ -23685,8 +23676,6 @@
     AbstractInstruction *jumpZero;
 
 	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
-	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, Arg0Reg, ClassReg);
 	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, Arg0Reg, Arg1Reg);
@@ -23694,7 +23683,7 @@
 	/* We must shift away the tags, not just subtract them, so that the
 	   overflow case doesn't actually overflow the machine instruction. */
 
-	jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNotSI = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	genShiftAwaySmallIntegerTagsInScratchReg(ClassReg);
 	if (!(setsConditionCodesFor(lastOpcode(), JumpZero))) {
 		/* begin CmpCq:R: */
@@ -23744,14 +23733,12 @@
     sqInt quickConstant;
 
 	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
-	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, Arg0Reg, ClassReg);
 
 	/* We must shift away the tags, not just subtract them, so that the
 	   overflow case doesn't actually overflow the machine instruction. */
 
-	jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNotSI = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	genShiftAwaySmallIntegerTagsInScratchReg(ClassReg);
 	/* begin JumpZero: */
 	jumpZero = genoperand(JumpZero, ((sqInt)0));
@@ -23829,10 +23816,8 @@
     AbstractInstruction *jumpZero;
 
 	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
-	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, Arg0Reg, ClassReg);
-	jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNotSI = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	genRemoveSmallIntegerTagsInScratchReg(ClassReg);
 	/* begin JumpZero: */
 	jumpZero = genoperand(JumpZero, ((sqInt)0));
@@ -23876,12 +23861,10 @@
     AbstractInstruction *jumpOvfl;
 
 	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
-	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, Arg0Reg, ClassReg);
 	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, ReceiverResultReg, Arg1Reg);
-	jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNotSI = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	genShiftAwaySmallIntegerTagsInScratchReg(ClassReg);
 	genRemoveSmallIntegerTagsInScratchReg(Arg1Reg);
 	gMulRR(Arg1Reg, ClassReg);
@@ -23979,14 +23962,12 @@
     sqInt quickConstant;
 
 	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
-	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, Arg0Reg, ClassReg);
 
 	/* We must shift away the tags, not just subtract them, so that the
 	   overflow case doesn't actually overflow the machine instruction. */
 
-	jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpNotSI = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	genShiftAwaySmallIntegerTagsInScratchReg(ClassReg);
 	if (!(setsConditionCodesFor(lastOpcode(), JumpZero))) {
 		/* begin CmpCq:R: */
@@ -24057,10 +24038,8 @@
     AbstractInstruction *jumpNotSI;
     AbstractInstruction *jumpOvfl;
 
+	jumpNotSI = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
-	jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
-	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
 	/* begin SubR:R: */
 	genoperandoperand(SubRR, Arg0Reg, TempReg);
@@ -24485,9 +24464,7 @@
     AbstractInstruction *jumpFail;
     AbstractInstruction *jumpTrue;
 
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
-	jumpFail = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpFail = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	/* begin CmpR:R: */
 	genoperandoperand(CmpRR, Arg0Reg, ReceiverResultReg);
 	jumpTrue = gen(jumpOpcode);
@@ -24528,9 +24505,7 @@
 
 	return genSmallIntegerComparison(jumpOpcode);
 
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg0Reg, TempReg);
-	jumpDouble = genJumpNotSmallIntegerInScratchReg(TempReg);
+	jumpDouble = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
 	/* begin CmpR:R: */
 	genoperandoperand(CmpRR, Arg0Reg, ReceiverResultReg);
 	jumpTrue = gen(jumpOpcode);
@@ -24550,9 +24525,7 @@
 	/* begin RetN: */
 	genoperand(RetN, 0);
 	jmpTarget(jumpDouble, gLabel());
-	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, ClassReg, TempReg);
-	jumpNonInt = genJumpImmediateInScratchReg(TempReg);
+	jumpNonInt = genJumpImmediate(Arg0Reg);
 
 	genGetCompactClassIndexNonImmOfinto(Arg0Reg, SendNumArgsReg);
 	genCmpClassFloatCompactIndexR(SendNumArgsReg);
@@ -24981,6 +24954,8 @@
     AbstractInstruction *finished;
     AbstractInstruction *finished1;
     usqInt fixup;
+    AbstractInstruction *imm;
+    AbstractInstruction *imm1;
     void *jumpTarget;
     void *jumpTarget1;
     AbstractInstruction *label;
@@ -25003,8 +24978,6 @@
     sqInt rNext1;
     sqInt rTop;
     sqInt rTop1;
-    AbstractInstruction *skip;
-    AbstractInstruction *skip1;
     sqInt target;
     sqInt targetBytecodePC;
     sqInt targetBytecodePC1;
@@ -25158,15 +25131,13 @@
 		else {
 			/* begin genEnsureOopInRegNotForwarded:scratchReg:ifForwarder:ifNotForwarder: */
 			assert(argReg != TempReg);
-			/* begin MoveR:R: */
-			genoperandoperand(MoveRR, argReg, TempReg);
 
 			/* notionally
 			   self genGetClassIndexOfNonImm: reg into: scratch.
 			   cogit CmpCq: objectMemory isForwardedObjectClassIndexPun R: TempReg.
 			   but the following is an instruction shorter: */
 
-			skip = genJumpImmediateInScratchReg(TempReg);
+			imm = genJumpImmediate(argReg);
 			/* begin MoveMw:r:R: */
 			genoperandoperandoperand(MoveMwrR, 0, argReg, TempReg);
 			/* begin AndCq:R: */
@@ -25184,22 +25155,20 @@
 			else {
 				finished = ((AbstractInstruction *) fixup);
 			}
-			jmpTarget(skip, jmpTarget(ok, finished));
+			jmpTarget(imm, jmpTarget(ok, finished));
 			0;
 		}
 	}
 	if (unforwardRcvr) {
 		/* begin genEnsureOopInRegNotForwarded:scratchReg:ifForwarder:ifNotForwarder: */
 		assert(rcvrReg != TempReg);
-		/* begin MoveR:R: */
-		genoperandoperand(MoveRR, rcvrReg, TempReg);
 
 		/* notionally
 		   self genGetClassIndexOfNonImm: reg into: scratch.
 		   cogit CmpCq: objectMemory isForwardedObjectClassIndexPun R: TempReg.
 		   but the following is an instruction shorter: */
 
-		skip1 = genJumpImmediateInScratchReg(TempReg);
+		imm1 = genJumpImmediate(rcvrReg);
 		/* begin MoveMw:r:R: */
 		genoperandoperandoperand(MoveMwrR, 0, rcvrReg, TempReg);
 		/* begin AndCq:R: */
@@ -25217,7 +25186,7 @@
 		else {
 			finished1 = ((AbstractInstruction *) fixup);
 		}
-		jmpTarget(skip1, jmpTarget(ok1, finished1));
+		jmpTarget(imm1, jmpTarget(ok1, finished1));
 		0;
 	}
 	return 0;

Modified: branches/Cog/nsspursrc/vm/cogitIA32.c
===================================================================
--- branches/Cog/nsspursrc/vm/cogitIA32.c	2015-06-03 16:00:39 UTC (rev 3367)
+++ branches/Cog/nsspursrc/vm/cogitIA32.c	2015-06-04 05:19:31 UTC (rev 3368)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1333 uuid: bc9001c2-8816-4b4e-bf91-8e11cad6ed6b
+	CCodeGenerator VMMaker.oscog-eem.1336 uuid: a8254ed3-d450-4a8a-aa78-7ae88f6aae1a
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.1333 uuid: bc9001c2-8816-4b4e-bf91-8e11cad6ed6b
+	StackToRegisterMappingCogit VMMaker.oscog-eem.1336 uuid: a8254ed3-d450-4a8a-aa78-7ae88f6aae1a
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1333 uuid: bc9001c2-8816-4b4e-bf91-8e11cad6ed6b " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1336 uuid: a8254ed3-d450-4a8a-aa78-7ae88f6aae1a " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -394,6 +394,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;
+sqInt defaultCogCodeSize(AbstractInstruction * self_in_defaultCogCodeSize);
 static sqInt genAlignCStackSavingRegistersnumArgswordAlignment(AbstractInstruction * self_in_genAlignCStackSavingRegistersnumArgswordAlignment, sqInt saveRegs, sqInt numArgs, sqInt alignment) NoDbgRegParms;
 static AbstractInstruction * generateICacheFlush(AbstractInstruction * self_in_generateICacheFlush) NoDbgRegParms;
 static AbstractInstruction * genWriteCResultIntoReg(AbstractInstruction * self_in_genWriteCResultIntoReg, sqInt abstractRegister) NoDbgRegParms;
@@ -696,7 +697,6 @@
 static void relocateCallsAndSelfReferencesInMethod(CogMethod *cogMethod) NoDbgRegParms;
 static void relocateCallsInClosedPIC(CogMethod *cPIC) NoDbgRegParms;
 static sqInt relocateIfCallOrMethodReferencemcpcdelta(sqInt annotation, char *mcpc, sqInt delta) NoDbgRegParms;
-static sqInt relocateMethodsPreCompaction(void);
 static sqInt remapIfObjectRefpchasYoung(sqInt annotation, char *mcpc, sqInt hasYoungPtr) NoDbgRegParms;
 static AbstractInstruction * gSubCwR(sqInt wordConstant, sqInt reg) NoDbgRegParms;
 static sqInt scanForCleanBlocks(void);
@@ -750,6 +750,7 @@
 void printOpenPICList(void);
 static sqInt pruneYoungReferrers(void);
 static sqInt relocateAndPruneYoungReferrers(void);
+static sqInt relocateMethodsPreCompaction(void);
 static sqInt removeFromOpenPICList(CogMethod *anOpenPIC) NoDbgRegParms;
 static sqInt removeFromUnpairedMethodList(CogMethod *aCogMethod) NoDbgRegParms;
 static void voidYoungReferrersPostTenureAll(void);
@@ -758,6 +759,8 @@
 static AbstractInstruction * genCmpClassFloatCompactIndexR(sqInt reg) NoDbgRegParms;
 static AbstractInstruction * genCmpClassMethodContextCompactIndexR(sqInt reg) NoDbgRegParms;
 static sqInt genInnerPrimitiveNewMethod(sqInt retNoffset) NoDbgRegParms;
+static AbstractInstruction * genJumpNotSmallIntegerscratchReg(sqInt aRegister, sqInt scratch) NoDbgRegParms;
+static sqInt genLoadSlotsourceRegdestReg(sqInt index, sqInt sourceReg, sqInt destReg) NoDbgRegParms;
 static sqInt isUnannotatableConstant(CogSimStackEntry *simStackEntry) NoDbgRegParms;
 static sqInt genAddSmallIntegerTagsTo(sqInt aRegister) NoDbgRegParms;
 static void genConvertCharacterToSmallIntegerInReg(sqInt reg) NoDbgRegParms;
@@ -785,7 +788,6 @@
 static sqInt genInnerPrimitiveStringAt(sqInt retNoffset) NoDbgRegParms;
 static AbstractInstruction * genJumpNotSmallIntegerInScratchReg(sqInt aRegister) NoDbgRegParms;
 static AbstractInstruction * genJumpNotSmallInteger(sqInt aRegister) NoDbgRegParms;
-static AbstractInstruction * genJumpSmallIntegerInScratchReg(sqInt aRegister) NoDbgRegParms;
 static AbstractInstruction * genJumpSmallInteger(sqInt aRegister) NoDbgRegParms;
 static sqInt genNewArrayOfSizeinitialized(sqInt size, sqInt initialized) NoDbgRegParms;
 static sqInt genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock) NoDbgRegParms;
@@ -809,9 +811,9 @@
 static sqInt genConvertCharacterToCodeInReg(sqInt reg) NoDbgRegParms;
 static sqInt genConvertIntegerToCharacterInReg(sqInt reg) NoDbgRegParms;
 static sqInt genEnsureObjInRegNotForwardedscratchReg(sqInt reg, sqInt scratch) NoDbgRegParms;
-static sqInt genEnsureObjInRegNotForwardedscratchRegupdatingMwr(sqInt reg, sqInt scratch, sqInt offset, sqInt baseReg) NoDbgRegParms;
 static sqInt genEnsureOopInRegNotForwardedscratchReg(sqInt reg, sqInt scratch) NoDbgRegParms;
 static sqInt genEnsureOopInRegNotForwardedscratchRegjumpBackTo(sqInt reg, sqInt scratch, AbstractInstruction *instruction) NoDbgRegParms;
+static sqInt genEnsureOopInRegNotForwardedscratchRegupdatingMwr(sqInt reg, sqInt scratch, sqInt offset, sqInt baseReg) NoDbgRegParms;
 static void generateObjectRepresentationTrampolines(void);
 static sqInt genGetActiveContextNumArgslargeinBlock(sqInt numArgs, sqInt isLargeContext, sqInt isInBlock) NoDbgRegParms;
 static sqInt genGetBitsofFormatByteOfintobaseHeaderIntoScratch(sqInt mask, sqInt sourceReg, sqInt destReg, sqInt scratchReg) NoDbgRegParms;
@@ -827,10 +829,8 @@
 static sqInt genInnerPrimitiveCharacterValue(sqInt retNOffset) NoDbgRegParms;
 static sqInt genInnerPrimitiveIdenticalorNotIf(sqInt retNoffset, sqInt orNot) NoDbgRegParms;
 static sqInt genInnerPrimitiveSize(sqInt retNoffset) NoDbgRegParms;
-static AbstractInstruction * genJumpImmediateInScratchReg(sqInt aRegister) NoDbgRegParms;
 static AbstractInstruction * genJumpImmediate(sqInt aRegister) NoDbgRegParms;
 static AbstractInstruction * genJumpNotCharacterInScratchReg(sqInt reg) NoDbgRegParms;
-static sqInt genLoadSlotsourceRegdestReg(sqInt index, sqInt sourceReg, sqInt destReg) NoDbgRegParms;
 static sqInt genStoreCheckReceiverRegvalueRegscratchReginFrame(sqInt destReg, sqInt valueReg, sqInt scratchReg, sqInt inFrame) NoDbgRegParms;
 static sqInt genStoreImmediateInSourceRegslotIndexdestReg(sqInt sourceReg, sqInt index, sqInt destReg) NoDbgRegParms;
 static sqInt genStoreSourceRegslotIndexdestRegscratchReginFrame(sqInt sourceReg, sqInt index, sqInt destReg, sqInt scratchReg, sqInt inFrame) NoDbgRegParms;
@@ -1966,6 +1966,18 @@
 	return null;
 }
 
+
+/*	Return the default number of bytes to allocate for native code at startup.
+	The actual value can be set via vmParameterAt: and/or a preference in the
+	ini file. */
+
+	/* CogAbstractInstruction>>#defaultCogCodeSize */
+sqInt
+defaultCogCodeSize(AbstractInstruction * self_in_defaultCogCodeSize)
+{
+	return 1024 * 1024;
+}
+
 	/* CogAbstractInstruction>>#genAlignCStackSavingRegisters:numArgs:wordAlignment: */
 static sqInt
 genAlignCStackSavingRegistersnumArgswordAlignment(AbstractInstruction * self_in_genAlignCStackSavingRegistersnumArgswordAlignment, sqInt saveRegs, sqInt numArgs, sqInt alignment)
@@ -7149,12 +7161,12 @@
 			}
 			return ceSendFromInLineCacheMiss(targetMethod);
 		}
-		flushICacheFromto(processor, ((sqInt)pic), (((sqInt)pic)) + closedPICSize);
+		flushICacheFromto(processor, ((usqInt)pic), (((usqInt)pic)) + closedPICSize);
 	}
 	extent = (((pic->cmType)) == CMOpenPIC
 		? rewriteInlineCacheAttagtarget(backEnd, outerReturn, (targetMethod->selector), (((sqInt)pic)) + cmEntryOffset)
 		: rewriteCallAttarget(backEnd, outerReturn, (((sqInt)pic)) + cmEntryOffset));
-	flushICacheFromto(processor, (outerReturn - 1) - extent, outerReturn - 1);
+	flushICacheFromto(processor, ((((usqInt)outerReturn)) - 1) - extent, (((usqInt)outerReturn)) - 1);
 	executeCogPICfromLinkedSendWithReceiverandCacheTag(pic, receiver, inlineCacheTagAt(backEnd, outerReturn));
 	return null;
 }
@@ -7819,7 +7831,7 @@
 	address = addressOfEndOfCaseinCPIC(((cPIC->cPICNumCases)) - 1, cPIC);
 	size = generateInstructionsAt(address);
 	end = outputInstructionsAt(address);
-	flushICacheFromto(processor, ((sqInt)cPIC), (((sqInt)cPIC)) + closedPICSize);
+	flushICacheFromto(processor, ((usqInt)cPIC), (((usqInt)cPIC)) + closedPICSize);
 	(cPIC->cPICNumCases = ((cPIC->cPICNumCases)) + 1);
 	return 0;
 }
@@ -8166,7 +8178,7 @@
 	compactCompiledCode();
 	assert(allMethodsHaveCorrectHeader());
 	assert(kosherYoungReferrers());
-	flushICacheFromto(processor, methodZoneBase, freeStart());
+	flushICacheFromto(processor, ((usqInt)methodZoneBase), ((usqInt)(freeStart())));
 }
 
 
@@ -9351,7 +9363,7 @@
 	/* begin RetN: */
 	genoperand(RetN, 0);
 	outputInstructionsForGeneratedRuntimeAt(startAddress);
-	flushICacheFromto(processor, startAddress, methodZoneBase);
+	flushICacheFromto(processor, ((usqInt)startAddress), ((usqInt)methodZoneBase));
 	recordGeneratedRunTimeaddress("ceCaptureCStackPointers", startAddress);
 	ceCaptureCStackPointers = ((void (*)(void)) startAddress);
 }
@@ -9700,7 +9712,7 @@
 	generateEnilopmarts();
 	generateTracingTrampolines();
 	recordGeneratedRunTimeaddress("methodZoneBase", methodZoneBase);
-	flushICacheFromto(processor, methodZoneStart, methodZoneBase);
+	flushICacheFromto(processor, ((usqInt)methodZoneStart), ((usqInt)methodZoneBase));
 }
 
 	/* Cogit>>#generateVMOwnerLockFunctions */
@@ -9889,7 +9901,7 @@
 	/* begin JumpR: */
 	genoperand(JumpR, TempReg);
 	jmpTarget(jumpMiss, gLabel());
-	genEnsureObjInRegNotForwardedscratchRegupdatingMwr(ReceiverResultReg, TempReg, FoxMFReceiver, FPReg);
+	genEnsureOopInRegNotForwardedscratchRegupdatingMwr(ReceiverResultReg, TempReg, FoxMFReceiver, FPReg);

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list