Skip to content

Commit

Permalink
CogVM source as per VMMaker.oscog-eem.3003
Browse files Browse the repository at this point in the history
Cogit: fix what is hopefully the last bug with the new FastCPrimitive
scheme.  ReceiverResultReg must be reloaded if it is in the ABI's
caller saved registers since it may have been smashed and the prologue
sequence assumes ReceiverResultReg is live.
  • Loading branch information
eliotmiranda committed Jul 27, 2021
1 parent fde4fd0 commit 137e96d
Show file tree
Hide file tree
Showing 67 changed files with 747 additions and 534 deletions.
2 changes: 1 addition & 1 deletion spur64src/vm/cogit.h
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.3002 uuid: 618f5960-8dbf-452c-8709-f8201ee6433b
CCodeGenerator VMMaker.oscog-eem.3003 uuid: dd2cf315-8c10-45ac-9ad5-336ddc486b87
*/


Expand Down
33 changes: 22 additions & 11 deletions spur64src/vm/cogitARMv8.c
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.3002 uuid: 618f5960-8dbf-452c-8709-f8201ee6433b
CCodeGenerator VMMaker.oscog-eem.3003 uuid: dd2cf315-8c10-45ac-9ad5-336ddc486b87
from
StackToRegisterMappingCogit VMMaker.oscog-eem.3002 uuid: 618f5960-8dbf-452c-8709-f8201ee6433b
StackToRegisterMappingCogit VMMaker.oscog-eem.3003 uuid: dd2cf315-8c10-45ac-9ad5-336ddc486b87
*/
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3002 uuid: 618f5960-8dbf-452c-8709-f8201ee6433b " __DATE__ ;
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3003 uuid: dd2cf315-8c10-45ac-9ad5-336ddc486b87 " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;


Expand Down Expand Up @@ -685,7 +685,7 @@ static sqInt NoDbgRegParms ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver);
extern void ceFree(void *pointer);
static void* NoDbgRegParms ceMalloc(size_t size);
static sqInt NoDbgRegParms ceSICMiss(sqInt receiver);
static sqInt NoDbgRegParms checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, sqInt cogMethod);
static sqInt NoDbgRegParms checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod);
static sqInt NoDbgRegParms checkIfValidOopRefpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod);
extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes);
static sqInt NoDbgRegParms checkMaybeObjRefInClosedPIC(sqInt maybeObject);
Expand Down Expand Up @@ -8590,7 +8590,7 @@ ceSICMiss(sqInt receiver)

/* Cogit>>#checkIfValidOopRefAndTarget:pc:cogMethod: */
static sqInt NoDbgRegParms
checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, sqInt cogMethod)
checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod)
{
usqInt cacheTag1;
sqInt entryPoint;
Expand Down Expand Up @@ -26590,17 +26590,19 @@ compileOnStackExternalPrimitive(void (*primitiveRoutine)(void))
AbstractInstruction *anInstruction3;
AbstractInstruction *anInstruction4;
AbstractInstruction *anInstruction5;
AbstractInstruction *anInstruction6;
sqInt calleeSavedReg;
AbstractInstruction * jmp;
sqInt offset;
sqInt offset1;
sqInt operand1;
AbstractInstruction * retry;
AbstractInstruction * skip;

/* begin checkQuickConstant:forInstruction: */
anInstruction4 = genoperandoperand(MoveCqR, 0, TempReg);
if (usesOutOfLineLiteral(anInstruction4)) {
(anInstruction4->dependent = locateLiteralsize(0, BytesPerOop));
anInstruction5 = genoperandoperand(MoveCqR, 0, TempReg);
if (usesOutOfLineLiteral(anInstruction5)) {
(anInstruction5->dependent = locateLiteralsize(0, BytesPerOop));
}
/* begin MoveR:Aw: */
address4 = primFailCodeAddress();
Expand Down Expand Up @@ -26640,9 +26642,9 @@ compileOnStackExternalPrimitive(void (*primitiveRoutine)(void))
genoperandoperand(MoveRR, calleeSavedReg, SPReg);
}
/* begin checkQuickConstant:forInstruction: */
anInstruction5 = genoperandoperand(CmpCqR, 0, TempReg);
if (usesOutOfLineLiteral(anInstruction5)) {
(anInstruction5->dependent = locateLiteralsize(0, BytesPerOop));
anInstruction6 = genoperandoperand(CmpCqR, 0, TempReg);
if (usesOutOfLineLiteral(anInstruction6)) {
(anInstruction6->dependent = locateLiteralsize(0, BytesPerOop));
}
/* begin JumpNonZero: */
jmp = genConditionalBranchoperand(JumpNonZero, ((sqInt)0));
Expand Down Expand Up @@ -26715,6 +26717,15 @@ compileOnStackExternalPrimitive(void (*primitiveRoutine)(void))
genoperand(Jump, ((sqInt)retry));
jmpTarget(skip, genoperandoperand(Label, (labelCounter += 1), bytecodePC));
}
if (((ABICallerSavedRegisterMask & (1U << ReceiverResultReg)) != 0)) {
/* begin MoveMw:r:R: */
offset1 = (methodOrBlockNumArgs) * BytesPerWord;
/* begin checkQuickConstant:forInstruction: */
anInstruction4 = genoperandoperandoperand(MoveMwrR, offset1, SPReg, ReceiverResultReg);
if (usesOutOfLineLiteral(anInstruction4)) {
(anInstruction4->dependent = locateLiteralsize(offset1, BytesPerOop));
}
}
return 0;
}

