[commit] r2488 - CogVM source as per VMMaker.oscog-eem.119.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[commit] r2488 - CogVM source as per VMMaker.oscog-eem.119.

commits-3
 
Author: eliot
Date: 2011-08-19 14:33:12 -0700 (Fri, 19 Aug 2011)
New Revision: 2488

Added:
   branches/Cog/scripts/mknsvmlinuxarchive
Modified:
   branches/Cog/nscogbuild/cygwinbuild/mvm
   branches/Cog/nscogbuild/macbuild/makevm
   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/platforms/Cross/vm/sqSCCSVersion.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
Log:
CogVM source as per VMMaker.oscog-eem.119.

CoInterpreter/StackInterpreter:
Fix object accessing prims (at:, at:put: & size 60, 61 & 612) for contexts,
because primitives  60-62 are used for the mirror primitives in ContextPart
(object:at: et al).  Fix now obsolete, but still used primitiveContextAt et al
(primitives 210, 211 & 212) to be varargs, since these might also be used from
mirror primitives.  Pull the temporary:in:[put:] code into a non-inlined wrapper
to avoid bloating the common case.

Cogit/CogObjectRepresentationForSqueakV3:
Fix genInnerPrimitiveAt: & genInnerPrimitiveSize to fail for context receivers.
Fix genInnerPrimitiveAt:, genInnerPrimitiveStringAt: & genInnerPrimitiveSize to
call the interpereter primitive on failure, to get the error code - not yet
avoiding the call if the method doesn't use the error code; one thing at a time.


Modified: branches/Cog/nscogbuild/cygwinbuild/mvm
===================================================================
--- branches/Cog/nscogbuild/cygwinbuild/mvm 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/nscogbuild/cygwinbuild/mvm 2011-08-19 21:33:12 UTC (rev 2488)
@@ -2,4 +2,18 @@
 rm -rf build*/vm/nsvm*.exe
 make debug;make assert;make
 ls -rlt build*/vm/nsvm*.exe
-echo "don't forget to link in sources!!"
+if [ ! -f builddbg/vm/SqueakV41.sources \
+  -a ! -f buildast/vm/SqueakV41.sources \
+  -a ! -f build/vm/SqueakV41.sources ]; then
+ echo "don't forget to link in sources!!"
+else
+ if [ ! -f builddbg/vm/SqueakV41.sources ]; then
+ echo "don't forget to link in builddbg/vm sources"
+ fi
+ if [ ! -f buildast/vm/SqueakV41.sources ]; then
+ echo "don't forget to link in buildast/vm sources"
+ fi
+ if [ ! -f build/vm/SqueakV41.sources ]; then
+ echo "don't forget to link in build/vm sources"
+ fi
+fi

Modified: branches/Cog/nscogbuild/macbuild/makevm
===================================================================
--- branches/Cog/nscogbuild/macbuild/makevm 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/nscogbuild/macbuild/makevm 2011-08-19 21:33:12 UTC (rev 2488)
@@ -70,3 +70,5 @@
 
 # Clean out any .svn directories (result of copying) in the VM
 find "$DEST" -name .svn -exec rm -rf {} \;
+#link source file into resources directory
+ln SqueakV41.sources "$DEST/Contents/Resources"

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/nscogsrc/vm/cogit.c 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,9 +1,9 @@
 /* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGenerator VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
    from
- StackToRegisterMappingCogit VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ StackToRegisterMappingCogit VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -145,6 +145,7 @@
 #define BytesPerWord 4
 #define Call 9
 #define CDQ 103
+#define ClassMethodContextCompactIndex 14
 #define ClassReg -5
 #define ClosureFirstCopiedValueIndex 3
 #define ClosureNumArgsIndex 2
@@ -607,7 +608,6 @@
 static sqInt genGetHashFieldNonIntOfasSmallIntegerInto(sqInt instReg, sqInt destReg);
 static sqInt genGetLeafCallStackPointer(void);
 static void genGetLeafCallStackPointerFunction(AbstractInstruction * self_in_genGetLeafCallStackPointerFunction);
-static AbstractInstruction * genGetSizeOfintoformatRegscratchReg(sqInt sourceReg, sqInt destReg, sqInt formatReg, sqInt scratchReg);
 static sqInt genInnerPICAbortTrampoline(char *name);
 static sqInt genInnerPrimitiveAt(sqInt retNoffset);
 static sqInt genInnerPrimitiveSize(sqInt retNoffset);
@@ -772,7 +772,6 @@
 static sqInt hasPCDependentInstructions(AbstractInstruction * self_in_hasPCDependentInstructions);
 static sqInt hasSSE2Instructions(AbstractInstruction * self_in_hasSSE2Instructions);
 static sqInt hasSSEInstructions(AbstractInstruction * self_in_hasSSEInstructions);
-static sqInt hasValidHeaderPostGC(CogMethod *cogMethod);
 static sqInt incrementUsageOfTargetIfLinkedSendmcpcignored(sqInt annotation, char *mcpc, sqInt superfluity);
 static sqInt initialClosedPICUsageCount(void);
 static void initializeBackend(void);
@@ -870,6 +869,7 @@
 static AbstractInstruction * gNegateR(sqInt reg);
 static sqInt needsFrameIfInBlock(sqInt isInBlock);
 static sqInt needsFrameNever(sqInt isInBlock);
+static sqInt noAssertMethodClassAssociationOf(sqInt methodPointer);
 static sqInt noCogMethodsMaximallyMarked(void);
 static void nopsFromto(AbstractInstruction * self_in_nopsFromto, sqInt startAddr, sqInt endAddr);
 static sqInt noTargetsFreeInClosedPIC(CogMethod *cPIC);
@@ -1689,7 +1689,6 @@
 #define traceSimStack() 0
 #define traceSpill(ign) 0
 #define tryLockVMOwner() (ceTryLockVMOwner() != 0)
-#define typeEtAlWord(cm) (((long *)(cm))[1])
 #define unalignedLongAt(inst,byteAddress) longAt(byteAddress)
 #define unalignedLongAtput(inst,byteAddress,aWord) longAtput(byteAddress,aWord)
 #define unlockVMOwner() ceUnlockVMOwner()
@@ -1922,7 +1921,7 @@
  cogMethod = ((CogMethod *) methodZoneBase);
  while (cogMethod < (limitZony())) {
  if (((cogMethod->cmType)) == CMMethod) {
- if (!(hasValidHeaderPostGC(cogMethod))) {
+ if (!(((cogMethod->objectHeader)) == (nullHeaderForMachineCodeMethod()))) {
  return 0;
  }
  }
@@ -2454,7 +2453,9 @@
     sqInt cacheTag;
     sqInt entryPoint;
     sqInt literal;
+    sqInt off;
     sqInt offset;
+    sqInt table;
     CogMethod *targetMethod;
 
  if (annotation == IsObjectReference) {
@@ -2492,9 +2493,55 @@
  }
  entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
  if (entryPoint > methodZoneBase) {
- offset = ((entryPoint & entryPointMask) == checkedEntryAlignment
- ? cmEntryOffset
- : cmNoCheckEntryOffset);
+ /* begin offsetAndSendTableFor:annotation:into: */
+ VM_LABEL(0offsetAndSendTableForannotationinto);
+
+#      if NewspeakVM
+ if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
+ assert(annotation == IsSendCall);
+
+ /* It's a linked send; find which kind. */
+
+ offset = cmEntryOffset;
+
+ }
+ else {
+ if ((entryPoint & entryPointMask) == dynSuperEntryAlignment) {
+ assert(annotation == IsNSSendCall);
+
+ /* It's a linked send; find which kind. */
+
+ offset = cmDynSuperEntryOffset;
+
+ }
+ else {
+ assert(annotation == IsSendCall);
+
+ /* It's a linked send; find which kind. */
+
+ offset = cmNoCheckEntryOffset;
+
+ }
+ }
+
+#      else /* NewspeakVM */
+ if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
+
+ /* It's a linked send; find which kind. */
+
+ offset = cmEntryOffset;
+
+ }
+ else {
+
+ /* It's a linked send; find which kind. */
+
+ offset = cmNoCheckEntryOffset;
+
+ }
+
+#      endif /* NewspeakVM */
+
  targetMethod = ((CogMethod *) (entryPoint - offset));
  if (!(asserta((((targetMethod->cmType)) == CMMethod)
  || ((((targetMethod->cmType)) == CMClosedPIC)
@@ -3171,7 +3218,7 @@
     CogMethod *cogMethod;
 
  assert((!(methodHasCogMethod(aMethodObj)))
- || ((methodClassAssociationOf(aMethodObj)) == (nilObject())));
+ || ((noAssertMethodClassAssociationOf(aMethodObj)) == (nilObject())));
  compilationBreakpoint(aSelectorOop, lengthOf(aSelectorOop));
  if (aMethodObj == breakMethod) {
  haltmsg("Compilation of breakMethod");
@@ -3183,6 +3230,11 @@
  null;
  }
  else {
+ if (!(methodHasCogMethod(aMethodObj))) {
+ assert((rawHeaderOf(aMethodObj)) == ((cogMethod->methodHeader)));
+ (cogMethod->methodObject = aMethodObj);
+ rawHeaderOfput(aMethodObj, ((sqInt)cogMethod));
+ }
  return cogMethod;
  }
 
@@ -3254,7 +3306,7 @@
  (dest->objectHeader = objectHeaderValue);
  if (((dest->cmType)) == CMMethod) {
  assert(((((sqInt)(rawHeaderOf((dest->methodObject))))) == (((sqInt)source)))
- || ((methodClassAssociationOf((dest->methodObject))) == (nilObject())));
+ || ((noAssertMethodClassAssociationOf((dest->methodObject))) == (nilObject())));
  if ((((sqInt)(rawHeaderOf((dest->methodObject))))) == (((sqInt)source))) {
  rawHeaderOfput((dest->methodObject), ((sqInt)dest));
  }
@@ -7560,7 +7612,7 @@
  assert((cogMethodDoesntLookKosher(cogMethod)) == 0);
  if (((cogMethod->cmType)) == CMMethod) {
  assert(((((sqInt)(rawHeaderOf((cogMethod->methodObject))))) == (((sqInt)cogMethod)))
- || ((methodClassAssociationOf((cogMethod->methodObject))) == (nilObject())));
+ || ((noAssertMethodClassAssociationOf((cogMethod->methodObject))) == (nilObject())));
  if ((((sqInt)(rawHeaderOf((cogMethod->methodObject))))) == (((sqInt)cogMethod))) {
  rawHeaderOfput((cogMethod->methodObject), (cogMethod->methodHeader));
  }
@@ -8916,11 +8968,11 @@
  /* begin MoveMw:r:R: */
  genoperandoperandoperand(MoveMwrR, 0, instReg, destReg);
  /* begin LogicalShiftRightCq:R: */
- quickConstant1 = (compactClassFieldLSB()) - ShiftForWord;
- genoperandoperand(LogicalShiftRightCqR, quickConstant1, destReg);
+ quickConstant = (compactClassFieldLSB()) - ShiftForWord;
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, destReg);
  /* begin AndCq:R: */
- quickConstant = ((1 << (compactClassFieldWidth())) - 1) << ShiftForWord;
- genoperandoperand(AndCqR, quickConstant, destReg);
+ quickConstant1 = ((1 << (compactClassFieldWidth())) - 1) << ShiftForWord;
+ genoperandoperand(AndCqR, quickConstant1, destReg);
  /* begin JumpNonZero: */
  jumpCompact = genoperand(JumpNonZero, ((sqInt)0));
  /* begin MoveMw:r:R: */
@@ -8962,11 +9014,11 @@
  /* begin MoveMw:r:R: */
  genoperandoperandoperand(MoveMwrR, 0, instReg, scratchReg);
  /* begin LogicalShiftRightCq:R: */
- quickConstant1 = (compactClassFieldLSB()) - ShiftForWord;
- genoperandoperand(LogicalShiftRightCqR, quickConstant1, scratchReg);
+ quickConstant = (compactClassFieldLSB()) - ShiftForWord;
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, scratchReg);
  /* begin AndCq:R: */
- quickConstant = ((1 << (compactClassFieldWidth())) - 1) << ShiftForWord;
- genoperandoperand(AndCqR, quickConstant, scratchReg);
+ quickConstant1 = ((1 << (compactClassFieldWidth())) - 1) << ShiftForWord;
+ genoperandoperand(AndCqR, quickConstant1, scratchReg);
  /* begin JumpNonZero: */
  jumpCompact = genoperand(JumpNonZero, ((sqInt)0));
  /* begin MoveMw:r:R: */
@@ -8998,11 +9050,11 @@
  /* begin MoveMw:r:R: */
  genoperandoperandoperand(MoveMwrR, 0, instReg, destReg);
  /* begin LogicalShiftRightCq:R: */
- quickConstant1 = compactClassFieldLSB();
- genoperandoperand(LogicalShiftRightCqR, quickConstant1, destReg);
+ quickConstant = compactClassFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, destReg);
  /* begin AndCq:R: */
- quickConstant = (1 << (compactClassFieldWidth())) - 1;
- genoperandoperand(AndCqR, quickConstant, destReg);
+ quickConstant1 = (1 << (compactClassFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant1, destReg);
  return 0;
 }
 
@@ -9089,138 +9141,145 @@
 }
 
 
-/* Get the size of the non-immediate object in sourceReg into destReg using
- formatReg and scratchReg as temps. None of these registers can overlap.
- Answer the jump
- taken if the object in sourceReg is not indexable. Hack: If the object hs
- a pointer
- format other than 2 leave the number of fixed fields in formatReg. Used by
- primitiveSize, primitiveAt, primitiveAtPut, primitiveStringAt &
- primitiveStringAtPut  */
+/* Generate the abort for a PIC. This abort performs either a call of
+ ceInterpretMethodFromPIC:receiver: to handle invoking an uncogged
+ target or a call of ceMNUFromPICMNUMethod:receiver: to handle an
+ MNU dispatch in a closed PIC. It distinguishes the two by testing
+ ClassReg. If the register is zero then this is an MNU. */
+
+static sqInt
+genInnerPICAbortTrampoline(char *name)
+{
+    AbstractInstruction *jumpMNUCase;
+
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, 0, ClassReg);
+ /* begin JumpZero: */
+ jumpMNUCase = genoperand(JumpZero, ((sqInt)0));
+ compileTrampolineForcallJumpBarnumArgsargargargargsaveRegsresultReg(ceInterpretMethodFromPICreceiver, 1, 2, SendNumArgsReg, ReceiverResultReg, null, null, 0, null);
+ jmpTarget(jumpMNUCase, gLabel());
+ return genTrampolineForcalledcallJumpBarnumArgsargargargargsaveRegsresultRegappendOpcodes(ceMNUFromPICMNUMethodreceiver, name, 1, 2, SendNumArgsReg, ReceiverResultReg, null, null, 0, null, 1);
+}
+
+
 /* c.f. StackInterpreter>>stSizeOf: lengthOf:baseHeader:format:
  fixedFieldsOf:format:length:
  */
-/* and one wonders why Squeak V1 through V3 are slow... */
 
-static AbstractInstruction *
-genGetSizeOfintoformatRegscratchReg(sqInt sourceReg, sqInt destReg, sqInt formatReg, sqInt scratchReg)
+static sqInt
+genInnerPrimitiveAt(sqInt retNoffset)
 {
+    sqInt jic;
     AbstractInstruction *jmpFmtGe8;
+    sqInt jnx;
+    AbstractInstruction *jumpBounds;
+    AbstractInstruction *jumpFmtEq2;
+    AbstractInstruction *jumpFmtGt4;
     AbstractInstruction *jumpFmtIs2;
     AbstractInstruction *jumpFmtLe4;
+    AbstractInstruction *jumpFmtLt8;
     AbstractInstruction *jumpGotByteSize;
     AbstractInstruction *jumpGotWordSize;
+    AbstractInstruction *jumpIsContext;
+    AbstractInstruction *jumpIsContext1;
+    AbstractInstruction *jumpLarge;
     AbstractInstruction *jumpNotIndexable;
+    AbstractInstruction *jumpNotIndexable1;
+    AbstractInstruction *jumpNotSI;
     AbstractInstruction *jumpShortHeader;
+    AbstractInstruction *jumpSI;
     AbstractInstruction *jumpSkip;
+    sqInt quickConstant;
+    sqInt quickConstant1;
+    sqInt quickConstant11;
+    sqInt quickConstant2;
+    sqInt quickConstant3;
+    sqInt quickConstant4;
 
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
+ jumpSI = genJumpSmallIntegerInScratchReg(TempReg);
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, Arg0Reg, TempReg);
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, Arg0Reg, Arg1Reg);
+ jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
+ /* begin genGetSizeOf:into:formatReg:scratchReg:abortJumpsInto: */
+ VM_LABEL(0genGetSizeOfintoformatRegscratchRegabortJumpsInto);
  /* begin MoveMw:r:R: */
- genoperandoperandoperand(MoveMwrR, 0, sourceReg, formatReg);
+ genoperandoperandoperand(MoveMwrR, 0, ReceiverResultReg, SendNumArgsReg);
  /* begin MoveR:R: */
- genoperandoperand(MoveRR, formatReg, destReg);
+ genoperandoperand(MoveRR, SendNumArgsReg, ClassReg);
  /* begin LogicalShiftRightCq:R: */
- genoperandoperand(LogicalShiftRightCqR, 8, formatReg);
+ quickConstant4 = instFormatFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant4, SendNumArgsReg);
  /* begin AndCq:R: */
- genoperandoperand(AndCqR, 15, formatReg);
+ quickConstant11 = (1 << (instFormatFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant11, SendNumArgsReg);
  /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, 2, formatReg);
+ genoperandoperand(CmpCqR, 2, SendNumArgsReg);
  /* begin JumpLess: */
- jumpNotIndexable = genoperand(JumpLess, ((sqInt)0));
+ jumpNotIndexable1 = genoperand(JumpLess, ((sqInt)0));
  /* begin MoveR:R: */
- genoperandoperand(MoveRR, destReg, scratchReg);
+ genoperandoperand(MoveRR, ClassReg, TempReg);
+ /* begin LogicalShiftRightCq:R: */
+ quickConstant2 = compactClassFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant2, TempReg);
  /* begin AndCq:R: */
- genoperandoperand(AndCqR, TypeMask, scratchReg);
+ quickConstant3 = (1 << (compactClassFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant3, TempReg);
  /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, HeaderTypeSizeAndClass, scratchReg);
+ genoperandoperand(CmpCqR, ClassMethodContextCompactIndex, TempReg);
+ /* begin JumpZero: */
+ jumpIsContext1 = genoperand(JumpZero, ((sqInt)0));
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, ClassReg, TempReg);
+ /* begin AndCq:R: */
+ genoperandoperand(AndCqR, TypeMask, TempReg);
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, HeaderTypeSizeAndClass, TempReg);
  /* begin JumpNonZero: */
  jumpShortHeader = genoperand(JumpNonZero, ((sqInt)0));
  assert(Size4Bit == 0);
  /* begin MoveMw:r:R: */
- genoperandoperandoperand(MoveMwrR, 0 - (2 * BytesPerWord), sourceReg, destReg);
+ genoperandoperandoperand(MoveMwrR, 0 - (2 * BytesPerWord), ReceiverResultReg, ClassReg);
  /* begin AndCq:R: */
- genoperandoperand(AndCqR, ((sqInt) LongSizeMask), destReg);
+ genoperandoperand(AndCqR, ((sqInt) LongSizeMask), ClassReg);
  /* begin Jump: */
  jumpSkip = genoperand(Jump, ((sqInt)0));
- jmpTarget(jumpShortHeader, gAndCqR(SizeMask, destReg));
- jmpTarget(jumpSkip, gSubCqR(BaseHeaderSize, destReg));
+ jmpTarget(jumpShortHeader, gAndCqR(SizeMask, ClassReg));
+ jmpTarget(jumpSkip, gSubCqR(BaseHeaderSize, ClassReg));
  /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, 4, formatReg);
+ genoperandoperand(CmpCqR, 4, SendNumArgsReg);
  /* begin JumpLessOrEqual: */
  jumpFmtLe4 = genoperand(JumpLessOrEqual, ((sqInt)0));
  /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, 8, formatReg);
+ genoperandoperand(CmpCqR, 8, SendNumArgsReg);
  /* begin JumpLess: */
  jmpFmtGe8 = genoperand(JumpLess, ((sqInt)0));
  /* begin AndCq:R: */
- genoperandoperand(AndCqR, 3, formatReg);
+ genoperandoperand(AndCqR, 3, SendNumArgsReg);
  /* begin SubR:R: */
- genoperandoperand(SubRR, formatReg, destReg);
+ genoperandoperand(SubRR, SendNumArgsReg, ClassReg);
  /* begin Jump: */
  jumpGotByteSize = genoperand(Jump, ((sqInt)0));
- jmpTarget(jmpFmtGe8, gLogicalShiftRightCqR(2, destReg));
+ jmpTarget(jmpFmtGe8, gLogicalShiftRightCqR(2, ClassReg));
  /* begin Jump: */
  jumpGotWordSize = genoperand(Jump, ((sqInt)0));
  jmpTarget(jumpFmtLe4, gLabel());
  /* begin LogicalShiftRightCq:R: */
- genoperandoperand(LogicalShiftRightCqR, ShiftForWord, destReg);
+ genoperandoperand(LogicalShiftRightCqR, ShiftForWord, ClassReg);
  /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, 2, formatReg);
+ genoperandoperand(CmpCqR, 2, SendNumArgsReg);
  /* begin JumpZero: */
  jumpFmtIs2 = genoperand(JumpZero, ((sqInt)0));
- genGetFixedFieldsOfPointerNonIntintoscratchReg(sourceReg, formatReg, scratchReg);
+ genGetFixedFieldsOfPointerNonIntintoscratchReg(ReceiverResultReg, SendNumArgsReg, TempReg);
  /* begin SubR:R: */
- genoperandoperand(SubRR, formatReg, destReg);
+ genoperandoperand(SubRR, SendNumArgsReg, ClassReg);
  jmpTarget(jumpFmtIs2, jmpTarget(jumpGotWordSize, jmpTarget(jumpGotByteSize, gLabel())));
- return jumpNotIndexable;
-}
+ jumpNotIndexable = jumpNotIndexable1;
+ jumpIsContext = jumpIsContext1;
 
-
-/* Generate the abort for a PIC. This abort performs either a call of
- ceInterpretMethodFromPIC:receiver: to handle invoking an uncogged
- target or a call of ceMNUFromPICMNUMethod:receiver: to handle an
- MNU dispatch in a closed PIC. It distinguishes the two by testing
- ClassReg. If the register is zero then this is an MNU. */
-
-static sqInt
-genInnerPICAbortTrampoline(char *name)
-{
-    AbstractInstruction *jumpMNUCase;
-
- /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, 0, ClassReg);
- /* begin JumpZero: */
- jumpMNUCase = genoperand(JumpZero, ((sqInt)0));
- compileTrampolineForcallJumpBarnumArgsargargargargsaveRegsresultReg(ceInterpretMethodFromPICreceiver, 1, 2, SendNumArgsReg, ReceiverResultReg, null, null, 0, null);
- jmpTarget(jumpMNUCase, gLabel());
- return genTrampolineForcalledcallJumpBarnumArgsargargargargsaveRegsresultRegappendOpcodes(ceMNUFromPICMNUMethodreceiver, name, 1, 2, SendNumArgsReg, ReceiverResultReg, null, null, 0, null, 1);
-}
-
-
-/* c.f. StackInterpreter>>stSizeOf: lengthOf:baseHeader:format:
- fixedFieldsOf:format:length:
- */
-
-static sqInt
-genInnerPrimitiveAt(sqInt retNoffset)
-{
-    AbstractInstruction *jumpBounds;
-    AbstractInstruction *jumpFmtEq2;
-    AbstractInstruction *jumpFmtGt4;
-    AbstractInstruction *jumpFmtLt8;
-    AbstractInstruction *jumpLarge;
-    AbstractInstruction *jumpNotIndexable;
-    AbstractInstruction *jumpNotSI;
-    AbstractInstruction *jumpSI;
-
- /* begin MoveR:R: */
- genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
- jumpSI = genJumpSmallIntegerInScratchReg(TempReg);
- /* begin MoveR:R: */
- genoperandoperand(MoveRR, Arg0Reg, TempReg);
- /* begin MoveR:R: */
- genoperandoperand(MoveRR, Arg0Reg, Arg1Reg);
- jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
- jumpNotIndexable = genGetSizeOfintoformatRegscratchReg(ReceiverResultReg, ClassReg, SendNumArgsReg, TempReg);
  genConvertSmallIntegerToIntegerInScratchReg(Arg1Reg);
  /* begin SubCq:R: */
  genoperandoperand(SubCqR, 1, Arg1Reg);
@@ -9231,9 +9290,11 @@
  /* begin MoveMw:r:R: */
  genoperandoperandoperand(MoveMwrR, 0, ReceiverResultReg, ClassReg);
  /* begin LogicalShiftRightCq:R: */
- genoperandoperand(LogicalShiftRightCqR, 8, ClassReg);
+ quickConstant = instFormatFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, ClassReg);
  /* begin AndCq:R: */
- genoperandoperand(AndCqR, 15, ClassReg);
+ quickConstant1 = (1 << (instFormatFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant1, ClassReg);
  /* begin CmpCq:R: */
  genoperandoperand(CmpCqR, 4, ClassReg);
  /* begin JumpGreater: */
@@ -9281,7 +9342,7 @@
  genoperandoperand(MoveRR, TempReg, ReceiverResultReg);
  /* begin RetN: */
  genoperand(RetN, retNoffset);
- jmpTarget(jumpSI, jmpTarget(jumpNotSI, jmpTarget(jumpNotIndexable, jmpTarget(jumpBounds, gLabel()))));
+ jmpTarget(jumpSI, jmpTarget(jumpNotSI, jmpTarget(jumpNotIndexable, jmpTarget(jumpIsContext, jmpTarget(jumpBounds, gLabel())))));
  return 0;
 }
 
@@ -9293,20 +9354,111 @@
 static sqInt
 genInnerPrimitiveSize(sqInt retNoffset)
 {
+    sqInt jic;
+    AbstractInstruction *jmpFmtGe8;
+    sqInt jnx;
+    AbstractInstruction *jumpFmtIs2;
+    AbstractInstruction *jumpFmtLe4;
+    AbstractInstruction *jumpGotByteSize;
+    AbstractInstruction *jumpGotWordSize;
+    AbstractInstruction *jumpIsContext;
+    AbstractInstruction *jumpIsContext1;
     AbstractInstruction *jumpNotIndexable;
+    AbstractInstruction *jumpNotIndexable1;
     AbstractInstruction *jumpNotSI;
+    AbstractInstruction *jumpShortHeader;
+    AbstractInstruction *jumpSkip;
+    sqInt quickConstant;
+    sqInt quickConstant1;
+    sqInt quickConstant2;
+    sqInt quickConstant3;
 
  /* begin MoveR:R: */
  genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
  jumpNotSI = genJumpSmallIntegerInScratchReg(TempReg);
- jumpNotIndexable = genGetSizeOfintoformatRegscratchReg(ReceiverResultReg, ClassReg, SendNumArgsReg, TempReg);
+ /* begin genGetSizeOf:into:formatReg:scratchReg:abortJumpsInto: */
+ VM_LABEL(1genGetSizeOfintoformatRegscratchRegabortJumpsInto);
+ /* begin MoveMw:r:R: */
+ genoperandoperandoperand(MoveMwrR, 0, ReceiverResultReg, SendNumArgsReg);
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, SendNumArgsReg, ClassReg);
+ /* begin LogicalShiftRightCq:R: */
+ quickConstant = instFormatFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, SendNumArgsReg);
+ /* begin AndCq:R: */
+ quickConstant1 = (1 << (instFormatFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant1, SendNumArgsReg);
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, 2, SendNumArgsReg);
+ /* begin JumpLess: */
+ jumpNotIndexable1 = genoperand(JumpLess, ((sqInt)0));
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, ClassReg, TempReg);
+ /* begin LogicalShiftRightCq:R: */
+ quickConstant2 = compactClassFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant2, TempReg);
+ /* begin AndCq:R: */
+ quickConstant3 = (1 << (compactClassFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant3, TempReg);
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, ClassMethodContextCompactIndex, TempReg);
+ /* begin JumpZero: */
+ jumpIsContext1 = genoperand(JumpZero, ((sqInt)0));
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, ClassReg, TempReg);
+ /* begin AndCq:R: */
+ genoperandoperand(AndCqR, TypeMask, TempReg);
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, HeaderTypeSizeAndClass, TempReg);
+ /* begin JumpNonZero: */
+ jumpShortHeader = genoperand(JumpNonZero, ((sqInt)0));
+ assert(Size4Bit == 0);
+ /* begin MoveMw:r:R: */
+ genoperandoperandoperand(MoveMwrR, 0 - (2 * BytesPerWord), ReceiverResultReg, ClassReg);
+ /* begin AndCq:R: */
+ genoperandoperand(AndCqR, ((sqInt) LongSizeMask), ClassReg);
+ /* begin Jump: */
+ jumpSkip = genoperand(Jump, ((sqInt)0));
+ jmpTarget(jumpShortHeader, gAndCqR(SizeMask, ClassReg));
+ jmpTarget(jumpSkip, gSubCqR(BaseHeaderSize, ClassReg));
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, 4, SendNumArgsReg);
+ /* begin JumpLessOrEqual: */
+ jumpFmtLe4 = genoperand(JumpLessOrEqual, ((sqInt)0));
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, 8, SendNumArgsReg);
+ /* begin JumpLess: */
+ jmpFmtGe8 = genoperand(JumpLess, ((sqInt)0));
+ /* begin AndCq:R: */
+ genoperandoperand(AndCqR, 3, SendNumArgsReg);
+ /* begin SubR:R: */
+ genoperandoperand(SubRR, SendNumArgsReg, ClassReg);
+ /* begin Jump: */
+ jumpGotByteSize = genoperand(Jump, ((sqInt)0));
+ jmpTarget(jmpFmtGe8, gLogicalShiftRightCqR(2, ClassReg));
+ /* begin Jump: */
+ jumpGotWordSize = genoperand(Jump, ((sqInt)0));
+ jmpTarget(jumpFmtLe4, gLabel());
+ /* begin LogicalShiftRightCq:R: */
+ genoperandoperand(LogicalShiftRightCqR, ShiftForWord, ClassReg);
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, 2, SendNumArgsReg);
+ /* begin JumpZero: */
+ jumpFmtIs2 = genoperand(JumpZero, ((sqInt)0));
+ genGetFixedFieldsOfPointerNonIntintoscratchReg(ReceiverResultReg, SendNumArgsReg, TempReg);
+ /* begin SubR:R: */
+ genoperandoperand(SubRR, SendNumArgsReg, ClassReg);
+ jmpTarget(jumpFmtIs2, jmpTarget(jumpGotWordSize, jmpTarget(jumpGotByteSize, gLabel())));
+ jumpNotIndexable = jumpNotIndexable1;
+ jumpIsContext = jumpIsContext1;
+
  genConvertIntegerToSmallIntegerInScratchReg(ClassReg);
  /* begin MoveR:R: */
  genoperandoperand(MoveRR, ClassReg, ReceiverResultReg);
  flag("currently caller pushes result");
  /* begin RetN: */
  genoperand(RetN, retNoffset);
- jmpTarget(jumpNotSI, jmpTarget(jumpNotIndexable, gLabel()));
+ jmpTarget(jumpNotSI, jmpTarget(jumpNotIndexable, jmpTarget(jumpIsContext, gLabel())));
  return 0;
 }
 
@@ -9324,6 +9476,8 @@
     AbstractInstruction *jumpShortHeader;
     AbstractInstruction *jumpSI;
     AbstractInstruction *jumpSkip;
+    sqInt quickConstant;
+    sqInt quickConstant1;
 
  /* begin MoveR:R: */
  genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
@@ -9338,9 +9492,11 @@
  /* begin MoveR:R: */
  genoperandoperand(MoveRR, TempReg, ClassReg);
  /* begin LogicalShiftRightCq:R: */
- genoperandoperand(LogicalShiftRightCqR, 8, TempReg);
+ quickConstant = instFormatFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, TempReg);
  /* begin AndCq:R: */
- genoperandoperand(AndCqR, 15, TempReg);
+ quickConstant1 = (1 << (instFormatFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant1, TempReg);
  /* begin MoveR:R: */
  genoperandoperand(MoveRR, TempReg, SendNumArgsReg);
  /* begin AndCq:R: */
@@ -9905,8 +10061,13 @@
 static sqInt
 genPrimitiveAt(void)
 {
+    sqInt r;
+
  assert((numRegArgs()) >= 1);
- return genInnerPrimitiveAt(0);
+ if (((r = genInnerPrimitiveAt(0))) < 0) {
+ return r;
+ }
+ return compileInterpreterPrimitive(functionPointerForCompiledMethodprimitiveIndex(methodObj, primitiveIndex));
 }
 
 static sqInt
@@ -10502,14 +10663,24 @@
 static sqInt
 genPrimitiveSize(void)
 {
- return genInnerPrimitiveSize(0);
+    sqInt r;
+
+ if (((r = genInnerPrimitiveSize(0))) < 0) {
+ return r;
+ }
+ return compileInterpreterPrimitive(functionPointerForCompiledMethodprimitiveIndex(methodObj, primitiveIndex));
 }
 
 static sqInt
 genPrimitiveStringAt(void)
 {
+    sqInt r;
+
  assert((numRegArgs()) >= 1);
- return genInnerPrimitiveStringAt(0);
+ if (((r = genInnerPrimitiveStringAt(0))) < 0) {
+ return r;
+ }
+ return compileInterpreterPrimitive(functionPointerForCompiledMethodprimitiveIndex(methodObj, primitiveIndex));
 }
 
 static sqInt
@@ -12388,11 +12559,11 @@
  /* begin MoveMw:r:R: */
  genoperandoperandoperand(MoveMwrR, 0, sourceReg, destReg);
  /* begin LogicalShiftRightCq:R: */
- quickConstant1 = (compactClassFieldLSB()) - ShiftForWord;
- genoperandoperand(LogicalShiftRightCqR, quickConstant1, destReg);
+ quickConstant = (compactClassFieldLSB()) - ShiftForWord;
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, destReg);
  /* begin AndCq:R: */
- quickConstant = ((1 << (compactClassFieldWidth())) - 1) << ShiftForWord;
- genoperandoperand(AndCqR, quickConstant, destReg);
+ quickConstant1 = ((1 << (compactClassFieldWidth())) - 1) << ShiftForWord;
+ genoperandoperand(AndCqR, quickConstant1, destReg);
  /* begin JumpNonZero: */
  jumpCompact = genoperand(JumpNonZero, ((sqInt)0));
  /* begin MoveMw:r:R: */
@@ -12461,12 +12632,6 @@
 }
 
 static sqInt
