[Vm-dev] [commit][2796] Cog VM source as per VMMaker.oscog-eem.493.

commits at squeakvm.org commits at squeakvm.org
Sat Nov 2 02:57:02 UTC 2013


Revision: 2796
Author:   eliot
Date:     2013-11-01 19:56:58 -0700 (Fri, 01 Nov 2013)
Log Message:
-----------
Cog VM source as per VMMaker.oscog-eem.493.

Functionality:

Fix stack backtrace printing on Mac & Unix to not segfault when invoked from
error(char *msg) function.

Fix roomToPushNArgs:; the Cog VMs can be more lenient because of the use of a
stack instead of contexts. Fixes some valueWithArguments: failures.

Integrate Nice's improved SmallInteger generated primitives that support
int x float comparison, & hence speed-up int x float comparison enormously.

Integrate VMMaker-dtl.328 (failure of primitiveDisplayString to advance destX).

Integrate 2792, fix memory leaks in SqueakSSL on unix.

Integrate VMMaker-tpr.325 7247: BitBlt Bug in alphaSourceBlendBits8.

Integrate VMMaker-tpr.326, Fix a single-bit constant error in
BitBltSimulation>>copyBits:Fallback: - change 16r3FFF to 16r7FFF to
correct tallyIntoMap behaviour for Scratch using BenBlt on the Pi.

Restrict at-cache to bytecodePrimAt[Put], eliminating it from
primitive[String]At[Put].  Sionara the explicit noAtCache at:[put:] machinery
in CoInterpreter now that the atCache is confined to the interpreter's special
selector at:[put:] bytecodes.  Speeds up Stack VM signfiicantly, e.g. a compile
of Compiler package falls from 1.6s to 1.4s on 2.2GHz Intel Core i7 MacBook Pro.

Internals:
Many cosmetic changes now VM mates to SpurMemoryManager as well as ObjectMemory.

Add Spur-specific interpreter proxy functions for immediate character and
pinning access (not available in ObjectMemory VMs).

Restrict at-cache to bytecodePrimAt[Put], eliminating it from primitive[String]
At[Put].  Undoes need for fix in VMMaker-oscog.44 of 7 January 2011:
	"Fix leaking of objects into the atCache due to ceSend:super:to:numArgs:'s
	 use of executeNewMethod without always setting messageSelector."
This renders messageSelector and lkupClass ephemeral, since they are live only
during message lookup and because createActualMessageTo will not cause a GC
these cannot change during message lookup. Hence eliminate them from
markAndTraceInterpreterOops: & mapVMRegisters.

Do not generate dead code by default.

Fix off-by-one bug in findSelectorOfMethod:.

Replace metaclassSizeBits with metaclassNumSlots.
Fix printActivationNameFor:receiver:isBlock:firstTemporary: for anon methods.

Fix bug in shortPrintFrameAndCallers: (filter-out base frames).

Slang: only output VM_LABELs in interpret. Change mac Stack VM builds to define
VM_LABEL as null in the debug VMs, restoring interpret's debuggability.

Modified Paths:
--------------
    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/sq.h
    branches/Cog/platforms/Cross/vm/sqMemoryAccess.h
    branches/Cog/platforms/Cross/vm/sqVirtualMachine.c
    branches/Cog/platforms/Cross/vm/sqVirtualMachine.h
    branches/Cog/platforms/Mac OS/vm/sqMacMain.c
    branches/Cog/platforms/Mac OS/vm/sqMacMemory.c
    branches/Cog/platforms/unix/plugins/SqueakSSL/sqUnixOpenSSL.c
    branches/Cog/platforms/unix/vm/sqUnixMain.c
    branches/Cog/src/vm/cogit.c
    branches/Cog/src/vm/cogit.h
    branches/Cog/src/vm/cogmethod.h
    branches/Cog/src/vm/cointerp.c
    branches/Cog/src/vm/cointerp.h
    branches/Cog/src/vm/cointerpmt.c
    branches/Cog/src/vm/cointerpmt.h
    branches/Cog/src/vm/gcc3x-cointerp.c
    branches/Cog/src/vm/gcc3x-cointerpmt.c
    branches/Cog/src/vm/interp.h
    branches/Cog/src/vm/vmCallback.h
    branches/Cog/stackbuild/macbuild/CoreVM.xcodeproj/project.pbxproj
    branches/Cog/stacksrc/vm/gcc3x-interp.c
    branches/Cog/stacksrc/vm/interp.c
    branches/Cog/stacksrc/vm/interp.h
    branches/Cog/stacksrc/vm/vmCallback.h

