Skip to content

Commit 3558c8b

Browse files
committed
CogVM source as per VMMaker.oscog-eem.2901
MTVM: Eliminate some compiler warnings. Fix a slip in the assert in cogMethodContainng:
1 parent 792adfd commit 3558c8b

File tree

18 files changed

+171
-151
lines changed

18 files changed

+171
-151
lines changed

platforms/Cross/vm/sq.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,15 @@ void addIdleUsecs(sqInt);
210210
* purpose register, in which case it need not and should not be captured.
211211
*/
212212
extern int isCFramePointerInUse(usqIntptr_t *cFpPtr, usqIntptr_t *cSpPtr);
213+
/* For writing back the machine frame and stack pointer to the interpreter's
214+
* variables, which may allow for a stack backtrace to be generated on an
215+
* exception.
216+
*/
217+
extern void ifValidWriteBackStackPointersSaveTo(void *,void *,char **,char **);
213218
# endif
214219
#endif /* STACKVM */
220+
extern void printCallStack(void);
221+
extern void printAllStacks(void);
215222

216223
/* this function should return the value of the high performance
217224
counter if there is such a thing on this platform (otherwise return 0) */

platforms/unix/vm/sqUnixMain.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ printRegisterState(ucontext_t *uap)
10081008
uap->sc_r8, uap->sc_r9, uap->sc_r10, uap->sc_r11,
10091009
uap->sc_r12, uap->sc_r13, uap->sc_r14, uap->sc_r15,
10101010
uap->sc_rip);
1011-
return (void*)uap->sc_rip;
1011+
return (void *)uap->sc_rip;
10121012
# elif __linux__ && (defined(__arm64__) || defined(__aarch64__))
10131013
void **regs = (void **)&uap->uc_mcontext.regs[0];
10141014
printf( "\tx0 %p x1 %p x2 %p x3 %p\n"
@@ -1027,7 +1027,7 @@ printRegisterState(ucontext_t *uap)
10271027
regs[20], regs[21], regs[22], regs[23],
10281028
regs[24], regs[25], regs[26], regs[27],
10291029
regs[28], regs[29], regs[30], (void *)(uap->uc_mcontext.sp));
1030-
return uap->uc_mcontext.pc;
1030+
return (void *)uap->uc_mcontext.pc;
10311031
# elif __linux__ && (defined(__arm__) || defined(__arm32__) || defined(ARM32))
10321032
struct sigcontext *regs = &uap->uc_mcontext;
10331033
printf( "\t r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n"
@@ -1038,6 +1038,7 @@ printRegisterState(ucontext_t *uap)
10381038
regs->arm_r4,regs->arm_r5,regs->arm_r6,regs->arm_r7,
10391039
regs->arm_r8,regs->arm_r9,regs->arm_r10,regs->arm_fp,
10401040
regs->arm_ip, regs->arm_sp, regs->arm_lr, regs->arm_pc);
1041+
return (void *)uap->uc_mcontext.arm_pc;
10411042
#else
10421043
printf("don't know how to derive register state from a ucontext_t on this platform\n");
10431044
return 0;

platforms/unix/vm/sqUnixThreads.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ ioSignalOSSemaphore(sqOSSemaphore *sem)
103103
if ((err = pthread_mutex_lock(&sem->mutex)))
104104
THRLOG("%d !! SIGN pthread_mutex_lock 0x%p => %d\n", tid, sem, err);
105105
if (++sem->count <= 0) {
106-
THRLOG("%d pthread_cond_signal 0x%x\n", tid, sem);
106+
THRLOG("%d pthread_cond_signal 0x%p\n", tid, sem);
107107
err = pthread_cond_signal(&sem->cond);
108-
THRLOG("%d pthread_cond_signal 0x%x => %d\n", tid, sem, err);
108+
THRLOG("%d pthread_cond_signal 0x%p => %d\n", tid, sem, err);
109109
}
110110
else
111-
THRLOG("%d ioSig 0x%x ++count = %d\n", tid, sem, sem->count);
111+
THRLOG("%d ioSig 0x%p ++count = %d\n", tid, sem, sem->count);
112112
if ((err = pthread_mutex_unlock(&sem->mutex)))
113113
THRLOG("%d !!pthread_mutex_unlock 0x%p => %d\n", tid, sem, err);
114114
#else
@@ -129,12 +129,12 @@ ioWaitOnOSSemaphore(sqOSSemaphore *sem)
129129
if ((err = pthread_mutex_lock(&sem->mutex)))
130130
THRLOG("%d !! WAIT pthread_mutex_lock 0x%p => %d\n", tid, sem, err);
131131
if (--sem->count < 0) {
132-
THRLOG("%d pthread_cond_wait 0x%x\n", tid, sem);
132+
THRLOG("%d pthread_cond_wait 0x%p\n", tid, sem);
133133
err = pthread_cond_wait(&sem->cond, &sem->mutex);
134-
THRLOG("%d proceeding 0x%x (pcw err %d)\n", tid, sem, err);
134+
THRLOG("%d proceeding 0x%p (pcw err %d)\n", tid, sem, err);
135135
}
136136
else
137-
THRLOG("%d ioWait 0x%x --count = %d\n", tid, sem, sem->count);
137+
THRLOG("%d ioWait 0x%p --count = %d\n", tid, sem, sem->count);
138138
if ((err = pthread_mutex_unlock(&sem->mutex)))
139139
THRLOG("%d !! WAIT pthread_mutex_unlock 0x%p => %d\n", tid, sem, err);
140140
#else