-hasValidHeaderPostGC(CogMethod *cogMethod)
-{
- return ((cogMethod->objectHeader)) == (nullHeaderForMachineCodeMethod());
-}
-
-static sqInt
 incrementUsageOfTargetIfLinkedSendmcpcignored(sqInt annotation, char *mcpc, sqInt superfluity)
 {
     sqInt entryPoint;
@@ -12486,7 +12651,7 @@
  entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(0offsetAndSendTableForannotationinto);
+ VM_LABEL(1offsetAndSendTableForannotationinto);
 
 #      if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -13643,7 +13808,8 @@
  if (((cogMethod->cmType)) == CMMethod) {
  assert(((cogMethod->objectHeader)) == (nullHeaderForMachineCodeMethod()));
  (cogMethod->methodObject = remapOop((cogMethod->methodObject)));
- assert((rawHeaderOf((cogMethod->methodObject))) == (((sqInt)cogMethod)));
+ assert(((rawHeaderOf((cogMethod->methodObject))) == (((sqInt)cogMethod)))
+ || ((noAssertMethodClassAssociationOf((cogMethod->methodObject))) == (nilObject())));
  if (isYoung((cogMethod->methodObject))) {
  hasYoungObj = 1;
  }
@@ -14071,7 +14237,7 @@
  else {
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(1offsetAndSendTableForannotationinto);
+ VM_LABEL(2offsetAndSendTableForannotationinto);
 
 #        if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -14179,7 +14345,7 @@
  entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(2offsetAndSendTableForannotationinto);
+ VM_LABEL(3offsetAndSendTableForannotationinto);
 
 #      if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -14564,7 +14730,13 @@
  return 0;
 }
 
+static sqInt
+noAssertMethodClassAssociationOf(sqInt methodPointer)
+{
+ return literalofMethod((literalCountOfHeader(noAssertHeaderOf(methodPointer))) - 1, methodPointer);
+}
 
+
 /* Check that no metod is maximally marked. A maximal mark is an indication
  the method has been scanned to increase the usage count of its referent
  methods.  */
@@ -15366,7 +15538,7 @@
  return 0;
  }
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(3offsetAndSendTableForannotationinto);
+ VM_LABEL(4offsetAndSendTableForannotationinto);
 
 #    if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -16666,7 +16838,7 @@
  entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(4offsetAndSendTableForannotationinto);
+ VM_LABEL(5offsetAndSendTableForannotationinto);
 
 #      if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -16752,7 +16924,7 @@
  entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(5offsetAndSendTableForannotationinto);
+ VM_LABEL(6offsetAndSendTableForannotationinto);
 
 #      if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -16846,7 +17018,7 @@
 
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(6offsetAndSendTableForannotationinto);
+ VM_LABEL(7offsetAndSendTableForannotationinto);
 
 #      if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -16932,7 +17104,7 @@
  entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(7offsetAndSendTableForannotationinto);
+ VM_LABEL(8offsetAndSendTableForannotationinto);
 
 #      if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/nscogsrc/vm/cogit.h 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,5 +1,5 @@
 /* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGenerator VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
 
 

Modified: branches/Cog/nscogsrc/vm/cogmethod.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogmethod.h 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/nscogsrc/vm/cogmethod.h 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,5 +1,5 @@
 /* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGenerator VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
 
 typedef struct {

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/nscogsrc/vm/cointerp.c 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,9 +1,9 @@
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
    from
- CoInterpreter VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CoInterpreter VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -414,7 +414,6 @@
 sqInt classExternalFunction(void);
 sqInt classExternalLibrary(void);
 sqInt classExternalStructure(void);
-sqInt classFieldOffset(void);
 sqInt classFloat(void);
 sqInt classFloatCompactIndex(void);
 sqInt classHeader(sqInt oop);
@@ -435,8 +434,6 @@
 static void commonAtPut(sqInt stringy);
 static void commonAt(sqInt stringy);
 sqInt compactClassAt(sqInt ccIndex);
-sqInt compactClassFieldLSB(void);
-sqInt compactClassFieldWidth(void);
 sqInt compactClassIndexOfHeader(sqInt header);
 sqInt compactClassIndexOf(sqInt oop);
 sqInt compactClassTable(void);
@@ -580,7 +577,7 @@
 static void initializeObjectMemory(sqInt bytesToShift);
 static void initializeStacknumSlotspageSizestackLimitOffsetstackPageHeadroom(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage, sqInt stackLimitOffsetBytes, sqInt stackPageHeadroomBytes);
 static sqInt initStackPagesAndInterpret(void);
-static void installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy);
+static sqInt installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy);
 sqInt instanceSizeOf(sqInt classObj);
 sqInt instantiateClassindexableSize(sqInt classPointer, sqInt size);
 usqInt instructionPointerAddress(void);
@@ -597,6 +594,7 @@
 sqInt isCogMethodReference(sqInt methodHeader);
 sqInt isCompiledMethod(sqInt oop);
 static sqInt isContextHeader(sqInt aHeader);
+static sqInt isContextNonInt(sqInt oop);
 static sqInt isContext(sqInt oop);
 sqInt isFloatObject(sqInt oop);
 static sqInt isFree(StackPage * self_in_isFree);
@@ -641,6 +639,7 @@
 sqInt loadBitBltFrom(sqInt bb);
 static sqInt loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray);
 void loadInitialContext(void);
+void longPrintOop(sqInt oop);
 static sqInt lookupInMethodCacheSelclass(sqInt selector, sqInt class);
 static sqInt lookupMethodInClass(sqInt class);
 static sqInt lookupMethodInDictionary(sqInt dictionary);
@@ -695,8 +694,11 @@
 static StackPage * newStackPage(void);
 usqInt nextProfileTickAddress(void);
 sqInt nilObject(void);
+sqInt noAssertHeaderOf(sqInt methodPointer);
 static void noAtCacheCommonAtPut(sqInt stringy);
 static void noAtCacheCommonAt(sqInt stringy);
+static sqInt noInlineTemporaryin(sqInt offset, char *theFP);
+static void noInlineTemporaryinput(sqInt offset, char *theFP, sqInt valueOop);
 static sqInt noMarkedContextsOnPage(StackPage *thePage);
 static sqInt nonWeakFieldsOf(sqInt oop);
 sqInt nullHeaderForMachineCodeMethod(void);
@@ -1889,12 +1891,15 @@
  /* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.117";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.119";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
 
 /*** Macros ***/
+#define classFieldOffset() (0 - BaseHeaderSize)
+#define compactClassFieldLSB() 12
+#define compactClassFieldWidth() 5
 #define compilationBreakpoint(sel, len) do { \
  if ((len) == breakSelectorLength \
  && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, breakSelectorLength)) { \
@@ -1912,6 +1917,8 @@
 #define getCogCodeSize() integerObjectOf(GIV(cogCodeSize))
 #define getDesiredCogCodeSize() integerObjectOf(desiredCogCodeSize)
 #define initialEnterSmalltalkExecutive() enterSmalltalkExecutiveImplementation()
+#define instFormatFieldLSB() 8
+#define instFormatFieldWidth() 4
 #define memory() memory
 #define mostRecentlyUsedPage() GIV(mostRecentlyUsedPage)
 #define nextOpenPIC methodObject
@@ -1922,7 +1929,6 @@
 #define remapBufferCount() GIV(remapBufferCount)
 #define setDesiredCogCodeSize(dccs) (desiredCogCodeSize = (dccs))
 #define stackPageAtpages(index,pages) ((pages) + (index))
-#define typeEtAlWord(cm) (((long *)(cm))[1])
 #define validate() 0
 #define youngStart() GIV(youngStart)
 
@@ -7924,36 +7930,39 @@
  }
  }
  }
- /* begin commonVariable:at:cacheIndex: */
- VM_LABEL(0commonVariableatcacheIndex);
- stSize = GIV(atCache)[atIx + AtCacheSize];
- if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
- && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
- fmt = GIV(atCache)[atIx + AtCacheFmt];
- if (fmt <= 4) {
- fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
- result = longAt((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord));
- goto l78;
- }
- if (fmt < 8) {
+ if (!GIV(primFailCode)) {
+ /* begin commonVariable:at:cacheIndex: */
+ VM_LABEL(0commonVariableatcacheIndex);
+ stSize = GIV(atCache)[atIx + AtCacheSize];
+ if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
+ && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
+ fmt = GIV(atCache)[atIx + AtCacheFmt];
+ if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
+ fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
+ result = longAt((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord));
+ goto l78;
+ }
+ if (fmt < 8) {
 
- /* Bitmap */
+ /* Bitmap */
 
- result1 = long32At((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2));
- result = positive32BitIntegerFor(result1);
- goto l78;
+ result1 = long32At((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2));
+ result = positive32BitIntegerFor(result1);
+ goto l78;
+ }
+ if (fmt >= 16) {
+ result = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + ((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << ShiftForWord));
+ goto l78;
+ }
+ else {
+ result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
+ goto l78;
+ }
  }
- if (fmt >= 16) {
- result = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + ((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << ShiftForWord));
- goto l78;
- }
- else {
- result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
- goto l78;
- }
+ result = (GIV(primFailCode) = PrimErrBadIndex);
+ l78: /* end commonVariable:at:cacheIndex: */;
  }
- result = (GIV(primFailCode) = PrimErrBadIndex);
- l78: /* end commonVariable:at:cacheIndex: */;
  if (!GIV(primFailCode)) {
  /* begin fetchNextBytecode */
  currentBytecode = byteAtPointer(++localIP);
@@ -7961,6 +7970,8 @@
  longAtPointerput((localSP += (2 - 1) * BytesPerWord), result);
  goto l76;
  }
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
  }
  GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SpecialSelectors << ShiftForWord))) + BaseHeaderSize) + ((16 * 2) << ShiftForWord));
  GIV(argumentCount) = 1;
@@ -8023,59 +8034,62 @@
  }
  }
  }
- /* begin commonVariable:at:put:cacheIndex: */
- VM_LABEL(0commonVariableatputcacheIndex);
- stSize = GIV(atCache)[atIx + AtCacheSize];
- if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
- && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
- fmt = GIV(atCache)[atIx + AtCacheFmt];
- if (fmt <= 4) {
- fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
- /* begin storePointer:ofObject:withValue: */
- if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
- possibleRootStoreIntovalue(rcvr, value);
+ if (!GIV(primFailCode)) {
+ /* begin commonVariable:at:put:cacheIndex: */
+ VM_LABEL(0commonVariableatputcacheIndex);
+ stSize = GIV(atCache)[atIx + AtCacheSize];
+ if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
+ && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
+ fmt = GIV(atCache)[atIx + AtCacheFmt];
+ if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
+ fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
+ /* begin storePointer:ofObject:withValue: */
+ if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
+ possibleRootStoreIntovalue(rcvr, value);
+ }
+ longAtput((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord), value);
+ goto l80;
  }
- longAtput((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord), value);
- goto l80;
- }
- if (fmt < 8) {
+ if (fmt < 8) {
 
- /* Bitmap */
+ /* Bitmap */
 
- valToPut = positive32BitValueOf(value);
- if (!GIV(primFailCode)) {
- long32Atput((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2), valToPut);
+ valToPut = positive32BitValueOf(value);
+ if (!GIV(primFailCode)) {
+ long32Atput((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2), valToPut);
+ }
+ goto l80;
  }
- goto l80;
- }
- if (fmt >= 16) {
+ if (fmt >= 16) {
 
- /* Note fmt >= 16 is an artificial flag for strings */
+ /* Note fmt >= 16 is an artificial flag for strings */
 
- valToPut = asciiOfCharacter(value);
- if (!(!GIV(primFailCode))) {
- goto l80;
+ valToPut = asciiOfCharacter(value);
+ if (!(!GIV(primFailCode))) {
+ goto l80;
+ }
  }
- }
- else {
- valToPut = value;
- }
- if ((valToPut & 1)) {
- valToPut = (valToPut >> 1);
- if (!((valToPut >= 0)
- && (valToPut <= 255))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
+ else {
+ valToPut = value;
+ }
+ if ((valToPut & 1)) {
+ valToPut = (valToPut >> 1);
+ if (!((valToPut >= 0)
+ && (valToPut <= 255))) {
+ /* begin primitiveFail */
+ if (!GIV(primFailCode)) {
+ GIV(primFailCode) = 1;
+ }
+ goto l80;
  }
+ byteAtput((rcvr + BaseHeaderSize) + (((index >> 1)) - 1), valToPut);
  goto l80;
  }
- byteAtput((rcvr + BaseHeaderSize) + (((index >> 1)) - 1), valToPut);
- goto l80;
  }
+ GIV(primFailCode) = PrimErrBadIndex;
+ l80: /* end commonVariable:at:put:cacheIndex: */;
  }
- GIV(primFailCode) = PrimErrBadIndex;
- l80: /* end commonVariable:at:put:cacheIndex: */;
  if (!GIV(primFailCode)) {
  /* begin fetchNextBytecode */
  currentBytecode = byteAtPointer(++localIP);
@@ -8083,6 +8097,8 @@
  longAtPointerput((localSP += (3 - 1) * BytesPerWord), value);
  goto l79;
  }
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
  }
  GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SpecialSelectors << ShiftForWord))) + BaseHeaderSize) + ((17 * 2) << ShiftForWord));
  GIV(argumentCount) = 2;
@@ -11743,7 +11759,7 @@
  || ((heapMapAtWord(pointerForOop(fieldOop))) == 0)) {
  print("object leak in ");
  printHex(obj);
- print(" class ");
+ print(" class = ");
  printHex(fieldOop);
  /* begin cr */
  printf("\n");
@@ -11810,6 +11826,8 @@
  printHex(obj);
  print(" @ ");
  printNum(fi);
+ print(" = ");
+ printHex(fieldOop);
  /* begin cr */
  printf("\n");
  ok = 0;
@@ -12289,12 +12307,6 @@
 }
 
 sqInt
-classFieldOffset(void)
-{
- return 0 - BaseHeaderSize;
-}
-
-sqInt
 classFloat(void)
 {
  return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassFloat << ShiftForWord));
@@ -12644,7 +12656,12 @@
 
  atIx = (rcvr & AtCacheMask) + AtPutBase;
  if (!((GIV(atCache)[atIx + AtCacheOop]) == rcvr)) {
- installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy);
+ if (!(installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy))) {
+ assert(isContextNonInt(rcvr));
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
+ primitiveContextAtPut(); return;
+ }
  }
  if (!GIV(primFailCode)) {
  /* begin commonVariable:at:put:cacheIndex: */
@@ -12654,6 +12671,7 @@
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  fmt = GIV(atCache)[atIx + AtCacheFmt];
  if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
  fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
  /* begin storePointer:ofObject:withValue: */
  if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
@@ -12771,7 +12789,12 @@
 
  atIx = rcvr & AtCacheMask;
  if (!((GIV(atCache)[atIx + AtCacheOop]) == rcvr)) {
- installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy);
+ if (!(installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy))) {
+ assert(isContextNonInt(rcvr));
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
+ primitiveContextAt(); return;
+ }
  }
  if (!GIV(primFailCode)) {
  /* begin commonVariable:at:cacheIndex: */
@@ -12781,6 +12804,7 @@
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  fmt = GIV(atCache)[atIx + AtCacheFmt];
  if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
  fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
  result = longAt((rcvr + BaseHeaderSize) + (((index + fixedFields) - 1) << ShiftForWord));
  goto l1;
@@ -12842,18 +12866,6 @@
 }
 
 sqInt
-compactClassFieldLSB(void)
-{
- return 12;
-}
-
-sqInt
-compactClassFieldWidth(void)
-{
- return 5;
-}
-
-sqInt
 compactClassIndexOfHeader(sqInt header)
 {
  return (((usqInt) header) >> 12) & 31;
@@ -18695,10 +18707,12 @@
 }
 
 
-/* Install the oop of this object in the given cache (at or atPut), along
- with its size, format and fixedSize */
+/* Attempt to install the oop of this object in the given cache (at or
+ atPut), along with its size, format and fixedSize. Answer if this was
+ successful.
+ */
 
-static void
+static sqInt
 installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
@@ -18714,11 +18728,8 @@
  fmt = (((usqInt) hdr) >> 8) & 15;
  if ((fmt == 3)
  && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ GIV(primFailCode) = PrimErrBadReceiver;
+ return 0;
  }
  /* begin lengthOf:baseHeader:format: */
  if ((hdr & TypeMask) == HeaderTypeSizeAndClass) {
@@ -18770,6 +18781,7 @@
  : fmt));
  cache[atIx + AtCacheFixedFields] = fixedFields;
  cache[atIx + AtCacheSize] = (totalLength - fixedFields);
+ return 1;
 }
 
 
@@ -19265,6 +19277,12 @@
 }
 
 static sqInt
+isContextNonInt(sqInt oop)
+{
+ return ((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex;
+}
+
+static sqInt
 isContext(sqInt oop)
 {
  return ((oop & 1) == 0)
@@ -20287,7 +20305,103 @@
  GIV(instructionPointer) = ((sqInt) top);
 }
 
+void
+longPrintOop(sqInt oop)
+{
+    sqInt byte;
+    sqInt bytecodesPerLine;
+    sqInt fieldOop;
+    sqInt fmt;
+    sqInt header;
+    sqInt index;
+    sqInt lastIndex;
+    sqInt startIP;
+    sqInt sz;
 
+ if (((oop & 1))
+ || ((!(((oop >= heapBase) && (oop <= GIV(freeStart)))))
+ || (((oop & (BytesPerWord - 1)) != 0)
+ || ((((longAt(oop)) & TypeMask) == HeaderTypeFree)
+ || (((((fmt = (((usqInt) (longAt(oop))) >> 8) & 15)) >= 5) && (((fmt = (((usqInt) (longAt(oop))) >> 8) & 15)) <= 11))))))) {
+ printOop(oop); return;
+ }
+ printHex(oop);
+ print(": a(n) ");
+ printNameOfClasscount(fetchClassOfNonInt(oop), 5);
+ if (fmt > 4) {
+ print(" nbytes ");
+ printNum(byteSizeOf(oop));
+ }
+ /* begin cr */
+ printf("\n");
+ lastIndex = ((64 < ((startIP = ((sqInt) (lastPointerOf(oop)) >> 2)))) ? 64 : ((startIP = ((sqInt) (lastPointerOf(oop)) >> 2))));
+ if (lastIndex > 0) {
+ for (index = 1; index <= lastIndex; index += 1) {
+ fieldOop = longAt((oop + BaseHeaderSize) + ((index - 1) << ShiftForWord));
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printHex(fieldOop);
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printOopShort(fieldOop);
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ if (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12) {
+ startIP = (startIP * BytesPerWord) + 1;
+ /* begin lengthOf: */
+ header = longAt(oop);
+ /* begin lengthOf:baseHeader:format: */
+ if ((header & TypeMask) == HeaderTypeSizeAndClass) {
+ sz = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
+ }
+ else {
+ sz = header & SizeMask;
+ }
+ sz -= header & Size4Bit;
+ if (((((usqInt) header) >> 8) & 15) <= 4) {
+ lastIndex = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+ goto l1;
+ }
+ if (((((usqInt) header) >> 8) & 15) < 8) {
+ lastIndex = ((usqInt) (sz - BaseHeaderSize)) >> 2;
+ goto l1;
+ }
+ else {
+ lastIndex = (sz - BaseHeaderSize) - (((((usqInt) header) >> 8) & 15) & 3);
+ goto l1;
+ }
+ l1: /* end lengthOf: */;
+ if ((lastIndex - startIP) > 100) {
+ lastIndex = startIP + 100;
+ }
+ bytecodesPerLine = 8;
+ for (index = startIP; index <= lastIndex; index += 1) {
+ byte = byteAt((oop + BaseHeaderSize) + (index - 1));
+ printf(" %02x/%-3d", byte,byte);
+ if ((((index - startIP) + 1) % bytecodesPerLine) == 0) {
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ if (!((((lastIndex - startIP) + 1) % bytecodesPerLine) == 0)) {
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ else {
+ if (startIP > 64) {
+ print("...");
+ /* begin cr */
+ printf("\n");
+ }
+ }
+}
+
+
 /* This method implements a simple method lookup cache. If an entry for the
  given selector and class is found in the cache, set the values of
  'newMethod' and 'primitiveFunctionPointer' and return true. Otherwise,
@@ -22718,7 +22832,18 @@
  return GIV(nilObj);
 }
 
+sqInt
+noAssertHeaderOf(sqInt methodPointer)
+{
+    sqInt methodHeader;
 
+ methodHeader = longAt((methodPointer + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+ return (isCogMethodReference(methodHeader)
+ ? (((CogMethod *) methodHeader)->methodHeader)
+ : methodHeader);
+}
+
+
 /* This code is called if the receiver responds primitively to at:Put:.
  The cogit can implement at: & at:put: quickly in machine code, and needs a
  backup that provides error codes. But it does not want the at cache so it
@@ -22803,7 +22928,47 @@
  }
 }
 
+static sqInt
+noInlineTemporaryin(sqInt offset, char *theFP)
+{
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
 
+ return ((((usqInt)(longAt(theFP + FoxMethod)))) < heapBase
+ ? (offset < ((frameNumArgs = (mframeCogMethod(theFP)->cmNumArgs)))
+ ? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs - offset) * BytesPerWord))
+ : longAt(((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - offset) * BytesPerWord)))
+ : (offset < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))
+ ? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - offset) * BytesPerWord))
+ : longAt(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - offset) * BytesPerWord))));
+}
+
+static void
+noInlineTemporaryinput(sqInt offset, char *theFP, sqInt valueOop)
+{
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
+
+ /* begin temporary:in:put: */
+ VM_LABEL(0temporaryinput);
+ if ((((usqInt)(longAt(theFP + FoxMethod)))) < heapBase) {
+ /* begin mtemporary:in:put: */
+ longAtput((offset < ((frameNumArgs = (mframeCogMethod(theFP)->cmNumArgs)))
+ ? (theFP + FoxCallerSavedIP) + ((frameNumArgs - offset) * BytesPerWord)
+ : ((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - offset) * BytesPerWord)), valueOop);
+ }
+ else {
+ /* begin itemporary:in:put: */
+ if (offset < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))) {
+ longAtput((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - offset) * BytesPerWord), valueOop);
+ }
+ else {
+ longAtput(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - offset) * BytesPerWord), valueOop);
+ }
+ }
+}
+
+
 /* Answer true if there are no marked contexts on thePage. */
 
 static sqInt
@@ -25141,7 +25306,7 @@
     sqInt methodHeader;
     sqInt newCopy;
     sqInt objHeader;
-    sqInt receiver;
+    sqInt rcvr;
     char *sp;
     sqInt sp1;
     char *spouseFP;
@@ -25149,29 +25314,29 @@
     sqInt valuePointer;
     sqInt valuePointer1;
 
- receiver = longAt(GIV(stackPointer));
- if ((receiver & 1)) {
- newCopy = receiver;
+ rcvr = longAt(GIV(stackPointer));
+ if ((rcvr & 1)) {
+ newCopy = rcvr;
  }
  else {
- objHeader = longAt(receiver);
+ objHeader = longAt(rcvr);
  if (((((usqInt) objHeader) >> 12) & 31) == ClassMethodContextCompactIndex) {
  /* begin cloneContext: */
  VM_LABEL(0cloneContext);
- cloned = eeInstantiateMethodContextByteSize(byteSizeOf(receiver));
+ cloned = eeInstantiateMethodContextByteSize(byteSizeOf(rcvr));
  if (cloned != 0) {
  for (i = 0; i <= StackPointerIndex; i += 1) {
  /* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer = externalInstVarofContext(i, receiver);
+ valuePointer = externalInstVarofContext(i, rcvr);
  longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), valuePointer);
  }
  for (i = MethodIndex; i <= ReceiverIndex; i += 1) {
- longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), longAt((receiver + BaseHeaderSize) + (i << ShiftForWord)));
+ longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), longAt((rcvr + BaseHeaderSize) + (i << ShiftForWord)));
  }
- if ((((longAt((receiver + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
- && (!(isWidowedContext(receiver)))) {
+ if ((((longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(rcvr)))) {
  /* begin frameOfMarriedContext: */
- value = longAt((receiver + BaseHeaderSize) + (SenderIndex << ShiftForWord));
+ value = longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord));
  /* begin withoutSmallIntegerTags: */
  assert((value & 1));
  spouseFP = pointerForOop(value - 1);
@@ -25189,16 +25354,16 @@
  }
  }
  else {
- sp1 = (fetchStackPointerOf(receiver)) - 1;
+ sp1 = (fetchStackPointerOf(rcvr)) - 1;
  for (i = 0; i <= sp1; i += 1) {
- longAtput((cloned + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord), longAt((receiver + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord)));
+ longAtput((cloned + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord), longAt((rcvr + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord)));
  }
  }
  }
  newCopy = cloned;
  }
  else {
- newCopy = clone(receiver);
+ newCopy = clone(rcvr);
  }
  if (newCopy == 0) {
  (GIV(primFailCode) = PrimErrNoMemory); return;
@@ -26131,6 +26296,10 @@
  }
 }
 
+
+/* Special version of primitiveAt for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static void
 primitiveContextAt(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -26158,11 +26327,7 @@
 
  index = longAt(GIV(stackPointer));
  if (!((index & 1))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadArgument); return;
  }
  index = (index >> 1);
 
@@ -26176,7 +26341,7 @@
 
  value = stObjectat(aContext, index);
  /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp = GIV(stackPointer) + ((GIV(argumentCount) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp;
  return;
  }
@@ -26258,11 +26423,7 @@
  stSize = (sp11 >> 1);
  l5: /* end stackPointerForMaybeMarriedContext: */;
  if (!(((index >= 1) && (index <= stSize)))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadIndex); return;
  }
  /* begin subscript:with:format: */
  if (fmt <= 4) {
@@ -26279,7 +26440,7 @@
  }
  l3: /* end subscript:with:format: */;
  /* begin pop:thenPush: */
- longAtput((sp1 = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp1;
  return;
  }
@@ -26289,11 +26450,7 @@
  assert((value1 & 1));
  spouseFP = pointerForOop(value1 - 1);
  if (!(((index >= 1) && (index <= (stackPointerIndexForFrame(spouseFP)))))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadIndex); return;
  }
  value = ((((usqInt)(longAt(spouseFP + FoxMethod)))) < heapBase
  ? ((index - 1) < ((frameNumArgs = (mframeCogMethod(spouseFP)->cmNumArgs)))
@@ -26303,10 +26460,14 @@
  ? longAt((spouseFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - 1)) * BytesPerWord))
  : longAt(((spouseFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - 1)) * BytesPerWord))));
  /* begin pop:thenPush: */
- longAtput((sp2 = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp2;
 }
 
+
+/* Special version of primitiveAtPut for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static sqInt
 primitiveContextAtPut(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -26337,18 +26498,14 @@
  index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
  aContext = longAt(GIV(stackPointer) + (2 * BytesPerWord));
  if (!((index & 1))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadArgument);
  }
  hdr = longAt(aContext);
  index = (index >> 1);
  if (!(((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
  stObjectatput(aContext, index, value);
  /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp;
  return null;
  }
@@ -26430,11 +26587,7 @@
  stSize = (sp11 >> 1);
  l4: /* end stackPointerForMaybeMarriedContext: */;
  if (!(((index >= 1) && (index <= stSize)))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadIndex);
  }
  /* begin subscript:with:storing:format: */
  VM_LABEL(0subscriptwithstoringformat);
@@ -26486,7 +26639,7 @@
  }
  }
  /* begin pop:thenPush: */
- longAtput((sp1 = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp1;
  return null;
  }
@@ -26496,15 +26649,10 @@
  assert((value1 & 1));
  spouseFP = pointerForOop(value1 - 1);
  if (!(((index >= 1) && (index <= (stackPointerIndexForFrame(spouseFP)))))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadIndex);
  }
  /* begin temporary:in:put: */
- VM_LABEL(0temporaryinput);
- ;
+ VM_LABEL(1temporaryinput);
  if ((((usqInt)(longAt(spouseFP + FoxMethod)))) < heapBase) {
  /* begin mtemporary:in:put: */
  longAtput(((index - 1) < ((frameNumArgs = (mframeCogMethod(spouseFP)->cmNumArgs)))
@@ -26521,11 +26669,15 @@
  }
  }
  /* begin pop:thenPush: */
- longAtput((sp2 = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp2;
  return null;
 }
 
+
+/* Special version of primitiveSize for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static void
 primitiveContextSize(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -26625,11 +26777,9 @@
  else {
  sz = totalLength - fixedFields;
  }
- if (!GIV(primFailCode)) {
- /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), ((sz << 1) | 1));
- GIV(stackPointer) = sp;
- }
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((sz << 1) | 1));
+ GIV(stackPointer) = sp;
 }
 
 
@@ -35122,31 +35272,77 @@
 static void
 primitiveSize(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt ccIndex;
+    sqInt class;
+    sqInt classFormat;
+    sqInt fixedFields;
+    sqInt fmt;
+    sqInt hdr;
     sqInt rcvr;
     char *sp;
     sqInt sz;
+    sqInt totalLength;
 
  rcvr = longAt(GIV(stackPointer));
- if ((rcvr & 1)) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ if (((rcvr & 1))
+ || ((
+ /* Integers are not indexable */
+
+(hdr = longAt(rcvr)),
+ ((fmt = (((usqInt) hdr) >> 8) & 15)) < 2))) {
+ (GIV(primFailCode) = PrimErrBadReceiver); return;
  }
- if (((((usqInt) (longAt(rcvr))) >> 8) & 15) < 2) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ primitiveContextSize(); return;
  }
- sz = stSizeOf(rcvr);
- if (!GIV(primFailCode)) {
- /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((sz << 1) | 1));
- GIV(stackPointer) = sp;
+ /* begin lengthOf:baseHeader:format: */
+ if ((hdr & TypeMask) == HeaderTypeSizeAndClass) {
+ sz = (longAt(rcvr - (BytesPerWord * 2))) & LongSizeMask;
  }
+ else {
+ sz = hdr & SizeMask;
+ }
+ sz -= hdr & Size4Bit;
+ if (fmt <= 4) {
+ totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+ goto l1;
+ }
+ if (fmt < 8) {
+ totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
+ goto l1;
+ }
+ else {
+ totalLength = (sz - BaseHeaderSize) - (fmt & 3);
+ goto l1;
+ }
+l1: /* end lengthOf:baseHeader:format: */;
+ /* begin fixedFieldsOf:format:length: */
+ if ((fmt > 4)
+ || (fmt == 2)) {
+ fixedFields = 0;
+ goto l2;
+ }
+ if (fmt < 2) {
+ fixedFields = totalLength;
+ goto l2;
+ }
+ /* begin fetchClassOfNonInt: */
+ if (((ccIndex = (((usqInt) (longAt(rcvr))) >> 12) & 31)) == 0) {
+ class = (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask;
+ goto l3;
+ }
+ else {
+ class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
+ goto l3;
+ }
+l3: /* end fetchClassOfNonInt: */;
+ classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
+ fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
+l2: /* end fixedFieldsOf:format:length: */;
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((totalLength - fixedFields) << 1) | 1));
+ GIV(stackPointer) = sp;
 }
 
 
@@ -38908,6 +39104,7 @@
 printMethodDictionaryOf(sqInt behavior)
 {
     sqInt index;
+    sqInt meth;
     sqInt methodArray;
     sqInt selector;
 
@@ -38917,9 +39114,15 @@
  for (index = SelectorStart; index <= ((fetchWordLengthOf(longAt((behavior + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord)))) - 1); index += 1) {
  selector = longAt(((longAt((behavior + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord))) + BaseHeaderSize) + (index << ShiftForWord));
  if (selector != GIV(nilObj)) {
+ meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
  printOopShort(selector);
  print(" => ");
- printOopShort(longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord)));
+ printOopShort(meth);
+ print(" (");
+ printHex(selector);
+ print(" => ");
+ printHex(meth);
+ putchar(')');
  /* begin cr */
  printf("\n");
  }
@@ -38930,6 +39133,7 @@
 printMethodDictionary(sqInt dictionary)
 {
     sqInt index;
+    sqInt meth;
     sqInt methodArray;
     sqInt selector;
 
@@ -38937,9 +39141,15 @@
  for (index = SelectorStart; index <= ((fetchWordLengthOf(dictionary)) - 1); index += 1) {
  selector = longAt((dictionary + BaseHeaderSize) + (index << ShiftForWord));
  if (selector != GIV(nilObj)) {
+ meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
  printOopShort(selector);
  print(" => ");
- printOopShort(longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord)));
+ printOopShort(meth);
+ print(" (");
+ printHex(selector);
+ print(" => ");
+ printHex(meth);
+ putchar(')');
  /* begin cr */
  printf("\n");
  }
@@ -42987,6 +43197,7 @@
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
+    sqInt sp;
     sqInt stSize;
     sqInt sz;
     sqInt totalLength;
@@ -43003,44 +43214,61 @@
  sz -= hdr & Size4Bit;
  if (fmt <= 4) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
- goto l1;
+ goto l2;
  }
  if (fmt < 8) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
- goto l1;
+ goto l2;
  }
  else {
  totalLength = (sz - BaseHeaderSize) - (fmt & 3);
- goto l1;
+ goto l2;
  }
-l1: /* end lengthOf:baseHeader:format: */;
+l2: /* end lengthOf:baseHeader:format: */;
  /* begin fixedFieldsOf:format:length: */
  if ((fmt > 4)
  || (fmt == 2)) {
  fixedFields = 0;
- goto l2;
+ goto l3;
  }
  if (fmt < 2) {
  fixedFields = totalLength;
- goto l2;
+ goto l3;
  }
  /* begin fetchClassOfNonInt: */
  if (((ccIndex = (((usqInt) (longAt(array))) >> 12) & 31)) == 0) {
  class = (longAt(array - BaseHeaderSize)) & AllButTypeMask;
- goto l3;
+ goto l4;
  }
  else {
  class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
- goto l3;
+ goto l4;
  }
-l3: /* end fetchClassOfNonInt: */;
+l4: /* end fetchClassOfNonInt: */;
  classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
  fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
-l2: /* end fixedFieldsOf:format:length: */;
- if (fmt == 3) {
- assert(!(isContextHeader(hdr)));
+l3: /* end fixedFieldsOf:format:length: */;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ /* begin fetchStackPointerOf: */
+ sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord));
+ if (!((sp & 1))) {
+ stSize = 0;
+ goto l1;
+ }
+ assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array)));
+ stSize = (sp >> 1);
+ l1: /* end fetchStackPointerOf: */;
+ if (((((usqInt) index)) >= (((usqInt) 1)))
+ && (((((usqInt) index)) <= (((usqInt) stSize)))
+ && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(array)))))) {
+ return noInlineTemporaryin(index - 1, frameOfMarriedContext(array));
+ }
  }
- stSize = totalLength - fixedFields;
+ else {
+ stSize = totalLength - fixedFields;
+ }
  if (((((usqInt) index)) >= (((usqInt) 1)))
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  /* begin subscript:with:format: */
@@ -43072,6 +43300,7 @@
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
+    sqInt sp;
     sqInt stSize;
     sqInt sz;
     sqInt totalLength;
@@ -43089,44 +43318,62 @@
  sz -= hdr & Size4Bit;
  if (fmt <= 4) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
- goto l1;
+ goto l2;
  }
  if (fmt < 8) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
- goto l1;
+ goto l2;
  }
  else {
  totalLength = (sz - BaseHeaderSize) - (fmt & 3);
- goto l1;
+ goto l2;
  }
-l1: /* end lengthOf:baseHeader:format: */;
+l2: /* end lengthOf:baseHeader:format: */;
  /* begin fixedFieldsOf:format:length: */
  if ((fmt > 4)
  || (fmt == 2)) {
  fixedFields = 0;
- goto l2;
+ goto l3;
  }
  if (fmt < 2) {
  fixedFields = totalLength;
- goto l2;
+ goto l3;
  }
  /* begin fetchClassOfNonInt: */
  if (((ccIndex = (((usqInt) (longAt(array))) >> 12) & 31)) == 0) {
  class = (longAt(array - BaseHeaderSize)) & AllButTypeMask;
- goto l3;
+ goto l4;
  }
  else {
  class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
- goto l3;
+ goto l4;
  }
-l3: /* end fetchClassOfNonInt: */;
+l4: /* end fetchClassOfNonInt: */;
  classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
  fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
-l2: /* end fixedFieldsOf:format:length: */;
- if (fmt == 3) {
- assert(!(isContextHeader(hdr)));
+l3: /* end fixedFieldsOf:format:length: */;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ /* begin fetchStackPointerOf: */
+ sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord));
+ if (!((sp & 1))) {
+ stSize = 0;
+ goto l1;
+ }
+ assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array)));
+ stSize = (sp >> 1);
+ l1: /* end fetchStackPointerOf: */;
+ if (((((usqInt) index)) >= (((usqInt) 1)))
+ && (((((usqInt) index)) <= (((usqInt) stSize)))
+ && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(array)))))) {
+ noInlineTemporaryinput(index - 1, frameOfMarriedContext(array), value);
+ return;
+ }
  }
- stSize = totalLength - fixedFields;
+ else {
+ stSize = totalLength - fixedFields;
+ }
  if (((((usqInt) index)) >= (((usqInt) 1)))
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  /* begin subscript:with:storing:format: */

Modified: branches/Cog/nscogsrc/vm/cointerp.h
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.h 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/nscogsrc/vm/cointerp.h 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,5 +1,5 @@
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
 
 
@@ -45,7 +45,6 @@
 void checkAssertsEnabledInCoInterpreter(void);
 sqInt checkedLongAt(sqInt byteAddress);
 sqInt classArray(void);
-sqInt classFieldOffset(void);
 sqInt classFloat(void);
 sqInt classFloatCompactIndex(void);
 sqInt classHeader(sqInt oop);
@@ -53,8 +52,6 @@
 void clearTraceLog(void);
 CogMethod * cogMethodOf(sqInt aMethodOop);
 sqInt compactClassAt(sqInt ccIndex);
-sqInt compactClassFieldLSB(void);
-sqInt compactClassFieldWidth(void);
 sqInt compactClassIndexOfHeader(sqInt header);
 sqInt compactClassIndexOf(sqInt oop);
 sqInt compactClassTable(void);
@@ -103,6 +100,7 @@
 sqInt lengthOf(sqInt oop);
 sqInt literalCountOfHeader(sqInt headerPointer);
 sqInt literalofMethod(sqInt offset, sqInt methodPointer);
+void longPrintOop(sqInt oop);
 sqInt lookupreceiver(sqInt selector, sqInt rcvr);
 void markActiveMethodsAndReferents(void);
 void markAndTrace(sqInt oop);
@@ -119,6 +117,7 @@
 usqInt newMethodAddress(void);
 usqInt nextProfileTickAddress(void);
 sqInt nilObject(void);
+sqInt noAssertHeaderOf(sqInt methodPointer);
 sqInt nullHeaderForMachineCodeMethod(void);
 sqInt objectAfter(sqInt oop);
 sqInt objectBefore(sqInt address);
@@ -210,6 +209,9 @@
 
 
 /*** Macros ***/
+#define classFieldOffset() (0 - BaseHeaderSize)
+#define compactClassFieldLSB() 12
+#define compactClassFieldWidth() 5
 #define compilationBreakpoint(sel, len) do { \
  if ((len) == breakSelectorLength \
  && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, breakSelectorLength)) { \
@@ -217,4 +219,6 @@
  compilationBreakpointFor(sel); \
  } \
 } while (0)
