[Vm-dev] [commit][3571] CogVM source as per VMMaker.oscog-eem.1668

commits at squeakvm.org commits at squeakvm.org
Mon Jan 25 03:02:32 UTC 2016


Revision: 3571
Author:   eliot
Date:     2016-01-24 19:02:30 -0800 (Sun, 24 Jan 2016)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.1668

General:
Add vmParameter 20 (stolen from ikp's JITTER, forgive me Ian) to answer the
utc microseconds at startup.  Require ioUTCStartMicroseconds from the platform.

StackInterpreter: Don't eneter an object into the atCache if it is 16-bit
indexable (this is easier, or rather likely more efficient for non-16-bit
access, than implementing 16-bit indexability in the atCache).

Spur: Fix start up of images containing >= 16 segments.  The old code assumed
numSegments < 16 and failed to grow the segment records, resulting in objects
in segments not entered into the segments to not be swizzled.

Add a free space mode to the leak checked to help track down the Newspeak image
startup crashes we've seen recently at Cadence.  So checkFreeSpace is
refactored to checkFreeSpace: gcMode.

Insist on inlining objectAfter:limit:.  Never inline prepareForSnapshot or
writeImageFileIO (for C-level debugging).

Spur Cogit: Support CompiledMethod indexing in genPrimitiveAt[Put].  Hence fix
the regression in at:[put:] wherreby in Spur one could access the literals part
of a method as bytes. Refactor to pull-out the num-literals access from
genPrimitiveObjectAt.

CoInterpreter: Remove the atCache from the CoInterpreter.  It's of little
benefit given the Cogit.

Modified Paths:
--------------
    branches/Cog/nsspur64src/vm/cogit.h
    branches/Cog/nsspur64src/vm/cogitX64.c
    branches/Cog/nsspur64src/vm/cointerp.c
    branches/Cog/nsspur64src/vm/cointerp.h
    branches/Cog/nsspur64src/vm/gcc3x-cointerp.c
    branches/Cog/nsspursrc/vm/cogit.h
    branches/Cog/nsspursrc/vm/cogitARMv5.c
    branches/Cog/nsspursrc/vm/cogitIA32.c
    branches/Cog/nsspursrc/vm/cogitMIPSEL.c
    branches/Cog/nsspursrc/vm/cointerp.c
    branches/Cog/nsspursrc/vm/cointerp.h
    branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
    branches/Cog/nsspurstack64src/vm/gcc3x-interp.c
    branches/Cog/nsspurstack64src/vm/interp.c
    branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c
    branches/Cog/nsspurstacksrc/vm/interp.c
    branches/Cog/platforms/Cross/vm/sq.h
    branches/Cog/platforms/Mac OS/vm/sqMacMain.c
    branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m
    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/spur64src/vm/cogit.h
    branches/Cog/spur64src/vm/cogitX64.c
    branches/Cog/spur64src/vm/cointerp.c
    branches/Cog/spur64src/vm/cointerp.h
    branches/Cog/spur64src/vm/gcc3x-cointerp.c
    branches/Cog/spursistasrc/vm/cogit.h
    branches/Cog/spursistasrc/vm/cogitARMv5.c
    branches/Cog/spursistasrc/vm/cogitIA32.c
    branches/Cog/spursistasrc/vm/cogitMIPSEL.c
    branches/Cog/spursistasrc/vm/cointerp.c
    branches/Cog/spursistasrc/vm/cointerp.h
    branches/Cog/spursistasrc/vm/gcc3x-cointerp.c
    branches/Cog/spursrc/vm/cogit.h
    branches/Cog/spursrc/vm/cogitARMv5.c
    branches/Cog/spursrc/vm/cogitIA32.c
    branches/Cog/spursrc/vm/cogitMIPSEL.c
    branches/Cog/spursrc/vm/cointerp.c
    branches/Cog/spursrc/vm/cointerp.h
    branches/Cog/spursrc/vm/gcc3x-cointerp.c
    branches/Cog/spurstack64src/vm/gcc3x-interp.c
    branches/Cog/spurstack64src/vm/interp.c
    branches/Cog/spurstacksrc/vm/gcc3x-interp.c
    branches/Cog/spurstacksrc/vm/interp.c
    branches/Cog/src/vm/cogit.h
    branches/Cog/src/vm/cogitARMv5.c
    branches/Cog/src/vm/cogitIA32.c
    branches/Cog/src/vm/cogitMIPSEL.c
    branches/Cog/src/vm/cointerp.c
    branches/Cog/src/vm/cointerp.h
    branches/Cog/src/vm/cointerpmt.c
    branches/Cog/src/vm/cointerpmt.h
    branches/Cog/src/vm/gcc3x-cointerp.c
    branches/Cog/src/vm/gcc3x-cointerpmt.c
    branches/Cog/stacksrc/vm/gcc3x-interp.c
    branches/Cog/stacksrc/vm/interp.c

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

Modified: branches/Cog/nsspur64src/vm/cogit.h
===================================================================
--- branches/Cog/nsspur64src/vm/cogit.h	2016-01-25 01:07:09 UTC (rev 3570)
+++ branches/Cog/nsspur64src/vm/cogit.h	2016-01-25 03:02:30 UTC (rev 3571)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1664 uuid: 9e676eea-f638-4da0-bd70-920a096bda28
+	CCodeGenerator VMMaker.oscog-eem.1668 uuid: 1f0b27be-e423-42d3-a18d-1c7e292a4f14
  */
 
 

Modified: branches/Cog/nsspur64src/vm/cogitX64.c
===================================================================
--- branches/Cog/nsspur64src/vm/cogitX64.c	2016-01-25 01:07:09 UTC (rev 3570)
+++ branches/Cog/nsspur64src/vm/cogitX64.c	2016-01-25 03:02:30 UTC (rev 3571)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1663 uuid: a07a8c3d-4a04-48fc-bed8-f189f0494d6d
+	CCodeGenerator VMMaker.oscog-eem.1668 uuid: 1f0b27be-e423-42d3-a18d-1c7e292a4f14
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.1663 uuid: a07a8c3d-4a04-48fc-bed8-f189f0494d6d
+	StackToRegisterMappingCogit VMMaker.oscog-eem.1668 uuid: 1f0b27be-e423-42d3-a18d-1c7e292a4f14
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1663 uuid: a07a8c3d-4a04-48fc-bed8-f189f0494d6d " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1668 uuid: 1f0b27be-e423-42d3-a18d-1c7e292a4f14 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -701,6 +701,7 @@
 static sqInt NoDbgRegParms checkValidObjectReference(sqInt anOop);
 static AbstractInstruction * NoDbgRegParms genCmpClassFloatCompactIndexR(sqInt reg);
 static AbstractInstruction * NoDbgRegParms genCmpClassMethodContextCompactIndexR(sqInt reg);
+static sqInt NoDbgRegParms genGetMethodHeaderOfintoscratch(sqInt methodReg, sqInt headerReg, sqInt scratchReg);
 static sqInt NoDbgRegParms genLoadSlotsourceRegdestReg(sqInt index, sqInt sourceReg, sqInt destReg);
 static sqInt genPrimitiveAdd(void);
 static sqInt genPrimitiveAsFloat(void);
@@ -783,6 +784,7 @@
 static sqInt genPrimitiveStringAtPut(void);
 static sqInt NoDbgRegParms genRemoveSmallIntegerTagsInScratchReg(sqInt scratchReg);
 static sqInt NoDbgRegParms genShiftAwaySmallIntegerTagsInScratchReg(sqInt scratchReg);
+static sqInt NoDbgRegParms getLiteralCountOfplusOneinBytesintoscratch(sqInt methodReg, sqInt plusOne, sqInt inBytes, sqInt litCountReg, sqInt scratchReg);
 static sqInt NoDbgRegParms inlineCacheTagForInstance(sqInt oop);
 static sqInt log2BytesPerWord(void);
 static void maybeGenerateSelectorIndexDereferenceRoutine(void);
@@ -4194,7 +4196,6 @@
 		if ((((sqInt)cogMethod)) == InsufficientCodeSpace) {
 			callForCogCompiledCodeCompaction();
 		}
-		/* begin maybeFreeCounters */
 		return null;
 	}
 	return cogMethod;
@@ -4680,7 +4681,6 @@
     sqInt i;
     sqInt relativeAddress;
 
