[Vm-dev] [commit][3511] CogVM source as per VMMaker.oscog-eem.1539

commits at squeakvm.org commits at squeakvm.org
Wed Dec 2 18:26:40 UTC 2015


Revision: 3511
Author:   eliot
Date:     2015-12-02 10:26:38 -0800 (Wed, 02 Dec 2015)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.1539

Cogit:
Fix /horrible/ bug with primitive error codes and fixups.  The adjustment of the
initialPC to skip the primitive and error code, if any, was done after
generating fixups for backward branches, and hence these branches were bogus.
Object>>shallowCopy in Spur is subject to this, but amazingly enough it has not
surfaced before now.  Fix this by adjusting the initialPC before scanMethod
scans for fixups.

ARM builds:
Revert inclusion of Squeak3D plugin until the code is in the src/plugins tree.

Modified Paths:
--------------
    branches/Cog/build.linux32ARM/squeak.cog.spur/plugins.ext
    branches/Cog/nsspursrc/vm/cogit.h
    branches/Cog/nsspursrc/vm/cogitARMv5.c
    branches/Cog/nsspursrc/vm/cogitIA32.c
    branches/Cog/spursistasrc/vm/cogit.h
    branches/Cog/spursistasrc/vm/cogitARMv5.c
    branches/Cog/spursistasrc/vm/cogitIA32.c
    branches/Cog/spursrc/vm/cogit.h
    branches/Cog/spursrc/vm/cogitARMv5.c
    branches/Cog/spursrc/vm/cogitIA32.c
    branches/Cog/src/vm/cogit.h
    branches/Cog/src/vm/cogitARMv5.c
    branches/Cog/src/vm/cogitIA32.c

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

Modified: branches/Cog/build.linux32ARM/squeak.cog.spur/plugins.ext
===================================================================
--- branches/Cog/build.linux32ARM/squeak.cog.spur/plugins.ext	2015-12-01 00:32:22 UTC (rev 3510)
+++ branches/Cog/build.linux32ARM/squeak.cog.spur/plugins.ext	2015-12-02 18:26:38 UTC (rev 3511)
@@ -1,7 +1,7 @@
 # Copied, perhaps edited, from ../../src/examplePlugins.ext
 EXTERNAL_PLUGINS = \
-B3DAcceleratorPlugin \
-Squeak3D \
+#B3DAcceleratorPlugin \
+#Squeak3D \
 #BochsIA32Plugin \
 #GdbARMPlugin \
 SqueakFFIPrims \

Modified: branches/Cog/nsspursrc/vm/cogit.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.h	2015-12-01 00:32:22 UTC (rev 3510)
+++ branches/Cog/nsspursrc/vm/cogit.h	2015-12-02 18:26:38 UTC (rev 3511)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247
+	CCodeGenerator VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d
  */
 
 

Modified: branches/Cog/nsspursrc/vm/cogitARMv5.c
===================================================================
--- branches/Cog/nsspursrc/vm/cogitARMv5.c	2015-12-01 00:32:22 UTC (rev 3510)
+++ branches/Cog/nsspursrc/vm/cogitARMv5.c	2015-12-02 18:26:38 UTC (rev 3511)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247
+	CCodeGenerator VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247
+	StackToRegisterMappingCogit VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -113,26 +113,26 @@
 
 
 /*** Constants ***/
-#define AddCqR 95
-#define AddCwR 103
+#define AddCqR 97
+#define AddCwR 105
 #define AddOpcode 4
-#define AddRdRd 110
-#define AddRR 89
+#define AddRdRd 112
+#define AddRR 91
 #define AL 14
 #define AlignmentNops 3
 #define AltBlockCreationBytecodeSize 3
 #define AltFirstSpecialSelector 80
 #define AltNumSpecialSelectors 32
-#define AndCqR 97
-#define AndCqRR 108
-#define AndCwR 105
+#define AndCqR 99
+#define AndCqRR 110
+#define AndCwR 107
 #define AndOpcode 0
-#define AndRR 91
+#define AndRR 93
 #define AnnotationShift 5
 #define Arg0Reg -7
 #define Arg1Reg -8
-#define ArithmeticShiftRightCqR 82
-#define ArithmeticShiftRightRR 83
+#define ArithmeticShiftRightCqR 84
+#define ArithmeticShiftRightRR 85
 #define BadRegisterSet 1
 #define BicOpcode 14
 #define BlockCreationBytecodeSize 4
@@ -160,18 +160,18 @@
 #define CMMaxUsageCount 7
 #define CMMethod 2
 #define CMOpenPIC 5
-#define CMPSMULL 121
-#define CmpC32R 102
-#define CmpCqR 94
-#define CmpCwR 101
+#define CMPSMULL 123
+#define CmpC32R 104
+#define CmpCqR 96
+#define CmpCwR 103
 #define CmpNotOpcode 11
 #define CmpOpcode 10
-#define CmpRdRd 109
-#define CmpRR 88
+#define CmpRdRd 111
+#define CmpRR 90
 #define ConcreteIPReg 12
 #define ConcreteVarBaseReg 10
 #define ConstZero 1
-#define ConvertRRd 115
+#define ConvertRRd 117
 #define CS 2
 #define D0 0
 #define D1 1
@@ -184,7 +184,7 @@
 #define Debug DEBUGVM
 #define DisplacementMask 0x1F
 #define DisplacementX2N 0
-#define DivRdRd 113
+#define DivRdRd 115
 #define DPFPReg0 -21
 #define DPFPReg1 -22
 #define DPFPReg2 -23
@@ -266,11 +266,11 @@
 #define LE 13
 #define LinkReg -17
 #define Literal 2
-#define LoadEffectiveAddressMwrR 79
-#define LogicalShiftLeftCqR 86
-#define LogicalShiftLeftRR 87
-#define LogicalShiftRightCqR 84
-#define LogicalShiftRightRR 85
+#define LoadEffectiveAddressMwrR 81
+#define LogicalShiftLeftCqR 88
+#define LogicalShiftLeftRR 89
+#define LogicalShiftRightCqR 86
+#define LogicalShiftRightRR 87
 #define LookupRuleDynamicSuper 0x101
 #define LookupRuleImplicit 0x100
 #define LookupRuleSelf 0
@@ -300,15 +300,15 @@
 #define MoveCqR 67
 #define MoveCwR 68
 #define MoveM16rR 55
-#define MoveM64rRd 72
+#define MoveM64rRd 74
 #define MoveMbrR 63
 #define MoveMwrR 49
 #define MoveNotOpcode 15
 #define MoveOpcode 13
 #define MoveRAb 48
 #define MoveRAw 46
-#define MoveRdM64r 73
-#define MoveRdRd 71
+#define MoveRdM64r 75
+#define MoveRdRd 73
 #define MoveRMbr 64
 #define MoveRMwr 50
 #define MoveRR 44
@@ -316,11 +316,11 @@
 #define MoveRXwrR 52
 #define MoveXbrRR 65
 #define MoveXwrRR 51
-#define MSR 117
+#define MSR 119
 #define MULTIPLEBYTECODESETS 1
-#define MulRdRd 112
+#define MulRdRd 114
 #define NE 1
-#define NegateR 81
+#define NegateR 83
 #define NewspeakVM 1
 #define Nop 9
 #define NotFullyInitialized -1
@@ -333,24 +333,24 @@
 #define NumSendTrampolines 4
 #define NumSpecialSelectors 32
 #define NumTrampolines 72
-#define OrCqR 98
-#define OrCwR 106
+#define OrCqR 100
+#define OrCwR 108
 #define OrOpcode 12
-#define OrRR 92
+#define OrRR 94
 #define PC 15
 #define PCReg -19
 #define PL 5