+#define instFormatFieldLSB() 8
+#define instFormatFieldWidth() 4
 

Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2011-08-19 21:33:12 UTC (rev 2488)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
    from
- CoInterpreter VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CoInterpreter VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -417,7 +417,6 @@
 sqInt classExternalFunction(void);
 sqInt classExternalLibrary(void);
 sqInt classExternalStructure(void);
-sqInt classFieldOffset(void);
 sqInt classFloat(void);
 sqInt classFloatCompactIndex(void);
 sqInt classHeader(sqInt oop);
@@ -438,8 +437,6 @@
 static void commonAtPut(sqInt stringy);
 static void commonAt(sqInt stringy);
 sqInt compactClassAt(sqInt ccIndex);
-sqInt compactClassFieldLSB(void);
-sqInt compactClassFieldWidth(void);
 sqInt compactClassIndexOfHeader(sqInt header);
 sqInt compactClassIndexOf(sqInt oop);
 sqInt compactClassTable(void);
@@ -583,7 +580,7 @@
 static void initializeObjectMemory(sqInt bytesToShift);
 static void initializeStacknumSlotspageSizestackLimitOffsetstackPageHeadroom(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage, sqInt stackLimitOffsetBytes, sqInt stackPageHeadroomBytes);
 static sqInt initStackPagesAndInterpret(void);
-static void installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy);
+static sqInt installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy);
 sqInt instanceSizeOf(sqInt classObj);
 sqInt instantiateClassindexableSize(sqInt classPointer, sqInt size);
 usqInt instructionPointerAddress(void);
@@ -600,6 +597,7 @@
 sqInt isCogMethodReference(sqInt methodHeader);
 sqInt isCompiledMethod(sqInt oop);
 static sqInt isContextHeader(sqInt aHeader);
+static sqInt isContextNonInt(sqInt oop);
 static sqInt isContext(sqInt oop);
 sqInt isFloatObject(sqInt oop);
 static sqInt isFree(StackPage * self_in_isFree);
@@ -644,6 +642,7 @@
 sqInt loadBitBltFrom(sqInt bb);
 static sqInt loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray);
 void loadInitialContext(void);
+void longPrintOop(sqInt oop);
 static sqInt lookupInMethodCacheSelclass(sqInt selector, sqInt class);
 static sqInt lookupMethodInClass(sqInt class);
 static sqInt lookupMethodInDictionary(sqInt dictionary);
@@ -698,8 +697,11 @@
 static StackPage * newStackPage(void);
 usqInt nextProfileTickAddress(void);
 sqInt nilObject(void);
+sqInt noAssertHeaderOf(sqInt methodPointer);
 static void noAtCacheCommonAtPut(sqInt stringy);
 static void noAtCacheCommonAt(sqInt stringy);
+static sqInt noInlineTemporaryin(sqInt offset, char *theFP);
+static void noInlineTemporaryinput(sqInt offset, char *theFP, sqInt valueOop);
 static sqInt noMarkedContextsOnPage(StackPage *thePage);
 static sqInt nonWeakFieldsOf(sqInt oop);
 sqInt nullHeaderForMachineCodeMethod(void);
@@ -1892,12 +1894,15 @@
  /* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.117";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.119";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
 
 /*** Macros ***/
+#define classFieldOffset() (0 - BaseHeaderSize)
+#define compactClassFieldLSB() 12
+#define compactClassFieldWidth() 5
 #define compilationBreakpoint(sel, len) do { \
  if ((len) == breakSelectorLength \
  && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, breakSelectorLength)) { \
@@ -1915,6 +1920,8 @@
 #define getCogCodeSize() integerObjectOf(GIV(cogCodeSize))
 #define getDesiredCogCodeSize() integerObjectOf(desiredCogCodeSize)
 #define initialEnterSmalltalkExecutive() enterSmalltalkExecutiveImplementation()
+#define instFormatFieldLSB() 8
+#define instFormatFieldWidth() 4
 #define memory() memory
 #define mostRecentlyUsedPage() GIV(mostRecentlyUsedPage)
 #define nextOpenPIC methodObject
@@ -1925,7 +1932,6 @@
 #define remapBufferCount() GIV(remapBufferCount)
 #define setDesiredCogCodeSize(dccs) (desiredCogCodeSize = (dccs))
 #define stackPageAtpages(index,pages) ((pages) + (index))
-#define typeEtAlWord(cm) (((long *)(cm))[1])
 #define validate() 0
 #define youngStart() GIV(youngStart)
 
@@ -7928,36 +7934,39 @@
  }
  }
  }
- /* begin commonVariable:at:cacheIndex: */
- VM_LABEL(0commonVariableatcacheIndex);
- stSize = GIV(atCache)[atIx + AtCacheSize];
- if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
- && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
- fmt = GIV(atCache)[atIx + AtCacheFmt];
- if (fmt <= 4) {
- fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
- result = longAt((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord));
- goto l78;
- }
- if (fmt < 8) {
+ if (!GIV(primFailCode)) {
+ /* begin commonVariable:at:cacheIndex: */
+ VM_LABEL(0commonVariableatcacheIndex);
+ stSize = GIV(atCache)[atIx + AtCacheSize];
+ if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
+ && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
+ fmt = GIV(atCache)[atIx + AtCacheFmt];
+ if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
+ fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
+ result = longAt((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord));
+ goto l78;
+ }
+ if (fmt < 8) {
 
- /* Bitmap */
+ /* Bitmap */
 
- result1 = long32At((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2));
- result = positive32BitIntegerFor(result1);
- goto l78;
+ result1 = long32At((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2));
+ result = positive32BitIntegerFor(result1);
+ goto l78;
+ }
+ if (fmt >= 16) {
+ result = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + ((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << ShiftForWord));
+ goto l78;
+ }
+ else {
+ result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
+ goto l78;
+ }
  }
- if (fmt >= 16) {
- result = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + ((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << ShiftForWord));
- goto l78;
- }
- else {
- result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
- goto l78;
- }
+ result = (GIV(primFailCode) = PrimErrBadIndex);
+ l78: /* end commonVariable:at:cacheIndex: */;
  }
- result = (GIV(primFailCode) = PrimErrBadIndex);
- l78: /* end commonVariable:at:cacheIndex: */;
  if (!GIV(primFailCode)) {
  /* begin fetchNextBytecode */
  currentBytecode = byteAtPointer(++localIP);
@@ -7965,6 +7974,8 @@
  longAtPointerput((localSP += (2 - 1) * BytesPerWord), result);
  goto l76;
  }
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
  }
  GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SpecialSelectors << ShiftForWord))) + BaseHeaderSize) + ((16 * 2) << ShiftForWord));
  GIV(argumentCount) = 1;
@@ -8027,59 +8038,62 @@
  }
  }
  }
- /* begin commonVariable:at:put:cacheIndex: */
- VM_LABEL(0commonVariableatputcacheIndex);
- stSize = GIV(atCache)[atIx + AtCacheSize];
- if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
- && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
- fmt = GIV(atCache)[atIx + AtCacheFmt];
- if (fmt <= 4) {
- fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
- /* begin storePointer:ofObject:withValue: */
- if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
- possibleRootStoreIntovalue(rcvr, value);
+ if (!GIV(primFailCode)) {
+ /* begin commonVariable:at:put:cacheIndex: */
+ VM_LABEL(0commonVariableatputcacheIndex);
+ stSize = GIV(atCache)[atIx + AtCacheSize];
+ if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
+ && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
+ fmt = GIV(atCache)[atIx + AtCacheFmt];
+ if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
+ fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
+ /* begin storePointer:ofObject:withValue: */
+ if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
+ possibleRootStoreIntovalue(rcvr, value);
+ }
+ longAtput((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord), value);
+ goto l80;
  }
- longAtput((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord), value);
- goto l80;
- }
- if (fmt < 8) {
+ if (fmt < 8) {
 
- /* Bitmap */
+ /* Bitmap */
 
- valToPut = positive32BitValueOf(value);
- if (!GIV(primFailCode)) {
- long32Atput((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2), valToPut);
+ valToPut = positive32BitValueOf(value);
+ if (!GIV(primFailCode)) {
+ long32Atput((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2), valToPut);
+ }
+ goto l80;
  }
- goto l80;
- }
- if (fmt >= 16) {
+ if (fmt >= 16) {
 
- /* Note fmt >= 16 is an artificial flag for strings */
+ /* Note fmt >= 16 is an artificial flag for strings */
 
- valToPut = asciiOfCharacter(value);
- if (!(!GIV(primFailCode))) {
- goto l80;
+ valToPut = asciiOfCharacter(value);
+ if (!(!GIV(primFailCode))) {
+ goto l80;
+ }
  }
- }
- else {
- valToPut = value;
- }
- if ((valToPut & 1)) {
- valToPut = (valToPut >> 1);
- if (!((valToPut >= 0)
- && (valToPut <= 255))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
+ else {
+ valToPut = value;
+ }
+ if ((valToPut & 1)) {
+ valToPut = (valToPut >> 1);
+ if (!((valToPut >= 0)
+ && (valToPut <= 255))) {
+ /* begin primitiveFail */
+ if (!GIV(primFailCode)) {
+ GIV(primFailCode) = 1;
+ }
+ goto l80;
  }
+ byteAtput((rcvr + BaseHeaderSize) + (((index >> 1)) - 1), valToPut);
  goto l80;
  }
- byteAtput((rcvr + BaseHeaderSize) + (((index >> 1)) - 1), valToPut);
- goto l80;
  }
+ GIV(primFailCode) = PrimErrBadIndex;
+ l80: /* end commonVariable:at:put:cacheIndex: */;
  }
- GIV(primFailCode) = PrimErrBadIndex;
- l80: /* end commonVariable:at:put:cacheIndex: */;
  if (!GIV(primFailCode)) {
  /* begin fetchNextBytecode */
  currentBytecode = byteAtPointer(++localIP);
@@ -8087,6 +8101,8 @@
  longAtPointerput((localSP += (3 - 1) * BytesPerWord), value);
  goto l79;
  }
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
  }
  GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SpecialSelectors << ShiftForWord))) + BaseHeaderSize) + ((17 * 2) << ShiftForWord));
  GIV(argumentCount) = 2;
@@ -11747,7 +11763,7 @@
  || ((heapMapAtWord(pointerForOop(fieldOop))) == 0)) {
  print("object leak in ");
  printHex(obj);
- print(" class ");
+ print(" class = ");
  printHex(fieldOop);
  /* begin cr */
  printf("\n");
@@ -11814,6 +11830,8 @@
  printHex(obj);
  print(" @ ");
  printNum(fi);
+ print(" = ");
+ printHex(fieldOop);
  /* begin cr */
  printf("\n");
  ok = 0;
@@ -12293,12 +12311,6 @@
 }
 
 sqInt
-classFieldOffset(void)
-{
- return 0 - BaseHeaderSize;
-}
-
-sqInt
 classFloat(void)
 {
  return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassFloat << ShiftForWord));
@@ -12648,7 +12660,12 @@
 
  atIx = (rcvr & AtCacheMask) + AtPutBase;
  if (!((GIV(atCache)[atIx + AtCacheOop]) == rcvr)) {
- installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy);
+ if (!(installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy))) {
+ assert(isContextNonInt(rcvr));
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
+ primitiveContextAtPut(); return;
+ }
  }
  if (!GIV(primFailCode)) {
  /* begin commonVariable:at:put:cacheIndex: */
@@ -12658,6 +12675,7 @@
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  fmt = GIV(atCache)[atIx + AtCacheFmt];
  if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
  fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
  /* begin storePointer:ofObject:withValue: */
  if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
@@ -12775,7 +12793,12 @@
 
  atIx = rcvr & AtCacheMask;
  if (!((GIV(atCache)[atIx + AtCacheOop]) == rcvr)) {
- installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy);
+ if (!(installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy))) {
+ assert(isContextNonInt(rcvr));
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
+ primitiveContextAt(); return;
+ }
  }
  if (!GIV(primFailCode)) {
  /* begin commonVariable:at:cacheIndex: */
@@ -12785,6 +12808,7 @@
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  fmt = GIV(atCache)[atIx + AtCacheFmt];
  if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
  fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
  result = longAt((rcvr + BaseHeaderSize) + (((index + fixedFields) - 1) << ShiftForWord));
  goto l1;
@@ -12846,18 +12870,6 @@
 }
 
 sqInt
-compactClassFieldLSB(void)
-{
- return 12;
-}
-
-sqInt
-compactClassFieldWidth(void)
-{
- return 5;
-}
-
-sqInt
 compactClassIndexOfHeader(sqInt header)
 {
  return (((usqInt) header) >> 12) & 31;
@@ -18699,10 +18711,12 @@
 }
 
 
-/* Install the oop of this object in the given cache (at or atPut), along
- with its size, format and fixedSize */
+/* Attempt to install the oop of this object in the given cache (at or
+ atPut), along with its size, format and fixedSize. Answer if this was
+ successful.
+ */
 
-static void
+static sqInt
 installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
@@ -18718,11 +18732,8 @@
  fmt = (((usqInt) hdr) >> 8) & 15;
  if ((fmt == 3)
  && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ GIV(primFailCode) = PrimErrBadReceiver;
+ return 0;
  }
  /* begin lengthOf:baseHeader:format: */
  if ((hdr & TypeMask) == HeaderTypeSizeAndClass) {
@@ -18774,6 +18785,7 @@
  : fmt));
  cache[atIx + AtCacheFixedFields] = fixedFields;
  cache[atIx + AtCacheSize] = (totalLength - fixedFields);
+ return 1;
 }
 
 
@@ -19269,6 +19281,12 @@
 }
 
 static sqInt
+isContextNonInt(sqInt oop)
+{
+ return ((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex;
+}
+
+static sqInt
 isContext(sqInt oop)
 {
  return ((oop & 1) == 0)
@@ -20291,7 +20309,103 @@
  GIV(instructionPointer) = ((sqInt) top);
 }
 
+void
+longPrintOop(sqInt oop)
+{
+    sqInt byte;
+    sqInt bytecodesPerLine;
+    sqInt fieldOop;
+    sqInt fmt;
+    sqInt header;
+    sqInt index;
+    sqInt lastIndex;
+    sqInt startIP;
+    sqInt sz;
 
+ if (((oop & 1))
+ || ((!(((oop >= heapBase) && (oop <= GIV(freeStart)))))
+ || (((oop & (BytesPerWord - 1)) != 0)
+ || ((((longAt(oop)) & TypeMask) == HeaderTypeFree)
+ || (((((fmt = (((usqInt) (longAt(oop))) >> 8) & 15)) >= 5) && (((fmt = (((usqInt) (longAt(oop))) >> 8) & 15)) <= 11))))))) {
+ printOop(oop); return;
+ }
+ printHex(oop);
+ print(": a(n) ");
+ printNameOfClasscount(fetchClassOfNonInt(oop), 5);
+ if (fmt > 4) {
+ print(" nbytes ");
+ printNum(byteSizeOf(oop));
+ }
+ /* begin cr */
+ printf("\n");
+ lastIndex = ((64 < ((startIP = ((sqInt) (lastPointerOf(oop)) >> 2)))) ? 64 : ((startIP = ((sqInt) (lastPointerOf(oop)) >> 2))));
+ if (lastIndex > 0) {
+ for (index = 1; index <= lastIndex; index += 1) {
+ fieldOop = longAt((oop + BaseHeaderSize) + ((index - 1) << ShiftForWord));
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printHex(fieldOop);
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printOopShort(fieldOop);
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ if (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12) {
+ startIP = (startIP * BytesPerWord) + 1;
+ /* begin lengthOf: */
+ header = longAt(oop);
+ /* begin lengthOf:baseHeader:format: */
+ if ((header & TypeMask) == HeaderTypeSizeAndClass) {
+ sz = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
+ }
+ else {
+ sz = header & SizeMask;
+ }
+ sz -= header & Size4Bit;
+ if (((((usqInt) header) >> 8) & 15) <= 4) {
+ lastIndex = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+ goto l1;
+ }
+ if (((((usqInt) header) >> 8) & 15) < 8) {
+ lastIndex = ((usqInt) (sz - BaseHeaderSize)) >> 2;
+ goto l1;
+ }
+ else {
+ lastIndex = (sz - BaseHeaderSize) - (((((usqInt) header) >> 8) & 15) & 3);
+ goto l1;
+ }
+ l1: /* end lengthOf: */;
+ if ((lastIndex - startIP) > 100) {
+ lastIndex = startIP + 100;
+ }
+ bytecodesPerLine = 8;
+ for (index = startIP; index <= lastIndex; index += 1) {
+ byte = byteAt((oop + BaseHeaderSize) + (index - 1));
+ printf(" %02x/%-3d", byte,byte);
+ if ((((index - startIP) + 1) % bytecodesPerLine) == 0) {
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ if (!((((lastIndex - startIP) + 1) % bytecodesPerLine) == 0)) {
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ else {
+ if (startIP > 64) {
+ print("...");
+ /* begin cr */
+ printf("\n");
+ }
+ }
+}
+
+
 /* This method implements a simple method lookup cache. If an entry for the
  given selector and class is found in the cache, set the values of
  'newMethod' and 'primitiveFunctionPointer' and return true. Otherwise,
@@ -22722,7 +22836,18 @@
  return GIV(nilObj);
 }
 
+sqInt
+noAssertHeaderOf(sqInt methodPointer)
+{
+    sqInt methodHeader;
 
+ methodHeader = longAt((methodPointer + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+ return (isCogMethodReference(methodHeader)
+ ? (((CogMethod *) methodHeader)->methodHeader)
+ : methodHeader);
+}
+
+
 /* This code is called if the receiver responds primitively to at:Put:.
  The cogit can implement at: & at:put: quickly in machine code, and needs a
  backup that provides error codes. But it does not want the at cache so it
@@ -22807,7 +22932,47 @@
  }
 }
 
+static sqInt
+noInlineTemporaryin(sqInt offset, char *theFP)
+{
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
 
+ return ((((usqInt)(longAt(theFP + FoxMethod)))) < heapBase
+ ? (offset < ((frameNumArgs = (mframeCogMethod(theFP)->cmNumArgs)))
+ ? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs - offset) * BytesPerWord))
+ : longAt(((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - offset) * BytesPerWord)))
+ : (offset < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))
+ ? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - offset) * BytesPerWord))
+ : longAt(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - offset) * BytesPerWord))));
+}
+
+static void
+noInlineTemporaryinput(sqInt offset, char *theFP, sqInt valueOop)
+{
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
+
+ /* begin temporary:in:put: */
+ VM_LABEL(0temporaryinput);
+ if ((((usqInt)(longAt(theFP + FoxMethod)))) < heapBase) {
+ /* begin mtemporary:in:put: */
+ longAtput((offset < ((frameNumArgs = (mframeCogMethod(theFP)->cmNumArgs)))
+ ? (theFP + FoxCallerSavedIP) + ((frameNumArgs - offset) * BytesPerWord)
+ : ((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - offset) * BytesPerWord)), valueOop);
+ }
+ else {
+ /* begin itemporary:in:put: */
+ if (offset < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))) {
+ longAtput((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - offset) * BytesPerWord), valueOop);
+ }
+ else {
+ longAtput(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - offset) * BytesPerWord), valueOop);
+ }
+ }
+}
+
+
 /* Answer true if there are no marked contexts on thePage. */
 
 static sqInt
@@ -25145,7 +25310,7 @@
     sqInt methodHeader;
     sqInt newCopy;
     sqInt objHeader;
-    sqInt receiver;
+    sqInt rcvr;
     char *sp;
     sqInt sp1;
     char *spouseFP;
@@ -25153,29 +25318,29 @@
     sqInt valuePointer;
     sqInt valuePointer1;
 
- receiver = longAt(GIV(stackPointer));
- if ((receiver & 1)) {
- newCopy = receiver;
+ rcvr = longAt(GIV(stackPointer));
+ if ((rcvr & 1)) {
+ newCopy = rcvr;
  }
  else {
- objHeader = longAt(receiver);
+ objHeader = longAt(rcvr);
  if (((((usqInt) objHeader) >> 12) & 31) == ClassMethodContextCompactIndex) {
  /* begin cloneContext: */
  VM_LABEL(0cloneContext);
- cloned = eeInstantiateMethodContextByteSize(byteSizeOf(receiver));
+ cloned = eeInstantiateMethodContextByteSize(byteSizeOf(rcvr));
  if (cloned != 0) {
  for (i = 0; i <= StackPointerIndex; i += 1) {
  /* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer = externalInstVarofContext(i, receiver);
+ valuePointer = externalInstVarofContext(i, rcvr);
  longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), valuePointer);
  }
  for (i = MethodIndex; i <= ReceiverIndex; i += 1) {
- longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), longAt((receiver + BaseHeaderSize) + (i << ShiftForWord)));
+ longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), longAt((rcvr + BaseHeaderSize) + (i << ShiftForWord)));
  }
- if ((((longAt((receiver + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
- && (!(isWidowedContext(receiver)))) {
+ if ((((longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(rcvr)))) {
  /* begin frameOfMarriedContext: */
- value = longAt((receiver + BaseHeaderSize) + (SenderIndex << ShiftForWord));
+ value = longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord));
  /* begin withoutSmallIntegerTags: */
  assert((value & 1));
  spouseFP = pointerForOop(value - 1);
@@ -25193,16 +25358,16 @@
  }
  }
  else {
- sp1 = (fetchStackPointerOf(receiver)) - 1;
+ sp1 = (fetchStackPointerOf(rcvr)) - 1;
  for (i = 0; i <= sp1; i += 1) {
- longAtput((cloned + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord), longAt((receiver + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord)));
+ longAtput((cloned + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord), longAt((rcvr + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord)));
  }
  }
  }
  newCopy = cloned;
  }
  else {
- newCopy = clone(receiver);
+ newCopy = clone(rcvr);
  }
  if (newCopy == 0) {
  (GIV(primFailCode) = PrimErrNoMemory); return;
@@ -26135,6 +26300,10 @@
  }
 }
 
+
+/* Special version of primitiveAt for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static void
 primitiveContextAt(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -26162,11 +26331,7 @@
 
  index = longAt(GIV(stackPointer));
  if (!((index & 1))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadArgument); return;
  }
  index = (index >> 1);
 
@@ -26180,7 +26345,7 @@
 
  value = stObjectat(aContext, index);
  /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp = GIV(stackPointer) + ((GIV(argumentCount) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp;
  return;
  }
@@ -26262,11 +26427,7 @@
  stSize = (sp11 >> 1);
  l5: /* end stackPointerForMaybeMarriedContext: */;
  if (!(((index >= 1) && (index <= stSize)))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadIndex); return;
  }
  /* begin subscript:with:format: */
  if (fmt <= 4) {
@@ -26283,7 +26444,7 @@
  }
  l3: /* end subscript:with:format: */;
  /* begin pop:thenPush: */
- longAtput((sp1 = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp1;
  return;
  }
@@ -26293,11 +26454,7 @@
  assert((value1 & 1));
  spouseFP = pointerForOop(value1 - 1);
  if (!(((index >= 1) && (index <= (stackPointerIndexForFrame(spouseFP)))))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadIndex); return;
  }
  value = ((((usqInt)(longAt(spouseFP + FoxMethod)))) < heapBase
  ? ((index - 1) < ((frameNumArgs = (mframeCogMethod(spouseFP)->cmNumArgs)))
@@ -26307,10 +26464,14 @@
  ? longAt((spouseFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - 1)) * BytesPerWord))
  : longAt(((spouseFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - 1)) * BytesPerWord))));
  /* begin pop:thenPush: */
- longAtput((sp2 = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp2;
 }
 
+
+/* Special version of primitiveAtPut for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static sqInt
 primitiveContextAtPut(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -26341,18 +26502,14 @@
  index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
  aContext = longAt(GIV(stackPointer) + (2 * BytesPerWord));
  if (!((index & 1))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadArgument);
  }
  hdr = longAt(aContext);
  index = (index >> 1);
  if (!(((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
  stObjectatput(aContext, index, value);
  /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp;
  return null;
  }
@@ -26434,11 +26591,7 @@
  stSize = (sp11 >> 1);
  l4: /* end stackPointerForMaybeMarriedContext: */;
  if (!(((index >= 1) && (index <= stSize)))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadIndex);
  }
  /* begin subscript:with:storing:format: */
  VM_LABEL(0subscriptwithstoringformat);
@@ -26490,7 +26643,7 @@
  }
  }
  /* begin pop:thenPush: */
- longAtput((sp1 = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp1;
  return null;
  }
@@ -26500,15 +26653,10 @@
  assert((value1 & 1));
  spouseFP = pointerForOop(value1 - 1);
  if (!(((index >= 1) && (index <= (stackPointerIndexForFrame(spouseFP)))))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadIndex);
  }
  /* begin temporary:in:put: */
- VM_LABEL(0temporaryinput);
- ;
+ VM_LABEL(1temporaryinput);
  if ((((usqInt)(longAt(spouseFP + FoxMethod)))) < heapBase) {
  /* begin mtemporary:in:put: */
  longAtput(((index - 1) < ((frameNumArgs = (mframeCogMethod(spouseFP)->cmNumArgs)))
@@ -26525,11 +26673,15 @@
  }
  }
  /* begin pop:thenPush: */
- longAtput((sp2 = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp2;
  return null;
 }
 
+
+/* Special version of primitiveSize for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static void
 primitiveContextSize(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -26629,11 +26781,9 @@
  else {
  sz = totalLength - fixedFields;
  }
- if (!GIV(primFailCode)) {
- /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), ((sz << 1) | 1));
- GIV(stackPointer) = sp;
- }
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((sz << 1) | 1));
+ GIV(stackPointer) = sp;
 }
 
 
@@ -35126,31 +35276,77 @@
 static void
 primitiveSize(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt ccIndex;
+    sqInt class;
+    sqInt classFormat;
+    sqInt fixedFields;
+    sqInt fmt;
+    sqInt hdr;
     sqInt rcvr;
     char *sp;
     sqInt sz;
+    sqInt totalLength;
 
  rcvr = longAt(GIV(stackPointer));
- if ((rcvr & 1)) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ if (((rcvr & 1))
+ || ((
+ /* Integers are not indexable */
+
+(hdr = longAt(rcvr)),
+ ((fmt = (((usqInt) hdr) >> 8) & 15)) < 2))) {
+ (GIV(primFailCode) = PrimErrBadReceiver); return;
  }
- if (((((usqInt) (longAt(rcvr))) >> 8) & 15) < 2) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ primitiveContextSize(); return;
  }
- sz = stSizeOf(rcvr);
- if (!GIV(primFailCode)) {
- /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((sz << 1) | 1));
- GIV(stackPointer) = sp;
+ /* begin lengthOf:baseHeader:format: */
+ if ((hdr & TypeMask) == HeaderTypeSizeAndClass) {
+ sz = (longAt(rcvr - (BytesPerWord * 2))) & LongSizeMask;
  }
+ else {
+ sz = hdr & SizeMask;
+ }
+ sz -= hdr & Size4Bit;
+ if (fmt <= 4) {
+ totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+ goto l1;
+ }
+ if (fmt < 8) {
+ totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
+ goto l1;
+ }
+ else {
+ totalLength = (sz - BaseHeaderSize) - (fmt & 3);
+ goto l1;
+ }
+l1: /* end lengthOf:baseHeader:format: */;
+ /* begin fixedFieldsOf:format:length: */
+ if ((fmt > 4)
+ || (fmt == 2)) {
+ fixedFields = 0;
+ goto l2;
+ }
+ if (fmt < 2) {
+ fixedFields = totalLength;
+ goto l2;
+ }
+ /* begin fetchClassOfNonInt: */
+ if (((ccIndex = (((usqInt) (longAt(rcvr))) >> 12) & 31)) == 0) {
+ class = (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask;
+ goto l3;
+ }
+ else {
+ class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
+ goto l3;
+ }
+l3: /* end fetchClassOfNonInt: */;
+ classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
+ fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
+l2: /* end fixedFieldsOf:format:length: */;
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((totalLength - fixedFields) << 1) | 1));
+ GIV(stackPointer) = sp;
 }
 
 
@@ -38912,6 +39108,7 @@
 printMethodDictionaryOf(sqInt behavior)
 {
     sqInt index;
+    sqInt meth;
     sqInt methodArray;
     sqInt selector;
 
@@ -38921,9 +39118,15 @@
  for (index = SelectorStart; index <= ((fetchWordLengthOf(longAt((behavior + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord)))) - 1); index += 1) {
  selector = longAt(((longAt((behavior + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord))) + BaseHeaderSize) + (index << ShiftForWord));
  if (selector != GIV(nilObj)) {
+ meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
  printOopShort(selector);
  print(" => ");
- printOopShort(longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord)));
+ printOopShort(meth);
+ print(" (");
+ printHex(selector);
+ print(" => ");
+ printHex(meth);
+ putchar(')');
  /* begin cr */
  printf("\n");
  }
@@ -38934,6 +39137,7 @@
 printMethodDictionary(sqInt dictionary)
 {
     sqInt index;
+    sqInt meth;
     sqInt methodArray;
     sqInt selector;
 
@@ -38941,9 +39145,15 @@
  for (index = SelectorStart; index <= ((fetchWordLengthOf(dictionary)) - 1); index += 1) {
  selector = longAt((dictionary + BaseHeaderSize) + (index << ShiftForWord));
  if (selector != GIV(nilObj)) {
+ meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
  printOopShort(selector);
  print(" => ");
- printOopShort(longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord)));
+ printOopShort(meth);
+ print(" (");
+ printHex(selector);
+ print(" => ");
+ printHex(meth);
+ putchar(')');
  /* begin cr */
  printf("\n");
  }
@@ -42991,6 +43201,7 @@
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
+    sqInt sp;
     sqInt stSize;
     sqInt sz;
     sqInt totalLength;
@@ -43007,44 +43218,61 @@
  sz -= hdr & Size4Bit;
  if (fmt <= 4) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
- goto l1;
+ goto l2;
  }
  if (fmt < 8) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
- goto l1;
+ goto l2;
  }
  else {
  totalLength = (sz - BaseHeaderSize) - (fmt & 3);
- goto l1;
+ goto l2;
  }
-l1: /* end lengthOf:baseHeader:format: */;
+l2: /* end lengthOf:baseHeader:format: */;
  /* begin fixedFieldsOf:format:length: */
  if ((fmt > 4)
  || (fmt == 2)) {
  fixedFields = 0;
- goto l2;
+ goto l3;
  }
  if (fmt < 2) {
  fixedFields = totalLength;
- goto l2;
+ goto l3;
  }
  /* begin fetchClassOfNonInt: */
  if (((ccIndex = (((usqInt) (longAt(array))) >> 12) & 31)) == 0) {
  class = (longAt(array - BaseHeaderSize)) & AllButTypeMask;
- goto l3;
+ goto l4;
  }
  else {
  class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
- goto l3;
+ goto l4;
  }
-l3: /* end fetchClassOfNonInt: */;
+l4: /* end fetchClassOfNonInt: */;
  classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
  fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
-l2: /* end fixedFieldsOf:format:length: */;
- if (fmt == 3) {
- assert(!(isContextHeader(hdr)));
+l3: /* end fixedFieldsOf:format:length: */;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ /* begin fetchStackPointerOf: */
+ sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord));
+ if (!((sp & 1))) {
+ stSize = 0;
+ goto l1;
+ }
+ assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array)));
+ stSize = (sp >> 1);
+ l1: /* end fetchStackPointerOf: */;
+ if (((((usqInt) index)) >= (((usqInt) 1)))
+ && (((((usqInt) index)) <= (((usqInt) stSize)))
+ && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(array)))))) {
+ return noInlineTemporaryin(index - 1, frameOfMarriedContext(array));
+ }
  }
- stSize = totalLength - fixedFields;
+ else {
+ stSize = totalLength - fixedFields;
+ }
  if (((((usqInt) index)) >= (((usqInt) 1)))
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  /* begin subscript:with:format: */
@@ -43076,6 +43304,7 @@
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
+    sqInt sp;
     sqInt stSize;
     sqInt sz;
     sqInt totalLength;
@@ -43093,44 +43322,62 @@
  sz -= hdr & Size4Bit;
  if (fmt <= 4) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
- goto l1;
+ goto l2;
  }
  if (fmt < 8) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
- goto l1;
+ goto l2;
  }
  else {
  totalLength = (sz - BaseHeaderSize) - (fmt & 3);
- goto l1;
+ goto l2;
  }
-l1: /* end lengthOf:baseHeader:format: */;
+l2: /* end lengthOf:baseHeader:format: */;
  /* begin fixedFieldsOf:format:length: */
  if ((fmt > 4)
  || (fmt == 2)) {
  fixedFields = 0;
- goto l2;
+ goto l3;
  }
  if (fmt < 2) {
  fixedFields = totalLength;
- goto l2;
+ goto l3;
  }
  /* begin fetchClassOfNonInt: */
  if (((ccIndex = (((usqInt) (longAt(array))) >> 12) & 31)) == 0) {
  class = (longAt(array - BaseHeaderSize)) & AllButTypeMask;
- goto l3;
+ goto l4;
  }
  else {
  class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
- goto l3;
+ goto l4;
  }
-l3: /* end fetchClassOfNonInt: */;
+l4: /* end fetchClassOfNonInt: */;
  classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
  fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
-l2: /* end fixedFieldsOf:format:length: */;
- if (fmt == 3) {
- assert(!(isContextHeader(hdr)));
+l3: /* end fixedFieldsOf:format:length: */;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ /* begin fetchStackPointerOf: */
+ sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord));
+ if (!((sp & 1))) {
+ stSize = 0;
+ goto l1;
+ }
+ assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array)));
+ stSize = (sp >> 1);
+ l1: /* end fetchStackPointerOf: */;
+ if (((((usqInt) index)) >= (((usqInt) 1)))
+ && (((((usqInt) index)) <= (((usqInt) stSize)))
+ && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(array)))))) {
+ noInlineTemporaryinput(index - 1, frameOfMarriedContext(array), value);
+ return;
+ }
  }