-	/* begin dumpLiterals: */
 	relativeAddress = 0;
 	for (i = 0; i < opcodeIndex; i += 1) {
 		abstractInstruction = abstractInstructionAt(i);
@@ -5750,7 +5750,6 @@
 	genoperand(JumpLong, jumpTarget2);
 	/* begin Label */
 	cPICEndOfCodeLabel = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
-	/* begin dumpLiterals: */
 	computeMaximumSizes();
 	cPIC = ((CogMethod *) methodZoneBase);
 	closedPICSize = (sizeof(CogMethod)) + (generateInstructionsAt(methodZoneBase + (sizeof(CogMethod))));
@@ -5877,12 +5876,12 @@
 generateMapAtstart(sqInt addressOrNull, sqInt startAddress)
 {
     unsigned char annotation;
-    sqInt delta;
+    usqInt delta;
     sqInt i;
     AbstractInstruction *instruction;
     sqInt length;
-    sqInt location;
-    sqInt mapEntry;
+    usqInt location;
+    usqInt mapEntry;
     sqInt maxDelta;
     usqInt mcpc;
 
@@ -5892,7 +5891,6 @@
 		instruction = abstractInstructionAt(i);
 		annotation = (instruction->annotation);
 		if (!(annotation == null)) {
-			/* begin assertValidAnnotation:for: */
 			mcpc = ((instruction->address)) + ((instruction->machineCodeSize));
 			while (((delta = (mcpc - location) / 1)) > DisplacementMask) {
 				maxDelta = (((((delta < MaxX2NDisplacement) ? delta : MaxX2NDisplacement)) | DisplacementMask) - DisplacementMask);
@@ -6702,8 +6700,7 @@
 	callerSavedRegMask = callerSavedRegisterMask(backEnd);
 	assert(((registerMaskFor(VarBaseReg)) & callerSavedRegMask) == 0);
 
-	/* begin allocateLiterals: */
-	}
+}
 
 	/* Cogit>>#initializeCodeZoneFrom:upTo: */
 void
@@ -10043,7 +10040,6 @@
 zeroOpcodeIndex(void)
 {
 	opcodeIndex = 0;
-	/* begin resetLiterals */
 }
 
 	/* CogMethodZone>>#addAllToYoungReferrers */
@@ -10307,7 +10303,6 @@
 			removeFromUnpairedMethodList(cogMethod);
 
 		}
-		/* begin maybeFreeCountersOf: */
 	}
 	if (((cogMethod->cmType)) == CMOpenPIC) {
 		removeFromOpenPICList(cogMethod);
@@ -10850,6 +10845,30 @@
 	return anInstruction;
 }
 
+
+/*	Get the method header (first word) of a CompiledMethod into headerReg.
+	Deal with the method possibly being cogged. */
+
+	/* CogObjectRepresentation>>#genGetMethodHeaderOf:into:scratch: */
+static sqInt NoDbgRegParms
+genGetMethodHeaderOfintoscratch(sqInt methodReg, sqInt headerReg, sqInt scratchReg)
+{
+    AbstractInstruction *anInstruction;
+    AbstractInstruction *anInstruction1;
+    AbstractInstruction *jumpNotCogged;
+    sqInt offset;
+
+	/* begin MoveMw:r:R: */
+	anInstruction = genoperandoperandoperand(MoveMwrR, BaseHeaderSize, methodReg, headerReg);
+	jumpNotCogged = genJumpSmallIntegerscratchReg(headerReg, scratchReg);
+	/* begin MoveMw:r:R: */
+	offset = offsetof(CogMethod, methodHeader);
+	/* begin gen:quickConstant:operand:operand: */
+	anInstruction1 = genoperandoperandoperand(MoveMwrR, offset, headerReg, headerReg);
+	jmpTarget(jumpNotCogged, gLabel());
+	return 0;
+}
+
 	/* CogObjectRepresentation>>#genLoadSlot:sourceReg:destReg: */
 static sqInt NoDbgRegParms
 genLoadSlotsourceRegdestReg(sqInt index, sqInt sourceReg, sqInt destReg)
@@ -12545,13 +12564,14 @@
     AbstractInstruction * jumpIsArray;
     AbstractInstruction *jumpIsBytes;
     AbstractInstruction *jumpIsContext;
+    AbstractInstruction *jumpIsMethod;
     AbstractInstruction *jumpIsShorts;
     AbstractInstruction * jumpIsWords;
     AbstractInstruction *jumpNotIndexable;
     AbstractInstruction *jumpShortsOutOfBounds;
     AbstractInstruction *jumpWordsOutOfBounds;
     sqInt literal;
-    sqInt literal1;
+    AbstractInstruction *methodInBounds;
     sqInt quickConstant;
     sqInt quickConstant1;
     sqInt quickConstant2;
@@ -12561,6 +12581,7 @@
     sqInt quickConstant6;
     sqInt quickConstant7;
     sqInt quickConstant8;
+    sqInt quickConstant9;
 
 	/* begin genLoadArgAtDepth:into: */
 	assert(0 < (numRegArgs()));
@@ -12608,19 +12629,37 @@
 	jmpTarget(jumpNotIndexable, gLabel());
 	/* begin Jump: */
 	jumpNotIndexable = genoperand(Jump, ((sqInt)0));
+	jmpTarget(jumpIsArray, gCmpRR(Arg1Reg, ClassReg));
+	/* begin JumpBelowOrEqual: */
+	jumpArrayOutOfBounds = genConditionalBranchoperand(JumpBelowOrEqual, ((sqInt)0));
+	/* begin AddCq:R: */
+	quickConstant5 = ((usqInt) BaseHeaderSize) >> (shiftForWord());
+	/* begin gen:quickConstant:operand: */
+	anInstruction6 = genoperandoperand(AddCqR, quickConstant5, Arg1Reg);
+	/* begin MoveXwr:R:R: */
+	genoperandoperandoperand(MoveXwrRR, Arg1Reg, ReceiverResultReg, ReceiverResultReg);
+	/* begin genPrimReturn */
+	assert(methodOrBlockNumArgs <= (numRegArgs()));
+	/* begin RetN: */
+	genoperand(RetN, 0);
 	jmpTarget(jumpIsBytes, gLogicalShiftLeftCqR(shiftForWord(), ClassReg));
-	/* begin AndCq:R: */
-	literal = BytesPerWord - 1;
-	anInstruction6 = genoperandoperand(AndCqR, BytesPerWord - 1, formatReg);
+	gAndCqRR(BytesPerWord - 1, formatReg, TempReg);
 	/* begin SubR:R: */
-	genoperandoperand(SubRR, formatReg, ClassReg);
+	genoperandoperand(SubRR, TempReg, ClassReg);
 	/* begin CmpR:R: */
 	genoperandoperand(CmpRR, Arg1Reg, ClassReg);
 	/* begin JumpBelowOrEqual: */
 	jumpBytesOutOfBounds = genConditionalBranchoperand(JumpBelowOrEqual, ((sqInt)0));
+	/* begin CmpCq:R: */
+	quickConstant6 = firstCompiledMethodFormat();
+	/* begin gen:quickConstant:operand: */
+	anInstruction7 = genoperandoperand(CmpCqR, quickConstant6, formatReg);
+	/* begin JumpAboveOrEqual: */
+	jumpIsMethod = genConditionalBranchoperand(JumpAboveOrEqual, ((sqInt)0));
 	/* begin AddCq:R: */
-	literal1 = BaseHeaderSize;
-	anInstruction7 = genoperandoperand(AddCqR, BaseHeaderSize, Arg1Reg);
+	literal = BaseHeaderSize;
+	anInstruction8 = genoperandoperand(AddCqR, BaseHeaderSize, Arg1Reg);
+	methodInBounds = anInstruction8;
 	
 	/* formatReg already contains a value <= 16r1f, so no need to zero it */
 	/* begin MoveXbr:R:R: */
@@ -12637,7 +12676,7 @@
 	genoperand(RetN, 0);
 	jmpTarget(jumpIsShorts, gLogicalShiftLeftCqR((shiftForWord()) - 1, ClassReg));
 	/* begin AndCq:R: */
-	anInstruction8 = genoperandoperand(AndCqR, 1, formatReg);
+	anInstruction9 = genoperandoperand(AndCqR, 1, formatReg);
 	/* begin SubR:R: */
 	genoperandoperand(SubRR, formatReg, ClassReg);
 	/* begin CmpR:R: */
@@ -12647,16 +12686,16 @@
 	/* begin AddR:R: */
 	genoperandoperand(AddRR, Arg1Reg, ReceiverResultReg);
 	/* begin MoveM16:r:R: */
-	anInstruction9 = genoperandoperandoperand(MoveM16rR, BaseHeaderSize, ReceiverResultReg, ReceiverResultReg);
+	anInstruction10 = genoperandoperandoperand(MoveM16rR, BaseHeaderSize, ReceiverResultReg, ReceiverResultReg);
 	/* begin Jump: */
 	genoperand(Jump, ((sqInt)convertToIntAndReturn));
 	jmpTarget(jumpIsWords, gCmpRR(Arg1Reg, ClassReg));
 	/* begin JumpBelowOrEqual: */
 	jumpWordsOutOfBounds = genConditionalBranchoperand(JumpBelowOrEqual, ((sqInt)0));
 	/* begin AddCq:R: */
