[Vm-dev] [commit][3064] CogVM source as per VMMaker.oscog-eem.865

commits at squeakvm.org commits at squeakvm.org
Tue Aug 26 08:52:46 UTC 2014


Revision: 3064
Author:   eliot
Date:     2014-08-26 01:52:44 -0700 (Tue, 26 Aug 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.865

Sista:
Fix primitiveSistaMethodPICAndCounterData after the VMMaker.oscog-eem.814
change moving counters to the heap.  Add several modifications to the
current image facade so we can get the send and branch data for an
in-image compilation.  Fix header printing of counters and IR caches.

Implement genBinaryConstOpVarInlinePrimitive: &
genBinaryVarOpConstInlinePrimitive: and correct
genBinaryVarOpVarInlinePrimitive: for Slang.

V3:
Fix bug with become where duplicate entries in the input
array would crash the system (thanks Igor).

Spur:
Add an assert to check for a valid mehtodClassAssociation
in methods (arguably dubious) to help catch malformed
methods in multiple bytecode shenannigans.

Reduce the possibility for heisenbugs by providing
noFixupFollowField:ofObject: and using it in debugging code.

General:
Make nameOfClass: more robust, in both the real and simulated VMs.

Modified Paths:
--------------
    branches/Cog/image/BuildSqueak45VMMakerImage.st
    branches/Cog/image/LoadSpurPackagesFromTempDir.st
    branches/Cog/image/WriteSpurPackagesToTempDir.st
    branches/Cog/image/buildspurtrunkimage.sh
    branches/Cog/image/getGoodCogVM.sh
    branches/Cog/image/getGoodSpurVM.sh
    branches/Cog/nscogsrc/vm/cogit.c
    branches/Cog/nscogsrc/vm/cogit.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/nsspurstacksrc/vm/gcc3x-interp.c
    branches/Cog/nsspurstacksrc/vm/interp.c
    branches/Cog/scripts/uploadvms
    branches/Cog/sistasrc/vm/cogit.c
    branches/Cog/sistasrc/vm/cogit.h
    branches/Cog/sistasrc/vm/cointerp.c
    branches/Cog/sistasrc/vm/cointerp.h
    branches/Cog/sistasrc/vm/gcc3x-cointerp.c
    branches/Cog/spursistasrc/vm/cogit.c
    branches/Cog/spursistasrc/vm/cogit.h
    branches/Cog/spursistasrc/vm/cointerp.c
    branches/Cog/spursistasrc/vm/cointerp.h
    branches/Cog/spursistasrc/vm/gcc3x-cointerp.c
    branches/Cog/spursrc/vm/cogit.c
    branches/Cog/spursrc/vm/cogit.h
    branches/Cog/spursrc/vm/cointerp.c
    branches/Cog/spursrc/vm/cointerp.h
    branches/Cog/spursrc/vm/gcc3x-cointerp.c
    branches/Cog/spurstacksrc/vm/gcc3x-interp.c
    branches/Cog/spurstacksrc/vm/interp.c
    branches/Cog/src/vm/cogit.c
    branches/Cog/src/vm/cogit.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/stacksrc/vm/gcc3x-interp.c
    branches/Cog/stacksrc/vm/interp.c

Added Paths:
-----------
    branches/Cog/image/uploadspurimage.sh

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

Modified: branches/Cog/image/BuildSqueak45VMMakerImage.st
===================================================================
--- branches/Cog/image/BuildSqueak45VMMakerImage.st	2014-08-14 19:43:38 UTC (rev 3063)
+++ branches/Cog/image/BuildSqueak45VMMakerImage.st	2014-08-26 08:52:44 UTC (rev 3064)
@@ -23,6 +23,10 @@
 				{repository. order. packages}] valueWithArguments: tuple])
 			sort: [:a :b| a second <= b second].
 
+Character instSize > 0 ifTrue:
+	[#('callPrimitiveShimForV3.st') do:
+		[:fileName| (FileDirectory default fileNamed: fileName) fileIn]].
+
 ((MCMcmUpdater defaultUpdateURL endsWith: 'trunk')
 	ifTrue:
 		[#(	"'FT2Constants.st'"
Modified: branches/Cog/image/LoadSpurPackagesFromTempDir.st
===================================================================
--- branches/Cog/image/LoadSpurPackagesFromTempDir.st	2014-08-14 19:43:38 UTC (rev 3063)
+++ branches/Cog/image/LoadSpurPackagesFromTempDir.st	2014-08-26 08:52:44 UTC (rev 3064)
@@ -1,7 +1,9 @@
 | dir tempRepo |
 dir := FileDirectory default directoryNamed: 'temp-spur-repository'.
 tempRepo := MCDirectoryRepository path: dir fullName.
-#('Collections' 'Kernel' 'System') do:
+"I dug a deep hole with the compiler changes here.  This hack gets me out."
+EncoderForV3 removeSelector: #computeMethodHeaderForNumArgs:numTemps:numLits:primitive:.
+#('Collections' 'Compiler' 'Kernel' 'System') do:
 	[:package| | versionName version |
 	versionName := (tempRepo versionNamesForPackageNamed: package) first.
 	version := tempRepo versionNamed: versionName.
Modified: branches/Cog/image/WriteSpurPackagesToTempDir.st
===================================================================
--- branches/Cog/image/WriteSpurPackagesToTempDir.st	2014-08-14 19:43:38 UTC (rev 3063)
+++ branches/Cog/image/WriteSpurPackagesToTempDir.st	2014-08-26 08:52:44 UTC (rev 3064)
@@ -3,7 +3,7 @@
 dir assureExistence.
 tempRepo := MCDirectoryRepository path: dir fullName.
 trunkRepo := MCRepositoryGroup default repositories  detect:[:r| r description = 'http://source.squeak.org/trunk'].
-#('Collections' 'Kernel' 'System') do:
+#('Collections' 'Compiler' 'Kernel' 'System') do:
 	[:package| | currentVersion |
 	currentVersion := (MCPackage named: package) workingCopy ancestry ancestors first versionName.
 	tempRepo storeVersion: (trunkRepo versionNamed: currentVersion, '.mcz')].
Modified: branches/Cog/image/buildspurtrunkimage.sh
===================================================================
--- branches/Cog/image/buildspurtrunkimage.sh	2014-08-14 19:43:38 UTC (rev 3063)
+++ branches/Cog/image/buildspurtrunkimage.sh	2014-08-26 08:52:44 UTC (rev 3064)
@@ -3,7 +3,7 @@
 ./getsqueak45.sh
 . ./getGoodCogVM.sh
 
-if [ "$1" -ne -skiptrunkbuild ]; then
+if [ "$1" != -skiptrunkbuild ]; then
 	cp -p $SQUEAK45.image trunk46forspur.image
 	cp -p $SQUEAK45.changes trunk46forspur.changes
 
@@ -52,5 +52,5 @@
 
 # Now load the modified packages
 . ./getGoodSpurVM.sh
-echo $VM trunk46-spur.image LoadSpurPackagesFromTempDir.st
-$VM trunk46-spur.image LoadSpurPackagesFromTempDir.st
+echo $VM -blockonerror trunk46-spur.image LoadSpurPackagesFromTempDir.st
+$VM -blockonerror trunk46-spur.image LoadSpurPackagesFromTempDir.st

Modified: branches/Cog/image/getGoodCogVM.sh
===================================================================
--- branches/Cog/image/getGoodCogVM.sh	2014-08-14 19:43:38 UTC (rev 3063)
+++ branches/Cog/image/getGoodCogVM.sh	2014-08-26 08:52:44 UTC (rev 3064)
@@ -1,31 +1,31 @@
 #!/bin/sh
-# Sets the VM env var to the r3060 Cog VM for the current platform.
+# Sets the VM env var to the r3063 Cog VM for the current platform.
 # will download and install the VM in this directory if necessary.
 
-TAG=14.31.3060
-REV=3060
+TAG=14.32.3063
+REV=3063
 URL=http://www.mirandabanda.org/files/Cog/VM/VM.r$REV/
 
 . ./envvars.sh
 
 case "$OS" in
 Darwin) get_vm_from_tar \
-            Cog.app/Contents/MacOS/Squeak b9d79576423fe79f9f77383f676d37d6 \
-            Cog.app-$TAG.tgz 2d93340bed9902bd8913067f372c7371
+            Cog.app/Contents/MacOS/Squeak efd6128a2e0ca36035bbe5ace4fd8e80 \
+            Cog.app-$TAG.tgz 658e5e3a5085529959a744c11b78f7d9
         VM=Cog.app/Contents/MacOS/Squeak;;
 Linux)
     if expr $OSREL \> 2.6.12; then
         get_vm_from_tar \
-        coglinuxht/lib/squeak/4.0-$REV/squeak 35c003d9bd2c614850ca5b99c86155e9 \
-        coglinuxht-$TAG.tgz a9e34f56f4923fff1ab4fc82f6ec93a0
+        coglinuxht/lib/squeak/4.0-$REV/squeak badd6e33775c1176e478b2262cffe177 \
+        coglinuxht-$TAG.tgz 1b58e26c4c6c92ca8b141e94c04b0ed9
     else
         get_vm_from_tar \
-        coglinux/lib/squeak/4.0-$REV/squeak 8327eef0d7dda150f3fcf809df940bf5 \
-        coglinux-$TAG.tgz 81466c4732d2fa5d8aec991938e714c8
+        coglinux/lib/squeak/4.0-$REV/squeak 817f87fa0cf4b7d90ef9599d7b762fe5 \
+        coglinux-$TAG.tgz 1394d1bfd1749b711a2266621dc8ff5b
     fi;;
 CYGWIN*) get_vm_from_zip \