-#define PopR 74
-#define PrefetchAw 78
+#define PopR 76
+#define PrefetchAw 80
 #define PrimCallCollectsProfileSamples 8
 #define PrimCallDoNotJIT 32
 #define PrimCallMayCallBack 4
 #define PrimCallNeedsNewMethod 1
 #define PrimCallNeedsPrimitiveFunction 2
 #define PrimErrWritePastObject 17
-#define PushCq 76
-#define PushCw 77
-#define PushR 75
+#define PushCq 78
+#define PushCw 79
+#define PushR 77
 #define R0 0
 #define R11 11
 #define R12 12
@@ -371,24 +371,24 @@
 #define SendNumArgsReg -6
 #define ShouldNotJIT -8
 #define SistaVM 0
-#define SMULL 116
+#define SMULL 118
 #define SmallContextSlots 22
 #define SP 13
 #define SPReg -2
-#define SqrtRd 114
+#define SqrtRd 116
 #define SSBaseOffset 1
 #define SSConstant 2
 #define SSRegister 3
 #define SSSpill 4
 #define StackPointerIndex 2
 #define Stop 14
-#define SubCqR 96
-#define SubCwR 104
+#define SubCqR 98
+#define SubCwR 106
 #define SubOpcode 2
-#define SubRdRd 111
-#define SubRR 90
+#define SubRdRd 113
+#define SubRR 92
 #define TempReg -4
-#define TstCqR 99
+#define TstCqR 101
 #define TstOpcode 8
 #define UnfailingPrimitive 3
 #define UnimplementedPrimitive -7
@@ -396,10 +396,10 @@
 #define VarBaseReg -20
 #define VC 7
 #define VS 6
-#define XorCqR 100
-#define XorCwR 107
+#define XorCqR 102
+#define XorCwR 109
 #define XorOpcode 1
-#define XorRR 93
+#define XorRR 95
 #define YoungSelectorInPIC -5
 
 
@@ -439,6 +439,7 @@
 static sqInt NoDbgRegParms numCheckFeaturesOpcodes(AbstractInstruction * self_in_numCheckFeaturesOpcodes);
 static AbstractInstruction * NoDbgRegParms relocateJumpLongBeforeFollowingAddressby(AbstractInstruction * self_in_relocateJumpLongBeforeFollowingAddressby, sqInt pc, sqInt delta);
 static AbstractInstruction * NoDbgRegParms resolveJumpTarget(AbstractInstruction * self_in_resolveJumpTarget);
+static sqInt NoDbgRegParms rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 static sqInt NoDbgRegParms setLabelOffset(AbstractInstruction * self_in_setLabelOffset, sqInt aValue);
 static sqInt NoDbgRegParms abstractRegisterForConcreteRegister(AbstractInstruction * self_in_abstractRegisterForConcreteRegister, sqInt reg);
 static sqInt NoDbgRegParms addsrnimmror(AbstractInstruction * self_in_addsrnimmror, sqInt destReg, sqInt srcReg, sqInt immediate, sqInt rot);
@@ -547,7 +548,6 @@
 static AbstractInstruction * NoDbgRegParms relocateCallBeforeReturnPCby(AbstractInstruction * self_in_relocateCallBeforeReturnPCby, sqInt retpc, sqInt delta);
 static sqInt NoDbgRegParms rewriteCallAttarget(AbstractInstruction * self_in_rewriteCallAttarget, usqInt callSiteReturnAddress, usqInt callTargetAddress);
 static sqInt NoDbgRegParms rewriteCallFullAttarget(AbstractInstruction * self_in_rewriteCallFullAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
-static sqInt NoDbgRegParms rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 static sqInt NoDbgRegParms rewriteJumpFullAttarget(AbstractInstruction * self_in_rewriteJumpFullAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 static sqInt NoDbgRegParms rewriteJumpLongAttarget(AbstractInstruction * self_in_rewriteJumpLongAttarget, usqInt callSiteReturnAddress, usqInt callTargetAddress);
 static sqInt NoDbgRegParms rewriteTransferAttarget(AbstractInstruction * self_in_rewriteTransferAttarget, usqInt callSiteReturnAddress, usqInt callTargetAddress);
@@ -965,6 +965,7 @@
 static sqInt NoDbgRegParms mustDumpLiterals(sqInt currentOpcodeIndex);
 static sqInt resetForBlockCompile(void);
 static sqInt saveForBlockCompile(void);
+static sqInt checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed(void);
 static sqInt compileBlockDispatch(void);
 static sqInt compileFallbackToInterpreterPrimitive(void);
 static void compileGetErrorCode(void);
@@ -1065,6 +1066,7 @@
 static sqInt genStoreAndPopTemporaryVariableBytecode(void);
 static sqInt genStoreRemoteTempLongBytecode(void);
 static void maybeCompileAllocFillerCheck(void);
+static sqInt NoDbgRegParms methodUsesPrimitiveErrorCode(sqInt methodHeader);
 static sqInt numSpecialSelectors(void);
 extern void recordCallOffsetIn(CogMethod *cogMethod);
 static sqInt NoDbgRegParms registerisInMask(sqInt reg, sqInt mask);
@@ -2248,6 +2250,19 @@
 }
 
 
+/*	Rewrite a conditional jump long to jump to target. This version defaults
+	to using
+	rewriteJumpLongAt:, which works for many ISAs. Subclasses override if
+	necessary.  */
+
+	/* CogAbstractInstruction>>#rewriteConditionalJumpLongAt:target: */
+static sqInt NoDbgRegParms
+rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress)
+{
+	return rewriteJumpLongAttarget(self_in_rewriteConditionalJumpLongAttarget, callSiteReturnAddress, callTargetAddress);
+}
+
+
 /*	Hack: To arrange that the block method field pushed in a block entry has
 	its MFMethodFlagIsBlockFlag bit set we provide labels with an offset. The
 	offset for the fakeHeader reference is MFMethodFlagIsBlockFlag. See
@@ -7408,14 +7423,7 @@
 	return rewriteFullTransferAttargetexpectedInstruction(self_in_rewriteCallFullAttarget, callSiteReturnAddress, callTargetAddress, 3778019132UL);
 }
 
-	/* CogARMCompiler>>#rewriteConditionalJumpLongAt:target: */
-static sqInt NoDbgRegParms
-rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress)
-{
-	return rewriteJumpLongAttarget(self_in_rewriteConditionalJumpLongAttarget, callSiteReturnAddress, callTargetAddress);
-}
 
-
 /*	Rewrite a full jump instruction to jump to a different target. This
 	variant is used to rewrite cached primitive calls where we load the target
 	address into ip
@@ -11032,12 +11040,12 @@
 generateMapAtstart(sqInt addressOrNull, sqInt startAddress)
 {
     unsigned char annotation;
-    sqInt delta;
+    usqInt delta;
     sqInt i;
     AbstractInstruction *instruction;
     sqInt length;
-    sqInt location;
-    sqInt mapEntry;
+    usqInt location;
+    usqInt mapEntry;
     sqInt maxDelta;
     usqInt mcpc;
 
@@ -14590,8 +14598,10 @@
 	/* rewite the tag via the first ldr */
 
 	classTagPC = followingAddress - (jumpLongConditionalByteSize(backEnd));
-	storeLiteralbeforeFollowingAddress(backEnd, newTag, classTagPC);
+	/* begin storeLiteral32:beforeFollowingAddress: */
+	storeLiteralbeforeFollowingAddress(((AbstractInstruction *) backEnd), newTag, classTagPC);
 
+	((AbstractInstruction *) backEnd);
 	rewriteConditionalJumpLongAttarget(backEnd, followingAddress, newTarget);
 }
 
@@ -21031,6 +21041,30 @@
 }
 
 