-	quickConstant5 = ((usqInt) BaseHeaderSize) >> ((shiftForWord()) - 1);
+	quickConstant7 = ((usqInt) BaseHeaderSize) >> ((shiftForWord()) - 1);
 	/* begin gen:quickConstant:operand: */
-	anInstruction10 = genoperandoperand(AddCqR, quickConstant5, Arg1Reg);
+	anInstruction11 = genoperandoperand(AddCqR, quickConstant7, Arg1Reg);
 	/* begin MoveX32r:R:R: */
 	genoperandoperandoperand(MoveX32rRR, Arg1Reg, ReceiverResultReg, TempReg);
 	/* begin MoveR:R: */
@@ -12667,16 +12706,16 @@
 	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, TempReg, formatReg);
 	/* begin CmpCq:R: */
-	anInstruction11 = genoperandoperand(CmpCqR, ClassMethodContextCompactIndex, TempReg);
+	anInstruction12 = genoperandoperand(CmpCqR, ClassMethodContextCompactIndex, TempReg);
 	/* begin JumpZero: */
 	jumpIsContext = genConditionalBranchoperand(JumpZero, ((sqInt)0));
 	genGetClassObjectOfClassIndexintoscratchReg(formatReg, Scratch0Reg, TempReg);
 	genLoadSlotsourceRegdestReg(InstanceSpecificationIndex, Scratch0Reg, formatReg);
 	genConvertSmallIntegerToIntegerInReg(formatReg);
 	/* begin AndCq:R: */
-	quickConstant6 = fixedFieldsOfClassFormatMask();
+	quickConstant8 = fixedFieldsOfClassFormatMask();
 	/* begin gen:quickConstant:operand: */
-	anInstruction12 = genoperandoperand(AndCqR, quickConstant6, formatReg);
+	anInstruction13 = genoperandoperand(AndCqR, quickConstant8, formatReg);
 	/* begin SubR:R: */
 	genoperandoperand(SubRR, formatReg, ClassReg);
 	/* begin CmpR:R: */
@@ -12686,28 +12725,21 @@
 	/* begin AddR:R: */
 	genoperandoperand(AddRR, formatReg, Arg1Reg);
 	/* begin AddCq:R: */
-	quickConstant7 = ((usqInt) BaseHeaderSize) >> (shiftForWord());
+	quickConstant9 = ((usqInt) BaseHeaderSize) >> (shiftForWord());
 	/* begin gen:quickConstant:operand: */
-	anInstruction13 = genoperandoperand(AddCqR, quickConstant7, Arg1Reg);
+	anInstruction14 = genoperandoperand(AddCqR, quickConstant9, Arg1Reg);
 	/* begin MoveXwr:R:R: */
 	genoperandoperandoperand(MoveXwrRR, Arg1Reg, ReceiverResultReg, ReceiverResultReg);
 	/* begin genPrimReturn */
 	assert(methodOrBlockNumArgs <= (numRegArgs()));
 	/* begin RetN: */
 	genoperand(RetN, 0);
-	jmpTarget(jumpIsArray, gCmpRR(Arg1Reg, ClassReg));
-	/* begin JumpBelowOrEqual: */
-	jumpArrayOutOfBounds = genConditionalBranchoperand(JumpBelowOrEqual, ((sqInt)0));
-	/* begin AddCq:R: */
-	quickConstant8 = ((usqInt) BaseHeaderSize) >> (shiftForWord());
-	/* begin gen:quickConstant:operand: */
-	anInstruction14 = genoperandoperand(AddCqR, quickConstant8, Arg1Reg);
-	/* begin MoveXwr:R:R: */
-	genoperandoperandoperand(MoveXwrRR, Arg1Reg, ReceiverResultReg, ReceiverResultReg);
-	/* begin genPrimReturn */
-	assert(methodOrBlockNumArgs <= (numRegArgs()));
-	/* begin RetN: */
-	genoperand(RetN, 0);
+	jmpTarget(jumpIsMethod, gLabel());
+	getLiteralCountOfplusOneinBytesintoscratch(ReceiverResultReg, 1, 1, ClassReg, TempReg);
+	/* begin CmpR:R: */
+	genoperandoperand(CmpRR, Arg1Reg, ClassReg);
+	/* begin JumpBelow: */
+	genConditionalBranchoperand(JumpBelow, ((sqInt)methodInBounds));
 	jmpTarget(jumpFixedFieldsOutOfBounds, jmpTarget(jumpArrayOutOfBounds, jmpTarget(jumpBytesOutOfBounds, jmpTarget(jumpShortsOutOfBounds, jmpTarget(jumpWordsOutOfBounds, jmpTarget(jumpNotIndexable, jmpTarget(jumpIsContext, jmpTarget(jumpBadIndex, jmpTarget(jumpImmediate, gLabel())))))))));
 	return 0;
 }
@@ -12760,12 +12792,14 @@
     AbstractInstruction *jumpShortsOutOfRange;
     AbstractInstruction *jumpWordsOutOfBounds;
     AbstractInstruction *jumpWordsOutOfRange;
+    AbstractInstruction *methodInBounds;
     sqInt quickConstant;
     sqInt quickConstant1;
     sqInt quickConstant2;
     sqInt quickConstant3;
     sqInt quickConstant4;
     sqInt quickConstant5;
+    sqInt quickConstant6;
 
 	jumpImmutable = 0;
 	/* begin genLoadArgAtDepth:into: */
@@ -12848,9 +12882,7 @@
 	assert(methodOrBlockNumArgs <= (numRegArgs()));
 	/* begin RetN: */
 	genoperand(RetN, 0);
-	jmpTarget(jumpNotPointers, gCmpCqR(firstCompiledMethodFormat(), formatReg));
-	/* begin JumpAboveOrEqual: */
-	jumpIsCompiledMethod = genConditionalBranchoperand(JumpAboveOrEqual, ((sqInt)0));
+	jmpTarget(jumpNotPointers, gLabel());
 	jumpNonSmallIntegerValue = genJumpNotSmallIntegerscratchReg(Arg1Reg, TempReg);
 	/* begin CmpCq:R: */
 	quickConstant3 = firstByteFormat();
@@ -12902,16 +12934,21 @@
 	jumpBytesOutOfRange = genConditionalBranchoperand(JumpAbove, ((sqInt)0));
 	/* begin LogicalShiftLeftCq:R: */
 	genoperandoperand(LogicalShiftLeftCqR, shiftForWord(), ClassReg);
-	/* begin AndCq:R: */
-	anInstruction12 = genoperandoperand(AndCqR, BytesPerWord - 1, formatReg);
+	gAndCqRR(BytesPerWord - 1, formatReg, TempReg);
 	/* begin SubR:R: */
-	genoperandoperand(SubRR, formatReg, ClassReg);
+	genoperandoperand(SubRR, TempReg, ClassReg);
 	/* begin CmpR:R: */
 	genoperandoperand(CmpRR, Arg0Reg, ClassReg);
 	/* begin JumpBelowOrEqual: */
 	jumpBytesOutOfBounds = genConditionalBranchoperand(JumpBelowOrEqual, ((sqInt)0));
+	/* begin CmpCq:R: */
+	quickConstant6 = firstCompiledMethodFormat();
+	/* begin gen:quickConstant:operand: */
+	anInstruction12 = genoperandoperand(CmpCqR, quickConstant6, formatReg);
+	/* begin JumpAboveOrEqual: */
+	jumpIsCompiledMethod = genConditionalBranchoperand(JumpAboveOrEqual, ((sqInt)0));
 	/* begin MoveR:R: */
-	genoperandoperand(MoveRR, Arg1Reg, TempReg);
+	methodInBounds = genoperandoperand(MoveRR, Arg1Reg, TempReg);
 	genConvertSmallIntegerToIntegerInReg(TempReg);
 	/* begin AddCq:R: */
 	anInstruction13 = genoperandoperand(AddCqR, BaseHeaderSize, Arg0Reg);
@@ -12949,6 +12986,12 @@
 	assert(methodOrBlockNumArgs <= (numRegArgs()));
 	/* begin RetN: */
 	genoperand(RetN, 0);
