Skip to content

Commit

Permalink
CogVM source as per VMMaker.oscog-eem.2969
Browse files Browse the repository at this point in the history
Fix a bug in the assert in cogMethodContaining: when supplied
the mcpc of a block method at its stack check offset.
  • Loading branch information
eliotmiranda committed Jun 19, 2021
1 parent 9799385 commit 342e5e6
Show file tree
Hide file tree
Showing 28 changed files with 713 additions and 116 deletions.
2 changes: 1 addition & 1 deletion spur64src/vm/cogit.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.2967 uuid: 57b9e5f9-0212-436d-acaf-4e501e470621
CCodeGenerator VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181
*/


Expand Down
41 changes: 35 additions & 6 deletions spur64src/vm/cogitARMv8.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.2953 uuid: 9f3d924e-9226-4242-9b6f-3dad93c7a837
CCodeGenerator VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181
from
StackToRegisterMappingCogit VMMaker.oscog-eem.2953 uuid: 9f3d924e-9226-4242-9b6f-3dad93c7a837
StackToRegisterMappingCogit VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181
*/
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2953 uuid: 9f3d924e-9226-4242-9b6f-3dad93c7a837 " __DATE__ ;
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181 " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;


Expand Down Expand Up @@ -860,6 +860,7 @@ extern void setBreakMethod(sqInt anObj);
extern void setPostCompileHook(void (*aFunction)(CogMethod *));
extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop);
static sqInt NoDbgRegParms spanForCleanBlockStartingAt(sqInt startPC);
static usqInt NoDbgRegParms stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc);
static sqInt subsequentPrototypeMethodOop(void);
static AbstractInstruction * NoDbgRegParms gTstCqR(sqInt quickConstant, sqInt reg);
extern sqInt traceLinkedSendOffset(void);
Expand Down Expand Up @@ -896,6 +897,7 @@ static void followForwardedLiteralsInOpenPICList(void);
extern void freeMethod(CogMethod *cogMethod);
static void freeOlderMethodsForCompaction(void);
extern sqInt kosherYoungReferrers(void);
static sqInt NoDbgRegParms mcpcisAtStackCheckOfBlockMethodIn(sqInt mcpc, CogMethod *cogMethod);
extern CogMethod * methodFor(void *address);
extern sqInt methodsCompiledToMachineCodeInto(sqInt arrayObj);
extern sqInt numMethods(void);
Expand Down Expand Up @@ -6973,7 +6975,7 @@ rewriteImm19JumpBeforetarget(AbstractInstruction * self_in_rewriteImm19JumpBefor
static sqInt NoDbgRegParms
rewriteImm26JumpBeforetarget(AbstractInstruction * self_in_rewriteImm26JumpBeforetarget, sqInt followingAddress, sqInt targetAddress)
{
sqInt instrOpcode;
usqInt instrOpcode;
sqInt mcpc;
sqInt offset;

Expand All @@ -6983,7 +6985,7 @@ rewriteImm26JumpBeforetarget(AbstractInstruction * self_in_rewriteImm26JumpBefor
instrOpcode = ((instructionBeforeAddress(self_in_rewriteImm26JumpBeforetarget, followingAddress))) >> 26;
assert((instrOpcode == 5)
|| (instrOpcode == 37));
codeLong32Atput(mcpc, (((sqInt)((usqInt)(instrOpcode) << 26))) + (((offset) >> 2) & (0x3FFFFFF)));
codeLong32Atput(mcpc, (instrOpcode << 26) + (((offset) >> 2) & (0x3FFFFFF)));
return 4;
}

Expand Down Expand Up @@ -14980,6 +14982,19 @@ spanForCleanBlockStartingAt(sqInt startPC)
return 0;
}

/* Cogit>>#stackCheckOffsetOfBlockAt:isMcpc: */
static usqInt NoDbgRegParms
stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc)
{
CogBlockMethod *cogBlockMethod;

cogBlockMethod = ((CogBlockMethod *) (blockEntryMcpc - (sizeof(CogBlockMethod))));
if (((((sqInt)cogBlockMethod)) + ((cogBlockMethod->stackCheckOffset))) == mcpc) {
return ((usqInt)cogBlockMethod);
}
return 0;
}


