[Vm-dev] VM Maker: VMMaker.oscog-nice.2573.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Oct 27 10:53:55 UTC 2019


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!



More information about the Vm-dev mailing list