[Vm-dev] [commit][2936] CogVM source as per VMMaker.oscog-eem.743

commits at squeakvm.org commits at squeakvm.org
Sun Jun 1 17:18:39 UTC 2014


Revision: 2936
Author:   eliot
Date:     2014-06-01 10:18:37 -0700 (Sun, 01 Jun 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.743

Refactor closure creation in the Cogit to move it into the object
representations.  In Spur allocate and initialize the closure inline.

In Spur make sure to always use unsigned comparisons for
allocation against scavenge threshold.

Fix bugs in Spur object representation's context creation trampolines. Source and
destination offsets for args were wrong. Destination offset for temps was wrong.
Loop comparisons were wrong way round (CmpR:R: is weird).

Modified Paths:
--------------
    branches/Cog/nscogsrc/vm/cogit.c
    branches/Cog/nscogsrc/vm/cogit.h
    branches/Cog/nscogsrc/vm/cogmethod.h
    branches/Cog/nsspursrc/vm/cogit.c
    branches/Cog/nsspursrc/vm/cogit.h
    branches/Cog/nsspursrc/vm/cogmethod.h
    branches/Cog/sistasrc/vm/cogit.c
    branches/Cog/sistasrc/vm/cogit.h
    branches/Cog/sistasrc/vm/cogmethod.h
    branches/Cog/spursistasrc/vm/cogit.c
    branches/Cog/spursistasrc/vm/cogit.h
    branches/Cog/spursistasrc/vm/cogmethod.h
    branches/Cog/spursrc/vm/cogit.c
    branches/Cog/spursrc/vm/cogit.h
    branches/Cog/spursrc/vm/cogmethod.h
    branches/Cog/src/vm/cogit.c
    branches/Cog/src/vm/cogit.h
    branches/Cog/src/vm/cogmethod.h

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

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59
+	StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -591,6 +591,7 @@
 static sqInt genConvertIntegerToSmallIntegerInReg(sqInt reg) NoDbgRegParms;
 static sqInt genConvertIntegerToSmallIntegerInScratchReg(sqInt scratchReg) NoDbgRegParms;
 static sqInt genConvertSmallIntegerToIntegerInReg(sqInt reg) NoDbgRegParms;
+static sqInt genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock) NoDbgRegParms;
 static AbstractInstruction * genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder) NoDbgRegParms;
 static sqInt genDoubleArithmeticpreOpCheck(sqInt arithmeticOperator, AbstractInstruction *(*preOpCheckOrNil)(int rcvrReg, int argReg)) NoDbgRegParms;
 static sqInt genDoubleComparisoninvert(AbstractInstruction *(*jumpOpcodeGenerator)(void *), sqInt invertComparison) NoDbgRegParms;
@@ -10981,6 +10982,25 @@
 	return 0;
 }
 
+
+/*	Create a closure with the given startpc, numArgs and numCopied
+	within a context with ctxtNumArgs, large if isLargeCtxt that is in a
+	block if isInBlock. If numCopied > 0 pop those values off the stack. */
+/*	see ceClosureCopyDescriptor: */
+
+static sqInt
+genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock)
+{
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, (numArgs + (numCopied << 6)) + (bcpc << 12), SendNumArgsReg);
+	CallRT(ceClosureCopyTrampoline);
+	if (numCopied > 0) {
+		/* begin AddCq:R: */
+		genoperandoperand(AddCqR, numCopied * BytesPerWord, SPReg);
+	}
+	return 0;
+}
+
 static AbstractInstruction *
 genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder)
 {
@@ -11534,12 +11554,9 @@
 	}
 	(optStatus.isReceiverResultRegLive = 0);
 	ssAllocateCallRegand(SendNumArgsReg, ReceiverResultReg);
-	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, (numArgs + (numCopied << 6)) + ((bytecodePC + 4) << 12), SendNumArgsReg);
-	CallRT(ceClosureCopyTrampoline);
+
+	genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bytecodePC + 4, numArgs, numCopied, methodOrBlockNumArgs, methodNeedsLargeContext(methodObj), inBlock);
 	if (numCopied > 0) {
-		/* begin AddCq:R: */
-		genoperandoperand(AddCqR, numCopied * BytesPerWord, SPReg);
 		ssPop(numCopied);
 	}
 	return ssPushRegister(ReceiverResultReg);
@@ -12271,6 +12288,7 @@
 	ceCreateNewArrayTrampoline = genTrampolineForcalledargresult(ceNewArraySlotSize, "ceCreateNewArrayTrampoline", SendNumArgsReg, ReceiverResultReg);
 	cePositive32BitIntegerTrampoline = genTrampolineForcalledargresult(cePositive32BitIntegerFor, "cePositive32BitIntegerTrampoline", ReceiverResultReg, TempReg);
 	ceActiveContextTrampoline = genActiveContextTrampoline();
+	ceClosureCopyTrampoline = genTrampolineForcalledargresult(ceClosureCopyDescriptor, "ceClosureCopyTrampoline", SendNumArgsReg, ReceiverResultReg);
 }
 
 
@@ -12308,7 +12326,6 @@
 {
 	ceSendMustBeBooleanAddFalseTrampoline = genMustBeBooleanTrampolineForcalled(falseObject(), "ceSendMustBeBooleanAddFalseTrampoline");
 	ceSendMustBeBooleanAddTrueTrampoline = genMustBeBooleanTrampolineForcalled(trueObject(), "ceSendMustBeBooleanAddTrueTrampoline");
-	ceClosureCopyTrampoline = genTrampolineForcalledargresult(ceClosureCopyDescriptor, "ceClosureCopyTrampoline", SendNumArgsReg, ReceiverResultReg);
 	ceNonLocalReturnTrampoline = genNonLocalReturnTrampoline();
 	ceBaseFrameReturnTrampoline = genTrampolineForcalledarg(ceBaseFrameReturn, "ceBaseFrameReturnTrampoline", ReceiverResultReg);
 	ceCheckForInterruptTrampoline = genCheckForInterruptsTrampoline();
@@ -12401,7 +12418,7 @@
     sqInt selector;
 
 	methodZoneStart = methodZoneBase;
-	allocateOpcodesbytecodes(72, 0);
+	allocateOpcodesbytecodes(80, 0);
 	initialPC = 0;
 	endPC = numAbstractOpcodes - 1;
 	hasYoungReferent = 0;
@@ -14830,12 +14847,9 @@
 	}
 	(optStatus.isReceiverResultRegLive = 0);
 	ssAllocateCallRegand(SendNumArgsReg, ReceiverResultReg);
