[Vm-dev] [commit][2935] CogVM source as per VMMaker.oscog-eem.742

commits at squeakvm.org commits at squeakvm.org
Sun Jun 1 05:32:36 UTC 2014


Revision: 2935
Author:   eliot
Date:     2014-05-31 22:32:34 -0700 (Sat, 31 May 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.742

Refactor context creation in the Cogit, moving it to the object representations.
In Spur allocate the context in one of four trampolines for block vs method and
large vs small contexts.

Refactor ceCreateNewArray & cePositive32BitInteger trampolines, moving them into
the object representations as required (cePositive32BitInteger is only used in
the Squeak obj rep).  In the Spur obj rep inline allocation in pushNewArray
bytecodes.

Fix regression in primitiveUtcWithOffset, answer the correct local time offset.

Fix code generation for ThreadedFFIPlugin by ensuring that target directory
exists, addressing failures in http://build.squeak.org/job/CogVM/ code
generation test.

Fix ioSecondsNow to use the time now, not the heartbeat time.

Fix initialization in the VM Simulation Workspace.

Modified Paths:
--------------
    branches/Cog/image/VM Simulation Workspace.text
    branches/Cog/nscogsrc/vm/cogit.c
    branches/Cog/nscogsrc/vm/cogit.h
    branches/Cog/nscogsrc/vm/cogmethod.h
    branches/Cog/nscogsrc/vm/cointerp.c
    branches/Cog/nscogsrc/vm/cointerp.h
    branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
    branches/Cog/nscogsrc/vm/interp.h
    branches/Cog/nscogsrc/vm/vmCallback.h
    branches/Cog/nsspursrc/vm/cogit.c
    branches/Cog/nsspursrc/vm/cogit.h
    branches/Cog/nsspursrc/vm/cogmethod.h
    branches/Cog/nsspursrc/vm/cointerp.c
    branches/Cog/nsspursrc/vm/cointerp.h
    branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
    branches/Cog/nsspursrc/vm/interp.h
    branches/Cog/nsspursrc/vm/vmCallback.h
    branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c
    branches/Cog/nsspurstacksrc/vm/interp.c
    branches/Cog/nsspurstacksrc/vm/interp.h
    branches/Cog/nsspurstacksrc/vm/vmCallback.h
    branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c
    branches/Cog/platforms/unix/vm/sqUnixITimerHeartbeat.c
    branches/Cog/platforms/unix/vm/sqUnixITimerTickerHeartbeat.c
    branches/Cog/platforms/win32/vm/sqWin32Heartbeat.c
    branches/Cog/sistasrc/vm/cogit.c
    branches/Cog/sistasrc/vm/cogit.h
    branches/Cog/sistasrc/vm/cogmethod.h
    branches/Cog/sistasrc/vm/cointerp.c
    branches/Cog/sistasrc/vm/cointerp.h
    branches/Cog/sistasrc/vm/gcc3x-cointerp.c
    branches/Cog/sistasrc/vm/interp.h
    branches/Cog/sistasrc/vm/vmCallback.h
    branches/Cog/spursistasrc/vm/cogit.c
    branches/Cog/spursistasrc/vm/cogit.h
    branches/Cog/spursistasrc/vm/cogmethod.h
    branches/Cog/spursistasrc/vm/cointerp.c
    branches/Cog/spursistasrc/vm/cointerp.h
    branches/Cog/spursistasrc/vm/gcc3x-cointerp.c
    branches/Cog/spursistasrc/vm/interp.h
    branches/Cog/spursistasrc/vm/vmCallback.h
    branches/Cog/spursrc/vm/cogit.c
    branches/Cog/spursrc/vm/cogit.h
    branches/Cog/spursrc/vm/cogmethod.h
    branches/Cog/spursrc/vm/cointerp.c
    branches/Cog/spursrc/vm/cointerp.h
    branches/Cog/spursrc/vm/gcc3x-cointerp.c
    branches/Cog/spursrc/vm/interp.h
    branches/Cog/spursrc/vm/vmCallback.h
    branches/Cog/spurstacksrc/vm/gcc3x-interp.c
    branches/Cog/spurstacksrc/vm/interp.c
    branches/Cog/spurstacksrc/vm/interp.h
    branches/Cog/spurstacksrc/vm/vmCallback.h
    branches/Cog/src/vm/cogit.c
    branches/Cog/src/vm/cogit.h
    branches/Cog/src/vm/cogmethod.h
    branches/Cog/src/vm/cointerp.c
    branches/Cog/src/vm/cointerp.h
    branches/Cog/src/vm/cointerpmt.c
    branches/Cog/src/vm/cointerpmt.h
    branches/Cog/src/vm/gcc3x-cointerp.c
    branches/Cog/src/vm/gcc3x-cointerpmt.c
    branches/Cog/src/vm/interp.h
    branches/Cog/src/vm/vmCallback.h
    branches/Cog/stacksrc/vm/gcc3x-interp.c
    branches/Cog/stacksrc/vm/interp.c
    branches/Cog/stacksrc/vm/interp.h
    branches/Cog/stacksrc/vm/vmCallback.h

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

Modified: branches/Cog/image/VM Simulation Workspace.text
===================================================================
--- branches/Cog/image/VM Simulation Workspace.text	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/image/VM Simulation Workspace.text	2014-06-01 05:32:34 UTC (rev 2935)
@@ -1,8 +1,6 @@
 ("Run the VM simulator on an image (by default the Squeak 4.5 image:)"
 | cos proc opts |
-CoInterpreter initializeWithOptions: (opts := Dictionary newFromPairs: #()).
-CogVMSimulator chooseAndInitCogitClassWithOpts: opts.
-cos := CogVMSimulator new.
+cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit").
 "cos initializeThreadSupport."
 cos desiredNumStackPages: 8.
 cos openOn: 'Squeak-4.5-All-in-One.app/Contents/Resources/Squeak4.5-13680.image'.
Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-06-01 05:32:34 UTC (rev 2935)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CCodeGenerator VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	StackToRegisterMappingCogit VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -647,6 +647,7 @@
 static void genFastPrimTraceUsingand(sqInt r1, sqInt r2) NoDbgRegParms;
 static sqInt genFetchIndexRegisterfrominto(sqInt indexReg, sqInt tableObj, sqInt destReg) NoDbgRegParms;
 static sqInt genFramelessStorePopReceiverVariable(sqInt popBoolean, sqInt slotIndex) NoDbgRegParms;
+static void genGetActiveContextNumArgslargeinBlock(sqInt numArgs, sqInt isLargeContext, sqInt isInBlock) NoDbgRegParms;
 static sqInt genGetClassFormatOfNonIntintoscratchReg(sqInt instReg, sqInt destReg, sqInt scratchReg) NoDbgRegParms;
 static sqInt genGetClassObjectOfintoscratchReginstRegIsReceiver(sqInt instReg, sqInt destReg, sqInt scratchReg, sqInt instRegIsReceiver) NoDbgRegParms;
 static AbstractInstruction * genGetClassTagOfintoscratchReg(sqInt instReg, sqInt destReg, sqInt scratchReg) NoDbgRegParms;
@@ -702,6 +703,7 @@
 static sqInt genMethodAbortTrampolineFor(sqInt numArgs) NoDbgRegParms;
 static AbstractInstruction * genMulRR(AbstractInstruction * self_in_genMulRR, sqInt regSource, sqInt regDest) NoDbgRegParms;
 static sqInt genMustBeBooleanTrampolineForcalled(sqInt boolean, char *trampolineName) NoDbgRegParms;
+static void genNewArrayOfSizeinitialized(sqInt size, sqInt initialized) NoDbgRegParms;
 static sqInt genNonLocalReturnTrampoline(void);
 static sqInt genPassConstasArgument(AbstractInstruction * self_in_genPassConstasArgument, sqInt constant, sqInt zeroRelativeArgIndex) NoDbgRegParms;
 static sqInt genPassRegasArgument(AbstractInstruction * self_in_genPassRegasArgument, sqInt abstractRegister, sqInt zeroRelativeArgIndex) NoDbgRegParms;
@@ -847,6 +849,7 @@
 static AbstractInstruction * genoperand(sqInt opcode, sqInt operand) NoDbgRegParms;
 static AbstractInstruction * genoperandoperand(sqInt opcode, sqInt operandOne, sqInt operandTwo) NoDbgRegParms;
 static AbstractInstruction * genoperandoperandoperand(sqInt opcode, sqInt operandOne, sqInt operandTwo, sqInt operandThree) NoDbgRegParms;
+static sqInt getActiveContextAllocatesInMachineCode(void);
 static AbstractInstruction * getInlineCacheClassTagFrominto(sqInt sourceReg, sqInt destReg) NoDbgRegParms;
 static AbstractInstruction * getJmpTarget(AbstractInstruction * self_in_getJmpTarget) NoDbgRegParms;
 static sqInt getLiteral(sqInt litIndex) NoDbgRegParms;
@@ -1053,6 +1056,7 @@
 static sqInt spanForCleanBlockStartingAt(sqInt startPC) NoDbgRegParms;
 static void ssAllocateCallReg(sqInt requiredReg) NoDbgRegParms;
 static void ssAllocateCallRegand(sqInt requiredReg1, sqInt requiredReg2) NoDbgRegParms;
+static void ssAllocateCallRegandand(sqInt requiredReg1, sqInt requiredReg2, sqInt requiredReg3) NoDbgRegParms;
 static void ssAllocateCallRegandandand(sqInt requiredReg1, sqInt requiredReg2, sqInt requiredReg3, sqInt requiredReg4) NoDbgRegParms;
 static sqInt ssAllocatePreferredReg(sqInt preferredReg) NoDbgRegParms;
 static void ssAllocateRequiredRegMaskupThrough(sqInt requiredRegsMask, sqInt stackPtr) NoDbgRegParms;
@@ -1107,6 +1111,7 @@
 static void voidYoungReferrersPostTenureAll(void);
 char * whereIsMaybeCodeThing(sqInt anOop);
 static AbstractInstruction * gXorCwR(sqInt wordConstant, sqInt reg) NoDbgRegParms;
+static void zeroOpcodeIndex(void);
 
 
 /*** Variables ***/
@@ -2029,6 +2034,7 @@
 		annotations = (void *)((char *)fixups + fixupSize); \
 		opcodeIndex = labelCounter = annotationIndex = 0; \
 } while (0)
+#define backEnd() backEnd
 #define blockAlignment(self) 8
 #define blockStartAt(index) (&blockStarts[index])
 #define breakOnImplicitReceiver() (traceFlags & 64)
@@ -2036,7 +2042,6 @@
 #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline
 #define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline)
 #define ceCheckFeatures() ceCheckFeaturesFunction()
-#define cePositive32BitIntegerTrampoline() cePositive32BitIntegerTrampoline
 #define ceReturnToInterpreterPC() ((usqInt)ceReturnToInterpreterTrampoline)
 #define cFramePointerAddress() ((unsigned long)&CFramePointer)
 #define cPICNumCases stackCheckOffset
@@ -2056,6 +2061,7 @@
 #define limitZony() ((CogMethod *)mzFreeStart)
 #define maybeConstant(sse) ((sse)->constant)
 #define methodBytesFreedSinceLastCompaction() methodBytesFreedSinceLastCompaction
+#define methodZoneBase() methodZoneBase
 #define minCallAddress() minValidCallAddress
 #define nextOpenPIC methodObject
 #define nextOpenPICHack hack hack hack i.e. the getter macro does all the work
@@ -10846,7 +10852,7 @@
 {
     AbstractInstruction *jumpSingle;
 
-	opcodeIndex = 0;
+	zeroOpcodeIndex();
 	/* begin MoveMw:r:R: */
 	genoperandoperandoperand(MoveMwrR, FoxMethod, FPReg, TempReg);
 	/* begin AndCq:R: */
@@ -12262,6 +12268,9 @@
 generateObjectRepresentationTrampolines(void)
 {
 	ceStoreCheckTrampoline = genTrampolineForcalledargresult(ceStoreCheck, "ceStoreCheckTrampoline", ReceiverResultReg, returnRegForStoreCheck());
+	ceCreateNewArrayTrampoline = genTrampolineForcalledargresult(ceNewArraySlotSize, "ceCreateNewArrayTrampoline", SendNumArgsReg, ReceiverResultReg);
+	cePositive32BitIntegerTrampoline = genTrampolineForcalledargresult(cePositive32BitIntegerFor, "cePositive32BitIntegerTrampoline", ReceiverResultReg, TempReg);
+	ceActiveContextTrampoline = genActiveContextTrampoline();
 }
 
 
@@ -12300,17 +12309,14 @@
 	ceSendMustBeBooleanAddFalseTrampoline = genMustBeBooleanTrampolineForcalled(falseObject(), "ceSendMustBeBooleanAddFalseTrampoline");
 	ceSendMustBeBooleanAddTrueTrampoline = genMustBeBooleanTrampolineForcalled(trueObject(), "ceSendMustBeBooleanAddTrueTrampoline");
 	ceClosureCopyTrampoline = genTrampolineForcalledargresult(ceClosureCopyDescriptor, "ceClosureCopyTrampoline", SendNumArgsReg, ReceiverResultReg);
-	ceActiveContextTrampoline = genActiveContextTrampoline();
 	ceNonLocalReturnTrampoline = genNonLocalReturnTrampoline();
 	ceBaseFrameReturnTrampoline = genTrampolineForcalledarg(ceBaseFrameReturn, "ceBaseFrameReturnTrampoline", ReceiverResultReg);
-	ceCreateNewArrayTrampoline = genTrampolineForcalledargresult(ceNewArraySlotSize, "ceCreateNewArrayTrampoline", SendNumArgsReg, ReceiverResultReg);
 	ceCheckForInterruptTrampoline = genCheckForInterruptsTrampoline();
 	ceFetchContextInstVarTrampoline = genTrampolineForcalledargargresult(ceContextinstVar, "ceFetchContextInstVarTrampoline", ReceiverResultReg, SendNumArgsReg, SendNumArgsReg);
 
 	/* to keep ReceiverResultReg live. */
 
 	ceStoreContextInstVarTrampoline = genTrampolineForcalledargargargresult(ceContextinstVarvalue, "ceStoreContextInstVarTrampoline", ReceiverResultReg, SendNumArgsReg, ClassReg, ReceiverResultReg);
-	cePositive32BitIntegerTrampoline = genTrampolineForcalledargresult(cePositive32BitIntegerFor, "cePositive32BitIntegerTrampoline", ReceiverResultReg, TempReg);
 	ceReturnToInterpreterTrampoline = genTrampolineForcalledarg(ceReturnToInterpreter, "ceReturnToInterpreterTrampoline", ReceiverResultReg);
 	ceCannotResumeTrampoline = genTrampolineForcalled(ceCannotResume, "ceCannotResumeTrampoline");
 }
@@ -12395,7 +12401,7 @@
     sqInt selector;
 
 	methodZoneStart = methodZoneBase;
-	allocateOpcodesbytecodes(42, 0);
+	allocateOpcodesbytecodes(72, 0);
 	initialPC = 0;
 	endPC = numAbstractOpcodes - 1;
 	hasYoungReferent = 0;
@@ -12536,6 +12542,15 @@
 }
 
 
+/*	Get the active context into ReceiverResultReg, creating it if necessary. */
+
+static void
+genGetActiveContextNumArgslargeinBlock(sqInt numArgs, sqInt isLargeContext, sqInt isInBlock)
+{
+	CallRT(ceActiveContextTrampoline);
+}
+
+
 /*	Fetch the instance's class format into destReg, assuming the object is
 	non-int. 
  */
@@ -13021,7 +13036,7 @@
 	genConvertIntegerToSmallIntegerInScratchReg(ReceiverResultReg);
 	/* begin RetN: */
 	genoperand(RetN, retNoffset);
-	jmpTarget(jumpLarge, CallRT(cePositive32BitIntegerTrampoline()));
+	jmpTarget(jumpLarge, CallRT(cePositive32BitIntegerTrampoline));
 	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, TempReg, ReceiverResultReg);
 	/* begin RetN: */