-            cogwin/SqueakConsole.exe 6655d9ea5c7f0919f61a9cf5ad58b202 \
-            cogwin-$TAG.zip 8fa6ba2df26e72342889b0279f17bb6d
+            cogwin/SqueakConsole.exe 8edd0cc2355232726330ecbc967c7ce0 \
+            cogwin-$TAG.zip 888ca7a978e34176763c8be34fa13860
     VM=cogwin/SqueakConsole.exe;;
 *)  echo "don't know how to run Squeak on your system.  bailing out." 1>&2; exit 2
 esac

Modified: branches/Cog/image/getGoodSpurVM.sh
===================================================================
--- branches/Cog/image/getGoodSpurVM.sh	2014-08-14 19:43:38 UTC (rev 3063)
+++ branches/Cog/image/getGoodSpurVM.sh	2014-08-26 08:52:44 UTC (rev 3064)
@@ -1,25 +1,25 @@
 #!/bin/sh
-# Sets the VM env var to the r3060 Cog Spur VM for the current platform.
+# Sets the VM env var to the r3063 Cog Spur VM for the current platform.
 # will download and install the VM in this directory if necessary.
 
-TAG=14.31.3060
-REV=3060
+TAG=14.32.3063
+REV=3063
 URL=http://www.mirandabanda.org/files/Cog/VM/VM.r$REV/
 
 . ./envvars.sh
 
 case "$OS" in
 Darwin) get_vm_from_tar \
-            CogSpur.app/Contents/MacOS/Squeak d71657f3596108f1ee26ddde98d2a6e1 \
-            CogSpur.app-$TAG.tgz 775fc34a65293eb7c6b1fe585b29343c
+            CogSpur.app/Contents/MacOS/Squeak 80a55ecfb5abeabf3890c87898ee5914 \
+            CogSpur.app-$TAG.tgz 741a5355c22f20cda33db969bb5e3d7a
         VM=CogSpur.app/Contents/MacOS/Squeak;;
 Linux) get_vm_from_tar \
-        cogspurlinuxht/lib/squeak/4.0-$REV/squeak c0df39147de2ac7d76aee7d7aa073f36 \
-        cogspurlinuxht-$TAG.tgz 70421b720be1f5f843c96b48fbe8d07e
+        cogspurlinuxht/lib/squeak/4.0-$REV/squeak  \
+        cogspurlinuxht-$TAG.tgz af8988545c1042a9813e3166390af6cb
     VM=cogspurlinuxht/squeak;;
 CYGWIN*) get_vm_from_zip \
-            cogspurwin/SqueakConsole.exe 83454062da3b7855b81e3fb5a8c6d360 \
-            cogspurwin-$TAG.zip 463d2fe92c95f4c7083ac37cd9baf84f
+            cogspurwin/SqueakConsole.exe a7bc32115050dab7e9060e8391025c4e \
+            cogspurwin-$TAG.zip 6945ef0ff89bc5c1da00f6076868f3e6
     VM=cogspurwin/SqueakConsole.exe;;
 *)  echo "don't know how to run Squeak on your system.  bailing out." 1>&2; exit 2
 esac

Added: branches/Cog/image/uploadspurimage.sh
===================================================================
--- branches/Cog/image/uploadspurimage.sh	                        (rev 0)
+++ branches/Cog/image/uploadspurimage.sh	2014-08-26 08:52:44 UTC (rev 3064)
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Upload a trunk46-spur.image/.changes to mirandabanda.org
+RemoteUser=eliotmiranda at highland-park.dreamhost.com
+RemoteRoot=mirandabanda.org/files/Cog/SpurImages
+IFS="	
+"
+DATE=`date +%Y-%m-%d`
+BASENAME=trunk46-spur
+cd `dirname $0`
+
+DIR=$RemoteRoot/$DATE
+echo ssh -x $RemoteUser mkdir $DIR
+ssh -x $RemoteUser mkdir $DIR
+echo scp -p $BASENAME.image $BASENAME.changes "$@" $RemoteUser:$DIR
+scp -p $BASENAME.image $BASENAME.changes "$@" $RemoteUser:$DIR
+echo ssh $RemoteUser chmod a-w $DIR/* \\\; ls -al $DIR
+ssh $RemoteUser chmod a-w $DIR/* \; ls -al $DIR
+echo ssh $RemoteUser rm $RemoteRoot/{$BASENAME.image,$BASENAME.changes}
+ssh $RemoteUser rm $RemoteRoot/{$BASENAME.image,$BASENAME.changes}
+echo ssh $RemoteUser ln -s $DIR/{$BASENAME.image,$BASENAME.changes} $RemoteRoot
+ssh $RemoteUser ln -s $DIR/{$BASENAME.image,$BASENAME.changes} $RemoteRoot
+ssh $RemoteUser ls -l $RemoteRoot


Property changes on: branches/Cog/image/uploadspurimage.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2014-08-14 19:43:38 UTC (rev 3063)
+++ branches/Cog/nscogsrc/vm/cogit.c	2014-08-26 08:52:44 UTC (rev 3064)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648
+	CCodeGenerator VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648
+	StackToRegisterMappingCogit VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -120,6 +120,7 @@
 #define AlignmentNops 2
 #define AllButTypeMask 0xFFFFFFFCUL
 #define AltBlockCreationBytecodeSize 3
+#define AltFirstSpecialSelector 80
 #define AltNSSendIsPCAnnotated 0
 #define AndCqR 93
 #define AndCwR 100
@@ -183,6 +184,7 @@
 #define FirstAnnotation 64
 #define FirstJump 12
 #define FirstShortJump 15
+#define FirstSpecialSelector 176
 #define FoxCallerSavedIP 4
 #define FoxMethod -4
 #define FoxMFReceiver -12
@@ -385,6 +387,7 @@
 
 static sqInt abstractRegisterForConcreteRegister(AbstractInstruction * self_in_abstractRegisterForConcreteRegister, sqInt reg) NoDbgRegParms;
 static AbstractInstruction * addDependent(AbstractInstruction * self_in_addDependent, AbstractInstruction *anInstruction) NoDbgRegParms;
+static sqInt availableRegisterOrNilFor(AbstractInstruction * self_in_availableRegisterOrNilFor, sqInt liveRegsMask) NoDbgRegParms;
 static sqInt computeJumpTargetOffsetPlus(AbstractInstruction * self_in_computeJumpTargetOffsetPlus, sqInt anPCOffset) NoDbgRegParms;
 static sqInt concretizeLabel(AbstractInstruction * self_in_concretizeLabel) NoDbgRegParms;
 static sqInt genAlignCStackSavingRegistersnumArgswordAlignment(AbstractInstruction * self_in_genAlignCStackSavingRegistersnumArgswordAlignment, sqInt saveRegs, sqInt numArgs, sqInt alignment) NoDbgRegParms;
@@ -492,7 +495,6 @@
 static sqInt concretizeXCHGRR(AbstractInstruction * self_in_concretizeXCHGRR) NoDbgRegParms;
 static sqInt concretizeXorCwR(AbstractInstruction * self_in_concretizeXorCwR) NoDbgRegParms;
 static sqInt concretizeXorRR(AbstractInstruction * self_in_concretizeXorRR) NoDbgRegParms;
-static sqInt counterTargetFromFollowingAddress(AbstractInstruction * self_in_counterTargetFromFollowingAddress, sqInt nextInstructionAddress) NoDbgRegParms;
 static sqInt cResultRegister(AbstractInstruction * self_in_cResultRegister) NoDbgRegParms;
 static void dispatchConcretize(AbstractInstruction * self_in_dispatchConcretize) NoDbgRegParms;
 static AbstractInstruction * genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder) NoDbgRegParms;
@@ -2094,6 +2096,7 @@
 #define ceCheckFeatures() ceCheckFeaturesFunction()
 #define ceReturnToInterpreterPC() ((usqInt)ceReturnToInterpreterTrampoline)
 #define cFramePointerAddress() ((unsigned long)&CFramePointer)
+#define compileSendTrace() (traceFlags & 2)
 #define cr() putchar('\n')
 #define cStackPointerAddress() ((unsigned long)&CStackPointer)
 #define dynSuperEntryOffset() cmDynSuperEntryOffset
@@ -2183,6 +2186,31 @@
 }
 
 
+/*	Answer an unused abstract register in the liveRegMask.
+	Subclasses with more registers can override to answer them. */
+
+static sqInt
+availableRegisterOrNilFor(AbstractInstruction * self_in_availableRegisterOrNilFor, sqInt liveRegsMask)
+{
+	if (!(liveRegsMask & (registerMaskFor(Arg1Reg)))) {
+		return Arg1Reg;
+	}
+	if (!(liveRegsMask & (registerMaskFor(Arg0Reg)))) {
+		return Arg0Reg;
+	}
+	if (!(liveRegsMask & (registerMaskFor(SendNumArgsReg)))) {
+		return SendNumArgsReg;
+	}
+	if (!(liveRegsMask & (registerMaskFor(ClassReg)))) {
+		return ClassReg;
+	}
+	if (!(liveRegsMask & (registerMaskFor(ReceiverResultReg)))) {
+		return ReceiverResultReg;
+	}
+	return null;
+}
+
+
 /*	Since it's an extraction from other methods. */
 
 static sqInt