-	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, (numArgs + (numCopied << 6)) + ((bytecodePC + 5) << 12), SendNumArgsReg);
-	CallRT(ceClosureCopyTrampoline);
+
+	genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bytecodePC + 5, numArgs, numCopied, methodOrBlockNumArgs, methodNeedsLargeContext(methodObj), inBlock);
 	if (numCopied > 0) {
-		/* begin AddCq:R: */
-		genoperandoperand(AddCqR, numCopied * BytesPerWord, SPReg);
 		ssPop(numCopied);
 	}
 	return ssPushRegister(ReceiverResultReg);

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/nscogsrc/vm/cogmethod.h	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
 
 typedef struct {

Modified: branches/Cog/nsspursrc/vm/cogit.c
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.c	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/nsspursrc/vm/cogit.c	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
+	StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -132,6 +132,7 @@
 #define Call 9
 #define CDQ 110
 #define ClassArrayCompactIndex 51
+#define ClassBlockClosureCompactIndex 37
 #define ClassMethodContextCompactIndex 36
 #define ClassReg -5
 #define ClosureFirstCopiedValueIndex 3
@@ -405,7 +406,6 @@
 static sqInt callTargetFromReturnAddress(AbstractInstruction * self_in_callTargetFromReturnAddress, sqInt callSiteReturnAddress) NoDbgRegParms;
 static sqInt canDivQuoRem(AbstractInstruction * self_in_canDivQuoRem) NoDbgRegParms;
 static sqInt canMulRR(AbstractInstruction * self_in_canMulRR) NoDbgRegParms;
-static sqInt ceClosureCopyDescriptor(sqInt descriptor) NoDbgRegParms;
 sqInt ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver);
 static sqInt ceImplicitReceiverForreceiverclass(sqInt selector, sqInt receiver, sqInt rcvrClass) NoDbgRegParms;
 sqInt ceSICMiss(sqInt receiver);
@@ -592,6 +592,7 @@
 static sqInt genConvertIntegerToSmallIntegerInScratchReg(sqInt scratchReg) NoDbgRegParms;
 static void genConvertSmallIntegerToCharacterInReg(sqInt reg) NoDbgRegParms;
 static sqInt genConvertSmallIntegerToIntegerInReg(sqInt reg) NoDbgRegParms;
+static sqInt genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock) NoDbgRegParms;
 static AbstractInstruction * genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder) NoDbgRegParms;
 static sqInt genDoubleArithmeticpreOpCheck(sqInt arithmeticOperator, AbstractInstruction *(*preOpCheckOrNil)(int rcvrReg, int argReg)) NoDbgRegParms;
 static sqInt genDoubleComparisoninvert(AbstractInstruction *(*jumpOpcodeGenerator)(void *), sqInt invertComparison) NoDbgRegParms;
@@ -1150,7 +1151,6 @@
 void (*ceCaptureCStackPointers)(void);
 static unsigned long (*ceCheckFeaturesFunction)(void);
 sqInt ceCheckForInterruptTrampoline;
-static sqInt ceClosureCopyTrampoline;
 static sqInt ceCPICMissTrampoline;
 void (*ceEnter0ArgsPIC)(void);
 void (*ceEnter1ArgsPIC)(void);
@@ -1168,7 +1168,6 @@
 static sqInt ceMethodAbortTrampoline;
 static sqInt ceNonLocalReturnTrampoline;
 static sqInt cePICAbortTrampoline;
-static sqInt cePositive32BitIntegerTrampoline;
 static sqInt cePrimReturnEnterCogCode;
 static sqInt cePrimReturnEnterCogCodeProfiling;
 sqInt ceReturnToInterpreterTrampoline;
@@ -2853,15 +2852,6 @@
 }
 
 
-/*	<Integer> */
-
-static sqInt
-ceClosureCopyDescriptor(sqInt descriptor)
-{
-	return createClosureNumArgsnumCopiedstartpc(descriptor & 0x3F, (((usqInt) descriptor) >> 6) & 0x3F, ((usqInt) descriptor) >> 12);
-}
-
-
 /*	Code entry closed PIC miss. A send has fallen
 	through a closed (finite) polymorphic inline cache.
 	Either extend it or patch the send site to an open PIC.
@@ -11093,6 +11083,76 @@
 	return 0;
 }
 
+
+/*	Create a closure with the given startpc, numArgs and numCopied
+	within a context with ctxtNumArgs, large if isLargeCtxt that is in a
+	block if isInBlock. If numCopied > 0 pop those values off the stack. */
+
+static sqInt
+genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock)
+{
+    sqInt address;
+    sqInt address1;
+    usqLong header;
+    sqInt i;
+    sqInt quickConstant;
+    sqInt quickConstant1;
+    AbstractInstruction *skip;
+    sqInt slotSize;
+
+
+	/* First get thisContext into ReceiverResultRega and thence in ClassReg. */
+
+	genGetActiveContextNumArgslargeinBlock(ctxtNumArgs, isLargeCtxt, isInBlock);
+	/* begin MoveR:R: */
+	genoperandoperand(MoveRR, ReceiverResultReg, ClassReg);
+	slotSize = ClosureFirstCopiedValueIndex + numCopied;
+	header = headerForSlotsformatclassIndex(slotSize, indexablePointersFormat(), ClassBlockClosureCompactIndex);
+	/* begin MoveAw:R: */
+	address = freeStartAddress();
+	genoperandoperand(MoveAwR, address, ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, ((usqInt) header), TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, 0, ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, header >> 32, TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, 4, ReceiverResultReg);
+	/* begin MoveR:R: */
+	genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
+	/* begin AddCq:R: */
+	quickConstant = smallObjectBytesForSlots(slotSize);
+	genoperandoperand(AddCqR, quickConstant, TempReg);
+	/* begin MoveR:Aw: */
+	address1 = freeStartAddress();
+	genoperandoperand(MoveRAw, TempReg, address1);
+	/* begin CmpCq:R: */
+	quickConstant1 = getScavengeThreshold();
+	genoperandoperand(CmpCqR, quickConstant1, TempReg);
+	/* begin JumpBelow: */
+	skip = genoperand(JumpBelow, ((sqInt)0));
+	CallRT(ceSheduleScavengeTrampoline);
+	jmpTarget(skip, gLabel());
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, ClassReg, (ClosureOuterContextIndex * BytesPerOop) + BaseHeaderSize, ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, ((bcpc << 1) | 1), TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, (ClosureStartPCIndex * BytesPerOop) + BaseHeaderSize, ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, ((numArgs << 1) | 1), TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, (ClosureNumArgsIndex * BytesPerOop) + BaseHeaderSize, ReceiverResultReg);
+	for (i = 1; i <= numCopied; i += 1) {
+		/* begin PopR: */
+		genoperand(PopR, TempReg);
+		/* begin MoveR:Mw:r: */
+		genoperandoperandoperand(MoveRMwr, TempReg, (((numCopied - i) + ClosureFirstCopiedValueIndex) * BytesPerOop) + BaseHeaderSize, ReceiverResultReg);
+	}
+	return 0;
+}
+
 static AbstractInstruction *
 genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder)
 {
@@ -11665,13 +11725,10 @@
 		ssFlushTo(simStackPtr);
 	}
 	(optStatus.isReceiverResultRegLive = 0);