platforms/win32/vm/sqWin32Main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2241,7 +2241,7 @@ isCFramePointerInUse(usqIntptr_t *cFrmPtrPtr, usqIntptr_t *cStkPtrPtr)
22412241
return *cFrmPtrPtr >= *cStkPtrPtr && *cFrmPtrPtr <= currentCSP;
22422242
}
22432243
# else
2244-
# error please provide a deifnition of isCFramePointerInUse for this platform
2244+
# error please provide a definition of isCFramePointerInUse for this platform
22452245
# endif /* defined(_M_IX86) et al */
22462246

22472247
/* Answer an approximation of the size of the redzone (if any). Do so by

spur64src/vm/cogit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.2893 uuid: 80846f05-27f9-4e14-a97e-11dcde420a0b
2+
CCodeGenerator VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71
33
*/
44

55

spur64src/vm/cogitARMv8.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.2893 uuid: 80846f05-27f9-4e14-a97e-11dcde420a0b
2+
CCodeGenerator VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71
33
from
4-
StackToRegisterMappingCogit VMMaker.oscog-eem.2893 uuid: 80846f05-27f9-4e14-a97e-11dcde420a0b
4+
StackToRegisterMappingCogit VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71
55
CogARMv8Compiler ClosedVMMaker-eem.114 uuid: 627f25e2-a361-4576-9e60-755e07bdf13e
66
*/
7-
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2893 uuid: 80846f05-27f9-4e14-a97e-11dcde420a0b\n\
7+
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71\n\
88
CogARMv8Compiler ClosedVMMaker-eem.114 uuid: 627f25e2-a361-4576-9e60-755e07bdf13e " __DATE__ ;
99
char *__cogitBuildInfo = __buildInfo;
1010

