Skip to content

Commit

Permalink
Fix primitiveSignalAtMilliseconds for the cog.v3 flavours
Browse files Browse the repository at this point in the history
We could also fix it for the spur variants, but this can wait because those primitive are presumably unused (superseded by microsecond handling)
  • Loading branch information
nicolas-cellier-aka-nice committed Oct 26, 2019
1 parent 588a4ca commit 01b7df8
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 54 deletions.
23 changes: 16 additions & 7 deletions src/vm/cointerp.c
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920
CCodeGeneratorGlobalStructure VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2
from
CoInterpreter VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920
CoInterpreter VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2
*/
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920 " __DATE__ ;
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;


Expand Down Expand Up @@ -2217,7 +2217,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 578 */])(void) = {
0 };
sqInt checkedPluginName;
char expensiveAsserts = 0;
const char *interpreterVersion = "Croquet Closure Cog[SqueakV3] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2570]";
const char *interpreterVersion = "Croquet Closure Cog[SqueakV3] VM [CoInterpreterPrimitives VMMaker.oscog-nice.2572]";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;

Expand Down Expand Up @@ -54293,6 +54293,7 @@ primitiveSignalAtMilliseconds(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt ccIndex;
sqLong deltaMsecs;
sqLong limit;
usqInt msecs;
sqInt msecsObj;
sqInt oop;
Expand All @@ -54316,10 +54317,18 @@ primitiveSignalAtMilliseconds(void)
}
longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(TheTimerSemaphore) << (shiftForWord())))), sema);
deltaMsecs = msecs - ((ioMSecs()) & MillisecondClockMask);
if (deltaMsecs < 0) {
deltaMsecs = (deltaMsecs + MillisecondClockMask) + 1;

/* Handle a roll-over that could happen in between image invocation of ioMSecs and this invocation.
This will limit the maximum relative duration to MillisecondClockMask/2, about 3 days currently.
Every delay longer than that limit may lead to undefined behavior (shorten delay, or no delay at all).
The maximum delay might be further limited by platform dependent nextWakeupUsecs handling. */
limit = ((usqInt) MillisecondClockMask) >> 1;
if (deltaMsecs > limit) {
deltaMsecs -= MillisecondClockMask;
}
if (deltaMsecs > 0) {
GIV(nextWakeupUsecs) = (ioUTCMicroseconds()) + (deltaMsecs * 1000);
}
GIV(nextWakeupUsecs) = (ioUTCMicroseconds()) + (deltaMsecs * 1000);
/* begin pop: */
GIV(stackPointer) += 2 * BytesPerWord;
return;
Expand Down
2 changes: 1 addition & 1 deletion src/vm/cointerp.h
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920
CCodeGeneratorGlobalStructure VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2
*/


Expand Down
33 changes: 21 additions & 12 deletions src/vm/cointerpmt.c
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920
CCodeGeneratorGlobalStructure VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2
from
CoInterpreterMT VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920
CoInterpreterMT VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2
*/
static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920 " __DATE__ ;
static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;


Expand Down Expand Up @@ -2311,7 +2311,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 578 */])(void) = {
0 };
sqInt checkedPluginName;
char expensiveAsserts = 0;
const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.2570]";
const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-nice.2572]";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;

