Skip to content

Commit

Permalink
CogVM source as per VMMaker.oscog-eem.3148
Browse files Browse the repository at this point in the history
Spur CoInterpreter: fix crashes of vmParameterAt: on WIndows under Clang.
The PrimCallOnSmalltalkStack needs PrimCallOnSmalltalkStackAlign2x also.
  • Loading branch information
eliotmiranda committed Feb 8, 2022
1 parent 2410b68 commit 7af8010
Show file tree
Hide file tree
Showing 27 changed files with 233 additions and 215 deletions.
27 changes: 14 additions & 13 deletions src/spur32.cog.lowcode/cointerp.c
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3147 uuid: 409be388-ed75-49dc-a648-c7051eb48168
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3148 uuid: 55858401-f9a2-4458-ab45-b576bac43a1c
from
CoInterpreter VMMaker.oscog-eem.3147 uuid: 409be388-ed75-49dc-a648-c7051eb48168
CoInterpreter VMMaker.oscog-eem.3148 uuid: 55858401-f9a2-4458-ab45-b576bac43a1c
*/
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3147 uuid: 409be388-ed75-49dc-a648-c7051eb48168 " __DATE__ ;
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3148 uuid: 55858401-f9a2-4458-ab45-b576bac43a1c " __DATE__ ;
char *__interpBuildInfo = __buildInfo;


Expand Down Expand Up @@ -249,6 +249,7 @@ warningat(const char *s, int l) { /* ditto with line number. */
#define PrimCallMayEndureCodeCompaction 16
#define PrimCallNeedsNewMethod 8
#define PrimCallOnSmalltalkStack 1
#define PrimCallOnSmalltalkStackAlign2x 2
#define PrimErrBadArgument 3
#define PrimErrBadIndex 4
#define PrimErrBadMethod 12
Expand Down Expand Up @@ -2029,7 +2030,7 @@ static signed short primitiveMetadataTable[MaxPrimitiveIndex + 2 /* 578 */] = {
/*77*/ 0, 0, 0,
/*80*/ -256,-256,-256, 8, 8, 0, 0x100, 0, 0x200,-256,-256, 0, 0, 0, 0x100,-256,-256,
/*97*/ -256, 0, 0,
/*100*/ 264, 0x200, 0x100, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256,
/*100*/ 264, 0x200, 0x200, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256,
/*115*/ 0x100, 0, 24, 264, 0,
/*120*/ 536, 0x100,-256,-256, 1, 0, 0, 0, 0,-255,-256,-256, 0, 0, 0,-256, 0,-256,-256,
/*139*/ 0,
Expand Down Expand Up @@ -2694,7 +2695,7 @@ sqInt suppressHeartbeatFlag;
sqInt debugCallbackInvokes;
sqInt debugCallbackReturns;
sqInt checkedPluginName;
const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3147]";
const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3148]";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
char expensiveAsserts = 0;
int (*showSurfaceFn)(sqIntptr_t, int, int, int, int);
Expand Down Expand Up @@ -39093,7 +39094,7 @@ mnuMethodOrNilFor(sqInt rcvr)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt currentClass;
sqInt dictionary;
sqInt index;
usqInt index;
usqInt length;
sqInt mask;
sqInt methodArray;
Expand Down Expand Up @@ -39142,7 +39143,7 @@ mnuMethodOrNilFor(sqInt rcvr)
wrapAround = 0;
while (1) {
/* begin fetchPointer:ofObject: */
nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))));
nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord())));
if (nextSelector == GIV(nilObj)) {
mnuMethod = null;
goto l11;
Expand All @@ -39160,7 +39161,7 @@ mnuMethodOrNilFor(sqInt rcvr)
}
methodArray = objOop;
/* begin followField:ofObject: */
objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord())))));
objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord())));
if (((!(objOop1 & (tagMask()))))
&& ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) {
objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1);
Expand Down Expand Up @@ -40099,7 +40100,7 @@ primitivePropertyFlagsnumArgs(sqInt primIndex, sqInt numArgs)
&& (numArgs == 1)) {

/* vmParameterAt: */
return (baseFlags + PrimCallOnSmalltalkStack) + PrimCallIsInternalPrim;
return ((baseFlags + PrimCallOnSmalltalkStack) + PrimCallOnSmalltalkStackAlign2x) + PrimCallIsInternalPrim;
}
return baseFlags | ((primitiveMetadataTable[primIndex]) & SpurPrimitiveFlagsMask);
}
Expand Down Expand Up @@ -53381,7 +53382,7 @@ primitiveInvokeObjectAsMethod(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt i;
sqInt lookupClassTag;
usqInt runArgs;
sqInt runArgs;
sqInt runReceiver;
char *sp;
char *sp1;
Expand Down Expand Up @@ -86679,7 +86680,7 @@ lookupSelectorinClass(sqInt selector, sqInt class)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt currentClass;
sqInt dictionary;
sqInt index;
usqInt index;
usqInt length;
sqInt mask;
sqInt meth;
Expand Down Expand Up @@ -86723,7 +86724,7 @@ lookupSelectorinClass(sqInt selector, sqInt class)
wrapAround = 0;
while (1) {
/* begin fetchPointer:ofObject: */
nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))));
nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord())));
if (nextSelector == GIV(nilObj)) {
meth = null;
goto l8;
Expand All @@ -86741,7 +86742,7 @@ lookupSelectorinClass(sqInt selector, sqInt class)
}
methodArray = objOop2;
/* begin followField:ofObject: */
objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord())))));
objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord())));
if (((!(objOop1 & (tagMask()))))
&& ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) {
objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1);
Expand Down
2 changes: 1 addition & 1 deletion src/spur32.cog.lowcode/cointerp.h
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3147 uuid: 409be388-ed75-49dc-a648-c7051eb48168
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3148 uuid: 55858401-f9a2-4458-ab45-b576bac43a1c
*/