@@ -4675,17 +4703,6 @@
 }
 
 
-/*	Answer the address of the MoveAw:R or MoveR:Aw: instruction preceeding
-	nextInstructionAddress 
- */
-
-static sqInt
-counterTargetFromFollowingAddress(AbstractInstruction * self_in_counterTargetFromFollowingAddress, sqInt nextInstructionAddress)
-{
-	return literalBeforeFollowingAddress(self_in_counterTargetFromFollowingAddress, nextInstructionAddress);
-}
-
-
 /*	Answer the abstract register for the C result register.
 	Only partially implemented. Works on x86 since TempReg = EAX = C result
 	reg.  */
@@ -8663,7 +8680,6 @@
 					? nExts + 1
 					: 0);
 			}
-			/* begin maybeRememberPrevMap:absPCMcpc: */
 		}
 		else {
 			mcpc1 += (mapByte >= DisplacementX2N
@@ -10268,7 +10284,7 @@
 	genoperand(JumpNonZero, ((sqInt)sendMiss));
 	/* begin Label */
 	noCheckEntry = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
-	if (recordSendTrace()) {
+	if (compileSendTrace()) {
 		CallRT(ceTraceLinkedSendTrampoline);
 	}
 }
@@ -10694,7 +10710,7 @@
 	}
 	(method->cmUsageCount = initialMethodUsageCount());
 	(method->cpicHasMNUCase = 0);
-	(method->cmUsesPenultimateLit = maxLitIndex >= ((literalCountOfHeader(methodHeader)) - 2));
+	(method->cmUsesPenultimateLit = maxLitIndex >= ((literalCountOfMethodHeader(methodHeader)) - 2));
 	(method->blockEntryOffset = (blockEntryLabel != null
 		? ((blockEntryLabel->address)) - (((sqInt)method))
 		: 0));
@@ -12990,7 +13006,7 @@
 {
     sqInt *address;
     sqInt *address1;
-    usqInt cacheAddress;
+    sqInt cacheAddress;
     sqInt cacheTag;
     sqInt cacheTag1;
     sqInt cacheTagMarked;
@@ -13123,7 +13139,7 @@
 markLiteralspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
 {
     sqInt *address;
-    usqInt cacheAddress;
+    sqInt cacheAddress;
     sqInt cacheTag;
     sqInt cacheTag1;
     sqInt class;
@@ -13239,7 +13255,7 @@
 static sqInt
 markYoungObjectspcmethod(sqInt annotation, char *mcpc, sqInt cogMethod)
 {
-    usqInt cacheAddress;
+    sqInt cacheAddress;
     sqInt cacheTag;
     sqInt cacheTag1;
     sqInt class;
@@ -13530,7 +13546,6 @@
 					? nExts + 1
 					: 0);
 			}
-			/* begin maybeRememberPrevMap:absPCMcpc: */
 		}
 		else {
 			mcpc += (mapByte >= DisplacementX2N
@@ -13559,14 +13574,14 @@
     sqInt li;
     sqInt numLitsA;
 
-	headerA = headerOf(methodA);
-	headerB = headerOf(methodB);
-	numLitsA = literalCountOfHeader(headerA);
+	headerA = methodHeaderOf(methodA);
+	headerB = methodHeaderOf(methodB);
+	numLitsA = literalCountOfMethodHeader(headerA);
 	endPCA = endPCOf(methodA);
 	if (((argumentCountOfMethodHeader(headerA)) != (argumentCountOfMethodHeader(headerB)))
 	 || (((temporaryCountOfMethodHeader(headerA)) != (temporaryCountOfMethodHeader(headerB)))
 	 || (((primitiveIndexOfMethodheader(methodA, headerA)) != (primitiveIndexOfMethodheader(methodB, headerB)))
-	 || ((numLitsA != (literalCountOfHeader(headerB)))
+	 || ((numLitsA != (literalCountOfMethodHeader(headerB)))
 	 || (endPCA > (numBytesOf(methodB))))))) {
 		return 0;
 	}
@@ -13619,7 +13634,7 @@
 static sqInt
 noAssertMethodClassAssociationOf(sqInt methodPointer)
 {
-	return literalofMethod((literalCountOfHeader(noAssertHeaderOf(methodPointer))) - 1, methodPointer);
+	return literalofMethod((literalCountOfMethodHeader(noAssertHeaderOf(methodPointer))) - 1, methodPointer);
 }
 
 
@@ -14086,7 +14101,7 @@
 static sqInt
 remapIfObjectRefpchasYoung(sqInt annotation, char *mcpc, sqInt hasYoungPtr)
 {
-    usqInt cacheAddress;
+    sqInt cacheAddress;
     sqInt cacheTag;
     sqInt cacheTag1;
     sqInt entryPoint;
@@ -14850,7 +14865,7 @@
 static void
 voidImplicitReceiverCacheAt(sqInt mcpc)
 {
-    usqInt cacheAddress;
+    sqInt cacheAddress;
 
 	assert(NumOopsPerIRC == 2);
 	cacheAddress = (((usqInt)mcpc)) + (jumpShortByteSize(backEnd));
@@ -17065,9 +17080,13 @@
 }
 
 
-/*	249		11111001	i i i i i i i i	jjjjjjjj		Call Primitive #iiiiiiii +
+/*	V3PlusClosures:	139 10001011	iiiiiiii jjjjjjjj Call Primitive #iiiiiiii +
 	(jjjjjjjj * 256)
- */
+	NewsqueakV4:		249 11111001	iiiiiiii jjjjjjjj Call Primitive #iiiiiiii +
+	(jjjjjjjj * 256)
+	SistaV1:			248 11111000 iiiiiiii mjjjjjjj Call Primitive #iiiiiiii + (
+	jjjjjjj * 256)
+	m=1 means inlined primitive, no hard return after execution. */
 
 static sqInt
 callPrimitiveBytecode(void)
@@ -18417,8 +18436,8 @@
     sqInt selector;
 
 	index = byte0 - ((bytecodeSetOffset == 256
-		? 80 + 256
-		: 176));
+		? AltFirstSpecialSelector + 256
+		: FirstSpecialSelector));
 	selector = specialSelector(index);
 	numArgs = specialSelectorNumArgs(index);
 	return genSendnumArgs(selector, numArgs);
@@ -19209,7 +19228,7 @@
 	if (!needsFrame) {
 		return 0;
 	}
-	methodHeader = headerOf(methodObj);
+	methodHeader = methodHeaderOf(methodObj);
 	
 	/* begin PushR: */
 	genoperand(PushR, FPReg);
@@ -21503,8 +21522,8 @@
 		genoperandoperand(MoveCqR, argInt, Arg0Reg);
 	}
 	genMarshalledSendnumArgs(specialSelector(byte0 - ((bytecodeSetOffset == 256
-		? 80 + 256
-		: 176))), 1);
+		? AltFirstSpecialSelector + 256
+		: FirstSpecialSelector))), 1);
 	jmpTarget(jumpContinue, gLabel());
 	return 0;
 }