-	ssAllocateCallRegand(SendNumArgsReg, ReceiverResultReg);
-	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, (numArgs + (numCopied << 6)) + ((bytecodePC + 4) << 12), SendNumArgsReg);
-	CallRT(ceClosureCopyTrampoline);
+	ssAllocateCallRegandand(ReceiverResultReg, SendNumArgsReg, ClassReg);
+
+	genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bytecodePC + 4, numArgs, numCopied, methodOrBlockNumArgs, methodNeedsLargeContext(methodObj), inBlock);
 	if (numCopied > 0) {
-		/* begin AddCq:R: */
-		genoperandoperand(AddCqR, numCopied * BytesPerWord, SPReg);
 		ssPop(numCopied);
 	}
 	return ssPushRegister(ReceiverResultReg);
@@ -12444,7 +12501,6 @@
 {
 	ceSendMustBeBooleanAddFalseTrampoline = genMustBeBooleanTrampolineForcalled(falseObject(), "ceSendMustBeBooleanAddFalseTrampoline");
 	ceSendMustBeBooleanAddTrueTrampoline = genMustBeBooleanTrampolineForcalled(trueObject(), "ceSendMustBeBooleanAddTrueTrampoline");
-	ceClosureCopyTrampoline = genTrampolineForcalledargresult(ceClosureCopyDescriptor, "ceClosureCopyTrampoline", SendNumArgsReg, ReceiverResultReg);
 	ceNonLocalReturnTrampoline = genNonLocalReturnTrampoline();
 	ceBaseFrameReturnTrampoline = genTrampolineForcalledarg(ceBaseFrameReturn, "ceBaseFrameReturnTrampoline", ReceiverResultReg);
 	ceCheckForInterruptTrampoline = genCheckForInterruptsTrampoline();
@@ -12537,7 +12593,7 @@
     sqInt selector;
 
 	methodZoneStart = methodZoneBase;
-	allocateOpcodesbytecodes(72, 0);
+	allocateOpcodesbytecodes(80, 0);
 	initialPC = 0;
 	endPC = numAbstractOpcodes - 1;
 	hasYoungReferent = 0;
@@ -12762,8 +12818,8 @@
 	/* begin CmpCq:R: */
 	quickConstant1 = getScavengeThreshold();
 	genoperandoperand(CmpCqR, quickConstant1, TempReg);
-	/* begin JumpGreaterOrEqual: */
-	jumpNeedScavenge = genoperand(JumpGreaterOrEqual, ((sqInt)0));
+	/* begin JumpAboveOrEqual: */
+	jumpNeedScavenge = genoperand(JumpAboveOrEqual, ((sqInt)0));
 	/* begin MoveR:R: */
 	continuation = genoperandoperand(MoveRR, FPReg, TempReg);
 	genSetSmallIntegerTagsIn(TempReg);
@@ -12796,8 +12852,6 @@
 	genConvertIntegerToSmallIntegerInReg(TempReg);
 	/* begin MoveR:Mw:r: */
 	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (StackPointerIndex * BytesPerOop), ReceiverResultReg);
-	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, 0, ClassReg);
 	if (isInBlock) {
 		/* begin MoveR:R: */
 		genoperandoperand(MoveRR, SendNumArgsReg, TempReg);
@@ -12812,23 +12866,31 @@
 		genoperandoperand(MoveCwR, wordConstant, TempReg);
 	}
 	/* begin MoveR:Mw:r: */
-	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (ClosureIndex * BytesPerWord), ReceiverResultReg);
+	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (ClosureIndex * BytesPerOop), ReceiverResultReg);
+	/* begin MoveMw:r:R: */
+	genoperandoperandoperand(MoveMwrR, FoxMFReceiver, FPReg, TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (ReceiverIndex * BytesPerOop), ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, 1, ClassReg);
 	/* begin CmpR:R: */
-	loopHead = genoperandoperand(CmpRR, ClassReg, SendNumArgsReg);
-	/* begin JumpGreaterOrEqual: */
-	exit = genoperand(JumpGreaterOrEqual, ((sqInt)0));
+	loopHead = genoperandoperand(CmpRR, SendNumArgsReg, ClassReg);
+	/* begin JumpGreater: */
+	exit = genoperand(JumpGreater, ((sqInt)0));
 	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, SendNumArgsReg, TempReg);
 	/* begin SubR:R: */
 	genoperandoperand(SubRR, ClassReg, TempReg);
+	/* begin AddCq:R: */
+	genoperandoperand(AddCqR, 2, TempReg);
 	/* begin MoveXwr:R:R: */
 	genoperandoperandoperand(MoveXwrRR, TempReg, FPReg, TempReg);
 	/* begin AddCq:R: */
-	genoperandoperand(AddCqR, ReceiverIndex, ClassReg);
+	genoperandoperand(AddCqR, ReceiverIndex + (((sqInt) BaseHeaderSize >> 2)), ClassReg);
 	/* begin MoveR:Xwr:R: */
 	genoperandoperandoperand(MoveRXwrR, TempReg, ClassReg, ReceiverResultReg);
 	/* begin SubCq:R: */
-	genoperandoperand(SubCqR, ReceiverIndex - 1, ClassReg);
+	genoperandoperand(SubCqR, (ReceiverIndex + (((sqInt) BaseHeaderSize >> 2))) - 1, ClassReg);
 	/* begin Jump: */
 	genoperand(Jump, ((sqInt)loopHead));
 	jmpTarget(exit, gLabel());
@@ -12836,18 +12898,14 @@
 	genoperandoperand(MoveRR, FPReg, ClassReg);
 	/* begin AddCq:R: */
 	genoperandoperand(AddCqR, FoxMFReceiver, ClassReg);
-	/* begin MoveMw:r:R: */
-	genoperandoperandoperand(MoveMwrR, 0, ClassReg, TempReg);
-	/* begin MoveR:Mw:r: */
-	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (ReceiverIndex * BytesPerOop), ReceiverResultReg);
 	/* begin AddCq:R: */