+/*	Answer if methodObj contains a quick primitive. In addition, if it has a
+	primitive that uses an error code, update the initialPC to skip this code.
+	The code to
+	process the error code is generated in compileFrameBuild. For fixups to
+	work correctly, the initialPC must be updated before scanning for backward
+	branches.  */
+
+	/* SimpleStackBasedCogit>>#checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed */
+static sqInt
+checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed(void)
+{
+    sqInt methodHeader;
+
+	if (primitiveIndex == 0) {
+		return 0;
+	}
+	methodHeader = methodHeaderOf(methodObj);
+	if (methodUsesPrimitiveErrorCode(methodHeader)) {
+		initialPC = (initialPC + (sizeOfCallPrimitiveBytecode(methodHeader))) + (sizeOfLongStoreTempBytecode(methodHeader));
+	}
+	return isQuickPrimitiveIndex(primitiveIndex);
+}
+
+
 /*	Compile the jump instruction(s) at the end of the method that dispatch to
 	each block body.
  */
@@ -22941,6 +22975,19 @@
 	}
 }
 
+
+/*	Answer if methodObj contains a primitive and uses the primitive error
+	code. 
+ */
+
+	/* SimpleStackBasedCogit>>#methodUsesPrimitiveErrorCode: */
+static sqInt NoDbgRegParms
+methodUsesPrimitiveErrorCode(sqInt methodHeader)
+{
+	return ((primitiveIndexOfMethodheader(methodObj, methodHeader)) > 0)
+	 && ((longStoreBytecodeForHeader(methodHeader)) == (fetchByteofObject(initialPC + (sizeOfCallPrimitiveBytecode(methodHeader)), methodObj)));
+}
+
 	/* SimpleStackBasedCogit>>#numSpecialSelectors */
 static sqInt
 numSpecialSelectors(void)
@@ -23910,10 +23957,8 @@
 		/* begin PushR: */
 		genoperand(PushR, SendNumArgsReg);
 	}