- stSize = totalLength - fixedFields;
+ else {
+ stSize = totalLength - fixedFields;
+ }
  if (((((usqInt) index)) >= (((usqInt) 1)))
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  /* begin subscript:with:storing:format: */

Modified: branches/Cog/nscogsrc/vm/interp.h
===================================================================
--- branches/Cog/nscogsrc/vm/interp.h 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/nscogsrc/vm/interp.h 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,5 +1,5 @@
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/nscogsrc/vm/vmCallback.h
===================================================================
--- branches/Cog/nscogsrc/vm/vmCallback.h 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/nscogsrc/vm/vmCallback.h 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,5 +1,5 @@
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
 
 #define VM_CALLBACK_INC 1


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Tue Aug 16 15:27:50 PDT 2011
   + Fri Aug 19 14:31:01 PDT 2011

Added: branches/Cog/scripts/mknsvmlinuxarchive
===================================================================
--- branches/Cog/scripts/mknsvmlinuxarchive                        (rev 0)
+++ branches/Cog/scripts/mknsvmlinuxarchive 2011-08-19 21:33:12 UTC (rev 2488)
@@ -0,0 +1,7 @@
+#!/bin/sh
+SVNREV="`svnversion | sed 's/^.*://'`"
+echo $SVNREV
+export SVNREV
+rm nsvmlinux/lib/nsvm/{npsqueakregister,npsqueakrun}
+ln ~/Squeak/SqueakV41.sources nsvmlinux/lib/nsvm/*
+tar cvzf nsvmlinux-`date +%g.%U.$SVNREV`.tgz nsvmlinux


Property changes on: branches/Cog/scripts/mknsvmlinuxarchive
___________________________________________________________________
Added: svn:executable
   + *

Modified: branches/Cog/src/vm/cogit.c
===================================================================
--- branches/Cog/src/vm/cogit.c 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/src/vm/cogit.c 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,9 +1,9 @@
 /* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGenerator VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
    from
- StackToRegisterMappingCogit VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ StackToRegisterMappingCogit VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -145,6 +145,7 @@
 #define BytesPerWord 4
 #define Call 9
 #define CDQ 103
+#define ClassMethodContextCompactIndex 14
 #define ClassReg -5
 #define ClosureFirstCopiedValueIndex 3
 #define ClosureNumArgsIndex 2
@@ -603,7 +604,6 @@
 static sqInt genGetHashFieldNonIntOfasSmallIntegerInto(sqInt instReg, sqInt destReg);
 static sqInt genGetLeafCallStackPointer(void);
 static void genGetLeafCallStackPointerFunction(AbstractInstruction * self_in_genGetLeafCallStackPointerFunction);
-static AbstractInstruction * genGetSizeOfintoformatRegscratchReg(sqInt sourceReg, sqInt destReg, sqInt formatReg, sqInt scratchReg);
 static sqInt genInnerPICAbortTrampoline(char *name);
 static sqInt genInnerPrimitiveAt(sqInt retNoffset);
 static sqInt genInnerPrimitiveSize(sqInt retNoffset);
@@ -765,7 +765,6 @@
 static sqInt hasPCDependentInstructions(AbstractInstruction * self_in_hasPCDependentInstructions);
 static sqInt hasSSE2Instructions(AbstractInstruction * self_in_hasSSE2Instructions);
 static sqInt hasSSEInstructions(AbstractInstruction * self_in_hasSSEInstructions);
-static sqInt hasValidHeaderPostGC(CogMethod *cogMethod);
 static sqInt incrementUsageOfTargetIfLinkedSendmcpcignored(sqInt annotation, char *mcpc, sqInt superfluity);
 static sqInt initialClosedPICUsageCount(void);
 static void initializeBackend(void);
@@ -861,6 +860,7 @@
 static AbstractInstruction * gNegateR(sqInt reg);
 static sqInt needsFrameIfInBlock(sqInt isInBlock);
 static sqInt needsFrameNever(sqInt isInBlock);
+static sqInt noAssertMethodClassAssociationOf(sqInt methodPointer);
 static sqInt noCogMethodsMaximallyMarked(void);
 static void nopsFromto(AbstractInstruction * self_in_nopsFromto, sqInt startAddr, sqInt endAddr);
 static sqInt noTargetsFreeInClosedPIC(CogMethod *cPIC);
@@ -1672,7 +1672,6 @@
 #define traceSimStack() 0
 #define traceSpill(ign) 0
 #define tryLockVMOwner() (ceTryLockVMOwner() != 0)
-#define typeEtAlWord(cm) (((long *)(cm))[1])
 #define unalignedLongAt(inst,byteAddress) longAt(byteAddress)
 #define unalignedLongAtput(inst,byteAddress,aWord) longAtput(byteAddress,aWord)
 #define unlockVMOwner() ceUnlockVMOwner()
@@ -1905,7 +1904,7 @@
  cogMethod = ((CogMethod *) methodZoneBase);
  while (cogMethod < (limitZony())) {
  if (((cogMethod->cmType)) == CMMethod) {
- if (!(hasValidHeaderPostGC(cogMethod))) {
+ if (!(((cogMethod->objectHeader)) == (nullHeaderForMachineCodeMethod()))) {
  return 0;
  }
  }
@@ -2377,7 +2376,9 @@
     sqInt cacheTag;
     sqInt entryPoint;
     sqInt literal;
+    sqInt off;
     sqInt offset;
+    sqInt table;
     CogMethod *targetMethod;
 
  if (annotation == IsObjectReference) {
@@ -2415,9 +2416,55 @@
  }
  entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
  if (entryPoint > methodZoneBase) {
- offset = ((entryPoint & entryPointMask) == checkedEntryAlignment
- ? cmEntryOffset
- : cmNoCheckEntryOffset);
+ /* begin offsetAndSendTableFor:annotation:into: */
+ VM_LABEL(0offsetAndSendTableForannotationinto);
+
+#      if NewspeakVM
+ if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
+ assert(annotation == IsSendCall);
+
+ /* It's a linked send; find which kind. */
+
+ offset = cmEntryOffset;
+
+ }
+ else {
+ if ((entryPoint & entryPointMask) == dynSuperEntryAlignment) {
+ assert(annotation == IsNSSendCall);
+
+ /* It's a linked send; find which kind. */
+
+ offset = cmDynSuperEntryOffset;
+
+ }
+ else {
+ assert(annotation == IsSendCall);
+
+ /* It's a linked send; find which kind. */
+
+ offset = cmNoCheckEntryOffset;
+
+ }
+ }
+
+#      else /* NewspeakVM */
+ if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
+
+ /* It's a linked send; find which kind. */
+
+ offset = cmEntryOffset;
+
+ }
+ else {
+
+ /* It's a linked send; find which kind. */
+
+ offset = cmNoCheckEntryOffset;
+
+ }
+
+#      endif /* NewspeakVM */
+
  targetMethod = ((CogMethod *) (entryPoint - offset));
  if (!(asserta((((targetMethod->cmType)) == CMMethod)
  || ((((targetMethod->cmType)) == CMClosedPIC)
@@ -3094,7 +3141,7 @@
     CogMethod *cogMethod;
 
  assert((!(methodHasCogMethod(aMethodObj)))
- || ((methodClassAssociationOf(aMethodObj)) == (nilObject())));
+ || ((noAssertMethodClassAssociationOf(aMethodObj)) == (nilObject())));
  compilationBreakpoint(aSelectorOop, lengthOf(aSelectorOop));
  if (aMethodObj == breakMethod) {
  haltmsg("Compilation of breakMethod");
@@ -3106,6 +3153,11 @@
  null;
  }
  else {
+ if (!(methodHasCogMethod(aMethodObj))) {
+ assert((rawHeaderOf(aMethodObj)) == ((cogMethod->methodHeader)));
+ (cogMethod->methodObject = aMethodObj);
+ rawHeaderOfput(aMethodObj, ((sqInt)cogMethod));
+ }
  return cogMethod;
  }
 
@@ -3177,7 +3229,7 @@
  (dest->objectHeader = objectHeaderValue);
  if (((dest->cmType)) == CMMethod) {
  assert(((((sqInt)(rawHeaderOf((dest->methodObject))))) == (((sqInt)source)))
- || ((methodClassAssociationOf((dest->methodObject))) == (nilObject())));
+ || ((noAssertMethodClassAssociationOf((dest->methodObject))) == (nilObject())));
  if ((((sqInt)(rawHeaderOf((dest->methodObject))))) == (((sqInt)source))) {
  rawHeaderOfput((dest->methodObject), ((sqInt)dest));
  }
@@ -7483,7 +7535,7 @@
  assert((cogMethodDoesntLookKosher(cogMethod)) == 0);
  if (((cogMethod->cmType)) == CMMethod) {
  assert(((((sqInt)(rawHeaderOf((cogMethod->methodObject))))) == (((sqInt)cogMethod)))
- || ((methodClassAssociationOf((cogMethod->methodObject))) == (nilObject())));
+ || ((noAssertMethodClassAssociationOf((cogMethod->methodObject))) == (nilObject())));
  if ((((sqInt)(rawHeaderOf((cogMethod->methodObject))))) == (((sqInt)cogMethod))) {
  rawHeaderOfput((cogMethod->methodObject), (cogMethod->methodHeader));
  }
@@ -8777,11 +8829,11 @@
  /* begin MoveMw:r:R: */
  genoperandoperandoperand(MoveMwrR, 0, instReg, destReg);
  /* begin LogicalShiftRightCq:R: */
- quickConstant1 = (compactClassFieldLSB()) - ShiftForWord;
- genoperandoperand(LogicalShiftRightCqR, quickConstant1, destReg);
+ quickConstant = (compactClassFieldLSB()) - ShiftForWord;
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, destReg);
  /* begin AndCq:R: */
- quickConstant = ((1 << (compactClassFieldWidth())) - 1) << ShiftForWord;
- genoperandoperand(AndCqR, quickConstant, destReg);
+ quickConstant1 = ((1 << (compactClassFieldWidth())) - 1) << ShiftForWord;
+ genoperandoperand(AndCqR, quickConstant1, destReg);
  /* begin JumpNonZero: */
  jumpCompact = genoperand(JumpNonZero, ((sqInt)0));
  /* begin MoveMw:r:R: */
@@ -8823,11 +8875,11 @@
  /* begin MoveMw:r:R: */
  genoperandoperandoperand(MoveMwrR, 0, instReg, scratchReg);
  /* begin LogicalShiftRightCq:R: */
- quickConstant1 = (compactClassFieldLSB()) - ShiftForWord;
- genoperandoperand(LogicalShiftRightCqR, quickConstant1, scratchReg);
+ quickConstant = (compactClassFieldLSB()) - ShiftForWord;
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, scratchReg);
  /* begin AndCq:R: */
- quickConstant = ((1 << (compactClassFieldWidth())) - 1) << ShiftForWord;
- genoperandoperand(AndCqR, quickConstant, scratchReg);
+ quickConstant1 = ((1 << (compactClassFieldWidth())) - 1) << ShiftForWord;
+ genoperandoperand(AndCqR, quickConstant1, scratchReg);
  /* begin JumpNonZero: */
  jumpCompact = genoperand(JumpNonZero, ((sqInt)0));
  /* begin MoveMw:r:R: */
@@ -8859,11 +8911,11 @@
  /* begin MoveMw:r:R: */
  genoperandoperandoperand(MoveMwrR, 0, instReg, destReg);
  /* begin LogicalShiftRightCq:R: */
- quickConstant1 = compactClassFieldLSB();
- genoperandoperand(LogicalShiftRightCqR, quickConstant1, destReg);
+ quickConstant = compactClassFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, destReg);
  /* begin AndCq:R: */
- quickConstant = (1 << (compactClassFieldWidth())) - 1;
- genoperandoperand(AndCqR, quickConstant, destReg);
+ quickConstant1 = (1 << (compactClassFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant1, destReg);
  return 0;
 }
 
@@ -8950,138 +9002,145 @@
 }
 
 
-/* Get the size of the non-immediate object in sourceReg into destReg using
- formatReg and scratchReg as temps. None of these registers can overlap.
- Answer the jump
- taken if the object in sourceReg is not indexable. Hack: If the object hs
- a pointer
- format other than 2 leave the number of fixed fields in formatReg. Used by
- primitiveSize, primitiveAt, primitiveAtPut, primitiveStringAt &
- primitiveStringAtPut  */
+/* Generate the abort for a PIC. This abort performs either a call of
+ ceInterpretMethodFromPIC:receiver: to handle invoking an uncogged
+ target or a call of ceMNUFromPICMNUMethod:receiver: to handle an
+ MNU dispatch in a closed PIC. It distinguishes the two by testing
+ ClassReg. If the register is zero then this is an MNU. */
+
+static sqInt
+genInnerPICAbortTrampoline(char *name)
+{
+    AbstractInstruction *jumpMNUCase;
+
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, 0, ClassReg);
+ /* begin JumpZero: */
+ jumpMNUCase = genoperand(JumpZero, ((sqInt)0));
+ compileTrampolineForcallJumpBarnumArgsargargargargsaveRegsresultReg(ceInterpretMethodFromPICreceiver, 1, 2, SendNumArgsReg, ReceiverResultReg, null, null, 0, null);
+ jmpTarget(jumpMNUCase, gLabel());
+ return genTrampolineForcalledcallJumpBarnumArgsargargargargsaveRegsresultRegappendOpcodes(ceMNUFromPICMNUMethodreceiver, name, 1, 2, SendNumArgsReg, ReceiverResultReg, null, null, 0, null, 1);
+}
+
+
 /* c.f. StackInterpreter>>stSizeOf: lengthOf:baseHeader:format:
  fixedFieldsOf:format:length:
  */
-/* and one wonders why Squeak V1 through V3 are slow... */
 
-static AbstractInstruction *
-genGetSizeOfintoformatRegscratchReg(sqInt sourceReg, sqInt destReg, sqInt formatReg, sqInt scratchReg)
+static sqInt
+genInnerPrimitiveAt(sqInt retNoffset)
 {
+    sqInt jic;
     AbstractInstruction *jmpFmtGe8;
+    sqInt jnx;
+    AbstractInstruction *jumpBounds;
+    AbstractInstruction *jumpFmtEq2;
+    AbstractInstruction *jumpFmtGt4;
     AbstractInstruction *jumpFmtIs2;
     AbstractInstruction *jumpFmtLe4;
+    AbstractInstruction *jumpFmtLt8;
     AbstractInstruction *jumpGotByteSize;
     AbstractInstruction *jumpGotWordSize;
+    AbstractInstruction *jumpIsContext;
+    AbstractInstruction *jumpIsContext1;
+    AbstractInstruction *jumpLarge;
     AbstractInstruction *jumpNotIndexable;
+    AbstractInstruction *jumpNotIndexable1;
+    AbstractInstruction *jumpNotSI;
     AbstractInstruction *jumpShortHeader;
+    AbstractInstruction *jumpSI;
     AbstractInstruction *jumpSkip;
+    sqInt quickConstant;
+    sqInt quickConstant1;
+    sqInt quickConstant11;
+    sqInt quickConstant2;
+    sqInt quickConstant3;
+    sqInt quickConstant4;
 
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
+ jumpSI = genJumpSmallIntegerInScratchReg(TempReg);
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, Arg0Reg, TempReg);
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, Arg0Reg, Arg1Reg);
+ jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
+ /* begin genGetSizeOf:into:formatReg:scratchReg:abortJumpsInto: */
+ VM_LABEL(0genGetSizeOfintoformatRegscratchRegabortJumpsInto);
  /* begin MoveMw:r:R: */
- genoperandoperandoperand(MoveMwrR, 0, sourceReg, formatReg);
+ genoperandoperandoperand(MoveMwrR, 0, ReceiverResultReg, SendNumArgsReg);
  /* begin MoveR:R: */
- genoperandoperand(MoveRR, formatReg, destReg);
+ genoperandoperand(MoveRR, SendNumArgsReg, ClassReg);
  /* begin LogicalShiftRightCq:R: */
- genoperandoperand(LogicalShiftRightCqR, 8, formatReg);
+ quickConstant4 = instFormatFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant4, SendNumArgsReg);
  /* begin AndCq:R: */
- genoperandoperand(AndCqR, 15, formatReg);
+ quickConstant11 = (1 << (instFormatFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant11, SendNumArgsReg);
  /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, 2, formatReg);
+ genoperandoperand(CmpCqR, 2, SendNumArgsReg);
  /* begin JumpLess: */
- jumpNotIndexable = genoperand(JumpLess, ((sqInt)0));
+ jumpNotIndexable1 = genoperand(JumpLess, ((sqInt)0));
  /* begin MoveR:R: */
- genoperandoperand(MoveRR, destReg, scratchReg);
+ genoperandoperand(MoveRR, ClassReg, TempReg);
+ /* begin LogicalShiftRightCq:R: */
+ quickConstant2 = compactClassFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant2, TempReg);
  /* begin AndCq:R: */
- genoperandoperand(AndCqR, TypeMask, scratchReg);
+ quickConstant3 = (1 << (compactClassFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant3, TempReg);
  /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, HeaderTypeSizeAndClass, scratchReg);
+ genoperandoperand(CmpCqR, ClassMethodContextCompactIndex, TempReg);
+ /* begin JumpZero: */
+ jumpIsContext1 = genoperand(JumpZero, ((sqInt)0));
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, ClassReg, TempReg);
+ /* begin AndCq:R: */
+ genoperandoperand(AndCqR, TypeMask, TempReg);
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, HeaderTypeSizeAndClass, TempReg);
  /* begin JumpNonZero: */
  jumpShortHeader = genoperand(JumpNonZero, ((sqInt)0));
  assert(Size4Bit == 0);
  /* begin MoveMw:r:R: */
- genoperandoperandoperand(MoveMwrR, 0 - (2 * BytesPerWord), sourceReg, destReg);
+ genoperandoperandoperand(MoveMwrR, 0 - (2 * BytesPerWord), ReceiverResultReg, ClassReg);
  /* begin AndCq:R: */
- genoperandoperand(AndCqR, ((sqInt) LongSizeMask), destReg);
+ genoperandoperand(AndCqR, ((sqInt) LongSizeMask), ClassReg);
  /* begin Jump: */
  jumpSkip = genoperand(Jump, ((sqInt)0));
- jmpTarget(jumpShortHeader, gAndCqR(SizeMask, destReg));
- jmpTarget(jumpSkip, gSubCqR(BaseHeaderSize, destReg));
+ jmpTarget(jumpShortHeader, gAndCqR(SizeMask, ClassReg));
+ jmpTarget(jumpSkip, gSubCqR(BaseHeaderSize, ClassReg));
  /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, 4, formatReg);
+ genoperandoperand(CmpCqR, 4, SendNumArgsReg);
  /* begin JumpLessOrEqual: */
  jumpFmtLe4 = genoperand(JumpLessOrEqual, ((sqInt)0));
  /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, 8, formatReg);
+ genoperandoperand(CmpCqR, 8, SendNumArgsReg);
  /* begin JumpLess: */
  jmpFmtGe8 = genoperand(JumpLess, ((sqInt)0));
  /* begin AndCq:R: */
- genoperandoperand(AndCqR, 3, formatReg);
+ genoperandoperand(AndCqR, 3, SendNumArgsReg);
  /* begin SubR:R: */
- genoperandoperand(SubRR, formatReg, destReg);
+ genoperandoperand(SubRR, SendNumArgsReg, ClassReg);
  /* begin Jump: */
  jumpGotByteSize = genoperand(Jump, ((sqInt)0));
- jmpTarget(jmpFmtGe8, gLogicalShiftRightCqR(2, destReg));
+ jmpTarget(jmpFmtGe8, gLogicalShiftRightCqR(2, ClassReg));
  /* begin Jump: */
  jumpGotWordSize = genoperand(Jump, ((sqInt)0));
  jmpTarget(jumpFmtLe4, gLabel());
  /* begin LogicalShiftRightCq:R: */
- genoperandoperand(LogicalShiftRightCqR, ShiftForWord, destReg);
+ genoperandoperand(LogicalShiftRightCqR, ShiftForWord, ClassReg);
  /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, 2, formatReg);
+ genoperandoperand(CmpCqR, 2, SendNumArgsReg);
  /* begin JumpZero: */
  jumpFmtIs2 = genoperand(JumpZero, ((sqInt)0));
- genGetFixedFieldsOfPointerNonIntintoscratchReg(sourceReg, formatReg, scratchReg);
+ genGetFixedFieldsOfPointerNonIntintoscratchReg(ReceiverResultReg, SendNumArgsReg, TempReg);
  /* begin SubR:R: */
- genoperandoperand(SubRR, formatReg, destReg);
+ genoperandoperand(SubRR, SendNumArgsReg, ClassReg);
  jmpTarget(jumpFmtIs2, jmpTarget(jumpGotWordSize, jmpTarget(jumpGotByteSize, gLabel())));
- return jumpNotIndexable;
-}
+ jumpNotIndexable = jumpNotIndexable1;
+ jumpIsContext = jumpIsContext1;
 
-
-/* Generate the abort for a PIC. This abort performs either a call of
- ceInterpretMethodFromPIC:receiver: to handle invoking an uncogged
- target or a call of ceMNUFromPICMNUMethod:receiver: to handle an
- MNU dispatch in a closed PIC. It distinguishes the two by testing
- ClassReg. If the register is zero then this is an MNU. */
-
-static sqInt
-genInnerPICAbortTrampoline(char *name)
-{
-    AbstractInstruction *jumpMNUCase;
-
- /* begin CmpCq:R: */
- genoperandoperand(CmpCqR, 0, ClassReg);
- /* begin JumpZero: */
- jumpMNUCase = genoperand(JumpZero, ((sqInt)0));
- compileTrampolineForcallJumpBarnumArgsargargargargsaveRegsresultReg(ceInterpretMethodFromPICreceiver, 1, 2, SendNumArgsReg, ReceiverResultReg, null, null, 0, null);
- jmpTarget(jumpMNUCase, gLabel());
- return genTrampolineForcalledcallJumpBarnumArgsargargargargsaveRegsresultRegappendOpcodes(ceMNUFromPICMNUMethodreceiver, name, 1, 2, SendNumArgsReg, ReceiverResultReg, null, null, 0, null, 1);
-}
-
-
-/* c.f. StackInterpreter>>stSizeOf: lengthOf:baseHeader:format:
- fixedFieldsOf:format:length:
- */
-
-static sqInt
-genInnerPrimitiveAt(sqInt retNoffset)
-{
-    AbstractInstruction *jumpBounds;
-    AbstractInstruction *jumpFmtEq2;
-    AbstractInstruction *jumpFmtGt4;
-    AbstractInstruction *jumpFmtLt8;
-    AbstractInstruction *jumpLarge;
-    AbstractInstruction *jumpNotIndexable;
-    AbstractInstruction *jumpNotSI;
-    AbstractInstruction *jumpSI;
-
- /* begin MoveR:R: */
- genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
- jumpSI = genJumpSmallIntegerInScratchReg(TempReg);
- /* begin MoveR:R: */
- genoperandoperand(MoveRR, Arg0Reg, TempReg);
- /* begin MoveR:R: */
- genoperandoperand(MoveRR, Arg0Reg, Arg1Reg);
- jumpNotSI = genJumpNotSmallIntegerInScratchReg(TempReg);
- jumpNotIndexable = genGetSizeOfintoformatRegscratchReg(ReceiverResultReg, ClassReg, SendNumArgsReg, TempReg);
  genConvertSmallIntegerToIntegerInScratchReg(Arg1Reg);
  /* begin SubCq:R: */
  genoperandoperand(SubCqR, 1, Arg1Reg);
@@ -9092,9 +9151,11 @@
  /* begin MoveMw:r:R: */
  genoperandoperandoperand(MoveMwrR, 0, ReceiverResultReg, ClassReg);
  /* begin LogicalShiftRightCq:R: */
- genoperandoperand(LogicalShiftRightCqR, 8, ClassReg);
+ quickConstant = instFormatFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, ClassReg);
  /* begin AndCq:R: */
- genoperandoperand(AndCqR, 15, ClassReg);
+ quickConstant1 = (1 << (instFormatFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant1, ClassReg);
  /* begin CmpCq:R: */
  genoperandoperand(CmpCqR, 4, ClassReg);
  /* begin JumpGreater: */
@@ -9142,7 +9203,7 @@
  genoperandoperand(MoveRR, TempReg, ReceiverResultReg);
  /* begin RetN: */
  genoperand(RetN, retNoffset);
- jmpTarget(jumpSI, jmpTarget(jumpNotSI, jmpTarget(jumpNotIndexable, jmpTarget(jumpBounds, gLabel()))));
+ jmpTarget(jumpSI, jmpTarget(jumpNotSI, jmpTarget(jumpNotIndexable, jmpTarget(jumpIsContext, jmpTarget(jumpBounds, gLabel())))));
  return 0;
 }
 
@@ -9154,20 +9215,111 @@
 static sqInt
 genInnerPrimitiveSize(sqInt retNoffset)
 {
+    sqInt jic;
+    AbstractInstruction *jmpFmtGe8;
+    sqInt jnx;
+    AbstractInstruction *jumpFmtIs2;
+    AbstractInstruction *jumpFmtLe4;
+    AbstractInstruction *jumpGotByteSize;
+    AbstractInstruction *jumpGotWordSize;
+    AbstractInstruction *jumpIsContext;
+    AbstractInstruction *jumpIsContext1;
     AbstractInstruction *jumpNotIndexable;
+    AbstractInstruction *jumpNotIndexable1;
     AbstractInstruction *jumpNotSI;
+    AbstractInstruction *jumpShortHeader;
+    AbstractInstruction *jumpSkip;
+    sqInt quickConstant;
+    sqInt quickConstant1;
+    sqInt quickConstant2;
+    sqInt quickConstant3;
 
  /* begin MoveR:R: */
  genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
  jumpNotSI = genJumpSmallIntegerInScratchReg(TempReg);
- jumpNotIndexable = genGetSizeOfintoformatRegscratchReg(ReceiverResultReg, ClassReg, SendNumArgsReg, TempReg);
+ /* begin genGetSizeOf:into:formatReg:scratchReg:abortJumpsInto: */
+ VM_LABEL(1genGetSizeOfintoformatRegscratchRegabortJumpsInto);
+ /* begin MoveMw:r:R: */
+ genoperandoperandoperand(MoveMwrR, 0, ReceiverResultReg, SendNumArgsReg);
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, SendNumArgsReg, ClassReg);
+ /* begin LogicalShiftRightCq:R: */
+ quickConstant = instFormatFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, SendNumArgsReg);
+ /* begin AndCq:R: */
+ quickConstant1 = (1 << (instFormatFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant1, SendNumArgsReg);
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, 2, SendNumArgsReg);
+ /* begin JumpLess: */
+ jumpNotIndexable1 = genoperand(JumpLess, ((sqInt)0));
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, ClassReg, TempReg);
+ /* begin LogicalShiftRightCq:R: */
+ quickConstant2 = compactClassFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant2, TempReg);
+ /* begin AndCq:R: */
+ quickConstant3 = (1 << (compactClassFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant3, TempReg);
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, ClassMethodContextCompactIndex, TempReg);
+ /* begin JumpZero: */
+ jumpIsContext1 = genoperand(JumpZero, ((sqInt)0));
+ /* begin MoveR:R: */
+ genoperandoperand(MoveRR, ClassReg, TempReg);
+ /* begin AndCq:R: */
+ genoperandoperand(AndCqR, TypeMask, TempReg);
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, HeaderTypeSizeAndClass, TempReg);
+ /* begin JumpNonZero: */
+ jumpShortHeader = genoperand(JumpNonZero, ((sqInt)0));
+ assert(Size4Bit == 0);
+ /* begin MoveMw:r:R: */
+ genoperandoperandoperand(MoveMwrR, 0 - (2 * BytesPerWord), ReceiverResultReg, ClassReg);
+ /* begin AndCq:R: */
+ genoperandoperand(AndCqR, ((sqInt) LongSizeMask), ClassReg);
+ /* begin Jump: */
+ jumpSkip = genoperand(Jump, ((sqInt)0));
+ jmpTarget(jumpShortHeader, gAndCqR(SizeMask, ClassReg));
+ jmpTarget(jumpSkip, gSubCqR(BaseHeaderSize, ClassReg));
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, 4, SendNumArgsReg);
+ /* begin JumpLessOrEqual: */
+ jumpFmtLe4 = genoperand(JumpLessOrEqual, ((sqInt)0));
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, 8, SendNumArgsReg);
+ /* begin JumpLess: */
+ jmpFmtGe8 = genoperand(JumpLess, ((sqInt)0));
+ /* begin AndCq:R: */
+ genoperandoperand(AndCqR, 3, SendNumArgsReg);
+ /* begin SubR:R: */
+ genoperandoperand(SubRR, SendNumArgsReg, ClassReg);
+ /* begin Jump: */
+ jumpGotByteSize = genoperand(Jump, ((sqInt)0));
+ jmpTarget(jmpFmtGe8, gLogicalShiftRightCqR(2, ClassReg));
+ /* begin Jump: */
+ jumpGotWordSize = genoperand(Jump, ((sqInt)0));
+ jmpTarget(jumpFmtLe4, gLabel());
+ /* begin LogicalShiftRightCq:R: */
+ genoperandoperand(LogicalShiftRightCqR, ShiftForWord, ClassReg);
+ /* begin CmpCq:R: */
+ genoperandoperand(CmpCqR, 2, SendNumArgsReg);
+ /* begin JumpZero: */
+ jumpFmtIs2 = genoperand(JumpZero, ((sqInt)0));
+ genGetFixedFieldsOfPointerNonIntintoscratchReg(ReceiverResultReg, SendNumArgsReg, TempReg);
+ /* begin SubR:R: */
+ genoperandoperand(SubRR, SendNumArgsReg, ClassReg);
+ jmpTarget(jumpFmtIs2, jmpTarget(jumpGotWordSize, jmpTarget(jumpGotByteSize, gLabel())));
+ jumpNotIndexable = jumpNotIndexable1;
+ jumpIsContext = jumpIsContext1;
+
  genConvertIntegerToSmallIntegerInScratchReg(ClassReg);
  /* begin MoveR:R: */
  genoperandoperand(MoveRR, ClassReg, ReceiverResultReg);
  flag("currently caller pushes result");
  /* begin RetN: */
  genoperand(RetN, retNoffset);
- jmpTarget(jumpNotSI, jmpTarget(jumpNotIndexable, gLabel()));
+ jmpTarget(jumpNotSI, jmpTarget(jumpNotIndexable, jmpTarget(jumpIsContext, gLabel())));
  return 0;
 }
 
@@ -9185,6 +9337,8 @@
     AbstractInstruction *jumpShortHeader;
     AbstractInstruction *jumpSI;
     AbstractInstruction *jumpSkip;
+    sqInt quickConstant;
+    sqInt quickConstant1;
 
  /* begin MoveR:R: */
  genoperandoperand(MoveRR, ReceiverResultReg, TempReg);
@@ -9199,9 +9353,11 @@
  /* begin MoveR:R: */
  genoperandoperand(MoveRR, TempReg, ClassReg);
  /* begin LogicalShiftRightCq:R: */
- genoperandoperand(LogicalShiftRightCqR, 8, TempReg);
+ quickConstant = instFormatFieldLSB();
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, TempReg);
  /* begin AndCq:R: */
- genoperandoperand(AndCqR, 15, TempReg);
+ quickConstant1 = (1 << (instFormatFieldWidth())) - 1;
+ genoperandoperand(AndCqR, quickConstant1, TempReg);
  /* begin MoveR:R: */
  genoperandoperand(MoveRR, TempReg, SendNumArgsReg);
  /* begin AndCq:R: */
@@ -9748,8 +9904,13 @@
 static sqInt
 genPrimitiveAt(void)
 {
+    sqInt r;
+
  assert((numRegArgs()) >= 1);
- return genInnerPrimitiveAt(0);
+ if (((r = genInnerPrimitiveAt(0))) < 0) {
+ return r;
+ }
+ return compileInterpreterPrimitive(functionPointerForCompiledMethodprimitiveIndex(methodObj, primitiveIndex));
 }
 
 static sqInt
@@ -10345,14 +10506,24 @@
 static sqInt
 genPrimitiveSize(void)
 {
- return genInnerPrimitiveSize(0);
+    sqInt r;
+
+ if (((r = genInnerPrimitiveSize(0))) < 0) {
+ return r;
+ }
+ return compileInterpreterPrimitive(functionPointerForCompiledMethodprimitiveIndex(methodObj, primitiveIndex));
 }
 
 static sqInt
 genPrimitiveStringAt(void)
 {
+    sqInt r;
+
  assert((numRegArgs()) >= 1);
- return genInnerPrimitiveStringAt(0);
+ if (((r = genInnerPrimitiveStringAt(0))) < 0) {
+ return r;
+ }
+ return compileInterpreterPrimitive(functionPointerForCompiledMethodprimitiveIndex(methodObj, primitiveIndex));
 }
 
 static sqInt
@@ -12176,11 +12347,11 @@
  /* begin MoveMw:r:R: */
  genoperandoperandoperand(MoveMwrR, 0, sourceReg, destReg);
  /* begin LogicalShiftRightCq:R: */
- quickConstant1 = (compactClassFieldLSB()) - ShiftForWord;
- genoperandoperand(LogicalShiftRightCqR, quickConstant1, destReg);
+ quickConstant = (compactClassFieldLSB()) - ShiftForWord;
+ genoperandoperand(LogicalShiftRightCqR, quickConstant, destReg);
  /* begin AndCq:R: */
- quickConstant = ((1 << (compactClassFieldWidth())) - 1) << ShiftForWord;
- genoperandoperand(AndCqR, quickConstant, destReg);
+ quickConstant1 = ((1 << (compactClassFieldWidth())) - 1) << ShiftForWord;
+ genoperandoperand(AndCqR, quickConstant1, destReg);
  /* begin JumpNonZero: */
  jumpCompact = genoperand(JumpNonZero, ((sqInt)0));
  /* begin MoveMw:r:R: */
@@ -12249,12 +12420,6 @@
 }
 
 static sqInt
-hasValidHeaderPostGC(CogMethod *cogMethod)
-{
- return ((cogMethod->objectHeader)) == (nullHeaderForMachineCodeMethod());
-}
-
-static sqInt
 incrementUsageOfTargetIfLinkedSendmcpcignored(sqInt annotation, char *mcpc, sqInt superfluity)
 {
     sqInt entryPoint;
@@ -12274,7 +12439,7 @@
  entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(0offsetAndSendTableForannotationinto);
+ VM_LABEL(1offsetAndSendTableForannotationinto);
 
 #      if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -13431,7 +13596,8 @@
  if (((cogMethod->cmType)) == CMMethod) {
  assert(((cogMethod->objectHeader)) == (nullHeaderForMachineCodeMethod()));
  (cogMethod->methodObject = remapOop((cogMethod->methodObject)));
- assert((rawHeaderOf((cogMethod->methodObject))) == (((sqInt)cogMethod)));
+ assert(((rawHeaderOf((cogMethod->methodObject))) == (((sqInt)cogMethod)))
+ || ((noAssertMethodClassAssociationOf((cogMethod->methodObject))) == (nilObject())));
  if (isYoung((cogMethod->methodObject))) {
  hasYoungObj = 1;
  }
@@ -13832,7 +13998,7 @@
  entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(1offsetAndSendTableForannotationinto);
+ VM_LABEL(2offsetAndSendTableForannotationinto);
 
 #      if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -14179,7 +14345,13 @@
  return 0;
 }
 
+static sqInt
+noAssertMethodClassAssociationOf(sqInt methodPointer)
+{
+ return literalofMethod((literalCountOfHeader(noAssertHeaderOf(methodPointer))) - 1, methodPointer);
+}
 
+
 /* Check that no metod is maximally marked. A maximal mark is an indication
  the method has been scanned to increase the usage count of its referent
  methods.  */
@@ -14975,7 +15147,7 @@
  return 0;
  }
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(2offsetAndSendTableForannotationinto);
+ VM_LABEL(3offsetAndSendTableForannotationinto);
 
 #    if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -16187,7 +16359,7 @@
  entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(3offsetAndSendTableForannotationinto);
+ VM_LABEL(4offsetAndSendTableForannotationinto);
 
 #      if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -16273,7 +16445,7 @@
  entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(4offsetAndSendTableForannotationinto);
+ VM_LABEL(5offsetAndSendTableForannotationinto);
 
 #      if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -16367,7 +16539,7 @@
 
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(5offsetAndSendTableForannotationinto);
+ VM_LABEL(6offsetAndSendTableForannotationinto);
 
 #      if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
@@ -16453,7 +16625,7 @@
  entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
  if (entryPoint > methodZoneBase) {
  /* begin offsetAndSendTableFor:annotation:into: */
- VM_LABEL(6offsetAndSendTableForannotationinto);
+ VM_LABEL(7offsetAndSendTableForannotationinto);
 
 #      if NewspeakVM
  if ((entryPoint & entryPointMask) == checkedEntryAlignment) {

Modified: branches/Cog/src/vm/cogit.h
===================================================================
--- branches/Cog/src/vm/cogit.h 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/src/vm/cogit.h 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,5 +1,5 @@
 /* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGenerator VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
 
 

Modified: branches/Cog/src/vm/cogmethod.h
===================================================================
--- branches/Cog/src/vm/cogmethod.h 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/src/vm/cogmethod.h 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,5 +1,5 @@
 /* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGenerator VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
 
 typedef struct {

Modified: branches/Cog/src/vm/cointerp.c
===================================================================
--- branches/Cog/src/vm/cointerp.c 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/src/vm/cointerp.c 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,9 +1,9 @@
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
    from
- CoInterpreter VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CoInterpreter VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -409,7 +409,6 @@
 sqInt classExternalFunction(void);
 sqInt classExternalLibrary(void);
 sqInt classExternalStructure(void);
-sqInt classFieldOffset(void);
 sqInt classFloat(void);
 sqInt classFloatCompactIndex(void);
 sqInt classHeader(sqInt oop);
@@ -430,8 +429,6 @@
 static void commonAtPut(sqInt stringy);
 static void commonAt(sqInt stringy);
 sqInt compactClassAt(sqInt ccIndex);
-sqInt compactClassFieldLSB(void);
-sqInt compactClassFieldWidth(void);
 sqInt compactClassIndexOfHeader(sqInt header);
 sqInt compactClassIndexOf(sqInt oop);
 sqInt compactClassTable(void);
@@ -572,7 +569,7 @@
 static void initializeObjectMemory(sqInt bytesToShift);
 static void initializeStacknumSlotspageSizestackLimitOffsetstackPageHeadroom(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage, sqInt stackLimitOffsetBytes, sqInt stackPageHeadroomBytes);
 static sqInt initStackPagesAndInterpret(void);
-static void installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy);
+static sqInt installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy);
 sqInt instanceSizeOf(sqInt classObj);
 sqInt instantiateClassindexableSize(sqInt classPointer, sqInt size);
 usqInt instructionPointerAddress(void);
@@ -589,6 +586,7 @@
 sqInt isCogMethodReference(sqInt methodHeader);
 sqInt isCompiledMethod(sqInt oop);
 static sqInt isContextHeader(sqInt aHeader);
+static sqInt isContextNonInt(sqInt oop);
 static sqInt isContext(sqInt oop);
 sqInt isFloatObject(sqInt oop);
 static sqInt isFree(StackPage * self_in_isFree);
@@ -633,6 +631,7 @@
 sqInt loadBitBltFrom(sqInt bb);
 static sqInt loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray);
 void loadInitialContext(void);
+void longPrintOop(sqInt oop);
 static sqInt lookupInMethodCacheSelclass(sqInt selector, sqInt class);
 static sqInt lookupMethodInClass(sqInt class);
 static sqInt lookupMethodInDictionary(sqInt dictionary);
@@ -686,8 +685,11 @@
 static StackPage * newStackPage(void);
 usqInt nextProfileTickAddress(void);
 sqInt nilObject(void);
+sqInt noAssertHeaderOf(sqInt methodPointer);
 static void noAtCacheCommonAtPut(sqInt stringy);
 static void noAtCacheCommonAt(sqInt stringy);
+static sqInt noInlineTemporaryin(sqInt offset, char *theFP);
+static void noInlineTemporaryinput(sqInt offset, char *theFP, sqInt valueOop);
 static sqInt noMarkedContextsOnPage(StackPage *thePage);
 static sqInt nonWeakFieldsOf(sqInt oop);
 sqInt nullHeaderForMachineCodeMethod(void);
@@ -1136,9 +1138,9 @@
 _iss StackPage * stackPage;
 _iss sqInt nilObj;
 _iss usqInt instructionPointer;
+_iss sqInt argumentCount;
 _iss usqInt method;
 _iss usqInt freeStart;
-_iss sqInt argumentCount;
 _iss usqInt newMethod;
 _iss sqInt messageSelector;
 _iss StackPage * pages;
@@ -1880,12 +1882,15 @@
  /* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.117]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.119]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
 
 /*** Macros ***/
+#define classFieldOffset() (0 - BaseHeaderSize)
+#define compactClassFieldLSB() 12
+#define compactClassFieldWidth() 5
 #define compilationBreakpoint(sel, len) do { \
  if ((len) == breakSelectorLength \
  && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, breakSelectorLength)) { \
@@ -1903,6 +1908,8 @@
 #define getCogCodeSize() integerObjectOf(GIV(cogCodeSize))
 #define getDesiredCogCodeSize() integerObjectOf(desiredCogCodeSize)
 #define initialEnterSmalltalkExecutive() enterSmalltalkExecutiveImplementation()
+#define instFormatFieldLSB() 8
+#define instFormatFieldWidth() 4
 #define memory() memory
 #define mostRecentlyUsedPage() GIV(mostRecentlyUsedPage)
 #define nextOpenPIC methodObject
@@ -1913,7 +1920,6 @@
 #define remapBufferCount() GIV(remapBufferCount)
 #define setDesiredCogCodeSize(dccs) (desiredCogCodeSize = (dccs))
 #define stackPageAtpages(index,pages) ((pages) + (index))
-#define typeEtAlWord(cm) (((long *)(cm))[1])
 #define validate() 0
 #define youngStart() GIV(youngStart)
 
@@ -7684,36 +7690,39 @@
  }
  }
  }