@@ -13786,6 +13801,20 @@
 	return genTrampolineForcalledcallJumpBarnumArgsargargargargsaveRegsresultRegappendOpcodes(ceSendMustBeBoolean, trampolineName, 1, 1, TempReg, null, null, null, 0, null, 1);
 }
 
+
+/*	Generate a call to code that allocates a new Array of size.
+	The Array should be initialized with nils iff initialized is true.
+	The size arg is passed in SendNumArgsReg, the result
+	must come back in ReceiverResultReg. */
+
+static void
+genNewArrayOfSizeinitialized(sqInt size, sqInt initialized)
+{
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, size, SendNumArgsReg);
+	CallRT(ceCreateNewArrayTrampoline);
+}
+
 static sqInt
 genNonLocalReturnTrampoline(void)
 {
@@ -14775,7 +14804,8 @@
 	assert(needsFrame);
 	(optStatus.isReceiverResultRegLive = 0);
 	ssAllocateCallReg(ReceiverResultReg);
-	CallRT(ceActiveContextTrampoline);
+
+	genGetActiveContextNumArgslargeinBlock(methodOrBlockNumArgs, methodNeedsLargeContext(methodObj), inBlock);
 	return ssPushRegister(ReceiverResultReg);
 }
 
@@ -14996,9 +15026,7 @@
 		ssAllocateCallRegand(SendNumArgsReg, ReceiverResultReg);
 	}
 	size = byte1 & 0x7F;