/* Answer a fake value for the method oop in other than the first case in the
PIC prototype.
Expand Down Expand Up @@ -16015,9 +16030,10 @@ cogMethodContaining(usqInt mcpc)
}
assert((prevMethod != null)
&& ((mcpc == ((((usqInt)prevMethod)) + ((prevMethod->stackCheckOffset))))
|| ((mcpcisAtStackCheckOfBlockMethodIn(mcpc, prevMethod))
|| ((isCallPrecedingReturnPC(backEnd(), mcpc))
&& (((primitiveIndexOfMethodheader((prevMethod->methodObject), (prevMethod->methodHeader))) > 0)
|| ((callTargetFromReturnAddress(backEnd(), mcpc)) == (ceCheckForInterruptTrampoline()))))));
|| ((callTargetFromReturnAddress(backEnd(), mcpc)) == (ceCheckForInterruptTrampoline())))))));
return prevMethod;
}

Expand Down Expand Up @@ -16248,6 +16264,19 @@ kosherYoungReferrers(void)
return 1;
}


/* For assert checking... */

/* CogMethodZone>>#mcpc:isAtStackCheckOfBlockMethodIn: */
static sqInt NoDbgRegParms
mcpcisAtStackCheckOfBlockMethodIn(sqInt mcpc, CogMethod *cogMethod)
{
if (((cogMethod->blockEntryOffset)) == 0) {
return 0;
}
return (blockDispatchTargetsForperformarg(cogMethod, stackCheckOffsetOfBlockAtisMcpc, mcpc)) != 0;
}

/* CogMethodZone>>#methodFor: */
CogMethod *
methodFor(void *address)
Expand Down
37 changes: 33 additions & 4 deletions spur64src/vm/cogitX64SysV.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.2953 uuid: 9f3d924e-9226-4242-9b6f-3dad93c7a837
CCodeGenerator VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181
from
StackToRegisterMappingCogit VMMaker.oscog-eem.2953 uuid: 9f3d924e-9226-4242-9b6f-3dad93c7a837
StackToRegisterMappingCogit VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181
*/
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2953 uuid: 9f3d924e-9226-4242-9b6f-3dad93c7a837 " __DATE__ ;
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181 " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;


Expand Down Expand Up @@ -744,6 +744,7 @@ extern void setBreakMethod(sqInt anObj);
extern void setPostCompileHook(void (*aFunction)(CogMethod *));
extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop);
static sqInt NoDbgRegParms spanForCleanBlockStartingAt(sqInt startPC);
static usqInt NoDbgRegParms stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc);
static sqInt subsequentPrototypeMethodOop(void);
static AbstractInstruction * NoDbgRegParms gTstCqR(sqInt quickConstant, sqInt reg);
extern sqInt traceLinkedSendOffset(void);
Expand Down Expand Up @@ -779,6 +780,7 @@ static void followForwardedLiteralsInOpenPICList(void);
extern void freeMethod(CogMethod *cogMethod);
static void freeOlderMethodsForCompaction(void);
extern sqInt kosherYoungReferrers(void);
static sqInt NoDbgRegParms mcpcisAtStackCheckOfBlockMethodIn(sqInt mcpc, CogMethod *cogMethod);
extern CogMethod * methodFor(void *address);
extern sqInt methodsCompiledToMachineCodeInto(sqInt arrayObj);
extern sqInt numMethods(void);
Expand Down Expand Up @@ -10517,6 +10519,19 @@ spanForCleanBlockStartingAt(sqInt startPC)
return 0;
}

/* Cogit>>#stackCheckOffsetOfBlockAt:isMcpc: */
static usqInt NoDbgRegParms
stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc)
{
CogBlockMethod *cogBlockMethod;

cogBlockMethod = ((CogBlockMethod *) (blockEntryMcpc - (sizeof(CogBlockMethod))));
if (((((sqInt)cogBlockMethod)) + ((cogBlockMethod->stackCheckOffset))) == mcpc) {
return ((usqInt)cogBlockMethod);
}
return 0;
}


/* Answer a fake value for the method oop in other than the first case in the
PIC prototype.
Expand Down Expand Up @@ -11536,9 +11551,10 @@ cogMethodContaining(usqInt mcpc)
}
assert((prevMethod != null)
&& ((mcpc == ((((usqInt)prevMethod)) + ((prevMethod->stackCheckOffset))))
|| ((mcpcisAtStackCheckOfBlockMethodIn(mcpc, prevMethod))
|| ((isCallPrecedingReturnPC(backEnd(), mcpc))
&& (((primitiveIndexOfMethodheader((prevMethod->methodObject), (prevMethod->methodHeader))) > 0)
|| ((callTargetFromReturnAddress(backEnd(), mcpc)) == (ceCheckForInterruptTrampoline()))))));
|| ((callTargetFromReturnAddress(backEnd(), mcpc)) == (ceCheckForInterruptTrampoline())))))));
return prevMethod;
}

Expand Down Expand Up @@ -11769,6 +11785,19 @@ kosherYoungReferrers(void)
return 1;
}


/* For assert checking... */

