[Vm-dev] [commit][2937] CogVM source as per VMMaker.oscog-eem.745

commits at squeakvm.org commits at squeakvm.org
Sun Jun 1 19:43:16 UTC 2014


Revision: 2937
Author:   eliot
Date:     2014-06-01 12:43:14 -0700 (Sun, 01 Jun 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.745

In Spur refactor closure creation in the Cogit to not flush copied values to the
stack, assigning them direct to the closure.  Generates much more compact code.

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 17:18:37 UTC (rev 2936)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	StackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -551,6 +551,7 @@
 static sqInt cPICMissTrampolineFor(sqInt numArgs) NoDbgRegParms;
 static sqInt cPICHasTarget(CogMethod *cPIC, CogMethod *targetMethod) NoDbgRegParms;
 static sqInt cResultRegister(AbstractInstruction * self_in_cResultRegister) NoDbgRegParms;
+static sqInt createsClosuresInline(void);
 static AbstractInstruction * gDivRRQuoRem(sqInt rDivisor, sqInt rDividend, sqInt rQuotient, sqInt rRemainder) NoDbgRegParms;
 static void dispatchConcretize(AbstractInstruction * self_in_dispatchConcretize) NoDbgRegParms;
 static sqInt doubleExtendedDoAnythingBytecode(void);
@@ -7721,6 +7722,17 @@
 }
 
 
+/*	Answer if the object representation allocates closures inline. By
+	default answer false. Better code can be generated when creating
+	closures inline if copied values are /not/ flushed to the stack. */
+
+static sqInt
+createsClosuresInline(void)
+{
+	return 0;
+}
+
+
 /*	Division is a little weird on some processors. Defer to the backEnd
 	to allow it to generate any special code it may need to. */
 
@@ -11543,12 +11555,15 @@
 static sqInt
 genExtPushClosureBytecode(void)
 {
+    sqInt i;
     sqInt numArgs;
     sqInt numCopied;
+    sqInt reg;
 
 	assert(needsFrame);
 	addBlockStartAtnumArgsnumCopiedspan(bytecodePC + 3, (numArgs = (byte1 & 7) + ((extA % 16) * 8)), (numCopied = ((((usqInt) byte1) >> 3) & 7) + ((((sqInt) extA >> 4)) * 8)), byte2 + (extB << 8));
 	extA = (extB = 0);
+	
 	if (numCopied > 0) {
 		ssFlushTo(simStackPtr);
 	}
@@ -14837,11 +14852,14 @@
 static sqInt
 genPushClosureCopyCopiedValuesBytecode(void)
 {
+    sqInt i;
     sqInt numArgs;
     sqInt numCopied;
+    sqInt reg;
 
 	assert(needsFrame);
 	addBlockStartAtnumArgsnumCopiedspan(bytecodePC + 4, (numArgs = byte1 & 15), (numCopied = ((usqInt) byte1) >> 4), (byte2 << 8) + byte3);
+	
 	if (numCopied > 0) {
 		ssFlushTo(simStackPtr);
 	}

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/nscogsrc/vm/cogmethod.h	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
 
 typedef struct {

Modified: branches/Cog/nsspursrc/vm/cogit.c
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.c	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/nsspursrc/vm/cogit.c	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	StackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -544,6 +544,7 @@
 static sqInt cPICMissTrampolineFor(sqInt numArgs) NoDbgRegParms;
 static sqInt cPICHasTarget(CogMethod *cPIC, CogMethod *targetMethod) NoDbgRegParms;
 static sqInt cResultRegister(AbstractInstruction * self_in_cResultRegister) NoDbgRegParms;
+static sqInt createsClosuresInline(void);
 static AbstractInstruction * gDivRRQuoRem(sqInt rDivisor, sqInt rDividend, sqInt rQuotient, sqInt rRemainder) NoDbgRegParms;
 static void dispatchConcretize(AbstractInstruction * self_in_dispatchConcretize) NoDbgRegParms;
 static sqInt doubleExtendedDoAnythingBytecode(void);
@@ -712,6 +713,7 @@
 static sqInt genMustBeBooleanTrampolineForcalled(sqInt boolean, char *trampolineName) NoDbgRegParms;
 static sqInt genNewArrayOfSizeinitialized(sqInt size, sqInt initialized) NoDbgRegParms;
 static sqInt genNonLocalReturnTrampoline(void);
+static sqInt genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock) NoDbgRegParms;
 static sqInt genPassConstasArgument(AbstractInstruction * self_in_genPassConstasArgument, sqInt constant, sqInt zeroRelativeArgIndex) NoDbgRegParms;
 static sqInt genPassRegasArgument(AbstractInstruction * self_in_genPassRegasArgument, sqInt abstractRegister, sqInt zeroRelativeArgIndex) NoDbgRegParms;
 static sqInt genPICAbortTrampolineFor(sqInt numArgs) NoDbgRegParms;
@@ -7654,6 +7656,17 @@
 }
 
 
+/*	Answer if the object representation allocates closures inline. By
+	default answer false. Better code can be generated when creating
+	closures inline if copied values are /not/ flushed to the stack. */
+
+static sqInt
+createsClosuresInline(void)
+{
+	return 1;
+}
+
+
 /*	Division is a little weird on some processors. Defer to the backEnd
 	to allow it to generate any special code it may need to. */
 
@@ -11091,59 +11104,9 @@
 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);