-	if ((primitiveIndex > 0)
-	 && ((longStoreBytecodeForHeader(methodHeader)) == (fetchByteofObject(initialPC + (sizeOfCallPrimitiveBytecode(methodHeader)), methodObj)))) {
+	if (methodUsesPrimitiveErrorCode(methodHeader)) {
 		compileGetErrorCode();
-		initialPC = (initialPC + (sizeOfCallPrimitiveBytecode(methodHeader))) + (sizeOfLongStoreTempBytecode(methodHeader));
 	}
 	/* begin MoveAw:R: */
 	address = stackLimitAddress();
@@ -28541,8 +28586,7 @@
 
 #  endif /* NewspeakVM */
 
-	if ((primitiveIndex > 0)
-	 && (isQuickPrimitiveIndex(primitiveIndex))) {
+	if (checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed()) {
 		return 0;
 	}
 	pc = (latestContinuation = initialPC);

Modified: branches/Cog/nsspursrc/vm/cogitIA32.c
===================================================================
--- branches/Cog/nsspursrc/vm/cogitIA32.c	2015-12-01 00:32:22 UTC (rev 3510)
+++ branches/Cog/nsspursrc/vm/cogitIA32.c	2015-12-02 18:26:38 UTC (rev 3511)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247
+	CCodeGenerator VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247
+	StackToRegisterMappingCogit VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247 " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -111,29 +111,29 @@
 
 
 /*** Constants ***/
-#define AddCqR 95
-#define AddCwR 103
-#define AddRdRd 110
-#define AddRR 89
+#define AddCqR 97
+#define AddCwR 105
+#define AddRdRd 112
+#define AddRR 91
 #define AlignmentNops 3
 #define AltBlockCreationBytecodeSize 3
 #define AltFirstSpecialSelector 80
 #define AltNumSpecialSelectors 32
-#define AndCqR 97
-#define AndCqRR 108
-#define AndCwR 105
-#define AndRR 91
+#define AndCqR 99
+#define AndCqRR 110
+#define AndCwR 107
+#define AndRR 93
 #define AnnotationShift 5
 #define Arg0Reg -7
 #define Arg1Reg -8
-#define ArithmeticShiftRightCqR 82
-#define ArithmeticShiftRightRR 83
+#define ArithmeticShiftRightCqR 84
+#define ArithmeticShiftRightRR 85
 #define BadRegisterSet 1
 #define BlockCreationBytecodeSize 4
 #define BytecodeSetHasDirectedSuperSend 0
 #define Call 10
 #define CallFull 11
-#define CDQ 116
+#define CDQ 118
 #define ClassArrayCompactIndex 51
 #define ClassBlockClosureCompactIndex 37
 #define ClassFloatCompactIndex 34
@@ -150,20 +150,20 @@
 #define CMMaxUsageCount 7
 #define CMMethod 2
 #define CMOpenPIC 5
-#define CMPXCHGAwR 124
-#define CMPXCHGMwrR 125
-#define CmpC32R 102
-#define CmpCqR 94
-#define CmpCwR 101
-#define CmpRdRd 109
-#define CmpRR 88
+#define CMPXCHGAwR 126
+#define CMPXCHGMwrR 127
+#define CmpC32R 104
+#define CmpCqR 96
+#define CmpCwR 103
+#define CmpRdRd 111
+#define CmpRR 90
 #define ConstZero 1
-#define ConvertRRd 115
-#define CPUID 119
+#define ConvertRRd 117
+#define CPUID 121
 #define Debug DEBUGVM
 #define DisplacementMask 0x1F
 #define DisplacementX2N 0
-#define DivRdRd 113
+#define DivRdRd 115
 #define DPFPReg0 -21
 #define DPFPReg1 -22
 #define DPFPReg2 -23
@@ -199,8 +199,8 @@
 #define GCModeNewSpace 2
 #define HasBytecodePC 4
 #define HeaderIndex 0
-#define IDIVR 117
-#define IMULRR 118
+#define IDIVR 119
+#define IMULRR 120
 #define InstanceSpecificationIndex 2
 #define InstructionPointerIndex 1
 #define InsufficientCodeSpace -2
@@ -248,15 +248,15 @@
 #define Label 1
 #define LargeContextSlots 62
 #define LastJump 43
-#define LFENCE 120
+#define LFENCE 122
 #define LinkReg -17
 #define Literal 2
-#define LOCK 123
-#define LoadEffectiveAddressMwrR 79
-#define LogicalShiftLeftCqR 86
-#define LogicalShiftLeftRR 87
-#define LogicalShiftRightCqR 84
-#define LogicalShiftRightRR 85
+#define LOCK 125
+#define LoadEffectiveAddressMwrR 81
+#define LogicalShiftLeftCqR 88
+#define LogicalShiftLeftRR 89
+#define LogicalShiftRightCqR 86
+#define LogicalShiftRightRR 87
 #define LookupRuleDynamicSuper 0x101
 #define LookupRuleImplicit 0x100
 #define LookupRuleSelf 0
@@ -274,7 +274,7 @@
 #define MethodCacheSelector 1
 #define MethodIndex 3
 #define MethodTooBig -4
-#define MFENCE 121
+#define MFENCE 123
 #define MFMethodFlagHasContextFlag 1
 #define MFMethodFlagIsBlockFlag 2
 #define ModReg 3
@@ -287,13 +287,13 @@
 #define MoveCqR 67
 #define MoveCwR 68
 #define MoveM16rR 55
-#define MoveM64rRd 72
+#define MoveM64rRd 74
 #define MoveMbrR 63
 #define MoveMwrR 49
 #define MoveRAb 48
 #define MoveRAw 46
-#define MoveRdM64r 73
-#define MoveRdRd 71
+#define MoveRdM64r 75
+#define MoveRdRd 73
 #define MoveRMbr 64
 #define MoveRMwr 50
 #define MoveRR 44
@@ -302,8 +302,8 @@
 #define MoveXbrRR 65
 #define MoveXwrRR 51
 #define MULTIPLEBYTECODESETS 1
-#define MulRdRd 112
-#define NegateR 81
+#define MulRdRd 114
+#define NegateR 83
 #define NewspeakVM 1
 #define Nop 9
 #define NotFullyInitialized -1
@@ -316,21 +316,21 @@
 #define NumSendTrampolines 4
 #define NumSpecialSelectors 32
 #define NumTrampolines 72
-#define OrCqR 98
-#define OrCwR 106
-#define OrRR 92
+#define OrCqR 100
+#define OrCwR 108
+#define OrRR 94
 #define PCReg -19
-#define PopR 74
-#define PrefetchAw 78
+#define PopR 76
+#define PrefetchAw 80
 #define PrimCallCollectsProfileSamples 8
 #define PrimCallDoNotJIT 32
 #define PrimCallMayCallBack 4
 #define PrimCallNeedsNewMethod 1
 #define PrimCallNeedsPrimitiveFunction 2
 #define PrimErrWritePastObject 17
-#define PushCq 76
-#define PushCw 77
-#define PushR 75
+#define PushCq 78
+#define PushCw 79
+#define PushR 77
 #define ReceiverIndex 5
 #define ReceiverResultReg -3
 #define RetN 12
@@ -339,33 +339,33 @@
 #define SelectorDoesNotUnderstand 20
 #define SenderIndex 0
 #define SendNumArgsReg -6
-#define SFENCE 122
+#define SFENCE 124
 #define ShouldNotJIT -8
 #define SIB1 0
 #define SIB4 2
 #define SistaVM 0
 #define SmallContextSlots 22
 #define SPReg -2
-#define SqrtRd 114
+#define SqrtRd 116
 #define SSBaseOffset 1
 #define SSConstant 2
 #define SSRegister 3
 #define SSSpill 4
 #define StackPointerIndex 2
 #define Stop 14
-#define SubCqR 96
-#define SubCwR 104
-#define SubRdRd 111
-#define SubRR 90
+#define SubCqR 98
+#define SubCwR 106
+#define SubRdRd 113
+#define SubRR 92
 #define TempReg -4
-#define TstCqR 99
+#define TstCqR 101
 #define UnfailingPrimitive 3
 #define UnimplementedPrimitive -7
 #define ValueIndex 1
 #define VarBaseReg -20
-#define XCHGAwR 126
-#define XCHGMwrR 127
-#define XCHGRR 128
+#define XCHGAwR 128
+#define XCHGMwrR 129
+#define XCHGRR 130
 #define XMM0L 0
 #define XMM1L 2
 #define XMM2L 4
@@ -374,8 +374,8 @@
 #define XMM5L 10
 #define XMM6L 12
 #define XMM7L 14
-#define XorCwR 107
-#define XorRR 93
+#define XorCwR 109
+#define XorRR 95
 #define YoungSelectorInPIC -5
 
 
@@ -416,6 +416,7 @@
 static AbstractInstruction * NoDbgRegParms relocateJumpLongBeforeFollowingAddressby(AbstractInstruction * self_in_relocateJumpLongBeforeFollowingAddressby, sqInt pc, sqInt delta);
 static AbstractInstruction * NoDbgRegParms resolveJumpTarget(AbstractInstruction * self_in_resolveJumpTarget);
 static sqInt NoDbgRegParms rewriteCallFullAttarget(AbstractInstruction * self_in_rewriteCallFullAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
+static sqInt NoDbgRegParms rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 static sqInt NoDbgRegParms rewriteJumpFullAttarget(AbstractInstruction * self_in_rewriteJumpFullAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 static sqInt NoDbgRegParms setLabelOffset(AbstractInstruction * self_in_setLabelOffset, sqInt aValue);
 static AbstractInstruction * NoDbgRegParms updateLabel(AbstractInstruction * self_in_updateLabel, AbstractInstruction *labelInstruction);
@@ -488,7 +489,6 @@
 static AbstractInstruction * NoDbgRegParms relocateCallBeforeReturnPCby(AbstractInstruction * self_in_relocateCallBeforeReturnPCby, sqInt retpc, sqInt delta);
 static AbstractInstruction * NoDbgRegParms relocateMethodReferenceBeforeAddressby(AbstractInstruction * self_in_relocateMethodReferenceBeforeAddressby, sqInt pc, sqInt delta);
 static sqInt NoDbgRegParms rewriteCallAttarget(AbstractInstruction * self_in_rewriteCallAttarget, usqInt callSiteReturnAddress, usqInt callTargetAddress);
-static sqInt NoDbgRegParms rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 static sqInt NoDbgRegParms rewriteCPICJumpAttarget(AbstractInstruction * self_in_rewriteCPICJumpAttarget, usqInt addressFollowingJump, usqInt jumpTargetAddress);
 static sqInt NoDbgRegParms rewriteInlineCacheAttagtarget(AbstractInstruction * self_in_rewriteInlineCacheAttagtarget, usqInt callSiteReturnAddress, sqInt cacheTag, usqInt callTargetAddress);
 static AbstractInstruction * NoDbgRegParms rewriteInlineCacheTagat(AbstractInstruction * self_in_rewriteInlineCacheTagat, sqInt cacheTag, sqInt callSiteReturnAddress);
@@ -875,6 +875,7 @@
 static sqInt NoDbgRegParms registerOrNil(CogSimStackEntry * self_in_registerOrNil);
 static CogSimStackEntry * NoDbgRegParms storeToReg(CogSimStackEntry * self_in_storeToReg, sqInt reg);
 static sqInt endSizeOffset(void);
+static sqInt checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed(void);
 static sqInt compileBlockDispatch(void);
 static sqInt compileFallbackToInterpreterPrimitive(void);
 static void compileGetErrorCode(void);
@@ -975,6 +976,7 @@
 static sqInt genStoreAndPopTemporaryVariableBytecode(void);
 static sqInt genStoreRemoteTempLongBytecode(void);
 static void maybeCompileAllocFillerCheck(void);
+static sqInt NoDbgRegParms methodUsesPrimitiveErrorCode(sqInt methodHeader);
 static sqInt numSpecialSelectors(void);
 extern void recordCallOffsetIn(CogMethod *cogMethod);
 static sqInt NoDbgRegParms registerisInMask(sqInt reg, sqInt mask);
@@ -2207,6 +2209,19 @@
 }
 
 
+/*	Rewrite a conditional jump long to jump to target. This version defaults
+	to using
+	rewriteJumpLongAt:, which works for many ISAs. Subclasses override if
+	necessary.  */
+
+	/* CogAbstractInstruction>>#rewriteConditionalJumpLongAt:target: */
+static sqInt NoDbgRegParms
+rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress)
+{
+	return rewriteJumpLongAttarget(self_in_rewriteConditionalJumpLongAttarget, callSiteReturnAddress, callTargetAddress);
+}
+
+
 /*	Rewrite a JumpFull instruction to jump to a different target. This variant
 	is used to rewrite cached primitive calls.
 	Answer the extent of the code change which is used to compute the range of
@@ -6454,14 +6469,7 @@
 	return 5;
 }
 
-	/* CogIA32Compiler>>#rewriteConditionalJumpLongAt:target: */
-static sqInt NoDbgRegParms
-rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress)
-{
-	return rewriteJumpLongAttarget(self_in_rewriteConditionalJumpLongAttarget, callSiteReturnAddress, callTargetAddress);
-}
 
-
 /*	Rewrite the short jump instruction to jump to a new cpic case target. */
 
 	/* CogIA32Compiler>>#rewriteCPICJumpAt:target: */
@@ -13727,6 +13735,7 @@
 	/* begin storeLiteral32:beforeFollowingAddress: */
 	storeLiteralbeforeFollowingAddress(((AbstractInstruction *) backEnd), newTag, classTagPC);
 
+	((AbstractInstruction *) backEnd);
 	rewriteConditionalJumpLongAttarget(backEnd, followingAddress, newTarget);
 }
 