Added Paths:
-----------
    branches/Cog/spurstackbuild/
    branches/Cog/spurstackbuild/cygwinbuild/
    branches/Cog/spurstackbuild/cygwinbuild/Croquet.def.in
    branches/Cog/spurstackbuild/cygwinbuild/Croquet.ico
    branches/Cog/spurstackbuild/cygwinbuild/Croquet.rc
    branches/Cog/spurstackbuild/cygwinbuild/HowToBuild
    branches/Cog/spurstackbuild/cygwinbuild/Makefile
    branches/Cog/spurstackbuild/cygwinbuild/Makefile.plugin
    branches/Cog/spurstackbuild/cygwinbuild/Pharo.def.in
    branches/Cog/spurstackbuild/cygwinbuild/Pharo.ico
    branches/Cog/spurstackbuild/cygwinbuild/Pharo.rc
    branches/Cog/spurstackbuild/cygwinbuild/Squeak.def.in
    branches/Cog/spurstackbuild/cygwinbuild/Squeak.rc
    branches/Cog/spurstackbuild/cygwinbuild/mvm
    branches/Cog/spurstackbuild/cygwinbuild/plugins.ext
    branches/Cog/spurstackbuild/cygwinbuild/plugins.int
    branches/Cog/spurstackbuild/cygwinbuild/squeak.ico
    branches/Cog/spurstackbuild/macbuild/
    branches/Cog/spurstackbuild/macbuild/CoreVM.plist
    branches/Cog/spurstackbuild/macbuild/CoreVM.xcodeproj/
    branches/Cog/spurstackbuild/macbuild/CoreVM.xcodeproj/eliot.mode1v3
    branches/Cog/spurstackbuild/macbuild/CoreVM.xcodeproj/eliot.pbxuser
    branches/Cog/spurstackbuild/macbuild/CoreVM.xcodeproj/johnmci.mode1
    branches/Cog/spurstackbuild/macbuild/CoreVM.xcodeproj/johnmci.pbxuser
    branches/Cog/spurstackbuild/macbuild/CoreVM.xcodeproj/project.pbxproj
    branches/Cog/spurstackbuild/macbuild/CoreVM.xcodeproj/sophie.mode1
    branches/Cog/spurstackbuild/macbuild/CoreVM.xcodeproj/sophie.pbxuser
    branches/Cog/spurstackbuild/macbuild/CoreVM.xcodeproj/temp
    branches/Cog/spurstackbuild/macbuild/CoreVM.xcodeproj/werdna.pbxuser
    branches/Cog/spurstackbuild/macbuild/CroquetPlugin/
    branches/Cog/spurstackbuild/macbuild/CroquetPlugin/CroquetPlugin.xcodeproj/
    branches/Cog/spurstackbuild/macbuild/CroquetPlugin/CroquetPlugin.xcodeproj/project.pbxproj
    branches/Cog/spurstackbuild/macbuild/CroquetPlugin/CroquetPlugin_Prefix.pch
    branches/Cog/spurstackbuild/macbuild/CroquetPlugin/English.lproj/
    branches/Cog/spurstackbuild/macbuild/CroquetPlugin/English.lproj/InfoPlist.strings
    branches/Cog/spurstackbuild/macbuild/CroquetPlugin/Info.plist
    branches/Cog/spurstackbuild/macbuild/FloatArrayPlugin/
    branches/Cog/spurstackbuild/macbuild/FloatArrayPlugin/English.lproj/
    branches/Cog/spurstackbuild/macbuild/FloatArrayPlugin/English.lproj/InfoPlist.strings
    branches/Cog/spurstackbuild/macbuild/FloatArrayPlugin/FloatArrayPlugin.xcodeproj/
    branches/Cog/spurstackbuild/macbuild/FloatArrayPlugin/FloatArrayPlugin.xcodeproj/project.pbxproj
    branches/Cog/spurstackbuild/macbuild/FloatArrayPlugin/FloatArrayPlugin_Prefix.pch
    branches/Cog/spurstackbuild/macbuild/FloatArrayPlugin/Info.plist
    branches/Cog/spurstackbuild/macbuild/FloatMathPlugin/
    branches/Cog/spurstackbuild/macbuild/FloatMathPlugin/English.lproj/
    branches/Cog/spurstackbuild/macbuild/FloatMathPlugin/English.lproj/InfoPlist.strings
    branches/Cog/spurstackbuild/macbuild/FloatMathPlugin/FloatMathPlugin.xcodeproj/
    branches/Cog/spurstackbuild/macbuild/FloatMathPlugin/FloatMathPlugin.xcodeproj/project.pbxproj
    branches/Cog/spurstackbuild/macbuild/FloatMathPlugin/FloatMathPlugin_Prefix.pch
    branches/Cog/spurstackbuild/macbuild/FloatMathPlugin/Info.plist
    branches/Cog/spurstackbuild/macbuild/HowToBuild
    branches/Cog/spurstackbuild/macbuild/Mpeg3Plugin/
    branches/Cog/spurstackbuild/macbuild/Mpeg3Plugin/Mpeg3Plugin-Info.plist
    branches/Cog/spurstackbuild/macbuild/Mpeg3Plugin/Mpeg3Plugin.xcodeproj/
    branches/Cog/spurstackbuild/macbuild/Mpeg3Plugin/Mpeg3Plugin.xcodeproj/project.pbxproj
    branches/Cog/spurstackbuild/macbuild/SqueakFFIPrims/
    branches/Cog/spurstackbuild/macbuild/SqueakFFIPrims/Info.plist
    branches/Cog/spurstackbuild/macbuild/SqueakFFIPrims/SqueakFFI.xcodeproj/
    branches/Cog/spurstackbuild/macbuild/SqueakFFIPrims/SqueakFFI.xcodeproj/project.pbxproj
    branches/Cog/spurstackbuild/macbuild/SqueakFFIPrims/SqueakFFIPrims_Prefix.pch
    branches/Cog/spurstackbuild/macbuild/Template/
    branches/Cog/spurstackbuild/macbuild/Template/HowToMakeANewPlugin.txt
    branches/Cog/spurstackbuild/macbuild/Template/Info.plist
    branches/Cog/spurstackbuild/macbuild/Template/Template.xcodeproj/
    branches/Cog/spurstackbuild/macbuild/Template/Template.xcodeproj/project.pbxproj
    branches/Cog/spurstackbuild/macbuild/Template/Template_Prefix.pch
    branches/Cog/spurstackbuild/macbuild/UnixOSProcessPlugin/
    branches/Cog/spurstackbuild/macbuild/UnixOSProcessPlugin/English.lproj/
    branches/Cog/spurstackbuild/macbuild/UnixOSProcessPlugin/English.lproj/InfoPlist.strings
    branches/Cog/spurstackbuild/macbuild/UnixOSProcessPlugin/Info.plist
    branches/Cog/spurstackbuild/macbuild/UnixOSProcessPlugin/PkgInfo
    branches/Cog/spurstackbuild/macbuild/UnixOSProcessPlugin/UnixOSProcessPlugin.xcodeproj/
    branches/Cog/spurstackbuild/macbuild/UnixOSProcessPlugin/UnixOSProcessPlugin.xcodeproj/eliot.mode1
    branches/Cog/spurstackbuild/macbuild/UnixOSProcessPlugin/UnixOSProcessPlugin.xcodeproj/eliot.pbxuser
    branches/Cog/spurstackbuild/macbuild/UnixOSProcessPlugin/UnixOSProcessPlugin.xcodeproj/project.pbxproj
    branches/Cog/spurstackbuild/macbuild/UnixOSProcessPlugin/makeit
    branches/Cog/spurstackbuild/macbuild/makeall
    branches/Cog/spurstackbuild/macbuild/makeclean
    branches/Cog/spurstackbuild/macbuild/makevm
    branches/Cog/spurstackbuild/macbuild/mkNamedPrims.sh
    branches/Cog/spurstackbuild/macbuild/mvm
    branches/Cog/spurstackbuild/macbuild/plugins.ext
    branches/Cog/spurstackbuild/macbuild/plugins.int
    branches/Cog/spurstackbuild/macbuild/resources/
    branches/Cog/spurstackbuild/macbuild/resources/FloatMathPlugin.bundle/
    branches/Cog/spurstackbuild/macbuild/resources/FloatMathPlugin.bundle/Contents/
    branches/Cog/spurstackbuild/macbuild/resources/FloatMathPlugin.bundle/Contents/Info.plist
    branches/Cog/spurstackbuild/macbuild/resources/FloatMathPlugin.bundle/Contents/MacOS/
    branches/Cog/spurstackbuild/macbuild/resources/FloatMathPlugin.bundle/Contents/MacOS/FloatMathPlugin
    branches/Cog/spurstackbuild/macbuild/resources/FloatMathPlugin.bundle/Contents/PkgInfo
    branches/Cog/spurstackbuild/macbuild/resources/FloatMathPlugin.bundle/Contents/Resources/
    branches/Cog/spurstackbuild/macbuild/resources/FloatMathPlugin.bundle/Contents/Resources/SqueakPlugin.icns
    branches/Cog/spurstackbuild/macbuild/resources/LocalePlugin.bundle/
    branches/Cog/spurstackbuild/macbuild/resources/LocalePlugin.bundle/Contents/
    branches/Cog/spurstackbuild/macbuild/resources/LocalePlugin.bundle/Contents/Info.plist
    branches/Cog/spurstackbuild/macbuild/resources/LocalePlugin.bundle/Contents/MacOS/
    branches/Cog/spurstackbuild/macbuild/resources/LocalePlugin.bundle/Contents/MacOS/LocalePlugin
    branches/Cog/spurstackbuild/macbuild/resources/LocalePlugin.bundle/Contents/PkgInfo
    branches/Cog/spurstackbuild/macbuild/resources/LocalePlugin.bundle/Contents/Resources/
    branches/Cog/spurstackbuild/macbuild/resources/LocalePlugin.bundle/Contents/Resources/SqueakPlugin.icns
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/Croquet.icns
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/GreenCogSqueak.icns
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/Squeak VM.r
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/Squeak.icns
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/SqueakChanges.icns
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/SqueakGeneric.icns
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/SqueakImage.icns
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/SqueakPlugin.icns
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/SqueakProject.icns
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/SqueakScript.icns
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/SqueakSources.icns
    branches/Cog/spurstackbuild/macbuild/resources/ProjectBuilder/Teleplace.icns
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Frameworks/
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Frameworks/SpellCheck.bundle/
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Frameworks/SpellCheck.bundle/Contents/
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Frameworks/SpellCheck.bundle/Contents/Info.plist
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Frameworks/SpellCheck.bundle/Contents/MacOS/
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Frameworks/SpellCheck.bundle/Contents/MacOS/SpellCheck
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Frameworks/SpellCheck.bundle/Contents/Resources/
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Frameworks/SpellCheck.bundle/Contents/Resources/English.lproj/
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Frameworks/SpellCheck.bundle/Contents/Resources/English.lproj/InfoPlist.strings
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Info.plist
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/MacOS/
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/MacOS/SpellingPlugin
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/PkgInfo
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Resources/
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Resources/InfoPlist.strings
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Resources/PkgInfo
    branches/Cog/spurstackbuild/macbuild/resources/SpellingPlugin.bundle/Contents/Resources/SqueakPlugin.icns
    branches/Cog/spurstacksrc/
    branches/Cog/spurstacksrc/examplePlugins.ext
    branches/Cog/spurstacksrc/examplePlugins.int
    branches/Cog/spurstacksrc/vm/
    branches/Cog/spurstacksrc/vm/exampleSqNamedPrims.h
    branches/Cog/spurstacksrc/vm/gcc3x-interp.c
    branches/Cog/spurstacksrc/vm/interp.c
    branches/Cog/spurstacksrc/vm/interp.h
    branches/Cog/spurstacksrc/vm/vmCallback.h

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

Modified: branches/Cog/nscogsrc/vm/cogit.c
===================================================================
--- branches/Cog/nscogsrc/vm/cogit.c	2013-10-31 23:56:21 UTC (rev 2795)
+++ branches/Cog/nscogsrc/vm/cogit.c	2013-11-02 02:56:58 UTC (rev 2796)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.335 uuid: 02e5ae48-52a4-4324-9b6d-887f45be6a12
+	CCodeGenerator VMMaker.oscog-eem.493 uuid: d37e2bf0-ffed-4789-be4e-2aa8a9630e47
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.335 uuid: 02e5ae48-52a4-4324-9b6d-887f45be6a12
+	StackToRegisterMappingCogit VMMaker.oscog-eem.493 uuid: d37e2bf0-ffed-4789-be4e-2aa8a9630e47
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.335 uuid: 02e5ae48-52a4-4324-9b6d-887f45be6a12 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.493 uuid: d37e2bf0-ffed-4789-be4e-2aa8a9630e47 " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -24,10 +24,10 @@
 	char	opcode;
 	char	machineCodeSize;
 	char	maxSize;
-	unsigned long		operands[3];
+	unsigned long		operands [3];
 	unsigned long	address;
 	struct _AbstractInstruction *dependent;
-	unsigned char		machineCode[10];
+	unsigned char		machineCode [10];
  } AbstractInstruction;
 
 #define CogIA32Compiler AbstractInstruction