-	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, size, SendNumArgsReg);
-	CallRT(ceCreateNewArrayTrampoline);
+	genNewArrayOfSizeinitialized(size, !popValues);
 	if (popValues) {
 		for (i = (size - 1); i >= 0; i += -1) {
 			/* begin PopR: */
@@ -16638,6 +16666,18 @@
 }
 
 
+/*	subclasses override if they want, and will have SendNumArgsReg and
+	ClassReg available in addition to ReceiverResultReg and TempReg if they
+	do. 
+ */
+
+static sqInt
+getActiveContextAllocatesInMachineCode(void)
+{
+	return 0;
+}
+
+
 /*	Extract the inline cache tag for the object in sourceReg into destReg. The
 	inline cache tag for a given object is the value loaded in inline caches
 	to distinguish objects
@@ -21079,6 +21119,12 @@
 }
 
 static void
+ssAllocateCallRegandand(sqInt requiredReg1, sqInt requiredReg2, sqInt requiredReg3)
+{
+	ssAllocateRequiredRegMaskupThrough(callerSavedRegMask | ((registerMaskFor(requiredReg1)) | ((registerMaskFor(requiredReg2)) | (registerMaskFor(requiredReg3)))), simStackPtr);
+}
+
+static void
 ssAllocateCallRegandandand(sqInt requiredReg1, sqInt requiredReg2, sqInt requiredReg3, sqInt requiredReg4)
 {
 	ssAllocateRequiredRegMaskupThrough(callerSavedRegMask | ((registerMaskFor(requiredReg1)) | ((registerMaskFor(requiredReg2)) | ((registerMaskFor(requiredReg3)) | (registerMaskFor(requiredReg4))))), simStackPtr);
@@ -22299,3 +22345,14 @@
 {
 	return genoperandoperand(XorCwR, wordConstant, reg);
 }
+
+
+/*	Access for the object representations when they need to prepend code to
+	trampolines. 
+ */
+
+static void
+zeroOpcodeIndex(void)
+{
+	opcodeIndex = 0;
+}

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-06-01 05:32:34 UTC (rev 2935)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CCodeGenerator VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/nscogsrc/vm/cogmethod.h	2014-06-01 05:32:34 UTC (rev 2935)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CCodeGenerator VMMaker.oscog-eem.742 uuid: ed898ba8-2dfc-4c0f-9d9a-00633e988f59
  */
 
 typedef struct {

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2014-06-01 05:32:34 UTC (rev 2935)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
    from
-	CoInterpreter VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -781,6 +781,7 @@
 sqInt methodClassOf(sqInt methodPointer);
 sqInt methodHasCogMethod(sqInt aMethodOop);
 static sqInt methodHeaderHasPrimitive(sqInt methodHeader) NoDbgRegParms;
+sqInt methodNeedsLargeContext(sqInt methodObj);
 sqInt methodPrimitiveIndex(void);
 sqInt methodReturnValue(sqInt oop);
 sqInt methodShouldBeCogged(sqInt aMethodObj);
@@ -2058,7 +2059,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.735";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.741";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -28930,6 +28931,12 @@
 }
 
 sqInt
+methodNeedsLargeContext(sqInt methodObj)
+{
+	return (headerOf(methodObj)) & LargeContextBit;
+}
+
+sqInt
 methodPrimitiveIndex(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt firstBytecode;
@@ -45227,18 +45234,20 @@
 EXPORT(sqInt)
 primitiveUtcWithOffset(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    static usqLong epochDelta= 2177452800000000ULL;
+    sqLong offset;
     sqInt oop;
     sqInt oop1;
     sqInt resultArray;
     char *sp;
+    usqLong utcMicroseconds;
     sqInt valuePointer;
-    sqInt valuePointer1;
 
-
-	/* 2177452800000000 = '1/1/1970' asDate asSeconds - '1/1/1901' asDate asSeconds * 1,000,000 */
-
+	utcMicroseconds = ioUTCMicroseconds();
+	offset = (ioLocalMicroseconds()) - utcMicroseconds;
+	offset = offset / 1000000;
 	/* begin pushRemappableOop: */
-	oop = positive64BitIntegerFor((ioUTCMicrosecondsNow()) - 2177452800000000ULL);
+	oop = positive64BitIntegerFor(utcMicroseconds - epochDelta);
 	assert(addressCouldBeOop(oop));
 	GIV(remapBuffer)[(GIV(remapBufferCount) += 1)] = oop;
 	if (!(GIV(remapBufferCount) <= RemapBufferSize)) {
@@ -45254,9 +45263,7 @@
 		possibleRootStoreIntovalue(resultArray, valuePointer);
 	}
 	longAtput((resultArray + BaseHeaderSize) + (0 << ShiftForWord), valuePointer);
-	/* begin storePointerUnchecked:ofObject:withValue: */
-	valuePointer1 = (((ioLocalSecondsOffset()) << 1) | 1);
-	longAtput((resultArray + BaseHeaderSize) + (1 << ShiftForWord), valuePointer1);
+	longAtput((resultArray + BaseHeaderSize) + (1 << ShiftForWord), ((offset << 1) | 1));
 	/* begin pop:thenPush: */
 	longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), resultArray);
 	GIV(stackPointer) = sp;

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/nscogsrc/vm/cointerp.h	2014-06-01 05:32:34 UTC (rev 2935)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
  */
 
 
@@ -150,6 +150,7 @@
 sqInt methodClassAssociationOf(sqInt methodPointer);
 sqInt methodClassOf(sqInt methodPointer);
 sqInt methodHasCogMethod(sqInt aMethodOop);
+sqInt methodNeedsLargeContext(sqInt methodObj);
 sqInt methodPrimitiveIndex(void);
 sqInt methodShouldBeCogged(sqInt aMethodObj);
 sqInt methodUsesAlternateBytecodeSet(sqInt aMethodObj);

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c	2014-06-01 05:32:34 UTC (rev 2935)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
    from
-	CoInterpreter VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -784,6 +784,7 @@
 sqInt methodClassOf(sqInt methodPointer);
 sqInt methodHasCogMethod(sqInt aMethodOop);
 static sqInt methodHeaderHasPrimitive(sqInt methodHeader) NoDbgRegParms;
+sqInt methodNeedsLargeContext(sqInt methodObj);
 sqInt methodPrimitiveIndex(void);
 sqInt methodReturnValue(sqInt oop);
 sqInt methodShouldBeCogged(sqInt aMethodObj);
@@ -2061,7 +2062,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.735";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.741";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
@@ -28939,6 +28940,12 @@
 }
 
 sqInt