@@ -21660,8 +21679,8 @@
 		genoperandoperand(MoveCqR, argInt, Arg0Reg);
 	}
 	return genMarshalledSendnumArgs(specialSelector(byte0 - ((bytecodeSetOffset == 256
-		? 80 + 256
-		: 176))), 1);
+		? AltFirstSpecialSelector + 256
+		: FirstSpecialSelector))), 1);
 }
 
 static sqInt

Modified: branches/Cog/nscogsrc/vm/cogit.h
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.h	2014-08-14 19:43:38 UTC (rev 3063)
+++ branches/Cog/nscogsrc/vm/cogit.h	2014-08-26 08:52:44 UTC (rev 3064)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648
+	CCodeGenerator VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
  */
 
 
@@ -134,6 +134,7 @@
 #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline
 #define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline)
 #define ceReturnToInterpreterPC() ((usqInt)ceReturnToInterpreterTrampoline)
+#define compileSendTrace() (traceFlags & 2)
 #define dynSuperEntryOffset() cmDynSuperEntryOffset
 #define entryOffset() cmEntryOffset
 #define getCFramePointer() CFramePointer

Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c	2014-08-14 19:43:38 UTC (rev 3063)
+++ branches/Cog/nscogsrc/vm/cointerp.c	2014-08-26 08:52:44 UTC (rev 3064)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648
+	CCodeGeneratorGlobalStructure VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
    from
-	CoInterpreter VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648
+	CoInterpreter VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970
  */
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.848 uuid: 2aa6755a-a96a-4834-bc08-5c0a831c4648 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.865 uuid: 4efffc12-280e-4060-b741-9066fb3fc970 " __DATE__ ;
 char *__interpBuildInfo = __buildInfo;
 
 
@@ -458,7 +458,6 @@
 sqInt getCheckAllocFiller(void);
 sqInt getCurrentBytecode(void);
 static sqInt handleMNUInMachineCodeToclassForMessage(sqInt selectorIndex, sqInt rcvr, sqInt classForMessage) NoDbgRegParms;
-sqInt headerOf(sqInt methodPointer);
 static sqInt iframeIsBlockActivation(char *theFP) NoDbgRegParms;
 static sqInt iframeReceiver(char *theFP) NoDbgRegParms;
 static sqInt iframeSavedIP(char *theFP) NoDbgRegParms;
@@ -792,9 +791,11 @@
 static sqInt copyObjtoSegmentaddrstopAtsaveOopAtheaderAt(sqInt oop, sqInt segmentWordArray, sqInt lastSeg, sqInt stopAddr, sqInt oopPtr, sqInt hdrPtr) NoDbgRegParms;
 usqInt freeStartAddress(void);
 sqInt isReallyYoungObject(sqInt obj);
+sqInt methodHeaderOf(sqInt methodObj);
 sqInt noShiftCompactClassIndexOf(sqInt oop);
 sqInt nullHeaderForMachineCodeMethod(void);
 usqInt scavengeThresholdAddress(void);
+sqInt smallIntegerTag(void);
 sqInt withoutForwardingOnandsendToCogit(sqInt obj1, sqInt obj2, sqInt (*selector)(sqInt,sqInt));
 sqInt withoutForwardingOnandwithsendToCogit(sqInt obj1, sqInt obj2, sqInt aBool, sqInt (*selector)(sqInt,sqInt,sqInt));
 usqInt youngStartAddress(void);
@@ -830,11 +831,12 @@
 static void initializeObjectMemory(sqInt bytesToShift) NoDbgRegParms;
 static sqInt isContextHeader(sqInt aHeader) NoDbgRegParms;
 sqInt isYoungObject(sqInt obj);
-sqInt lastPointerOf(sqInt oop);
+sqInt lastPointerOf(sqInt objOop);
 sqInt leakCheckBecome(void);
 sqInt leakCheckFullGC(void);
 sqInt leakCheckIncrementalGC(void);
 sqInt leakCheckNewSpaceGC(void);
+sqInt literalCountOfMethodHeader(sqInt header);
 static sqInt loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray) NoDbgRegParms;
 void longPrintReferencesTo(sqInt anOop);
 static void mapPointersInObjectsFromto(sqInt memStart, sqInt memEnd) NoDbgRegParms;
@@ -850,7 +852,7 @@
 void printWronglySizedContexts(sqInt printContexts);
 static void restoreHeadersFromtofromandtofrom(sqInt firstIn, sqInt lastIn, sqInt hdrBaseIn, sqInt firstOut, sqInt lastOut, sqInt hdrBaseOut) NoDbgRegParms;
 static void runLeakCheckerForFullGC(sqInt fullGCFlag) NoDbgRegParms;
-static sqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
+static usqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
 static sqInt safePrintStringOf(sqInt oop) NoDbgRegParms;
 static sqInt shortentoIndexableSize(sqInt obj, sqInt nSlots) NoDbgRegParms;
 static sqInt sizeBitsOfSafe(sqInt oop) NoDbgRegParms;
@@ -926,6 +928,7 @@
 sqInt formatOfClass(sqInt classPointer);
 static sqInt fwdBlockValid(sqInt addr) NoDbgRegParms;
 static sqInt goodContextSize(sqInt oop) NoDbgRegParms;
+static sqInt hasForwardingBlock(sqInt objOop) NoDbgRegParms;
 static sqInt headerWhileForwardingOf(sqInt oop) NoDbgRegParms;
 sqInt indexablePointersFormat(void);
 sqInt instanceSizeOf(sqInt classObj);
@@ -968,11 +971,13 @@
 static sqInt lengthOfMaybeImmediate(sqInt oop) NoDbgRegParms;
 sqInt lengthOf(sqInt oop);
 static sqInt lengthOfbaseHeaderformat(sqInt oop, sqInt hdr, sqInt fmt) NoDbgRegParms;
+sqInt literalCountOf(sqInt methodPointer);
 void longPrintInstancesOf(sqInt aClassOop);
 static sqInt lowestFreeAfter(sqInt chunk) NoDbgRegParms;
 sqInt markAndTrace(sqInt oop);
 sqInt maybeSplObj(sqInt index);
 sqInt nilObject(void);
+static sqInt noFixupFollowFieldofObject(sqInt fieldIndex, sqInt anObject) NoDbgRegParms;
 sqInt noShiftCompactClassIndexOfHeader(sqInt header);
 sqInt numBytesOf(sqInt objOop);
 sqInt numSlotsOf(sqInt obj);