@@ -49,9 +49,9 @@
 
 
 typedef struct _BytecodeDescriptor {
-	sqInt (*generator)(void);
-	sqInt (*spanFunction)(struct _BytecodeDescriptor *,sqInt,sqInt,sqInt);
-	sqInt (*needsFrameFunction)(sqInt);
+	sqInt (*generator )(void);
+	sqInt (*spanFunction )(struct _BytecodeDescriptor *,sqInt,sqInt,sqInt);
+	sqInt (*needsFrameFunction )(sqInt);
 	signed char	stackDelta;
 	unsigned char	opcode;
 	unsigned char	numBytes;
@@ -76,9 +76,9 @@
 
 
 typedef struct {
-	sqInt (*primitiveGenerator)(void);
+	sqInt (*primitiveGenerator )(void);
 	sqInt	primNumArgs;
-	sqInt (*enabled)(sqInt);
+	sqInt (*enabled )(sqInt);
  } PrimitiveDescriptor;
 
 #define CogPrimitiveDescriptor PrimitiveDescriptor
@@ -112,28 +112,29 @@
 
 
 /*** Constants ***/
-#define AddCqR 83
-#define AddCwR 90
-#define AddRdRd 97
-#define AddRR 76
+#define AddCqR 85
+#define AddCwR 92
+#define AddRdRd 99
+#define AddRR 78
 #define AlignmentNops 2
 #define AllButTypeMask 0xFFFFFFFCUL
 #define AltBlockCreationBytecodeSize 3
 #define AltNSSendIsPCAnnotated 0
-#define AndCqR 85
-#define AndCwR 92
-#define AndRR 78
+#define AndCqR 87
+#define AndCwR 94
+#define AndRR 80
 #define AnnotationShift 5
 #define Arg0Reg -7
 #define Arg1Reg -8
-#define ArithmeticShiftRightCqR 69
-#define ArithmeticShiftRightRR 70
+#define ArithmeticShiftRightCqR 71
+#define ArithmeticShiftRightRR 72
+#define BadRegisterSet 1
 #define BaseHeaderSize 4
 #define BlockCreationBytecodeSize 4
 #define BytesPerOop 4
 #define BytesPerWord 4
 #define Call 9
-#define CDQ 103
+#define CDQ 105
 #define ClassMethodContextCompactIndex 14
 #define ClassReg -5
 #define ClosureFirstCopiedValueIndex 3
@@ -146,20 +147,20 @@
 #define CMMaxUsageCount 7
 #define CMMethod 2
 #define CMOpenPIC 5
-#define CMPXCHGAwR 111
-#define CMPXCHGMwrR 112
-#define CmpCqR 82
-#define CmpCwR 89
-#define CmpRdRd 96
-#define CmpRR 75
+#define CMPXCHGAwR 113
+#define CMPXCHGMwrR 114
+#define CmpCqR 84
+#define CmpCwR 91
+#define CmpRdRd 98
+#define CmpRR 77
 #define CompactClasses 28
 #define ConstZero 1
-#define ConvertRRd 102
-#define CPUID 106
+#define ConvertRRd 104
+#define CPUID 108
 #define Debug DEBUGVM
 #define DisplacementMask 0x1F
 #define DisplacementX2N 32
-#define DivRdRd 100
+#define DivRdRd 102
 #define DPFPReg0 -9
 #define DPFPReg1 -10
 #define DPFPReg2 -11
@@ -188,9 +189,10 @@
 #define FoxMFReceiver -12
 #define FoxThisContext -8
 #define FPReg -1
-#define GCModeBecome 3
+#define GCModeBecome 4
 #define GCModeFull 1
 #define GCModeIncr 2
+#define GCModeScavenge 3
 #define GPRegMax -3
 #define GPRegMin -8
 #define HasBytecodePC 5
@@ -199,8 +201,8 @@
 #define HeaderIndex 0
 #define HeaderTypeShort 3
 #define HeaderTypeSizeAndClass 0
-#define IDIVR 104
-#define IMULRR 105
+#define IDIVR 106
+#define IMULRR 107
 #define InstanceSpecificationIndex 2
 #define InstructionPointerIndex 1
 #define InsufficientCodeSpace -2
@@ -241,14 +243,14 @@
 #define JumpZero 16
 #define Label 1
 #define LastJump 39
-#define LFENCE 107
+#define LFENCE 109
 #define LinkReg -17
-#define LOCK 110
-#define LoadEffectiveAddressMwrR 67
-#define LogicalShiftLeftCqR 73
-#define LogicalShiftLeftRR 74
-#define LogicalShiftRightCqR 71
-#define LogicalShiftRightRR 72
+#define LOCK 112
+#define LoadEffectiveAddressMwrR 69
+#define LogicalShiftLeftCqR 75
+#define LogicalShiftLeftRR 76
+#define LogicalShiftRightCqR 73
+#define LogicalShiftRightRR 74
 #define LongSizeMask 0xFFFFFFFCUL
 #define MapEnd 0
 #define MaxCompiledPrimitiveIndex 222
@@ -265,7 +267,7 @@
 #define MethodCacheSelector 1
 #define MethodIndex 3
 #define MethodTooBig -4
-#define MFENCE 108
+#define MFENCE 110
 #define MFMethodFlagHasContextFlag 1
 #define MFMethodFlagIsBlockFlag 2
 #define ModReg 3
@@ -273,24 +275,24 @@
 #define ModRegRegDisp32 2
 #define ModRegRegDisp8 1
 #define MoveAwR 41
-#define MoveCqR 56
-#define MoveCwR 57
-#define MoveM16rR 48
-#define MoveM64rRd 61
-#define MoveMbrR 52
+#define MoveCqR 58
+#define MoveCwR 59
+#define MoveM16rR 50
+#define MoveM64rRd 63
+#define MoveMbrR 54
 #define MoveMwrR 44
 #define MoveRAw 42
-#define MoveRdM64r 62
-#define MoveRdRd 60
-#define MoveRMbr 53
+#define MoveRdM64r 64
+#define MoveRdRd 62
+#define MoveRMbr 55
 #define MoveRMwr 45
 #define MoveRR 40
 #define MoveRXwrR 47
-#define MoveXbrRR 54
+#define MoveXbrRR 56
 #define MoveXwrRR 46
 #define MULTIPLEBYTECODESETS 1
-#define MulRdRd 99
-#define NegateR 68
+#define MulRdRd 101
+#define NegateR 70
 #define NewspeakVM 1
 #define Nop 8
 #define NotFullyInitialized -1
@@ -298,17 +300,17 @@
 #define NumObjRefsInRuntime 2
 #define NumSendTrampolines 4
 #define NumTrampolines 58
-#define OrCqR 86
-#define OrCwR 93
-#define OrRR 79
-#define PopR 63
-#define PrefetchAw 66
+#define OrCqR 88
+#define OrCwR 95
+#define OrRR 81
+#define PopR 65
+#define PrefetchAw 68
 #define PrimCallCollectsProfileSamples 8
 #define PrimCallMayCallBack 4
 #define PrimCallNeedsNewMethod 1
 #define PrimCallNeedsPrimitiveFunction 2
-#define PushCw 65
-#define PushR 64
+#define PushCw 67
+#define PushR 66
 #define ReceiverIndex 5
 #define ReceiverResultReg -3
 #define RetN 10
@@ -318,28 +320,28 @@
 #define SelectorDoesNotUnderstand 20
 #define SenderIndex 0
 #define SendNumArgsReg -6
-#define SFENCE 109
+#define SFENCE 111
 #define ShiftForWord 2
 #define SIB1 0
 #define SIB4 2
 #define Size4Bit 0
 #define SizeMask 0xFC
 #define SPReg -2
-#define SqrtRd 101
+#define SqrtRd 103
 #define SSBaseOffset 1
 #define SSConstant 2
 #define SSRegister 3
 #define SSSpill 4
-#define SubCqR 84
-#define SubCwR 91
-#define SubRdRd 98
-#define SubRR 77
+#define SubCqR 86
+#define SubCwR 93
+#define SubRdRd 100
+#define SubRR 79
 #define TempReg -4
 #define TypeMask 0x3
 #define ValueIndex 1
-#define XCHGAwR 113
-#define XCHGMwrR 114
-#define XCHGRR 115
+#define XCHGAwR 115
+#define XCHGMwrR 116
+#define XCHGRR 117
 #define XMM0L 0
 #define XMM1L 2
 #define XMM2L 4
@@ -348,8 +350,8 @@
 #define XMM5L 10
 #define XMM6L 12
 #define XMM7L 14
-#define XorCwR 94
-#define XorRR 80
+#define XorCwR 96
+#define XorRR 82
 #define YoungSelectorInPIC -5
 
 
@@ -432,7 +434,7 @@
 static sqInt compileAbstractInstructionsFromthrough(sqInt start, sqInt end);
 static sqInt compileBlockBodies(void);
 static sqInt compileBlockDispatch(void);
-static void compileBlockDispatchFromto(sqInt lowBlockStartIndex, sqInt highBlockStartIndex);
+static sqInt compileBlockDispatchFromto(sqInt lowBlockStartIndex, sqInt highBlockStartIndex);
 static void compileBlockEntry(BlockStart *blockStart);
 static void compileBlockFrameBuild(BlockStart *blockStart);
 static void compileBlockFramelessEntry(BlockStart *blockStart);
@@ -442,7 +444,8 @@
 static sqInt compileCPICCase0Case1MethodtagisMNUCasenumArgs(CogMethod *cPIC, CogMethod *case0CogMethod, sqInt case1Method, sqInt case1Tag, sqInt isMNUCase, sqInt numArgs);
 static sqInt compileEntireMethod(void);
 static void compileEntry(void);
-static void compileFrameBuild(void);
+static sqInt compileFallbackToInterpreterPrimitive(void);
+static sqInt compileFrameBuild(void);
 static void compileGetErrorCode(void);
 static sqInt compileInterpreterPrimitive(void (*primitiveRoutine)(void));
 static sqInt compileMethodBody(void);
@@ -461,7 +464,7 @@
 static sqInt concretizeAddCqR(AbstractInstruction * self_in_concretizeAddCqR);
 static sqInt concretizeAddCwR(AbstractInstruction * self_in_concretizeAddCwR);
 static sqInt concretizeAddRR(AbstractInstruction * self_in_concretizeAddRR);
-static void concretizeAlignmentNops(AbstractInstruction * self_in_concretizeAlignmentNops);
+static AbstractInstruction * concretizeAlignmentNops(AbstractInstruction * self_in_concretizeAlignmentNops);
 static sqInt concretizeAndCqR(AbstractInstruction * self_in_concretizeAndCqR);
 static sqInt concretizeAndCwR(AbstractInstruction * self_in_concretizeAndCwR);
 static sqInt concretizeAndRR(AbstractInstruction * self_in_concretizeAndRR);
@@ -544,7 +547,7 @@
 static BytecodeFixup * ensureFixupAt(sqInt targetIndex);
 static BytecodeFixup * ensureNonMergeFixupAt(sqInt targetIndex);
 static void ensureReceiverResultRegContainsSelf(void);
-static void ensureSpilledAtfrom(CogSimStackEntry * self_in_ensureSpilledAtfrom, sqInt baseOffset, sqInt baseRegister);
+static CogSimStackEntry * ensureSpilledAtfrom(CogSimStackEntry * self_in_ensureSpilledAtfrom, sqInt baseOffset, sqInt baseRegister);
 void enterCogCodePopReceiver(void);
 void enterCogCodePopReceiverAndClassRegs(void);
 void enterCogCodePopReceiverArg0Regs(void);
@@ -554,7 +557,7 @@
 static sqInt extendedPushBytecode(void);
 static sqInt extendedStoreAndPopBytecode(void);
 static sqInt extendedStoreBytecode(void);
-static void fillInBlockHeadersAt(sqInt startAddress);
+static sqInt fillInBlockHeadersAt(sqInt startAddress);
 static CogMethod * fillInCPICHeadersizenumArgsnumCaseshasMNUCaseselector(CogMethod *pic, sqInt size, sqInt numArgs, sqInt numCases, sqInt hasMNUCase, sqInt selector);
 static CogMethod * fillInMethodHeadersizeselector(CogMethod *method, sqInt size, sqInt selector);
 static CogMethod * fillInOPICHeadersizenumArgsselector(CogMethod *pic, sqInt size, sqInt numArgs, sqInt selector);
@@ -576,7 +579,7 @@
 static sqInt genCheckForInterruptsTrampoline(void);
 static sqInt genConvertIntegerToSmallIntegerInScratchReg(sqInt scratchReg);
 static sqInt genConvertSmallIntegerToIntegerInScratchReg(sqInt scratchReg);
-static void genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder);
+static AbstractInstruction * genDivRRQuoRem(AbstractInstruction * self_in_genDivRRQuoRem, sqInt abstractRegDivisor, sqInt abstractRegDividend, sqInt abstractRegQuotient, sqInt abstractRegRemainder);
 static sqInt genDoubleArithmeticpreOpCheck(sqInt arithmeticOperator, AbstractInstruction *(*preOpCheckOrNil)(int rcvrReg, int argReg));
 static sqInt genDoubleComparisoninvert(AbstractInstruction *(*jumpOpcodeGenerator)(void *), sqInt invertComparison);
 static AbstractInstruction * genDoubleFailIfZeroArgRcvrarg(sqInt rcvrReg, sqInt argReg);