@@ -20212,6 +20221,30 @@
 }
 
 
+/*	Answer if methodObj contains a quick primitive. In addition, if it has a
+	primitive that uses an error code, update the initialPC to skip this code.
+	The code to
+	process the error code is generated in compileFrameBuild. For fixups to
+	work correctly, the initialPC must be updated before scanning for backward
+	branches.  */
+
+	/* SimpleStackBasedCogit>>#checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed */
+static sqInt
+checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed(void)
+{
+    sqInt methodHeader;
+
+	if (primitiveIndex == 0) {
+		return 0;
+	}
+	methodHeader = methodHeaderOf(methodObj);
+	if (methodUsesPrimitiveErrorCode(methodHeader)) {
+		initialPC = (initialPC + (sizeOfCallPrimitiveBytecode(methodHeader))) + (sizeOfLongStoreTempBytecode(methodHeader));
+	}
+	return isQuickPrimitiveIndex(primitiveIndex);
+}
+
+
 /*	Compile the jump instruction(s) at the end of the method that dispatch to
 	each block body.
  */
@@ -22411,6 +22444,19 @@
 	}
 }
 
+
+/*	Answer if methodObj contains a primitive and uses the primitive error
+	code. 
+ */
+
+	/* SimpleStackBasedCogit>>#methodUsesPrimitiveErrorCode: */
+static sqInt NoDbgRegParms
+methodUsesPrimitiveErrorCode(sqInt methodHeader)
+{
+	return ((primitiveIndexOfMethodheader(methodObj, methodHeader)) > 0)
+	 && ((longStoreBytecodeForHeader(methodHeader)) == (fetchByteofObject(initialPC + (sizeOfCallPrimitiveBytecode(methodHeader)), methodObj)));
+}
+
 	/* SimpleStackBasedCogit>>#numSpecialSelectors */
 static sqInt
 numSpecialSelectors(void)
@@ -23408,10 +23454,8 @@
 		/* begin PushR: */
 		genoperand(PushR, SendNumArgsReg);
 	}