-	genoperandoperand(AddCqR, (ReceiverIndex + (((sqInt) BaseHeaderSize >> 2))) + 1, SendNumArgsReg);
+	genoperandoperand(AddCqR, (ReceiverIndex + 1) + (((sqInt) BaseHeaderSize >> 2)), SendNumArgsReg);
 	/* begin SubCq:R: */
 	loopHead = genoperandoperand(SubCqR, BytesPerWord, ClassReg);
 	/* begin CmpR:R: */
 	genoperandoperand(CmpRR, SPReg, ClassReg);
-	exit = (/* begin JumpLess: */
-	genoperand(JumpLess, ((sqInt)0)));
+	exit = (/* begin JumpBelow: */
+	genoperand(JumpBelow, ((sqInt)0)));
 	/* begin MoveMw:r:R: */
 	genoperandoperandoperand(MoveMwrR, 0, ClassReg, TempReg);
 	/* begin MoveR:Xwr:R: */
@@ -15350,8 +15408,8 @@
 	/* begin CmpCq:R: */
 	quickConstant1 = getScavengeThreshold();
 	genoperandoperand(CmpCqR, quickConstant1, TempReg);
-	/* begin JumpLess: */
-	skip = genoperand(JumpLess, ((sqInt)0));
+	/* begin JumpBelow: */
+	skip = genoperand(JumpBelow, ((sqInt)0));
 	CallRT(ceSheduleScavengeTrampoline);
 	jmpTarget(skip, gLabel());
 	return 0;
@@ -16371,13 +16429,10 @@
 		ssFlushTo(simStackPtr);
 	}
 	(optStatus.isReceiverResultRegLive = 0);
-	ssAllocateCallRegand(SendNumArgsReg, ReceiverResultReg);
-	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, (numArgs + (numCopied << 6)) + ((bytecodePC + 5) << 12), SendNumArgsReg);
-	CallRT(ceClosureCopyTrampoline);
+	ssAllocateCallRegandand(ReceiverResultReg, SendNumArgsReg, ClassReg);
+
+	genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bytecodePC + 5, numArgs, numCopied, methodOrBlockNumArgs, methodNeedsLargeContext(methodObj), inBlock);
 	if (numCopied > 0) {
-		/* begin AddCq:R: */
-		genoperandoperand(AddCqR, numCopied * BytesPerWord, SPReg);
 		ssPop(numCopied);
 	}
 	return ssPushRegister(ReceiverResultReg);

Modified: branches/Cog/nsspursrc/vm/cogit.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.h	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/nsspursrc/vm/cogit.h	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
 
 

Modified: branches/Cog/nsspursrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogmethod.h	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/nsspursrc/vm/cogmethod.h	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
 
 typedef struct {


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Sat May 31 22:32:08 PDT 2014
   + Sun Jun  1 10:16:54 PDT 2014

Modified: branches/Cog/sistasrc/vm/cogit.c
===================================================================
--- branches/Cog/sistasrc/vm/cogit.c	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/sistasrc/vm/cogit.c	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
    from
-	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59
+	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
-static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59 " __DATE__ ;
+static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -590,6 +590,7 @@
 static sqInt genConvertIntegerToSmallIntegerInReg(sqInt reg) NoDbgRegParms;
 static sqInt genConvertIntegerToSmallIntegerInScratchReg(sqInt scratchReg) NoDbgRegParms;
 static sqInt genConvertSmallIntegerToIntegerInReg(sqInt reg) NoDbgRegParms;
+static sqInt genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock) NoDbgRegParms;
 static AbstractInstruction * genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder) NoDbgRegParms;
 static sqInt genDoubleArithmeticpreOpCheck(sqInt arithmeticOperator, AbstractInstruction *(*preOpCheckOrNil)(int rcvrReg, int argReg)) NoDbgRegParms;
 static sqInt genDoubleComparisoninvert(AbstractInstruction *(*jumpOpcodeGenerator)(void *), sqInt invertComparison) NoDbgRegParms;
@@ -10501,6 +10502,25 @@
 	return 0;
 }
 
+
+/*	Create a closure with the given startpc, numArgs and numCopied
+	within a context with ctxtNumArgs, large if isLargeCtxt that is in a
+	block if isInBlock. If numCopied > 0 pop those values off the stack. */
+/*	see ceClosureCopyDescriptor: */
+
+static sqInt
+genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock)
+{
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, (numArgs + (numCopied << 6)) + (bcpc << 12), SendNumArgsReg);
+	CallRT(ceClosureCopyTrampoline);
+	if (numCopied > 0) {
+		/* begin AddCq:R: */
+		genoperandoperand(AddCqR, numCopied * BytesPerWord, SPReg);
+	}
+	return 0;
+}
+
 static AbstractInstruction *
 genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder)
 {
@@ -11368,6 +11388,7 @@
 	ceCreateNewArrayTrampoline = genTrampolineForcalledargresult(ceNewArraySlotSize, "ceCreateNewArrayTrampoline", SendNumArgsReg, ReceiverResultReg);
 	cePositive32BitIntegerTrampoline = genTrampolineForcalledargresult(cePositive32BitIntegerFor, "cePositive32BitIntegerTrampoline", ReceiverResultReg, TempReg);
 	ceActiveContextTrampoline = genActiveContextTrampoline();
+	ceClosureCopyTrampoline = genTrampolineForcalledargresult(ceClosureCopyDescriptor, "ceClosureCopyTrampoline", SendNumArgsReg, ReceiverResultReg);
 }
 
 
@@ -11405,7 +11426,6 @@
 {
 	ceSendMustBeBooleanAddFalseTrampoline = genMustBeBooleanTrampolineForcalled(falseObject(), "ceSendMustBeBooleanAddFalseTrampoline");
 	ceSendMustBeBooleanAddTrueTrampoline = genMustBeBooleanTrampolineForcalled(trueObject(), "ceSendMustBeBooleanAddTrueTrampoline");
-	ceClosureCopyTrampoline = genTrampolineForcalledargresult(ceClosureCopyDescriptor, "ceClosureCopyTrampoline", SendNumArgsReg, ReceiverResultReg);
 	ceNonLocalReturnTrampoline = genNonLocalReturnTrampoline();
 	ceBaseFrameReturnTrampoline = genTrampolineForcalledarg(ceBaseFrameReturn, "ceBaseFrameReturnTrampoline", ReceiverResultReg);
 	ceCheckForInterruptTrampoline = genCheckForInterruptsTrampoline();
@@ -11494,7 +11514,7 @@
     sqInt selector;
 
 	methodZoneStart = methodZoneBase;
-	allocateOpcodesbytecodes(72, 0);
+	allocateOpcodesbytecodes(80, 0);
 	initialPC = 0;
 	endPC = numAbstractOpcodes - 1;
 	hasYoungReferent = 0;
@@ -13822,12 +13842,9 @@
 	}
 	(optStatus.isReceiverResultRegLive = 0);
 	ssAllocateCallRegand(SendNumArgsReg, ReceiverResultReg);