/* CogMethodZone>>#mcpc:isAtStackCheckOfBlockMethodIn: */
static sqInt NoDbgRegParms
mcpcisAtStackCheckOfBlockMethodIn(sqInt mcpc, CogMethod *cogMethod)
{
if (((cogMethod->blockEntryOffset)) == 0) {
return 0;
}
return (blockDispatchTargetsForperformarg(cogMethod, stackCheckOffsetOfBlockAtisMcpc, mcpc)) != 0;
}

/* CogMethodZone>>#methodFor: */
CogMethod *
methodFor(void *address)
Expand Down
37 changes: 33 additions & 4 deletions spur64src/vm/cogitX64WIN64.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.2953 uuid: 9f3d924e-9226-4242-9b6f-3dad93c7a837
CCodeGenerator VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181
from
StackToRegisterMappingCogit VMMaker.oscog-eem.2953 uuid: 9f3d924e-9226-4242-9b6f-3dad93c7a837
StackToRegisterMappingCogit VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181
*/
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2953 uuid: 9f3d924e-9226-4242-9b6f-3dad93c7a837 " __DATE__ ;
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181 " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;


Expand Down Expand Up @@ -744,6 +744,7 @@ extern void setBreakMethod(sqInt anObj);
extern void setPostCompileHook(void (*aFunction)(CogMethod *));
extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop);
static sqInt NoDbgRegParms spanForCleanBlockStartingAt(sqInt startPC);
static usqInt NoDbgRegParms stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc);
static sqInt subsequentPrototypeMethodOop(void);
static AbstractInstruction * NoDbgRegParms gTstCqR(sqInt quickConstant, sqInt reg);
extern sqInt traceLinkedSendOffset(void);
Expand Down Expand Up @@ -779,6 +780,7 @@ static void followForwardedLiteralsInOpenPICList(void);
extern void freeMethod(CogMethod *cogMethod);
static void freeOlderMethodsForCompaction(void);
extern sqInt kosherYoungReferrers(void);
static sqInt NoDbgRegParms mcpcisAtStackCheckOfBlockMethodIn(sqInt mcpc, CogMethod *cogMethod);
extern CogMethod * methodFor(void *address);
extern sqInt methodsCompiledToMachineCodeInto(sqInt arrayObj);
extern sqInt numMethods(void);
Expand Down Expand Up @@ -10535,6 +10537,19 @@ spanForCleanBlockStartingAt(sqInt startPC)
return 0;
}

/* Cogit>>#stackCheckOffsetOfBlockAt:isMcpc: */
static usqInt NoDbgRegParms
stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc)
{
CogBlockMethod *cogBlockMethod;

cogBlockMethod = ((CogBlockMethod *) (blockEntryMcpc - (sizeof(CogBlockMethod))));
if (((((sqInt)cogBlockMethod)) + ((cogBlockMethod->stackCheckOffset))) == mcpc) {
return ((usqInt)cogBlockMethod);
}
return 0;
}


/* Answer a fake value for the method oop in other than the first case in the
PIC prototype.
Expand Down Expand Up @@ -11554,9 +11569,10 @@ cogMethodContaining(usqInt mcpc)
}
assert((prevMethod != null)
&& ((mcpc == ((((usqInt)prevMethod)) + ((prevMethod->stackCheckOffset))))
|| ((mcpcisAtStackCheckOfBlockMethodIn(mcpc, prevMethod))
|| ((isCallPrecedingReturnPC(backEnd(), mcpc))
&& (((primitiveIndexOfMethodheader((prevMethod->methodObject), (prevMethod->methodHeader))) > 0)
|| ((callTargetFromReturnAddress(backEnd(), mcpc)) == (ceCheckForInterruptTrampoline()))))));
|| ((callTargetFromReturnAddress(backEnd(), mcpc)) == (ceCheckForInterruptTrampoline())))))));
return prevMethod;
}

Expand Down Expand Up @@ -11787,6 +11803,19 @@ kosherYoungReferrers(void)
return 1;
}


/* For assert checking... */

/* CogMethodZone>>#mcpc:isAtStackCheckOfBlockMethodIn: */
static sqInt NoDbgRegParms
mcpcisAtStackCheckOfBlockMethodIn(sqInt mcpc, CogMethod *cogMethod)
{
if (((cogMethod->blockEntryOffset)) == 0) {
return 0;
}
return (blockDispatchTargetsForperformarg(cogMethod, stackCheckOffsetOfBlockAtisMcpc, mcpc)) != 0;
}