-	if ((primitiveIndex > 0)
-	 && ((longStoreBytecodeForHeader(methodHeader)) == (fetchByteofObject(initialPC + (sizeOfCallPrimitiveBytecode(methodHeader)), methodObj)))) {
+	if (methodUsesPrimitiveErrorCode(methodHeader)) {
 		compileGetErrorCode();
-		initialPC = (initialPC + (sizeOfCallPrimitiveBytecode(methodHeader))) + (sizeOfLongStoreTempBytecode(methodHeader));
 	}
 	/* begin MoveAw:R: */
 	address = stackLimitAddress();
@@ -28341,8 +28385,7 @@
 
 #  endif /* NewspeakVM */
 
-	if ((primitiveIndex > 0)
-	 && (isQuickPrimitiveIndex(primitiveIndex))) {
+	if (checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed()) {
 		return 0;
 	}
 	pc = (latestContinuation = initialPC);


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Mon Nov 30 16:28:35 PST 2015
   + Wed Dec  2 10:25:49 PST 2015

Modified: branches/Cog/spursistasrc/vm/cogit.h
===================================================================
--- branches/Cog/spursistasrc/vm/cogit.h	2015-12-01 00:32:22 UTC (rev 3510)
+++ branches/Cog/spursistasrc/vm/cogit.h	2015-12-02 18:26:38 UTC (rev 3511)
@@ -1,5 +1,5 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247
+	CCodeGenerator VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d
  */
 
 

Modified: branches/Cog/spursistasrc/vm/cogitARMv5.c
===================================================================
--- branches/Cog/spursistasrc/vm/cogitARMv5.c	2015-12-01 00:32:22 UTC (rev 3510)
+++ branches/Cog/spursistasrc/vm/cogitARMv5.c	2015-12-02 18:26:38 UTC (rev 3511)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247
+	CCodeGenerator VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d
    from
-	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247
+	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d
  */
-static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247 " __DATE__ ;
+static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -111,26 +111,26 @@
 
 
 /*** Constants ***/
-#define AddCqR 95
-#define AddCwR 103
+#define AddCqR 97
+#define AddCwR 105
 #define AddOpcode 4
-#define AddRdRd 110
-#define AddRR 89
+#define AddRdRd 112
+#define AddRR 91
 #define AL 14
 #define AlignmentNops 3
 #define AltBlockCreationBytecodeSize 3
 #define AltFirstSpecialSelector 96
 #define AltNumSpecialSelectors 32
-#define AndCqR 97
-#define AndCqRR 108
-#define AndCwR 105
+#define AndCqR 99
+#define AndCqRR 110
+#define AndCwR 107
 #define AndOpcode 0
-#define AndRR 91
+#define AndRR 93
 #define AnnotationShift 5
 #define Arg0Reg -7
 #define Arg1Reg -8
-#define ArithmeticShiftRightCqR 82
-#define ArithmeticShiftRightRR 83
+#define ArithmeticShiftRightCqR 84
+#define ArithmeticShiftRightRR 85
 #define BadRegisterSet 1
 #define BicOpcode 14
 #define BlockCreationBytecodeSize 4
@@ -158,18 +158,18 @@
 #define CMMaxUsageCount 7
 #define CMMethod 2
 #define CMOpenPIC 5
-#define CMPSMULL 121
-#define CmpC32R 102
-#define CmpCqR 94
-#define CmpCwR 101
+#define CMPSMULL 123
+#define CmpC32R 104
+#define CmpCqR 96
+#define CmpCwR 103
 #define CmpNotOpcode 11
 #define CmpOpcode 10
-#define CmpRdRd 109
-#define CmpRR 88
+#define CmpRdRd 111
+#define CmpRR 90
 #define ConcreteIPReg 12
 #define ConcreteVarBaseReg 10
 #define ConstZero 1
-#define ConvertRRd 115
+#define ConvertRRd 117
 #define CounterBytes 4
 #define CS 2
 #define D0 0
@@ -183,7 +183,7 @@
 #define Debug DEBUGVM
 #define DisplacementMask 0x1F
 #define DisplacementX2N 0
-#define DivRdRd 113
+#define DivRdRd 115
 #define DPFPReg0 -21
 #define DPFPReg1 -22
 #define DPFPReg2 -23
@@ -265,11 +265,11 @@
 #define LE 13
 #define LinkReg -17
 #define Literal 2
-#define LoadEffectiveAddressMwrR 79
-#define LogicalShiftLeftCqR 86
-#define LogicalShiftLeftRR 87
-#define LogicalShiftRightCqR 84
-#define LogicalShiftRightRR 85
+#define LoadEffectiveAddressMwrR 81
+#define LogicalShiftLeftCqR 88
+#define LogicalShiftLeftRR 89
+#define LogicalShiftRightCqR 86
+#define LogicalShiftRightRR 87
 #define LR 14
 #define LS 9
 #define LT 11
@@ -297,15 +297,15 @@
 #define MoveCqR 67
 #define MoveCwR 68
 #define MoveM16rR 55
-#define MoveM64rRd 72
+#define MoveM64rRd 74
 #define MoveMbrR 63
 #define MoveMwrR 49
 #define MoveNotOpcode 15
 #define MoveOpcode 13
 #define MoveRAb 48
 #define MoveRAw 46
-#define MoveRdM64r 73
-#define MoveRdRd 71
+#define MoveRdM64r 75
+#define MoveRdRd 73
 #define MoveRMbr 64
 #define MoveRMwr 50
 #define MoveRR 44
@@ -313,11 +313,11 @@
 #define MoveRXwrR 52
 #define MoveXbrRR 65
 #define MoveXwrRR 51
-#define MSR 117
+#define MSR 119
 #define MULTIPLEBYTECODESETS 1
-#define MulRdRd 112
+#define MulRdRd 114
 #define NE 1
-#define NegateR 81
+#define NegateR 83
 #define NewspeakVM 0
 #define Nop 9
 #define NotFullyInitialized -1
@@ -326,15 +326,15 @@
 #define NumSendTrampolines 4
 #define NumSpecialSelectors 32
 #define NumTrampolines 59
-#define OrCqR 98
-#define OrCwR 106
+#define OrCqR 100
+#define OrCwR 108
 #define OrOpcode 12
-#define OrRR 92
+#define OrRR 94
 #define PC 15
 #define PCReg -19
 #define PL 5
-#define PopR 74
-#define PrefetchAw 78
+#define PopR 76
+#define PrefetchAw 80
 #define PrimCallCollectsProfileSamples 8
 #define PrimCallDoNotJIT 32
 #define PrimCallMayCallBack 4
@@ -342,9 +342,9 @@
 #define PrimCallNeedsPrimitiveFunction 2
 #define PrimErrNoMemory 9
 #define PrimErrWritePastObject 17
-#define PushCq 76
-#define PushCw 77
-#define PushR 75
+#define PushCq 78
+#define PushCw 79
+#define PushR 77
 #define R0 0
 #define R11 11
 #define R12 12
@@ -365,24 +365,24 @@
 #define SendNumArgsReg -6
 #define ShouldNotJIT -8
 #define SistaVM 1
-#define SMULL 116
+#define SMULL 118
 #define SmallContextSlots 22
 #define SP 13
 #define SPReg -2
-#define SqrtRd 114
+#define SqrtRd 116
 #define SSBaseOffset 1
 #define SSConstant 2
 #define SSRegister 3
 #define SSSpill 4
 #define StackPointerIndex 2
 #define Stop 14
-#define SubCqR 96
-#define SubCwR 104
+#define SubCqR 98
+#define SubCwR 106
 #define SubOpcode 2
-#define SubRdRd 111
-#define SubRR 90
+#define SubRdRd 113
+#define SubRR 92
 #define TempReg -4
-#define TstCqR 99
+#define TstCqR 101
 #define TstOpcode 8
 #define UnfailingPrimitive 3
 #define UnimplementedPrimitive -7
@@ -390,10 +390,10 @@
 #define VarBaseReg -20
 #define VC 7
 #define VS 6
-#define XorCqR 100
-#define XorCwR 107
+#define XorCqR 102
+#define XorCwR 109
 #define XorOpcode 1
-#define XorRR 93
+#define XorRR 95
 #define YoungSelectorInPIC -5
 
 
@@ -433,6 +433,7 @@
 static sqInt NoDbgRegParms numCheckFeaturesOpcodes(AbstractInstruction * self_in_numCheckFeaturesOpcodes);
 static AbstractInstruction * NoDbgRegParms relocateJumpLongBeforeFollowingAddressby(AbstractInstruction * self_in_relocateJumpLongBeforeFollowingAddressby, sqInt pc, sqInt delta);
 static AbstractInstruction * NoDbgRegParms resolveJumpTarget(AbstractInstruction * self_in_resolveJumpTarget);
+static sqInt NoDbgRegParms rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 static sqInt NoDbgRegParms setLabelOffset(AbstractInstruction * self_in_setLabelOffset, sqInt aValue);
 static sqInt NoDbgRegParms abstractRegisterForConcreteRegister(AbstractInstruction * self_in_abstractRegisterForConcreteRegister, sqInt reg);
 static sqInt NoDbgRegParms addsrnimmror(AbstractInstruction * self_in_addsrnimmror, sqInt destReg, sqInt srcReg, sqInt immediate, sqInt rot);
@@ -541,7 +542,6 @@
 static AbstractInstruction * NoDbgRegParms relocateCallBeforeReturnPCby(AbstractInstruction * self_in_relocateCallBeforeReturnPCby, sqInt retpc, sqInt delta);
 static sqInt NoDbgRegParms rewriteCallAttarget(AbstractInstruction * self_in_rewriteCallAttarget, usqInt callSiteReturnAddress, usqInt callTargetAddress);
 static sqInt NoDbgRegParms rewriteCallFullAttarget(AbstractInstruction * self_in_rewriteCallFullAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
-static sqInt NoDbgRegParms rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 static sqInt NoDbgRegParms rewriteJumpFullAttarget(AbstractInstruction * self_in_rewriteJumpFullAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 static sqInt NoDbgRegParms rewriteJumpLongAttarget(AbstractInstruction * self_in_rewriteJumpLongAttarget, usqInt callSiteReturnAddress, usqInt callTargetAddress);
 static sqInt NoDbgRegParms rewriteTransferAttarget(AbstractInstruction * self_in_rewriteTransferAttarget, usqInt callSiteReturnAddress, usqInt callTargetAddress);
@@ -957,6 +957,7 @@
 static sqInt NoDbgRegParms literalInstructionInRange(AbstractInstruction *litInst);
 static AbstractInstruction * NoDbgRegParms locateLiteral(sqInt aLiteral);
 static sqInt NoDbgRegParms mustDumpLiterals(sqInt currentOpcodeIndex);
+static sqInt checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed(void);
 static sqInt compileBlockDispatch(void);
 static sqInt compileFallbackToInterpreterPrimitive(void);
 static void compileGetErrorCode(void);
@@ -1048,6 +1049,7 @@
 static sqInt genStoreAndPopTemporaryVariableBytecode(void);
 static sqInt genStoreRemoteTempLongBytecode(void);
 static void maybeCompileAllocFillerCheck(void);
+static sqInt NoDbgRegParms methodUsesPrimitiveErrorCode(sqInt methodHeader);
 static sqInt numSpecialSelectors(void);
 extern void recordCallOffsetIn(CogMethod *cogMethod);
 static sqInt NoDbgRegParms registerisInMask(sqInt reg, sqInt mask);
@@ -2246,6 +2248,19 @@
 }
 
 
+/*	Rewrite a conditional jump long to jump to target. This version defaults
+	to using
+	rewriteJumpLongAt:, which works for many ISAs. Subclasses override if
+	necessary.  */
+
+	/* CogAbstractInstruction>>#rewriteConditionalJumpLongAt:target: */
+static sqInt NoDbgRegParms
+rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress)
+{
+	return rewriteJumpLongAttarget(self_in_rewriteConditionalJumpLongAttarget, callSiteReturnAddress, callTargetAddress);
+}
+
+
 /*	Hack: To arrange that the block method field pushed in a block entry has
 	its MFMethodFlagIsBlockFlag bit set we provide labels with an offset. The
 	offset for the fakeHeader reference is MFMethodFlagIsBlockFlag. See
@@ -7406,14 +7421,7 @@
 	return rewriteFullTransferAttargetexpectedInstruction(self_in_rewriteCallFullAttarget, callSiteReturnAddress, callTargetAddress, 3778019132UL);
 }
 
-	/* CogARMCompiler>>#rewriteConditionalJumpLongAt:target: */
-static sqInt NoDbgRegParms
-rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress)
-{
-	return rewriteJumpLongAttarget(self_in_rewriteConditionalJumpLongAttarget, callSiteReturnAddress, callTargetAddress);
-}
 
-
 /*	Rewrite a full jump instruction to jump to a different target. This
 	variant is used to rewrite cached primitive calls where we load the target
 	address into ip
@@ -14124,8 +14132,10 @@
 	/* rewite the tag via the first ldr */
 
 	classTagPC = followingAddress - (jumpLongConditionalByteSize(backEnd));
-	storeLiteralbeforeFollowingAddress(backEnd, newTag, classTagPC);
+	/* begin storeLiteral32:beforeFollowingAddress: */
+	storeLiteralbeforeFollowingAddress(((AbstractInstruction *) backEnd), newTag, classTagPC);
 
+	((AbstractInstruction *) backEnd);
 	rewriteConditionalJumpLongAttarget(backEnd, followingAddress, newTarget);
 }
 