- /* begin commonVariable:at:cacheIndex: */
- VM_LABEL(0commonVariableatcacheIndex);
- stSize = GIV(atCache)[atIx + AtCacheSize];
- if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
- && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
- fmt = GIV(atCache)[atIx + AtCacheFmt];
- if (fmt <= 4) {
- fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
- result = longAt((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord));
- goto l73;
- }
- if (fmt < 8) {
+ if (!GIV(primFailCode)) {
+ /* begin commonVariable:at:cacheIndex: */
+ VM_LABEL(0commonVariableatcacheIndex);
+ stSize = GIV(atCache)[atIx + AtCacheSize];
+ if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
+ && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
+ fmt = GIV(atCache)[atIx + AtCacheFmt];
+ if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
+ fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
+ result = longAt((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord));
+ goto l73;
+ }
+ if (fmt < 8) {
 
- /* Bitmap */
+ /* Bitmap */
 
- result1 = long32At((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2));
- result = positive32BitIntegerFor(result1);
- goto l73;
+ result1 = long32At((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2));
+ result = positive32BitIntegerFor(result1);
+ goto l73;
+ }
+ if (fmt >= 16) {
+ result = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + ((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << ShiftForWord));
+ goto l73;
+ }
+ else {
+ result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
+ goto l73;
+ }
  }
- if (fmt >= 16) {
- result = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + ((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << ShiftForWord));
- goto l73;
- }
- else {
- result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
- goto l73;
- }
+ result = (GIV(primFailCode) = PrimErrBadIndex);
+ l73: /* end commonVariable:at:cacheIndex: */;
  }
- result = (GIV(primFailCode) = PrimErrBadIndex);
- l73: /* end commonVariable:at:cacheIndex: */;
  if (!GIV(primFailCode)) {
  /* begin fetchNextBytecode */
  currentBytecode = byteAtPointer(++localIP);
@@ -7721,6 +7730,8 @@
  longAtPointerput((localSP += (2 - 1) * BytesPerWord), result);
  goto l71;
  }
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
  }
  GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SpecialSelectors << ShiftForWord))) + BaseHeaderSize) + ((16 * 2) << ShiftForWord));
  GIV(argumentCount) = 1;
@@ -7783,59 +7794,62 @@
  }
  }
  }
- /* begin commonVariable:at:put:cacheIndex: */
- VM_LABEL(0commonVariableatputcacheIndex);
- stSize = GIV(atCache)[atIx + AtCacheSize];
- if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
- && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
- fmt = GIV(atCache)[atIx + AtCacheFmt];
- if (fmt <= 4) {
- fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
- /* begin storePointer:ofObject:withValue: */
- if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
- possibleRootStoreIntovalue(rcvr, value);
+ if (!GIV(primFailCode)) {
+ /* begin commonVariable:at:put:cacheIndex: */
+ VM_LABEL(0commonVariableatputcacheIndex);
+ stSize = GIV(atCache)[atIx + AtCacheSize];
+ if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
+ && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
+ fmt = GIV(atCache)[atIx + AtCacheFmt];
+ if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
+ fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
+ /* begin storePointer:ofObject:withValue: */
+ if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
+ possibleRootStoreIntovalue(rcvr, value);
+ }
+ longAtput((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord), value);
+ goto l75;
  }
- longAtput((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord), value);
- goto l75;
- }
- if (fmt < 8) {
+ if (fmt < 8) {
 
- /* Bitmap */
+ /* Bitmap */
 
- valToPut = positive32BitValueOf(value);
- if (!GIV(primFailCode)) {
- long32Atput((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2), valToPut);
+ valToPut = positive32BitValueOf(value);
+ if (!GIV(primFailCode)) {
+ long32Atput((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2), valToPut);
+ }
+ goto l75;
  }
- goto l75;
- }
- if (fmt >= 16) {
+ if (fmt >= 16) {
 
- /* Note fmt >= 16 is an artificial flag for strings */
+ /* Note fmt >= 16 is an artificial flag for strings */
 
- valToPut = asciiOfCharacter(value);
- if (!(!GIV(primFailCode))) {
- goto l75;
+ valToPut = asciiOfCharacter(value);
+ if (!(!GIV(primFailCode))) {
+ goto l75;
+ }
  }
- }
- else {
- valToPut = value;
- }
- if ((valToPut & 1)) {
- valToPut = (valToPut >> 1);
- if (!((valToPut >= 0)
- && (valToPut <= 255))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
+ else {
+ valToPut = value;
+ }
+ if ((valToPut & 1)) {
+ valToPut = (valToPut >> 1);
+ if (!((valToPut >= 0)
+ && (valToPut <= 255))) {
+ /* begin primitiveFail */
+ if (!GIV(primFailCode)) {
+ GIV(primFailCode) = 1;
+ }
+ goto l75;
  }
+ byteAtput((rcvr + BaseHeaderSize) + (((index >> 1)) - 1), valToPut);
  goto l75;
  }
- byteAtput((rcvr + BaseHeaderSize) + (((index >> 1)) - 1), valToPut);
- goto l75;
  }
+ GIV(primFailCode) = PrimErrBadIndex;
+ l75: /* end commonVariable:at:put:cacheIndex: */;
  }
- GIV(primFailCode) = PrimErrBadIndex;
- l75: /* end commonVariable:at:put:cacheIndex: */;
  if (!GIV(primFailCode)) {
  /* begin fetchNextBytecode */
  currentBytecode = byteAtPointer(++localIP);
@@ -7843,6 +7857,8 @@
  longAtPointerput((localSP += (3 - 1) * BytesPerWord), value);
  goto l74;
  }
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
  }
  GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SpecialSelectors << ShiftForWord))) + BaseHeaderSize) + ((17 * 2) << ShiftForWord));
  GIV(argumentCount) = 2;
@@ -11364,7 +11380,7 @@
  || ((heapMapAtWord(pointerForOop(fieldOop))) == 0)) {
  print("object leak in ");
  printHex(obj);
- print(" class ");
+ print(" class = ");
  printHex(fieldOop);
  /* begin cr */
  printf("\n");
@@ -11431,6 +11447,8 @@
  printHex(obj);
  print(" @ ");
  printNum(fi);
+ print(" = ");
+ printHex(fieldOop);
  /* begin cr */
  printf("\n");
  ok = 0;
@@ -11910,12 +11928,6 @@
 }
 
 sqInt
-classFieldOffset(void)
-{
- return 0 - BaseHeaderSize;
-}
-
-sqInt
 classFloat(void)
 {
  return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassFloat << ShiftForWord));
@@ -12265,7 +12277,12 @@
 
  atIx = (rcvr & AtCacheMask) + AtPutBase;
  if (!((GIV(atCache)[atIx + AtCacheOop]) == rcvr)) {
- installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy);
+ if (!(installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy))) {
+ assert(isContextNonInt(rcvr));
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
+ primitiveContextAtPut(); return;
+ }
  }
  if (!GIV(primFailCode)) {
  /* begin commonVariable:at:put:cacheIndex: */
@@ -12275,6 +12292,7 @@
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  fmt = GIV(atCache)[atIx + AtCacheFmt];
  if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
  fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
  /* begin storePointer:ofObject:withValue: */
  if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
@@ -12392,7 +12410,12 @@
 
  atIx = rcvr & AtCacheMask;
  if (!((GIV(atCache)[atIx + AtCacheOop]) == rcvr)) {
- installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy);
+ if (!(installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy))) {
+ assert(isContextNonInt(rcvr));
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
+ primitiveContextAt(); return;
+ }
  }
  if (!GIV(primFailCode)) {
  /* begin commonVariable:at:cacheIndex: */
@@ -12402,6 +12425,7 @@
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  fmt = GIV(atCache)[atIx + AtCacheFmt];
  if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
  fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
  result = longAt((rcvr + BaseHeaderSize) + (((index + fixedFields) - 1) << ShiftForWord));
  goto l1;
@@ -12463,18 +12487,6 @@
 }
 
 sqInt
-compactClassFieldLSB(void)
-{
- return 12;
-}
-
-sqInt
-compactClassFieldWidth(void)
-{
- return 5;
-}
-
-sqInt
 compactClassIndexOfHeader(sqInt header)
 {
  return (((usqInt) header) >> 12) & 31;
@@ -18026,10 +18038,12 @@
 }
 
 
-/* Install the oop of this object in the given cache (at or atPut), along
- with its size, format and fixedSize */
+/* Attempt to install the oop of this object in the given cache (at or
+ atPut), along with its size, format and fixedSize. Answer if this was
+ successful.
+ */
 
-static void
+static sqInt
 installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
@@ -18045,11 +18059,8 @@
  fmt = (((usqInt) hdr) >> 8) & 15;
  if ((fmt == 3)
  && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ GIV(primFailCode) = PrimErrBadReceiver;
+ return 0;
  }
  /* begin lengthOf:baseHeader:format: */
  if ((hdr & TypeMask) == HeaderTypeSizeAndClass) {
@@ -18101,6 +18112,7 @@
  : fmt));
  cache[atIx + AtCacheFixedFields] = fixedFields;
  cache[atIx + AtCacheSize] = (totalLength - fixedFields);
+ return 1;
 }
 
 
@@ -18596,6 +18608,12 @@
 }
 
 static sqInt
+isContextNonInt(sqInt oop)
+{
+ return ((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex;
+}
+
+static sqInt
 isContext(sqInt oop)
 {
  return ((oop & 1) == 0)
@@ -19618,7 +19636,103 @@
  GIV(instructionPointer) = ((sqInt) top);
 }
 
+void
+longPrintOop(sqInt oop)
+{
+    sqInt byte;
+    sqInt bytecodesPerLine;
+    sqInt fieldOop;
+    sqInt fmt;
+    sqInt header;
+    sqInt index;
+    sqInt lastIndex;
+    sqInt startIP;
+    sqInt sz;
 
+ if (((oop & 1))
+ || ((!(((oop >= heapBase) && (oop <= GIV(freeStart)))))
+ || (((oop & (BytesPerWord - 1)) != 0)
+ || ((((longAt(oop)) & TypeMask) == HeaderTypeFree)
+ || (((((fmt = (((usqInt) (longAt(oop))) >> 8) & 15)) >= 5) && (((fmt = (((usqInt) (longAt(oop))) >> 8) & 15)) <= 11))))))) {
+ printOop(oop); return;
+ }
+ printHex(oop);
+ print(": a(n) ");
+ printNameOfClasscount(fetchClassOfNonInt(oop), 5);
+ if (fmt > 4) {
+ print(" nbytes ");
+ printNum(byteSizeOf(oop));
+ }
+ /* begin cr */
+ printf("\n");
+ lastIndex = ((64 < ((startIP = ((sqInt) (lastPointerOf(oop)) >> 2)))) ? 64 : ((startIP = ((sqInt) (lastPointerOf(oop)) >> 2))));
+ if (lastIndex > 0) {
+ for (index = 1; index <= lastIndex; index += 1) {
+ fieldOop = longAt((oop + BaseHeaderSize) + ((index - 1) << ShiftForWord));
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printHex(fieldOop);
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printOopShort(fieldOop);
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ if (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12) {
+ startIP = (startIP * BytesPerWord) + 1;
+ /* begin lengthOf: */
+ header = longAt(oop);
+ /* begin lengthOf:baseHeader:format: */
+ if ((header & TypeMask) == HeaderTypeSizeAndClass) {
+ sz = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
+ }
+ else {
+ sz = header & SizeMask;
+ }
+ sz -= header & Size4Bit;
+ if (((((usqInt) header) >> 8) & 15) <= 4) {
+ lastIndex = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+ goto l1;
+ }
+ if (((((usqInt) header) >> 8) & 15) < 8) {
+ lastIndex = ((usqInt) (sz - BaseHeaderSize)) >> 2;
+ goto l1;
+ }
+ else {
+ lastIndex = (sz - BaseHeaderSize) - (((((usqInt) header) >> 8) & 15) & 3);
+ goto l1;
+ }
+ l1: /* end lengthOf: */;
+ if ((lastIndex - startIP) > 100) {
+ lastIndex = startIP + 100;
+ }
+ bytecodesPerLine = 8;
+ for (index = startIP; index <= lastIndex; index += 1) {
+ byte = byteAt((oop + BaseHeaderSize) + (index - 1));
+ printf(" %02x/%-3d", byte,byte);
+ if ((((index - startIP) + 1) % bytecodesPerLine) == 0) {
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ if (!((((lastIndex - startIP) + 1) % bytecodesPerLine) == 0)) {
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ else {
+ if (startIP > 64) {
+ print("...");
+ /* begin cr */
+ printf("\n");
+ }
+ }
+}
+
+
 /* This method implements a simple method lookup cache. If an entry for the
  given selector and class is found in the cache, set the values of
  'newMethod' and 'primitiveFunctionPointer' and return true. Otherwise,
@@ -22036,7 +22150,18 @@
  return GIV(nilObj);
 }
 
+sqInt
+noAssertHeaderOf(sqInt methodPointer)
+{
+    sqInt methodHeader;
 
+ methodHeader = longAt((methodPointer + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+ return (isCogMethodReference(methodHeader)
+ ? (((CogMethod *) methodHeader)->methodHeader)
+ : methodHeader);
+}
+
+
 /* This code is called if the receiver responds primitively to at:Put:.
  The cogit can implement at: & at:put: quickly in machine code, and needs a
  backup that provides error codes. But it does not want the at cache so it
@@ -22121,7 +22246,47 @@
  }
 }
 
+static sqInt
+noInlineTemporaryin(sqInt offset, char *theFP)
+{
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
 
+ return ((((usqInt)(longAt(theFP + FoxMethod)))) < heapBase
+ ? (offset < ((frameNumArgs = (mframeCogMethod(theFP)->cmNumArgs)))
+ ? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs - offset) * BytesPerWord))
+ : longAt(((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - offset) * BytesPerWord)))
+ : (offset < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))
+ ? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - offset) * BytesPerWord))
+ : longAt(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - offset) * BytesPerWord))));
+}
+
+static void
+noInlineTemporaryinput(sqInt offset, char *theFP, sqInt valueOop)
+{
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
+
+ /* begin temporary:in:put: */
+ VM_LABEL(0temporaryinput);
+ if ((((usqInt)(longAt(theFP + FoxMethod)))) < heapBase) {
+ /* begin mtemporary:in:put: */
+ longAtput((offset < ((frameNumArgs = (mframeCogMethod(theFP)->cmNumArgs)))
+ ? (theFP + FoxCallerSavedIP) + ((frameNumArgs - offset) * BytesPerWord)
+ : ((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - offset) * BytesPerWord)), valueOop);
+ }
+ else {
+ /* begin itemporary:in:put: */
+ if (offset < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))) {
+ longAtput((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - offset) * BytesPerWord), valueOop);
+ }
+ else {
+ longAtput(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - offset) * BytesPerWord), valueOop);
+ }
+ }
+}
+
+
 /* Answer true if there are no marked contexts on thePage. */
 
 static sqInt
@@ -24459,7 +24624,7 @@
     sqInt methodHeader;
     sqInt newCopy;
     sqInt objHeader;
-    sqInt receiver;
+    sqInt rcvr;
     char *sp;
     sqInt sp1;
     char *spouseFP;
@@ -24467,29 +24632,29 @@
     sqInt valuePointer;
     sqInt valuePointer1;
 
- receiver = longAt(GIV(stackPointer));
- if ((receiver & 1)) {
- newCopy = receiver;
+ rcvr = longAt(GIV(stackPointer));
+ if ((rcvr & 1)) {
+ newCopy = rcvr;
  }
  else {
- objHeader = longAt(receiver);
+ objHeader = longAt(rcvr);
  if (((((usqInt) objHeader) >> 12) & 31) == ClassMethodContextCompactIndex) {
  /* begin cloneContext: */
  VM_LABEL(0cloneContext);
- cloned = eeInstantiateMethodContextByteSize(byteSizeOf(receiver));
+ cloned = eeInstantiateMethodContextByteSize(byteSizeOf(rcvr));
  if (cloned != 0) {
  for (i = 0; i <= StackPointerIndex; i += 1) {
  /* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer = externalInstVarofContext(i, receiver);
+ valuePointer = externalInstVarofContext(i, rcvr);
  longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), valuePointer);
  }
  for (i = MethodIndex; i <= ReceiverIndex; i += 1) {
- longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), longAt((receiver + BaseHeaderSize) + (i << ShiftForWord)));
+ longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), longAt((rcvr + BaseHeaderSize) + (i << ShiftForWord)));
  }
- if ((((longAt((receiver + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
- && (!(isWidowedContext(receiver)))) {
+ if ((((longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(rcvr)))) {
  /* begin frameOfMarriedContext: */
- value = longAt((receiver + BaseHeaderSize) + (SenderIndex << ShiftForWord));
+ value = longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord));
  /* begin withoutSmallIntegerTags: */
  assert((value & 1));
  spouseFP = pointerForOop(value - 1);
@@ -24507,16 +24672,16 @@
  }
  }
  else {
- sp1 = (fetchStackPointerOf(receiver)) - 1;
+ sp1 = (fetchStackPointerOf(rcvr)) - 1;
  for (i = 0; i <= sp1; i += 1) {
- longAtput((cloned + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord), longAt((receiver + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord)));
+ longAtput((cloned + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord), longAt((rcvr + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord)));
  }
  }
  }
  newCopy = cloned;
  }
  else {
- newCopy = clone(receiver);
+ newCopy = clone(rcvr);
  }
  if (newCopy == 0) {
  (GIV(primFailCode) = PrimErrNoMemory); return;
@@ -25449,6 +25614,10 @@
  }
 }
 
+
+/* Special version of primitiveAt for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static void
 primitiveContextAt(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -25476,11 +25645,7 @@
 
  index = longAt(GIV(stackPointer));
  if (!((index & 1))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadArgument); return;
  }
  index = (index >> 1);
 
@@ -25494,7 +25659,7 @@
 
  value = stObjectat(aContext, index);
  /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp = GIV(stackPointer) + ((GIV(argumentCount) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp;
  return;
  }
@@ -25576,11 +25741,7 @@
  stSize = (sp11 >> 1);
  l5: /* end stackPointerForMaybeMarriedContext: */;
  if (!(((index >= 1) && (index <= stSize)))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadIndex); return;
  }
  /* begin subscript:with:format: */
  if (fmt <= 4) {
@@ -25597,7 +25758,7 @@
  }
  l3: /* end subscript:with:format: */;
  /* begin pop:thenPush: */
- longAtput((sp1 = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp1;
  return;
  }
@@ -25607,11 +25768,7 @@
  assert((value1 & 1));
  spouseFP = pointerForOop(value1 - 1);
  if (!(((index >= 1) && (index <= (stackPointerIndexForFrame(spouseFP)))))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadIndex); return;
  }
  value = ((((usqInt)(longAt(spouseFP + FoxMethod)))) < heapBase
  ? ((index - 1) < ((frameNumArgs = (mframeCogMethod(spouseFP)->cmNumArgs)))
@@ -25621,10 +25778,14 @@
  ? longAt((spouseFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - 1)) * BytesPerWord))
  : longAt(((spouseFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - 1)) * BytesPerWord))));
  /* begin pop:thenPush: */
- longAtput((sp2 = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp2;
 }
 
+
+/* Special version of primitiveAtPut for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static sqInt
 primitiveContextAtPut(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -25655,18 +25816,14 @@
  index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
  aContext = longAt(GIV(stackPointer) + (2 * BytesPerWord));
  if (!((index & 1))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadArgument);
  }
  hdr = longAt(aContext);
  index = (index >> 1);
  if (!(((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
  stObjectatput(aContext, index, value);
  /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp;
  return null;
  }
@@ -25748,11 +25905,7 @@
  stSize = (sp11 >> 1);
  l4: /* end stackPointerForMaybeMarriedContext: */;
  if (!(((index >= 1) && (index <= stSize)))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadIndex);
  }
  /* begin subscript:with:storing:format: */
  VM_LABEL(0subscriptwithstoringformat);
@@ -25804,7 +25957,7 @@
  }
  }
  /* begin pop:thenPush: */
- longAtput((sp1 = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp1;
  return null;
  }
@@ -25814,15 +25967,10 @@
  assert((value1 & 1));
  spouseFP = pointerForOop(value1 - 1);
  if (!(((index >= 1) && (index <= (stackPointerIndexForFrame(spouseFP)))))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadIndex);
  }
  /* begin temporary:in:put: */
- VM_LABEL(0temporaryinput);
- ;
+ VM_LABEL(1temporaryinput);
  if ((((usqInt)(longAt(spouseFP + FoxMethod)))) < heapBase) {
  /* begin mtemporary:in:put: */
  longAtput(((index - 1) < ((frameNumArgs = (mframeCogMethod(spouseFP)->cmNumArgs)))
@@ -25839,11 +25987,15 @@
  }
  }
  /* begin pop:thenPush: */
- longAtput((sp2 = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp2;
  return null;
 }
 
+
+/* Special version of primitiveSize for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static void
 primitiveContextSize(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -25943,11 +26095,9 @@
  else {
  sz = totalLength - fixedFields;
  }
- if (!GIV(primFailCode)) {
- /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), ((sz << 1) | 1));
- GIV(stackPointer) = sp;
- }
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((sz << 1) | 1));
+ GIV(stackPointer) = sp;
 }
 
 
@@ -34440,31 +34590,77 @@
 static void
 primitiveSize(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt ccIndex;
+    sqInt class;
+    sqInt classFormat;
+    sqInt fixedFields;
+    sqInt fmt;
+    sqInt hdr;
     sqInt rcvr;
     char *sp;
     sqInt sz;
+    sqInt totalLength;
 
  rcvr = longAt(GIV(stackPointer));
- if ((rcvr & 1)) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ if (((rcvr & 1))
+ || ((
+ /* Integers are not indexable */
+
+(hdr = longAt(rcvr)),
+ ((fmt = (((usqInt) hdr) >> 8) & 15)) < 2))) {
+ (GIV(primFailCode) = PrimErrBadReceiver); return;
  }
- if (((((usqInt) (longAt(rcvr))) >> 8) & 15) < 2) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ primitiveContextSize(); return;
  }
- sz = stSizeOf(rcvr);
- if (!GIV(primFailCode)) {
- /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((sz << 1) | 1));
- GIV(stackPointer) = sp;
+ /* begin lengthOf:baseHeader:format: */
+ if ((hdr & TypeMask) == HeaderTypeSizeAndClass) {
+ sz = (longAt(rcvr - (BytesPerWord * 2))) & LongSizeMask;
  }
+ else {
+ sz = hdr & SizeMask;
+ }
+ sz -= hdr & Size4Bit;
+ if (fmt <= 4) {
+ totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+ goto l1;
+ }
+ if (fmt < 8) {
+ totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
+ goto l1;
+ }
+ else {
+ totalLength = (sz - BaseHeaderSize) - (fmt & 3);
+ goto l1;
+ }
+l1: /* end lengthOf:baseHeader:format: */;
+ /* begin fixedFieldsOf:format:length: */
+ if ((fmt > 4)
+ || (fmt == 2)) {
+ fixedFields = 0;
+ goto l2;
+ }
+ if (fmt < 2) {
+ fixedFields = totalLength;
+ goto l2;
+ }
+ /* begin fetchClassOfNonInt: */
+ if (((ccIndex = (((usqInt) (longAt(rcvr))) >> 12) & 31)) == 0) {
+ class = (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask;
+ goto l3;
+ }
+ else {
+ class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
+ goto l3;
+ }
+l3: /* end fetchClassOfNonInt: */;
+ classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
+ fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
+l2: /* end fixedFieldsOf:format:length: */;
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((totalLength - fixedFields) << 1) | 1));
+ GIV(stackPointer) = sp;
 }
 
 
@@ -38226,6 +38422,7 @@
 printMethodDictionaryOf(sqInt behavior)
 {
     sqInt index;
+    sqInt meth;
     sqInt methodArray;
     sqInt selector;
 
@@ -38235,9 +38432,15 @@
  for (index = SelectorStart; index <= ((fetchWordLengthOf(longAt((behavior + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord)))) - 1); index += 1) {
  selector = longAt(((longAt((behavior + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord))) + BaseHeaderSize) + (index << ShiftForWord));
  if (selector != GIV(nilObj)) {
+ meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
  printOopShort(selector);
  print(" => ");
- printOopShort(longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord)));
+ printOopShort(meth);
+ print(" (");
+ printHex(selector);
+ print(" => ");
+ printHex(meth);
+ putchar(')');
  /* begin cr */
  printf("\n");
  }
@@ -38248,6 +38451,7 @@
 printMethodDictionary(sqInt dictionary)
 {
     sqInt index;
+    sqInt meth;
     sqInt methodArray;
     sqInt selector;
 
@@ -38255,9 +38459,15 @@
  for (index = SelectorStart; index <= ((fetchWordLengthOf(dictionary)) - 1); index += 1) {
  selector = longAt((dictionary + BaseHeaderSize) + (index << ShiftForWord));
  if (selector != GIV(nilObj)) {
+ meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
  printOopShort(selector);
  print(" => ");
- printOopShort(longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord)));
+ printOopShort(meth);
+ print(" (");
+ printHex(selector);
+ print(" => ");
+ printHex(meth);
+ putchar(')');
  /* begin cr */
  printf("\n");
  }
@@ -42305,6 +42515,7 @@
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
+    sqInt sp;
     sqInt stSize;
     sqInt sz;
     sqInt totalLength;
@@ -42321,44 +42532,61 @@
  sz -= hdr & Size4Bit;
  if (fmt <= 4) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
- goto l1;
+ goto l2;
  }
  if (fmt < 8) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
- goto l1;
+ goto l2;
  }
  else {
  totalLength = (sz - BaseHeaderSize) - (fmt & 3);
- goto l1;
+ goto l2;
  }
-l1: /* end lengthOf:baseHeader:format: */;
+l2: /* end lengthOf:baseHeader:format: */;
  /* begin fixedFieldsOf:format:length: */
  if ((fmt > 4)
  || (fmt == 2)) {
  fixedFields = 0;
- goto l2;
+ goto l3;
  }
  if (fmt < 2) {
  fixedFields = totalLength;
- goto l2;
+ goto l3;
  }
  /* begin fetchClassOfNonInt: */
  if (((ccIndex = (((usqInt) (longAt(array))) >> 12) & 31)) == 0) {
  class = (longAt(array - BaseHeaderSize)) & AllButTypeMask;
- goto l3;
+ goto l4;
  }
  else {
  class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
- goto l3;
+ goto l4;
  }
-l3: /* end fetchClassOfNonInt: */;
+l4: /* end fetchClassOfNonInt: */;
  classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
  fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
-l2: /* end fixedFieldsOf:format:length: */;
- if (fmt == 3) {
- assert(!(isContextHeader(hdr)));
+l3: /* end fixedFieldsOf:format:length: */;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ /* begin fetchStackPointerOf: */
+ sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord));
+ if (!((sp & 1))) {
+ stSize = 0;
+ goto l1;
+ }
+ assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array)));
+ stSize = (sp >> 1);
+ l1: /* end fetchStackPointerOf: */;
+ if (((((usqInt) index)) >= (((usqInt) 1)))
+ && (((((usqInt) index)) <= (((usqInt) stSize)))
+ && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(array)))))) {
+ return noInlineTemporaryin(index - 1, frameOfMarriedContext(array));
+ }
  }
- stSize = totalLength - fixedFields;
+ else {
+ stSize = totalLength - fixedFields;
+ }
  if (((((usqInt) index)) >= (((usqInt) 1)))
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  /* begin subscript:with:format: */
@@ -42390,6 +42618,7 @@
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
+    sqInt sp;
     sqInt stSize;
     sqInt sz;
     sqInt totalLength;
@@ -42407,44 +42636,62 @@
  sz -= hdr & Size4Bit;
  if (fmt <= 4) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
- goto l1;
+ goto l2;
  }
  if (fmt < 8) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
- goto l1;
+ goto l2;
  }
  else {
  totalLength = (sz - BaseHeaderSize) - (fmt & 3);
- goto l1;
+ goto l2;
  }
-l1: /* end lengthOf:baseHeader:format: */;
+l2: /* end lengthOf:baseHeader:format: */;
  /* begin fixedFieldsOf:format:length: */
  if ((fmt > 4)
  || (fmt == 2)) {
  fixedFields = 0;
- goto l2;
+ goto l3;
  }
  if (fmt < 2) {
  fixedFields = totalLength;
- goto l2;
+ goto l3;
  }
  /* begin fetchClassOfNonInt: */
  if (((ccIndex = (((usqInt) (longAt(array))) >> 12) & 31)) == 0) {
  class = (longAt(array - BaseHeaderSize)) & AllButTypeMask;
- goto l3;
+ goto l4;
  }
  else {
  class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
- goto l3;
+ goto l4;
  }
-l3: /* end fetchClassOfNonInt: */;
+l4: /* end fetchClassOfNonInt: */;
  classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
  fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
-l2: /* end fixedFieldsOf:format:length: */;
- if (fmt == 3) {
- assert(!(isContextHeader(hdr)));
+l3: /* end fixedFieldsOf:format:length: */;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ /* begin fetchStackPointerOf: */
+ sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord));
+ if (!((sp & 1))) {
+ stSize = 0;
+ goto l1;
+ }
+ assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array)));
+ stSize = (sp >> 1);
+ l1: /* end fetchStackPointerOf: */;
+ if (((((usqInt) index)) >= (((usqInt) 1)))
+ && (((((usqInt) index)) <= (((usqInt) stSize)))
+ && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(array)))))) {
+ noInlineTemporaryinput(index - 1, frameOfMarriedContext(array), value);
+ return;
+ }
  }
- stSize = totalLength - fixedFields;
+ else {
+ stSize = totalLength - fixedFields;
+ }
  if (((((usqInt) index)) >= (((usqInt) 1)))
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  /* begin subscript:with:storing:format: */

Modified: branches/Cog/src/vm/cointerp.h
===================================================================
--- branches/Cog/src/vm/cointerp.h 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/src/vm/cointerp.h 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,5 +1,5 @@
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
 
 
@@ -45,7 +45,6 @@
 void checkAssertsEnabledInCoInterpreter(void);
 sqInt checkedLongAt(sqInt byteAddress);
 sqInt classArray(void);
-sqInt classFieldOffset(void);
 sqInt classFloat(void);
 sqInt classFloatCompactIndex(void);
 sqInt classHeader(sqInt oop);
@@ -53,8 +52,6 @@
 void clearTraceLog(void);
 CogMethod * cogMethodOf(sqInt aMethodOop);
 sqInt compactClassAt(sqInt ccIndex);
-sqInt compactClassFieldLSB(void);
-sqInt compactClassFieldWidth(void);
 sqInt compactClassIndexOfHeader(sqInt header);
 sqInt compactClassIndexOf(sqInt oop);
 sqInt compactClassTable(void);
@@ -103,6 +100,7 @@
 sqInt lengthOf(sqInt oop);
 sqInt literalCountOfHeader(sqInt headerPointer);
 sqInt literalofMethod(sqInt offset, sqInt methodPointer);
+void longPrintOop(sqInt oop);
 sqInt lookupreceiver(sqInt selector, sqInt rcvr);
 void markActiveMethodsAndReferents(void);
 void markAndTrace(sqInt oop);
@@ -119,6 +117,7 @@
 usqInt newMethodAddress(void);
 usqInt nextProfileTickAddress(void);
 sqInt nilObject(void);
+sqInt noAssertHeaderOf(sqInt methodPointer);
 sqInt nullHeaderForMachineCodeMethod(void);
 sqInt objectAfter(sqInt oop);
 sqInt objectBefore(sqInt address);
@@ -210,6 +209,9 @@
 
 
 /*** Macros ***/
+#define classFieldOffset() (0 - BaseHeaderSize)
+#define compactClassFieldLSB() 12
+#define compactClassFieldWidth() 5
 #define compilationBreakpoint(sel, len) do { \
  if ((len) == breakSelectorLength \
  && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, breakSelectorLength)) { \
@@ -217,4 +219,6 @@
  compilationBreakpointFor(sel); \
  } \
 } while (0)
+#define instFormatFieldLSB() 8
+#define instFormatFieldWidth() 4
 

Modified: branches/Cog/src/vm/cointerpmt.c
===================================================================
--- branches/Cog/src/vm/cointerpmt.c 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/src/vm/cointerpmt.c 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,9 +1,9 @@
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
    from
- CoInterpreterMT VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CoInterpreterMT VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
-static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -456,7 +456,6 @@
 sqInt classExternalFunction(void);
 sqInt classExternalLibrary(void);
 sqInt classExternalStructure(void);
-sqInt classFieldOffset(void);
 sqInt classFloat(void);
 sqInt classFloatCompactIndex(void);
 sqInt classHeader(sqInt oop);
@@ -477,8 +476,6 @@
 static void commonAtPut(sqInt stringy);
 static void commonAt(sqInt stringy);
 sqInt compactClassAt(sqInt ccIndex);
-sqInt compactClassFieldLSB(void);
-sqInt compactClassFieldWidth(void);
 sqInt compactClassIndexOfHeader(sqInt header);
 sqInt compactClassIndexOf(sqInt oop);
 sqInt compactClassTable(void);
@@ -627,7 +624,7 @@
 static void initializeObjectMemory(sqInt bytesToShift);
 static void initializeStacknumSlotspageSizestackLimitOffsetstackPageHeadroom(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage, sqInt stackLimitOffsetBytes, sqInt stackPageHeadroomBytes);
 static sqInt initStackPagesAndInterpret(void);
-static void installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy);
+static sqInt installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy);
 sqInt instanceSizeOf(sqInt classObj);
 sqInt instantiateClassindexableSize(sqInt classPointer, sqInt size);
 usqInt instructionPointerAddress(void);
@@ -646,6 +643,7 @@
 sqInt isCogMethodReference(sqInt methodHeader);
 sqInt isCompiledMethod(sqInt oop);
 static sqInt isContextHeader(sqInt aHeader);
+static sqInt isContextNonInt(sqInt oop);
 static sqInt isContext(sqInt oop);
 sqInt isFloatObject(sqInt oop);
 static sqInt isFree(StackPage * self_in_isFree);
@@ -690,6 +688,7 @@
 sqInt loadBitBltFrom(sqInt bb);
 static sqInt loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray);
 void loadInitialContext(void);
+void longPrintOop(sqInt oop);
 static sqInt lookupInMethodCacheSelclass(sqInt selector, sqInt class);
 static sqInt lookupMethodInClass(sqInt class);
 static sqInt lookupMethodInDictionary(sqInt dictionary);
@@ -743,8 +742,11 @@
 static StackPage * newStackPage(void);
 usqInt nextProfileTickAddress(void);
 sqInt nilObject(void);
+sqInt noAssertHeaderOf(sqInt methodPointer);
 static void noAtCacheCommonAtPut(sqInt stringy);
 static void noAtCacheCommonAt(sqInt stringy);
+static sqInt noInlineTemporaryin(sqInt offset, char *theFP);
+static void noInlineTemporaryinput(sqInt offset, char *theFP, sqInt valueOop);
 static sqInt noMarkedContextsOnPage(StackPage *thePage);
 static sqInt nonWeakFieldsOf(sqInt oop);
 sqInt nullHeaderForMachineCodeMethod(void);