/* CogMethodZone>>#methodFor: */
CogMethod *
methodFor(void *address)
Expand Down
2 changes: 1 addition & 1 deletion spurlowcode64src/vm/cogit.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.2967 uuid: 57b9e5f9-0212-436d-acaf-4e501e470621
CCodeGenerator VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181
*/


Expand Down
41 changes: 34 additions & 7 deletions spurlowcode64src/vm/cogitARMv8.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.2952 uuid: 5c7088cc-0ef4-4266-ba50-b043fdce40f0
CCodeGenerator VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181
from
StackToRegisterMappingCogit VMMaker.oscog-eem.2952 uuid: 5c7088cc-0ef4-4266-ba50-b043fdce40f0
StackToRegisterMappingCogit VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181
*/
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2952 uuid: 5c7088cc-0ef4-4266-ba50-b043fdce40f0 " __DATE__ ;
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181 " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;


Expand Down Expand Up @@ -932,6 +932,7 @@ extern void setBreakMethod(sqInt anObj);
extern void setPostCompileHook(void (*aFunction)(CogMethod *));
extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop);
static sqInt NoDbgRegParms spanForCleanBlockStartingAt(sqInt startPC);
static usqInt NoDbgRegParms stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc);
static sqInt subsequentPrototypeMethodOop(void);
static AbstractInstruction * NoDbgRegParms gTstCqR(sqInt quickConstant, sqInt reg);
extern sqInt traceLinkedSendOffset(void);
Expand Down Expand Up @@ -968,6 +969,7 @@ static void followForwardedLiteralsInOpenPICList(void);
extern void freeMethod(CogMethod *cogMethod);
static void freeOlderMethodsForCompaction(void);
extern sqInt kosherYoungReferrers(void);
static sqInt NoDbgRegParms mcpcisAtStackCheckOfBlockMethodIn(sqInt mcpc, CogMethod *cogMethod);
extern CogMethod * methodFor(void *address);
extern sqInt methodsCompiledToMachineCodeInto(sqInt arrayObj);
extern sqInt numMethods(void);
Expand Down Expand Up @@ -15491,6 +15493,19 @@ spanForCleanBlockStartingAt(sqInt startPC)
return 0;
}

/* Cogit>>#stackCheckOffsetOfBlockAt:isMcpc: */
static usqInt NoDbgRegParms
stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc)
{
CogBlockMethod *cogBlockMethod;

cogBlockMethod = ((CogBlockMethod *) (blockEntryMcpc - (sizeof(CogBlockMethod))));
if (((((sqInt)cogBlockMethod)) + ((cogBlockMethod->stackCheckOffset))) == mcpc) {
return ((usqInt)cogBlockMethod);
}
return 0;
}


/* Answer a fake value for the method oop in other than the first case in the
PIC prototype.
Expand Down Expand Up @@ -16528,9 +16543,10 @@ cogMethodContaining(usqInt mcpc)
}
assert((prevMethod != null)
&& ((mcpc == ((((usqInt)prevMethod)) + ((prevMethod->stackCheckOffset))))
|| ((mcpcisAtStackCheckOfBlockMethodIn(mcpc, prevMethod))
|| ((isCallPrecedingReturnPC(backEnd(), mcpc))
&& (((primitiveIndexOfMethodheader((prevMethod->methodObject), (prevMethod->methodHeader))) > 0)
|| ((callTargetFromReturnAddress(backEnd(), mcpc)) == (ceCheckForInterruptTrampoline()))))));
|| ((callTargetFromReturnAddress(backEnd(), mcpc)) == (ceCheckForInterruptTrampoline())))))));
return prevMethod;
}

Expand Down Expand Up @@ -16769,6 +16785,19 @@ kosherYoungReferrers(void)
return 1;
}


/* For assert checking... */

/* CogMethodZone>>#mcpc:isAtStackCheckOfBlockMethodIn: */
static sqInt NoDbgRegParms
mcpcisAtStackCheckOfBlockMethodIn(sqInt mcpc, CogMethod *cogMethod)
{
if (((cogMethod->blockEntryOffset)) == 0) {
return 0;
}
return (blockDispatchTargetsForperformarg(cogMethod, stackCheckOffsetOfBlockAtisMcpc, mcpc)) != 0;
}

/* CogMethodZone>>#methodFor: */
CogMethod *
methodFor(void *address)
Expand Down Expand Up @@ -17309,9 +17338,7 @@ voidYoungReferrersPostTenureAll(void)
}


/* useful for VM debugging; use export: not api, so it will be accessible on
win32
*/
/* useful for VM debugging; use export: so it will be accessible on win32 */

/* CogMethodZone>>#whereIsMaybeCodeThing: */
EXPORT(char *)
Expand Down
Loading

0 comments on commit 342e5e6

Please sign in to comment.