@@ -20121,6 +20131,30 @@
 }
 
 
+/*	Answer if methodObj contains a quick primitive. In addition, if it has a
+	primitive that uses an error code, update the initialPC to skip this code.
+	The code to
+	process the error code is generated in compileFrameBuild. For fixups to
+	work correctly, the initialPC must be updated before scanning for backward
+	branches.  */
+
+	/* SimpleStackBasedCogit>>#checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed */
+static sqInt
+checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed(void)
+{
+    sqInt methodHeader;
+
+	if (primitiveIndex == 0) {
+		return 0;
+	}
+	methodHeader = methodHeaderOf(methodObj);
+	if (methodUsesPrimitiveErrorCode(methodHeader)) {
+		initialPC = (initialPC + (sizeOfCallPrimitiveBytecode(methodHeader))) + (sizeOfLongStoreTempBytecode(methodHeader));
+	}
+	return isQuickPrimitiveIndex(primitiveIndex);
+}
+
+
 /*	Compile the jump instruction(s) at the end of the method that dispatch to
 	each block body.
  */
@@ -21903,6 +21937,19 @@
 	}
 }
 
+
+/*	Answer if methodObj contains a primitive and uses the primitive error
+	code. 
+ */
+
+	/* SimpleStackBasedCogit>>#methodUsesPrimitiveErrorCode: */
+static sqInt NoDbgRegParms
+methodUsesPrimitiveErrorCode(sqInt methodHeader)
+{
+	return ((primitiveIndexOfMethodheader(methodObj, methodHeader)) > 0)
+	 && ((longStoreBytecodeForHeader(methodHeader)) == (fetchByteofObject(initialPC + (sizeOfCallPrimitiveBytecode(methodHeader)), methodObj)));
+}
+
 	/* SimpleStackBasedCogit>>#numSpecialSelectors */
 static sqInt
 numSpecialSelectors(void)
@@ -22446,10 +22493,8 @@
 		/* begin PushR: */
 		genoperand(PushR, SendNumArgsReg);
 	}