+	jmpTarget(jumpIsCompiledMethod, gLabel());
+	getLiteralCountOfplusOneinBytesintoscratch(ReceiverResultReg, 1, 1, ClassReg, TempReg);
+	/* begin CmpR:R: */
+	genoperandoperand(CmpRR, Arg0Reg, ClassReg);
+	/* begin JumpBelow: */
+	genConditionalBranchoperand(JumpBelow, ((sqInt)methodInBounds));
 	jmpTarget(jumpIsContext, jmpTarget(jumpNotIndexableBits, jmpTarget(jumpBytesOutOfRange, jmpTarget(jumpShortsOutOfRange, jmpTarget(jumpWordsOutOfRange, jmpTarget(jumpIsCompiledMethod, jmpTarget(jumpArrayOutOfBounds, jmpTarget(jumpBytesOutOfBounds, jmpTarget(jumpShortsOutOfBounds, jmpTarget(jumpWordsOutOfBounds, jmpTarget(jumpNotIndexablePointers, jmpTarget(jumpNonSmallIntegerValue, jmpTarget(jumpFixedFieldsOutOfBounds, gLabel())))))))))))));
 	
 #  if IMMUTABILITY
@@ -14217,6 +14260,52 @@
 }
 
 
+/*	Get the literal count of a CompiledMethod into headerReg, plus one if
+	requested. If inBytes is true, scale the count by the word size. Deal with
+	the possibility of
+	the method being cogged. */
+
+	/* CogObjectRepresentationFor64BitSpur>>#getLiteralCountOf:plusOne:inBytes:into:scratch: */
+static sqInt NoDbgRegParms
+getLiteralCountOfplusOneinBytesintoscratch(sqInt methodReg, sqInt plusOne, sqInt inBytes, sqInt litCountReg, sqInt scratchReg)
+{
+    AbstractInstruction *anInstruction;
+    AbstractInstruction *anInstruction1;
+    AbstractInstruction *anInstruction2;
+    sqInt quickConstant;
+    sqInt quickConstant1;
+    sqInt quickConstant2;
+    sqInt quickConstant3;
+
+	genGetMethodHeaderOfintoscratch(methodReg, litCountReg, scratchReg);
+	assert((1LL << (numTagBits())) == BytesPerWord);
+	if (inBytes) {
+		/* begin AndCq:R: */
+		quickConstant = ((long)(alternateHeaderNumLiteralsMask())) << (numTagBits());
+		/* begin gen:quickConstant:operand: */
+		anInstruction = genoperandoperand(AndCqR, quickConstant, litCountReg);
+	}
+	else {
+		/* begin LogicalShiftRightCq:R: */
+		quickConstant1 = numTagBits();
+		genoperandoperand(LogicalShiftRightCqR, quickConstant1, litCountReg);
+		/* begin AndCq:R: */
+		quickConstant2 = alternateHeaderNumLiteralsMask();
+		/* begin gen:quickConstant:operand: */
+		anInstruction1 = genoperandoperand(AndCqR, quickConstant2, litCountReg);
+	}
+	if (plusOne) {
+		/* begin AddCq:R: */
+		quickConstant3 = (inBytes
+			? LiteralStart * BytesPerWord
+			: LiteralStart);
+		/* begin gen:quickConstant:operand: */
+		anInstruction2 = genoperandoperand(AddCqR, quickConstant3, litCountReg);
+	}
+	return 0;
+}
+
+
 /*	Answer the relevant inline cache tag for an instance.
 	c.f. getInlineCacheClassTagFrom:into: & inlineCacheTagForClass: */
 
@@ -15474,31 +15563,18 @@
     AbstractInstruction *anInstruction;
     AbstractInstruction *anInstruction1;
     AbstractInstruction *anInstruction2;
-    AbstractInstruction *anInstruction3;
-    sqInt destReg;
     sqInt headerReg;
     AbstractInstruction *jumpBadIndex;
     AbstractInstruction *jumpBounds;
-    AbstractInstruction *jumpNotCogMethod;
     AbstractInstruction *jumpNotHeaderIndex;
-    sqInt offset;
     sqInt quickConstant;
 
 	/* begin genLoadArgAtDepth:into: */
 	assert(0 < (numRegArgs()));
-
-	/* get header into Arg1Reg... */
 	jumpBadIndex = genJumpNotSmallIntegerscratchReg(Arg0Reg, TempReg);
-	/* begin MoveMw:r:R: */
-	destReg = (headerReg = Arg1Reg);
-	/* begin gen:quickConstant:operand:operand: */
-	anInstruction1 = genoperandoperandoperand(MoveMwrR, BaseHeaderSize, ReceiverResultReg, destReg);
-	jumpNotCogMethod = genJumpSmallIntegerscratchReg(headerReg, TempReg);
-	/* begin MoveMw:r:R: */
-	offset = offsetof(CogMethod, methodHeader);
-	/* begin gen:quickConstant:operand:operand: */
-	anInstruction2 = genoperandoperandoperand(MoveMwrR, offset, headerReg, headerReg);
-	jmpTarget(jumpNotCogMethod, gCmpCqR((((sqInt)1 << 3) | 1), Arg0Reg));
+	genGetMethodHeaderOfintoscratch(ReceiverResultReg, (headerReg = Arg1Reg), TempReg);
+	/* begin CmpCq:R: */
+	anInstruction = genoperandoperand(CmpCqR, (((sqInt)1 << 3) | 1), Arg0Reg);
 	/* begin JumpNonZero: */
 	jumpNotHeaderIndex = genConditionalBranchoperand(JumpNonZero, ((sqInt)0));
 	/* begin MoveR:R: */
@@ -15511,14 +15587,14 @@
 	/* begin SubCq:R: */
 	quickConstant = ((((sqInt)1 << 3) | 1)) - (smallIntegerTag());
 	/* begin gen:quickConstant:operand: */
-	anInstruction3 = genoperandoperand(SubCqR, quickConstant, Arg0Reg);
+	anInstruction2 = genoperandoperand(SubCqR, quickConstant, Arg0Reg);
 	/* begin CmpR:R: */
 	genoperandoperand(CmpRR, headerReg, Arg0Reg);
 	/* begin JumpAbove: */
 	jumpBounds = genConditionalBranchoperand(JumpAbove, ((sqInt)0));
 	genConvertSmallIntegerToIntegerInReg(Arg0Reg);
 	/* begin AddCq:R: */
-	anInstruction = genoperandoperand(AddCqR, ((usqInt) BaseHeaderSize) >> (shiftForWord()), Arg0Reg);
+	anInstruction1 = genoperandoperand(AddCqR, ((usqInt) BaseHeaderSize) >> (shiftForWord()), Arg0Reg);
 	/* begin MoveXwr:R:R: */
 	genoperandoperandoperand(MoveXwrRR, Arg0Reg, ReceiverResultReg, ReceiverResultReg);
 	/* begin genPrimReturn */
@@ -23753,7 +23829,6 @@
 		blockStart = blockStartAt(compiledBlocksCount);
 		scanBlock(blockStart);
 		initialOpcodeIndex = opcodeIndex;
-		/* begin saveForBlockCompile */
 		
 #    if NewspeakVM
 		initialIndexOfIRC = indexOfIRC;
@@ -23774,7 +23849,6 @@
 			bzero(abstractOpcodes + initialOpcodeIndex,
 									(opcodeIndex - initialOpcodeIndex) * sizeof(AbstractInstruction));
 			opcodeIndex = initialOpcodeIndex;
-			/* begin resetForBlockCompile */
 			
 #      if NewspeakVM
 			indexOfIRC = initialIndexOfIRC;

Modified: branches/Cog/nsspur64src/vm/cointerp.c
===================================================================
--- branches/Cog/nsspur64src/vm/cointerp.c	2016-01-25 01:07:09 UTC (rev 3570)
+++ branches/Cog/nsspur64src/vm/cointerp.c	2016-01-25 03:02:30 UTC (rev 3571)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1664 uuid: 9e676eea-f638-4da0-bd70-920a096bda28
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1668 uuid: 1f0b27be-e423-42d3-a18d-1c7e292a4f14
    from
-	CoInterpreter VMMaker.oscog-eem.1664 uuid: 9e676eea-f638-4da0-bd70-920a096bda28
+	CoInterpreter VMMaker.oscog-eem.1668 uuid: 1f0b27be-e423-42d3-a18d-1c7e292a4f14
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1664 uuid: 9e676eea-f638-4da0-bd70-920a096bda28 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1668 uuid: 1f0b27be-e423-42d3-a18d-1c7e292a4f14 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -134,13 +134,6 @@
 #define AlternateHeaderHasPrimFlag 0x80000
 #define AlternateHeaderNumLiteralsMask 0x7FFF
 #define AltLongStoreBytecode 234
-#define AtCacheFixedFields 4
-#define AtCacheFmt 3
-#define AtCacheMask 0x1C
-#define AtCacheOop 1
-#define AtCacheSize 2
-#define AtCacheTotalSize 64
-#define AtPutBase 32
 #define BecameActiveClassFlag 8
 #define BecameCompiledMethodFlag 2
 #define BecamePointerObjectFlag 1