-	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, (numArgs + (numCopied << 6)) + ((bytecodePC + 5) << 12), SendNumArgsReg);
-	CallRT(ceClosureCopyTrampoline);
+
+	genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bytecodePC + 5, numArgs, numCopied, methodOrBlockNumArgs, methodNeedsLargeContext(methodObj), inBlock);
 	if (numCopied > 0) {
-		/* begin AddCq:R: */
-		genoperandoperand(AddCqR, numCopied * BytesPerWord, SPReg);
 		ssPop(numCopied);
 	}
 	return ssPushRegister(ReceiverResultReg);

Modified: branches/Cog/sistasrc/vm/cogit.h
===================================================================
--- branches/Cog/sistasrc/vm/cogit.h	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/sistasrc/vm/cogit.h	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
 
 

Modified: branches/Cog/sistasrc/vm/cogmethod.h
===================================================================
--- branches/Cog/sistasrc/vm/cogmethod.h	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/sistasrc/vm/cogmethod.h	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
 
 typedef struct {

Modified: branches/Cog/spursistasrc/vm/cogit.c
===================================================================
--- branches/Cog/spursistasrc/vm/cogit.c	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/spursistasrc/vm/cogit.c	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
    from
-	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
+	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
-static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 " __DATE__ ;
+static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -132,6 +132,7 @@
 #define Call 9
 #define CDQ 110
 #define ClassArrayCompactIndex 51
+#define ClassBlockClosureCompactIndex 37
 #define ClassMethodContextCompactIndex 36
 #define ClassReg -5
 #define ClosureFirstCopiedValueIndex 3
@@ -405,7 +406,6 @@
 static sqInt callTargetFromReturnAddress(AbstractInstruction * self_in_callTargetFromReturnAddress, sqInt callSiteReturnAddress) NoDbgRegParms;
 static sqInt canDivQuoRem(AbstractInstruction * self_in_canDivQuoRem) NoDbgRegParms;
 static sqInt canMulRR(AbstractInstruction * self_in_canMulRR) NoDbgRegParms;
-static sqInt ceClosureCopyDescriptor(sqInt descriptor) NoDbgRegParms;
 sqInt ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver);
 sqInt ceSICMiss(sqInt receiver);
 void checkAssertsEnabledInCogit(void);
@@ -590,6 +590,7 @@
 static sqInt genConvertIntegerToSmallIntegerInScratchReg(sqInt scratchReg) NoDbgRegParms;
 static void genConvertSmallIntegerToCharacterInReg(sqInt reg) NoDbgRegParms;
 static sqInt genConvertSmallIntegerToIntegerInReg(sqInt reg) NoDbgRegParms;
+static sqInt genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock) NoDbgRegParms;
 static AbstractInstruction * genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder) NoDbgRegParms;
 static sqInt genDoubleArithmeticpreOpCheck(sqInt arithmeticOperator, AbstractInstruction *(*preOpCheckOrNil)(int rcvrReg, int argReg)) NoDbgRegParms;
 static sqInt genDoubleComparisoninvert(AbstractInstruction *(*jumpOpcodeGenerator)(void *), sqInt invertComparison) NoDbgRegParms;
@@ -1114,7 +1115,6 @@
 void (*ceCaptureCStackPointers)(void);
 static unsigned long (*ceCheckFeaturesFunction)(void);
 sqInt ceCheckForInterruptTrampoline;
-static sqInt ceClosureCopyTrampoline;
 static sqInt ceCPICMissTrampoline;
 void (*ceEnter0ArgsPIC)(void);
 void (*ceEnter1ArgsPIC)(void);
@@ -1130,7 +1130,6 @@
 static sqInt ceMethodAbortTrampoline;
 static sqInt ceNonLocalReturnTrampoline;
 static sqInt cePICAbortTrampoline;
-static sqInt cePositive32BitIntegerTrampoline;
 static sqInt cePrimReturnEnterCogCode;
 static sqInt cePrimReturnEnterCogCodeProfiling;
 sqInt ceReturnToInterpreterTrampoline;
@@ -2508,15 +2507,6 @@
 }
 
 