+methodNeedsLargeContext(sqInt methodObj)
+{
+	return (headerOf(methodObj)) & LargeContextBit;
+}
+
+sqInt
 methodPrimitiveIndex(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt firstBytecode;
@@ -45236,18 +45243,20 @@
 EXPORT(sqInt)
 primitiveUtcWithOffset(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    static usqLong epochDelta= 2177452800000000ULL;
+    sqLong offset;
     sqInt oop;
     sqInt oop1;
     sqInt resultArray;
     char *sp;
+    usqLong utcMicroseconds;
     sqInt valuePointer;
-    sqInt valuePointer1;
 
-
-	/* 2177452800000000 = '1/1/1970' asDate asSeconds - '1/1/1901' asDate asSeconds * 1,000,000 */
-
+	utcMicroseconds = ioUTCMicroseconds();
+	offset = (ioLocalMicroseconds()) - utcMicroseconds;
+	offset = offset / 1000000;
 	/* begin pushRemappableOop: */
-	oop = positive64BitIntegerFor((ioUTCMicrosecondsNow()) - 2177452800000000ULL);
+	oop = positive64BitIntegerFor(utcMicroseconds - epochDelta);
 	assert(addressCouldBeOop(oop));
 	GIV(remapBuffer)[(GIV(remapBufferCount) += 1)] = oop;
 	if (!(GIV(remapBufferCount) <= RemapBufferSize)) {
@@ -45263,9 +45272,7 @@
 		possibleRootStoreIntovalue(resultArray, valuePointer);
 	}
 	longAtput((resultArray + BaseHeaderSize) + (0 << ShiftForWord), valuePointer);
-	/* begin storePointerUnchecked:ofObject:withValue: */
-	valuePointer1 = (((ioLocalSecondsOffset()) << 1) | 1);
-	longAtput((resultArray + BaseHeaderSize) + (1 << ShiftForWord), valuePointer1);
+	longAtput((resultArray + BaseHeaderSize) + (1 << ShiftForWord), ((offset << 1) | 1));
 	/* begin pop:thenPush: */
 	longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), resultArray);
 	GIV(stackPointer) = sp;

Modified: branches/Cog/nscogsrc/vm/interp.h
===================================================================
--- branches/Cog/nscogsrc/vm/interp.h	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/nscogsrc/vm/interp.h	2014-06-01 05:32:34 UTC (rev 2935)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/nscogsrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nscogsrc/vm/vmCallback.h	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/nscogsrc/vm/vmCallback.h	2014-06-01 05:32:34 UTC (rev 2935)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
  */
 
 #define VM_CALLBACK_INC 1

Modified: branches/Cog/nsspursrc/vm/cogit.c
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.c	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/nsspursrc/vm/cogit.c	2014-06-01 05:32:34 UTC (rev 2935)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CCodeGenerator VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	StackToRegisterMappingCogit VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -131,9 +131,11 @@
 #define BlockCreationBytecodeSize 4
 #define Call 9
 #define CDQ 110
+#define ClassArrayCompactIndex 51
 #define ClassMethodContextCompactIndex 36
 #define ClassReg -5
 #define ClosureFirstCopiedValueIndex 3
+#define ClosureIndex 4
 #define ClosureNumArgsIndex 2
 #define ClosureOuterContextIndex 0
 #define ClosureStartPCIndex 1
@@ -182,6 +184,7 @@
 #define FoxCallerSavedIP 4
 #define FoxMethod -4
 #define FoxMFReceiver -12
+#define FoxSavedFP 0
 #define FoxThisContext -8
 #define FPReg -1
 #define GCModeBecome 4
@@ -233,6 +236,7 @@
 #define JumpR 11
 #define JumpZero 16
 #define Label 1
+#define LargeContextSlots 62
 #define LastJump 39
 #define LFENCE 114
 #define LinkReg -17
@@ -313,12 +317,14 @@
 #define ShiftForWord 2
 #define SIB1 0
 #define SIB4 2
+#define SmallContextSlots 22
 #define SPReg -2
 #define SqrtRd 108
 #define SSBaseOffset 1
 #define SSConstant 2
 #define SSRegister 3
 #define SSSpill 4
+#define StackPointerIndex 2
 #define SubCqR 91
 #define SubCwR 98
 #define SubRdRd 105
@@ -574,7 +580,7 @@
 static void freeOlderMethodsForCompaction(void);
 static void freePICsWithFreedTargets(void);
 void freeUnmarkedMachineCode(void);
-static sqInt genActiveContextTrampoline(void);
+static sqInt genActiveContextTrampolineLargeinBlockcalled(sqInt isLarge, sqInt isInBlock, sqInt aString) NoDbgRegParms;
 static sqInt genAddSmallIntegerTagsTo(sqInt aRegister) NoDbgRegParms;
 static sqInt genAlignCStackSavingRegistersnumArgswordAlignment(AbstractInstruction * self_in_genAlignCStackSavingRegistersnumArgswordAlignment, sqInt saveRegs, sqInt numArgs, sqInt alignment) NoDbgRegParms;
 static AbstractInstruction * genAllocFloatValueintoscratchRegscratchReg(sqInt dpreg, sqInt resultReg, sqInt scratch1, sqInt scratch2) NoDbgRegParms;
@@ -642,6 +648,8 @@
 static void genFastPrimTraceUsingand(sqInt r1, sqInt r2) NoDbgRegParms;
 static sqInt genFetchIndexRegisterfrominto(sqInt indexReg, sqInt tableObj, sqInt destReg) NoDbgRegParms;
 static sqInt genFramelessStorePopReceiverVariable(sqInt popBoolean, sqInt slotIndex) NoDbgRegParms;