@@ -244,6 +237,7 @@
 #define FoxSavedFP 0
 #define FoxThisContext -16
 #define GCModeBecome 8
+#define GCModeFreeSpace 32
 #define GCModeFull 1
 #define GCModeImageSegment 16
 #define GCModeIncremental 4
@@ -971,6 +965,7 @@
 extern sqInt characterValueOf(sqInt oop);
 static sqInt NoDbgRegParms cheapAddressCouldBeInHeap(sqInt address);
 extern sqInt checkedLongAt(sqInt byteAddress);
+static sqInt checkHeapFreeSpaceIntegrity(void);
 static sqInt NoDbgRegParms checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedNewSpaceObjs, sqInt classIndicesShouldBeValid);
 extern sqInt checkOkayOop(usqInt oop);
 extern sqInt checkOopHasOkayClass(usqInt obj);
@@ -1005,6 +1000,7 @@
 static sqInt classTableRootSlots(void);
 extern sqInt classTagForClass(sqInt classObj);
 extern sqInt classUnsafeAlien(void);
+static void clearLeakMapAndMapAccessibleFreeSpace(void);
 static sqInt NoDbgRegParms cloneInOldSpaceForPinning(sqInt objOop);
 extern sqInt clone(sqInt objOop);
 static void NeverInline compact(void);
@@ -1085,7 +1081,6 @@
 static sqInt NoDbgRegParms isCompiledMethodHeader(sqInt objHeader);
 extern sqInt isCompiledMethod(sqInt objOop);
 static sqInt NoDbgRegParms isContextHeader(sqInt aHeader);
-static sqInt NoDbgRegParms isContextNonImm(sqInt oop);
 static sqInt NoDbgRegParms isContext(sqInt oop);
 static sqInt NoDbgRegParms isEmptyObjStack(sqInt objStack);
 static sqInt NoDbgRegParms isEnumerableObjectNoAssert(sqInt objOop);
@@ -1222,6 +1217,7 @@
 extern sqInt remapObj(sqInt objOop);
 extern sqInt removeGCRoot(sqInt *varLoc);
 static void NoDbgRegParms restoreObjectsInsavedHashes(sqInt objArray, sqInt savedHashes);
+static void NoDbgRegParms runLeakCheckerForFreeSpace(sqInt gcModes);
 static void NoDbgRegParms runLeakCheckerFor(sqInt gcModes);
 static void NoDbgRegParms runLeakCheckerForexcludeUnmarkedNewSpaceObjsclassIndicesShouldBeValid(sqInt gcModes, sqInt excludeUnmarkedNewSpaceObjs, sqInt classIndicesShouldBeValid);
 static void NoDbgRegParms scavengingGCTenuringIf(sqInt tenuringCriterion);
@@ -1271,7 +1267,7 @@
 static sqInt lastBridge(void);
 static SpurSegmentInfo * NoDbgRegParms nextNonEmptySegmentAfter(sqInt i);
 static void postSnapshot(void);
-static void prepareForSnapshot(void);
+static void NeverInline prepareForSnapshot(void);
 static sqInt NoDbgRegParms readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes);
 EXPORT(SpurSegmentInfo *) segmentContainingObj(sqInt objOop);
 static void NoDbgRegParms shrinkObjectMemory(usqInt delta);
@@ -1556,7 +1552,7 @@
 static void NoDbgRegParms voidLongRunningPrimitive(char *reason);
 static sqInt wakeHighestPriority(void);
 static sqInt NoDbgRegParms withSmallIntegerTags(char *value);
-static sqInt writeImageFileIO(void);
+static sqInt NeverInline writeImageFileIO(void);
 static sqInt NoDbgRegParms cloneContext(sqInt aContext);
 static sqInt NoDbgRegParms fieldOrSenderFPofContext(sqInt index, sqInt contextObj);
 static sqInt NoDbgRegParms fieldofFrame(sqInt index, char *theFP);
@@ -1608,8 +1604,8 @@
 _iss sqInt argumentCount;
 _iss sqInt specialObjectsOop;
 _iss sqInt bytecodeSetSelector;
-_iss sqInt messageSelector;
 _iss usqInt instructionPointer;
+_iss sqInt messageSelector;
 _iss usqInt newMethod;
 _iss usqInt freeStart;
 _iss sqInt markStack;
@@ -1620,10 +1616,10 @@
 _iss sqInt weaklingStack;
 _iss usqInt newSpaceStart;
 _iss sqInt trueObj;
-_iss sqInt lkupClassTag;
 _iss sqInt falseObj;
 _iss sqInt hiddenRootsObj;
 _iss SpurSegmentInfo * segments;
+_iss sqInt lkupClassTag;
 _iss usqInt totalFreeOldSpace;
 _iss usqInt pastSpaceStart;
 _iss sqInt bytesPerPage;
@@ -1632,10 +1628,10 @@
 _iss sqInt localAbsentReceiver;
 _iss sqInt classTableFirstPage;
 _iss sqInt traceLogIndex;
+_iss sqInt * freeLists;
 _iss usqInt scavengeThreshold;
 _iss char * stackLimit;
 _iss sqInt lkupClass;
-_iss sqInt * freeLists;
 _iss unsigned char primTraceLogIndex;
 _iss sqInt rememberedSetSize;
 _iss sqInt * rememberedSet;
@@ -1679,13 +1675,13 @@
 _iss sqInt mournQueue;
 _iss sqInt tenureCriterion;
 _iss sqInt metaclassNumSlots;
+_iss sqInt numSegInfos;
 _iss sqInt preemptionYields;
 _iss sqInt cogCompiledCodeCompactionCalledFor;
 _iss sqInt gcMode;
 _iss sqInt lastCoggableInterpretedBlockMethod;
 _iss sqInt lastUncoggableInterpretedBlockMethod;
 _iss usqLong nextWakeupUsecs;
-_iss sqInt numSegInfos;
 _iss sqInt cogCodeSize;
 _iss sqInt flagInterpretedMethods;
 _iss sqInt highestRunnableProcessPriority;
@@ -1767,7 +1763,6 @@
 _iss sqInt the2ndUnknownShort;
 _iss long nsMethodCache[NSMethodCacheSize + 1 /* 4097 */];
 _iss long methodCache[MethodCacheSize + 1 /* 2049 */];
-_iss sqInt atCache[AtCacheTotalSize + 1 /* 65 */];
 _iss sqInt traceLog[TraceBufferSize /* 768 */];
 _iss sqInt primTraceLog[256];
 _iss sqInt remapBuffer[RemapBufferSize + 1 /* 26 */];
@@ -1807,6 +1802,7 @@
 #endif
 #endif
 static void (*primitiveFunctionPointer)();
+sqInt checkForLeaks;
 sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */;
 jmp_buf reenterInterpreter; /* private export */;
 sqInt checkAllocFiller;
@@ -1815,7 +1811,6 @@
 sqInt desiredEdenBytes;
 sqInt desiredNumStackPages;
 sqInt extraVMMemory;
-sqInt checkForLeaks;
 sqInt desiredCogCodeSize;
 unsigned long maxOldSpaceSize;
 char * breakSelector;
@@ -2436,7 +2431,7 @@
 /*560*/	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1
 	};
 char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1664";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1668";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -5103,7 +5098,7 @@
 				frameToReturnTo = 0;
 				if (!((byteAt((localFP + FoxIFrameFlags) + 3)) != 0)) {
 					goto commonCallerReturn;
-					goto l194;
+					goto l154;
 				}
 				closure = longAt(localFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(localFP + FoxMethod)))) < (startOfMemory())
 	? ((mframeCogMethod(localFP))->cmNumArgs)
@@ -5153,10 +5148,10 @@
 						: (byteAt((localFP + FoxIFrameFlags) + 2)) != 0)) {
 						assert(isContext(frameContext(localFP)));
 						ourContext = longAt(localFP + FoxThisContext);
-						goto l198;
+						goto l158;
 					}
 					ourContext = marryFrameSP(localFP, localSP);
-				l198:	/* end ensureFrameIsMarried:SP: */;
+				l158:	/* end ensureFrameIsMarried:SP: */;
 					/* begin internalPush: */
 					longAtPointerput((localSP -= BytesPerOop), ourContext);
 					/* begin internalPush: */
@@ -5164,7 +5159,7 @@
 					GIV(messageSelector) = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((long)SelectorCannotReturn) << (shiftForWord())));
 					GIV(argumentCount) = 1;
 					goto normalSend;
-					goto l194;
+					goto l154;
 				}
 				if (unwindContextOrNilOrZero != 0) {
 					/* begin internalAboutToReturn:through: */
@@ -5173,10 +5168,10 @@
 						: (byteAt((localFP + FoxIFrameFlags) + 2)) != 0)) {
 						assert(isContext(frameContext(localFP)));
 						ourContext1 = longAt(localFP + FoxThisContext);
-						goto l195;
+						goto l155;
 					}
 					ourContext1 = marryFrameSP(localFP, localSP);