Expand Down
27 changes: 14 additions & 13 deletions src/spur32.cog.lowcode/gcc3x-cointerp.c
Expand Up @@ -2,11 +2,11 @@


/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3147 uuid: 409be388-ed75-49dc-a648-c7051eb48168
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3148 uuid: 55858401-f9a2-4458-ab45-b576bac43a1c
from
CoInterpreter VMMaker.oscog-eem.3147 uuid: 409be388-ed75-49dc-a648-c7051eb48168
CoInterpreter VMMaker.oscog-eem.3148 uuid: 55858401-f9a2-4458-ab45-b576bac43a1c
*/
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3147 uuid: 409be388-ed75-49dc-a648-c7051eb48168 " __DATE__ ;
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3148 uuid: 55858401-f9a2-4458-ab45-b576bac43a1c " __DATE__ ;
char *__interpBuildInfo = __buildInfo;


Expand Down Expand Up @@ -252,6 +252,7 @@ warningat(const char *s, int l) { /* ditto with line number. */
#define PrimCallMayEndureCodeCompaction 16
#define PrimCallNeedsNewMethod 8
#define PrimCallOnSmalltalkStack 1
#define PrimCallOnSmalltalkStackAlign2x 2
#define PrimErrBadArgument 3
#define PrimErrBadIndex 4
#define PrimErrBadMethod 12
Expand Down Expand Up @@ -2032,7 +2033,7 @@ static signed short primitiveMetadataTable[MaxPrimitiveIndex + 2 /* 578 */] = {
/*77*/ 0, 0, 0,
/*80*/ -256,-256,-256, 8, 8, 0, 0x100, 0, 0x200,-256,-256, 0, 0, 0, 0x100,-256,-256,
/*97*/ -256, 0, 0,
/*100*/ 264, 0x200, 0x100, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256,
/*100*/ 264, 0x200, 0x200, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256,
/*115*/ 0x100, 0, 24, 264, 0,
/*120*/ 536, 0x100,-256,-256, 1, 0, 0, 0, 0,-255,-256,-256, 0, 0, 0,-256, 0,-256,-256,
/*139*/ 0,
Expand Down Expand Up @@ -2697,7 +2698,7 @@ sqInt suppressHeartbeatFlag;
sqInt debugCallbackInvokes;
sqInt debugCallbackReturns;
sqInt checkedPluginName;
const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3147]";
const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3148]";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
char expensiveAsserts = 0;
int (*showSurfaceFn)(sqIntptr_t, int, int, int, int);
Expand Down Expand Up @@ -39102,7 +39103,7 @@ mnuMethodOrNilFor(sqInt rcvr)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt currentClass;
sqInt dictionary;
sqInt index;
usqInt index;
usqInt length;
sqInt mask;
sqInt methodArray;
Expand Down Expand Up @@ -39151,7 +39152,7 @@ mnuMethodOrNilFor(sqInt rcvr)
wrapAround = 0;
while (1) {
/* begin fetchPointer:ofObject: */
nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))));
nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord())));
if (nextSelector == GIV(nilObj)) {
mnuMethod = null;
goto l11;
Expand All @@ -39169,7 +39170,7 @@ mnuMethodOrNilFor(sqInt rcvr)
}
methodArray = objOop;
/* begin followField:ofObject: */
objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord())))));
objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord())));
if (((!(objOop1 & (tagMask()))))
&& ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) {
objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1);
Expand Down Expand Up @@ -40108,7 +40109,7 @@ primitivePropertyFlagsnumArgs(sqInt primIndex, sqInt numArgs)
&& (numArgs == 1)) {

/* vmParameterAt: */
return (baseFlags + PrimCallOnSmalltalkStack) + PrimCallIsInternalPrim;
return ((baseFlags + PrimCallOnSmalltalkStack) + PrimCallOnSmalltalkStackAlign2x) + PrimCallIsInternalPrim;
}
return baseFlags | ((primitiveMetadataTable[primIndex]) & SpurPrimitiveFlagsMask);
}
Expand Down Expand Up @@ -53390,7 +53391,7 @@ primitiveInvokeObjectAsMethod(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt i;
sqInt lookupClassTag;
usqInt runArgs;
sqInt runArgs;
sqInt runReceiver;
char *sp;
char *sp1;
Expand Down Expand Up @@ -86688,7 +86689,7 @@ lookupSelectorinClass(sqInt selector, sqInt class)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt currentClass;
sqInt dictionary;
sqInt index;
usqInt index;
usqInt length;
sqInt mask;
sqInt meth;
Expand Down Expand Up @@ -86732,7 +86733,7 @@ lookupSelectorinClass(sqInt selector, sqInt class)
wrapAround = 0;
while (1) {
/* begin fetchPointer:ofObject: */
nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))));
nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord())));
if (nextSelector == GIV(nilObj)) {
meth = null;
goto l8;
Expand All @@ -86750,7 +86751,7 @@ lookupSelectorinClass(sqInt selector, sqInt class)
}
methodArray = objOop2;
/* begin followField:ofObject: */
objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord())))));
objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord())));
if (((!(objOop1 & (tagMask()))))
&& ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) {
objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1);
Expand Down
31 changes: 16 additions & 15 deletions src/spur32.cog/cointerp.c
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3147 uuid: 409be388-ed75-49dc-a648-c7051eb48168
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3148 uuid: 55858401-f9a2-4458-ab45-b576bac43a1c
from
CoInterpreter VMMaker.oscog-eem.3147 uuid: 409be388-ed75-49dc-a648-c7051eb48168
CoInterpreter VMMaker.oscog-eem.3148 uuid: 55858401-f9a2-4458-ab45-b576bac43a1c
*/
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3147 uuid: 409be388-ed75-49dc-a648-c7051eb48168 " __DATE__ ;
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3148 uuid: 55858401-f9a2-4458-ab45-b576bac43a1c " __DATE__ ;
char *__interpBuildInfo = __buildInfo;


