Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: b3f2941772a038e04307bd8b7f87e29d0d93c134
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/b3f2941772a038e043…
Author: Nicolas Cellier <nicolas.cellier.aka.nice(a)gmail.com>
Date: 2019-10-27 (Sun, 27 Oct 2019)
Changed paths:
M src/vm/cointerp.c
M src/vm/cointerp.h
M src/vm/gcc3x-cointerp.c
M stacksrc/vm/gcc3x-interp.c
M stacksrc/vm/interp.c
Log Message:
-----------
Fix issue 436 again
We must let the Semaphore be signalled in case of expired delay!
Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-nice.2573.mcz
==================== Summary ====================
Name: VMMaker.oscog-nice.2573
Author: nice
Time: 27 October 2019, 12:52:59.027591 pm
UUID: 263ac95f-c419-4deb-93e5-52ce2f4f9c6d
Ancestors: VMMaker.oscog-nice.2572
Complete the fix of primitiveSignalAtMilliseconds
If delatMsecs <= 0, the delay has expired, AND we must signal the Semaphore in this case!
Don't signal the Semaphore immediately, let the checkForEventsMayContextSwitch: (cog replacement for checkForInterrupts) do its work by setting the nextWakeupUsecs now.
=============== Diff against VMMaker.oscog-nice.2572 ===============
Item was changed:
----- Method: StackInterpreterPrimitives>>primitiveSignalAtMilliseconds (in category 'system control primitives') -----
primitiveSignalAtMilliseconds
"Cause the time semaphore, if one has been registered, to be
signalled when the microsecond clock is greater than or equal to
the given tick value. A tick value of zero turns off timer interrupts."
| msecsObj msecs deltaMsecs sema limit |
<var: #msecs type: #usqInt>
<var: #deltaMsecs type: #sqLong>
<var: #limit type: #sqLong>
msecsObj := self stackTop.
sema := self stackValue: 1.
msecs := self positive32BitValueOf: msecsObj.
self successful ifTrue:
[(objectMemory isSemaphoreOop: sema) ifTrue:
[objectMemory splObj: TheTimerSemaphore put: sema.
deltaMsecs := msecs - (self ioMSecs bitAnd: MillisecondClockMask).
limit := 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)"
- 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."
deltaMsecs > limit ifTrue: [deltaMsecs := deltaMsecs - MillisecondClockMask].
+ nextWakeupUsecs := deltaMsecs > 0
+ ifTrue: [self ioUTCMicroseconds + (deltaMsecs * 1000)]
+ ifFalse: [self ioUTCMicroseconds].
- deltaMsecs > 0
- ifTrue:
- [nextWakeupUsecs := self ioUTCMicroseconds + (deltaMsecs * 1000)].
^self pop: 2].
sema = objectMemory nilObject ifTrue:
[objectMemory
storePointer: TheTimerSemaphore
ofObject: objectMemory specialObjectsOop
withValue: objectMemory nilObject.
nextWakeupUsecs := 0.
^self pop: 2]].
self primitiveFailFor: PrimErrBadArgument!
You can view, comment on, or merge this pull request online at:
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/439
-- Commit Summary --
* Avoid an overflow in ioRelinquishProcessorForMicroseconds
* Align iOS and obsolete Mac OS
* Fix primitiveSignalAtMilliseconds for the cog.v3 flavours
-- File Changes --
M platforms/Mac OS/vm/sqMacTime.c (21)
M platforms/iOS/vm/Common/Classes/sqMacV2Time.c (25)
M platforms/iOS/vm/Common/sqDummyaio.h (2)
M platforms/iOS/vm/iPhone/sqDummyaio.c (16)
M platforms/minheadless/unix/sqUnixHeartbeat.c (2)
M platforms/unix/misc/threadValidate/sqUnixHeartbeat.c (6)
M platforms/unix/vm-display-Quartz/zzz/sqUnixQuartz.m (2)
M platforms/unix/vm/sqUnixHeartbeat.c (2)
M platforms/unix/vm/sqUnixITimerHeartbeat.c (4)
M platforms/unix/vm/sqUnixITimerTickerHeartbeat.c (4)
M src/vm/cointerp.c (23)
M src/vm/cointerp.h (2)
M src/vm/cointerpmt.c (33)
M src/vm/cointerpmt.h (2)
M src/vm/gcc3x-cointerp.c (23)
M src/vm/gcc3x-cointerpmt.c (33)
M stacksrc/vm/gcc3x-interp.c (23)
M stacksrc/vm/interp.c (23)
-- Patch Links --
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/439.patchhttps://github.com/OpenSmalltalk/opensmalltalk-vm/pull/439.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/439