-				l195:	/* end ensureFrameIsMarried:SP: */;
+				l155:	/* end ensureFrameIsMarried:SP: */;
 					/* begin internalPush: */
 					longAtPointerput((localSP -= BytesPerOop), ourContext1);
 					/* begin internalPush: */
@@ -5186,7 +5181,7 @@
 					GIV(messageSelector) = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((long)SelectorAboutToReturn) << (shiftForWord())));
 					GIV(argumentCount) = 2;
 					goto normalSend;
-					goto l194;
+					goto l154;
 				}
 				contextToReturnTo = null;
 				if (((((longAt((home + BaseHeaderSize) + (((long)SenderIndex) << (shiftForWord()))))) & 7) == 1)) {
@@ -5238,10 +5233,10 @@
 							: (byteAt((localFP + FoxIFrameFlags) + 2)) != 0)) {
 							assert(isContext(frameContext(localFP)));
 							ourContext2 = longAt(localFP + FoxThisContext);
-							goto l197;
+							goto l157;
 						}
 						ourContext2 = marryFrameSP(localFP, localSP);
-					l197:	/* end ensureFrameIsMarried:SP: */;
+					l157:	/* end ensureFrameIsMarried:SP: */;
 						/* begin internalPush: */
 						longAtPointerput((localSP -= BytesPerOop), ourContext2);
 						/* begin internalPush: */
@@ -5249,7 +5244,7 @@
 						GIV(messageSelector) = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((long)SelectorCannotReturn) << (shiftForWord())));
 						GIV(argumentCount) = 1;
 						goto normalSend;
-						goto l194;
+						goto l154;
 					}
 				}
 				assert(pageListIsWellFormed());
@@ -5354,11 +5349,11 @@
 						GIV(stackPointer) = localSP;
 						GIV(framePointer) = localFP;
 						ceEnterCogCodePopReceiverReg();
-						goto l196;
+						goto l156;
 					}
 					localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
 				}
-			l196:	/* end maybeReturnToMachineCodeFrame */;
+			l156:	/* end maybeReturnToMachineCodeFrame */;
 				/* begin setMethod: */
 				aMethodObj = longAt(localFP + FoxMethod);
 				assert((((usqInt)aMethodObj)) >= (startOfMemory()));
@@ -5373,7 +5368,7 @@
 
 				longAtPointerput(localSP, localReturnValue);
 			}
-		l194:	/* end case */;
+		l154:	/* end case */;
 			break;
 		case 121:
 			/* returnTrue */
@@ -5486,27 +5481,27 @@
 							fp = (thePage->headFP);
 							if (fp == theFP) {
 								frameAbove = 0;
-								goto l200;
+								goto l160;
 							}
 							while (((callerFP = pointerForOop(longAt(fp + FoxSavedFP)))) != 0) {
 								if (callerFP == theFP) {
 									frameAbove = fp;
-									goto l200;
+									goto l160;
 								}
 								fp = callerFP;
 							}
 							error("did not find theFP in stack page");
 							frameAbove = 0;
-						l200:	/* end findFrameAbove:inPage: */;
+						l160:	/* end findFrameAbove:inPage: */;
 							/* begin newStackPage */
 							lruOrFree = (GIV(mostRecentlyUsedPage)->nextPage);
 							if (((lruOrFree->baseFP)) == 0) {
 								newPage = lruOrFree;
-								goto l201;
+								goto l161;
 							}
 							divorceFramesIn(lruOrFree);
 							newPage = lruOrFree;
-						l201:	/* end newStackPage */;
+						l161:	/* end newStackPage */;
 							assert(newPage == GIV(stackPage));
 							moveFramesInthroughtoPage(thePage, frameAbove, newPage);
 							markStackPageMostRecentlyUsed(newPage);
@@ -5529,7 +5524,7 @@
 							longAtput((sp2 = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer));
 							GIV(stackPointer) = sp2;
 							ceSendAborttonumArgs(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((long)SelectorCannotReturn) << (shiftForWord()))), contextToReturnFrom, 1);
-							goto l199;
+							goto l159;
 						}
 						GIV(instructionPointer) = 0;
 						thePage = makeBaseFrameFor(contextToReturnTo);
@@ -5565,7 +5560,7 @@
 							GIV(stackPointer) = localSP;
 							GIV(framePointer) = localFP;
 							ceEnterCogCodePopReceiverReg();
-							goto l199;
+							goto l159;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
 					}
@@ -5583,7 +5578,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-					goto l199;
+					goto l159;
 				}
 				localIP = pointerForOop(longAt(localFP + FoxCallerSavedIP));
 				localSP = localFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(localFP + FoxMethod)))) < (startOfMemory())
@@ -5608,7 +5603,7 @@
 						GIV(stackPointer) = localSP;
 						GIV(framePointer) = localFP;
 						ceEnterCogCodePopReceiverReg();
-						goto l199;
+						goto l159;
 					}
 					localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
 				}
@@ -5626,7 +5621,7 @@
 
 				longAtPointerput(localSP, localReturnValue);
 			}
-		l199:	/* end case */;
+		l159:	/* end case */;
 			break;
 		case 126:
 		case 127:
@@ -5659,10 +5654,10 @@
 					: (byteAt((theFP + FoxIFrameFlags) + 2)) != 0)) {
 					assert(isContext(frameContext(theFP)));
 					ourContext = longAt(theFP + FoxThisContext);
-					goto l202;
+					goto l162;
 				}
 				ourContext = marryFrameSP(theFP, theSP);
-			l202:	/* end ensureFrameIsMarried:SP: */;
+			l162:	/* end ensureFrameIsMarried:SP: */;
 				localIP -= 1;
 				/* begin internalPush: */
 				longAtPointerput((localSP -= BytesPerOop), ourContext);
@@ -6039,12 +6034,12 @@
 						classTablePage = longAt((GIV(hiddenRootsObj) + BaseHeaderSize) + (((long)fieldIndex) << (shiftForWord())));
 						if (classTablePage == GIV(nilObj)) {
 							classOrInteger = null;
-							goto l206;
+							goto l166;
 						}
 						/* begin fetchPointer:ofObject: */
 						fieldIndex1 = GIV(lkupClassTag) & ((1LL << (classTableMajorIndexShift())) - 1);
 						classOrInteger = longAt((classTablePage + BaseHeaderSize) + (((long)fieldIndex1) << (shiftForWord())));
-					l206:	/* end classAtIndex: */;
+					l166:	/* end classAtIndex: */;
 						GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger;
 						GIV(traceLog)[GIV(traceLogIndex) + 1] = GIV(messageSelector);
 						GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromInterpreter;
@@ -6067,7 +6062,7 @@
 						GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
 						primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
 						ok = 1;
-						goto l204;
+						goto l164;
 					}
 
 					/* second probe */
@@ -6077,7 +6072,7 @@
 						GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
 						primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
 						ok = 1;
-						goto l204;
+						goto l164;
 					}
 					probe = (((usqInt) hash) >> 2) & MethodCacheMask;
 					if (((GIV(methodCache)[probe + MethodCacheSelector]) == GIV(messageSelector))
@@ -6085,10 +6080,10 @@
 						GIV(newMethod) = GIV(methodCache)[probe + MethodCacheMethod];
 						primitiveFunctionPointer = ((void (*)()) (GIV(methodCache)[probe + MethodCachePrimFunction]));
 						ok = 1;
-						goto l204;
+						goto l164;
 					}
 					ok = 0;
-				l204:	/* end inlineLookupInMethodCacheSel:classTag: */;
+				l164:	/* end inlineLookupInMethodCacheSel:classTag: */;
 					if (ok) {
 						/* begin ifAppropriateCompileToNativeCode:selector: */
 						methodHeader2 = longAt((GIV(newMethod) + BaseHeaderSize) + (((long)HeaderIndex) << (shiftForWord())));
@@ -6144,7 +6139,7 @@
 										maybeFlagMethodAsInterpreted(GIV(newMethod));
 									}
 								}
-								goto l203;
+								goto l163;
 							}
 						}
 						/* begin classAtIndex: */
@@ -6155,12 +6150,12 @@
 						classTablePage1 = longAt((GIV(hiddenRootsObj) + BaseHeaderSize) + (((long)fieldIndex2) << (shiftForWord())));
 						if (classTablePage1 == GIV(nilObj)) {
 							GIV(lkupClass) = null;
-							goto l207;
+							goto l167;
 						}
 						/* begin fetchPointer:ofObject: */
 						fieldIndex11 = GIV(lkupClassTag) & ((1LL << (classTableMajorIndexShift())) - 1);
 						GIV(lkupClass) = longAt((classTablePage1 + BaseHeaderSize) + (((long)fieldIndex11) << (shiftForWord())));