+static sqInt genGetActiveContextLargeinBlock(sqInt isLarge, sqInt isInBlock) NoDbgRegParms;
+static sqInt genGetActiveContextNumArgslargeinBlock(sqInt numArgs, sqInt isLargeContext, sqInt isInBlock) NoDbgRegParms;
 static sqInt genGetClassIndexOfNonImminto(sqInt sourceReg, sqInt destReg) NoDbgRegParms;
 static sqInt genGetClassObjectOfClassIndexintoscratchReg(sqInt instReg, sqInt destReg, sqInt scratchReg) NoDbgRegParms;
 static sqInt genGetClassObjectOfintoscratchReginstRegIsReceiver(sqInt instReg, sqInt destReg, sqInt scratchReg, sqInt instRegIsReceiver) NoDbgRegParms;
@@ -701,6 +709,7 @@
 static sqInt genMethodAbortTrampolineFor(sqInt numArgs) NoDbgRegParms;
 static AbstractInstruction * genMulRR(AbstractInstruction * self_in_genMulRR, sqInt regSource, sqInt regDest) NoDbgRegParms;
 static sqInt genMustBeBooleanTrampolineForcalled(sqInt boolean, char *trampolineName) NoDbgRegParms;
+static sqInt genNewArrayOfSizeinitialized(sqInt size, sqInt initialized) NoDbgRegParms;
 static sqInt genNonLocalReturnTrampoline(void);
 static sqInt genPassConstasArgument(AbstractInstruction * self_in_genPassConstasArgument, sqInt constant, sqInt zeroRelativeArgIndex) NoDbgRegParms;
 static sqInt genPassRegasArgument(AbstractInstruction * self_in_genPassRegasArgument, sqInt abstractRegister, sqInt zeroRelativeArgIndex) NoDbgRegParms;
@@ -793,6 +802,7 @@
 static sqInt genReturnTopFromBlock(void);
 static sqInt genReturnTopFromMethod(void);
 static sqInt genReturnTrue(void);
+static sqInt genSafeTrampolineForcalled(void *aRoutine, char *aString) NoDbgRegParms;
 static sqInt genSafeTrampolineForcalledarg(void *aRoutine, char *aString, sqInt regOrConst0) NoDbgRegParms;
 static sqInt genSafeTrampolineForcalledargarg(void *aRoutine, char *aString, sqInt regOrConst0, sqInt regOrConst1) NoDbgRegParms;
 static sqInt genSaveRegisters(AbstractInstruction * self_in_genSaveRegisters) NoDbgRegParms;
@@ -847,6 +857,7 @@
 static AbstractInstruction * genoperand(sqInt opcode, sqInt operand) NoDbgRegParms;
 static AbstractInstruction * genoperandoperand(sqInt opcode, sqInt operandOne, sqInt operandTwo) NoDbgRegParms;
 static AbstractInstruction * genoperandoperandoperand(sqInt opcode, sqInt operandOne, sqInt operandTwo, sqInt operandThree) NoDbgRegParms;
+static sqInt getActiveContextAllocatesInMachineCode(void);
 static AbstractInstruction * getInlineCacheClassTagFrominto(sqInt sourceReg, sqInt destReg) NoDbgRegParms;
 static AbstractInstruction * getJmpTarget(AbstractInstruction * self_in_getJmpTarget) NoDbgRegParms;
 static sqInt getLiteral(sqInt litIndex) NoDbgRegParms;
@@ -914,6 +925,7 @@
 static sqInt literalBeforeFollowingAddress(AbstractInstruction * self_in_literalBeforeFollowingAddress, sqInt followingAddress) NoDbgRegParms;
 static sqInt liveRegisters(void);
 static sqInt loadLiteralByteSize(AbstractInstruction * self_in_loadLiteralByteSize) NoDbgRegParms;
+static sqInt log2BytesPerWord(void);
 static AbstractInstruction * longJumpTargetAddress(AbstractInstruction * self_in_longJumpTargetAddress) NoDbgRegParms;
 static AbstractInstruction * gMoveAwR(sqInt address, sqInt reg) NoDbgRegParms;
 static AbstractInstruction * gMoveCwR(sqInt wordConstant, sqInt reg) NoDbgRegParms;
@@ -1051,6 +1063,7 @@
 static sqInt spanForCleanBlockStartingAt(sqInt startPC) NoDbgRegParms;
 static void ssAllocateCallReg(sqInt requiredReg) NoDbgRegParms;
 static void ssAllocateCallRegand(sqInt requiredReg1, sqInt requiredReg2) NoDbgRegParms;
+static void ssAllocateCallRegandand(sqInt requiredReg1, sqInt requiredReg2, sqInt requiredReg3) NoDbgRegParms;
 static void ssAllocateCallRegandandand(sqInt requiredReg1, sqInt requiredReg2, sqInt requiredReg3, sqInt requiredReg4) NoDbgRegParms;
 static sqInt ssAllocatePreferredReg(sqInt preferredReg) NoDbgRegParms;
 static void ssAllocateRequiredRegMaskupThrough(sqInt requiredRegsMask, sqInt stackPtr) NoDbgRegParms;
@@ -1105,6 +1118,7 @@
 static void voidYoungReferrersPostTenureAll(void);
 char * whereIsMaybeCodeThing(sqInt anOop);
 static AbstractInstruction * gXorCwR(sqInt wordConstant, sqInt reg) NoDbgRegParms;
+static void zeroOpcodeIndex(void);
 
 
 /*** Variables ***/
@@ -1131,7 +1145,6 @@
 void * CFramePointer;
 void * CStackPointer;
 static sqInt callerSavedRegMask;
-static sqInt ceActiveContextTrampoline;
 sqInt ceBaseFrameReturnTrampoline;
 sqInt ceCannotResumeTrampoline;
 void (*ceCaptureCStackPointers)(void);
@@ -1139,7 +1152,6 @@
 sqInt ceCheckForInterruptTrampoline;
 static sqInt ceClosureCopyTrampoline;
 static sqInt ceCPICMissTrampoline;
-static sqInt ceCreateNewArrayTrampoline;
 void (*ceEnter0ArgsPIC)(void);
 void (*ceEnter1ArgsPIC)(void);
 void (*ceEnter2ArgsPIC)(void);
@@ -1151,6 +1163,8 @@
 static sqInt ceFetchContextInstVarTrampoline;
 unsigned long (*ceGetSP)(void);
 static sqInt ceImplicitReceiverTrampoline;
+static sqInt ceLargeActiveContextInBlockTrampoline;
+static sqInt ceLargeActiveContextInMethodTrampoline;
 static sqInt ceMethodAbortTrampoline;
 static sqInt ceNonLocalReturnTrampoline;
 static sqInt cePICAbortTrampoline;
@@ -1160,6 +1174,9 @@
 sqInt ceReturnToInterpreterTrampoline;
 static sqInt ceSendMustBeBooleanAddFalseTrampoline;
 static sqInt ceSendMustBeBooleanAddTrueTrampoline;
+static sqInt ceSheduleScavengeTrampoline;
+static sqInt ceSmallActiveContextInBlockTrampoline;
+static sqInt ceSmallActiveContextInMethodTrampoline;
 static sqInt ceStoreCheckTrampoline;
 static sqInt ceStoreContextInstVarTrampoline;
 static sqInt ceTraceBlockActivationTrampoline;