@@ -608,17 +611,18 @@
 static sqInt genExtStoreReceiverVariableBytecode(void);
 static sqInt genExtUnconditionalJump(void);
 static void generateCaptureCStackPointers(sqInt captureFramePointer);
-static void generateCheckFeatures(AbstractInstruction * self_in_generateCheckFeatures);
+static AbstractInstruction * generateCheckFeatures(AbstractInstruction * self_in_generateCheckFeatures);
 static void generateClosedPICPrototype(void);
 static CogMethod * generateCogMethod(sqInt selector);
 static void generateEnilopmarts(void);
-static void generateICacheFlush(AbstractInstruction * self_in_generateICacheFlush);
+static AbstractInstruction * generateICacheFlush(AbstractInstruction * self_in_generateICacheFlush);
 static sqInt generateInstructionsAt(sqInt eventualAbsoluteAddress);
-static void generateLowLevelTryLock(AbstractInstruction * self_in_generateLowLevelTryLock, sqInt vmOwnerLockAddress);
-static void generateLowLevelUnlock(AbstractInstruction * self_in_generateLowLevelUnlock, sqInt vmOwnerLockAddress);
+static AbstractInstruction * generateLowLevelTryLock(AbstractInstruction * self_in_generateLowLevelTryLock, sqInt vmOwnerLockAddress);
+static AbstractInstruction * generateLowLevelUnlock(AbstractInstruction * self_in_generateLowLevelUnlock, sqInt vmOwnerLockAddress);
 static sqInt generateMapAtstart(sqInt addressOrNull, sqInt startAddress);
 static void generateMissAbortTrampolines(void);
 static void generateNewspeakRuntime(void);
+static void generateObjectRepresentationTrampolines(void);
 static void generateOpenPICPrototype(void);
 static void generateRunTimeTrampolines(void);
 static void generateSendTrampolines(void);
@@ -631,16 +635,20 @@
 static sqInt genFetchIndexRegisterfrominto(sqInt indexReg, sqInt tableObj, sqInt destReg);
 static sqInt genFramelessStorePopReceiverVariable(sqInt popBoolean, sqInt slotIndex);
 static sqInt genGetClassFormatOfNonIntintoscratchReg(sqInt instReg, sqInt destReg, sqInt scratchReg);
-static sqInt genGetClassObjectOfintoscratchReg(sqInt instReg, sqInt destReg, sqInt scratchReg);
-static sqInt genGetCompactClassIndexNonIntOfinto(sqInt instReg, sqInt destReg);
+static sqInt genGetClassObjectOfintoscratchReginstRegIsReceiver(sqInt instReg, sqInt destReg, sqInt scratchReg, sqInt instRegIsReceiver);
+static AbstractInstruction * genGetClassTagOfintoscratchReg(sqInt instReg, sqInt destReg, sqInt scratchReg);
+static sqInt genGetCompactClassIndexNonImmOfinto(sqInt instReg, sqInt destReg);
 static sqInt genGetDoubleValueOfinto(sqInt srcReg, sqInt destFPReg);
 static sqInt genGetFixedFieldsOfPointerNonIntintoscratchReg(sqInt instReg, sqInt destReg, sqInt scratchReg);
-static sqInt genGetHashFieldNonIntOfasSmallIntegerInto(sqInt instReg, sqInt destReg);
+static sqInt genGetHashFieldNonImmOfasSmallIntegerInto(sqInt instReg, sqInt destReg);
 static sqInt genGetImplicitReceiverForforPush(sqInt selector, sqInt forPushSendBar);
 static sqInt genGetLeafCallStackPointer(void);
-static void genGetLeafCallStackPointerFunction(AbstractInstruction * self_in_genGetLeafCallStackPointerFunction);
+static AbstractInstruction * genGetLeafCallStackPointerFunction(AbstractInstruction * self_in_genGetLeafCallStackPointerFunction);
 static sqInt genInnerPICAbortTrampoline(char *name);
 static sqInt genInnerPrimitiveAt(sqInt retNoffset);
+static sqInt genInnerPrimitiveNewMethod(sqInt retNoffset);
+static sqInt genInnerPrimitiveNewWithArg(sqInt retNoffset);
+static sqInt genInnerPrimitiveNew(sqInt retNoffset);
 static sqInt genInnerPrimitiveSize(sqInt retNoffset);
 static sqInt genInnerPrimitiveStringAt(sqInt retNOffset);
 static sqInt genJumpBackTo(sqInt targetBytecodePC);
@@ -651,6 +659,7 @@
 static AbstractInstruction * genJumpFPLess(AbstractInstruction * self_in_genJumpFPLess, void *jumpTarget);
 static AbstractInstruction * genJumpFPNotEqual(AbstractInstruction * self_in_genJumpFPNotEqual, void *jumpTarget);
 static sqInt genJumpIfto(sqInt boolean, sqInt targetBytecodePC);
+static AbstractInstruction * genJumpImmediateInScratchReg(sqInt aRegister);
 static AbstractInstruction * genJumpNotSmallIntegerInScratchReg(sqInt aRegister);
 static AbstractInstruction * genJumpSmallIntegerInScratchReg(sqInt aRegister);
 static sqInt genJumpTo(sqInt targetBytecodePC);
@@ -669,7 +678,7 @@
 static sqInt genMarshalledSendSupernumArgs(sqInt selector, sqInt numArgs);
 static sqInt genMarshalledSendnumArgs(sqInt selector, sqInt numArgs);
 static sqInt genMethodAbortTrampolineFor(sqInt numArgs);
-static void genMulRR(AbstractInstruction * self_in_genMulRR, sqInt regSource, sqInt regDest);
+static AbstractInstruction * genMulRR(AbstractInstruction * self_in_genMulRR, sqInt regSource, sqInt regDest);
 static sqInt genMustBeBooleanTrampolineForcalled(sqInt boolean, char *trampolineName);
 static sqInt genNonLocalReturnTrampoline(void);
 static sqInt genPassConstasArgument(AbstractInstruction * self_in_genPassConstasArgument, sqInt constant, sqInt zeroRelativeArgIndex);
@@ -689,7 +698,6 @@
 static sqInt genPrimitiveDiv(void);
 static sqInt genPrimitiveDivide(void);
 static sqInt genPrimitiveEqual(void);
-static sqInt genPrimitiveEquivalent(void);
 static sqInt genPrimitiveFloatAdd(void);
 static sqInt genPrimitiveFloatDivide(void);
 static sqInt genPrimitiveFloatEqual(void);
@@ -703,13 +711,17 @@
 static sqInt genPrimitiveFloatSubtract(void);
 static sqInt genPrimitiveGreaterOrEqual(void);
 static sqInt genPrimitiveGreaterThan(void);
+static sqInt genPrimitiveIdentical(void);
 static sqInt genPrimitiveIdentityHash(void);
 static sqInt genPrimitiveLessOrEqual(void);
 static sqInt genPrimitiveLessThan(void);
 static sqInt genPrimitiveMod(void);
 static sqInt genPrimitiveMultiply(void);
+static sqInt genPrimitiveNew(void);
+static sqInt genPrimitiveNewMethod(void);
+static sqInt genPrimitiveNewWithArg(void);
 static sqInt genPrimitiveNotEqual(void);
-static sqInt genPrimitiveNotEquivalent(void);
+static sqInt genPrimitiveNotIdentical(void);
 static sqInt genPrimitiveQuo(void);
 static sqInt genPrimitiveSize(void);
 static sqInt genPrimitiveStringAt(void);
@@ -777,17 +789,15 @@
 static sqInt genShortJumpIfFalse(void);
 static sqInt genShortJumpIfTrue(void);
 static sqInt genShortUnconditionalJump(void);
-static sqInt genSmallIntegerComparison(sqInt jumpOpcode);
+static sqInt genSmallIntegerComparisonorDoubleComparison(sqInt jumpOpcode, AbstractInstruction *(*jumpFPOpcodeGenerator)(void *));
 static sqInt genSpecialSelectorArithmetic(void);
 static sqInt genSpecialSelectorClass(void);
 static sqInt genSpecialSelectorComparison(void);
 static sqInt genSpecialSelectorEqualsEquals(void);
 static sqInt genSpecialSelectorSend(void);
-static sqInt genSSPushSlotreg(sqInt index, sqInt baseReg);
 static sqInt genStoreAndPopReceiverVariableBytecode(void);
 static sqInt genStoreAndPopRemoteTempLongBytecode(void);
 static sqInt genStoreAndPopTemporaryVariableBytecode(void);
-static sqInt genStoreCheckTrampoline(void);
 static sqInt genStoreImmediateInSourceRegslotIndexdestReg(sqInt sourceReg, sqInt index, sqInt destReg);
 static sqInt genStorePopLiteralVariable(sqInt popBoolean, sqInt litVarIndex);
 static sqInt genStorePopMaybeContextReceiverVariable(sqInt popBoolean, sqInt slotIndex);
@@ -805,12 +815,12 @@
 static sqInt genTrampolineForcalledargresult(void *aRoutine, char *aString, sqInt regOrConst0, sqInt resultReg);
 static sqInt genTrampolineForcalledcallJumpBarnumArgsargargargargsaveRegsresultRegappendOpcodes(void *aRoutine, char *trampolineName, sqInt callJumpBar, sqInt numArgs, sqInt regOrConst0, sqInt regOrConst1, sqInt regOrConst2, sqInt regOrConst3, sqInt saveRegs, sqInt resultRegOrNil, sqInt appendBoolean);
 static sqInt genUpArrowReturn(void);