Expand Down Expand Up @@ -34366,14 +34366,14 @@ eeInstantiateAndInitializeClassindexableSize(sqInt classPointer, sqInt size)
sqInt binc;
sqInt bm1;
sqInt byteSize;
usqInt cClass;
sqInt cClass;
sqInt classFormat;
usqInt end;
sqInt fillWord;
sqInt format;
usqInt hash;
int hdrSize;
usqInt header1;
sqInt header1;
sqInt header2;
sqInt header3;
usqInt i;
Expand Down Expand Up @@ -34915,7 +34915,7 @@ eeInstantiateSmallClassnumSlots(sqInt classPointer, sqInt numSlots)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
usqInt hash;
int hdrSize;
usqInt header1;
sqInt header1;
sqInt header2;
usqInt newChunk;
usqInt newFreeStart;
Expand Down Expand Up @@ -40055,7 +40055,7 @@ instantiateClassindexableSize(sqInt classPointer, sqInt size)
sqInt bm1;
sqInt byteSize;
sqInt byteSize1;
usqInt cClass;
sqInt cClass;
sqInt classFormat;
sqInt classOop;
usqInt end;
Expand All @@ -40064,7 +40064,7 @@ instantiateClassindexableSize(sqInt classPointer, sqInt size)
sqInt format;
usqInt hash;
sqInt hdrSize;
usqInt header1;
sqInt header1;
sqInt header3;
usqInt i;
sqInt minFree;
Expand Down Expand Up @@ -56250,6 +56250,7 @@ primitiveSignalAtMilliseconds(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt ccIndex;
sqLong deltaMsecs;
sqLong limit;
usqInt msecs;
sqInt msecsObj;
sqInt oop;
Expand All @@ -56273,10 +56274,18 @@ primitiveSignalAtMilliseconds(void)
}
longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(TheTimerSemaphore) << (shiftForWord())))), sema);
deltaMsecs = msecs - ((ioMSecs()) & MillisecondClockMask);
if (deltaMsecs < 0) {
deltaMsecs = (deltaMsecs + MillisecondClockMask) + 1;

/* Handle a roll-over that could happen in between image invocation of ioMSecs and this invocation.
This will limit the maximum relative duration to MillisecondClockMask/2, about 3 days currently.
Every delay longer than that limit may lead to undefined behavior (shorten delay, or no delay at all).
The maximum delay might be further limited by platform dependent nextWakeupUsecs handling. */
limit = ((usqInt) MillisecondClockMask) >> 1;
if (deltaMsecs > limit) {
deltaMsecs -= MillisecondClockMask;
}
if (deltaMsecs > 0) {
GIV(nextWakeupUsecs) = (ioUTCMicroseconds()) + (deltaMsecs * 1000);
}
GIV(nextWakeupUsecs) = (ioUTCMicroseconds()) + (deltaMsecs * 1000);
/* begin pop: */
GIV(stackPointer) += 2 * BytesPerWord;
return;
Expand Down
2 changes: 1 addition & 1 deletion src/vm/cointerpmt.h
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920
CCodeGeneratorGlobalStructure VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2
*/


Expand Down
23 changes: 16 additions & 7 deletions src/vm/gcc3x-cointerp.c
Expand Up @@ -2,11 +2,11 @@


/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920
CCodeGeneratorGlobalStructure VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2
from
CoInterpreter VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920
CoInterpreter VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2
*/
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920 " __DATE__ ;
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;


Expand Down Expand Up @@ -2220,7 +2220,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 578 */])(void) = {
0 };
sqInt checkedPluginName;
char expensiveAsserts = 0;
const char *interpreterVersion = "Croquet Closure Cog[SqueakV3] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2570]";
const char *interpreterVersion = "Croquet Closure Cog[SqueakV3] VM [CoInterpreterPrimitives VMMaker.oscog-nice.2572]";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;

Expand Down Expand Up @@ -54302,6 +54302,7 @@ primitiveSignalAtMilliseconds(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt ccIndex;
sqLong deltaMsecs;
sqLong limit;
usqInt msecs;
sqInt msecsObj;
sqInt oop;
Expand All @@ -54325,10 +54326,18 @@ primitiveSignalAtMilliseconds(void)
}
longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(TheTimerSemaphore) << (shiftForWord())))), sema);
deltaMsecs = msecs - ((ioMSecs()) & MillisecondClockMask);
if (deltaMsecs < 0) {
deltaMsecs = (deltaMsecs + MillisecondClockMask) + 1;

/* Handle a roll-over that could happen in between image invocation of ioMSecs and this invocation.
This will limit the maximum relative duration to MillisecondClockMask/2, about 3 days currently.
Every delay longer than that limit may lead to undefined behavior (shorten delay, or no delay at all).
The maximum delay might be further limited by platform dependent nextWakeupUsecs handling. */
limit = ((usqInt) MillisecondClockMask) >> 1;
if (deltaMsecs > limit) {
deltaMsecs -= MillisecondClockMask;
}
if (deltaMsecs > 0) {
GIV(nextWakeupUsecs) = (ioUTCMicroseconds()) + (deltaMsecs * 1000);
}
GIV(nextWakeupUsecs) = (ioUTCMicroseconds()) + (deltaMsecs * 1000);
/* begin pop: */
GIV(stackPointer) += 2 * BytesPerWord;
return;
Expand Down
33 changes: 21 additions & 12 deletions src/vm/gcc3x-cointerpmt.c
Expand Up @@ -2,11 +2,11 @@


/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920
CCodeGeneratorGlobalStructure VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2
from
CoInterpreterMT VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920
CoInterpreterMT VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2
*/
static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.2570 uuid: b61e294a-cb2a-4d9a-9e7e-8cc17676c920 " __DATE__ ;
static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;


Expand Down Expand Up @@ -2314,7 +2314,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 578 */])(void) = {
0 };
sqInt checkedPluginName;
char expensiveAsserts = 0;
const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.2570]";
const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-nice.2572]";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;