@@ -2027,6 +2044,7 @@
 		annotations = (void *)((char *)fixups + fixupSize); \
 		opcodeIndex = labelCounter = annotationIndex = 0; \
 } while (0)
+#define backEnd() backEnd
 #define blockAlignment(self) 8
 #define blockStartAt(index) (&blockStarts[index])
 #define breakOnImplicitReceiver() (traceFlags & 64)
@@ -2035,7 +2053,6 @@
 #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline
 #define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline)
 #define ceCheckFeatures() ceCheckFeaturesFunction()
-#define cePositive32BitIntegerTrampoline() cePositive32BitIntegerTrampoline
 #define ceReturnToInterpreterPC() ((usqInt)ceReturnToInterpreterTrampoline)
 #define cFramePointerAddress() ((unsigned long)&CFramePointer)
 #define cPICNumCases stackCheckOffset
@@ -2055,6 +2072,7 @@
 #define limitZony() ((CogMethod *)mzFreeStart)
 #define maybeConstant(sse) ((sse)->constant)
 #define methodBytesFreedSinceLastCompaction() methodBytesFreedSinceLastCompaction
+#define methodZoneBase() methodZoneBase
 #define minCallAddress() minValidCallAddress
 #define nextOpenPIC methodObject
 #define nextOpenPICHack hack hack hack i.e. the getter macro does all the work
@@ -10887,26 +10905,22 @@
 }
 
 
-/*	Short-circuit the interpreter call if a frame is already married. */
+/*	Create a trampoline to answer the active context that will
+	answer it if a frame is already married, and create it otherwise.
+	Assume numArgs is in SendNumArgsReg and ClassReg is free. */
 
 static sqInt
-genActiveContextTrampoline(void)
+genActiveContextTrampolineLargeinBlockcalled(sqInt isLarge, sqInt isInBlock, sqInt aString)
 {
-    AbstractInstruction *jumpSingle;
+    sqInt startAddress;
 
-	opcodeIndex = 0;
-	/* begin MoveMw:r:R: */
-	genoperandoperandoperand(MoveMwrR, FoxMethod, FPReg, TempReg);
-	/* begin AndCq:R: */
-	genoperandoperand(AndCqR, MFMethodFlagHasContextFlag, TempReg);
-	/* begin JumpZero: */
-	jumpSingle = genoperand(JumpZero, ((sqInt)0));
-	/* begin MoveMw:r:R: */
-	genoperandoperandoperand(MoveMwrR, FoxThisContext, FPReg, ReceiverResultReg);
-	/* begin RetN: */
-	genoperand(RetN, 0);
-	jmpTarget(jumpSingle, gLabel());
-	return genTrampolineForcalledcallJumpBarnumArgsargargargargsaveRegsresultRegappendOpcodes(ceActiveContext, "ceActiveContextTrampoline", 1, 0, null, null, null, null, 0, ReceiverResultReg, 1);
+	startAddress = methodZoneBase();
+	zeroOpcodeIndex();
+	genGetActiveContextLargeinBlock(isLarge, isInBlock);
+	outputInstructionsForGeneratedRuntimeAt(startAddress);
+	recordGeneratedRunTimeaddress(aString, startAddress);
+	recordRunTimeObjectReferences();
+	return startAddress;
 }
 
 static sqInt
@@ -12388,6 +12402,11 @@
 generateObjectRepresentationTrampolines(void)
 {
 	ceStoreCheckTrampoline = genTrampolineForcalledargresult(ceStoreCheck, "ceStoreCheckTrampoline", ReceiverResultReg, returnRegForStoreCheck());
+	ceSheduleScavengeTrampoline = genSafeTrampolineForcalled(ceSheduleScavenge, "ceSheduleScavengeTrampoline");
+	ceSmallActiveContextInMethodTrampoline = genActiveContextTrampolineLargeinBlockcalled(0, 0, "ceSmallMethodContext");
+	ceSmallActiveContextInBlockTrampoline = genActiveContextTrampolineLargeinBlockcalled(0, 1, "ceSmallBlockContext");
+	ceLargeActiveContextInMethodTrampoline = genActiveContextTrampolineLargeinBlockcalled(1, 0, "ceLargeMethodContext");
+	ceLargeActiveContextInBlockTrampoline = genActiveContextTrampolineLargeinBlockcalled(1, 1, "ceLargeBlockContext");
 }
 
 
@@ -12426,17 +12445,14 @@
 	ceSendMustBeBooleanAddFalseTrampoline = genMustBeBooleanTrampolineForcalled(falseObject(), "ceSendMustBeBooleanAddFalseTrampoline");
 	ceSendMustBeBooleanAddTrueTrampoline = genMustBeBooleanTrampolineForcalled(trueObject(), "ceSendMustBeBooleanAddTrueTrampoline");
 	ceClosureCopyTrampoline = genTrampolineForcalledargresult(ceClosureCopyDescriptor, "ceClosureCopyTrampoline", SendNumArgsReg, ReceiverResultReg);
-	ceActiveContextTrampoline = genActiveContextTrampoline();
 	ceNonLocalReturnTrampoline = genNonLocalReturnTrampoline();
 	ceBaseFrameReturnTrampoline = genTrampolineForcalledarg(ceBaseFrameReturn, "ceBaseFrameReturnTrampoline", ReceiverResultReg);
-	ceCreateNewArrayTrampoline = genTrampolineForcalledargresult(ceNewArraySlotSize, "ceCreateNewArrayTrampoline", SendNumArgsReg, ReceiverResultReg);
 	ceCheckForInterruptTrampoline = genCheckForInterruptsTrampoline();
 	ceFetchContextInstVarTrampoline = genTrampolineForcalledargargresult(ceContextinstVar, "ceFetchContextInstVarTrampoline", ReceiverResultReg, SendNumArgsReg, SendNumArgsReg);
 
 	/* to keep ReceiverResultReg live. */
 
 	ceStoreContextInstVarTrampoline = genTrampolineForcalledargargargresult(ceContextinstVarvalue, "ceStoreContextInstVarTrampoline", ReceiverResultReg, SendNumArgsReg, ClassReg, ReceiverResultReg);
-	cePositive32BitIntegerTrampoline = genTrampolineForcalledargresult(cePositive32BitIntegerFor, "cePositive32BitIntegerTrampoline", ReceiverResultReg, TempReg);
 	ceReturnToInterpreterTrampoline = genTrampolineForcalledarg(ceReturnToInterpreter, "ceReturnToInterpreterTrampoline", ReceiverResultReg);
 	ceCannotResumeTrampoline = genTrampolineForcalled(ceCannotResume, "ceCannotResumeTrampoline");
 }
@@ -12521,7 +12537,7 @@
     sqInt selector;
 
 	methodZoneStart = methodZoneBase;
-	allocateOpcodesbytecodes(42, 0);
+	allocateOpcodesbytecodes(72, 0);
 	initialPC = 0;
 	endPC = numAbstractOpcodes - 1;
 	hasYoungReferent = 0;
@@ -12667,6 +12683,210 @@
 }
 
 