@@ -1219,8 +1221,8 @@
 _iss StackPage * stackPage;
 _iss sqInt nilObj;
 _iss usqInt instructionPointer;
+_iss sqInt argumentCount;
 _iss usqInt method;
-_iss sqInt argumentCount;
 _iss usqInt freeStart;
 _iss usqInt newMethod;
 _iss usqInt youngStart;
@@ -1980,13 +1982,16 @@
  /* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.117]";
+const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.119]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 sqInt willNotThreadWarnCount;
 
 
 /*** Macros ***/
+#define classFieldOffset() (0 - BaseHeaderSize)
+#define compactClassFieldLSB() 12
+#define compactClassFieldWidth() 5
 #define compilationBreakpoint(sel, len) do { \
  if ((len) == breakSelectorLength \
  && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, breakSelectorLength)) { \
@@ -2005,6 +2010,8 @@
 #define getDesiredCogCodeSize() integerObjectOf(desiredCogCodeSize)
 #define getMaxWaitingPriority() GIV(maxWaitingPriority)
 #define getNumThreads() GIV(numThreads)
+#define instFormatFieldLSB() 8
+#define instFormatFieldWidth() 4
 #define memory() memory
 #define mostRecentlyUsedPage() GIV(mostRecentlyUsedPage)
 #define nextOpenPIC methodObject
@@ -2015,7 +2022,6 @@
 #define remapBufferCount() GIV(remapBufferCount)
 #define setDesiredCogCodeSize(dccs) (desiredCogCodeSize = (dccs))
 #define stackPageAtpages(index,pages) ((pages) + (index))
-#define typeEtAlWord(cm) (((long *)(cm))[1])
 #define validate() 0
 #define youngStart() GIV(youngStart)
 
@@ -7786,36 +7792,39 @@
  }
  }
  }
- /* begin commonVariable:at:cacheIndex: */
- VM_LABEL(0commonVariableatcacheIndex);
- stSize = GIV(atCache)[atIx + AtCacheSize];
- if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
- && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
- fmt = GIV(atCache)[atIx + AtCacheFmt];
- if (fmt <= 4) {
- fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
- result = longAt((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord));
- goto l73;
- }
- if (fmt < 8) {
+ if (!GIV(primFailCode)) {
+ /* begin commonVariable:at:cacheIndex: */
+ VM_LABEL(0commonVariableatcacheIndex);
+ stSize = GIV(atCache)[atIx + AtCacheSize];
+ if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
+ && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
+ fmt = GIV(atCache)[atIx + AtCacheFmt];
+ if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
+ fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
+ result = longAt((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord));
+ goto l73;
+ }
+ if (fmt < 8) {
 
- /* Bitmap */
+ /* Bitmap */
 
- result1 = long32At((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2));
- result = positive32BitIntegerFor(result1);
- goto l73;
+ result1 = long32At((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2));
+ result = positive32BitIntegerFor(result1);
+ goto l73;
+ }
+ if (fmt >= 16) {
+ result = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + ((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << ShiftForWord));
+ goto l73;
+ }
+ else {
+ result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
+ goto l73;
+ }
  }
- if (fmt >= 16) {
- result = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + ((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << ShiftForWord));
- goto l73;
- }
- else {
- result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
- goto l73;
- }
+ result = (GIV(primFailCode) = PrimErrBadIndex);
+ l73: /* end commonVariable:at:cacheIndex: */;
  }
- result = (GIV(primFailCode) = PrimErrBadIndex);
- l73: /* end commonVariable:at:cacheIndex: */;
  if (!GIV(primFailCode)) {
  /* begin fetchNextBytecode */
  currentBytecode = byteAtPointer(++localIP);
@@ -7823,6 +7832,8 @@
  longAtPointerput((localSP += (2 - 1) * BytesPerWord), result);
  goto l71;
  }
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
  }
  GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SpecialSelectors << ShiftForWord))) + BaseHeaderSize) + ((16 * 2) << ShiftForWord));
  GIV(argumentCount) = 1;
@@ -7885,59 +7896,62 @@
  }
  }
  }
- /* begin commonVariable:at:put:cacheIndex: */
- VM_LABEL(0commonVariableatputcacheIndex);
- stSize = GIV(atCache)[atIx + AtCacheSize];
- if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
- && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
- fmt = GIV(atCache)[atIx + AtCacheFmt];
- if (fmt <= 4) {
- fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
- /* begin storePointer:ofObject:withValue: */
- if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
- possibleRootStoreIntovalue(rcvr, value);
+ if (!GIV(primFailCode)) {
+ /* begin commonVariable:at:put:cacheIndex: */
+ VM_LABEL(0commonVariableatputcacheIndex);
+ stSize = GIV(atCache)[atIx + AtCacheSize];
+ if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
+ && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
+ fmt = GIV(atCache)[atIx + AtCacheFmt];
+ if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
+ fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
+ /* begin storePointer:ofObject:withValue: */
+ if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
+ possibleRootStoreIntovalue(rcvr, value);
+ }
+ longAtput((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord), value);
+ goto l75;
  }
- longAtput((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord), value);
- goto l75;
- }
- if (fmt < 8) {
+ if (fmt < 8) {
 
- /* Bitmap */
+ /* Bitmap */
 
- valToPut = positive32BitValueOf(value);
- if (!GIV(primFailCode)) {
- long32Atput((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2), valToPut);
+ valToPut = positive32BitValueOf(value);
+ if (!GIV(primFailCode)) {
+ long32Atput((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2), valToPut);
+ }
+ goto l75;
  }
- goto l75;
- }
- if (fmt >= 16) {
+ if (fmt >= 16) {
 
- /* Note fmt >= 16 is an artificial flag for strings */
+ /* Note fmt >= 16 is an artificial flag for strings */
 
- valToPut = asciiOfCharacter(value);
- if (!(!GIV(primFailCode))) {
- goto l75;
+ valToPut = asciiOfCharacter(value);
+ if (!(!GIV(primFailCode))) {
+ goto l75;
+ }
  }
- }
- else {
- valToPut = value;
- }
- if ((valToPut & 1)) {
- valToPut = (valToPut >> 1);
- if (!((valToPut >= 0)
- && (valToPut <= 255))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
+ else {
+ valToPut = value;
+ }
+ if ((valToPut & 1)) {
+ valToPut = (valToPut >> 1);
+ if (!((valToPut >= 0)
+ && (valToPut <= 255))) {
+ /* begin primitiveFail */
+ if (!GIV(primFailCode)) {
+ GIV(primFailCode) = 1;
+ }
+ goto l75;
  }
+ byteAtput((rcvr + BaseHeaderSize) + (((index >> 1)) - 1), valToPut);
  goto l75;
  }
- byteAtput((rcvr + BaseHeaderSize) + (((index >> 1)) - 1), valToPut);
- goto l75;
  }
+ GIV(primFailCode) = PrimErrBadIndex;
+ l75: /* end commonVariable:at:put:cacheIndex: */;
  }
- GIV(primFailCode) = PrimErrBadIndex;
- l75: /* end commonVariable:at:put:cacheIndex: */;
  if (!GIV(primFailCode)) {
  /* begin fetchNextBytecode */
  currentBytecode = byteAtPointer(++localIP);
@@ -7945,6 +7959,8 @@
  longAtPointerput((localSP += (3 - 1) * BytesPerWord), value);
  goto l74;
  }
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
  }
  GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SpecialSelectors << ShiftForWord))) + BaseHeaderSize) + ((17 * 2) << ShiftForWord));
  GIV(argumentCount) = 2;
@@ -11724,7 +11740,7 @@
  || ((heapMapAtWord(pointerForOop(fieldOop))) == 0)) {
  print("object leak in ");
  printHex(obj);
- print(" class ");
+ print(" class = ");
  printHex(fieldOop);
  /* begin cr */
  printf("\n");
@@ -11791,6 +11807,8 @@
  printHex(obj);
  print(" @ ");
  printNum(fi);
+ print(" = ");
+ printHex(fieldOop);
  /* begin cr */
  printf("\n");
  ok = 0;
@@ -12326,12 +12344,6 @@
 }
 
 sqInt
-classFieldOffset(void)
-{
- return 0 - BaseHeaderSize;
-}
-
-sqInt
 classFloat(void)
 {
  return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassFloat << ShiftForWord));
@@ -12681,7 +12693,12 @@
 
  atIx = (rcvr & AtCacheMask) + AtPutBase;
  if (!((GIV(atCache)[atIx + AtCacheOop]) == rcvr)) {
- installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy);
+ if (!(installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy))) {
+ assert(isContextNonInt(rcvr));
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
+ primitiveContextAtPut(); return;
+ }
  }
  if (!GIV(primFailCode)) {
  /* begin commonVariable:at:put:cacheIndex: */
@@ -12691,6 +12708,7 @@
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  fmt = GIV(atCache)[atIx + AtCacheFmt];
  if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
  fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
  /* begin storePointer:ofObject:withValue: */
  if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
@@ -12808,7 +12826,12 @@
 
  atIx = rcvr & AtCacheMask;
  if (!((GIV(atCache)[atIx + AtCacheOop]) == rcvr)) {
- installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy);
+ if (!(installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy))) {
+ assert(isContextNonInt(rcvr));
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
+ primitiveContextAt(); return;
+ }
  }
  if (!GIV(primFailCode)) {
  /* begin commonVariable:at:cacheIndex: */
@@ -12818,6 +12841,7 @@
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  fmt = GIV(atCache)[atIx + AtCacheFmt];
  if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
  fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
  result = longAt((rcvr + BaseHeaderSize) + (((index + fixedFields) - 1) << ShiftForWord));
  goto l1;
@@ -12879,18 +12903,6 @@
 }
 
 sqInt
-compactClassFieldLSB(void)
-{
- return 12;
-}
-
-sqInt
-compactClassFieldWidth(void)
-{
- return 5;
-}
-
-sqInt
 compactClassIndexOfHeader(sqInt header)
 {
  return (((usqInt) header) >> 12) & 31;
@@ -18672,6 +18684,7 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt activeContext;
     sqInt activeProc;
+    sqInt activeProc1;
     sqInt aMethodObj;
     StackPage *newPage;
     sqInt stackPageBytes;
@@ -18692,8 +18705,8 @@
  clearLeakMapAndMapAccessibleObjects();
  assert(checkHeapIntegrity());
  }
- activeProc = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
- activeContext = longAt((activeProc + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord));
+ activeProc1 = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
+ activeContext = longAt((activeProc1 + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord));
  /* begin marryContextInNewStackPageAndInitializeInterpreterRegisters: */
  VM_LABEL(0marryContextInNewStackPageAndInitializeInterpreterRegisters);
  assert(GIV(stackPage) == 0);
@@ -18716,6 +18729,7 @@
  top = longAt(GIV(stackPointer));
  GIV(stackPointer) += BytesPerWord;
  GIV(instructionPointer) = ((sqInt) top);
+ activeProc = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
  assert((ownerIndexOfProcess(activeProc)) == 0);
  GIV(activeProcessAffined) = (ownerIndexOfThreadId((GIV(processHasThreadId)
  ? longAt((activeProc + BaseHeaderSize) + (ThreadIdIndex << ShiftForWord))
@@ -18726,10 +18740,12 @@
 }
 
 
-/* Install the oop of this object in the given cache (at or atPut), along
- with its size, format and fixedSize */
+/* Attempt to install the oop of this object in the given cache (at or
+ atPut), along with its size, format and fixedSize. Answer if this was
+ successful.
+ */
 
-static void
+static sqInt
 installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
@@ -18745,11 +18761,8 @@
  fmt = (((usqInt) hdr) >> 8) & 15;
  if ((fmt == 3)
  && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ GIV(primFailCode) = PrimErrBadReceiver;
+ return 0;
  }
  /* begin lengthOf:baseHeader:format: */
  if ((hdr & TypeMask) == HeaderTypeSizeAndClass) {
@@ -18801,6 +18814,7 @@
  : fmt));
  cache[atIx + AtCacheFixedFields] = fixedFields;
  cache[atIx + AtCacheSize] = (totalLength - fixedFields);
+ return 1;
 }
 
 
@@ -19321,6 +19335,12 @@
 }
 
 static sqInt
+isContextNonInt(sqInt oop)
+{
+ return ((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex;
+}
+
+static sqInt
 isContext(sqInt oop)
 {
  return ((oop & 1) == 0)
@@ -20308,6 +20328,7 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt activeContext;
     sqInt activeProc;
+    sqInt activeProc1;
     sqInt aMethodObj;
     StackPage *newPage;
     char *theFP;
@@ -20317,8 +20338,8 @@
  clearLeakMapAndMapAccessibleObjects();
  assert(checkHeapIntegrity());
  }
- activeProc = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
- activeContext = longAt((activeProc + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord));
+ activeProc1 = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
+ activeContext = longAt((activeProc1 + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord));
  /* begin marryContextInNewStackPageAndInitializeInterpreterRegisters: */
  VM_LABEL(1marryContextInNewStackPageAndInitializeInterpreterRegisters);
  assert(GIV(stackPage) == 0);
@@ -20341,13 +20362,110 @@
  top = longAt(GIV(stackPointer));
  GIV(stackPointer) += BytesPerWord;
  GIV(instructionPointer) = ((sqInt) top);
+ activeProc = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
  assert((ownerIndexOfProcess(activeProc)) == 0);
  GIV(activeProcessAffined) = (ownerIndexOfThreadId((GIV(processHasThreadId)
  ? longAt((activeProc + BaseHeaderSize) + (ThreadIdIndex << ShiftForWord))
  : GIV(nilObj)))) != 0;
 }
 
+void
+longPrintOop(sqInt oop)
+{
+    sqInt byte;
+    sqInt bytecodesPerLine;
+    sqInt fieldOop;
+    sqInt fmt;
+    sqInt header;
+    sqInt index;
+    sqInt lastIndex;
+    sqInt startIP;
+    sqInt sz;
 
+ if (((oop & 1))
+ || ((!(((oop >= heapBase) && (oop <= GIV(freeStart)))))
+ || (((oop & (BytesPerWord - 1)) != 0)
+ || ((((longAt(oop)) & TypeMask) == HeaderTypeFree)
+ || (((((fmt = (((usqInt) (longAt(oop))) >> 8) & 15)) >= 5) && (((fmt = (((usqInt) (longAt(oop))) >> 8) & 15)) <= 11))))))) {
+ printOop(oop); return;
+ }
+ printHex(oop);
+ print(": a(n) ");
+ printNameOfClasscount(fetchClassOfNonInt(oop), 5);
+ if (fmt > 4) {
+ print(" nbytes ");
+ printNum(byteSizeOf(oop));
+ }
+ /* begin cr */
+ printf("\n");
+ lastIndex = ((64 < ((startIP = ((sqInt) (lastPointerOf(oop)) >> 2)))) ? 64 : ((startIP = ((sqInt) (lastPointerOf(oop)) >> 2))));
+ if (lastIndex > 0) {
+ for (index = 1; index <= lastIndex; index += 1) {
+ fieldOop = longAt((oop + BaseHeaderSize) + ((index - 1) << ShiftForWord));
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printHex(fieldOop);
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printOopShort(fieldOop);
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ if (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12) {
+ startIP = (startIP * BytesPerWord) + 1;
+ /* begin lengthOf: */
+ header = longAt(oop);
+ /* begin lengthOf:baseHeader:format: */
+ if ((header & TypeMask) == HeaderTypeSizeAndClass) {
+ sz = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
+ }
+ else {
+ sz = header & SizeMask;
+ }
+ sz -= header & Size4Bit;
+ if (((((usqInt) header) >> 8) & 15) <= 4) {
+ lastIndex = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+ goto l1;
+ }
+ if (((((usqInt) header) >> 8) & 15) < 8) {
+ lastIndex = ((usqInt) (sz - BaseHeaderSize)) >> 2;
+ goto l1;
+ }
+ else {
+ lastIndex = (sz - BaseHeaderSize) - (((((usqInt) header) >> 8) & 15) & 3);
+ goto l1;
+ }
+ l1: /* end lengthOf: */;
+ if ((lastIndex - startIP) > 100) {
+ lastIndex = startIP + 100;
+ }
+ bytecodesPerLine = 8;
+ for (index = startIP; index <= lastIndex; index += 1) {
+ byte = byteAt((oop + BaseHeaderSize) + (index - 1));
+ printf(" %02x/%-3d", byte,byte);
+ if ((((index - startIP) + 1) % bytecodesPerLine) == 0) {
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ if (!((((lastIndex - startIP) + 1) % bytecodesPerLine) == 0)) {
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ else {
+ if (startIP > 64) {
+ print("...");
+ /* begin cr */
+ printf("\n");
+ }
+ }
+}
+
+
 /* This method implements a simple method lookup cache. If an entry for the
  given selector and class is found in the cache, set the values of
  'newMethod' and 'primitiveFunctionPointer' and return true. Otherwise,
@@ -22793,7 +22911,18 @@
  return GIV(nilObj);
 }
 
+sqInt
+noAssertHeaderOf(sqInt methodPointer)
+{
+    sqInt methodHeader;
 
+ methodHeader = longAt((methodPointer + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+ return (isCogMethodReference(methodHeader)
+ ? (((CogMethod *) methodHeader)->methodHeader)
+ : methodHeader);
+}
+
+
 /* This code is called if the receiver responds primitively to at:Put:.
  The cogit can implement at: & at:put: quickly in machine code, and needs a
  backup that provides error codes. But it does not want the at cache so it
@@ -22878,7 +23007,47 @@
  }
 }
 
+static sqInt
+noInlineTemporaryin(sqInt offset, char *theFP)
+{
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
 
+ return ((((usqInt)(longAt(theFP + FoxMethod)))) < heapBase
+ ? (offset < ((frameNumArgs = (mframeCogMethod(theFP)->cmNumArgs)))
+ ? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs - offset) * BytesPerWord))
+ : longAt(((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - offset) * BytesPerWord)))
+ : (offset < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))
+ ? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - offset) * BytesPerWord))
+ : longAt(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - offset) * BytesPerWord))));
+}
+
+static void
+noInlineTemporaryinput(sqInt offset, char *theFP, sqInt valueOop)
+{
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
+
+ /* begin temporary:in:put: */
+ VM_LABEL(0temporaryinput);
+ if ((((usqInt)(longAt(theFP + FoxMethod)))) < heapBase) {
+ /* begin mtemporary:in:put: */
+ longAtput((offset < ((frameNumArgs = (mframeCogMethod(theFP)->cmNumArgs)))
+ ? (theFP + FoxCallerSavedIP) + ((frameNumArgs - offset) * BytesPerWord)
+ : ((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - offset) * BytesPerWord)), valueOop);
+ }
+ else {
+ /* begin itemporary:in:put: */
+ if (offset < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))) {
+ longAtput((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - offset) * BytesPerWord), valueOop);
+ }
+ else {
+ longAtput(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - offset) * BytesPerWord), valueOop);
+ }
+ }
+}
+
+
 /* Answer true if there are no marked contexts on thePage. */
 
 static sqInt
@@ -25664,7 +25833,7 @@
     sqInt methodHeader;
     sqInt newCopy;
     sqInt objHeader;
-    sqInt receiver;
+    sqInt rcvr;
     char *sp;
     sqInt sp1;
     char *spouseFP;
@@ -25672,29 +25841,29 @@
     sqInt valuePointer;
     sqInt valuePointer1;
 
- receiver = longAt(GIV(stackPointer));
- if ((receiver & 1)) {
- newCopy = receiver;
+ rcvr = longAt(GIV(stackPointer));
+ if ((rcvr & 1)) {
+ newCopy = rcvr;
  }
  else {
- objHeader = longAt(receiver);
+ objHeader = longAt(rcvr);
  if (((((usqInt) objHeader) >> 12) & 31) == ClassMethodContextCompactIndex) {
  /* begin cloneContext: */
  VM_LABEL(0cloneContext);
- cloned = eeInstantiateMethodContextByteSize(byteSizeOf(receiver));
+ cloned = eeInstantiateMethodContextByteSize(byteSizeOf(rcvr));
  if (cloned != 0) {
  for (i = 0; i <= StackPointerIndex; i += 1) {
  /* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer = externalInstVarofContext(i, receiver);
+ valuePointer = externalInstVarofContext(i, rcvr);
  longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), valuePointer);
  }
  for (i = MethodIndex; i <= ReceiverIndex; i += 1) {
- longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), longAt((receiver + BaseHeaderSize) + (i << ShiftForWord)));
+ longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), longAt((rcvr + BaseHeaderSize) + (i << ShiftForWord)));
  }
- if ((((longAt((receiver + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
- && (!(isWidowedContext(receiver)))) {
+ if ((((longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(rcvr)))) {
  /* begin frameOfMarriedContext: */
- value = longAt((receiver + BaseHeaderSize) + (SenderIndex << ShiftForWord));
+ value = longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord));
  /* begin withoutSmallIntegerTags: */
  assert((value & 1));
  spouseFP = pointerForOop(value - 1);
@@ -25712,16 +25881,16 @@
  }
  }
  else {
- sp1 = (fetchStackPointerOf(receiver)) - 1;
+ sp1 = (fetchStackPointerOf(rcvr)) - 1;
  for (i = 0; i <= sp1; i += 1) {
- longAtput((cloned + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord), longAt((receiver + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord)));
+ longAtput((cloned + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord), longAt((rcvr + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord)));
  }
  }
  }
  newCopy = cloned;
  }
  else {
- newCopy = clone(receiver);
+ newCopy = clone(rcvr);
  }
  if (newCopy == 0) {
  (GIV(primFailCode) = PrimErrNoMemory); return;
@@ -26654,6 +26823,10 @@
  }
 }
 
+
+/* Special version of primitiveAt for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static void
 primitiveContextAt(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -26681,11 +26854,7 @@
 
  index = longAt(GIV(stackPointer));
  if (!((index & 1))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadArgument); return;
  }
  index = (index >> 1);
 
@@ -26699,7 +26868,7 @@
 
  value = stObjectat(aContext, index);
  /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp = GIV(stackPointer) + ((GIV(argumentCount) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp;
  return;
  }
@@ -26781,11 +26950,7 @@
  stSize = (sp11 >> 1);
  l5: /* end stackPointerForMaybeMarriedContext: */;
  if (!(((index >= 1) && (index <= stSize)))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadIndex); return;
  }
  /* begin subscript:with:format: */
  if (fmt <= 4) {
@@ -26802,7 +26967,7 @@
  }
  l3: /* end subscript:with:format: */;
  /* begin pop:thenPush: */
- longAtput((sp1 = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp1;
  return;
  }
@@ -26812,11 +26977,7 @@
  assert((value1 & 1));
  spouseFP = pointerForOop(value1 - 1);
  if (!(((index >= 1) && (index <= (stackPointerIndexForFrame(spouseFP)))))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadIndex); return;
  }
  value = ((((usqInt)(longAt(spouseFP + FoxMethod)))) < heapBase
  ? ((index - 1) < ((frameNumArgs = (mframeCogMethod(spouseFP)->cmNumArgs)))
@@ -26826,10 +26987,14 @@
  ? longAt((spouseFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - 1)) * BytesPerWord))
  : longAt(((spouseFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - 1)) * BytesPerWord))));
  /* begin pop:thenPush: */
- longAtput((sp2 = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp2;
 }
 
+
+/* Special version of primitiveAtPut for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static sqInt
 primitiveContextAtPut(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -26860,18 +27025,14 @@
  index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
  aContext = longAt(GIV(stackPointer) + (2 * BytesPerWord));
  if (!((index & 1))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadArgument);
  }
  hdr = longAt(aContext);
  index = (index >> 1);
  if (!(((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
  stObjectatput(aContext, index, value);
  /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp;
  return null;
  }
@@ -26953,11 +27114,7 @@
  stSize = (sp11 >> 1);
  l4: /* end stackPointerForMaybeMarriedContext: */;
  if (!(((index >= 1) && (index <= stSize)))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadIndex);
  }
  /* begin subscript:with:storing:format: */
  VM_LABEL(0subscriptwithstoringformat);
@@ -27009,7 +27166,7 @@
  }
  }
  /* begin pop:thenPush: */
- longAtput((sp1 = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp1;
  return null;
  }
@@ -27019,15 +27176,10 @@
  assert((value1 & 1));
  spouseFP = pointerForOop(value1 - 1);
  if (!(((index >= 1) && (index <= (stackPointerIndexForFrame(spouseFP)))))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadIndex);
  }
  /* begin temporary:in:put: */
- VM_LABEL(0temporaryinput);
- ;
+ VM_LABEL(1temporaryinput);
  if ((((usqInt)(longAt(spouseFP + FoxMethod)))) < heapBase) {
  /* begin mtemporary:in:put: */
  longAtput(((index - 1) < ((frameNumArgs = (mframeCogMethod(spouseFP)->cmNumArgs)))
@@ -27044,11 +27196,15 @@
  }
  }
  /* begin pop:thenPush: */
- longAtput((sp2 = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp2;
  return null;
 }
 
+
+/* Special version of primitiveSize for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static void
 primitiveContextSize(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -27148,11 +27304,9 @@
  else {
  sz = totalLength - fixedFields;
  }
- if (!GIV(primFailCode)) {
- /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), ((sz << 1) | 1));
- GIV(stackPointer) = sp;
- }
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((sz << 1) | 1));
+ GIV(stackPointer) = sp;
 }
 
 
@@ -35745,31 +35899,77 @@
 static void
 primitiveSize(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt ccIndex;
+    sqInt class;
+    sqInt classFormat;
+    sqInt fixedFields;
+    sqInt fmt;
+    sqInt hdr;
     sqInt rcvr;
     char *sp;
     sqInt sz;
+    sqInt totalLength;
 
  rcvr = longAt(GIV(stackPointer));
- if ((rcvr & 1)) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ if (((rcvr & 1))
+ || ((
+ /* Integers are not indexable */
+
+(hdr = longAt(rcvr)),
+ ((fmt = (((usqInt) hdr) >> 8) & 15)) < 2))) {
+ (GIV(primFailCode) = PrimErrBadReceiver); return;
  }
- if (((((usqInt) (longAt(rcvr))) >> 8) & 15) < 2) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ primitiveContextSize(); return;
  }
- sz = stSizeOf(rcvr);
- if (!GIV(primFailCode)) {
- /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((sz << 1) | 1));
- GIV(stackPointer) = sp;
+ /* begin lengthOf:baseHeader:format: */
+ if ((hdr & TypeMask) == HeaderTypeSizeAndClass) {
+ sz = (longAt(rcvr - (BytesPerWord * 2))) & LongSizeMask;
  }
+ else {
+ sz = hdr & SizeMask;
+ }
+ sz -= hdr & Size4Bit;
+ if (fmt <= 4) {
+ totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+ goto l1;
+ }
+ if (fmt < 8) {
+ totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
+ goto l1;
+ }
+ else {
+ totalLength = (sz - BaseHeaderSize) - (fmt & 3);
+ goto l1;
+ }
+l1: /* end lengthOf:baseHeader:format: */;
+ /* begin fixedFieldsOf:format:length: */
+ if ((fmt > 4)
+ || (fmt == 2)) {
+ fixedFields = 0;
+ goto l2;
+ }
+ if (fmt < 2) {
+ fixedFields = totalLength;
+ goto l2;
+ }
+ /* begin fetchClassOfNonInt: */
+ if (((ccIndex = (((usqInt) (longAt(rcvr))) >> 12) & 31)) == 0) {
+ class = (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask;
+ goto l3;
+ }
+ else {
+ class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
+ goto l3;
+ }
+l3: /* end fetchClassOfNonInt: */;
+ classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
+ fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
+l2: /* end fixedFieldsOf:format:length: */;
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((totalLength - fixedFields) << 1) | 1));
+ GIV(stackPointer) = sp;
 }
 
 
@@ -39573,6 +39773,7 @@
 printMethodDictionaryOf(sqInt behavior)
 {
     sqInt index;
+    sqInt meth;
     sqInt methodArray;
     sqInt selector;
 
@@ -39582,9 +39783,15 @@
  for (index = SelectorStart; index <= ((fetchWordLengthOf(longAt((behavior + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord)))) - 1); index += 1) {
  selector = longAt(((longAt((behavior + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord))) + BaseHeaderSize) + (index << ShiftForWord));
  if (selector != GIV(nilObj)) {
+ meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
  printOopShort(selector);
  print(" => ");
- printOopShort(longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord)));
+ printOopShort(meth);
+ print(" (");
+ printHex(selector);
+ print(" => ");
+ printHex(meth);
+ putchar(')');
  /* begin cr */
  printf("\n");
  }
@@ -39595,6 +39802,7 @@
 printMethodDictionary(sqInt dictionary)
 {
     sqInt index;
+    sqInt meth;
     sqInt methodArray;
     sqInt selector;
 
@@ -39602,9 +39810,15 @@
  for (index = SelectorStart; index <= ((fetchWordLengthOf(dictionary)) - 1); index += 1) {
  selector = longAt((dictionary + BaseHeaderSize) + (index << ShiftForWord));
  if (selector != GIV(nilObj)) {
+ meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
  printOopShort(selector);
  print(" => ");
- printOopShort(longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord)));
+ printOopShort(meth);
+ print(" (");
+ printHex(selector);
+ print(" => ");
+ printHex(meth);
+ putchar(')');
  /* begin cr */
  printf("\n");
  }
@@ -43799,6 +44013,7 @@
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
+    sqInt sp;
     sqInt stSize;
     sqInt sz;
     sqInt totalLength;
@@ -43815,44 +44030,61 @@
  sz -= hdr & Size4Bit;
  if (fmt <= 4) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
- goto l1;
+ goto l2;
  }
  if (fmt < 8) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
- goto l1;
+ goto l2;
  }
  else {
  totalLength = (sz - BaseHeaderSize) - (fmt & 3);
- goto l1;
+ goto l2;
  }
-l1: /* end lengthOf:baseHeader:format: */;
+l2: /* end lengthOf:baseHeader:format: */;
  /* begin fixedFieldsOf:format:length: */
  if ((fmt > 4)
  || (fmt == 2)) {
  fixedFields = 0;
- goto l2;
+ goto l3;
  }
  if (fmt < 2) {
  fixedFields = totalLength;
- goto l2;
+ goto l3;
  }
  /* begin fetchClassOfNonInt: */
  if (((ccIndex = (((usqInt) (longAt(array))) >> 12) & 31)) == 0) {
  class = (longAt(array - BaseHeaderSize)) & AllButTypeMask;
- goto l3;
+ goto l4;
  }
  else {
  class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
- goto l3;
+ goto l4;
  }
-l3: /* end fetchClassOfNonInt: */;
+l4: /* end fetchClassOfNonInt: */;
  classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
  fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
-l2: /* end fixedFieldsOf:format:length: */;
- if (fmt == 3) {
- assert(!(isContextHeader(hdr)));
+l3: /* end fixedFieldsOf:format:length: */;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ /* begin fetchStackPointerOf: */
+ sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord));
+ if (!((sp & 1))) {
+ stSize = 0;
+ goto l1;
+ }
+ assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array)));
+ stSize = (sp >> 1);
+ l1: /* end fetchStackPointerOf: */;
+ if (((((usqInt) index)) >= (((usqInt) 1)))
+ && (((((usqInt) index)) <= (((usqInt) stSize)))
+ && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(array)))))) {
+ return noInlineTemporaryin(index - 1, frameOfMarriedContext(array));
+ }
  }
- stSize = totalLength - fixedFields;
+ else {
+ stSize = totalLength - fixedFields;
+ }
  if (((((usqInt) index)) >= (((usqInt) 1)))
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  /* begin subscript:with:format: */
@@ -43884,6 +44116,7 @@
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
+    sqInt sp;
     sqInt stSize;
     sqInt sz;
     sqInt totalLength;
@@ -43901,44 +44134,62 @@
  sz -= hdr & Size4Bit;
  if (fmt <= 4) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
- goto l1;
+ goto l2;
  }
  if (fmt < 8) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
- goto l1;
+ goto l2;
  }
  else {
  totalLength = (sz - BaseHeaderSize) - (fmt & 3);
- goto l1;
+ goto l2;
  }
-l1: /* end lengthOf:baseHeader:format: */;
+l2: /* end lengthOf:baseHeader:format: */;
  /* begin fixedFieldsOf:format:length: */
  if ((fmt > 4)
  || (fmt == 2)) {
  fixedFields = 0;
- goto l2;
+ goto l3;
  }
  if (fmt < 2) {
  fixedFields = totalLength;
- goto l2;
+ goto l3;
  }
  /* begin fetchClassOfNonInt: */
  if (((ccIndex = (((usqInt) (longAt(array))) >> 12) & 31)) == 0) {
  class = (longAt(array - BaseHeaderSize)) & AllButTypeMask;
- goto l3;
+ goto l4;
  }
  else {
  class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
- goto l3;
+ goto l4;
  }
-l3: /* end fetchClassOfNonInt: */;
+l4: /* end fetchClassOfNonInt: */;
  classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
  fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
-l2: /* end fixedFieldsOf:format:length: */;
- if (fmt == 3) {
- assert(!(isContextHeader(hdr)));
+l3: /* end fixedFieldsOf:format:length: */;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ /* begin fetchStackPointerOf: */
+ sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord));
+ if (!((sp & 1))) {
+ stSize = 0;
+ goto l1;
+ }
+ assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array)));
+ stSize = (sp >> 1);
+ l1: /* end fetchStackPointerOf: */;
+ if (((((usqInt) index)) >= (((usqInt) 1)))
+ && (((((usqInt) index)) <= (((usqInt) stSize)))
+ && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(array)))))) {
+ noInlineTemporaryinput(index - 1, frameOfMarriedContext(array), value);
+ return;
+ }
  }
- stSize = totalLength - fixedFields;
+ else {
+ stSize = totalLength - fixedFields;
+ }
  if (((((usqInt) index)) >= (((usqInt) 1)))
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  /* begin subscript:with:storing:format: */

Modified: branches/Cog/src/vm/cointerpmt.h
===================================================================
--- branches/Cog/src/vm/cointerpmt.h 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/src/vm/cointerpmt.h 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,5 +1,5 @@
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
 
 
@@ -45,7 +45,6 @@
 void checkAssertsEnabledInCoInterpreter(void);
 sqInt checkedLongAt(sqInt byteAddress);
 sqInt classArray(void);
-sqInt classFieldOffset(void);
 sqInt classFloat(void);
 sqInt classFloatCompactIndex(void);
 sqInt classHeader(sqInt oop);
@@ -53,8 +52,6 @@
 void clearTraceLog(void);
 CogMethod * cogMethodOf(sqInt aMethodOop);
 sqInt compactClassAt(sqInt ccIndex);
-sqInt compactClassFieldLSB(void);
-sqInt compactClassFieldWidth(void);
 sqInt compactClassIndexOfHeader(sqInt header);
 sqInt compactClassIndexOf(sqInt oop);
 sqInt compactClassTable(void);
@@ -105,6 +102,7 @@
 sqInt lengthOf(sqInt oop);
 sqInt literalCountOfHeader(sqInt headerPointer);
 sqInt literalofMethod(sqInt offset, sqInt methodPointer);
+void longPrintOop(sqInt oop);
 sqInt lookupreceiver(sqInt selector, sqInt rcvr);
 void markActiveMethodsAndReferents(void);
 void markAndTrace(sqInt oop);
@@ -121,6 +119,7 @@
 usqInt newMethodAddress(void);
 usqInt nextProfileTickAddress(void);
 sqInt nilObject(void);
+sqInt noAssertHeaderOf(sqInt methodPointer);
 sqInt nullHeaderForMachineCodeMethod(void);
 sqInt objectAfter(sqInt oop);
 sqInt objectBefore(sqInt address);
@@ -216,6 +215,9 @@
 
 
 /*** Macros ***/
+#define classFieldOffset() (0 - BaseHeaderSize)
+#define compactClassFieldLSB() 12
+#define compactClassFieldWidth() 5
 #define compilationBreakpoint(sel, len) do { \
  if ((len) == breakSelectorLength \
  && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, breakSelectorLength)) { \
@@ -223,4 +225,6 @@
  compilationBreakpointFor(sel); \
  } \
 } while (0)
+#define instFormatFieldLSB() 8
+#define instFormatFieldWidth() 4
 

Modified: branches/Cog/src/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/src/vm/gcc3x-cointerp.c 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/src/vm/gcc3x-cointerp.c 2011-08-19 21:33:12 UTC (rev 2488)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
    from
- CoInterpreter VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CoInterpreter VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -412,7 +412,6 @@
 sqInt classExternalFunction(void);
 sqInt classExternalLibrary(void);
 sqInt classExternalStructure(void);
-sqInt classFieldOffset(void);
 sqInt classFloat(void);
 sqInt classFloatCompactIndex(void);
 sqInt classHeader(sqInt oop);
@@ -433,8 +432,6 @@
 static void commonAtPut(sqInt stringy);
 static void commonAt(sqInt stringy);
 sqInt compactClassAt(sqInt ccIndex);