-static void genWriteCResultIntoReg(AbstractInstruction * self_in_genWriteCResultIntoReg, sqInt abstractRegister);
+static AbstractInstruction * genWriteCResultIntoReg(AbstractInstruction * self_in_genWriteCResultIntoReg, sqInt abstractRegister);
 static AbstractInstruction * gen(sqInt opcode);
 static AbstractInstruction * genoperand(sqInt opcode, sqInt operand);
 static AbstractInstruction * genoperandoperand(sqInt opcode, sqInt operandOne, sqInt operandTwo);
 static AbstractInstruction * genoperandoperandoperand(sqInt opcode, sqInt operandOne, sqInt operandTwo, sqInt operandThree);
-static sqInt getInlineCacheClassTagFrominto(sqInt sourceReg, sqInt destReg);
+static AbstractInstruction * getInlineCacheClassTagFrominto(sqInt sourceReg, sqInt destReg);
 static AbstractInstruction * getJmpTarget(AbstractInstruction * self_in_getJmpTarget);
 static sqInt getLiteral(sqInt litIndex);
 static sqInt hasDoublePrecisionFloatingPointSupport(AbstractInstruction * self_in_hasDoublePrecisionFloatingPointSupport);
@@ -818,6 +828,9 @@
 static sqInt hasPCDependentInstructions(AbstractInstruction * self_in_hasPCDependentInstructions);
 static sqInt hasSSE2Instructions(AbstractInstruction * self_in_hasSSE2Instructions);
 static sqInt hasSSEInstructions(AbstractInstruction * self_in_hasSSEInstructions);
+static sqInt implementsNew(void);
+static sqInt implementsNewMethod(void);
+static sqInt implementsNewWithArg(void);
 static sqInt incrementUsageOfTargetIfLinkedSendmcpcignored(sqInt annotation, char *mcpc, sqInt superfluity);
 static sqInt initialClosedPICUsageCount(void);
 static void initializeBackend(void);
@@ -840,7 +853,7 @@
 static sqInt isBigEndian(AbstractInstruction * self_in_isBigEndian);
 static sqInt isBranch(BytecodeDescriptor * self_in_isBranch);
 static sqInt isCallPreceedingReturnPC(AbstractInstruction * self_in_isCallPreceedingReturnPC, sqInt mcpc);
-static sqInt isImmediate(sqInt anOop);
+static sqInt isHashSetOnInstanceCreation(void);
 static sqInt isJump(AbstractInstruction * self_in_isJump);
 static sqInt isJumpAt(AbstractInstruction * self_in_isJumpAt, sqInt pc);
 static sqInt isLongJump(AbstractInstruction * self_in_isLongJump);
@@ -854,6 +867,8 @@
 static AbstractInstruction * gJumpFPEqual(void *jumpTarget);
 static AbstractInstruction * gJumpFPGreaterOrEqual(void *jumpTarget);
 static AbstractInstruction * gJumpFPGreater(void *jumpTarget);
+static AbstractInstruction * gJumpFPLessOrEqual(void *jumpTarget);
+static AbstractInstruction * gJumpFPLess(void *jumpTarget);
 static AbstractInstruction * gJumpFPNotEqual(void *jumpTarget);
 static AbstractInstruction * JumpRT(sqInt callTarget);
 static AbstractInstruction * jmpTarget(AbstractInstruction * self_in_jmpTarget, AbstractInstruction *anAbstractInstruction);
@@ -889,10 +904,11 @@
 static void mapObjectReferencesInMachineCodeForBecome(void);
 static void mapObjectReferencesInMachineCodeForFullGC(void);
 static void mapObjectReferencesInMachineCodeForIncrementalGC(void);
+static void mapObjectReferencesInMachineCodeForScavenge(void);
 void mapObjectReferencesInMachineCode(sqInt gcMode);
 static void markAndTraceLiteralIfYoung(sqInt literal);
 static void markAndTraceLiteral(sqInt literal);
-static void markAndTraceMachineCodeForIncrementalGC(void);
+static void markAndTraceMachineCodeForNewSpaceGC(void);
 static void markAndTraceObjectReferencesInGeneratedRuntime(void);
 void markAndTraceObjectsOrFreeMachineCode(sqInt inFullGC);
 static sqInt markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit);
@@ -906,10 +922,10 @@
 static void marshallSendArguments(sqInt numArgs);
 usqInt maxCogMethodAddress(void);
 static sqInt maybeFreeCogMethodDoesntLookKosher(CogMethod *cogMethod);
-static void maybeGenerateCheckFeatures(void);
-static void maybeGenerateICacheFlush(void);
+static sqInt maybeGenerateCheckFeatures(void);
+static sqInt maybeGenerateICacheFlush(void);
 sqInt mcPCForstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *cogMethod);
-static void mergeAtfrom(CogSimStackEntry * self_in_mergeAtfrom, sqInt baseOffset, sqInt baseRegister);
+static CogSimStackEntry * mergeAtfrom(CogSimStackEntry * self_in_mergeAtfrom, sqInt baseOffset, sqInt baseRegister);
 static void mergeafterContinuation(BytecodeFixup *fixup, sqInt mergeWithContinuation);
 static sqInt methodAbortTrampolineFor(sqInt numArgs);
 static CogMethod * methodAfter(CogMethod *cogMethod);
@@ -925,7 +941,7 @@
 static sqInt needsFrameNever(sqInt stackDelta);
 static sqInt noAssertMethodClassAssociationOf(sqInt methodPointer);
 static sqInt noCogMethodsMaximallyMarked(void);
-static void nopsFromto(AbstractInstruction * self_in_nopsFromto, sqInt startAddr, sqInt endAddr);
+static AbstractInstruction * nopsFromto(AbstractInstruction * self_in_nopsFromto, sqInt startAddr, sqInt endAddr);
 static sqInt noTargetsFreeInClosedPIC(CogMethod *cPIC);
 static sqInt numberOfSpillsInTopNItems(sqInt n);
 static sqInt numCheckFeaturesOpcodes(AbstractInstruction * self_in_numCheckFeaturesOpcodes);
@@ -934,6 +950,9 @@
 static sqInt numMethods(void);
 sqInt numMethodsOfType(sqInt cogMethodType);
 static sqInt numSmallIntegerBits(void);
+static sqInt objectRepresentationImplementsNewMethod(sqInt primIndex);
+static sqInt objectRepresentationImplementsNewWithArg(sqInt primIndex);
+static sqInt objectRepresentationImplementsNew(sqInt primIndex);
 static sqInt occurrencesInYoungReferrers(CogMethod *cogMethod);
 static sqInt oopisGreaterThanOrEqualTo(sqInt anOop, sqInt otherOop);
 static sqInt oopisGreaterThan(sqInt anOop, sqInt otherOop);
@@ -941,12 +960,12 @@
 static sqInt outputInstructionsAt(sqInt startAddress);
 static sqInt outputInstructionsForGeneratedRuntimeAt(sqInt startAddress);
 static AbstractInstruction * gPushCw(sqInt wordConstant);
-static void padIfPossibleWithNopsFromto(AbstractInstruction * self_in_padIfPossibleWithNopsFromto, sqInt startAddr, sqInt endAddr);
+static AbstractInstruction * padIfPossibleWithNopsFromto(AbstractInstruction * self_in_padIfPossibleWithNopsFromto, sqInt startAddr, sqInt endAddr);
 sqInt patchToOpenPICFornumArgsreceiver(sqInt selector, sqInt numArgs, sqInt receiver);
 sqInt pcisWithinMethod(char *address, CogMethod *cogMethod);
 static sqInt picAbortTrampolineFor(sqInt numArgs);
 static void planCompaction(void);
-static void popToReg(CogSimStackEntry * self_in_popToReg, sqInt reg);
+static CogSimStackEntry * popToReg(CogSimStackEntry * self_in_popToReg, sqInt reg);
 static sqInt prevInstIsPCAnnotated(void);
 static PrimitiveDescriptor * primitiveGeneratorOrNil(void);
 void printCogMethodFor(void *address);
@@ -958,7 +977,7 @@
 static sqInt processorHasDivQuoRem(sqInt ignoredPrimIndex);
 static sqInt processorHasDoublePrecisionFloatingPointSupport(sqInt ignoredPrimIndex);
 static sqInt processorHasMultiply(sqInt ignoredPrimIndex);
-static void pruneYoungReferrers(void);
+static sqInt pruneYoungReferrers(void);
 static AbstractInstruction * gRetN(sqInt offset);
 void recordCallOffsetInof(CogMethod *cogMethod, void *callLabelArg);
 static void recordGeneratedRunTimeaddress(char *aString, sqInt address);
@@ -970,24 +989,25 @@
 static sqInt registerMaskForandand(sqInt reg1, sqInt reg2, sqInt reg3);
 static sqInt registerOrNil(CogSimStackEntry * self_in_registerOrNil);
 static void reinitializeFixupsFromthrough(sqInt start, sqInt end);
-static void relocateAndPruneYoungReferrers(void);
-static void relocateCallBeforeReturnPCby(AbstractInstruction * self_in_relocateCallBeforeReturnPCby, sqInt retpc, sqInt delta);
+static sqInt relocateAndPruneYoungReferrers(void);
+static AbstractInstruction * relocateCallBeforeReturnPCby(AbstractInstruction * self_in_relocateCallBeforeReturnPCby, sqInt retpc, sqInt delta);
 static void relocateCallsAndSelfReferencesInMethod(CogMethod *cogMethod);
 static void relocateCallsInClosedPIC(CogMethod *cPIC);
 static sqInt relocateIfCallOrMethodReferencemcpcdelta(sqInt annotation, char *mcpc, sqInt delta);
-static void relocateJumpBeforeFollowingAddressby(AbstractInstruction * self_in_relocateJumpBeforeFollowingAddressby, sqInt pc, sqInt delta);
-static void relocateMethodReferenceBeforeAddressby(AbstractInstruction * self_in_relocateMethodReferenceBeforeAddressby, sqInt pc, sqInt delta);
+static AbstractInstruction * relocateJumpBeforeFollowingAddressby(AbstractInstruction * self_in_relocateJumpBeforeFollowingAddressby, sqInt pc, sqInt delta);
+static AbstractInstruction * relocateMethodReferenceBeforeAddressby(AbstractInstruction * self_in_relocateMethodReferenceBeforeAddressby, sqInt pc, sqInt delta);
 static sqInt relocateMethodsPreCompaction(void);
 static sqInt remapIfObjectRefpchasYoung(sqInt annotation, char *mcpc, sqInt hasYoungPtr);
 static sqInt remapNSIfObjectRefpchasYoung(sqInt annotation, char *mcpc, sqInt hasYoungPtr);