@@ -16017,12 +16017,12 @@ cogMethodContaining(usqInt mcpc)
1601716017
}
1601816018
assert(mcpc < (limitZony()));
1601916019
cogMethod = ((CogMethod *) baseAddress);
16020-
while (cogMethod < mcpc) {
16020+
while ((((usqInt)cogMethod)) < mcpc) {
1602116021
prevMethod = cogMethod;
1602216022
cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
1602316023
}
1602416024
assert((prevMethod != null)
16025-
&& (((mcpc == (((usqInt)prevMethod))) + ((prevMethod->stackCheckOffset)))
16025+
&& ((mcpc == ((((usqInt)prevMethod)) + ((prevMethod->stackCheckOffset))))
1602616026
|| (((primitiveIndexOfMethodheader((prevMethod->methodObject), (prevMethod->methodHeader))) > 0)
1602716027
&& (isCallPrecedingReturnPC(backEnd(), mcpc)))));
1602816028
return prevMethod;

spur64src/vm/cogitX64SysV.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.2893 uuid: 80846f05-27f9-4e14-a97e-11dcde420a0b
2+
CCodeGenerator VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71
33
from
4-
StackToRegisterMappingCogit VMMaker.oscog-eem.2893 uuid: 80846f05-27f9-4e14-a97e-11dcde420a0b
4+
StackToRegisterMappingCogit VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71
55
*/
6-
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2893 uuid: 80846f05-27f9-4e14-a97e-11dcde420a0b " __DATE__ ;
6+
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71 " __DATE__ ;
77
char *__cogitBuildInfo = __buildInfo;
88

99

@@ -11515,12 +11515,12 @@ cogMethodContaining(usqInt mcpc)
1151511515
}
1151611516
assert(mcpc < (limitZony()));
1151711517
cogMethod = ((CogMethod *) baseAddress);
11518-
while (cogMethod < mcpc) {
11518+
while ((((usqInt)cogMethod)) < mcpc) {
1151911519
prevMethod = cogMethod;
1152011520
cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
1152111521
}
1152211522
assert((prevMethod != null)
11523-
&& (((mcpc == (((usqInt)prevMethod))) + ((prevMethod->stackCheckOffset)))
11523+
&& ((mcpc == ((((usqInt)prevMethod)) + ((prevMethod->stackCheckOffset))))
1152411524
|| (((primitiveIndexOfMethodheader((prevMethod->methodObject), (prevMethod->methodHeader))) > 0)
1152511525
&& (isCallPrecedingReturnPC(backEnd(), mcpc)))));
1152611526
return prevMethod;

spur64src/vm/cogitX64WIN64.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.2893 uuid: 80846f05-27f9-4e14-a97e-11dcde420a0b
2+
CCodeGenerator VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71
33
from
4-
StackToRegisterMappingCogit VMMaker.oscog-eem.2893 uuid: 80846f05-27f9-4e14-a97e-11dcde420a0b
4+
StackToRegisterMappingCogit VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71
55
*/
6-
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2893 uuid: 80846f05-27f9-4e14-a97e-11dcde420a0b " __DATE__ ;
6+
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71 " __DATE__ ;
77
char *__cogitBuildInfo = __buildInfo;
88

99

@@ -11533,12 +11533,12 @@ cogMethodContaining(usqInt mcpc)
1153311533
}
1153411534
assert(mcpc < (limitZony()));
1153511535
cogMethod = ((CogMethod *) baseAddress);
11536-
while (cogMethod < mcpc) {
11536+
while ((((usqInt)cogMethod)) < mcpc) {
1153711537
prevMethod = cogMethod;
1153811538
cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize)))));
1153911539
}
1154011540
assert((prevMethod != null)
11541-
&& (((mcpc == (((usqInt)prevMethod))) + ((prevMethod->stackCheckOffset)))
11541+
&& ((mcpc == ((((usqInt)prevMethod)) + ((prevMethod->stackCheckOffset))))
1154211542
|| (((primitiveIndexOfMethodheader((prevMethod->methodObject), (prevMethod->methodHeader))) > 0)
1154311543
&& (isCallPrecedingReturnPC(backEnd(), mcpc)))));
1154411544
return prevMethod;

spur64src/vm/cointerpmt.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* Automatically generated by
2-
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2900 uuid: 633a69a6-2981-41c3-bddf-2fa634ab65b3
2+
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71
33
from
4-
CoInterpreterMT VMMaker.oscog-eem.2900 uuid: 633a69a6-2981-41c3-bddf-2fa634ab65b3
4+
CoInterpreterMT VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71
55
*/
6-
static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.2900 uuid: 633a69a6-2981-41c3-bddf-2fa634ab65b3 " __DATE__ ;
6+
static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71 " __DATE__ ;
77
char *__interpBuildInfo = __buildInfo;
88

99

@@ -433,10 +433,10 @@ typedef struct {
433433
sqOSThread osThread;
434434
sqInt newMethodOrNull;
435435
sqInt argumentCount;
436-
sqInt primitiveFunctionPointer;
436+
static void (*primitiveFunctionPointer)();
437437
sqInt inMachineCode;
438-
void *cStackPointer;
439-
void *cFramePointer;
438+
usqIntptr_t cStackPointer;
439+
usqIntptr_t cFramePointer;
440440
sqInt awolProcIndex;
441441
sqInt awolProcLength;
442442
sqInt awolProcesses[4];
@@ -2690,7 +2690,7 @@ sqInt debugCallbackInvokes;
26902690
sqInt debugCallbackReturns;
26912691
sqInt ffiExceptionResponse;
26922692
sqInt checkedPluginName;
2693-
const char *interpreterVersion = "Open Smalltalk Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.2900]";
2693+
const char *interpreterVersion = "Open Smalltalk Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.2901]";
26942694
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
26952695
int displayWidth;
26962696
int displayDepth;
@@ -18589,7 +18589,7 @@ markActiveMethodsAndReferents(void)
1858918589
if (GIV(instructionPointer) != 0) {
1859018590
primCogMethod = cogMethodContaining(GIV(instructionPointer));
1859118591
if (!(primCogMethod == null)) {
18592-
markMethodAndReferents(primCogMethod);
18592+
markMethodAndReferents(((CogBlockMethod *) primCogMethod));
1859318593
}
1859418594
}
1859518595
for (i = 0; i < GIV(numStackPages); i += 1) {
@@ -23766,8 +23766,8 @@ ownVM(sqInt threadIndexAndFlags)
2376623766
primitiveFunctionPointer = (vmThread->primitiveFunctionPointer);
2376723767
(vmThread->newMethodOrNull = null);
2376823768
/* begin setCFramePointer:setCStackPointer: */
23769-
cFramePointer = ((sqInt) ((vmThread->cFramePointer)));
23770-
cStackPointer = ((sqInt) ((vmThread->cStackPointer)));
23769+
cFramePointer = (vmThread->cFramePointer);
23770+
cStackPointer = (vmThread->cStackPointer);
2377123771
assert(!(((cFramePointer == null)
2377223772
|| (cStackPointer == null))));
2377323773
GIV(CStackPointer) = cStackPointer;
@@ -24026,8 +24026,8 @@ primitiveProcessBoundThreadId(void)
2402624026
static void
2402724027
primitiveRelinquishProcessor(void)
2402824028
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
24029-
void *currentCFramePointer;
24030-
void *currentCStackPointer;
24029+
volatile usqIntptr_t currentCFramePointer;
24030+
volatile usqIntptr_t currentCStackPointer;
2403124031
sqInt microSecs;
2403224032
sqInt threadIndexAndFlags;
2403324033

@@ -34950,7 +34950,7 @@ primitiveInvokeObjectAsMethod(void)
3495034950
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
3495134951
sqInt i;
3495234952
sqInt lookupClassTag;
34953-
usqInt runArgs;
34953+
sqInt runArgs;
3495434954
sqInt runReceiver;
3495534955
char *sp;
3495634956
char *sp1;
@@ -62312,7 +62312,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr)
6231262312
assert((ReceiverIndex + ((sp >> 3))) < (lengthOf(obj)));
6231362313
contextSize = (sp >> 3);
6231462314
l6: /* end fetchStackPointerOf: */;
62315-
numPointerSlots = CtxtTempFrameStart + contextSize;
62315+
numPointerSlots = ((usqInt) (CtxtTempFrameStart + contextSize));
6231662316
goto l10;
6231762317
}
6231862318
/* begin numSlotsOf: */
@@ -62342,7 +62342,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr)
6234262342
/* begin literalCountOfMethodHeader: */
6234362343
assert((((header) & 7) == 1));
6234462344
numLiterals = ((header >> 3)) & AlternateHeaderNumLiteralsMask;
62345-
numPointerSlots = numLiterals + LiteralStart;
62345+
numPointerSlots = ((usqInt) (numLiterals + LiteralStart));
6234662346
l10: /* end numPointerSlotsWhileCompactingOf:withFormat:savedFirstFieldPointer: */;
6234762347
if ((fmt <= 5 /* lastPointerFormat */)
6234862348
&& (numPointerSlots > 0)) {
@@ -62893,7 +62893,7 @@ prepareForSnapshot(void)
6289362893
sqInt limit;
6289462894
sqInt newEndOfMemory;
6289562895
sqInt next;
62896-
usqInt node;
62896+
sqInt node;
6289762897
SpurSegmentInfo *seg;
6289862898
sqInt smallChild;
6289962899
sqInt treeNode;
@@ -66341,8 +66341,8 @@ static sqInt
6634166341
getErrorObjectFromPrimFailCode(void)
6634266342
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
6634366343
sqInt classIndex;
66344-
sqInt clone;
66345-
sqInt errObj;
66344+
usqInt clone;
66345+
usqInt errObj;
6634666346
sqInt fieldIndex;
6634766347
sqInt i;
6634866348
usqInt newObj;
@@ -70529,7 +70529,7 @@ printCallStackOf(sqInt aContextOrProcessOrFrame)
7052970529
return printCallStackFP(((char *) aContextOrProcessOrFrame));
7053070530
}
7053170531
if (aContextOrProcessOrFrame == (activeProcess())) {
70532-
return printCallStackOf(GIV(framePointer));
70532+
return printCallStackOf(((sqInt)GIV(framePointer)));
7053370533
}
7053470534
if (couldBeProcess(aContextOrProcessOrFrame)) {
7053570535
return printCallStackOf(longAt((aContextOrProcessOrFrame + BaseHeaderSize) + (((sqInt)((usqInt)(SuspendedContextIndex) << (shiftForWord()))))));

spur64src/vm/cointerpmt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Automatically generated by
2-
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2900 uuid: 633a69a6-2981-41c3-bddf-2fa634ab65b3
2+
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2901 uuid: 62f5de98-d59e-4cdc-b4a5-1c0c2d987c71
33
*/
44

55

0 commit comments

Comments
 (0)