-/*	<Integer> */
-
-static sqInt
-ceClosureCopyDescriptor(sqInt descriptor)
-{
-	return createClosureNumArgsnumCopiedstartpc(descriptor & 0x3F, (((usqInt) descriptor) >> 6) & 0x3F, ((usqInt) descriptor) >> 12);
-}
-
-
 /*	Code entry closed PIC miss. A send has fallen
 	through a closed (finite) polymorphic inline cache.
 	Either extend it or patch the send site to an open PIC.
@@ -10606,6 +10596,76 @@
 	return 0;
 }
 
+
+/*	Create a closure with the given startpc, numArgs and numCopied
+	within a context with ctxtNumArgs, large if isLargeCtxt that is in a
+	block if isInBlock. If numCopied > 0 pop those values off the stack. */
+
+static sqInt
+genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock)
+{
+    sqInt address;
+    sqInt address1;
+    usqLong header;
+    sqInt i;
+    sqInt quickConstant;
+    sqInt quickConstant1;
+    AbstractInstruction *skip;
+    sqInt slotSize;
+
+
+	/* First get thisContext into ReceiverResultRega and thence in ClassReg. */
+
+	genGetActiveContextNumArgslargeinBlock(ctxtNumArgs, isLargeCtxt, isInBlock);
+	/* begin MoveR:R: */
+	genoperandoperand(MoveRR, ReceiverResultReg, ClassReg);
+	slotSize = ClosureFirstCopiedValueIndex + numCopied;
+	header = headerForSlotsformatclassIndex(slotSize, indexablePointersFormat(), ClassBlockClosureCompactIndex);
+	/* begin MoveAw:R: */
+	address = freeStartAddress();
+	genoperandoperand(MoveAwR, address, ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, ((usqInt) header), TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, 0, ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, header >> 32, TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, 4, ReceiverResultReg);
+	/* begin MoveR:R: */
+	genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
+	/* begin AddCq:R: */
+	quickConstant = smallObjectBytesForSlots(slotSize);
+	genoperandoperand(AddCqR, quickConstant, TempReg);
+	/* begin MoveR:Aw: */
+	address1 = freeStartAddress();
+	genoperandoperand(MoveRAw, TempReg, address1);
+	/* begin CmpCq:R: */
+	quickConstant1 = getScavengeThreshold();
+	genoperandoperand(CmpCqR, quickConstant1, TempReg);
+	/* begin JumpBelow: */
+	skip = genoperand(JumpBelow, ((sqInt)0));
+	CallRT(ceSheduleScavengeTrampoline);
+	jmpTarget(skip, gLabel());
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, ClassReg, (ClosureOuterContextIndex * BytesPerOop) + BaseHeaderSize, ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, ((bcpc << 1) | 1), TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, (ClosureStartPCIndex * BytesPerOop) + BaseHeaderSize, ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, ((numArgs << 1) | 1), TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, (ClosureNumArgsIndex * BytesPerOop) + BaseHeaderSize, ReceiverResultReg);
+	for (i = 1; i <= numCopied; i += 1) {
+		/* begin PopR: */
+		genoperand(PopR, TempReg);
+		/* begin MoveR:Mw:r: */
+		genoperandoperandoperand(MoveRMwr, TempReg, (((numCopied - i) + ClosureFirstCopiedValueIndex) * BytesPerOop) + BaseHeaderSize, ReceiverResultReg);
+	}
+	return 0;
+}
+
 static AbstractInstruction *
 genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder)
 {
@@ -11534,7 +11594,6 @@
 {
 	ceSendMustBeBooleanAddFalseTrampoline = genMustBeBooleanTrampolineForcalled(falseObject(), "ceSendMustBeBooleanAddFalseTrampoline");
 	ceSendMustBeBooleanAddTrueTrampoline = genMustBeBooleanTrampolineForcalled(trueObject(), "ceSendMustBeBooleanAddTrueTrampoline");
-	ceClosureCopyTrampoline = genTrampolineForcalledargresult(ceClosureCopyDescriptor, "ceClosureCopyTrampoline", SendNumArgsReg, ReceiverResultReg);
 	ceNonLocalReturnTrampoline = genNonLocalReturnTrampoline();
 	ceBaseFrameReturnTrampoline = genTrampolineForcalledarg(ceBaseFrameReturn, "ceBaseFrameReturnTrampoline", ReceiverResultReg);
 	ceCheckForInterruptTrampoline = genCheckForInterruptsTrampoline();
@@ -11623,7 +11682,7 @@
     sqInt selector;
 
 	methodZoneStart = methodZoneBase;
-	allocateOpcodesbytecodes(72, 0);
+	allocateOpcodesbytecodes(80, 0);
 	initialPC = 0;
 	endPC = numAbstractOpcodes - 1;
 	hasYoungReferent = 0;
@@ -11847,8 +11906,8 @@
 	/* begin CmpCq:R: */
 	quickConstant1 = getScavengeThreshold();
 	genoperandoperand(CmpCqR, quickConstant1, TempReg);
-	/* begin JumpGreaterOrEqual: */
-	jumpNeedScavenge = genoperand(JumpGreaterOrEqual, ((sqInt)0));
+	/* begin JumpAboveOrEqual: */
+	jumpNeedScavenge = genoperand(JumpAboveOrEqual, ((sqInt)0));
 	/* begin MoveR:R: */
 	continuation = genoperandoperand(MoveRR, FPReg, TempReg);
 	genSetSmallIntegerTagsIn(TempReg);
@@ -11881,8 +11940,6 @@
 	genConvertIntegerToSmallIntegerInReg(TempReg);
 	/* begin MoveR:Mw:r: */
 	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (StackPointerIndex * BytesPerOop), ReceiverResultReg);
-	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, 0, ClassReg);
 	if (isInBlock) {
 		/* begin MoveR:R: */
 		genoperandoperand(MoveRR, SendNumArgsReg, TempReg);
@@ -11897,23 +11954,31 @@
 		genoperandoperand(MoveCwR, wordConstant, TempReg);
 	}
 	/* begin MoveR:Mw:r: */
-	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (ClosureIndex * BytesPerWord), ReceiverResultReg);
+	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (ClosureIndex * BytesPerOop), ReceiverResultReg);
+	/* begin MoveMw:r:R: */
+	genoperandoperandoperand(MoveMwrR, FoxMFReceiver, FPReg, TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (ReceiverIndex * BytesPerOop), ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, 1, ClassReg);
 	/* begin CmpR:R: */
-	loopHead = genoperandoperand(CmpRR, ClassReg, SendNumArgsReg);
-	/* begin JumpGreaterOrEqual: */
-	exit = genoperand(JumpGreaterOrEqual, ((sqInt)0));
+	loopHead = genoperandoperand(CmpRR, SendNumArgsReg, ClassReg);
+	/* begin JumpGreater: */
+	exit = genoperand(JumpGreater, ((sqInt)0));
 	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, SendNumArgsReg, TempReg);
 	/* begin SubR:R: */
 	genoperandoperand(SubRR, ClassReg, TempReg);
+	/* begin AddCq:R: */
+	genoperandoperand(AddCqR, 2, TempReg);
 	/* begin MoveXwr:R:R: */
 	genoperandoperandoperand(MoveXwrRR, TempReg, FPReg, TempReg);
 	/* begin AddCq:R: */
-	genoperandoperand(AddCqR, ReceiverIndex, ClassReg);
+	genoperandoperand(AddCqR, ReceiverIndex + (((sqInt) BaseHeaderSize >> 2)), ClassReg);
 	/* begin MoveR:Xwr:R: */
 	genoperandoperandoperand(MoveRXwrR, TempReg, ClassReg, ReceiverResultReg);
 	/* begin SubCq:R: */
-	genoperandoperand(SubCqR, ReceiverIndex - 1, ClassReg);
+	genoperandoperand(SubCqR, (ReceiverIndex + (((sqInt) BaseHeaderSize >> 2))) - 1, ClassReg);
 	/* begin Jump: */
 	genoperand(Jump, ((sqInt)loopHead));
 	jmpTarget(exit, gLabel());
@@ -11921,18 +11986,14 @@
 	genoperandoperand(MoveRR, FPReg, ClassReg);
 	/* begin AddCq:R: */
 	genoperandoperand(AddCqR, FoxMFReceiver, ClassReg);
-	/* begin MoveMw:r:R: */
-	genoperandoperandoperand(MoveMwrR, 0, ClassReg, TempReg);
-	/* begin MoveR:Mw:r: */
-	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (ReceiverIndex * BytesPerOop), ReceiverResultReg);
 	/* begin AddCq:R: */
-	genoperandoperand(AddCqR, (ReceiverIndex + (((sqInt) BaseHeaderSize >> 2))) + 1, SendNumArgsReg);
+	genoperandoperand(AddCqR, (ReceiverIndex + 1) + (((sqInt) BaseHeaderSize >> 2)), SendNumArgsReg);
 	/* begin SubCq:R: */
 	loopHead = genoperandoperand(SubCqR, BytesPerWord, ClassReg);
 	/* begin CmpR:R: */
 	genoperandoperand(CmpRR, SPReg, ClassReg);