-	if ((primitiveIndex > 0)
-	 && ((longStoreBytecodeForHeader(methodHeader)) == (fetchByteofObject(initialPC + (sizeOfCallPrimitiveBytecode(methodHeader)), methodObj)))) {
+	if (methodUsesPrimitiveErrorCode(methodHeader)) {
 		compileGetErrorCode();
-		initialPC = (initialPC + (sizeOfCallPrimitiveBytecode(methodHeader))) + (sizeOfLongStoreTempBytecode(methodHeader));
 	}
 	/* begin MoveAw:R: */
 	address = stackLimitAddress();
@@ -24437,8 +24482,7 @@
 
 #  endif /* NewspeakVM */
 
-	if ((primitiveIndex > 0)
-	 && (isQuickPrimitiveIndex(primitiveIndex))) {
+	if (checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed()) {
 		return 0;
 	}
 	pc = (latestContinuation = initialPC);

Modified: branches/Cog/spursistasrc/vm/cogitIA32.c
===================================================================
--- branches/Cog/spursistasrc/vm/cogitIA32.c	2015-12-01 00:32:22 UTC (rev 3510)
+++ branches/Cog/spursistasrc/vm/cogitIA32.c	2015-12-02 18:26:38 UTC (rev 3511)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247
+	CCodeGenerator VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d
    from
-	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247
+	SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d
  */
-static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1535 uuid: eceebca6-4bc3-4640-b1eb-18e0ea917247 " __DATE__ ;
+static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.1539 uuid: 7d957563-4269-4950-9f7d-3d2dde2ac18d " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;
 
 
@@ -109,29 +109,29 @@
 
 
 /*** Constants ***/
-#define AddCqR 95
-#define AddCwR 103
-#define AddRdRd 110
-#define AddRR 89
+#define AddCqR 97
+#define AddCwR 105
+#define AddRdRd 112
+#define AddRR 91
 #define AlignmentNops 3
 #define AltBlockCreationBytecodeSize 3
 #define AltFirstSpecialSelector 96
 #define AltNumSpecialSelectors 32
-#define AndCqR 97
-#define AndCqRR 108
-#define AndCwR 105
-#define AndRR 91
+#define AndCqR 99
+#define AndCqRR 110
+#define AndCwR 107
+#define AndRR 93
 #define AnnotationShift 5
 #define Arg0Reg -7
 #define Arg1Reg -8
-#define ArithmeticShiftRightCqR 82
-#define ArithmeticShiftRightRR 83
+#define ArithmeticShiftRightCqR 84
+#define ArithmeticShiftRightRR 85
 #define BadRegisterSet 1
 #define BlockCreationBytecodeSize 4
 #define BytecodeSetHasDirectedSuperSend 1
 #define Call 10
 #define CallFull 11
-#define CDQ 116
+#define CDQ 118
 #define ClassArrayCompactIndex 51
 #define ClassBlockClosureCompactIndex 37
 #define ClassFloatCompactIndex 34
@@ -148,21 +148,21 @@
 #define CMMaxUsageCount 7
 #define CMMethod 2
 #define CMOpenPIC 5
-#define CMPXCHGAwR 124
-#define CMPXCHGMwrR 125
-#define CmpC32R 102
-#define CmpCqR 94
-#define CmpCwR 101
-#define CmpRdRd 109
-#define CmpRR 88
+#define CMPXCHGAwR 126
+#define CMPXCHGMwrR 127
+#define CmpC32R 104
+#define CmpCqR 96
+#define CmpCwR 103
+#define CmpRdRd 111
+#define CmpRR 90
 #define ConstZero 1
-#define ConvertRRd 115
+#define ConvertRRd 117
 #define CounterBytes 4
-#define CPUID 119
+#define CPUID 121
 #define Debug DEBUGVM
 #define DisplacementMask 0x1F
 #define DisplacementX2N 0
-#define DivRdRd 113
+#define DivRdRd 115
 #define DPFPReg0 -21
 #define DPFPReg1 -22
 #define DPFPReg2 -23
@@ -198,8 +198,8 @@
 #define GCModeNewSpace 2
 #define HasBytecodePC 4
 #define HeaderIndex 0
-#define IDIVR 117
-#define IMULRR 118
+#define IDIVR 119
+#define IMULRR 120
 #define InstanceSpecificationIndex 2
 #define InstructionPointerIndex 1
 #define InsufficientCodeSpace -2
@@ -247,15 +247,15 @@
 #define Label 1
 #define LargeContextSlots 62
 #define LastJump 43
-#define LFENCE 120
+#define LFENCE 122
 #define LinkReg -17
 #define Literal 2
-#define LOCK 123
-#define LoadEffectiveAddressMwrR 79
-#define LogicalShiftLeftCqR 86
-#define LogicalShiftLeftRR 87
-#define LogicalShiftRightCqR 84
-#define LogicalShiftRightRR 85
+#define LOCK 125
+#define LoadEffectiveAddressMwrR 81
+#define LogicalShiftLeftCqR 88
+#define LogicalShiftLeftRR 89
+#define LogicalShiftRightCqR 86
+#define LogicalShiftRightRR 87
 #define MapEnd 0
 #define MaxCompiledPrimitiveIndex 222
 #define MaxCounterValue 0xFFFF
@@ -271,7 +271,7 @@
 #define MethodCacheSelector 1
 #define MethodIndex 3
 #define MethodTooBig -4
-#define MFENCE 121
+#define MFENCE 123
 #define MFMethodFlagHasContextFlag 1
 #define MFMethodFlagIsBlockFlag 2
 #define ModReg 3
@@ -284,13 +284,13 @@
 #define MoveCqR 67
 #define MoveCwR 68
 #define MoveM16rR 55
-#define MoveM64rRd 72
+#define MoveM64rRd 74
 #define MoveMbrR 63
 #define MoveMwrR 49
 #define MoveRAb 48
 #define MoveRAw 46
-#define MoveRdM64r 73
-#define MoveRdRd 71
+#define MoveRdM64r 75
+#define MoveRdRd 73
 #define MoveRMbr 64
 #define MoveRMwr 50
 #define MoveRR 44
@@ -299,8 +299,8 @@
 #define MoveXbrRR 65
 #define MoveXwrRR 51
 #define MULTIPLEBYTECODESETS 1
-#define MulRdRd 112
-#define NegateR 81
+#define MulRdRd 114
+#define NegateR 83
 #define NewspeakVM 0
 #define Nop 9
 #define NotFullyInitialized -1
@@ -309,12 +309,12 @@
 #define NumSendTrampolines 4
 #define NumSpecialSelectors 32
 #define NumTrampolines 59
-#define OrCqR 98
-#define OrCwR 106
-#define OrRR 92
+#define OrCqR 100
+#define OrCwR 108
+#define OrRR 94
 #define PCReg -19
-#define PopR 74
-#define PrefetchAw 78
+#define PopR 76
+#define PrefetchAw 80
 #define PrimCallCollectsProfileSamples 8
 #define PrimCallDoNotJIT 32
 #define PrimCallMayCallBack 4
@@ -322,9 +322,9 @@
 #define PrimCallNeedsPrimitiveFunction 2
 #define PrimErrNoMemory 9
 #define PrimErrWritePastObject 17
-#define PushCq 76
-#define PushCw 77
-#define PushR 75
+#define PushCq 78
+#define PushCw 79
+#define PushR 77
 #define ReceiverIndex 5
 #define ReceiverResultReg -3
 #define RetN 12
@@ -333,33 +333,33 @@
 #define SelectorDoesNotUnderstand 20
 #define SenderIndex 0
 #define SendNumArgsReg -6
-#define SFENCE 122
+#define SFENCE 124
 #define ShouldNotJIT -8
 #define SIB1 0
 #define SIB4 2
 #define SistaVM 1
 #define SmallContextSlots 22
 #define SPReg -2
-#define SqrtRd 114
+#define SqrtRd 116
 #define SSBaseOffset 1
 #define SSConstant 2
 #define SSRegister 3
 #define SSSpill 4
 #define StackPointerIndex 2
 #define Stop 14
-#define SubCqR 96
-#define SubCwR 104
-#define SubRdRd 111
-#define SubRR 90
+#define SubCqR 98
+#define SubCwR 106
+#define SubRdRd 113
+#define SubRR 92
 #define TempReg -4
-#define TstCqR 99
+#define TstCqR 101
 #define UnfailingPrimitive 3
 #define UnimplementedPrimitive -7
 #define ValueIndex 1
 #define VarBaseReg -20
-#define XCHGAwR 126
-#define XCHGMwrR 127
-#define XCHGRR 128
+#define XCHGAwR 128
+#define XCHGMwrR 129
+#define XCHGRR 130
 #define XMM0L 0
 #define XMM1L 2
 #define XMM2L 4
@@ -368,8 +368,8 @@
 #define XMM5L 10
 #define XMM6L 12
 #define XMM7L 14
-#define XorCwR 107
-#define XorRR 93
+#define XorCwR 109
+#define XorRR 95
 #define YoungSelectorInPIC -5
 
 
@@ -410,6 +410,7 @@
 static AbstractInstruction * NoDbgRegParms relocateJumpLongBeforeFollowingAddressby(AbstractInstruction * self_in_relocateJumpLongBeforeFollowingAddressby, sqInt pc, sqInt delta);
 static AbstractInstruction * NoDbgRegParms resolveJumpTarget(AbstractInstruction * self_in_resolveJumpTarget);
 static sqInt NoDbgRegParms rewriteCallFullAttarget(AbstractInstruction * self_in_rewriteCallFullAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
+static sqInt NoDbgRegParms rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 static sqInt NoDbgRegParms rewriteJumpFullAttarget(AbstractInstruction * self_in_rewriteJumpFullAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 static sqInt NoDbgRegParms setLabelOffset(AbstractInstruction * self_in_setLabelOffset, sqInt aValue);
 static AbstractInstruction * NoDbgRegParms updateLabel(AbstractInstruction * self_in_updateLabel, AbstractInstruction *labelInstruction);
@@ -481,7 +482,6 @@
 static AbstractInstruction * NoDbgRegParms relocateCallBeforeReturnPCby(AbstractInstruction * self_in_relocateCallBeforeReturnPCby, sqInt retpc, sqInt delta);
 static AbstractInstruction * NoDbgRegParms relocateMethodReferenceBeforeAddressby(AbstractInstruction * self_in_relocateMethodReferenceBeforeAddressby, sqInt pc, sqInt delta);
 static sqInt NoDbgRegParms rewriteCallAttarget(AbstractInstruction * self_in_rewriteCallAttarget, usqInt callSiteReturnAddress, usqInt callTargetAddress);
-static sqInt NoDbgRegParms rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress);
 static sqInt NoDbgRegParms rewriteCPICJumpAttarget(AbstractInstruction * self_in_rewriteCPICJumpAttarget, usqInt addressFollowingJump, usqInt jumpTargetAddress);
 static sqInt NoDbgRegParms rewriteInlineCacheAttagtarget(AbstractInstruction * self_in_rewriteInlineCacheAttagtarget, usqInt callSiteReturnAddress, sqInt cacheTag, usqInt callTargetAddress);
 static AbstractInstruction * NoDbgRegParms rewriteInlineCacheTagat(AbstractInstruction * self_in_rewriteInlineCacheTagat, sqInt cacheTag, sqInt callSiteReturnAddress);
@@ -868,6 +868,7 @@
 static sqInt NoDbgRegParms registerOrNil(CogSimStackEntry * self_in_registerOrNil);
 static CogSimStackEntry * NoDbgRegParms storeToReg(CogSimStackEntry * self_in_storeToReg, sqInt reg);
 static sqInt endSizeOffset(void);
+static sqInt checkForQuickPrimitiveAdjustingIntialPCIfErrorCodeUsed(void);
 static sqInt compileBlockDispatch(void);
 static sqInt compileFallbackToInterpreterPrimitive(void);
 static void compileGetErrorCode(void);
@@ -959,6 +960,7 @@
 static sqInt genStoreAndPopTemporaryVariableBytecode(void);
 static sqInt genStoreRemoteTempLongBytecode(void);
 static void maybeCompileAllocFillerCheck(void);
+static sqInt NoDbgRegParms methodUsesPrimitiveErrorCode(sqInt methodHeader);
 static sqInt numSpecialSelectors(void);
 extern void recordCallOffsetIn(CogMethod *cogMethod);
 static sqInt NoDbgRegParms registerisInMask(sqInt reg, sqInt mask);
@@ -2206,6 +2208,19 @@
 }
 
 
+/*	Rewrite a conditional jump long to jump to target. This version defaults
+	to using
+	rewriteJumpLongAt:, which works for many ISAs. Subclasses override if
+	necessary.  */
+
+	/* CogAbstractInstruction>>#rewriteConditionalJumpLongAt:target: */
+static sqInt NoDbgRegParms
+rewriteConditionalJumpLongAttarget(AbstractInstruction * self_in_rewriteConditionalJumpLongAttarget, sqInt callSiteReturnAddress, sqInt callTargetAddress)
+{
+	return rewriteJumpLongAttarget(self_in_rewriteConditionalJumpLongAttarget, callSiteReturnAddress, callTargetAddress);
+}
+
+

@@ Diff output truncated at 50000 characters. @@


More information about the Vm-dev mailing list