+static sqInt remapObj(sqInt oop);
 static sqInt remapOop(sqInt oop);
-static void removeFromOpenPICList(CogMethod *anOpenPIC);
-static void removeFromUnpairedMethodList(CogMethod *aCogMethod);
-static void resolveJumpTarget(AbstractInstruction * self_in_resolveJumpTarget);
+static sqInt removeFromOpenPICList(CogMethod *anOpenPIC);
+static sqInt removeFromUnpairedMethodList(CogMethod *aCogMethod);
+static AbstractInstruction * resolveJumpTarget(AbstractInstruction * self_in_resolveJumpTarget);
 static sqInt returnRegForStoreCheck(void);
 static sqInt rewriteCallAttarget(AbstractInstruction * self_in_rewriteCallAttarget, usqInt callSiteReturnAddress, usqInt callTargetAddress);
 static sqInt rewriteInlineCacheAttagtarget(AbstractInstruction * self_in_rewriteInlineCacheAttagtarget, usqInt callSiteReturnAddress, sqInt cacheTag, usqInt callTargetAddress);
-static void rewriteInlineCacheTagat(AbstractInstruction * self_in_rewriteInlineCacheTagat, sqInt cacheTag, sqInt callSiteReturnAddress);
+static AbstractInstruction * rewriteInlineCacheTagat(AbstractInstruction * self_in_rewriteInlineCacheTagat, sqInt cacheTag, sqInt callSiteReturnAddress);
 static sqInt rewriteJumpLongAttarget(AbstractInstruction * self_in_rewriteJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 void rewritePrimInvocationInto(CogMethod *cogMethod, void (*primFunctionPointer)(void));
 static sqInt roomOnYoungReferrersList(void);
@@ -1008,6 +1028,7 @@
 static sqInt sizeImmediateGroup1at(AbstractInstruction * self_in_sizeImmediateGroup1at, sqInt op, sqInt pc);
 static sqInt sizePCDependentInstructionAt(AbstractInstruction * self_in_sizePCDependentInstructionAt, sqInt eventualAbsoluteAddress);
 static sqInt slotOffsetOfInstVarIndex(sqInt index);
+static sqInt smallIntegerIsOnlyImmediateType(void);
 static sqInt spanForCleanBlockStartingAt(sqInt startPC);
 static void ssAllocateCallReg(sqInt requiredReg);
 static void ssAllocateCallRegand(sqInt requiredReg1, sqInt requiredReg2);
@@ -1033,8 +1054,8 @@
 static CogSimStackEntry * ssValue(sqInt n);
 static sqInt stackBytesForNumArgs(AbstractInstruction * self_in_stackBytesForNumArgs, sqInt numArgs);
 static sqInt stackPageInterruptHeadroomBytes(AbstractInstruction * self_in_stackPageInterruptHeadroomBytes);
-static void storeLiteralbeforeFollowingAddress(AbstractInstruction * self_in_storeLiteralbeforeFollowingAddress, sqInt literal, sqInt followingAddress);
-static void storeToReg(CogSimStackEntry * self_in_storeToReg, sqInt reg);
+static AbstractInstruction * storeLiteralbeforeFollowingAddress(AbstractInstruction * self_in_storeLiteralbeforeFollowingAddress, sqInt literal, sqInt followingAddress);
+static CogSimStackEntry * storeToReg(CogSimStackEntry * self_in_storeToReg, sqInt reg);
 static sqInt sib(AbstractInstruction * self_in_sib, sqInt scale, sqInt indexReg, sqInt baseReg);
 sqInt traceLinkedSendOffset(void);
 static char * trampolineNamenumArgs(char *routinePrefix, sqInt numArgs);
@@ -1049,7 +1070,7 @@
 void unlinkSendsToFree(void);
 void unlinkSendsToandFreeIf(sqInt targetMethodObject, sqInt freeIfTrue);
 static sqInt unsignedShortAt(AbstractInstruction * self_in_unsignedShortAt, sqInt byteAddress);
-static void updateLabel(AbstractInstruction * self_in_updateLabel, AbstractInstruction *labelInstruction);
+static AbstractInstruction * updateLabel(AbstractInstruction * self_in_updateLabel, AbstractInstruction *labelInstruction);
 static sqInt updateMaybeObjRefAt(sqInt mcpc);
 static sqInt v3or4PushNilSize(sqInt aMethodObj);
 static sqInt v3or4IsPushNil(BytecodeDescriptor *descriptor, sqInt pc, sqInt nExts, sqInt aMethodObj);
@@ -1779,15 +1800,16 @@
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
+	{ genPrimitiveNew, 0, objectRepresentationImplementsNew },
+	{ genPrimitiveNewWithArg, 1, objectRepresentationImplementsNewWithArg },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
-	{ 0, -1, 0 },
-	{ 0, -1, 0 },
 	{ genPrimitiveIdentityHash, 0, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
+	{ genPrimitiveNewMethod, 2, objectRepresentationImplementsNewMethod },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
@@ -1818,8 +1840,7 @@
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
-	{ 0, -1, 0 },
-	{ genPrimitiveEquivalent, 1, 0 },
+	{ genPrimitiveIdentical, 1, 0 },
 	{ genPrimitiveClass, -1, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
@@ -1878,7 +1899,7 @@
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
-	{ genPrimitiveNotEquivalent, 1, 0 },
+	{ genPrimitiveNotIdentical, 1, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
@@ -1910,11 +1931,11 @@
 	{ genFastPrimFail, -1, 0 },
 	{ genFastPrimFail, -1, 0 },
 	{ 0, -1, 0 },
-	{ genPrimitiveClosureValue, -1, 0 },
-	{ genPrimitiveClosureValue, -1, 0 },
-	{ genPrimitiveClosureValue, -1, 0 },
-	{ genPrimitiveClosureValue, -1, 0 },
-	{ genPrimitiveClosureValue, -1, 0 },
+	{ genPrimitiveClosureValue, 0, 0 },
+	{ genPrimitiveClosureValue, 1, 0 },
+	{ genPrimitiveClosureValue, 2, 0 },
+	{ genPrimitiveClosureValue, 3, 0 },
+	{ genPrimitiveClosureValue, 4, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
@@ -1930,8 +1951,8 @@
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
 	{ 0, -1, 0 },
-	{ genPrimitiveClosureValue, -1, 0 },
-	{ genPrimitiveClosureValue, -1, 0 }
+	{ genPrimitiveClosureValue, 0, 0 },
+	{ genPrimitiveClosureValue, 1, 0 }
 };
 static sqInt primitiveIndex;
 void (*realCEEnterCogCodePopReceiverAndClassRegs)(void);
@@ -1984,6 +2005,7 @@
 		annotations = (void *)((char *)fixups + fixupSize); \
 		opcodeIndex = labelCounter = annotationIndex = 0; \
 } while (0)
+#define blockAlignment(self) 8
 #define blockStartAt(index) (&blockStarts[index])
 #define breakOnImplicitReceiver() (traceFlags & 64)
 #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline
@@ -1991,7 +2013,6 @@
 #define ceCheckFeatures() ceCheckFeaturesFunction()
 #define cePositive32BitIntegerTrampoline() cePositive32BitIntegerTrampoline
 #define ceReturnToInterpreterPC() ((usqInt)ceReturnToInterpreterTrampoline)
-#define ceStoreCheckTrampoline() ceStoreCheckTrampoline
 #define cFramePointerAddress() ((unsigned long)&CFramePointer)
 #define cPICNumCases stackCheckOffset
 #define cPICNumCasesHack hack hack hack i.e. the getter macro does all the work
@@ -2157,10 +2178,8 @@
 
 	for (i = 1, iLimiT = (literalCountOf(methodObj)); i <= iLimiT; i += 1) {
 		lit = fetchPointerofObject(i, methodObj);
-		if (((startPCOrNil = startPCOrNilOfLiteralin(lit, methodObj))) == null) {
-			null;
-		}
-		else {
+		startPCOrNil = startPCOrNilOfLiteralin(lit, methodObj);
+		if (!(startPCOrNil == null)) {
 			maxLitIndex = ((maxLitIndex < i) ? i : maxLitIndex);
 			addBlockStartAtnumArgsnumCopiedspan(startPCOrNil - 1, argumentCountOfClosure(lit), copiedValueCountOfClosure(lit), spanForCleanBlockStartingAt(startPCOrNil - 1));
 		}
@@ -2323,7 +2342,7 @@
 	mzFreeStart += roundedBytes;
 	methodCount += 1;
 	assert(roomOnYoungReferrersList());
-	;
+	
 	return allocation;
 }
 
@@ -2490,7 +2509,7 @@
 sqInt
 bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod)
 {
-	return mapForbcpcperformUntilarg(cogMethod, startbcpc, findMcpcBcpcMatchingMcpc, ((void *) mcpc));
+	return mapForbcpcperformUntilarg(cogMethod, startbcpc, findMcpcBcpcMatchingMcpc, ((void *)mcpc));
 }
 
 static AbstractInstruction *
@@ -2622,7 +2641,7 @@
 static sqInt
 ceClosureCopyDescriptor(sqInt descriptor)
 {
-	return createClosureNumArgsnumCopiedstartpc(descriptor & 63, (((usqInt) descriptor) >> 6) & 63, ((usqInt) descriptor) >> 12);
+	return createClosureNumArgsnumCopiedstartpc(descriptor & 0x3F, (((usqInt) descriptor) >> 6) & 0x3F, ((usqInt) descriptor) >> 12);
 }
 
 
@@ -2647,11 +2666,10 @@
     sqInt result;
     sqInt selector;
 
-	;
+	
 	outerReturn = stackTop();
 	if (((cPIC->cPICNumCases)) < numPICCases) {
 		/* begin lookup:for:methodAndErrorSelectorInto: */
-		VM_LABEL(0lookupformethodAndErrorSelectorInto);
 		selector = (cPIC->selector);
 		methodOrSelectorIndex = lookupreceiver(selector, receiver);
 		if ((((usqInt)methodOrSelectorIndex)) >= (nilObject())) {
@@ -2814,7 +2832,6 @@
 
 	assert(((((sqInt)targetMethod)) + cmEntryOffset) == entryPoint);
 	/* begin lookup:for:methodAndErrorSelectorInto: */
-	VM_LABEL(1lookupformethodAndErrorSelectorInto);
 	selector = (targetMethod->selector);
 	methodOrSelectorIndex = lookupreceiver(selector, receiver);
 	if ((((usqInt)methodOrSelectorIndex)) >= (nilObject())) {
@@ -2923,14 +2940,14 @@
 		}
 		if ((couldBeObject(literal))
 		 && (isReallyYoungObject(literal))) {
-			if (!(asserta((((CogMethod *) cogMethod)->cmRefersToYoung)))) {
+			if (!(asserta(((((CogMethod *) cogMethod))->cmRefersToYoung)))) {
 				return 2;
 			}
 		}
 	}
 	if ((annotation == IsSendCall)
 			 || (annotation == IsNSSendCall)) {
-		if (!(asserta(((((CogMethod *) cogMethod)->cmType)) == CMMethod))) {
+		if (!(asserta((((((CogMethod *) cogMethod))->cmType)) == CMMethod))) {
 			return 3;
 		}
 		cacheTag = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
@@ -2939,7 +2956,7 @@
 		}
 		if ((couldBeObject(cacheTag))
 		 && (isReallyYoungObject(cacheTag))) {
-			if (!(asserta((((CogMethod *) cogMethod)->cmRefersToYoung)))) {
+			if (!(asserta(((((CogMethod *) cogMethod))->cmRefersToYoung)))) {
 				return 5;
 			}
 		}
@@ -2949,7 +2966,6 @@
 			/* It's a linked send; find which kind. */
 
 			/* begin offsetAndSendTableFor:annotation:into: */
-			VM_LABEL(0offsetAndSendTableForannotationinto);
 			if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
 				assert(annotation == IsSendCall);
 				offset = cmEntryOffset;
@@ -2982,8 +2998,13 @@
 static sqInt
 checkIfValidObjectRefpccogMethod(sqInt annotation, char *mcpc, sqInt cogMethod)
 {
-    sqInt cacheTag;
+    sqInt entryPoint;
     sqInt literal;
+    sqInt off;
+    sqInt offset;
+    sqInt selectorOrCacheTag;
+    sqInt *sendTable;
+    sqInt table;
 
 	if (annotation == IsObjectReference) {
 		literal = literalBeforeFollowingAddress(backEnd, ((sqInt)mcpc));
@@ -2998,15 +3019,59 @@
 	}
 	if ((annotation == IsSendCall)
 			 || (annotation == IsNSSendCall)) {
-		cacheTag = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
-		if (!(checkValidInlineCacheTag(cacheTag))) {
-			print("cache tag/selector leak in CM ");
-			printHex(((sqInt)cogMethod));
-			print(" @ ");
-			printHex(((sqInt)mcpc));
-			cr();
-			return 1;
+		entryPoint = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
+		/* begin offsetAndSendTableFor:annotation:into: */
+		if ((entryPoint & entryPointMask) == checkedEntryAlignment) {
+			assert(annotation == IsSendCall);
+			offset = cmEntryOffset;
+			sendTable = sendTrampolines;
+
 		}
+		else {
+			if ((entryPoint & entryPointMask) == dynSuperEntryAlignment) {
+				assert(annotation == IsNSSendCall);
+				offset = cmDynSuperEntryOffset;
+				sendTable = dynamicSuperSendTrampolines;
+
+			}
+			else {
+				assert(annotation == IsSendCall);
+				offset = cmNoCheckEntryOffset;
+				sendTable = superSendTrampolines;
+
+			}
+		}
+
+		selectorOrCacheTag = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
+		if ((entryPoint > methodZoneBase)
+		 && ((offset != cmNoCheckEntryOffset)
+		 && (((((((CogMethod *) (entryPoint + offset)))->cmType)) != CMOpenPIC)
+		 || (!(couldBeObject(selectorOrCacheTag)))))) {
+
+			/* linked non-super send, cacheTag is a cacheTag */
+
+			if (!(checkValidInlineCacheTag(selectorOrCacheTag))) {
+				print("cache tag leak in CM ");
+				printHex(((sqInt)cogMethod));
+				print(" @ ");
+				printHex(((sqInt)mcpc));
+				cr();
+				return 1;
+			}
+		}
+		else {
+
+			/* unlinked send or super send; cacheTag is a selector */
+
+			if (!(checkValidObjectReference(selectorOrCacheTag))) {
+				print("selector leak in CM ");
+				printHex(((sqInt)cogMethod));
+				print(" @ ");
+				printHex(((sqInt)mcpc));
+				cr();
+				return 1;
+			}
+		}
 	}
 	return 0;
 }
@@ -3357,7 +3422,7 @@
 		cogMethod = methodAfter(cogMethod);
 	}
 	if ((((label = stringForCString("CCFree"))) == null)
-	 || (((value = cePositive32BitIntegerFor(freeStart()))) == null)) {
+	 || (((value = cePositive32BitIntegerFor(mzFreeStart))) == null)) {
 		popRemappableOop();
 		return null;
 	}
@@ -3480,12 +3545,12 @@
 		if (((cogMethod->methodHeader)) != 0) {
 			return 22;
 		}
-		if ((((sqInt) ((cogMethod->objectHeader)))) >= 0) {
+		if (((cogMethod->objectHeader)) >= 0) {
 			if ((((cogMethod->methodObject)) != 0)
 			 && ((((cogMethod->methodObject)) < methodZoneBase)
-			 || ((((cogMethod->methodObject)) > ((freeStart()) - openPICSize))
+			 || ((((cogMethod->methodObject)) > (mzFreeStart - openPICSize))
 			 || (((((cogMethod->methodObject)) & (BytesPerWord - 1)) != 0)
-			 || (((((CogMethod *) ((cogMethod->methodObject)))->cmType)) != CMOpenPIC))))) {
+			 || ((((((CogMethod *) ((cogMethod->methodObject))))->cmType)) != CMOpenPIC))))) {
 				return 23;
 			}
 		}
@@ -3496,7 +3561,7 @@
 	}
 	if (((cogMethod->cmType)) == CMClosedPIC) {
 		if (((cogMethod->blockSize)) != closedPICSize) {
-			return 31;
+			return 0x1F;
 		}
 		if (!(((((cogMethod->cPICNumCases)) >= 1) && (((cogMethod->cPICNumCases)) <= numPICCases)))) {
 			return 32;
@@ -3648,10 +3713,7 @@
 		haltmsg("Compilation of breakMethod");
 	}
 	cogMethod = findPreviouslyCompiledVersionOfwith(aMethodObj, aSelectorOop);
-	if (cogMethod == null) {
-		null;
-	}
-	else {
+	if (!(cogMethod == null)) {
 		if (!(methodHasCogMethod(aMethodObj))) {
 			assert((rawHeaderOf(aMethodObj)) == ((cogMethod->methodHeader)));
 			(cogMethod->methodObject = aMethodObj);
@@ -3694,13 +3756,13 @@
 	compactCompiledCode(nullHeaderForMachineCodeMethod());
 	assert(allMethodsHaveCorrectHeader());
 	assert(kosherYoungReferrers());
-	flushICacheFromto(processor, methodZoneBase, freeStart());
+	flushICacheFromto(processor, methodZoneBase, mzFreeStart);
 }
 
 static void
 compactCompiledCode(sqInt objectHeaderValue)
 {
-    sqInt bytes;
+    unsigned short bytes;
     CogMethod *dest;
     CogMethod *source;
 
@@ -3730,7 +3792,8 @@
 		source = methodAfter(source);
 	}
 	if (source >= (limitZony())) {
-		haltmsg("no free methods; cannot compact."); return;
+		haltmsg("no free methods; cannot compact.");
+		return;
 	}
 	dest = source;
 	while (source < (limitZony())) {
@@ -3840,7 +3903,7 @@
 				deadCode = 1;
 			}
 		}
-		;
+		
 		byte0 = (fetchByteofObject(bytecodePC, methodObj)) + bytecodeSetOffset;
 		descriptor = generatorAt(byte0);
 		if (((descriptor->numBytes)) > 1) {
@@ -3938,7 +4001,7 @@
 			if (initialStackPtr == simStackPtr) break;
 			assert(initialStackPtr > simStackPtr);
 			(blockStart->numInitialNils = (((blockStart->numInitialNils)) + simStackPtr) - initialStackPtr);
-			((blockStart->fakeHeader)->dependent = null);
+			(((blockStart->fakeHeader))->dependent = null);
 			reinitializeFixupsFromthrough(((blockStart->startpc)) + ((blockStart->numInitialNils)), (((blockStart->startpc)) + ((blockStart->span))) - 1);
 			bzero(abstractOpcodes + initialOpcodeIndex,
 									(opcodeIndex - initialOpcodeIndex) * sizeof(AbstractInstruction));
@@ -3978,7 +4041,7 @@
 	return 0;
 }
 
-static void
+static sqInt
 compileBlockDispatchFromto(sqInt lowBlockStartIndex, sqInt highBlockStartIndex)
 {
     BlockStart *blockStart;
@@ -3994,7 +4057,7 @@
 		/* begin Jump: */
 		jumpTarget = (blockStart->entryLabel);
 		genoperand(Jump, ((sqInt)jumpTarget));
-		return;
+		return null;
 	}
 	halfWay = ((sqInt) (highBlockStartIndex + lowBlockStartIndex) >> 1);
 	assert(((halfWay >= lowBlockStartIndex) && (halfWay <= highBlockStartIndex)));
@@ -4010,14 +4073,14 @@
 		jumpTarget1 = (blockStart->entryLabel);
 		genoperand(JumpLessOrEqual, ((sqInt)jumpTarget1));
 		compileBlockDispatchFromto(halfWay + 1, highBlockStartIndex);
-		return;
+		return null;
 	}
 	if ((halfWay + 1) == highBlockStartIndex) {
 		blockStart = blockStartAt(highBlockStartIndex);
 		/* begin JumpGreater: */
 		jumpTarget2 = (blockStart->entryLabel);
 		genoperand(JumpGreater, ((sqInt)jumpTarget2));
-		compileBlockDispatchFromto(lowBlockStartIndex, halfWay); return;
+		return compileBlockDispatchFromto(lowBlockStartIndex, halfWay);
 	}
 	/* begin JumpGreater: */
 	jmp = genoperand(JumpGreater, ((sqInt)0));
@@ -4045,14 +4108,28 @@
     sqInt alignment;
 
 	/* begin AlignmentNops: */
-	alignment = sizeof(CogBlockMethod);
+	alignment = blockAlignment();
 	genoperand(AlignmentNops, alignment);
-	assert((sizeof(CogBlockMethod)) == (2 * BytesPerWord));
 	(blockStart->fakeHeader = gLabel());
-	/* begin Fill32: */
-	genoperand(Fill32, 0);
-	/* begin Fill32: */
-	genoperand(Fill32, 0);
+	
+	switch (sizeof(CogBlockMethod)) {
+	case 2 * BytesPerWord:
+		/* begin Fill32: */
+		genoperand(Fill32, 0);
+		/* begin Fill32: */
+		genoperand(Fill32, 0);
+		break;
+	case 3 * BytesPerWord:
+		/* begin Fill32: */
+		genoperand(Fill32, 0);
+		/* begin Fill32: */
+		genoperand(Fill32, 0);
+		/* begin Fill32: */
+		genoperand(Fill32, 0);
+		break;
+	default:
+		error("Case not found and no otherwise clause");
+	}
 	(blockStart->entryLabel = gLabel());
 	if (needsFrame) {
 		compileBlockFrameBuild(blockStart);
@@ -4222,7 +4299,7 @@
     sqInt result;
 
 	methodOrBlockNumTemps = tempCountOf(methodObj);
-	;
+	
 	hasYoungReferent = (isYoung(methodObj))
 	 || (isYoung(selector));
 	methodOrBlockNumArgs = argumentCountOf(methodObj);
@@ -4268,11 +4345,7 @@
 static AbstractInstruction *
 compileCPICEntry(void)
 {
-	/* begin AlignmentNops: */
-	genoperand(AlignmentNops, ((BytesPerWord < 8) ? 8 : BytesPerWord));
-	/* begin Label */
-	entry = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
-	getInlineCacheClassTagFrominto(ReceiverResultReg, TempReg);
+	entry = getInlineCacheClassTagFrominto(ReceiverResultReg, TempReg);
 	/* begin CmpR:R: */
 	genoperandoperand(CmpRR, ClassReg, TempReg);
 	/* begin JumpNonZero: */
@@ -4303,7 +4376,7 @@
 	if ((!isMNUCase)
 	 && (methodHasCogMethod(case1Method))) {
 		operand = 0;
-		targetEntry = ((void *) ((((sqInt)(cogMethodOf(case1Method)))) + cmNoCheckEntryOffset));
+		targetEntry = ((void *)((((sqInt)(cogMethodOf(case1Method)))) + cmNoCheckEntryOffset));
 	}
 	else {
 		assert((case1Method == null)
@@ -4377,19 +4450,12 @@
 static void
 compileEntry(void)
 {
-	
-	/* 1st nop differentiates dynSuperEntry from no-check entry if using nextMethod */
-
 	/* begin Nop */
 	gen(Nop);
 	/* begin Nop */
 	dynSuperEntry = gen(Nop);
 
-	/* begin AlignmentNops: */
-	genoperand(AlignmentNops, ((BytesPerWord < 8) ? 8 : BytesPerWord));
-	/* begin Label */
-	entry = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
-	getInlineCacheClassTagFrominto(ReceiverResultReg, TempReg);
+	entry = getInlineCacheClassTagFrominto(ReceiverResultReg, TempReg);
 	/* begin CmpR:R: */
 	genoperandoperand(CmpRR, ClassReg, TempReg);
 	/* begin JumpNonZero: */
@@ -4401,7 +4467,13 @@
 	}
 }
 
+static sqInt
+compileFallbackToInterpreterPrimitive(void)
+{
+	return compileInterpreterPrimitive(functionPointerForCompiledMethodprimitiveIndex(methodObj, primitiveIndex));
+}
 
+
 /*	Build a frame for a CogMethod activation. See CoInterpreter
 	class>>initializeFrameIndices. receiver (in ReceiverResultReg)
 	arg0
@@ -4423,7 +4495,7 @@
 	class>>initializeFrameIndices. Override to push the register receiver and
 	register arguments, if any. */
 
-static void
+static sqInt
 compileFrameBuild(void)
 {
     sqInt address;
@@ -4434,11 +4506,11 @@
 
 	if (!needsFrame) {
 		initSimStackForFramelessMethod(initialPC);
-		return;
+		return 0;
 	}
 	genPushRegisterArgs();
 	if (!needsFrame) {
-		return;
+		return 0;
 	}
 	methodHeader = headerOf(methodObj);
 	if (hasLinkRegister(backEnd)) {
@@ -4565,6 +4637,7 @@
     AbstractInstruction *jmpSampleNonPrim;
     AbstractInstruction *jmpSamplePrim;
     sqInt offset;
+    sqInt retpc;
 
 
 	/* Save processor fp, sp and return pc in the interpreter's frame stack and instruction pointers */
@@ -4642,9 +4715,12 @@
 
 		/* Sideways call the C primitive routine so that we return through cePrimReturnEnterCogCode. */
 
-		genSubstituteReturnAddress(backEnd, ((flags & PrimCallCollectsProfileSamples) != 0
+		/* begin genSubstituteReturnAddress: */
+		retpc = ((flags & PrimCallCollectsProfileSamples) != 0
 			? cePrimReturnEnterCogCodeProfiling
-			: cePrimReturnEnterCogCode));
+			: cePrimReturnEnterCogCode);
+		/* begin PushCw: */
+		genoperand(PushCw, retpc);
 		JumpRT(((sqInt)primitiveRoutine));
 		/* begin Label */
 		primInvokeLabel = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
@@ -4796,12 +4872,11 @@
     sqInt routine;
 
 	compilePICProlog(numArgs);
-	/* begin AlignmentNops: */
-	genoperand(AlignmentNops, ((BytesPerWord < 8) ? 8 : BytesPerWord));
-	/* begin Label */
-	entry = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
-	genGetClassObjectOfintoscratchReg(ReceiverResultReg, ClassReg, TempReg);
-	flag("lookupInMethodCacheSel:class:");
+
+	/* Do first of three probes.  See CoInterpreter>>lookupInMethodCacheSel:classTag: */
+
+	entry = genGetClassTagOfintoscratchReg(ReceiverResultReg, ClassReg, TempReg);
+	flag("lookupInMethodCacheSel:classTag:");
 	/* begin MoveR:R: */
 	genoperandoperand(MoveRR, ClassReg, SendNumArgsReg);
 	annotateobjRef(gXorCwR(selector, ClassReg), selector);
@@ -5021,10 +5096,7 @@
 		? Call
 		: Jump), ((usqInt)aRoutine));
 	if (callJumpBar) {
-		if (resultRegOrNil == null) {
-			null;
-		}
-		else {
+		if (!(resultRegOrNil == null)) {
 			genWriteCResultIntoReg(backEnd, resultRegOrNil);
 		}
 		if (saveRegs) {
@@ -5059,6 +5131,8 @@
 static void
 computeEntryOffsets(void)
 {
+    sqInt uncheckedEntryAlignment;
+
 	allocateOpcodesbytecodes(20, 0);
 	methodOrBlockNumArgs = 0;
 	compileAbort();
@@ -5080,11 +5154,12 @@
 		error("cannot differentiate checked and unchecked entry-points with current cog method alignment");
 	}
 	checkedEntryAlignment = cmEntryOffset & entryPointMask;
-	assert(checkedEntryAlignment != (cmNoCheckEntryOffset & entryPointMask));
+	uncheckedEntryAlignment = cmNoCheckEntryOffset & entryPointMask;
+	assert(checkedEntryAlignment != uncheckedEntryAlignment);
 	cmDynSuperEntryOffset = ((dynSuperEntry->address)) - methodZoneBase;
 	dynSuperEntryAlignment = cmDynSuperEntryOffset & entryPointMask;
-	assert((cmDynSuperEntryOffset & entryPointMask) != (cmEntryOffset & entryPointMask));
-	assert((cmDynSuperEntryOffset & entryPointMask) != (cmNoCheckEntryOffset & entryPointMask));
+	assert(dynSuperEntryAlignment != checkedEntryAlignment);
+	assert(dynSuperEntryAlignment != uncheckedEntryAlignment);
 
 }
 
@@ -5095,8 +5170,16 @@
 computeJumpTargetOffsetPlus(AbstractInstruction * self_in_computeJumpTargetOffsetPlus, sqInt anPCOffset)
 {
     AbstractInstruction *jumpTarget;
+    AbstractInstruction *jumpTarget1;
 
-	jumpTarget = jumpTargetAddress(self_in_computeJumpTargetOffsetPlus);
+	/* begin jumpTargetAddress */
+	jumpTarget1 = ((AbstractInstruction *) (((self_in_computeJumpTargetOffsetPlus->operands))[0]));
+	assertSaneJumpTarget(jumpTarget1);
+	if (isAnInstruction(self_in_computeJumpTargetOffsetPlus, jumpTarget1)) {
+		jumpTarget1 = ((AbstractInstruction *) ((jumpTarget1->address)));
+	}
+	assert(jumpTarget1 != 0);
+	jumpTarget = jumpTarget1;
 	return (((sqInt) jumpTarget)) - (((sqInt) (((self_in_computeJumpTargetOffsetPlus->address)) + anPCOffset)));
 }
 
@@ -5474,23 +5557,23 @@
 	if (isQuick(self_in_concretizeAddCqR, value)) {
 		((self_in_concretizeAddCqR->machineCode))[0] = 131;
 		((self_in_concretizeAddCqR->machineCode))[1] = (modRMRO(self_in_concretizeAddCqR, ModReg, reg, 0));

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list