Expand Down Expand Up @@ -246,6 +246,7 @@ warningat(const char *s, int l) { /* ditto with line number. */
#define PrimCallMayEndureCodeCompaction 16
#define PrimCallNeedsNewMethod 8
#define PrimCallOnSmalltalkStack 1
#define PrimCallOnSmalltalkStackAlign2x 2
#define PrimErrBadArgument 3
#define PrimErrBadIndex 4
#define PrimErrBadMethod 12
Expand Down Expand Up @@ -2004,7 +2005,7 @@ static signed short primitiveMetadataTable[MaxPrimitiveIndex + 2 /* 578 */] = {
/*77*/ 0, 0, 0,
/*80*/ -256,-256,-256, 8, 8, 0, 0x100, 0, 0x200,-256,-256, 0, 0, 0, 0x100,-256,-256,
/*97*/ -256, 0, 0,
/*100*/ 264, 0x200, 0x100, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256,
/*100*/ 264, 0x200, 0x200, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256,
/*115*/ 0x100, 0, 24, 264, 0,
/*120*/ 536, 0x100,-256,-256, 1, 0, 0, 0, 0,-255,-256,-256, 0, 0, 0,-256, 0,-256,-256,
/*139*/ 0,
Expand Down Expand Up @@ -2669,7 +2670,7 @@ sqInt suppressHeartbeatFlag;
sqInt debugCallbackInvokes;
sqInt debugCallbackReturns;
sqInt checkedPluginName;
const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3147]";
const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3148]";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
char expensiveAsserts = 0;
int (*showSurfaceFn)(sqIntptr_t, int, int, int, int);
Expand Down Expand Up @@ -19276,7 +19277,7 @@ mnuMethodOrNilFor(sqInt rcvr)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt currentClass;
sqInt dictionary;
usqInt index;
sqInt index;
usqInt length;
sqInt mask;
sqInt methodArray;
Expand Down Expand Up @@ -19325,7 +19326,7 @@ mnuMethodOrNilFor(sqInt rcvr)
wrapAround = 0;
while (1) {
/* begin fetchPointer:ofObject: */
nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord())));
nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))));
if (nextSelector == GIV(nilObj)) {
mnuMethod = null;
goto l11;
Expand All @@ -19343,7 +19344,7 @@ mnuMethodOrNilFor(sqInt rcvr)
}
methodArray = objOop;
/* begin followField:ofObject: */
objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord())));
objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord())))));
if (((!(objOop1 & (tagMask()))))
&& ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) {
objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1);
Expand Down Expand Up @@ -20238,7 +20239,7 @@ primitivePropertyFlagsnumArgs(sqInt primIndex, sqInt numArgs)
&& (numArgs == 1)) {

/* vmParameterAt: */
return (baseFlags + PrimCallOnSmalltalkStack) + PrimCallIsInternalPrim;
return ((baseFlags + PrimCallOnSmalltalkStack) + PrimCallOnSmalltalkStackAlign2x) + PrimCallIsInternalPrim;
}
return baseFlags | ((primitiveMetadataTable[primIndex]) & SpurPrimitiveFlagsMask);
}
Expand Down Expand Up @@ -33492,7 +33493,7 @@ primitiveInvokeObjectAsMethod(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt i;
sqInt lookupClassTag;
sqInt runArgs;
usqInt runArgs;
sqInt runReceiver;
char *sp;
char *sp1;
Expand Down Expand Up @@ -64528,8 +64529,8 @@ static sqInt
getErrorObjectFromPrimFailCode(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt classIndex;
usqInt clone;
usqInt errObj;
sqInt clone;
sqInt errObj;
sqInt fieldIndex;
sqInt i;
usqInt newObj;
Expand Down Expand Up @@ -66678,7 +66679,7 @@ lookupSelectorinClass(sqInt selector, sqInt class)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt currentClass;
sqInt dictionary;
usqInt index;
sqInt index;
usqInt length;
sqInt mask;
sqInt meth;
Expand Down Expand Up @@ -66722,7 +66723,7 @@ lookupSelectorinClass(sqInt selector, sqInt class)
wrapAround = 0;
while (1) {
/* begin fetchPointer:ofObject: */
nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord())));
nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))));
if (nextSelector == GIV(nilObj)) {
meth = null;
goto l8;
Expand All @@ -66740,7 +66741,7 @@ lookupSelectorinClass(sqInt selector, sqInt class)
}
methodArray = objOop2;
/* begin followField:ofObject: */
objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord())));
objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord())))));
if (((!(objOop1 & (tagMask()))))
&& ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) {
objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1);
Expand Down
2 changes: 1 addition & 1 deletion src/spur32.cog/cointerp.h
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3147 uuid: 409be388-ed75-49dc-a648-c7051eb48168
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3148 uuid: 55858401-f9a2-4458-ab45-b576bac43a1c
*/


Expand Down

0 comments on commit 7af8010

Please sign in to comment.