+	genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bcpc, numArgs, numCopied, ctxtNumArgs, isLargeCtxt, isInBlock);
 	for (i = 1; i <= numCopied; i += 1) {
 		/* begin PopR: */
 		genoperand(PopR, TempReg);
@@ -11715,12 +11678,24 @@
 static sqInt
 genExtPushClosureBytecode(void)
 {
+    sqInt i;
     sqInt numArgs;
     sqInt numCopied;
+    sqInt reg;
 
 	assert(needsFrame);
 	addBlockStartAtnumArgsnumCopiedspan(bytecodePC + 3, (numArgs = (byte1 & 7) + ((extA % 16) * 8)), (numCopied = ((((usqInt) byte1) >> 3) & 7) + ((((sqInt) extA >> 4)) * 8)), byte2 + (extB << 8));
 	extA = (extB = 0);
+	assert(getActiveContextAllocatesInMachineCode());
+	(optStatus.isReceiverResultRegLive = 0);
+	ssAllocateCallRegandand(ReceiverResultReg, SendNumArgsReg, ClassReg);
+	genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bytecodePC + 4, numArgs, numCopied, methodOrBlockNumArgs, methodNeedsLargeContext(methodObj), inBlock);
+	for (i = 1; i <= numCopied; i += 1) {
+		reg = ssStorePoptoPreferredReg(1, TempReg);
+		genStoreSourceRegslotIndexintoNewObjectInDestReg(reg, (ClosureFirstCopiedValueIndex + numCopied) - i, ReceiverResultReg);
+	}
+	return ssPushRegister(ReceiverResultReg);
+
 	if (numCopied > 0) {
 		ssFlushTo(simStackPtr);
 	}
@@ -15431,7 +15406,70 @@
 	return genTrampolineForcalledcallJumpBarnumArgsargargargargsaveRegsresultRegappendOpcodes(ceNonLocalReturn, "ceNonLocalReturnTrampoline", 1, 1, ReceiverResultReg, null, null, null, 0, null, 1);
 }
 
+
+/*	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. Do /not/ initialize the copied values. */
+
 static sqInt
+genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock)
+{
+    sqInt address;
+    sqInt address1;
+    usqLong header;
+    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);
+	return 0;
+}
+
+static sqInt
 genPassConstasArgument(AbstractInstruction * self_in_genPassConstasArgument, sqInt constant, sqInt zeroRelativeArgIndex)
 {
 	/* begin MoveCq:R: */
@@ -16420,11 +16458,23 @@
 static sqInt
 genPushClosureCopyCopiedValuesBytecode(void)
 {
+    sqInt i;
     sqInt numArgs;
     sqInt numCopied;
+    sqInt reg;
 
 	assert(needsFrame);
 	addBlockStartAtnumArgsnumCopiedspan(bytecodePC + 4, (numArgs = byte1 & 15), (numCopied = ((usqInt) byte1) >> 4), (byte2 << 8) + byte3);
+	assert(getActiveContextAllocatesInMachineCode());
+	(optStatus.isReceiverResultRegLive = 0);
+	ssAllocateCallRegandand(ReceiverResultReg, SendNumArgsReg, ClassReg);
+	genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bytecodePC + 5, numArgs, numCopied, methodOrBlockNumArgs, methodNeedsLargeContext(methodObj), inBlock);
+	for (i = 1; i <= numCopied; i += 1) {
+		reg = ssStorePoptoPreferredReg(1, TempReg);
+		genStoreSourceRegslotIndexintoNewObjectInDestReg(reg, (ClosureFirstCopiedValueIndex + numCopied) - i, ReceiverResultReg);
+	}
+	return ssPushRegister(ReceiverResultReg);
+
 	if (numCopied > 0) {
 		ssFlushTo(simStackPtr);
 	}

Modified: branches/Cog/nsspursrc/vm/cogit.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.h	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/nsspursrc/vm/cogit.h	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
 
 

Modified: branches/Cog/nsspursrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogmethod.h	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/nsspursrc/vm/cogmethod.h	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
 
 typedef struct {


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Sun Jun  1 10:16:54 PDT 2014
   + Sun Jun  1 12:42:46 PDT 2014

Modified: branches/Cog/sistasrc/vm/cogit.c
===================================================================
--- branches/Cog/sistasrc/vm/cogit.c	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/sistasrc/vm/cogit.c	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
    from
-	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
-static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785 " __DATE__ ;
+static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -552,6 +552,7 @@
 static sqInt cPICMissTrampolineFor(sqInt numArgs) NoDbgRegParms;
 static sqInt cPICHasTarget(CogMethod *cPIC, CogMethod *targetMethod) NoDbgRegParms;
 static sqInt cResultRegister(AbstractInstruction * self_in_cResultRegister) NoDbgRegParms;
+static sqInt createsClosuresInline(void);
 static AbstractInstruction * gDivRRQuoRem(sqInt rDivisor, sqInt rDividend, sqInt rQuotient, sqInt rRemainder) NoDbgRegParms;
 static void dispatchConcretize(AbstractInstruction * self_in_dispatchConcretize) NoDbgRegParms;
 static sqInt doubleExtendedDoAnythingBytecode(void);
@@ -7293,6 +7294,17 @@
 }
 
 
+/*	Answer if the object representation allocates closures inline. By
+	default answer false. Better code can be generated when creating
+	closures inline if copied values are /not/ flushed to the stack. */
+
+static sqInt
+createsClosuresInline(void)
+{
+	return 0;
+}
+
+
 /*	Division is a little weird on some processors. Defer to the backEnd
 	to allow it to generate any special code it may need to. */
 
@@ -13832,11 +13844,14 @@
 static sqInt
 genPushClosureCopyCopiedValuesBytecode(void)
 {
+    sqInt i;
     sqInt numArgs;
     sqInt numCopied;
+    sqInt reg;
 
 	assert(needsFrame);
 	addBlockStartAtnumArgsnumCopiedspan(bytecodePC + 4, (numArgs = byte1 & 15), (numCopied = ((usqInt) byte1) >> 4), (byte2 << 8) + byte3);
+	
 	if (numCopied > 0) {
 		ssFlushTo(simStackPtr);
 	}

Modified: branches/Cog/sistasrc/vm/cogit.h
===================================================================
--- branches/Cog/sistasrc/vm/cogit.h	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/sistasrc/vm/cogit.h	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
 
 

Modified: branches/Cog/sistasrc/vm/cogmethod.h
===================================================================
--- branches/Cog/sistasrc/vm/cogmethod.h	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/sistasrc/vm/cogmethod.h	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
 
 typedef struct {

Modified: branches/Cog/spursistasrc/vm/cogit.c
===================================================================
--- branches/Cog/spursistasrc/vm/cogit.c	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/spursistasrc/vm/cogit.c	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
    from
-	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
-static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785 " __DATE__ ;
+static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -544,6 +544,7 @@
 static sqInt cPICMissTrampolineFor(sqInt numArgs) NoDbgRegParms;
 static sqInt cPICHasTarget(CogMethod *cPIC, CogMethod *targetMethod) NoDbgRegParms;
 static sqInt cResultRegister(AbstractInstruction * self_in_cResultRegister) NoDbgRegParms;
+static sqInt createsClosuresInline(void);
 static AbstractInstruction * gDivRRQuoRem(sqInt rDivisor, sqInt rDividend, sqInt rQuotient, sqInt rRemainder) NoDbgRegParms;
 static void dispatchConcretize(AbstractInstruction * self_in_dispatchConcretize) NoDbgRegParms;
 static sqInt doubleExtendedDoAnythingBytecode(void);
@@ -681,6 +682,7 @@
 static sqInt genMustBeBooleanTrampolineForcalled(sqInt boolean, char *trampolineName) NoDbgRegParms;
 static sqInt genNewArrayOfSizeinitialized(sqInt size, sqInt initialized) NoDbgRegParms;
 static sqInt genNonLocalReturnTrampoline(void);
+static sqInt genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock) NoDbgRegParms;
 static sqInt genPassConstasArgument(AbstractInstruction * self_in_genPassConstasArgument, sqInt constant, sqInt zeroRelativeArgIndex) NoDbgRegParms;
 static sqInt genPassRegasArgument(AbstractInstruction * self_in_genPassRegasArgument, sqInt abstractRegister, sqInt zeroRelativeArgIndex) NoDbgRegParms;
 static sqInt genPICAbortTrampolineFor(sqInt numArgs) NoDbgRegParms;
@@ -7219,6 +7221,17 @@
 }
 
 
+/*	Answer if the object representation allocates closures inline. By
+	default answer false. Better code can be generated when creating
+	closures inline if copied values are /not/ flushed to the stack. */
+
+static sqInt
+createsClosuresInline(void)
+{
+	return 1;
+}
+
+
 /*	Division is a little weird on some processors. Defer to the backEnd
 	to allow it to generate any special code it may need to. */
 
@@ -10604,59 +10617,9 @@
 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);