-	exit = (/* begin JumpLess: */
-	genoperand(JumpLess, ((sqInt)0)));
+	exit = (/* begin JumpBelow: */
+	genoperand(JumpBelow, ((sqInt)0)));
 	/* begin MoveMw:r:R: */
 	genoperandoperandoperand(MoveMwrR, 0, ClassReg, TempReg);
 	/* begin MoveR:Xwr:R: */
@@ -13935,8 +13996,8 @@
 	/* begin CmpCq:R: */
 	quickConstant1 = getScavengeThreshold();
 	genoperandoperand(CmpCqR, quickConstant1, TempReg);
-	/* begin JumpLess: */
-	skip = genoperand(JumpLess, ((sqInt)0));
+	/* begin JumpBelow: */
+	skip = genoperand(JumpBelow, ((sqInt)0));
 	CallRT(ceSheduleScavengeTrampoline);
 	jmpTarget(skip, gLabel());
 	return 0;
@@ -14938,13 +14999,10 @@
 		ssFlushTo(simStackPtr);
 	}
 	(optStatus.isReceiverResultRegLive = 0);
-	ssAllocateCallRegand(SendNumArgsReg, ReceiverResultReg);
-	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, (numArgs + (numCopied << 6)) + ((bytecodePC + 5) << 12), SendNumArgsReg);
-	CallRT(ceClosureCopyTrampoline);
+	ssAllocateCallRegandand(ReceiverResultReg, SendNumArgsReg, ClassReg);
+
+	genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bytecodePC + 5, numArgs, numCopied, methodOrBlockNumArgs, methodNeedsLargeContext(methodObj), inBlock);
 	if (numCopied > 0) {
-		/* begin AddCq:R: */
-		genoperandoperand(AddCqR, numCopied * BytesPerWord, SPReg);
 		ssPop(numCopied);
 	}
 	return ssPushRegister(ReceiverResultReg);

Modified: branches/Cog/spursistasrc/vm/cogit.h
===================================================================
--- branches/Cog/spursistasrc/vm/cogit.h	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/spursistasrc/vm/cogit.h	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
 
 

Modified: branches/Cog/spursistasrc/vm/cogmethod.h
===================================================================
--- branches/Cog/spursistasrc/vm/cogmethod.h	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/spursistasrc/vm/cogmethod.h	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
 
 typedef struct {

Modified: branches/Cog/spursrc/vm/cogit.c
===================================================================
--- branches/Cog/spursrc/vm/cogit.c	2014-06-01 05:32:34 UTC (rev 2935)
+++ branches/Cog/spursrc/vm/cogit.c	2014-06-01 17:18:37 UTC (rev 2936)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
+	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
+	StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -132,6 +132,7 @@
 #define Call 9
 #define CDQ 110
 #define ClassArrayCompactIndex 51
+#define ClassBlockClosureCompactIndex 37
 #define ClassMethodContextCompactIndex 36
 #define ClassReg -5
 #define ClosureFirstCopiedValueIndex 3
@@ -402,7 +403,6 @@
 static sqInt callTargetFromReturnAddress(AbstractInstruction * self_in_callTargetFromReturnAddress, sqInt callSiteReturnAddress) NoDbgRegParms;
 static sqInt canDivQuoRem(AbstractInstruction * self_in_canDivQuoRem) NoDbgRegParms;
 static sqInt canMulRR(AbstractInstruction * self_in_canMulRR) NoDbgRegParms;
-static sqInt ceClosureCopyDescriptor(sqInt descriptor) NoDbgRegParms;
 sqInt ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver);
 sqInt ceSICMiss(sqInt receiver);
 void checkAssertsEnabledInCogit(void);
@@ -585,6 +585,7 @@
 static sqInt genConvertIntegerToSmallIntegerInScratchReg(sqInt scratchReg) NoDbgRegParms;
 static void genConvertSmallIntegerToCharacterInReg(sqInt reg) NoDbgRegParms;
 static sqInt genConvertSmallIntegerToIntegerInReg(sqInt reg) NoDbgRegParms;
+static sqInt genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock) NoDbgRegParms;
 static AbstractInstruction * genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder) NoDbgRegParms;
 static sqInt genDoubleArithmeticpreOpCheck(sqInt arithmeticOperator, AbstractInstruction *(*preOpCheckOrNil)(int rcvrReg, int argReg)) NoDbgRegParms;
 static sqInt genDoubleComparisoninvert(AbstractInstruction *(*jumpOpcodeGenerator)(void *), sqInt invertComparison) NoDbgRegParms;
@@ -1097,7 +1098,6 @@
 void (*ceCaptureCStackPointers)(void);
 static unsigned long (*ceCheckFeaturesFunction)(void);
 sqInt ceCheckForInterruptTrampoline;
-static sqInt ceClosureCopyTrampoline;
 static sqInt ceCPICMissTrampoline;
 void (*ceEnter0ArgsPIC)(void);
 void (*ceEnter1ArgsPIC)(void);
@@ -1113,7 +1113,6 @@
 static sqInt ceMethodAbortTrampoline;
 static sqInt ceNonLocalReturnTrampoline;
 static sqInt cePICAbortTrampoline;
-static sqInt cePositive32BitIntegerTrampoline;
 static sqInt cePrimReturnEnterCogCode;
 static sqInt cePrimReturnEnterCogCodeProfiling;
 sqInt ceReturnToInterpreterTrampoline;
@@ -2493,15 +2492,6 @@
 }
 
 