@@ -1104,7 +1109,7 @@
 static usqInt iframeMethod(char *theFP) NoDbgRegParms;
 static sqInt imageFormatVersion(void);
 sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass);
-sqInt initialPCForHeadermethod(sqInt methodHeader, sqInt theMethod);
+static sqInt initialPCForHeadermethod(sqInt methodHeader, sqInt theMethod) NoDbgRegParms;
 sqInt integerArg(sqInt index);
 void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean);
 static sqInt isBaseFrame(char *theFP) NoDbgRegParms;
@@ -1124,8 +1129,6 @@
 sqInt isKindOf(sqInt oop, char *className);
 sqInt isMemberOf(sqInt oop, char *className);
 static sqInt lengthOfNameOfClass(sqInt classOop) NoDbgRegParms;
-sqInt literalCountOfHeader(sqInt headerPointer);
-sqInt literalCountOf(sqInt methodPointer);
 sqInt literalofMethod(sqInt offset, sqInt methodPointer);
 sqInt loadBitBltFrom(sqInt bb);
 void loadInitialContext(void);
@@ -1148,6 +1151,7 @@
 sqInt methodClassAssociationOf(sqInt methodPointer);
 sqInt methodClassOf(sqInt methodPointer);
 static sqInt methodHeaderHasPrimitive(sqInt methodHeader) NoDbgRegParms;
+static sqInt methodHeaderIndicatesLargeFrame(sqInt methodHeader) NoDbgRegParms;
 sqInt methodPrimitiveIndex(void);
 sqInt methodReturnValue(sqInt oop);
 sqInt methodUsesAlternateBytecodeSet(sqInt aMethodObj);
@@ -1220,6 +1224,8 @@
 static sqInt removeFirstLinkOfList(sqInt aList) NoDbgRegParms;
 EXPORT(sqInt) returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext);
 static sqInt reverseDisplayFromto(sqInt startIndex, sqInt endIndex) NoDbgRegParms;
+static sqInt safeMethodClassOf(sqInt methodPointer) NoDbgRegParms;
+static sqInt saneMethodClassAssociationInnumLiterals(sqInt methodObj, sqInt numLiterals) NoDbgRegParms;
 void setBreakSelector(char *aString);
 void setFullScreenFlag(sqInt value);
 EXPORT(void (*setInterruptCheckChain(void (*aFunction)(void)))()) ;
@@ -1383,6 +1389,7 @@
 _iss usqInt compEnd;
 _iss sqInt externalPrimitiveTableFirstFreeIndex;
 _iss sqInt flagInterpretedMethods;
+_iss sqInt thisClassIndex;
 _iss sqInt edenBytes;
 _iss usqInt fwdTableLast;
 _iss usqLong gcStartUsecs;
@@ -1394,7 +1401,6 @@
 _iss usqLong statIOProcessEvents;
 _iss sqInt statMkFwdCount;
 _iss sqInt tenuringThreshold;
-_iss sqInt thisClassIndex;
 _iss sqInt forceTenureFlag;
 _iss sqInt longRunningPrimitiveCheckSequenceNumber;
 _iss sqInt methodDictLinearSearchLimit;
@@ -1492,8 +1498,8 @@
 sqInt desiredNumStackPages;
 sqInt extraVMMemory;
 sqInt desiredCogCodeSize;
+sqInt breakSelectorLength = -1;
 usqInt heapBase;
-sqInt breakSelectorLength = -1;
 void * showSurfaceFn;
 char * breakSelector;
 sqInt deferDisplayUpdates;
@@ -2082,7 +2088,7 @@
 	/* 574 */ (void (*)(void))0,
 	/* 575 */ (void (*)(void))0,
  0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.848";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.865";
 sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
 volatile int sendTrace;
 
@@ -2104,6 +2110,7 @@
 #define getCodeCompactionMSecs() integerObjectOf((GIV(statCodeCompactionUsecs) + 500) / 1000)
 #define getCogCodeSize() integerObjectOf(GIV(cogCodeSize))
 #define getDesiredCogCodeSize() integerObjectOf(desiredCogCodeSize)
+#define heapBase() heapBase
 #define initialEnterSmalltalkExecutive() enterSmalltalkExecutiveImplementation()
 #define primTraceLogIndex(aValue) (GIV(primTraceLogIndex) = (aValue))
 #define setDesiredCogCodeSize(dccs) (desiredCogCodeSize = (dccs))
@@ -4415,7 +4422,7 @@
 				ctxtOrNilOrZero = findMethodWithPrimitiveFromFPUpToContext(198, GIV(framePointer), home);
 				if (ctxtOrNilOrZero == 0) {
 					theMethod = longAt((home + BaseHeaderSize) + (MethodIndex << ShiftForWord));
-					if ((primitiveIndexOfMethodheader(theMethod, headerOf(theMethod))) == 198) {
+					if ((primitiveIndexOfMethodheader(theMethod, methodHeaderOf(theMethod))) == 198) {
 						unwindContextOrNilOrZero = home;
 						goto l299;
 					}
@@ -4664,7 +4671,7 @@
 				assert((((usqInt)(longAt(localFP + FoxMethod)))) >= (startOfMemory()));
 				GIV(method) = longAt(localFP + FoxMethod);
 				assert(isOopCompiledMethod(GIV(method)));
-				GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(headerOf(GIV(method)))
+				GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(methodHeaderOf(GIV(method)))
 					? 256
 					: 0);
 
@@ -4876,7 +4883,6 @@
 							GIV(framePointer) = localFP;
 							
 							ceEnterCogCodePopReceiverReg();
-							null;
 							goto l303;
 						}
 						localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -4886,7 +4892,7 @@
 					assert((((usqInt)(longAt(localFP + FoxMethod)))) >= (startOfMemory()));
 					GIV(method) = longAt(localFP + FoxMethod);
 					assert(isOopCompiledMethod(GIV(method)));
-					GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(headerOf(GIV(method)))
+					GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(methodHeaderOf(GIV(method)))
 						? 256
 						: 0);
 
@@ -4894,7 +4900,7 @@
 					/* begin fetchNextBytecode */
 					currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
 
-					null;
+					/* return self */
 				l303:	/* end baseFrameReturn */;
 					goto l302;
 				}
@@ -4933,7 +4939,7 @@
 				assert((((usqInt)(longAt(localFP + FoxMethod)))) >= (startOfMemory()));
 				GIV(method) = longAt(localFP + FoxMethod);
 				assert(isOopCompiledMethod(GIV(method)));
-				GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(headerOf(GIV(method)))
+				GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(methodHeaderOf(GIV(method)))
 					? 256
 					: 0);
 