+	genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bcpc, numArgs, numCopied, ctxtNumArgs, isLargeCtxt, isInBlock);
 	for (i = 1; i <= numCopied; i += 1) {
 		/* begin PopR: */
 		genoperand(PopR, TempReg);
@@ -14019,7 +13982,70 @@
 	return genTrampolineForcalledcallJumpBarnumArgsargargargargsaveRegsresultRegappendOpcodes(ceNonLocalReturn, "ceNonLocalReturnTrampoline", 1, 1, ReceiverResultReg, null, null, null, 0, null, 1);
 }
 
+
+/*	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. Do /not/ initialize the copied values. */
+
 static sqInt
+genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock)
+{
+    sqInt address;
+    sqInt address1;
+    usqLong header;
+    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);
+	return 0;
+}
+
+static sqInt
 genPassConstasArgument(AbstractInstruction * self_in_genPassConstasArgument, sqInt constant, sqInt zeroRelativeArgIndex)
 {
 	/* begin MoveCq:R: */
@@ -14990,11 +15016,23 @@
 static sqInt
 genPushClosureCopyCopiedValuesBytecode(void)
 {
+    sqInt i;
     sqInt numArgs;
     sqInt numCopied;
+    sqInt reg;
 
 	assert(needsFrame);
 	addBlockStartAtnumArgsnumCopiedspan(bytecodePC + 4, (numArgs = byte1 & 15), (numCopied = ((usqInt) byte1) >> 4), (byte2 << 8) + byte3);
+	assert(getActiveContextAllocatesInMachineCode());
+	(optStatus.isReceiverResultRegLive = 0);
+	ssAllocateCallRegandand(ReceiverResultReg, SendNumArgsReg, ClassReg);
+	genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bytecodePC + 5, numArgs, numCopied, methodOrBlockNumArgs, methodNeedsLargeContext(methodObj), inBlock);
+	for (i = 1; i <= numCopied; i += 1) {
+		reg = ssStorePoptoPreferredReg(1, TempReg);
+		genStoreSourceRegslotIndexintoNewObjectInDestReg(reg, (ClosureFirstCopiedValueIndex + numCopied) - i, ReceiverResultReg);
+	}
+	return ssPushRegister(ReceiverResultReg);
+
 	if (numCopied > 0) {
 		ssFlushTo(simStackPtr);
 	}

Modified: branches/Cog/spursistasrc/vm/cogit.h
===================================================================
--- branches/Cog/spursistasrc/vm/cogit.h	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/spursistasrc/vm/cogit.h	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
 
 

Modified: branches/Cog/spursistasrc/vm/cogmethod.h
===================================================================
--- branches/Cog/spursistasrc/vm/cogmethod.h	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/spursistasrc/vm/cogmethod.h	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
 
 typedef struct {

Modified: branches/Cog/spursrc/vm/cogit.c
===================================================================
--- branches/Cog/spursrc/vm/cogit.c	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/spursrc/vm/cogit.c	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	StackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -540,6 +540,7 @@
 static sqInt cPICMissTrampolineFor(sqInt numArgs) NoDbgRegParms;
 static sqInt cPICHasTarget(CogMethod *cPIC, CogMethod *targetMethod) NoDbgRegParms;
 static sqInt cResultRegister(AbstractInstruction * self_in_cResultRegister) NoDbgRegParms;
+static sqInt createsClosuresInline(void);
 static AbstractInstruction * gDivRRQuoRem(sqInt rDivisor, sqInt rDividend, sqInt rQuotient, sqInt rRemainder) NoDbgRegParms;
 static void dispatchConcretize(AbstractInstruction * self_in_dispatchConcretize) NoDbgRegParms;
 static sqInt doubleExtendedDoAnythingBytecode(void);
@@ -676,6 +677,7 @@
 static sqInt genMustBeBooleanTrampolineForcalled(sqInt boolean, char *trampolineName) NoDbgRegParms;
 static sqInt genNewArrayOfSizeinitialized(sqInt size, sqInt initialized) NoDbgRegParms;
 static sqInt genNonLocalReturnTrampoline(void);
+static sqInt genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock) NoDbgRegParms;
 static sqInt genPassConstasArgument(AbstractInstruction * self_in_genPassConstasArgument, sqInt constant, sqInt zeroRelativeArgIndex) NoDbgRegParms;
 static sqInt genPassRegasArgument(AbstractInstruction * self_in_genPassRegasArgument, sqInt abstractRegister, sqInt zeroRelativeArgIndex) NoDbgRegParms;
 static sqInt genPICAbortTrampolineFor(sqInt numArgs) NoDbgRegParms;
@@ -7188,6 +7190,17 @@
 }
 
 