-sqInt compactClassFieldLSB(void);
-sqInt compactClassFieldWidth(void);
 sqInt compactClassIndexOfHeader(sqInt header);
 sqInt compactClassIndexOf(sqInt oop);
 sqInt compactClassTable(void);
@@ -575,7 +572,7 @@
 static void initializeObjectMemory(sqInt bytesToShift);
 static void initializeStacknumSlotspageSizestackLimitOffsetstackPageHeadroom(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage, sqInt stackLimitOffsetBytes, sqInt stackPageHeadroomBytes);
 static sqInt initStackPagesAndInterpret(void);
-static void installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy);
+static sqInt installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy);
 sqInt instanceSizeOf(sqInt classObj);
 sqInt instantiateClassindexableSize(sqInt classPointer, sqInt size);
 usqInt instructionPointerAddress(void);
@@ -592,6 +589,7 @@
 sqInt isCogMethodReference(sqInt methodHeader);
 sqInt isCompiledMethod(sqInt oop);
 static sqInt isContextHeader(sqInt aHeader);
+static sqInt isContextNonInt(sqInt oop);
 static sqInt isContext(sqInt oop);
 sqInt isFloatObject(sqInt oop);
 static sqInt isFree(StackPage * self_in_isFree);
@@ -636,6 +634,7 @@
 sqInt loadBitBltFrom(sqInt bb);
 static sqInt loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray);
 void loadInitialContext(void);
+void longPrintOop(sqInt oop);
 static sqInt lookupInMethodCacheSelclass(sqInt selector, sqInt class);
 static sqInt lookupMethodInClass(sqInt class);
 static sqInt lookupMethodInDictionary(sqInt dictionary);
@@ -689,8 +688,11 @@
 static StackPage * newStackPage(void);
 usqInt nextProfileTickAddress(void);
 sqInt nilObject(void);
+sqInt noAssertHeaderOf(sqInt methodPointer);
 static void noAtCacheCommonAtPut(sqInt stringy);
 static void noAtCacheCommonAt(sqInt stringy);
+static sqInt noInlineTemporaryin(sqInt offset, char *theFP);
+static void noInlineTemporaryinput(sqInt offset, char *theFP, sqInt valueOop);
 static sqInt noMarkedContextsOnPage(StackPage *thePage);
 static sqInt nonWeakFieldsOf(sqInt oop);
 sqInt nullHeaderForMachineCodeMethod(void);
@@ -1139,9 +1141,9 @@
 _iss StackPage * stackPage;
 _iss sqInt nilObj;
 _iss usqInt instructionPointer;
+_iss sqInt argumentCount;
 _iss usqInt method;
 _iss usqInt freeStart;
-_iss sqInt argumentCount;
 _iss usqInt newMethod;
 _iss sqInt messageSelector;
 _iss StackPage * pages;
@@ -1883,12 +1885,15 @@
  /* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.117]";
+const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.119]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 
 
 /*** Macros ***/
+#define classFieldOffset() (0 - BaseHeaderSize)
+#define compactClassFieldLSB() 12
+#define compactClassFieldWidth() 5
 #define compilationBreakpoint(sel, len) do { \
  if ((len) == breakSelectorLength \
  && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, breakSelectorLength)) { \
@@ -1906,6 +1911,8 @@
 #define getCogCodeSize() integerObjectOf(GIV(cogCodeSize))
 #define getDesiredCogCodeSize() integerObjectOf(desiredCogCodeSize)
 #define initialEnterSmalltalkExecutive() enterSmalltalkExecutiveImplementation()
+#define instFormatFieldLSB() 8
+#define instFormatFieldWidth() 4
 #define memory() memory
 #define mostRecentlyUsedPage() GIV(mostRecentlyUsedPage)
 #define nextOpenPIC methodObject
@@ -1916,7 +1923,6 @@
 #define remapBufferCount() GIV(remapBufferCount)
 #define setDesiredCogCodeSize(dccs) (desiredCogCodeSize = (dccs))
 #define stackPageAtpages(index,pages) ((pages) + (index))
-#define typeEtAlWord(cm) (((long *)(cm))[1])
 #define validate() 0
 #define youngStart() GIV(youngStart)
 
@@ -7688,36 +7694,39 @@
  }
  }
  }
- /* begin commonVariable:at:cacheIndex: */
- VM_LABEL(0commonVariableatcacheIndex);
- stSize = GIV(atCache)[atIx + AtCacheSize];
- if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
- && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
- fmt = GIV(atCache)[atIx + AtCacheFmt];
- if (fmt <= 4) {
- fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
- result = longAt((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord));
- goto l73;
- }
- if (fmt < 8) {
+ if (!GIV(primFailCode)) {
+ /* begin commonVariable:at:cacheIndex: */
+ VM_LABEL(0commonVariableatcacheIndex);
+ stSize = GIV(atCache)[atIx + AtCacheSize];
+ if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
+ && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
+ fmt = GIV(atCache)[atIx + AtCacheFmt];
+ if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
+ fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
+ result = longAt((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord));
+ goto l73;
+ }
+ if (fmt < 8) {
 
- /* Bitmap */
+ /* Bitmap */
 
- result1 = long32At((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2));
- result = positive32BitIntegerFor(result1);
- goto l73;
+ result1 = long32At((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2));
+ result = positive32BitIntegerFor(result1);
+ goto l73;
+ }
+ if (fmt >= 16) {
+ result = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + ((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << ShiftForWord));
+ goto l73;
+ }
+ else {
+ result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
+ goto l73;
+ }
  }
- if (fmt >= 16) {
- result = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + ((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << ShiftForWord));
- goto l73;
- }
- else {
- result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
- goto l73;
- }
+ result = (GIV(primFailCode) = PrimErrBadIndex);
+ l73: /* end commonVariable:at:cacheIndex: */;
  }
- result = (GIV(primFailCode) = PrimErrBadIndex);
- l73: /* end commonVariable:at:cacheIndex: */;
  if (!GIV(primFailCode)) {
  /* begin fetchNextBytecode */
  currentBytecode = byteAtPointer(++localIP);
@@ -7725,6 +7734,8 @@
  longAtPointerput((localSP += (2 - 1) * BytesPerWord), result);
  goto l71;
  }
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
  }
  GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SpecialSelectors << ShiftForWord))) + BaseHeaderSize) + ((16 * 2) << ShiftForWord));
  GIV(argumentCount) = 1;
@@ -7787,59 +7798,62 @@
  }
  }
  }
- /* begin commonVariable:at:put:cacheIndex: */
- VM_LABEL(0commonVariableatputcacheIndex);
- stSize = GIV(atCache)[atIx + AtCacheSize];
- if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
- && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
- fmt = GIV(atCache)[atIx + AtCacheFmt];
- if (fmt <= 4) {
- fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
- /* begin storePointer:ofObject:withValue: */
- if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
- possibleRootStoreIntovalue(rcvr, value);
+ if (!GIV(primFailCode)) {
+ /* begin commonVariable:at:put:cacheIndex: */
+ VM_LABEL(0commonVariableatputcacheIndex);
+ stSize = GIV(atCache)[atIx + AtCacheSize];
+ if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
+ && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
+ fmt = GIV(atCache)[atIx + AtCacheFmt];
+ if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
+ fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
+ /* begin storePointer:ofObject:withValue: */
+ if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
+ possibleRootStoreIntovalue(rcvr, value);
+ }
+ longAtput((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord), value);
+ goto l75;
  }
- longAtput((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord), value);
- goto l75;
- }
- if (fmt < 8) {
+ if (fmt < 8) {
 
- /* Bitmap */
+ /* Bitmap */
 
- valToPut = positive32BitValueOf(value);
- if (!GIV(primFailCode)) {
- long32Atput((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2), valToPut);
+ valToPut = positive32BitValueOf(value);
+ if (!GIV(primFailCode)) {
+ long32Atput((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2), valToPut);
+ }
+ goto l75;
  }
- goto l75;
- }
- if (fmt >= 16) {
+ if (fmt >= 16) {
 
- /* Note fmt >= 16 is an artificial flag for strings */
+ /* Note fmt >= 16 is an artificial flag for strings */
 
- valToPut = asciiOfCharacter(value);
- if (!(!GIV(primFailCode))) {
- goto l75;
+ valToPut = asciiOfCharacter(value);
+ if (!(!GIV(primFailCode))) {
+ goto l75;
+ }
  }
- }
- else {
- valToPut = value;
- }
- if ((valToPut & 1)) {
- valToPut = (valToPut >> 1);
- if (!((valToPut >= 0)
- && (valToPut <= 255))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
+ else {
+ valToPut = value;
+ }
+ if ((valToPut & 1)) {
+ valToPut = (valToPut >> 1);
+ if (!((valToPut >= 0)
+ && (valToPut <= 255))) {
+ /* begin primitiveFail */
+ if (!GIV(primFailCode)) {
+ GIV(primFailCode) = 1;
+ }
+ goto l75;
  }
+ byteAtput((rcvr + BaseHeaderSize) + (((index >> 1)) - 1), valToPut);
  goto l75;
  }
- byteAtput((rcvr + BaseHeaderSize) + (((index >> 1)) - 1), valToPut);
- goto l75;
  }
+ GIV(primFailCode) = PrimErrBadIndex;
+ l75: /* end commonVariable:at:put:cacheIndex: */;
  }
- GIV(primFailCode) = PrimErrBadIndex;
- l75: /* end commonVariable:at:put:cacheIndex: */;
  if (!GIV(primFailCode)) {
  /* begin fetchNextBytecode */
  currentBytecode = byteAtPointer(++localIP);
@@ -7847,6 +7861,8 @@
  longAtPointerput((localSP += (3 - 1) * BytesPerWord), value);
  goto l74;
  }
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
  }
  GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SpecialSelectors << ShiftForWord))) + BaseHeaderSize) + ((17 * 2) << ShiftForWord));
  GIV(argumentCount) = 2;
@@ -11368,7 +11384,7 @@
  || ((heapMapAtWord(pointerForOop(fieldOop))) == 0)) {
  print("object leak in ");
  printHex(obj);
- print(" class ");
+ print(" class = ");
  printHex(fieldOop);
  /* begin cr */
  printf("\n");
@@ -11435,6 +11451,8 @@
  printHex(obj);
  print(" @ ");
  printNum(fi);
+ print(" = ");
+ printHex(fieldOop);
  /* begin cr */
  printf("\n");
  ok = 0;
@@ -11914,12 +11932,6 @@
 }
 
 sqInt
-classFieldOffset(void)
-{
- return 0 - BaseHeaderSize;
-}
-
-sqInt
 classFloat(void)
 {
  return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassFloat << ShiftForWord));
@@ -12269,7 +12281,12 @@
 
  atIx = (rcvr & AtCacheMask) + AtPutBase;
  if (!((GIV(atCache)[atIx + AtCacheOop]) == rcvr)) {
- installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy);
+ if (!(installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy))) {
+ assert(isContextNonInt(rcvr));
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
+ primitiveContextAtPut(); return;
+ }
  }
  if (!GIV(primFailCode)) {
  /* begin commonVariable:at:put:cacheIndex: */
@@ -12279,6 +12296,7 @@
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  fmt = GIV(atCache)[atIx + AtCacheFmt];
  if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
  fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
  /* begin storePointer:ofObject:withValue: */
  if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
@@ -12396,7 +12414,12 @@
 
  atIx = rcvr & AtCacheMask;
  if (!((GIV(atCache)[atIx + AtCacheOop]) == rcvr)) {
- installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy);
+ if (!(installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy))) {
+ assert(isContextNonInt(rcvr));
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
+ primitiveContextAt(); return;
+ }
  }
  if (!GIV(primFailCode)) {
  /* begin commonVariable:at:cacheIndex: */
@@ -12406,6 +12429,7 @@
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  fmt = GIV(atCache)[atIx + AtCacheFmt];
  if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
  fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
  result = longAt((rcvr + BaseHeaderSize) + (((index + fixedFields) - 1) << ShiftForWord));
  goto l1;
@@ -12467,18 +12491,6 @@
 }
 
 sqInt
-compactClassFieldLSB(void)
-{
- return 12;
-}
-
-sqInt
-compactClassFieldWidth(void)
-{
- return 5;
-}
-
-sqInt
 compactClassIndexOfHeader(sqInt header)
 {
  return (((usqInt) header) >> 12) & 31;
@@ -18030,10 +18042,12 @@
 }
 
 
-/* Install the oop of this object in the given cache (at or atPut), along
- with its size, format and fixedSize */
+/* Attempt to install the oop of this object in the given cache (at or
+ atPut), along with its size, format and fixedSize. Answer if this was
+ successful.
+ */
 
-static void
+static sqInt
 installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
@@ -18049,11 +18063,8 @@
  fmt = (((usqInt) hdr) >> 8) & 15;
  if ((fmt == 3)
  && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ GIV(primFailCode) = PrimErrBadReceiver;
+ return 0;
  }
  /* begin lengthOf:baseHeader:format: */
  if ((hdr & TypeMask) == HeaderTypeSizeAndClass) {
@@ -18105,6 +18116,7 @@
  : fmt));
  cache[atIx + AtCacheFixedFields] = fixedFields;
  cache[atIx + AtCacheSize] = (totalLength - fixedFields);
+ return 1;
 }
 
 
@@ -18600,6 +18612,12 @@
 }
 
 static sqInt
+isContextNonInt(sqInt oop)
+{
+ return ((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex;
+}
+
+static sqInt
 isContext(sqInt oop)
 {
  return ((oop & 1) == 0)
@@ -19622,7 +19640,103 @@
  GIV(instructionPointer) = ((sqInt) top);
 }
 
+void
+longPrintOop(sqInt oop)
+{
+    sqInt byte;
+    sqInt bytecodesPerLine;
+    sqInt fieldOop;
+    sqInt fmt;
+    sqInt header;
+    sqInt index;
+    sqInt lastIndex;
+    sqInt startIP;
+    sqInt sz;
 
+ if (((oop & 1))
+ || ((!(((oop >= heapBase) && (oop <= GIV(freeStart)))))
+ || (((oop & (BytesPerWord - 1)) != 0)
+ || ((((longAt(oop)) & TypeMask) == HeaderTypeFree)
+ || (((((fmt = (((usqInt) (longAt(oop))) >> 8) & 15)) >= 5) && (((fmt = (((usqInt) (longAt(oop))) >> 8) & 15)) <= 11))))))) {
+ printOop(oop); return;
+ }
+ printHex(oop);
+ print(": a(n) ");
+ printNameOfClasscount(fetchClassOfNonInt(oop), 5);
+ if (fmt > 4) {
+ print(" nbytes ");
+ printNum(byteSizeOf(oop));
+ }
+ /* begin cr */
+ printf("\n");
+ lastIndex = ((64 < ((startIP = ((sqInt) (lastPointerOf(oop)) >> 2)))) ? 64 : ((startIP = ((sqInt) (lastPointerOf(oop)) >> 2))));
+ if (lastIndex > 0) {
+ for (index = 1; index <= lastIndex; index += 1) {
+ fieldOop = longAt((oop + BaseHeaderSize) + ((index - 1) << ShiftForWord));
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printHex(fieldOop);
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printOopShort(fieldOop);
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ if (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12) {
+ startIP = (startIP * BytesPerWord) + 1;
+ /* begin lengthOf: */
+ header = longAt(oop);
+ /* begin lengthOf:baseHeader:format: */
+ if ((header & TypeMask) == HeaderTypeSizeAndClass) {
+ sz = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
+ }
+ else {
+ sz = header & SizeMask;
+ }
+ sz -= header & Size4Bit;
+ if (((((usqInt) header) >> 8) & 15) <= 4) {
+ lastIndex = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+ goto l1;
+ }
+ if (((((usqInt) header) >> 8) & 15) < 8) {
+ lastIndex = ((usqInt) (sz - BaseHeaderSize)) >> 2;
+ goto l1;
+ }
+ else {
+ lastIndex = (sz - BaseHeaderSize) - (((((usqInt) header) >> 8) & 15) & 3);
+ goto l1;
+ }
+ l1: /* end lengthOf: */;
+ if ((lastIndex - startIP) > 100) {
+ lastIndex = startIP + 100;
+ }
+ bytecodesPerLine = 8;
+ for (index = startIP; index <= lastIndex; index += 1) {
+ byte = byteAt((oop + BaseHeaderSize) + (index - 1));
+ printf(" %02x/%-3d", byte,byte);
+ if ((((index - startIP) + 1) % bytecodesPerLine) == 0) {
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ if (!((((lastIndex - startIP) + 1) % bytecodesPerLine) == 0)) {
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ else {
+ if (startIP > 64) {
+ print("...");
+ /* begin cr */
+ printf("\n");
+ }
+ }
+}
+
+
 /* This method implements a simple method lookup cache. If an entry for the
  given selector and class is found in the cache, set the values of
  'newMethod' and 'primitiveFunctionPointer' and return true. Otherwise,
@@ -22040,7 +22154,18 @@
  return GIV(nilObj);
 }
 
+sqInt
+noAssertHeaderOf(sqInt methodPointer)
+{
+    sqInt methodHeader;
 
+ methodHeader = longAt((methodPointer + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+ return (isCogMethodReference(methodHeader)
+ ? (((CogMethod *) methodHeader)->methodHeader)
+ : methodHeader);
+}
+
+
 /* This code is called if the receiver responds primitively to at:Put:.
  The cogit can implement at: & at:put: quickly in machine code, and needs a
  backup that provides error codes. But it does not want the at cache so it
@@ -22125,7 +22250,47 @@
  }
 }
 
+static sqInt
+noInlineTemporaryin(sqInt offset, char *theFP)
+{
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
 
+ return ((((usqInt)(longAt(theFP + FoxMethod)))) < heapBase
+ ? (offset < ((frameNumArgs = (mframeCogMethod(theFP)->cmNumArgs)))
+ ? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs - offset) * BytesPerWord))
+ : longAt(((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - offset) * BytesPerWord)))
+ : (offset < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))
+ ? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - offset) * BytesPerWord))
+ : longAt(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - offset) * BytesPerWord))));
+}
+
+static void
+noInlineTemporaryinput(sqInt offset, char *theFP, sqInt valueOop)
+{
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
+
+ /* begin temporary:in:put: */
+ VM_LABEL(0temporaryinput);
+ if ((((usqInt)(longAt(theFP + FoxMethod)))) < heapBase) {
+ /* begin mtemporary:in:put: */
+ longAtput((offset < ((frameNumArgs = (mframeCogMethod(theFP)->cmNumArgs)))
+ ? (theFP + FoxCallerSavedIP) + ((frameNumArgs - offset) * BytesPerWord)
+ : ((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - offset) * BytesPerWord)), valueOop);
+ }
+ else {
+ /* begin itemporary:in:put: */
+ if (offset < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))) {
+ longAtput((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - offset) * BytesPerWord), valueOop);
+ }
+ else {
+ longAtput(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - offset) * BytesPerWord), valueOop);
+ }
+ }
+}
+
+
 /* Answer true if there are no marked contexts on thePage. */
 
 static sqInt
@@ -24463,7 +24628,7 @@
     sqInt methodHeader;
     sqInt newCopy;
     sqInt objHeader;
-    sqInt receiver;
+    sqInt rcvr;
     char *sp;
     sqInt sp1;
     char *spouseFP;
@@ -24471,29 +24636,29 @@
     sqInt valuePointer;
     sqInt valuePointer1;
 
- receiver = longAt(GIV(stackPointer));
- if ((receiver & 1)) {
- newCopy = receiver;
+ rcvr = longAt(GIV(stackPointer));
+ if ((rcvr & 1)) {
+ newCopy = rcvr;
  }
  else {
- objHeader = longAt(receiver);
+ objHeader = longAt(rcvr);
  if (((((usqInt) objHeader) >> 12) & 31) == ClassMethodContextCompactIndex) {
  /* begin cloneContext: */
  VM_LABEL(0cloneContext);
- cloned = eeInstantiateMethodContextByteSize(byteSizeOf(receiver));
+ cloned = eeInstantiateMethodContextByteSize(byteSizeOf(rcvr));
  if (cloned != 0) {
  for (i = 0; i <= StackPointerIndex; i += 1) {
  /* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer = externalInstVarofContext(i, receiver);
+ valuePointer = externalInstVarofContext(i, rcvr);
  longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), valuePointer);
  }
  for (i = MethodIndex; i <= ReceiverIndex; i += 1) {
- longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), longAt((receiver + BaseHeaderSize) + (i << ShiftForWord)));
+ longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), longAt((rcvr + BaseHeaderSize) + (i << ShiftForWord)));
  }
- if ((((longAt((receiver + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
- && (!(isWidowedContext(receiver)))) {
+ if ((((longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(rcvr)))) {
  /* begin frameOfMarriedContext: */
- value = longAt((receiver + BaseHeaderSize) + (SenderIndex << ShiftForWord));
+ value = longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord));
  /* begin withoutSmallIntegerTags: */
  assert((value & 1));
  spouseFP = pointerForOop(value - 1);
@@ -24511,16 +24676,16 @@
  }
  }
  else {
- sp1 = (fetchStackPointerOf(receiver)) - 1;
+ sp1 = (fetchStackPointerOf(rcvr)) - 1;
  for (i = 0; i <= sp1; i += 1) {
- longAtput((cloned + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord), longAt((receiver + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord)));
+ longAtput((cloned + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord), longAt((rcvr + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord)));
  }
  }
  }
  newCopy = cloned;
  }
  else {
- newCopy = clone(receiver);
+ newCopy = clone(rcvr);
  }
  if (newCopy == 0) {
  (GIV(primFailCode) = PrimErrNoMemory); return;
@@ -25453,6 +25618,10 @@
  }
 }
 
+
+/* Special version of primitiveAt for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static void
 primitiveContextAt(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -25480,11 +25649,7 @@
 
  index = longAt(GIV(stackPointer));
  if (!((index & 1))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadArgument); return;
  }
  index = (index >> 1);
 
@@ -25498,7 +25663,7 @@
 
  value = stObjectat(aContext, index);
  /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp = GIV(stackPointer) + ((GIV(argumentCount) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp;
  return;
  }
@@ -25580,11 +25745,7 @@
  stSize = (sp11 >> 1);
  l5: /* end stackPointerForMaybeMarriedContext: */;
  if (!(((index >= 1) && (index <= stSize)))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadIndex); return;
  }
  /* begin subscript:with:format: */
  if (fmt <= 4) {
@@ -25601,7 +25762,7 @@
  }
  l3: /* end subscript:with:format: */;
  /* begin pop:thenPush: */
- longAtput((sp1 = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp1;
  return;
  }
@@ -25611,11 +25772,7 @@
  assert((value1 & 1));
  spouseFP = pointerForOop(value1 - 1);
  if (!(((index >= 1) && (index <= (stackPointerIndexForFrame(spouseFP)))))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadIndex); return;
  }
  value = ((((usqInt)(longAt(spouseFP + FoxMethod)))) < heapBase
  ? ((index - 1) < ((frameNumArgs = (mframeCogMethod(spouseFP)->cmNumArgs)))
@@ -25625,10 +25782,14 @@
  ? longAt((spouseFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - 1)) * BytesPerWord))
  : longAt(((spouseFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - 1)) * BytesPerWord))));
  /* begin pop:thenPush: */
- longAtput((sp2 = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp2;
 }
 
+
+/* Special version of primitiveAtPut for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static sqInt
 primitiveContextAtPut(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -25659,18 +25820,14 @@
  index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
  aContext = longAt(GIV(stackPointer) + (2 * BytesPerWord));
  if (!((index & 1))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadArgument);
  }
  hdr = longAt(aContext);
  index = (index >> 1);
  if (!(((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
  stObjectatput(aContext, index, value);
  /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp;
  return null;
  }
@@ -25752,11 +25909,7 @@
  stSize = (sp11 >> 1);
  l4: /* end stackPointerForMaybeMarriedContext: */;
  if (!(((index >= 1) && (index <= stSize)))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadIndex);
  }
  /* begin subscript:with:storing:format: */
  VM_LABEL(0subscriptwithstoringformat);
@@ -25808,7 +25961,7 @@
  }
  }
  /* begin pop:thenPush: */
- longAtput((sp1 = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp1;
  return null;
  }
@@ -25818,15 +25971,10 @@
  assert((value1 & 1));
  spouseFP = pointerForOop(value1 - 1);
  if (!(((index >= 1) && (index <= (stackPointerIndexForFrame(spouseFP)))))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadIndex);
  }
  /* begin temporary:in:put: */
- VM_LABEL(0temporaryinput);
- ;
+ VM_LABEL(1temporaryinput);
  if ((((usqInt)(longAt(spouseFP + FoxMethod)))) < heapBase) {
  /* begin mtemporary:in:put: */
  longAtput(((index - 1) < ((frameNumArgs = (mframeCogMethod(spouseFP)->cmNumArgs)))
@@ -25843,11 +25991,15 @@
  }
  }
  /* begin pop:thenPush: */
- longAtput((sp2 = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp2;
  return null;
 }
 
+
+/* Special version of primitiveSize for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static void
 primitiveContextSize(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -25947,11 +26099,9 @@
  else {
  sz = totalLength - fixedFields;
  }
- if (!GIV(primFailCode)) {
- /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), ((sz << 1) | 1));
- GIV(stackPointer) = sp;
- }
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((sz << 1) | 1));
+ GIV(stackPointer) = sp;
 }
 
 
@@ -34444,31 +34594,77 @@
 static void
 primitiveSize(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt ccIndex;
+    sqInt class;
+    sqInt classFormat;
+    sqInt fixedFields;
+    sqInt fmt;
+    sqInt hdr;
     sqInt rcvr;
     char *sp;
     sqInt sz;
+    sqInt totalLength;
 
  rcvr = longAt(GIV(stackPointer));
- if ((rcvr & 1)) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ if (((rcvr & 1))
+ || ((
+ /* Integers are not indexable */
+
+(hdr = longAt(rcvr)),
+ ((fmt = (((usqInt) hdr) >> 8) & 15)) < 2))) {
+ (GIV(primFailCode) = PrimErrBadReceiver); return;
  }
- if (((((usqInt) (longAt(rcvr))) >> 8) & 15) < 2) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ primitiveContextSize(); return;
  }
- sz = stSizeOf(rcvr);
- if (!GIV(primFailCode)) {
- /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((sz << 1) | 1));
- GIV(stackPointer) = sp;
+ /* begin lengthOf:baseHeader:format: */
+ if ((hdr & TypeMask) == HeaderTypeSizeAndClass) {
+ sz = (longAt(rcvr - (BytesPerWord * 2))) & LongSizeMask;
  }
+ else {
+ sz = hdr & SizeMask;
+ }
+ sz -= hdr & Size4Bit;
+ if (fmt <= 4) {
+ totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+ goto l1;
+ }
+ if (fmt < 8) {
+ totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
+ goto l1;
+ }
+ else {
+ totalLength = (sz - BaseHeaderSize) - (fmt & 3);
+ goto l1;
+ }
+l1: /* end lengthOf:baseHeader:format: */;
+ /* begin fixedFieldsOf:format:length: */
+ if ((fmt > 4)
+ || (fmt == 2)) {
+ fixedFields = 0;
+ goto l2;
+ }
+ if (fmt < 2) {
+ fixedFields = totalLength;
+ goto l2;
+ }
+ /* begin fetchClassOfNonInt: */
+ if (((ccIndex = (((usqInt) (longAt(rcvr))) >> 12) & 31)) == 0) {
+ class = (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask;
+ goto l3;
+ }
+ else {
+ class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
+ goto l3;
+ }
+l3: /* end fetchClassOfNonInt: */;
+ classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
+ fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
+l2: /* end fixedFieldsOf:format:length: */;
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((totalLength - fixedFields) << 1) | 1));
+ GIV(stackPointer) = sp;
 }
 
 
@@ -38230,6 +38426,7 @@
 printMethodDictionaryOf(sqInt behavior)
 {
     sqInt index;
+    sqInt meth;
     sqInt methodArray;
     sqInt selector;
 
@@ -38239,9 +38436,15 @@
  for (index = SelectorStart; index <= ((fetchWordLengthOf(longAt((behavior + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord)))) - 1); index += 1) {
  selector = longAt(((longAt((behavior + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord))) + BaseHeaderSize) + (index << ShiftForWord));
  if (selector != GIV(nilObj)) {
+ meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
  printOopShort(selector);
  print(" => ");
- printOopShort(longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord)));
+ printOopShort(meth);
+ print(" (");
+ printHex(selector);
+ print(" => ");
+ printHex(meth);
+ putchar(')');
  /* begin cr */
  printf("\n");
  }
@@ -38252,6 +38455,7 @@
 printMethodDictionary(sqInt dictionary)
 {
     sqInt index;
+    sqInt meth;
     sqInt methodArray;
     sqInt selector;
 
@@ -38259,9 +38463,15 @@
  for (index = SelectorStart; index <= ((fetchWordLengthOf(dictionary)) - 1); index += 1) {
  selector = longAt((dictionary + BaseHeaderSize) + (index << ShiftForWord));
  if (selector != GIV(nilObj)) {
+ meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
  printOopShort(selector);
  print(" => ");
- printOopShort(longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord)));
+ printOopShort(meth);
+ print(" (");
+ printHex(selector);
+ print(" => ");
+ printHex(meth);
+ putchar(')');
  /* begin cr */
  printf("\n");
  }
@@ -42309,6 +42519,7 @@
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
+    sqInt sp;
     sqInt stSize;
     sqInt sz;
     sqInt totalLength;
@@ -42325,44 +42536,61 @@
  sz -= hdr & Size4Bit;
  if (fmt <= 4) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
- goto l1;
+ goto l2;
  }
  if (fmt < 8) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
- goto l1;
+ goto l2;
  }
  else {
  totalLength = (sz - BaseHeaderSize) - (fmt & 3);
- goto l1;
+ goto l2;
  }
-l1: /* end lengthOf:baseHeader:format: */;
+l2: /* end lengthOf:baseHeader:format: */;
  /* begin fixedFieldsOf:format:length: */
  if ((fmt > 4)
  || (fmt == 2)) {
  fixedFields = 0;
- goto l2;
+ goto l3;
  }
  if (fmt < 2) {
  fixedFields = totalLength;
- goto l2;
+ goto l3;
  }
  /* begin fetchClassOfNonInt: */
  if (((ccIndex = (((usqInt) (longAt(array))) >> 12) & 31)) == 0) {
  class = (longAt(array - BaseHeaderSize)) & AllButTypeMask;
- goto l3;
+ goto l4;
  }
  else {
  class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
- goto l3;
+ goto l4;
  }
-l3: /* end fetchClassOfNonInt: */;
+l4: /* end fetchClassOfNonInt: */;
  classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
  fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
-l2: /* end fixedFieldsOf:format:length: */;
- if (fmt == 3) {
- assert(!(isContextHeader(hdr)));
+l3: /* end fixedFieldsOf:format:length: */;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ /* begin fetchStackPointerOf: */
+ sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord));
+ if (!((sp & 1))) {
+ stSize = 0;
+ goto l1;
+ }
+ assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array)));
+ stSize = (sp >> 1);
+ l1: /* end fetchStackPointerOf: */;
+ if (((((usqInt) index)) >= (((usqInt) 1)))
+ && (((((usqInt) index)) <= (((usqInt) stSize)))
+ && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(array)))))) {
+ return noInlineTemporaryin(index - 1, frameOfMarriedContext(array));
+ }
  }
- stSize = totalLength - fixedFields;
+ else {
+ stSize = totalLength - fixedFields;
+ }
  if (((((usqInt) index)) >= (((usqInt) 1)))
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  /* begin subscript:with:format: */
@@ -42394,6 +42622,7 @@
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
+    sqInt sp;
     sqInt stSize;
     sqInt sz;
     sqInt totalLength;
@@ -42411,44 +42640,62 @@
  sz -= hdr & Size4Bit;
  if (fmt <= 4) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
- goto l1;
+ goto l2;
  }
  if (fmt < 8) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
- goto l1;
+ goto l2;
  }
  else {
  totalLength = (sz - BaseHeaderSize) - (fmt & 3);
- goto l1;
+ goto l2;
  }
-l1: /* end lengthOf:baseHeader:format: */;
+l2: /* end lengthOf:baseHeader:format: */;
  /* begin fixedFieldsOf:format:length: */
  if ((fmt > 4)
  || (fmt == 2)) {
  fixedFields = 0;
- goto l2;
+ goto l3;
  }
  if (fmt < 2) {
  fixedFields = totalLength;
- goto l2;
+ goto l3;
  }
  /* begin fetchClassOfNonInt: */
  if (((ccIndex = (((usqInt) (longAt(array))) >> 12) & 31)) == 0) {
  class = (longAt(array - BaseHeaderSize)) & AllButTypeMask;
- goto l3;
+ goto l4;
  }
  else {
  class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
- goto l3;
+ goto l4;
  }
-l3: /* end fetchClassOfNonInt: */;
+l4: /* end fetchClassOfNonInt: */;
  classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
  fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
-l2: /* end fixedFieldsOf:format:length: */;
- if (fmt == 3) {
- assert(!(isContextHeader(hdr)));
+l3: /* end fixedFieldsOf:format:length: */;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ /* begin fetchStackPointerOf: */
+ sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord));
+ if (!((sp & 1))) {
+ stSize = 0;
+ goto l1;
+ }
+ assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array)));
+ stSize = (sp >> 1);
+ l1: /* end fetchStackPointerOf: */;
+ if (((((usqInt) index)) >= (((usqInt) 1)))
+ && (((((usqInt) index)) <= (((usqInt) stSize)))
+ && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(array)))))) {
+ noInlineTemporaryinput(index - 1, frameOfMarriedContext(array), value);
+ return;
+ }
  }
- stSize = totalLength - fixedFields;
+ else {
+ stSize = totalLength - fixedFields;
+ }
  if (((((usqInt) index)) >= (((usqInt) 1)))
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  /* begin subscript:with:storing:format: */

Modified: branches/Cog/src/vm/gcc3x-cointerpmt.c
===================================================================
--- branches/Cog/src/vm/gcc3x-cointerpmt.c 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/src/vm/gcc3x-cointerpmt.c 2011-08-19 21:33:12 UTC (rev 2488)
@@ -2,11 +2,11 @@
 
 
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
    from
- CoInterpreterMT VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CoInterpreterMT VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
-static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -459,7 +459,6 @@
 sqInt classExternalFunction(void);
 sqInt classExternalLibrary(void);
 sqInt classExternalStructure(void);
-sqInt classFieldOffset(void);
 sqInt classFloat(void);
 sqInt classFloatCompactIndex(void);
 sqInt classHeader(sqInt oop);
@@ -480,8 +479,6 @@
 static void commonAtPut(sqInt stringy);
 static void commonAt(sqInt stringy);
 sqInt compactClassAt(sqInt ccIndex);
-sqInt compactClassFieldLSB(void);
-sqInt compactClassFieldWidth(void);
 sqInt compactClassIndexOfHeader(sqInt header);
 sqInt compactClassIndexOf(sqInt oop);
 sqInt compactClassTable(void);
@@ -630,7 +627,7 @@
 static void initializeObjectMemory(sqInt bytesToShift);
 static void initializeStacknumSlotspageSizestackLimitOffsetstackPageHeadroom(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage, sqInt stackLimitOffsetBytes, sqInt stackPageHeadroomBytes);
 static sqInt initStackPagesAndInterpret(void);
-static void installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy);
+static sqInt installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy);
 sqInt instanceSizeOf(sqInt classObj);
 sqInt instantiateClassindexableSize(sqInt classPointer, sqInt size);
 usqInt instructionPointerAddress(void);
@@ -649,6 +646,7 @@
 sqInt isCogMethodReference(sqInt methodHeader);
 sqInt isCompiledMethod(sqInt oop);
 static sqInt isContextHeader(sqInt aHeader);
+static sqInt isContextNonInt(sqInt oop);
 static sqInt isContext(sqInt oop);
 sqInt isFloatObject(sqInt oop);
 static sqInt isFree(StackPage * self_in_isFree);
@@ -693,6 +691,7 @@
 sqInt loadBitBltFrom(sqInt bb);
 static sqInt loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray);
 void loadInitialContext(void);
+void longPrintOop(sqInt oop);
 static sqInt lookupInMethodCacheSelclass(sqInt selector, sqInt class);
 static sqInt lookupMethodInClass(sqInt class);
 static sqInt lookupMethodInDictionary(sqInt dictionary);
@@ -746,8 +745,11 @@
 static StackPage * newStackPage(void);
 usqInt nextProfileTickAddress(void);
 sqInt nilObject(void);
+sqInt noAssertHeaderOf(sqInt methodPointer);
 static void noAtCacheCommonAtPut(sqInt stringy);
 static void noAtCacheCommonAt(sqInt stringy);
+static sqInt noInlineTemporaryin(sqInt offset, char *theFP);
+static void noInlineTemporaryinput(sqInt offset, char *theFP, sqInt valueOop);
 static sqInt noMarkedContextsOnPage(StackPage *thePage);
 static sqInt nonWeakFieldsOf(sqInt oop);
 sqInt nullHeaderForMachineCodeMethod(void);
@@ -1222,8 +1224,8 @@
 _iss StackPage * stackPage;
 _iss sqInt nilObj;
 _iss usqInt instructionPointer;