+/*	Create a trampoline to answer the active context that will
+	answer it if a frame is already married, and create it otherwise.
+	Assume numArgs is in SendNumArgsReg and ClassReg is free. */
+
+static sqInt
+genGetActiveContextLargeinBlock(sqInt isLarge, sqInt isInBlock)
+{
+    sqInt address;
+    sqInt address1;
+    AbstractInstruction *continuation;
+    AbstractInstruction *exit;
+    usqLong header;
+    AbstractInstruction *jumpNeedScavenge;
+    AbstractInstruction *jumpSingle;
+    AbstractInstruction *loopHead;
+    sqInt offset;
+    sqInt quickConstant;
+    sqInt quickConstant1;
+    sqInt quickConstant2;
+    sqInt quickConstant3;
+    sqInt slotSize;
+    sqInt wordConstant;
+
+	/* begin MoveMw:r:R: */
+	genoperandoperandoperand(MoveMwrR, FoxMethod, FPReg, TempReg);
+	/* begin MoveR:R: */
+	genoperandoperand(MoveRR, TempReg, ClassReg);
+	/* begin AndCq:R: */
+	genoperandoperand(AndCqR, MFMethodFlagHasContextFlag, TempReg);
+	/* begin JumpZero: */
+	jumpSingle = genoperand(JumpZero, ((sqInt)0));
+	/* begin MoveMw:r:R: */
+	genoperandoperandoperand(MoveMwrR, FoxThisContext, FPReg, ReceiverResultReg);
+	/* begin RetN: */
+	genoperand(RetN, 0);
+	jmpTarget(jumpSingle, gLabel());
+	/* begin OrCq:R: */
+	genoperandoperand(OrCqR, MFMethodFlagHasContextFlag, ClassReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, ClassReg, FoxMethod, FPReg);
+	if (isInBlock) {
+		/* begin SubCq:R: */
+		genoperandoperand(SubCqR, 3, ClassReg);
+		/* begin MoveM16:r:R: */
+		genoperandoperandoperand(MoveM16rR, 0, ClassReg, TempReg);
+		/* begin SubR:R: */
+		genoperandoperand(SubRR, TempReg, ClassReg);
+	}
+	else {
+		/* begin SubCq:R: */
+		genoperandoperand(SubCqR, 1, ClassReg);
+	}
+	slotSize = (isLarge
+		? LargeContextSlots
+		: SmallContextSlots);
+	header = headerForSlotsformatclassIndex(slotSize, indexablePointersFormat(), ClassMethodContextCompactIndex);
+	flag("endianness");
+	/* 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 JumpGreaterOrEqual: */
+	jumpNeedScavenge = genoperand(JumpGreaterOrEqual, ((sqInt)0));
+	/* begin MoveR:R: */
+	continuation = genoperandoperand(MoveRR, FPReg, TempReg);
+	genSetSmallIntegerTagsIn(TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (SenderIndex * BytesPerOop), ReceiverResultReg);
+	/* begin MoveMw:r:R: */
+	genoperandoperandoperand(MoveMwrR, FoxSavedFP, FPReg, TempReg);
+	genSetSmallIntegerTagsIn(TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (InstructionPointerIndex * BytesPerOop), ReceiverResultReg);
+	/* begin MoveMw:r:R: */
+	offset = offsetof(CogMethod, methodObject);
+	genoperandoperandoperand(MoveMwrR, offset, ClassReg, TempReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (MethodIndex * BytesPerWord), ReceiverResultReg);
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, ReceiverResultReg, FoxThisContext, FPReg);
+	/* begin MoveR:R: */
+	genoperandoperand(MoveRR, FPReg, TempReg);
+	/* begin SubR:R: */
+	genoperandoperand(SubRR, SPReg, TempReg);
+	/* begin LogicalShiftRightCq:R: */
+	quickConstant2 = log2BytesPerWord();
+	genoperandoperand(LogicalShiftRightCqR, quickConstant2, TempReg);
+	/* begin SubCq:R: */
+	quickConstant3 = 4;
+	genoperandoperand(SubCqR, quickConstant3, TempReg);
+	/* begin AddR:R: */
+	genoperandoperand(AddRR, SendNumArgsReg, TempReg);
+	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);
+		/* begin AddCq:R: */
+		genoperandoperand(AddCqR, 2, TempReg);
+		/* begin MoveXwr:R:R: */
+		genoperandoperandoperand(MoveXwrRR, TempReg, FPReg, TempReg);
+	}
+	else {
+		/* begin MoveCw:R: */
+		wordConstant = nilObject();
+		genoperandoperand(MoveCwR, wordConstant, TempReg);
+	}
+	/* begin MoveR:Mw:r: */
+	genoperandoperandoperand(MoveRMwr, TempReg, BaseHeaderSize + (ClosureIndex * BytesPerWord), ReceiverResultReg);
+	/* begin CmpR:R: */
+	loopHead = genoperandoperand(CmpRR, ClassReg, SendNumArgsReg);
+	/* begin JumpGreaterOrEqual: */
+	exit = genoperand(JumpGreaterOrEqual, ((sqInt)0));
+	/* begin MoveR:R: */
+	genoperandoperand(MoveRR, SendNumArgsReg, TempReg);
+	/* begin SubR:R: */
+	genoperandoperand(SubRR, ClassReg, TempReg);
+	/* begin MoveXwr:R:R: */
+	genoperandoperandoperand(MoveXwrRR, TempReg, FPReg, TempReg);
+	/* begin AddCq:R: */
+	genoperandoperand(AddCqR, ReceiverIndex, ClassReg);
+	/* begin MoveR:Xwr:R: */
+	genoperandoperandoperand(MoveRXwrR, TempReg, ClassReg, ReceiverResultReg);
+	/* begin SubCq:R: */
+	genoperandoperand(SubCqR, ReceiverIndex - 1, ClassReg);
+	/* begin Jump: */
+	genoperand(Jump, ((sqInt)loopHead));
+	jmpTarget(exit, gLabel());
+	/* begin MoveR:R: */
+	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);
+	/* begin SubCq:R: */
+	loopHead = genoperandoperand(SubCqR, BytesPerWord, ClassReg);
+	/* begin CmpR:R: */
+	genoperandoperand(CmpRR, SPReg, ClassReg);
+	exit = (/* begin JumpLess: */
+	genoperand(JumpLess, ((sqInt)0)));
+	/* begin MoveMw:r:R: */
+	genoperandoperandoperand(MoveMwrR, 0, ClassReg, TempReg);
+	/* begin MoveR:Xwr:R: */
+	genoperandoperandoperand(MoveRXwrR, TempReg, SendNumArgsReg, ReceiverResultReg);
+	/* begin AddCq:R: */
+	genoperandoperand(AddCqR, 1, SendNumArgsReg);
+	/* begin Jump: */
+	genoperand(Jump, ((sqInt)loopHead));
+	jmpTarget(exit, gLabel());
+	/* begin RetN: */
+	genoperand(RetN, 0);
+	jmpTarget(jumpNeedScavenge, CallRT(ceSheduleScavengeTrampoline));
+	/* begin Jump: */
+	genoperand(Jump, ((sqInt)continuation));
+	return 0;
+}
+
+
+/*	Get the active context into ReceiverResultReg, creating it if necessary. */
+
+static sqInt
+genGetActiveContextNumArgslargeinBlock(sqInt numArgs, sqInt isLargeContext, sqInt isInBlock)
+{
+    sqInt routine;
+
+	routine = (isLargeContext
+		? (isInBlock
+				? ceLargeActiveContextInBlockTrampoline
+				: ceLargeActiveContextInMethodTrampoline)
+		: (isInBlock
+				? ceSmallActiveContextInBlockTrampoline
+				: ceSmallActiveContextInMethodTrampoline));
+	/* begin MoveCq:R: */
+	genoperandoperand(MoveCqR, numArgs, SendNumArgsReg);
+	CallRT(routine);
+	return 0;
+}
+
+
 /*	Fetch the instance's class index into destReg. */
 
 static sqInt