-/*	<Integer> */
-
-static sqInt
-ceClosureCopyDescriptor(sqInt descriptor)
-{
-	return createClosureNumArgsnumCopiedstartpc(descriptor & 0x3F, (((usqInt) descriptor) >> 6) & 0x3F, ((usqInt) descriptor) >> 12);
-}
-
-
 /*	Code entry closed PIC miss. A send has fallen
 	through a closed (finite) polymorphic inline cache.
 	Either extend it or patch the send site to an open PIC.
@@ -10562,6 +10552,76 @@
 	return 0;
 }
 
+
+/*	Create a closure with the given startpc, numArgs and numCopied
+	within a context with ctxtNumArgs, large if isLargeCtxt that is in a
+	block if isInBlock. If numCopied > 0 pop those values off the stack. */
+
+static sqInt
+genCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock)
+{
+    sqInt address;
+    sqInt address1;
+    usqLong header;
+    sqInt i;
+    sqInt quickConstant;
+    sqInt quickConstant1;
+    AbstractInstruction *skip;
+    sqInt slotSize;
+
+
+	/* First get thisContext into ReceiverResultRega and thence in ClassReg. */
+
+	genGetActiveContextNumArgslargeinBlock(ctxtNumArgs, isLargeCtxt, isInBlock);
+	/* begin MoveR:R: */
+	genoperandoperand(MoveRR, ReceiverResultReg, ClassReg);
+	slotSize = ClosureFirstCopiedValueIndex + numCopied;
+	header = headerForSlotsformatclassIndex(slotSize, indexablePointersFormat(), ClassBlockClosureCompactIndex);
+	/* begin MoveAw:R: */
+	address = freeStartAddress();
+	genoperandoperand(MoveAwR, address, ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, ((usqInt) header), TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, 0, ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, header >> 32, TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, 4, ReceiverResultReg);
+	/* begin MoveR:R: */
+	genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
+	/* begin AddCq:R: */
+	quickConstant = smallObjectBytesForSlots(slotSize);
+	genoperandoperand(AddCqR, quickConstant, TempReg);
+	/* begin MoveR:Aw: */
+	address1 = freeStartAddress();
+	genoperandoperand(MoveRAw, TempReg, address1);
+	/* begin CmpCq:R: */
+	quickConstant1 = getScavengeThreshold();
+	genoperandoperand(CmpCqR, quickConstant1, TempReg);
+	/* begin JumpBelow: */
+	skip = genoperand(JumpBelow, ((sqInt)0));
+	CallRT(ceSheduleScavengeTrampoline);
+	jmpTarget(skip, gLabel());
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, ClassReg, (ClosureOuterContextIndex * BytesPerOop) + BaseHeaderSize, ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, ((bcpc << 1) | 1), TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, (ClosureStartPCIndex * BytesPerOop) + BaseHeaderSize, ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, ((numArgs << 1) | 1), TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, (ClosureNumArgsIndex * BytesPerOop) + BaseHeaderSize, ReceiverResultReg);
+	for (i = 1; i <= numCopied; i += 1) {
+		/* begin PopR: */
+		genoperand(PopR, TempReg);
+		/* begin MoveR:Mw:r: */
+		genoperandoperandoperand(MoveRMwr, TempReg, (((numCopied - i) + ClosureFirstCopiedValueIndex) * BytesPerOop) + BaseHeaderSize, ReceiverResultReg);
+	}
+	return 0;
+}
+
 static AbstractInstruction *
 genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder)
 {
@@ -11484,7 +11544,6 @@
 {
 	ceSendMustBeBooleanAddFalseTrampoline = genMustBeBooleanTrampolineForcalled(falseObject(), "ceSendMustBeBooleanAddFalseTrampoline");
 	ceSendMustBeBooleanAddTrueTrampoline = genMustBeBooleanTrampolineForcalled(trueObject(), "ceSendMustBeBooleanAddTrueTrampoline");
-	ceClosureCopyTrampoline = genTrampolineForcalledargresult(ceClosureCopyDescriptor, "ceClosureCopyTrampoline", SendNumArgsReg, ReceiverResultReg);
 	ceNonLocalReturnTrampoline = genNonLocalReturnTrampoline();
 	ceBaseFrameReturnTrampoline = genTrampolineForcalledarg(ceBaseFrameReturn, "ceBaseFrameReturnTrampoline", ReceiverResultReg);
 	ceCheckForInterruptTrampoline = genCheckForInterruptsTrampoline();
@@ -11573,7 +11632,7 @@
     sqInt selector;
 
 	methodZoneStart = methodZoneBase;
-	allocateOpcodesbytecodes(72, 0);
+	allocateOpcodesbytecodes(80, 0);
 	initialPC = 0;
 	endPC = numAbstractOpcodes - 1;
 	hasYoungReferent = 0;
@@ -11797,8 +11856,8 @@
 	/* begin CmpCq:R: */
 	quickConstant1 = getScavengeThreshold();
 	genoperandoperand(CmpCqR, quickConstant1, TempReg);
-	/* begin JumpGreaterOrEqual: */
-	jumpNeedScavenge = genoperand(JumpGreaterOrEqual, ((sqInt)0));
+	/* begin JumpAboveOrEqual: */
+	jumpNeedScavenge = genoperand(JumpAboveOrEqual, ((sqInt)0));
 	/* begin MoveR:R: */
 	continuation = genoperandoperand(MoveRR, FPReg, TempReg);
 	genSetSmallIntegerTagsIn(TempReg);
@@ -11831,8 +11890,6 @@
 	genConvertIntegerToSmallIntegerInReg(TempReg);
 	/* begin MoveR:Mw:r: */
 	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (StackPointerIndex * BytesPerOop), ReceiverResultReg);
-	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, 0, ClassReg);
 	if (isInBlock) {
 		/* begin MoveR:R: */
 		genoperandoperand(MoveRR, SendNumArgsReg, TempReg);
@@ -11847,23 +11904,31 @@
 		genoperandoperand(MoveCwR, wordConstant, TempReg);
 	}
 	/* begin MoveR:Mw:r: */
-	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (ClosureIndex * BytesPerWord), ReceiverResultReg);
+	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (ClosureIndex * BytesPerOop), ReceiverResultReg);
+	/* begin MoveMw:r:R: */
+	genoperandoperandoperand(MoveMwrR, FoxMFReceiver, FPReg, TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (ReceiverIndex * BytesPerOop), ReceiverResultReg);
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, 1, ClassReg);
 	/* begin CmpR:R: */
-	loopHead = genoperandoperand(CmpRR, ClassReg, SendNumArgsReg);
-	/* begin JumpGreaterOrEqual: */
-	exit = genoperand(JumpGreaterOrEqual, ((sqInt)0));
+	loopHead = genoperandoperand(CmpRR, SendNumArgsReg, ClassReg);
+	/* begin JumpGreater: */
+	exit = genoperand(JumpGreater, ((sqInt)0));
 	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, SendNumArgsReg, TempReg);
 	/* begin SubR:R: */
 	genoperandoperand(SubRR, ClassReg, TempReg);
+	/* begin AddCq:R: */
+	genoperandoperand(AddCqR, 2, TempReg);
 	/* begin MoveXwr:R:R: */
 	genoperandoperandoperand(MoveXwrRR, TempReg, FPReg, TempReg);
 	/* begin AddCq:R: */
-	genoperandoperand(AddCqR, ReceiverIndex, ClassReg);
+	genoperandoperand(AddCqR, ReceiverIndex + (((sqInt) BaseHeaderSize >> 2)), ClassReg);
 	/* begin MoveR:Xwr:R: */
 	genoperandoperandoperand(MoveRXwrR, TempReg, ClassReg, ReceiverResultReg);
 	/* begin SubCq:R: */
-	genoperandoperand(SubCqR, ReceiverIndex - 1, ClassReg);

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list