Expand Down
30 changes: 19 additions & 11 deletions spur64src/vm/cogitX64SysV.c
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.3002 uuid: 618f5960-8dbf-452c-8709-f8201ee6433b
CCodeGenerator VMMaker.oscog-eem.3003 uuid: dd2cf315-8c10-45ac-9ad5-336ddc486b87
from
StackToRegisterMappingCogit VMMaker.oscog-eem.3002 uuid: 618f5960-8dbf-452c-8709-f8201ee6433b
StackToRegisterMappingCogit VMMaker.oscog-eem.3003 uuid: dd2cf315-8c10-45ac-9ad5-336ddc486b87
*/
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3002 uuid: 618f5960-8dbf-452c-8709-f8201ee6433b " __DATE__ ;
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3003 uuid: dd2cf315-8c10-45ac-9ad5-336ddc486b87 " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;


Expand Down Expand Up @@ -565,7 +565,7 @@ static sqInt NoDbgRegParms ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver);
extern void ceFree(void *pointer);
static void* NoDbgRegParms ceMalloc(size_t size);
static sqInt NoDbgRegParms ceSICMiss(sqInt receiver);
static sqInt NoDbgRegParms checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, sqInt cogMethod);
static sqInt NoDbgRegParms checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod);
static sqInt NoDbgRegParms checkIfValidOopRefpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod);
extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes);
static sqInt NoDbgRegParms checkMaybeObjRefInClosedPIC(sqInt maybeObject);
Expand Down Expand Up @@ -4146,7 +4146,7 @@ ceSICMiss(sqInt receiver)