+/*	Answer if the object representation allocates closures inline. By
+	default answer false. Better code can be generated when creating
+	closures inline if copied values are /not/ flushed to the stack. */
+
+static sqInt
+createsClosuresInline(void)
+{
+	return 1;
+}
+
+
 /*	Division is a little weird on some processors. Defer to the backEnd
 	to allow it to generate any special code it may need to. */
 
@@ -10560,59 +10573,9 @@
 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);
+	genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bcpc, numArgs, numCopied, ctxtNumArgs, isLargeCtxt, isInBlock);
 	for (i = 1; i <= numCopied; i += 1) {
 		/* begin PopR: */
 		genoperand(PopR, TempReg);
@@ -13939,7 +13902,70 @@
 	return genTrampolineForcalledcallJumpBarnumArgsargargargargsaveRegsresultRegappendOpcodes(ceNonLocalReturn, "ceNonLocalReturnTrampoline", 1, 1, ReceiverResultReg, null, null, null, 0, null, 1);
 }
 
+
+/*	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. Do /not/ initialize the copied values. */
+
 static sqInt
+genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(sqInt bcpc, sqInt numArgs, sqInt numCopied, sqInt ctxtNumArgs, sqInt isLargeCtxt, sqInt isInBlock)
+{
+    sqInt address;
+    sqInt address1;
+    usqLong header;
+    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);
+	return 0;
+}
+
+static sqInt
 genPassConstasArgument(AbstractInstruction * self_in_genPassConstasArgument, sqInt constant, sqInt zeroRelativeArgIndex)
 {
 	/* begin MoveCq:R: */
@@ -14910,11 +14936,23 @@
 static sqInt
 genPushClosureCopyCopiedValuesBytecode(void)
 {
+    sqInt i;
     sqInt numArgs;
     sqInt numCopied;
+    sqInt reg;
 
 	assert(needsFrame);
 	addBlockStartAtnumArgsnumCopiedspan(bytecodePC + 4, (numArgs = byte1 & 15), (numCopied = ((usqInt) byte1) >> 4), (byte2 << 8) + byte3);
+	assert(getActiveContextAllocatesInMachineCode());
+	(optStatus.isReceiverResultRegLive = 0);
+	ssAllocateCallRegandand(ReceiverResultReg, SendNumArgsReg, ClassReg);
+	genNoPopCreateClosureAtnumArgsnumCopiedcontextNumArgslargeinBlock(bytecodePC + 5, numArgs, numCopied, methodOrBlockNumArgs, methodNeedsLargeContext(methodObj), inBlock);
+	for (i = 1; i <= numCopied; i += 1) {
+		reg = ssStorePoptoPreferredReg(1, TempReg);
+		genStoreSourceRegslotIndexintoNewObjectInDestReg(reg, (ClosureFirstCopiedValueIndex + numCopied) - i, ReceiverResultReg);
+	}
+	return ssPushRegister(ReceiverResultReg);
+
 	if (numCopied > 0) {
 		ssFlushTo(simStackPtr);
 	}

Modified: branches/Cog/spursrc/vm/cogit.h
===================================================================
--- branches/Cog/spursrc/vm/cogit.h	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/spursrc/vm/cogit.h	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
 
 

Modified: branches/Cog/spursrc/vm/cogmethod.h
===================================================================
--- branches/Cog/spursrc/vm/cogmethod.h	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/spursrc/vm/cogmethod.h	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
 
 typedef struct {

Modified: branches/Cog/src/vm/cogit.c
===================================================================
--- branches/Cog/src/vm/cogit.c	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/src/vm/cogit.c	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	StackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -547,6 +547,7 @@
 static sqInt cPICMissTrampolineFor(sqInt numArgs) NoDbgRegParms;
 static sqInt cPICHasTarget(CogMethod *cPIC, CogMethod *targetMethod) NoDbgRegParms;
 static sqInt cResultRegister(AbstractInstruction * self_in_cResultRegister) NoDbgRegParms;
+static sqInt createsClosuresInline(void);
 static AbstractInstruction * gDivRRQuoRem(sqInt rDivisor, sqInt rDividend, sqInt rQuotient, sqInt rRemainder) NoDbgRegParms;
 static void dispatchConcretize(AbstractInstruction * self_in_dispatchConcretize) NoDbgRegParms;
 static sqInt doubleExtendedDoAnythingBytecode(void);
@@ -7255,6 +7256,17 @@
 }
 
 
+/*	Answer if the object representation allocates closures inline. By
+	default answer false. Better code can be generated when creating
+	closures inline if copied values are /not/ flushed to the stack. */
+
+static sqInt
+createsClosuresInline(void)
+{
+	return 0;
+}
+
+
 /*	Division is a little weird on some processors. Defer to the backEnd
 	to allow it to generate any special code it may need to. */
 
@@ -13745,11 +13757,14 @@
 static sqInt
 genPushClosureCopyCopiedValuesBytecode(void)
 {
+    sqInt i;
     sqInt numArgs;
     sqInt numCopied;
+    sqInt reg;
 
 	assert(needsFrame);
 	addBlockStartAtnumArgsnumCopiedspan(bytecodePC + 4, (numArgs = byte1 & 15), (numCopied = ((usqInt) byte1) >> 4), (byte2 << 8) + byte3);
+	
 	if (numCopied > 0) {
 		ssFlushTo(simStackPtr);
 	}

Modified: branches/Cog/src/vm/cogit.h
===================================================================
--- branches/Cog/src/vm/cogit.h	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/src/vm/cogit.h	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
 
 

Modified: branches/Cog/src/vm/cogmethod.h
===================================================================
--- branches/Cog/src/vm/cogmethod.h	2014-06-01 17:18:37 UTC (rev 2936)
+++ branches/Cog/src/vm/cogmethod.h	2014-06-01 19:43:14 UTC (rev 2937)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.743 uuid: 92a02694-b094-4525-b2e2-c166faf67785
+	CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92
  */
 
 typedef struct {



More information about the Vm-dev mailing list