@@ -15077,7 +15297,67 @@
 	return genTrampolineForcalledcallJumpBarnumArgsargargargargsaveRegsresultRegappendOpcodes(ceSendMustBeBoolean, trampolineName, 1, 1, TempReg, null, null, null, 0, null, 1);
 }
 
+
+/*	Generate a call to code that allocates a new Array of size.
+	The Array should be initialized with nils iff initialized is true.
+	The size arg is passed in SendNumArgsReg, the result
+	must come back in ReceiverResultReg. */
+
 static sqInt
+genNewArrayOfSizeinitialized(sqInt size, sqInt initialized)
+{
+    sqInt address;
+    sqInt address1;
+    usqLong header;
+    sqInt i;
+    sqInt quickConstant;
+    sqInt quickConstant1;
+    AbstractInstruction *skip;
+    sqInt wordConstant;
+
+	assert(size < (numSlotsMask()));
+	header = headerForSlotsformatclassIndex(size, arrayFormat(), ClassArrayCompactIndex);
+	flag("endianness");
+	/* 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);
+	if (initialized
+	 && (size > 0)) {
+		/* begin MoveCw:R: */
+		wordConstant = nilObject();
+		genoperandoperand(MoveCwR, wordConstant, TempReg);
+		for (i = 1; i <= size; i += 1) {
+			/* begin MoveR:Mw:r: */
+			genoperandoperandoperand(MoveRMwr, TempReg, (i * 4) + 4, ReceiverResultReg);
+		}
+	}
+	/* begin MoveR:R: */
+	genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
+	/* begin AddCq:R: */
+	quickConstant = smallObjectBytesForSlots(size);
+	genoperandoperand(AddCqR, quickConstant, TempReg);
+	/* begin MoveR:Aw: */
+	address1 = freeStartAddress();
+	genoperandoperand(MoveRAw, TempReg, address1);
+	/* begin CmpCq:R: */
+	quickConstant1 = getScavengeThreshold();
+	genoperandoperand(CmpCqR, quickConstant1, TempReg);
+	/* begin JumpLess: */
+	skip = genoperand(JumpLess, ((sqInt)0));
+	CallRT(ceSheduleScavengeTrampoline);
+	jmpTarget(skip, gLabel());
+	return 0;
+}
+
+static sqInt
 genNonLocalReturnTrampoline(void)
 {
     sqInt address;
@@ -16065,8 +16345,9 @@
 {
 	assert(needsFrame);
 	(optStatus.isReceiverResultRegLive = 0);
-	ssAllocateCallReg(ReceiverResultReg);
-	CallRT(ceActiveContextTrampoline);
+	ssAllocateCallRegandand(ReceiverResultReg, SendNumArgsReg, ClassReg);
+
+	genGetActiveContextNumArgslargeinBlock(methodOrBlockNumArgs, methodNeedsLargeContext(methodObj), inBlock);
 	return ssPushRegister(ReceiverResultReg);
 }
 
@@ -16287,9 +16568,7 @@
 		ssAllocateCallRegand(SendNumArgsReg, ReceiverResultReg);
 	}
 	size = byte1 & 0x7F;
-	/* begin MoveCq:R: */
-	genoperandoperand(MoveCqR, size, SendNumArgsReg);
-	CallRT(ceCreateNewArrayTrampoline);
+	genNewArrayOfSizeinitialized(size, !popValues);
 	if (popValues) {
 		for (i = (size - 1); i >= 0; i += -1) {
 			/* begin PopR: */
@@ -16668,6 +16947,16 @@
 }
 
 
+/*	Generate a trampoline with no arguments that will
+	save and restore all registers around the call */
+
+static sqInt
+genSafeTrampolineForcalled(void *aRoutine, char *aString)
+{
+	return genTrampolineForcalledcallJumpBarnumArgsargargargargsaveRegsresultRegappendOpcodes(aRoutine, aString, 1, 0, null, null, null, null, 1, null, 0);
+}
+
+
 /*	Generate a trampoline with one argument that will
 	save and restore all registers around the call */
 
@@ -17959,6 +18248,18 @@
 }
 
 
+/*	Make sure SendNumArgsReg and ClassReg are available in addition to
+	ReceiverResultReg and TempReg in
+	genGetActiveContextNumArgs:large:inBlock:. 
+ */
+
+static sqInt
+getActiveContextAllocatesInMachineCode(void)
+{
+	return 1;
+}
+
+
 /*	Extract the inline cache tag for the object in sourceReg into destReg. The
 	inline cache tag for a given object is the value loaded in inline caches
 	to distinguish
@@ -19002,7 +19303,13 @@
 	return 5;
 }
 
+static sqInt
+log2BytesPerWord(void)
+{
+	return 2;
+}
 
+
 /*	Since it's an extraction from other methods. */
 /*	This needs to be digfferent from jumpTargetAddress because long jumps can
 	be to absolute addresses and hence we can't assert that the jump target is
@@ -22104,6 +22411,12 @@
 }
 
 static void
+ssAllocateCallRegandand(sqInt requiredReg1, sqInt requiredReg2, sqInt requiredReg3)
+{
+	ssAllocateRequiredRegMaskupThrough(callerSavedRegMask | ((registerMaskFor(requiredReg1)) | ((registerMaskFor(requiredReg2)) | (registerMaskFor(requiredReg3)))), simStackPtr);
+}
+
+static void
 ssAllocateCallRegandandand(sqInt requiredReg1, sqInt requiredReg2, sqInt requiredReg3, sqInt requiredReg4)
 {
 	ssAllocateRequiredRegMaskupThrough(callerSavedRegMask | ((registerMaskFor(requiredReg1)) | ((registerMaskFor(requiredReg2)) | ((registerMaskFor(requiredReg3)) | (registerMaskFor(requiredReg4))))), simStackPtr);
@@ -23324,3 +23637,14 @@
 {
 	return genoperandoperand(XorCwR, wordConstant, reg);
 }
+
+
+/*	Access for the object representations when they need to prepend code to
+	trampolines. 
+ */
+
+static void
+zeroOpcodeIndex(void)
+{
+	opcodeIndex = 0;
+}

Modified: branches/Cog/nsspursrc/vm/cogit.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.h	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/nsspursrc/vm/cogit.h	2014-06-01 05:32:34 UTC (rev 2935)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CCodeGenerator VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
  */
 
 

Modified: branches/Cog/nsspursrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogmethod.h	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/nsspursrc/vm/cogmethod.h	2014-06-01 05:32:34 UTC (rev 2935)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CCodeGenerator VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
  */
 
 typedef struct {

Modified: branches/Cog/nsspursrc/vm/cointerp.c
===================================================================
--- branches/Cog/nsspursrc/vm/cointerp.c	2014-05-30 23:24:03 UTC (rev 2934)
+++ branches/Cog/nsspursrc/vm/cointerp.c	2014-06-01 05:32:34 UTC (rev 2935)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
    from
-	CoInterpreter VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1
+	CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.735 uuid: ee13367a-8346-4ce8-a124-276cba680fc1 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -457,6 +457,7 @@
 sqInt ceSendFromInLineCacheMiss(CogMethod *cogMethodOrPIC);
 sqInt ceSendMustBeBoolean(sqInt anObject);

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list