Expand Down Expand Up @@ -34375,14 +34375,14 @@ eeInstantiateAndInitializeClassindexableSize(sqInt classPointer, sqInt size)
sqInt binc;
sqInt bm1;
sqInt byteSize;
usqInt cClass;
sqInt cClass;
sqInt classFormat;
usqInt end;
sqInt fillWord;
sqInt format;
usqInt hash;
int hdrSize;
usqInt header1;
sqInt header1;
sqInt header2;
sqInt header3;
usqInt i;
Expand Down Expand Up @@ -34924,7 +34924,7 @@ eeInstantiateSmallClassnumSlots(sqInt classPointer, sqInt numSlots)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
usqInt hash;
int hdrSize;
usqInt header1;
sqInt header1;
sqInt header2;
usqInt newChunk;
usqInt newFreeStart;
Expand Down Expand Up @@ -40064,7 +40064,7 @@ instantiateClassindexableSize(sqInt classPointer, sqInt size)
sqInt bm1;
sqInt byteSize;
sqInt byteSize1;
usqInt cClass;
sqInt cClass;
sqInt classFormat;
sqInt classOop;
usqInt end;
Expand All @@ -40073,7 +40073,7 @@ instantiateClassindexableSize(sqInt classPointer, sqInt size)
sqInt format;
usqInt hash;
sqInt hdrSize;
usqInt header1;
sqInt header1;
sqInt header3;
usqInt i;
sqInt minFree;
Expand Down Expand Up @@ -56259,6 +56259,7 @@ primitiveSignalAtMilliseconds(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt ccIndex;
sqLong deltaMsecs;
sqLong limit;
usqInt msecs;
sqInt msecsObj;
sqInt oop;
Expand All @@ -56282,10 +56283,18 @@ primitiveSignalAtMilliseconds(void)
}
longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(TheTimerSemaphore) << (shiftForWord())))), sema);
deltaMsecs = msecs - ((ioMSecs()) & MillisecondClockMask);
if (deltaMsecs < 0) {
deltaMsecs = (deltaMsecs + MillisecondClockMask) + 1;

/* Handle a roll-over that could happen in between image invocation of ioMSecs and this invocation.
This will limit the maximum relative duration to MillisecondClockMask/2, about 3 days currently.
Every delay longer than that limit may lead to undefined behavior (shorten delay, or no delay at all).
The maximum delay might be further limited by platform dependent nextWakeupUsecs handling. */
limit = ((usqInt) MillisecondClockMask) >> 1;
if (deltaMsecs > limit) {
deltaMsecs -= MillisecondClockMask;
}
if (deltaMsecs > 0) {
GIV(nextWakeupUsecs) = (ioUTCMicroseconds()) + (deltaMsecs * 1000);
}
GIV(nextWakeupUsecs) = (ioUTCMicroseconds()) + (deltaMsecs * 1000);
/* begin pop: */
GIV(stackPointer) += 2 * BytesPerWord;
return;
Expand Down
23 changes: 16 additions & 7 deletions stacksrc/vm/gcc3x-interp.c
Expand Up @@ -2,11 +2,11 @@


/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2568 uuid: baa0b804-06fa-40fd-a87d-a9267b00ef76
CCodeGeneratorGlobalStructure VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2
from
StackInterpreter VMMaker.oscog-eem.2568 uuid: baa0b804-06fa-40fd-a87d-a9267b00ef76
StackInterpreter VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2
*/
static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.2568 uuid: baa0b804-06fa-40fd-a87d-a9267b00ef76 " __DATE__ ;
static char __buildInfo[] = "StackInterpreter VMMaker.oscog-nice.2572 uuid: 3489e554-cf3d-44fb-bfac-638c04ecdcf2 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;


Expand Down Expand Up @@ -1974,7 +1974,7 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 578 */])(void) = {
0 };
sqInt checkedPluginName;
char expensiveAsserts = 0;
const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.2568]";
const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreterPrimitives VMMaker.oscog-nice.2572]";
volatile int sendTrace;
sqInt suppressHeartbeatFlag;

Expand Down Expand Up @@ -46332,6 +46332,7 @@ primitiveSignalAtMilliseconds(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt ccIndex;
sqLong deltaMsecs;
sqLong limit;
usqInt msecs;
sqInt msecsObj;
sqInt oop;
Expand All @@ -46355,10 +46356,18 @@ primitiveSignalAtMilliseconds(void)
}
longAtput((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(TheTimerSemaphore) << (shiftForWord())))), sema);
deltaMsecs = msecs - ((ioMSecs()) & MillisecondClockMask);
if (deltaMsecs < 0) {
deltaMsecs = (deltaMsecs + MillisecondClockMask) + 1;

/* Handle a roll-over that could happen in between image invocation of ioMSecs and this invocation.
This will limit the maximum relative duration to MillisecondClockMask/2, about 3 days currently.
Every delay longer than that limit may lead to undefined behavior (shorten delay, or no delay at all).
The maximum delay might be further limited by platform dependent nextWakeupUsecs handling. */
limit = ((usqInt) MillisecondClockMask) >> 1;
if (deltaMsecs > limit) {
deltaMsecs -= MillisecondClockMask;
}
if (deltaMsecs > 0) {
GIV(nextWakeupUsecs) = (ioUTCMicroseconds()) + (deltaMsecs * 1000);
}
GIV(nextWakeupUsecs) = (ioUTCMicroseconds()) + (deltaMsecs * 1000);
/* begin pop: */
GIV(stackPointer) += 2 * BytesPerWord;
return;
Expand Down

0 comments on commit 01b7df8

Please sign in to comment.