-					l207:	/* end classAtIndex: */;
+					l167:	/* end classAtIndex: */;
 						lookupOrdinarySend();
 
 						/* begin internalizeIPandSP */
@@ -6170,7 +6165,7 @@
 						localFP = pointerForOop(GIV(framePointer));
 						addNewMethodToCache(GIV(lkupClass));
 					}
-				l203:	/* end internalFindNewMethodOrdinary */;
+				l163:	/* end internalFindNewMethodOrdinary */;
 					/* begin internalExecuteNewMethod */
 					if (primitiveFunctionPointer != 0) {
 						if ((((unsigned long) primitiveFunctionPointer)) <= MaxQuickPrimitiveIndex) {
@@ -6182,26 +6177,26 @@
 							if (localPrimIndex >= 264) {
 								/* begin internalStackTopPut: */
 								longAtPointerput(localSP, longAt(((longAtPointer(localSP)) + BaseHeaderSize) + (((long)(localPrimIndex - 264)) << (shiftForWord()))));
-								goto l205;
+								goto l165;
 							}
 							if (localPrimIndex == 256) {
-								goto l205;
+								goto l165;
 							}
 							if (localPrimIndex == 257) {
 								longAtPointerput(localSP, GIV(trueObj));
-								goto l205;
+								goto l165;
 							}
 							if (localPrimIndex == 258) {
 								longAtPointerput(localSP, GIV(falseObj));
-								goto l205;
+								goto l165;
 							}
 							if (localPrimIndex == 259) {
 								longAtPointerput(localSP, GIV(nilObj));
-								goto l205;
+								goto l165;
 							}
 							longAtPointerput(localSP, (((localPrimIndex - 261) << 3) | 1));
-						l205:	/* end internalQuickPrimitiveResponse */;
-							goto l209;
+						l165:	/* end internalQuickPrimitiveResponse */;
+							goto l169;
 						}
 						/* begin externalizeIPandSP */
 						assert((((usqInt)localIP)) != (ceReturnToInterpreterPC()));
@@ -6263,7 +6258,7 @@
 						if (succeeded) {
 							returntoExecutive(popStack(), 1);
 							browserPluginReturnIfNeeded();
-							goto l209;
+							goto l169;
 						}
 					}
 					if (methodHasCogMethod(GIV(newMethod))) {
@@ -6338,11 +6333,11 @@
 										table = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((long)PrimErrTableIndex) << (shiftForWord())));
 										if (GIV(primFailCode) <= (numSlotsOf(table))) {
 											errorCode = longAt((table + BaseHeaderSize) + (((long)(GIV(primFailCode) - 1)) << (shiftForWord())));
-											goto l208;
+											goto l168;
 										}
 									}
 									errorCode = ((GIV(primFailCode) << 3) | 1);
-								l208:	/* end getErrorObjectFromPrimFailCode */;
+								l168:	/* end getErrorObjectFromPrimFailCode */;
 									longAtPointerput(localSP, errorCode);
 								}
 								GIV(primFailCode) = 0;
@@ -6366,7 +6361,7 @@
 							localFP = pointerForOop(GIV(framePointer));
 						}
 					}
-				l209:	/* end internalExecuteNewMethod */;
+				l169:	/* end internalExecuteNewMethod */;
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
@@ -7940,7 +7935,7 @@
 						/* begin fetchNextBytecode */
 						currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-						goto l210;
+						goto l170;
 					}
 					if (bytecode == 172) {
 
@@ -7949,7 +7944,7 @@
 						/* begin fetchNextBytecode */
 						currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-						goto l210;
+						goto l170;
 					}
 					if (bytecode > 167) {
 
@@ -7959,7 +7954,7 @@
 						localIP = (localIP + offset) + 1;
 						currentBytecode = (byteAtPointer(localIP)) + GIV(bytecodeSetSelector);
 
-						goto l210;
+						goto l170;
 					}
 				}
 				currentBytecode = bytecode + GIV(bytecodeSetSelector);
@@ -7967,7 +7962,7 @@
 				/* begin internalPush: */
 				longAtPointerput((localSP -= BytesPerOop), GIV(trueObj));
 			}
-		l210:	/* end case */;
+		l170:	/* end case */;
 			break;
 		case 179:
 			/* bytecodePrimGreaterThan */
@@ -8117,7 +8112,7 @@
 					localIP = (localIP + (bytecode - 151)) + 1;
 					currentBytecode = (byteAtPointer(localIP)) + GIV(bytecodeSetSelector);
 
-					goto l211;
+					goto l171;
 				}
 				if (bytecode == 172) {
 
@@ -8127,14 +8122,14 @@
 					localIP = (localIP + offset) + 1;
 					currentBytecode = (byteAtPointer(localIP)) + GIV(bytecodeSetSelector);
 
-					goto l211;
+					goto l171;
 				}
 				currentBytecode = bytecode + GIV(bytecodeSetSelector);
 
 				/* begin internalPush: */
 				longAtPointerput((localSP -= BytesPerOop), GIV(falseObj));
 			}
-		l211:	/* end case */;
+		l171:	/* end case */;
 			break;
 		case 180:
 			/* bytecodePrimLessOrEqual */
@@ -9193,510 +9188,26 @@
 		l62:	/* end case */;
 			break;
 		case 192:
+		case 352: /*96*/
 			/* bytecodePrimAt */
 			{
-				sqInt atIx;
-				sqInt class;
-				sqInt class1;
-				sqInt fixedFields;
-				sqInt fixedFields1;
-				sqInt fixedFields2;
-				sqInt fmt;
-				sqInt fmt1;
-				sqInt fmt2;
-				sqLong hdr;
-				sqLong hdr1;
-				sqInt index;
-				sqInt index1;
-				usqInt numSlots;
-				usqInt numSlots1;
-				usqInt numSlots11;
-				usqInt numSlots2;
-				usqInt numSlots21;
-				usqInt numSlots3;
-				usqInt numSlots31;
-				usqInt numSlots4;
-				sqInt objOop;
-				sqInt rcvr;
-				sqInt reasonCode;
-				sqInt result;
-				sqInt result1;
-				sqInt stSize;
-				sqInt totalLength;
-				sqInt totalLength1;
-
 				VM_LABEL(bytecodePrimAt);
-				result = 0;
-				index = longAtPointer(localSP);
-				rcvr = longAtPointer(localSP + (1 * BytesPerOop));
-				if (((rcvr & (tagMask())) == 0)
-				 && ((((index) & 7) == 1))) {
-
-					/* Index into atCache = 4N, for N = 0 ... 7 */
-					atIx = rcvr & AtCacheMask;
-					if ((GIV(atCache)[atIx + AtCacheOop]) != rcvr) {
-						GIV(lkupClassTag) = (longAt(rcvr)) & (classIndexMask());
-						/* begin fetchPointer:ofObject: */
-						GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((long)SpecialSelectors) << (shiftForWord())))) + BaseHeaderSize) + (((long)(16 * 2)) << (shiftForWord())));
-						if (!(lookupInMethodCacheSelclassTag(GIV(messageSelector), GIV(lkupClassTag)))) {
-							GIV(argumentCount) = 1;
-							goto commonSendOrdinary;
-							goto l63;
-						}
-						if (primitiveFunctionPointer == primitiveAt) {
-							/* begin install:inAtCache:at:string: */
-							assert(!(isContext(rcvr)));
-							hdr = long64At(rcvr);
-							fmt1 = (((unsigned sqLong)hdr) >> (formatShift())) & (formatMask());
-							if ((fmt1 == (indexablePointersFormat()))
-							 && ((hdr & (classIndexMask())) == ClassMethodContextCompactIndex)) {
-
-								/* Contexts must not be put in the atCache, since their size is not constant */
-								GIV(primFailCode) = PrimErrBadReceiver;
-								goto l71;
-							}
-							/* begin lengthOf:format: */
-							numSlots3 = byteAt(rcvr + 7);
-							numSlots1 = (numSlots3 == (numSlotsMask())
-								? ((usqInt) (((unsigned long)(((long)(longAt(rcvr - BaseHeaderSize))) << 8)))) >> 8
-								: numSlots3);
-							if (fmt1 <= 5) {
-								totalLength = numSlots1;
-								goto l72;
-							}
-							if (fmt1 >= (firstByteFormat())) {
-
-								/* bytes, including CompiledMethod */
-								totalLength = (((long)numSlots1) << (shiftForWord())) - (fmt1 & 7);
-								goto l72;
-							}
-							if (fmt1 >= (firstShortFormat())) {
-								totalLength = (((long)numSlots1) << ((shiftForWord()) - 1)) - (fmt1 & 3);
-								goto l72;
-							}
-							if (fmt1 >= (firstLongFormat())) {
-								totalLength = (((long)numSlots1) << ((shiftForWord()) - 2)) - (fmt1 & 1);
-								goto l72;
-							}
-							if (fmt1 == (sixtyFourBitIndexableFormat())) {
-								totalLength = numSlots1;
-								goto l72;
-							}
-							totalLength = 0;
-						l72:	/* end lengthOf:format: */;
-							/* begin fixedFieldsOf:format:length: */
-							if ((fmt1 >= (sixtyFourBitIndexableFormat()))
-							 || (fmt1 == 2)) {
-								fixedFields1 = 0;
-								goto l69;
-							}
-							if (fmt1 < 2) {
-								fixedFields1 = totalLength;
-								goto l69;
-							}
-							class = fetchClassOfNonImm(rcvr);
-							/* begin fixedFieldsOfClassFormat: */
-							fixedFields1 = (((longAt((class + BaseHeaderSize) + (((long)InstanceSpecificationIndex) << (shiftForWord())))) >> 3)) & ((1LL << (fixedFieldsFieldWidth())) - 1);
-						l69:	/* end fixedFieldsOf:format:length: */;
-
-							GIV(atCache)[atIx + AtCacheOop] = rcvr;
-							GIV(atCache)[atIx + AtCacheFmt] = fmt1;
-							GIV(atCache)[atIx + AtCacheFixedFields] = fixedFields1;
-							GIV(atCache)[atIx + AtCacheSize] = (totalLength - fixedFields1);
-						l71:	/* end install:inAtCache:at:string: */;
-						}
-						else {
-							if (primitiveFunctionPointer == primitiveStringAt) {
-								/* begin install:inAtCache:at:string: */
-								assert(!(isContext(rcvr)));
-								hdr1 = long64At(rcvr);
-								fmt2 = (((unsigned sqLong)hdr1) >> (formatShift())) & (formatMask());
-								/* begin lengthOf:format: */
-								numSlots21 = byteAt(rcvr + 7);
-								numSlots4 = (numSlots21 == (numSlotsMask())
-									? ((usqInt) (((unsigned long)(((long)(longAt(rcvr - BaseHeaderSize))) << 8)))) >> 8
-									: numSlots21);
-								if (fmt2 <= 5) {
-									totalLength1 = numSlots4;
-									goto l64;
-								}
-								if (fmt2 >= (firstByteFormat())) {
-
-									/* bytes, including CompiledMethod */
-									totalLength1 = (((long)numSlots4) << (shiftForWord())) - (fmt2 & 7);
-									goto l64;
-								}
-								if (fmt2 >= (firstShortFormat())) {
-									totalLength1 = (((long)numSlots4) << ((shiftForWord()) - 1)) - (fmt2 & 3);
-									goto l64;
-								}
-								if (fmt2 >= (firstLongFormat())) {
-									totalLength1 = (((long)numSlots4) << ((shiftForWord()) - 2)) - (fmt2 & 1);
-									goto l64;
-								}
-								if (fmt2 == (sixtyFourBitIndexableFormat())) {
-									totalLength1 = numSlots4;
-									goto l64;
-								}
-								totalLength1 = 0;
-							l64:	/* end lengthOf:format: */;
-								fixedFields2 = 0;
-
-								/* special flag for strings */
-								fmt2 += 32;
-
-								GIV(atCache)[atIx + AtCacheOop] = rcvr;
-								GIV(atCache)[atIx + AtCacheFmt] = fmt2;
-								GIV(atCache)[atIx + AtCacheFixedFields] = fixedFields2;
-								GIV(atCache)[atIx + AtCacheSize] = (totalLength1 - fixedFields2);
-							l67:	/* end install:inAtCache:at:string: */;
-							}
-							else {
-								GIV(argumentCount) = 1;
-								goto commonSendOrdinary;
-								goto l63;
-							}
-						}
-					}
-					if (!GIV(primFailCode)) {
-						/* begin commonVariable:at:cacheIndex: */
-						index1 = (index >> 3);
-						stSize = GIV(atCache)[atIx + AtCacheSize];
-						if ((oopisGreaterThanOrEqualTo(index1, 1))
-						 && (oopisLessThanOrEqualTo(index1, stSize))) {
-							fmt = GIV(atCache)[atIx + AtCacheFmt];
-							if (fmt <= (weakArrayFormat())) {
-								assert(!(isContextNonImm(rcvr)));
-								fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
-								result = longAt((rcvr + BaseHeaderSize) + (((long)((index1 + fixedFields) - 1)) << (shiftForWord())));
-								goto l66;
-							}
-							if (fmt < (firstByteFormat())) {
-
-								/* Bitmap */
-								result1 = long32At((rcvr + BaseHeaderSize) + (((long)(index1 - 1)) << 2));
-								/* begin positive32BitIntegerFor: */
-								result = (((result1 & 0xFFFFFFFFULL) << 3) | 1);
-								goto l66;
-
-							}
-							if (fmt >= 32) {
-
-								/* Note fmt >= firstStringyFormat is an artificial flag for strings */
-								/* String */
-								/* Spur supports the String at:[put:] primitives on WideString */
-								if ((fmt - 32) < (firstByteFormat())) {
-									result1 = long32At((rcvr + BaseHeaderSize) + (((long)(index1 - 1)) << 2));
-								}
-								else {
-									result1 = byteAt((rcvr + BaseHeaderSize) + (index1 - 1));
-								}
-								result = (((long)result1) << (numTagBits())) + (characterTag());
-
-								goto l66;
-							}
-							else {
-								if ((fmt < (firstCompiledMethodFormat()))
-								 || (index1 >= ((((literalCountOf(rcvr)) + LiteralStart) * BytesPerOop) + 1))) {
-									result = (((byteAt((rcvr + BaseHeaderSize) + (index1 - 1))) << 3) | 1);
-									goto l66;
-								}
-							}
-						}
-						/* begin primitiveFailFor: */
-						reasonCode = (isIndexable(rcvr)
-							? PrimErrBadIndex
-							: PrimErrBadReceiver);
-						result = (GIV(primFailCode) = reasonCode);
-					l66:	/* end commonVariable:at:cacheIndex: */;
-					}
-					if (!GIV(primFailCode)) {
-						/* begin fetchNextBytecode */
-						currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
-
-						/* begin internalPop:thenPush: */
-						longAtPointerput((localSP += (2 - 1) * BytesPerOop), result);
-						goto l63;
-					}
-					/* begin initPrimCall */
-					GIV(primFailCode) = 0;
-				}
 				/* begin fetchPointer:ofObject: */
 				GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((long)SpecialSelectors) << (shiftForWord())))) + BaseHeaderSize) + (((long)(16 * 2)) << (shiftForWord())));
 				GIV(argumentCount) = 1;
 				goto normalSend;
 			}
-		l63:	/* end case */;
 			break;
 		case 193:
+		case 353: /*97*/
 			/* bytecodePrimAtPut */
 			{
-				sqInt atIx;
-				sqInt class;
-				sqInt class1;
-				sqInt correctRcvr;
-				sqInt fixedFields;
-				sqInt fixedFields1;
-				sqInt fixedFields2;
-				sqInt fmt;
-				sqInt fmt1;
-				sqInt fmt2;
-				sqLong hdr;
-				sqLong hdr1;
-				sqInt index;
-				sqInt isCharacter;
-				usqInt numSlots;
-				usqInt numSlots1;
-				usqInt numSlots11;
-				usqInt numSlots2;
-				usqInt numSlots21;
-				usqInt numSlots3;
-				usqInt numSlots31;
-				usqInt numSlots4;
-				sqInt rcvr;
-				sqInt reasonCode;
-				sqInt stSize;
-				sqInt totalLength;
-				sqInt totalLength1;
-				sqInt valToPut;
-				sqInt value;
-
 				VM_LABEL(bytecodePrimAtPut);
-				value = longAtPointer(localSP);
-				index = longAtPointer(localSP + (1 * BytesPerOop));
-				rcvr = longAtPointer(localSP + (2 * BytesPerOop));
-				
-#        if IMMUTABILITY
-				correctRcvr = ((rcvr & (tagMask())) == 0)
-				 && (!(((((usqInt) (longAt(rcvr))) >> 23) & 1) != 0));
-
-#        else /* IMMUTABILITY */
-				correctRcvr = (rcvr & (tagMask())) == 0;
-
-#        endif /* IMMUTABILITY */
-
-				if (correctRcvr
-				 && ((((index) & 7) == 1))) {
-
-					/* Index into atPutCache */
-					atIx = (rcvr & AtCacheMask) + AtPutBase;

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list