/* Cogit>>#checkIfValidOopRefAndTarget:pc:cogMethod: */
static sqInt NoDbgRegParms
checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, sqInt cogMethod)
checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod)
{
usqInt cacheTag1;
sqInt entryPoint;
Expand Down Expand Up @@ -25443,6 +25443,7 @@ compileOnStackExternalPrimitive(void (*primitiveRoutine)(void))
AbstractInstruction *anInstruction16;
AbstractInstruction *anInstruction17;
AbstractInstruction *anInstruction18;
AbstractInstruction *anInstruction19;
AbstractInstruction *anInstruction2;
AbstractInstruction *anInstruction4;
AbstractInstruction *anInstruction5;
Expand All @@ -25453,22 +25454,23 @@ compileOnStackExternalPrimitive(void (*primitiveRoutine)(void))
sqInt calleeSavedReg;
AbstractInstruction * jmp;
sqInt offset;
sqInt offset1;
sqInt operand1;
AbstractInstruction * retry;
AbstractInstruction * skip;

/* begin checkQuickConstant:forInstruction: */
anInstruction13 = genoperandoperand(MoveCqR, 0, TempReg);
anInstruction14 = genoperandoperand(MoveCqR, 0, TempReg);
/* begin checkLiteral:forInstruction: */
primFailCodeAddress();
anInstruction14 = genoperandoperand(MoveRAw, TempReg, primFailCodeAddress());
anInstruction15 = genoperandoperand(MoveRAw, TempReg, primFailCodeAddress());
if (methodOrBlockNumArgs != 0) {
/* begin checkQuickConstant:forInstruction: */
anInstruction = genoperandoperand(MoveCqR, methodOrBlockNumArgs, TempReg);
}
/* begin checkLiteral:forInstruction: */
argumentCountAddress();
anInstruction15 = genoperandoperand(MoveRAw, TempReg, argumentCountAddress());
anInstruction16 = genoperandoperand(MoveRAw, TempReg, argumentCountAddress());
genExternalizeStackPointerForFastPrimitiveCall();
/* begin Label */
retry = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
Expand All @@ -25477,20 +25479,20 @@ compileOnStackExternalPrimitive(void (*primitiveRoutine)(void))
anInstruction2 = genoperand(CallFull, primitiveRoutine);
/* begin checkLiteral:forInstruction: */
primFailCodeAddress();
anInstruction16 = genoperandoperand(MoveAwR, primFailCodeAddress(), TempReg);
anInstruction17 = genoperandoperand(MoveAwR, primFailCodeAddress(), TempReg);
if (calleeSavedReg != NoReg) {
/* begin MoveR:R: */
genoperandoperand(MoveRR, calleeSavedReg, SPReg);
}
/* begin checkQuickConstant:forInstruction: */
anInstruction17 = genoperandoperand(CmpCqR, 0, TempReg);
anInstruction18 = genoperandoperand(CmpCqR, 0, TempReg);
/* begin JumpNonZero: */
jmp = genConditionalBranchoperand(JumpNonZero, ((sqInt)0));
/* begin PopR: */
genoperand(PopR, TempReg);
/* begin checkLiteral:forInstruction: */
stackPointerAddress();
anInstruction18 = genoperandoperand(MoveAwR, stackPointerAddress(), SPReg);
anInstruction19 = genoperandoperand(MoveAwR, stackPointerAddress(), SPReg);
/* begin PopR: */
genoperand(PopR, ReceiverResultReg);
/* begin PushR: */
Expand Down Expand Up @@ -25545,6 +25547,12 @@ compileOnStackExternalPrimitive(void (*primitiveRoutine)(void))
genoperand(Jump, ((sqInt)retry));
jmpTarget(skip, genoperandoperand(Label, (labelCounter += 1), bytecodePC));
}
if (((ABICallerSavedRegisterMask & (1U << ReceiverResultReg)) != 0)) {
/* begin MoveMw:r:R: */
offset1 = (methodOrBlockNumArgs + 1) * BytesPerWord;
/* begin checkQuickConstant:forInstruction: */
anInstruction13 = genoperandoperandoperand(MoveMwrR, offset1, SPReg, ReceiverResultReg);
}
return 0;
}

Expand Down
30 changes: 19 additions & 11 deletions spur64src/vm/cogitX64WIN64.c
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.3002 uuid: 618f5960-8dbf-452c-8709-f8201ee6433b
CCodeGenerator VMMaker.oscog-eem.3003 uuid: dd2cf315-8c10-45ac-9ad5-336ddc486b87
from
StackToRegisterMappingCogit VMMaker.oscog-eem.3002 uuid: 618f5960-8dbf-452c-8709-f8201ee6433b
StackToRegisterMappingCogit VMMaker.oscog-eem.3003 uuid: dd2cf315-8c10-45ac-9ad5-336ddc486b87
*/
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3002 uuid: 618f5960-8dbf-452c-8709-f8201ee6433b " __DATE__ ;
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3003 uuid: dd2cf315-8c10-45ac-9ad5-336ddc486b87 " __DATE__ ;
char *__cogitBuildInfo = __buildInfo;


Expand Down Expand Up @@ -565,7 +565,7 @@ static sqInt NoDbgRegParms ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver);
extern void ceFree(void *pointer);
static void* NoDbgRegParms ceMalloc(size_t size);
static sqInt NoDbgRegParms ceSICMiss(sqInt receiver);
static sqInt NoDbgRegParms checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, sqInt cogMethod);
static sqInt NoDbgRegParms checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod);
static sqInt NoDbgRegParms checkIfValidOopRefpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod);
extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes);
static sqInt NoDbgRegParms checkMaybeObjRefInClosedPIC(sqInt maybeObject);
Expand Down Expand Up @@ -4146,7 +4146,7 @@ ceSICMiss(sqInt receiver)