+_iss sqInt argumentCount;
 _iss usqInt method;
-_iss sqInt argumentCount;
 _iss usqInt freeStart;
 _iss usqInt newMethod;
 _iss usqInt youngStart;
@@ -1983,13 +1985,16 @@
  /* 575 */ (void (*)(void))0,
  0 };
 static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void);
-const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.117]";
+const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.119]";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */;
 volatile int sendTrace;
 sqInt willNotThreadWarnCount;
 
 
 /*** Macros ***/
+#define classFieldOffset() (0 - BaseHeaderSize)
+#define compactClassFieldLSB() 12
+#define compactClassFieldWidth() 5
 #define compilationBreakpoint(sel, len) do { \
  if ((len) == breakSelectorLength \
  && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, breakSelectorLength)) { \
@@ -2008,6 +2013,8 @@
 #define getDesiredCogCodeSize() integerObjectOf(desiredCogCodeSize)
 #define getMaxWaitingPriority() GIV(maxWaitingPriority)
 #define getNumThreads() GIV(numThreads)
+#define instFormatFieldLSB() 8
+#define instFormatFieldWidth() 4
 #define memory() memory
 #define mostRecentlyUsedPage() GIV(mostRecentlyUsedPage)
 #define nextOpenPIC methodObject
@@ -2018,7 +2025,6 @@
 #define remapBufferCount() GIV(remapBufferCount)
 #define setDesiredCogCodeSize(dccs) (desiredCogCodeSize = (dccs))
 #define stackPageAtpages(index,pages) ((pages) + (index))
-#define typeEtAlWord(cm) (((long *)(cm))[1])
 #define validate() 0
 #define youngStart() GIV(youngStart)
 
@@ -7790,36 +7796,39 @@
  }
  }
  }
- /* begin commonVariable:at:cacheIndex: */
- VM_LABEL(0commonVariableatcacheIndex);
- stSize = GIV(atCache)[atIx + AtCacheSize];
- if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
- && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
- fmt = GIV(atCache)[atIx + AtCacheFmt];
- if (fmt <= 4) {
- fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
- result = longAt((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord));
- goto l73;
- }
- if (fmt < 8) {
+ if (!GIV(primFailCode)) {
+ /* begin commonVariable:at:cacheIndex: */
+ VM_LABEL(0commonVariableatcacheIndex);
+ stSize = GIV(atCache)[atIx + AtCacheSize];
+ if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
+ && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
+ fmt = GIV(atCache)[atIx + AtCacheFmt];
+ if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
+ fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
+ result = longAt((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord));
+ goto l73;
+ }
+ if (fmt < 8) {
 
- /* Bitmap */
+ /* Bitmap */
 
- result1 = long32At((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2));
- result = positive32BitIntegerFor(result1);
- goto l73;
+ result1 = long32At((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2));
+ result = positive32BitIntegerFor(result1);
+ goto l73;
+ }
+ if (fmt >= 16) {
+ result = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + ((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << ShiftForWord));
+ goto l73;
+ }
+ else {
+ result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
+ goto l73;
+ }
  }
- if (fmt >= 16) {
- result = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CharacterTable << ShiftForWord))) + BaseHeaderSize) + ((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << ShiftForWord));
- goto l73;
- }
- else {
- result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
- goto l73;
- }
+ result = (GIV(primFailCode) = PrimErrBadIndex);
+ l73: /* end commonVariable:at:cacheIndex: */;
  }
- result = (GIV(primFailCode) = PrimErrBadIndex);
- l73: /* end commonVariable:at:cacheIndex: */;
  if (!GIV(primFailCode)) {
  /* begin fetchNextBytecode */
  currentBytecode = byteAtPointer(++localIP);
@@ -7827,6 +7836,8 @@
  longAtPointerput((localSP += (2 - 1) * BytesPerWord), result);
  goto l71;
  }
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
  }
  GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SpecialSelectors << ShiftForWord))) + BaseHeaderSize) + ((16 * 2) << ShiftForWord));
  GIV(argumentCount) = 1;
@@ -7889,59 +7900,62 @@
  }
  }
  }
- /* begin commonVariable:at:put:cacheIndex: */
- VM_LABEL(0commonVariableatputcacheIndex);
- stSize = GIV(atCache)[atIx + AtCacheSize];
- if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
- && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
- fmt = GIV(atCache)[atIx + AtCacheFmt];
- if (fmt <= 4) {
- fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
- /* begin storePointer:ofObject:withValue: */
- if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
- possibleRootStoreIntovalue(rcvr, value);
+ if (!GIV(primFailCode)) {
+ /* begin commonVariable:at:put:cacheIndex: */
+ VM_LABEL(0commonVariableatputcacheIndex);
+ stSize = GIV(atCache)[atIx + AtCacheSize];
+ if (((((usqInt) ((index >> 1)))) >= (((usqInt) 1)))
+ && ((((usqInt) ((index >> 1)))) <= (((usqInt) stSize)))) {
+ fmt = GIV(atCache)[atIx + AtCacheFmt];
+ if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
+ fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
+ /* begin storePointer:ofObject:withValue: */
+ if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
+ possibleRootStoreIntovalue(rcvr, value);
+ }
+ longAtput((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord), value);
+ goto l75;
  }
- longAtput((rcvr + BaseHeaderSize) + (((((index >> 1)) + fixedFields) - 1) << ShiftForWord), value);
- goto l75;
- }
- if (fmt < 8) {
+ if (fmt < 8) {
 
- /* Bitmap */
+ /* Bitmap */
 
- valToPut = positive32BitValueOf(value);
- if (!GIV(primFailCode)) {
- long32Atput((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2), valToPut);
+ valToPut = positive32BitValueOf(value);
+ if (!GIV(primFailCode)) {
+ long32Atput((rcvr + BaseHeaderSize) + ((((index >> 1)) - 1) << 2), valToPut);
+ }
+ goto l75;
  }
- goto l75;
- }
- if (fmt >= 16) {
+ if (fmt >= 16) {
 
- /* Note fmt >= 16 is an artificial flag for strings */
+ /* Note fmt >= 16 is an artificial flag for strings */
 
- valToPut = asciiOfCharacter(value);
- if (!(!GIV(primFailCode))) {
- goto l75;
+ valToPut = asciiOfCharacter(value);
+ if (!(!GIV(primFailCode))) {
+ goto l75;
+ }
  }
- }
- else {
- valToPut = value;
- }
- if ((valToPut & 1)) {
- valToPut = (valToPut >> 1);
- if (!((valToPut >= 0)
- && (valToPut <= 255))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
+ else {
+ valToPut = value;
+ }
+ if ((valToPut & 1)) {
+ valToPut = (valToPut >> 1);
+ if (!((valToPut >= 0)
+ && (valToPut <= 255))) {
+ /* begin primitiveFail */
+ if (!GIV(primFailCode)) {
+ GIV(primFailCode) = 1;
+ }
+ goto l75;
  }
+ byteAtput((rcvr + BaseHeaderSize) + (((index >> 1)) - 1), valToPut);
  goto l75;
  }
- byteAtput((rcvr + BaseHeaderSize) + (((index >> 1)) - 1), valToPut);
- goto l75;
  }
+ GIV(primFailCode) = PrimErrBadIndex;
+ l75: /* end commonVariable:at:put:cacheIndex: */;
  }
- GIV(primFailCode) = PrimErrBadIndex;
- l75: /* end commonVariable:at:put:cacheIndex: */;
  if (!GIV(primFailCode)) {
  /* begin fetchNextBytecode */
  currentBytecode = byteAtPointer(++localIP);
@@ -7949,6 +7963,8 @@
  longAtPointerput((localSP += (3 - 1) * BytesPerWord), value);
  goto l74;
  }
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
  }
  GIV(messageSelector) = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SpecialSelectors << ShiftForWord))) + BaseHeaderSize) + ((17 * 2) << ShiftForWord));
  GIV(argumentCount) = 2;
@@ -11728,7 +11744,7 @@
  || ((heapMapAtWord(pointerForOop(fieldOop))) == 0)) {
  print("object leak in ");
  printHex(obj);
- print(" class ");
+ print(" class = ");
  printHex(fieldOop);
  /* begin cr */
  printf("\n");
@@ -11795,6 +11811,8 @@
  printHex(obj);
  print(" @ ");
  printNum(fi);
+ print(" = ");
+ printHex(fieldOop);
  /* begin cr */
  printf("\n");
  ok = 0;
@@ -12330,12 +12348,6 @@
 }
 
 sqInt
-classFieldOffset(void)
-{
- return 0 - BaseHeaderSize;
-}
-
-sqInt
 classFloat(void)
 {
  return longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassFloat << ShiftForWord));
@@ -12685,7 +12697,12 @@
 
  atIx = (rcvr & AtCacheMask) + AtPutBase;
  if (!((GIV(atCache)[atIx + AtCacheOop]) == rcvr)) {
- installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy);
+ if (!(installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy))) {
+ assert(isContextNonInt(rcvr));
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
+ primitiveContextAtPut(); return;
+ }
  }
  if (!GIV(primFailCode)) {
  /* begin commonVariable:at:put:cacheIndex: */
@@ -12695,6 +12712,7 @@
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  fmt = GIV(atCache)[atIx + AtCacheFmt];
  if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
  fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
  /* begin storePointer:ofObject:withValue: */
  if ((((usqInt) rcvr)) < (((usqInt) GIV(youngStart)))) {
@@ -12812,7 +12830,12 @@
 
  atIx = rcvr & AtCacheMask;
  if (!((GIV(atCache)[atIx + AtCacheOop]) == rcvr)) {
- installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy);
+ if (!(installinAtCacheatstring(rcvr, GIV(atCache), atIx, stringy))) {
+ assert(isContextNonInt(rcvr));
+ /* begin initPrimCall */
+ GIV(primFailCode) = 0;
+ primitiveContextAt(); return;
+ }
  }
  if (!GIV(primFailCode)) {
  /* begin commonVariable:at:cacheIndex: */
@@ -12822,6 +12845,7 @@
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  fmt = GIV(atCache)[atIx + AtCacheFmt];
  if (fmt <= 4) {
+ assert(!(isContextNonInt(rcvr)));
  fixedFields = GIV(atCache)[atIx + AtCacheFixedFields];
  result = longAt((rcvr + BaseHeaderSize) + (((index + fixedFields) - 1) << ShiftForWord));
  goto l1;
@@ -12883,18 +12907,6 @@
 }
 
 sqInt
-compactClassFieldLSB(void)
-{
- return 12;
-}
-
-sqInt
-compactClassFieldWidth(void)
-{
- return 5;
-}
-
-sqInt
 compactClassIndexOfHeader(sqInt header)
 {
  return (((usqInt) header) >> 12) & 31;
@@ -18676,6 +18688,7 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt activeContext;
     sqInt activeProc;
+    sqInt activeProc1;
     sqInt aMethodObj;
     StackPage *newPage;
     sqInt stackPageBytes;
@@ -18696,8 +18709,8 @@
  clearLeakMapAndMapAccessibleObjects();
  assert(checkHeapIntegrity());
  }
- activeProc = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
- activeContext = longAt((activeProc + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord));
+ activeProc1 = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
+ activeContext = longAt((activeProc1 + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord));
  /* begin marryContextInNewStackPageAndInitializeInterpreterRegisters: */
  VM_LABEL(0marryContextInNewStackPageAndInitializeInterpreterRegisters);
  assert(GIV(stackPage) == 0);
@@ -18720,6 +18733,7 @@
  top = longAt(GIV(stackPointer));
  GIV(stackPointer) += BytesPerWord;
  GIV(instructionPointer) = ((sqInt) top);
+ activeProc = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
  assert((ownerIndexOfProcess(activeProc)) == 0);
  GIV(activeProcessAffined) = (ownerIndexOfThreadId((GIV(processHasThreadId)
  ? longAt((activeProc + BaseHeaderSize) + (ThreadIdIndex << ShiftForWord))
@@ -18730,10 +18744,12 @@
 }
 
 
-/* Install the oop of this object in the given cache (at or atPut), along
- with its size, format and fixedSize */
+/* Attempt to install the oop of this object in the given cache (at or
+ atPut), along with its size, format and fixedSize. Answer if this was
+ successful.
+ */
 
-static void
+static sqInt
 installinAtCacheatstring(sqInt rcvr, sqInt *cache, sqInt atIx, sqInt stringy)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt ccIndex;
@@ -18749,11 +18765,8 @@
  fmt = (((usqInt) hdr) >> 8) & 15;
  if ((fmt == 3)
  && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ GIV(primFailCode) = PrimErrBadReceiver;
+ return 0;
  }
  /* begin lengthOf:baseHeader:format: */
  if ((hdr & TypeMask) == HeaderTypeSizeAndClass) {
@@ -18805,6 +18818,7 @@
  : fmt));
  cache[atIx + AtCacheFixedFields] = fixedFields;
  cache[atIx + AtCacheSize] = (totalLength - fixedFields);
+ return 1;
 }
 
 
@@ -19325,6 +19339,12 @@
 }
 
 static sqInt
+isContextNonInt(sqInt oop)
+{
+ return ((((usqInt) (longAt(oop))) >> 12) & 31) == ClassMethodContextCompactIndex;
+}
+
+static sqInt
 isContext(sqInt oop)
 {
  return ((oop & 1) == 0)
@@ -20312,6 +20332,7 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt activeContext;
     sqInt activeProc;
+    sqInt activeProc1;
     sqInt aMethodObj;
     StackPage *newPage;
     char *theFP;
@@ -20321,8 +20342,8 @@
  clearLeakMapAndMapAccessibleObjects();
  assert(checkHeapIntegrity());
  }
- activeProc = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
- activeContext = longAt((activeProc + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord));
+ activeProc1 = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
+ activeContext = longAt((activeProc1 + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord));
  /* begin marryContextInNewStackPageAndInitializeInterpreterRegisters: */
  VM_LABEL(1marryContextInNewStackPageAndInitializeInterpreterRegisters);
  assert(GIV(stackPage) == 0);
@@ -20345,13 +20366,110 @@
  top = longAt(GIV(stackPointer));
  GIV(stackPointer) += BytesPerWord;
  GIV(instructionPointer) = ((sqInt) top);
+ activeProc = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord));
  assert((ownerIndexOfProcess(activeProc)) == 0);
  GIV(activeProcessAffined) = (ownerIndexOfThreadId((GIV(processHasThreadId)
  ? longAt((activeProc + BaseHeaderSize) + (ThreadIdIndex << ShiftForWord))
  : GIV(nilObj)))) != 0;
 }
 
+void
+longPrintOop(sqInt oop)
+{
+    sqInt byte;
+    sqInt bytecodesPerLine;
+    sqInt fieldOop;
+    sqInt fmt;
+    sqInt header;
+    sqInt index;
+    sqInt lastIndex;
+    sqInt startIP;
+    sqInt sz;
 
+ if (((oop & 1))
+ || ((!(((oop >= heapBase) && (oop <= GIV(freeStart)))))
+ || (((oop & (BytesPerWord - 1)) != 0)
+ || ((((longAt(oop)) & TypeMask) == HeaderTypeFree)
+ || (((((fmt = (((usqInt) (longAt(oop))) >> 8) & 15)) >= 5) && (((fmt = (((usqInt) (longAt(oop))) >> 8) & 15)) <= 11))))))) {
+ printOop(oop); return;
+ }
+ printHex(oop);
+ print(": a(n) ");
+ printNameOfClasscount(fetchClassOfNonInt(oop), 5);
+ if (fmt > 4) {
+ print(" nbytes ");
+ printNum(byteSizeOf(oop));
+ }
+ /* begin cr */
+ printf("\n");
+ lastIndex = ((64 < ((startIP = ((sqInt) (lastPointerOf(oop)) >> 2)))) ? 64 : ((startIP = ((sqInt) (lastPointerOf(oop)) >> 2))));
+ if (lastIndex > 0) {
+ for (index = 1; index <= lastIndex; index += 1) {
+ fieldOop = longAt((oop + BaseHeaderSize) + ((index - 1) << ShiftForWord));
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printHex(fieldOop);
+ /* begin space */
+ /* begin printChar: */
+ putchar(' ');
+ printOopShort(fieldOop);
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ if (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12) {
+ startIP = (startIP * BytesPerWord) + 1;
+ /* begin lengthOf: */
+ header = longAt(oop);
+ /* begin lengthOf:baseHeader:format: */
+ if ((header & TypeMask) == HeaderTypeSizeAndClass) {
+ sz = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
+ }
+ else {
+ sz = header & SizeMask;
+ }
+ sz -= header & Size4Bit;
+ if (((((usqInt) header) >> 8) & 15) <= 4) {
+ lastIndex = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+ goto l1;
+ }
+ if (((((usqInt) header) >> 8) & 15) < 8) {
+ lastIndex = ((usqInt) (sz - BaseHeaderSize)) >> 2;
+ goto l1;
+ }
+ else {
+ lastIndex = (sz - BaseHeaderSize) - (((((usqInt) header) >> 8) & 15) & 3);
+ goto l1;
+ }
+ l1: /* end lengthOf: */;
+ if ((lastIndex - startIP) > 100) {
+ lastIndex = startIP + 100;
+ }
+ bytecodesPerLine = 8;
+ for (index = startIP; index <= lastIndex; index += 1) {
+ byte = byteAt((oop + BaseHeaderSize) + (index - 1));
+ printf(" %02x/%-3d", byte,byte);
+ if ((((index - startIP) + 1) % bytecodesPerLine) == 0) {
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ if (!((((lastIndex - startIP) + 1) % bytecodesPerLine) == 0)) {
+ /* begin cr */
+ printf("\n");
+ }
+ }
+ else {
+ if (startIP > 64) {
+ print("...");
+ /* begin cr */
+ printf("\n");
+ }
+ }
+}
+
+
 /* This method implements a simple method lookup cache. If an entry for the
  given selector and class is found in the cache, set the values of
  'newMethod' and 'primitiveFunctionPointer' and return true. Otherwise,
@@ -22797,7 +22915,18 @@
  return GIV(nilObj);
 }
 
+sqInt
+noAssertHeaderOf(sqInt methodPointer)
+{
+    sqInt methodHeader;
 
+ methodHeader = longAt((methodPointer + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+ return (isCogMethodReference(methodHeader)
+ ? (((CogMethod *) methodHeader)->methodHeader)
+ : methodHeader);
+}
+
+
 /* This code is called if the receiver responds primitively to at:Put:.
  The cogit can implement at: & at:put: quickly in machine code, and needs a
  backup that provides error codes. But it does not want the at cache so it
@@ -22882,7 +23011,47 @@
  }
 }
 
+static sqInt
+noInlineTemporaryin(sqInt offset, char *theFP)
+{
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
 
+ return ((((usqInt)(longAt(theFP + FoxMethod)))) < heapBase
+ ? (offset < ((frameNumArgs = (mframeCogMethod(theFP)->cmNumArgs)))
+ ? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs - offset) * BytesPerWord))
+ : longAt(((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - offset) * BytesPerWord)))
+ : (offset < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))
+ ? longAt((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - offset) * BytesPerWord))
+ : longAt(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - offset) * BytesPerWord))));
+}
+
+static void
+noInlineTemporaryinput(sqInt offset, char *theFP, sqInt valueOop)
+{
+    sqInt frameNumArgs;
+    sqInt frameNumArgs1;
+
+ /* begin temporary:in:put: */
+ VM_LABEL(0temporaryinput);
+ if ((((usqInt)(longAt(theFP + FoxMethod)))) < heapBase) {
+ /* begin mtemporary:in:put: */
+ longAtput((offset < ((frameNumArgs = (mframeCogMethod(theFP)->cmNumArgs)))
+ ? (theFP + FoxCallerSavedIP) + ((frameNumArgs - offset) * BytesPerWord)
+ : ((theFP + FoxMFReceiver) - BytesPerWord) + ((frameNumArgs - offset) * BytesPerWord)), valueOop);
+ }
+ else {
+ /* begin itemporary:in:put: */
+ if (offset < ((frameNumArgs1 = byteAt((theFP + FoxIFrameFlags) + 1)))) {
+ longAtput((theFP + FoxCallerSavedIP) + ((frameNumArgs1 - offset) * BytesPerWord), valueOop);
+ }
+ else {
+ longAtput(((theFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - offset) * BytesPerWord), valueOop);
+ }
+ }
+}
+
+
 /* Answer true if there are no marked contexts on thePage. */
 
 static sqInt
@@ -25668,7 +25837,7 @@
     sqInt methodHeader;
     sqInt newCopy;
     sqInt objHeader;
-    sqInt receiver;
+    sqInt rcvr;
     char *sp;
     sqInt sp1;
     char *spouseFP;
@@ -25676,29 +25845,29 @@
     sqInt valuePointer;
     sqInt valuePointer1;
 
- receiver = longAt(GIV(stackPointer));
- if ((receiver & 1)) {
- newCopy = receiver;
+ rcvr = longAt(GIV(stackPointer));
+ if ((rcvr & 1)) {
+ newCopy = rcvr;
  }
  else {
- objHeader = longAt(receiver);
+ objHeader = longAt(rcvr);
  if (((((usqInt) objHeader) >> 12) & 31) == ClassMethodContextCompactIndex) {
  /* begin cloneContext: */
  VM_LABEL(0cloneContext);
- cloned = eeInstantiateMethodContextByteSize(byteSizeOf(receiver));
+ cloned = eeInstantiateMethodContextByteSize(byteSizeOf(rcvr));
  if (cloned != 0) {
  for (i = 0; i <= StackPointerIndex; i += 1) {
  /* begin storePointerUnchecked:ofObject:withValue: */
- valuePointer = externalInstVarofContext(i, receiver);
+ valuePointer = externalInstVarofContext(i, rcvr);
  longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), valuePointer);
  }
  for (i = MethodIndex; i <= ReceiverIndex; i += 1) {
- longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), longAt((receiver + BaseHeaderSize) + (i << ShiftForWord)));
+ longAtput((cloned + BaseHeaderSize) + (i << ShiftForWord), longAt((rcvr + BaseHeaderSize) + (i << ShiftForWord)));
  }
- if ((((longAt((receiver + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
- && (!(isWidowedContext(receiver)))) {
+ if ((((longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(rcvr)))) {
  /* begin frameOfMarriedContext: */
- value = longAt((receiver + BaseHeaderSize) + (SenderIndex << ShiftForWord));
+ value = longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord));
  /* begin withoutSmallIntegerTags: */
  assert((value & 1));
  spouseFP = pointerForOop(value - 1);
@@ -25716,16 +25885,16 @@
  }
  }
  else {
- sp1 = (fetchStackPointerOf(receiver)) - 1;
+ sp1 = (fetchStackPointerOf(rcvr)) - 1;
  for (i = 0; i <= sp1; i += 1) {
- longAtput((cloned + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord), longAt((receiver + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord)));
+ longAtput((cloned + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord), longAt((rcvr + BaseHeaderSize) + ((i + CtxtTempFrameStart) << ShiftForWord)));
  }
  }
  }
  newCopy = cloned;
  }
  else {
- newCopy = clone(receiver);
+ newCopy = clone(rcvr);
  }
  if (newCopy == 0) {
  (GIV(primFailCode) = PrimErrNoMemory); return;
@@ -26658,6 +26827,10 @@
  }
 }
 
+
+/* Special version of primitiveAt for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static void
 primitiveContextAt(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -26685,11 +26858,7 @@
 
  index = longAt(GIV(stackPointer));
  if (!((index & 1))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadArgument); return;
  }
  index = (index >> 1);
 
@@ -26703,7 +26872,7 @@
 
  value = stObjectat(aContext, index);
  /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp = GIV(stackPointer) + ((GIV(argumentCount) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp;
  return;
  }
@@ -26785,11 +26954,7 @@
  stSize = (sp11 >> 1);
  l5: /* end stackPointerForMaybeMarriedContext: */;
  if (!(((index >= 1) && (index <= stSize)))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadIndex); return;
  }
  /* begin subscript:with:format: */
  if (fmt <= 4) {
@@ -26806,7 +26971,7 @@
  }
  l3: /* end subscript:with:format: */;
  /* begin pop:thenPush: */
- longAtput((sp1 = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp1;
  return;
  }
@@ -26816,11 +26981,7 @@
  assert((value1 & 1));
  spouseFP = pointerForOop(value1 - 1);
  if (!(((index >= 1) && (index <= (stackPointerIndexForFrame(spouseFP)))))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ (GIV(primFailCode) = PrimErrBadIndex); return;
  }
  value = ((((usqInt)(longAt(spouseFP + FoxMethod)))) < heapBase
  ? ((index - 1) < ((frameNumArgs = (mframeCogMethod(spouseFP)->cmNumArgs)))
@@ -26830,10 +26991,14 @@
  ? longAt((spouseFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - 1)) * BytesPerWord))
  : longAt(((spouseFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - 1)) * BytesPerWord))));
  /* begin pop:thenPush: */
- longAtput((sp2 = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), value);
+ longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp2;
 }
 
+
+/* Special version of primitiveAtPut for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static sqInt
 primitiveContextAtPut(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -26864,18 +27029,14 @@
  index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
  aContext = longAt(GIV(stackPointer) + (2 * BytesPerWord));
  if (!((index & 1))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadArgument);
  }
  hdr = longAt(aContext);
  index = (index >> 1);
  if (!(((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
  stObjectatput(aContext, index, value);
  /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp;
  return null;
  }
@@ -26957,11 +27118,7 @@
  stSize = (sp11 >> 1);
  l4: /* end stackPointerForMaybeMarriedContext: */;
  if (!(((index >= 1) && (index <= stSize)))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadIndex);
  }
  /* begin subscript:with:storing:format: */
  VM_LABEL(0subscriptwithstoringformat);
@@ -27013,7 +27170,7 @@
  }
  }
  /* begin pop:thenPush: */
- longAtput((sp1 = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp1;
  return null;
  }
@@ -27023,15 +27180,10 @@
  assert((value1 & 1));
  spouseFP = pointerForOop(value1 - 1);
  if (!(((index >= 1) && (index <= (stackPointerIndexForFrame(spouseFP)))))) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return null;
+ return (GIV(primFailCode) = PrimErrBadIndex);
  }
  /* begin temporary:in:put: */
- VM_LABEL(0temporaryinput);
- ;
+ VM_LABEL(1temporaryinput);
  if ((((usqInt)(longAt(spouseFP + FoxMethod)))) < heapBase) {
  /* begin mtemporary:in:put: */
  longAtput(((index - 1) < ((frameNumArgs = (mframeCogMethod(spouseFP)->cmNumArgs)))
@@ -27048,11 +27200,15 @@
  }
  }
  /* begin pop:thenPush: */
- longAtput((sp2 = GIV(stackPointer) + ((3 - 1) * BytesPerWord)), value);
+ longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
  GIV(stackPointer) = sp2;
  return null;
 }
 
+
+/* Special version of primitiveSize for accessing contexts.
+ Written to be varargs for use from mirror primitives. */
+
 static void
 primitiveContextSize(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
@@ -27152,11 +27308,9 @@
  else {
  sz = totalLength - fixedFields;
  }
- if (!GIV(primFailCode)) {
- /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + ((1 - 1) * BytesPerWord)), ((sz << 1) | 1));
- GIV(stackPointer) = sp;
- }
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((sz << 1) | 1));
+ GIV(stackPointer) = sp;
 }
 
 
@@ -35749,31 +35903,77 @@
 static void
 primitiveSize(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+    sqInt ccIndex;
+    sqInt class;
+    sqInt classFormat;
+    sqInt fixedFields;
+    sqInt fmt;
+    sqInt hdr;
     sqInt rcvr;
     char *sp;
     sqInt sz;
+    sqInt totalLength;
 
  rcvr = longAt(GIV(stackPointer));
- if ((rcvr & 1)) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ if (((rcvr & 1))
+ || ((
+ /* Integers are not indexable */
+
+(hdr = longAt(rcvr)),
+ ((fmt = (((usqInt) hdr) >> 8) & 15)) < 2))) {
+ (GIV(primFailCode) = PrimErrBadReceiver); return;
  }
- if (((((usqInt) (longAt(rcvr))) >> 8) & 15) < 2) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- return;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ primitiveContextSize(); return;
  }
- sz = stSizeOf(rcvr);
- if (!GIV(primFailCode)) {
- /* begin pop:thenPush: */
- longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), ((sz << 1) | 1));
- GIV(stackPointer) = sp;
+ /* begin lengthOf:baseHeader:format: */
+ if ((hdr & TypeMask) == HeaderTypeSizeAndClass) {
+ sz = (longAt(rcvr - (BytesPerWord * 2))) & LongSizeMask;
  }
+ else {
+ sz = hdr & SizeMask;
+ }
+ sz -= hdr & Size4Bit;
+ if (fmt <= 4) {
+ totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
+ goto l1;
+ }
+ if (fmt < 8) {
+ totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
+ goto l1;
+ }
+ else {
+ totalLength = (sz - BaseHeaderSize) - (fmt & 3);
+ goto l1;
+ }
+l1: /* end lengthOf:baseHeader:format: */;
+ /* begin fixedFieldsOf:format:length: */
+ if ((fmt > 4)
+ || (fmt == 2)) {
+ fixedFields = 0;
+ goto l2;
+ }
+ if (fmt < 2) {
+ fixedFields = totalLength;
+ goto l2;
+ }
+ /* begin fetchClassOfNonInt: */
+ if (((ccIndex = (((usqInt) (longAt(rcvr))) >> 12) & 31)) == 0) {
+ class = (longAt(rcvr - BaseHeaderSize)) & AllButTypeMask;
+ goto l3;
+ }
+ else {
+ class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
+ goto l3;
+ }
+l3: /* end fetchClassOfNonInt: */;
+ classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
+ fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
+l2: /* end fixedFieldsOf:format:length: */;
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (((totalLength - fixedFields) << 1) | 1));
+ GIV(stackPointer) = sp;
 }
 
 
@@ -39577,6 +39777,7 @@
 printMethodDictionaryOf(sqInt behavior)
 {
     sqInt index;
+    sqInt meth;
     sqInt methodArray;
     sqInt selector;
 
@@ -39586,9 +39787,15 @@
  for (index = SelectorStart; index <= ((fetchWordLengthOf(longAt((behavior + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord)))) - 1); index += 1) {
  selector = longAt(((longAt((behavior + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord))) + BaseHeaderSize) + (index << ShiftForWord));
  if (selector != GIV(nilObj)) {
+ meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
  printOopShort(selector);
  print(" => ");
- printOopShort(longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord)));
+ printOopShort(meth);
+ print(" (");
+ printHex(selector);
+ print(" => ");
+ printHex(meth);
+ putchar(')');
  /* begin cr */
  printf("\n");
  }
@@ -39599,6 +39806,7 @@
 printMethodDictionary(sqInt dictionary)
 {
     sqInt index;
+    sqInt meth;
     sqInt methodArray;
     sqInt selector;
 
@@ -39606,9 +39814,15 @@
  for (index = SelectorStart; index <= ((fetchWordLengthOf(dictionary)) - 1); index += 1) {
  selector = longAt((dictionary + BaseHeaderSize) + (index << ShiftForWord));
  if (selector != GIV(nilObj)) {
+ meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord));
  printOopShort(selector);
  print(" => ");
- printOopShort(longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << ShiftForWord)));
+ printOopShort(meth);
+ print(" (");
+ printHex(selector);
+ print(" => ");
+ printHex(meth);
+ putchar(')');
  /* begin cr */
  printf("\n");
  }
@@ -43803,6 +44017,7 @@
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
+    sqInt sp;
     sqInt stSize;
     sqInt sz;
     sqInt totalLength;
@@ -43819,44 +44034,61 @@
  sz -= hdr & Size4Bit;
  if (fmt <= 4) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
- goto l1;
+ goto l2;
  }
  if (fmt < 8) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
- goto l1;
+ goto l2;
  }
  else {
  totalLength = (sz - BaseHeaderSize) - (fmt & 3);
- goto l1;
+ goto l2;
  }
-l1: /* end lengthOf:baseHeader:format: */;
+l2: /* end lengthOf:baseHeader:format: */;
  /* begin fixedFieldsOf:format:length: */
  if ((fmt > 4)
  || (fmt == 2)) {
  fixedFields = 0;
- goto l2;
+ goto l3;
  }
  if (fmt < 2) {
  fixedFields = totalLength;
- goto l2;
+ goto l3;
  }
  /* begin fetchClassOfNonInt: */
  if (((ccIndex = (((usqInt) (longAt(array))) >> 12) & 31)) == 0) {
  class = (longAt(array - BaseHeaderSize)) & AllButTypeMask;
- goto l3;
+ goto l4;
  }
  else {
  class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
- goto l3;
+ goto l4;
  }
-l3: /* end fetchClassOfNonInt: */;
+l4: /* end fetchClassOfNonInt: */;
  classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
  fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
-l2: /* end fixedFieldsOf:format:length: */;
- if (fmt == 3) {
- assert(!(isContextHeader(hdr)));
+l3: /* end fixedFieldsOf:format:length: */;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ /* begin fetchStackPointerOf: */
+ sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord));
+ if (!((sp & 1))) {
+ stSize = 0;
+ goto l1;
+ }
+ assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array)));
+ stSize = (sp >> 1);
+ l1: /* end fetchStackPointerOf: */;
+ if (((((usqInt) index)) >= (((usqInt) 1)))
+ && (((((usqInt) index)) <= (((usqInt) stSize)))
+ && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(array)))))) {
+ return noInlineTemporaryin(index - 1, frameOfMarriedContext(array));
+ }
  }
- stSize = totalLength - fixedFields;
+ else {
+ stSize = totalLength - fixedFields;
+ }
  if (((((usqInt) index)) >= (((usqInt) 1)))
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  /* begin subscript:with:format: */
@@ -43888,6 +44120,7 @@
     sqInt fixedFields;
     sqInt fmt;
     sqInt hdr;
+    sqInt sp;
     sqInt stSize;
     sqInt sz;
     sqInt totalLength;
@@ -43905,44 +44138,62 @@
  sz -= hdr & Size4Bit;
  if (fmt <= 4) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord;
- goto l1;
+ goto l2;
  }
  if (fmt < 8) {
  totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2;
- goto l1;
+ goto l2;
  }
  else {
  totalLength = (sz - BaseHeaderSize) - (fmt & 3);
- goto l1;
+ goto l2;
  }
-l1: /* end lengthOf:baseHeader:format: */;
+l2: /* end lengthOf:baseHeader:format: */;
  /* begin fixedFieldsOf:format:length: */
  if ((fmt > 4)
  || (fmt == 2)) {
  fixedFields = 0;
- goto l2;
+ goto l3;
  }
  if (fmt < 2) {
  fixedFields = totalLength;
- goto l2;
+ goto l3;
  }
  /* begin fetchClassOfNonInt: */
  if (((ccIndex = (((usqInt) (longAt(array))) >> 12) & 31)) == 0) {
  class = (longAt(array - BaseHeaderSize)) & AllButTypeMask;
- goto l3;
+ goto l4;
  }
  else {
  class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord));
- goto l3;
+ goto l4;
  }
-l3: /* end fetchClassOfNonInt: */;
+l4: /* end fetchClassOfNonInt: */;
  classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1;
  fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1;
-l2: /* end fixedFieldsOf:format:length: */;
- if (fmt == 3) {
- assert(!(isContextHeader(hdr)));
+l3: /* end fixedFieldsOf:format:length: */;
+ if ((fmt == 3)
+ && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) {
+ /* begin fetchStackPointerOf: */
+ sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord));
+ if (!((sp & 1))) {
+ stSize = 0;
+ goto l1;
+ }
+ assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array)));
+ stSize = (sp >> 1);
+ l1: /* end fetchStackPointerOf: */;
+ if (((((usqInt) index)) >= (((usqInt) 1)))
+ && (((((usqInt) index)) <= (((usqInt) stSize)))
+ && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1))
+ && (!(isWidowedContext(array)))))) {
+ noInlineTemporaryinput(index - 1, frameOfMarriedContext(array), value);
+ return;
+ }
  }
- stSize = totalLength - fixedFields;
+ else {
+ stSize = totalLength - fixedFields;
+ }
  if (((((usqInt) index)) >= (((usqInt) 1)))
  && ((((usqInt) index)) <= (((usqInt) stSize)))) {
  /* begin subscript:with:storing:format: */

Modified: branches/Cog/src/vm/interp.h
===================================================================
--- branches/Cog/src/vm/interp.h 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/src/vm/interp.h 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,5 +1,5 @@
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
 
 #define VM_PROXY_MAJOR 1

Modified: branches/Cog/src/vm/vmCallback.h
===================================================================
--- branches/Cog/src/vm/vmCallback.h 2011-08-16 22:28:12 UTC (rev 2487)
+++ branches/Cog/src/vm/vmCallback.h 2011-08-19 21:33:12 UTC (rev 2488)
@@ -1,5 +1,5 @@
 /* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.117 uuid: a21465f6-8cd9-4284-8638-c30d5de21ce9
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.119 uuid: dedbaf07-59d6-4a97-b10a-af8a7f631287
  */
 
 #define VM_CALLBACK_INC 1