@@ -5259,7 +5265,6 @@
 				l309:	/* end inlineLookupInMethodCacheSel:classTag: */;
 					if (ok) {
 						/* begin ifAppropriateCompileToNativeCode:selector: */
-						VM_LABEL(0ifAppropriateCompileToNativeCodeselector);
 						methodHeader2 = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
 						if (isCogMethodReference(methodHeader2)) {
 
@@ -5271,9 +5276,7 @@
 							}
 						}
 						else {
-							if ((((((sqInt) methodHeader2)) < 0
-	? (((usqInt) methodHeader2) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader2) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
+							if ((literalCountOfMethodHeader(methodHeader2)) <= maxLiteralCountForCompile) {
 								cogselector(GIV(newMethod), GIV(messageSelector));
 							}
 							else {
@@ -5434,7 +5437,7 @@
 						/* begin setMethod:methodHeader: */
 						GIV(method) = GIV(newMethod);
 						assert(isOopCompiledMethod(GIV(method)));
-						assert((headerOf(GIV(method))) == methodHeader);
+						assert((methodHeaderOf(GIV(method))) == methodHeader);
 						GIV(bytecodeSetSelector) = ((((sqInt) methodHeader)) < 0
 							? 256
 							: 0);
@@ -5454,19 +5457,17 @@
 							/* begin internalPush: */
 							longAtPointerput((localSP -= BytesPerOop), GIV(nilObj));
 						}
-						localIP = pointerForOop(((GIV(newMethod) + ((LiteralStart + (((((sqInt) methodHeader)) < 0
-	? (((usqInt) methodHeader) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader) >> 10) & 0xFF))) * BytesPerOop)) + (BaseHeaderSize)) - 1);
+						localIP = pointerForOop((initialPCForHeadermethod(methodHeader, GIV(newMethod))) - 1);
 						if (((((sqInt) methodHeader)) < 0
-														? methodHeader & (65536 << SmallIntegerShift)
-														: (methodHeader & 536871934) != 0)) {
+							? methodHeader & (65536 << SmallIntegerShift)
+							: (methodHeader & 536871934) != 0)) {
 
 							/* Skip the CallPrimitive bytecode, if it's there, and store the error code if the method starts
 							   with a long store temp.  Strictly no need to skip the store because it's effectively a noop. */
 
 							localIP += ((((sqInt) methodHeader)) < 0
-																? 3
-																: 0);
+								? 3
+								: 0);
 							if (GIV(primFailCode) != 0) {
 								if ((byteAt(localIP + 1)) == (((((sqInt) methodHeader)) < 0
 		? AltLongStoreBytecode
@@ -6377,7 +6378,7 @@
 	? (FoxIFrameFlags + BytesPerWord) - 1
 	: FoxIFrameFlags)));
 				if (((backwardJumpCountByte -= 2)) == 1) {
-					if (methodWithHeaderShouldBeCogged(headerOf(GIV(method)))) {
+					if (methodWithHeaderShouldBeCogged(methodHeaderOf(GIV(method)))) {
 						/* begin externalizeIPandSP */
 						assert((((usqInt)localIP)) != (ceReturnToInterpreterPC()));
 						GIV(instructionPointer) = oopForPointer(localIP);
@@ -8452,7 +8453,7 @@
 							}
 							else {
 								if ((fmt2 < 12)
-								 || (((index >> 1)) >= ((((literalCountOfHeader(headerOf(rcvr))) + LiteralStart) * BytesPerOop) + 1))) {
+								 || (((index >> 1)) >= ((((literalCountOf(rcvr)) + LiteralStart) * BytesPerOop) + 1))) {
 									result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
 									goto l117;
 								}
@@ -8696,7 +8697,7 @@
 							}
 							else {
 								if ((fmt2 >= 12)
-								 && (((index >> 1)) < ((((literalCountOfHeader(headerOf(rcvr))) + LiteralStart) * BytesPerOop) + 1))) {
+								 && (((index >> 1)) < ((((literalCountOf(rcvr)) + LiteralStart) * BytesPerOop) + 1))) {
 									GIV(primFailCode) = PrimErrBadIndex;
 									goto l127;
 								}
@@ -11346,7 +11347,7 @@
 							}
 							else {
 								if ((fmt2 < 12)
-								 || (((index >> 1)) >= ((((literalCountOfHeader(headerOf(rcvr))) + LiteralStart) * BytesPerOop) + 1))) {
+								 || (((index >> 1)) >= ((((literalCountOf(rcvr)) + LiteralStart) * BytesPerOop) + 1))) {
 									result = (((byteAt((rcvr + BaseHeaderSize) + (((index >> 1)) - 1))) << 1) | 1);
 									goto l253;
 								}
@@ -11590,7 +11591,7 @@
 							}
 							else {
 								if ((fmt2 >= 12)
-								 && (((index >> 1)) < ((((literalCountOfHeader(headerOf(rcvr))) + LiteralStart) * BytesPerOop) + 1))) {
+								 && (((index >> 1)) < ((((literalCountOf(rcvr)) + LiteralStart) * BytesPerOop) + 1))) {
 									GIV(primFailCode) = PrimErrBadIndex;
 									goto l263;
 								}
@@ -12924,7 +12925,7 @@
 	? (FoxIFrameFlags + BytesPerWord) - 1
 	: FoxIFrameFlags)));
 				if (((backwardJumpCountByte -= 2)) == 1) {
-					if (methodWithHeaderShouldBeCogged(headerOf(GIV(method)))) {
+					if (methodWithHeaderShouldBeCogged(methodHeaderOf(GIV(method)))) {
 						/* begin externalizeIPandSP */
 						assert((((usqInt)localIP)) != (ceReturnToInterpreterPC()));
 						GIV(instructionPointer) = oopForPointer(localIP);
@@ -13222,16 +13223,14 @@
 		GIV(stackPointer) = sp2;
 	}
 	if (((((sqInt) methodHeader)) < 0
-				? methodHeader & (65536 << SmallIntegerShift)
-				: (methodHeader & 536871934) != 0)) {
+		? methodHeader & (65536 << SmallIntegerShift)
+		: (methodHeader & 536871934) != 0)) {
 
 		/* Store the error code if the method starts with a long store temp.  No instructionPointer skip because we're heading for machine code. */
 
-		initialPC = ((GIV(newMethod) + ((LiteralStart + (((((sqInt) methodHeader)) < 0
-	? (((usqInt) methodHeader) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader) >> 10) & 0xFF))) * BytesPerOop)) + (BaseHeaderSize)) + (((((sqInt) methodHeader)) < 0
-		? 3
-		: 0));
+		initialPC = (initialPCForHeadermethod(methodHeader, GIV(newMethod))) + (((((sqInt) methodHeader)) < 0
+	? 3
+	: 0));
 		if (GIV(primFailCode) != 0) {
 			if ((byteAt(initialPC)) == (((((sqInt) methodHeader)) < 0
 		? AltLongStoreBytecode
@@ -13272,10 +13271,10 @@
 activateNewMethod(void)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt errorCode;
+    sqInt header;
     sqInt i;
     sqInt inInterpreter;
     sqInt methodHeader;
-    sqInt methodHeader1;
     sqInt numArgs;
     sqInt numTemps;
     sqInt object;
@@ -13291,12 +13290,14 @@
     sqInt switched;
     sqInt table;
 
-	/* begin headerOf: */
-	methodHeader1 = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
-	methodHeader = (isCogMethodReference(methodHeader1)
-		? (assert((((((CogMethod *) methodHeader1))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
-			((((CogMethod *) methodHeader1))->methodHeader))
-		: methodHeader1);
+	/* begin methodHeaderOf: */
+	assert(isCompiledMethod(GIV(newMethod)));
+	header = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+	methodHeader = ((header & 1)
+		? header
+		: (assert((((usqInt)header)) < (heapBase())),
+			assert((((((CogMethod *) header))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
+			((((CogMethod *) header))->methodHeader)));
 	numTemps = (((usqInt) methodHeader) >> 19) & 0x3F;
 	numArgs = (((usqInt) methodHeader) >> 25) & 15;
 
@@ -13322,7 +13323,7 @@
 	/* begin setMethod:methodHeader: */
 	GIV(method) = GIV(newMethod);
 	assert(isOopCompiledMethod(GIV(method)));
-	assert((headerOf(GIV(method))) == methodHeader);
+	assert((methodHeaderOf(GIV(method))) == methodHeader);
 	GIV(bytecodeSetSelector) = ((((sqInt) methodHeader)) < 0
 		? 256
 		: 0);
@@ -13347,19 +13348,17 @@
 		longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(nilObj));
 		GIV(stackPointer) = sp;
 	}
-	GIV(instructionPointer) = ((GIV(newMethod) + ((LiteralStart + (((((sqInt) methodHeader)) < 0
-	? (((usqInt) methodHeader) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader) >> 10) & 0xFF))) * BytesPerOop)) + (BaseHeaderSize)) - 1;
+	GIV(instructionPointer) = (initialPCForHeadermethod(methodHeader, GIV(newMethod))) - 1;
 	if (((((sqInt) methodHeader)) < 0
-				? methodHeader & (65536 << SmallIntegerShift)
-				: (methodHeader & 536871934) != 0)) {
+		? methodHeader & (65536 << SmallIntegerShift)
+		: (methodHeader & 536871934) != 0)) {
 
 		/* Skip the CallPrimitive bytecode, if it's there, and store the error code if the method starts
 		   with a long store temp.  Strictly no need to skip the store because it's effectively a noop. */
 
 		GIV(instructionPointer) += ((((sqInt) methodHeader)) < 0
-						? 3
-						: 0);
+			? 3
+			: 0);
 		if (GIV(primFailCode) != 0) {
 			if ((byteAt(GIV(instructionPointer) + 1)) == (((((sqInt) methodHeader)) < 0
 		? AltLongStoreBytecode
@@ -13405,8 +13404,8 @@
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt firstBytecode;
     sqInt hash;
+    sqInt header;
     sqInt methodHeader;
-    sqInt methodHeader1;
     sqInt p;
     sqInt primBits;
     sqInt primitiveIndex;
@@ -13424,19 +13423,21 @@
 	if (((GIV(newMethod) & 1) == 0)
 	 && (((((usqInt) (longAt(GIV(newMethod)))) >> (instFormatFieldLSB())) & 15) >= 12)) {
 		/* begin primitiveIndexOfMethod:header: */
-		/* begin headerOf: */
-		methodHeader1 = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
-		methodHeader = (isCogMethodReference(methodHeader1)
-			? (assert((((((CogMethod *) methodHeader1))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
-				((((CogMethod *) methodHeader1))->methodHeader))
-			: methodHeader1);
+		/* begin methodHeaderOf: */
+		assert(isCompiledMethod(GIV(newMethod)));
+		header = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+		methodHeader = ((header & 1)
+			? header
+			: (assert((((usqInt)header)) < (heapBase())),
+				assert((((((CogMethod *) header))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
+				((((CogMethod *) header))->methodHeader)));
 		primitiveIndex = ((((sqInt) methodHeader)) < 0
-						? (methodHeader & (65536 << SmallIntegerShift)
-								? ((firstBytecode = (GIV(newMethod) + ((LiteralStart + ((((usqInt) methodHeader) >> 1) & 0xFFFF)) * BytesPerWord)) + BaseHeaderSize),
-									(byteAt(firstBytecode + 1)) + ((byteAt(firstBytecode + 2)) << 8))
-								: 0)
-						: ((primBits = ((usqInt) methodHeader) >> 1),
-							(primBits & 0x1FF) + ((((usqInt) primBits) >> 19) & 512)));
+			? (methodHeader & (65536 << SmallIntegerShift)
+					? ((firstBytecode = (GIV(newMethod) + ((LiteralStart + ((((usqInt) methodHeader) >> 1) & 0xFFFF)) * BytesPerOop)) + (BaseHeaderSize)),
+						(byteAt(firstBytecode + 1)) + ((byteAt(firstBytecode + 2)) << 8))
+					: 0)
+			: ((primBits = (methodHeader >> 1)),
+				(primBits & 0x1FF) + ((((usqInt) primBits) >> 19) & 512)));
 		/* begin functionPointerFor:inClass: */
 		primitiveFunctionPointer = ((void (*)(void)) ((primitiveIndex > MaxPrimitiveIndex
 	? 0
@@ -13731,9 +13732,7 @@
 		else {
 			/* begin startPCOfMethodHeader: */
 			aCompiledMethodHeader = (cogMethod->methodHeader);
-			startBcpc = ((((((sqInt) aCompiledMethodHeader)) < 0
-	? (((usqInt) aCompiledMethodHeader) >> 1) & 0xFFFF
-	: (((usqInt) aCompiledMethodHeader) >> 10) & 0xFF)) + LiteralStart) * BytesPerOop;
+			startBcpc = ((literalCountOfMethodHeader(aCompiledMethodHeader)) + LiteralStart) * BytesPerOop;
 			cogMethod2 = ((CogBlockMethod *) cogMethod);
 			methodField = ((sqInt)cogMethod);
 		}
@@ -13778,7 +13777,7 @@
     volatile void *currentCFramePointer;
     volatile void *currentCStackPointer;
     volatile sqInt header;
-    volatile sqInt methodHeader;
+    volatile sqInt header1;
     volatile jmp_buf savedReenterInterpreter;
     volatile sqInt wasInMachineCode;
     volatile sqInt xArray;
@@ -13827,12 +13826,14 @@
 
 	GIV(newMethod) = GIV(suspendedMethods)[GIV(jmpDepth)];
 	/* begin argumentCountOfMethodHeader: */
-	/* begin headerOf: */
-	methodHeader = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
-	header = (isCogMethodReference(methodHeader)
-		? (assert((((((CogMethod *) methodHeader))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
-			((((CogMethod *) methodHeader))->methodHeader))
-		: methodHeader);
+	/* begin methodHeaderOf: */
+	assert(isCompiledMethod(GIV(newMethod)));
+	header1 = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+	header = ((header1 & 1)
+		? header1
+		: (assert((((usqInt)header1)) < (heapBase())),
+			assert((((((CogMethod *) header1))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
+			((((CogMethod *) header1))->methodHeader)));
 	GIV(argumentCount) = (((usqInt) header) >> 25) & 15;
 	assert(wasInMachineCode == (isMachineCodeFrame(GIV(framePointer))));
 	if (calledFromMachineCode) {
@@ -14110,7 +14111,7 @@
 	assert((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) >= (startOfMemory()));
 	GIV(method) = longAt(GIV(framePointer) + FoxMethod);
 	assert(isOopCompiledMethod(GIV(method)));
-	GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(headerOf(GIV(method)))
+	GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(methodHeaderOf(GIV(method)))
 		? 256
 		: 0);
 
@@ -14298,9 +14299,7 @@
 			}
 		}
 		else {
-			if ((((((sqInt) methodHeader)) < 0
-	? (((usqInt) methodHeader) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
+			if ((literalCountOfMethodHeader(methodHeader)) <= maxLiteralCountForCompile) {
 				cogselector(GIV(newMethod), selector);
 			}
 			else {
@@ -14367,8 +14366,8 @@
 ceInterpretMethodFromPICreceiver(sqInt aMethodObj, sqInt rcvr)
 {   DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt firstBytecode;
+    sqInt header;
     sqInt methodHeader;
-    sqInt methodHeader1;
     CogMethod *pic;
     sqInt primBits;
     sqInt primitiveIndex;
@@ -14393,19 +14392,21 @@
 	GIV(messageSelector) = (pic->selector);
 	GIV(newMethod) = aMethodObj;
 	/* begin primitiveIndexOfMethod:header: */
-	/* begin headerOf: */
-	methodHeader1 = longAt((aMethodObj + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
-	methodHeader = (isCogMethodReference(methodHeader1)
-		? (assert((((((CogMethod *) methodHeader1))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
-			((((CogMethod *) methodHeader1))->methodHeader))
-		: methodHeader1);
+	/* begin methodHeaderOf: */
+	assert(isCompiledMethod(aMethodObj));
+	header = longAt((aMethodObj + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+	methodHeader = ((header & 1)
+		? header
+		: (assert((((usqInt)header)) < (heapBase())),
+			assert((((((CogMethod *) header))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
+			((((CogMethod *) header))->methodHeader)));
 	primitiveIndex = ((((sqInt) methodHeader)) < 0
-				? (methodHeader & (65536 << SmallIntegerShift)
-						? ((firstBytecode = (aMethodObj + ((LiteralStart + ((((usqInt) methodHeader) >> 1) & 0xFFFF)) * BytesPerWord)) + BaseHeaderSize),
-							(byteAt(firstBytecode + 1)) + ((byteAt(firstBytecode + 2)) << 8))
-						: 0)
-				: ((primBits = ((usqInt) methodHeader) >> 1),
-					(primBits & 0x1FF) + ((((usqInt) primBits) >> 19) & 512)));
+		? (methodHeader & (65536 << SmallIntegerShift)
+				? ((firstBytecode = (aMethodObj + ((LiteralStart + ((((usqInt) methodHeader) >> 1) & 0xFFFF)) * BytesPerOop)) + (BaseHeaderSize)),
+					(byteAt(firstBytecode + 1)) + ((byteAt(firstBytecode + 2)) << 8))
+				: 0)
+		: ((primBits = (methodHeader >> 1)),
+			(primBits & 0x1FF) + ((((usqInt) primBits) >> 19) & 512)));
 	/* begin functionPointerFor:inClass: */
 	primitiveFunctionPointer = ((void (*)(void)) ((primitiveIndex > MaxPrimitiveIndex
 	? 0
@@ -14425,8 +14426,8 @@
     sqInt ccIndex1;
     CogMethod *cPIC;
     sqInt firstBytecode;
+    sqInt header;
     sqInt methodHeader;
-    sqInt methodHeader1;
     sqInt primBits;
     sqInt primitiveIndex;
     char *sp;
@@ -14462,19 +14463,21 @@
 		}
 		GIV(newMethod) = aMethodObj;
 		/* begin primitiveIndexOfMethod:header: */
-		/* begin headerOf: */
-		methodHeader1 = longAt((aMethodObj + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
-		methodHeader = (isCogMethodReference(methodHeader1)
-			? (assert((((((CogMethod *) methodHeader1))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
-				((((CogMethod *) methodHeader1))->methodHeader))
-			: methodHeader1);
+		/* begin methodHeaderOf: */
+		assert(isCompiledMethod(aMethodObj));
+		header = longAt((aMethodObj + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
+		methodHeader = ((header & 1)
+			? header
+			: (assert((((usqInt)header)) < (heapBase())),
+				assert((((((CogMethod *) header))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
+				((((CogMethod *) header))->methodHeader)));
 		primitiveIndex = ((((sqInt) methodHeader)) < 0
-						? (methodHeader & (65536 << SmallIntegerShift)
-								? ((firstBytecode = (aMethodObj + ((LiteralStart + ((((usqInt) methodHeader) >> 1) & 0xFFFF)) * BytesPerWord)) + BaseHeaderSize),
-									(byteAt(firstBytecode + 1)) + ((byteAt(firstBytecode + 2)) << 8))
-								: 0)
-						: ((primBits = ((usqInt) methodHeader) >> 1),
-							(primBits & 0x1FF) + ((((usqInt) primBits) >> 19) & 512)));
+			? (methodHeader & (65536 << SmallIntegerShift)
+					? ((firstBytecode = (aMethodObj + ((LiteralStart + ((((usqInt) methodHeader) >> 1) & 0xFFFF)) * BytesPerOop)) + (BaseHeaderSize)),
+						(byteAt(firstBytecode + 1)) + ((byteAt(firstBytecode + 2)) << 8))
+					: 0)
+			: ((primBits = (methodHeader >> 1)),
+				(primBits & 0x1FF) + ((((usqInt) primBits) >> 19) & 512)));
 		/* begin functionPointerFor:inClass: */
 		primitiveFunctionPointer = ((void (*)(void)) ((primitiveIndex > MaxPrimitiveIndex
 	? 0
@@ -14583,7 +14586,7 @@
 	ctxtOrNilOrZero = findMethodWithPrimitiveFromFPUpToContext(198, GIV(framePointer), home);
 	if (ctxtOrNilOrZero == 0) {
 		theMethod = longAt((home + BaseHeaderSize) + (MethodIndex << ShiftForWord));
-		if ((primitiveIndexOfMethodheader(theMethod, headerOf(theMethod))) == 198) {
+		if ((primitiveIndexOfMethodheader(theMethod, methodHeaderOf(theMethod))) == 198) {
 			unwindContextOrNilOrZero = home;
 			goto l3;
 		}
@@ -14839,7 +14842,7 @@
 	assert((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) >= (startOfMemory()));
 	GIV(method) = longAt(GIV(framePointer) + FoxMethod);
 	assert(isOopCompiledMethod(GIV(method)));
-	GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(headerOf(GIV(method)))
+	GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(methodHeaderOf(GIV(method)))
 		? 256
 		: 0);
 
@@ -14903,9 +14906,7 @@
 			}
 		}
 		else {
-			if ((((((sqInt) methodHeader)) < 0
-	? (((usqInt) methodHeader) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
+			if ((literalCountOfMethodHeader(methodHeader)) <= maxLiteralCountForCompile) {
 				cogselector(GIV(newMethod), selector);
 			}
 			else {
@@ -14983,9 +14984,7 @@
 			}
 		}
 		else {
-			if ((((((sqInt) methodHeader)) < 0
-	? (((usqInt) methodHeader) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
+			if ((literalCountOfMethodHeader(methodHeader)) <= maxLiteralCountForCompile) {
 				cogselector(GIV(newMethod), selector);
 			}
 			else {
@@ -15110,9 +15109,7 @@
 			}
 		}
 		else {
-			if ((((((sqInt) methodHeader)) < 0
-	? (((usqInt) methodHeader) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
+			if ((literalCountOfMethodHeader(methodHeader)) <= maxLiteralCountForCompile) {
 				cogselector(GIV(newMethod), selector);
 			}
 			else {
@@ -15378,7 +15375,7 @@
 		? (longAt(oop - BaseHeaderSize)) & AllButTypeMask
 		: longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)))));
 	if (((((usqInt) (longAt(oop))) >> (instFormatFieldLSB())) & 15) >= 12) {
-		i = ((literalCountOfHeader(headerOf(oop))) + LiteralStart) - 1;
+		i = ((literalCountOfMethodHeader(methodHeaderOf(oop))) + LiteralStart) - 1;
 	}
 	else {
 		if (((oop & 1) == 0)
@@ -15958,7 +15955,7 @@
 	assert((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) >= (startOfMemory()));
 	GIV(method) = longAt(GIV(framePointer) + FoxMethod);
 	assert(isOopCompiledMethod(GIV(method)));
-	GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(headerOf(GIV(method)))
+	GIV(bytecodeSetSelector) = (headerIndicatesAlternateBytecodeSet(methodHeaderOf(GIV(method)))
 		? 256
 		: 0);
 
@@ -16130,9 +16127,7 @@
 	}
 	methodHeader = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
 	if (!(isCogMethodReference(methodHeader))) {
-		if ((((((sqInt) methodHeader)) < 0
-	? (((usqInt) methodHeader) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
+		if ((literalCountOfMethodHeader(methodHeader)) <= maxLiteralCountForCompile) {
 			cogselector(GIV(newMethod), GIV(nilObj));
 			methodHeader = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord));
 		}
@@ -16322,9 +16317,7 @@
 			}
 		}
 		else {
-			if ((((((sqInt) methodHeader)) < 0
-	? (((usqInt) methodHeader) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
+			if ((literalCountOfMethodHeader(methodHeader)) <= maxLiteralCountForCompile) {
 				cogselector(GIV(newMethod), GIV(messageSelector));
 			}
 			else {
@@ -16357,7 +16350,7 @@
 {
     sqInt lit;
 
-	if (!((literalCountOfHeader(headerOf(methodObj))) > 0)) {
+	if (!((literalCountOfMethodHeader(methodHeaderOf(methodObj))) > 0)) {
 		return null;
 	}
 	lit = longAt((methodObj + BaseHeaderSize) + ((0 + LiteralStart) << ShiftForWord));
@@ -16619,7 +16612,7 @@
 	if (functionPointer == primitiveExternalCall) {
 		/* begin functionForPrimitiveExternalCall: */
 		setPostCompileHook(recordCallOffsetInof);
-		if (!((literalCountOfHeader(headerOf(methodObj))) > 0)) {
+		if (!((literalCountOfMethodHeader(methodHeaderOf(methodObj))) > 0)) {
 			return ((void (*)(void)) primitiveExternalCall);
 		}
 
@@ -16706,9 +16699,7 @@
 			}
 		}
 		else {
-			if ((((((sqInt) methodHeader)) < 0
-	? (((usqInt) methodHeader) >> 1) & 0xFFFF
-	: (((usqInt) methodHeader) >> 10) & 0xFF)) <= maxLiteralCountForCompile) {
+			if ((literalCountOfMethodHeader(methodHeader)) <= maxLiteralCountForCompile) {
 				cogselector(GIV(newMethod), GIV(messageSelector));
 			}
 			else {
@@ -16740,19 +16731,7 @@

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list