/* Cogit>>#checkIfValidOopRefAndTarget:pc:cogMethod: */
static sqInt NoDbgRegParms
checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, sqInt cogMethod)
checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod)
{
usqInt cacheTag1;
sqInt entryPoint;
Expand Down Expand Up @@ -25486,6 +25486,7 @@ compileOnStackExternalPrimitive(void (*primitiveRoutine)(void))
AbstractInstruction *anInstruction16;
AbstractInstruction *anInstruction17;
AbstractInstruction *anInstruction18;
AbstractInstruction *anInstruction19;
AbstractInstruction *anInstruction2;
AbstractInstruction *anInstruction4;
AbstractInstruction *anInstruction5;
Expand All @@ -25496,22 +25497,23 @@ compileOnStackExternalPrimitive(void (*primitiveRoutine)(void))
sqInt calleeSavedReg;
AbstractInstruction * jmp;
sqInt offset;
sqInt offset1;
sqInt operand1;
AbstractInstruction * retry;
AbstractInstruction * skip;

/* begin checkQuickConstant:forInstruction: */
anInstruction13 = genoperandoperand(MoveCqR, 0, TempReg);
anInstruction14 = genoperandoperand(MoveCqR, 0, TempReg);
/* begin checkLiteral:forInstruction: */
primFailCodeAddress();
anInstruction14 = genoperandoperand(MoveRAw, TempReg, primFailCodeAddress());
anInstruction15 = genoperandoperand(MoveRAw, TempReg, primFailCodeAddress());
if (methodOrBlockNumArgs != 0) {
/* begin checkQuickConstant:forInstruction: */
anInstruction = genoperandoperand(MoveCqR, methodOrBlockNumArgs, TempReg);
}
/* begin checkLiteral:forInstruction: */
argumentCountAddress();
anInstruction15 = genoperandoperand(MoveRAw, TempReg, argumentCountAddress());
anInstruction16 = genoperandoperand(MoveRAw, TempReg, argumentCountAddress());
genExternalizeStackPointerForFastPrimitiveCall();
/* begin Label */
retry = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
Expand All @@ -25520,20 +25522,20 @@ compileOnStackExternalPrimitive(void (*primitiveRoutine)(void))
anInstruction2 = genoperand(CallFull, primitiveRoutine);
/* begin checkLiteral:forInstruction: */
primFailCodeAddress();
anInstruction16 = genoperandoperand(MoveAwR, primFailCodeAddress(), TempReg);
anInstruction17 = genoperandoperand(MoveAwR, primFailCodeAddress(), TempReg);
if (calleeSavedReg != NoReg) {
/* begin MoveR:R: */
genoperandoperand(MoveRR, calleeSavedReg, SPReg);
}
/* begin checkQuickConstant:forInstruction: */
anInstruction17 = genoperandoperand(CmpCqR, 0, TempReg);
anInstruction18 = genoperandoperand(CmpCqR, 0, TempReg);
/* begin JumpNonZero: */
jmp = genConditionalBranchoperand(JumpNonZero, ((sqInt)0));
/* begin PopR: */
genoperand(PopR, TempReg);
/* begin checkLiteral:forInstruction: */
stackPointerAddress();
anInstruction18 = genoperandoperand(MoveAwR, stackPointerAddress(), SPReg);
anInstruction19 = genoperandoperand(MoveAwR, stackPointerAddress(), SPReg);
/* begin PopR: */
genoperand(PopR, ReceiverResultReg);
/* begin PushR: */
Expand Down Expand Up @@ -25588,6 +25590,12 @@ compileOnStackExternalPrimitive(void (*primitiveRoutine)(void))
genoperand(Jump, ((sqInt)retry));
jmpTarget(skip, genoperandoperand(Label, (labelCounter += 1), bytecodePC));
}
if (((ABICallerSavedRegisterMask & (1U << ReceiverResultReg)) != 0)) {
/* begin MoveMw:r:R: */
offset1 = (methodOrBlockNumArgs + 1) * BytesPerWord;
/* begin checkQuickConstant:forInstruction: */
anInstruction13 = genoperandoperandoperand(MoveMwrR, offset1, SPReg, ReceiverResultReg);
}
return 0;
}

Expand Down

0 comments on commit 137e96d

Please sign in to comment.