[Vm-dev] VM Maker: VMMaker.oscog-dtl.2147.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Mar 12 22:42:43 UTC 2017


David T. Lewis uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-dtl.2147.mcz

==================== Summary ====================

Name: VMMaker.oscog-dtl.2147
Author: dtl
Time: 12 March 2017, 6:42:24.851569 pm
UUID: 8204a87f-f5aa-40a9-a9a6-532993ed89cb
Ancestors: VMMaker.oscog-eem.2146

Fix variable declaration in primitiveSignalAtMilliseconds to prevent arithmetic overflow in calculating nextWakeupUsecs on millisecond clock rollover.

Addresses a problem reported for 32 bit images converted to 64 bit (e.g. Cuis port to Spur64) for which delay timing has not yet been updated to use microsecond primitives.

Prior to this change, the following would lock a 64 bit Spur image:

s := Semaphore new.
Delay primSignal: s atMilliseconds: Time primMillisecondClock - 10.
s wait.

=============== Diff against VMMaker.oscog-eem.2146 ===============

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 |
  	<var: #msecs type: #usqInt>
+ 	<var: #deltaMsecs type: #usqLong>
  	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).
  			 deltaMsecs < 0 ifTrue:
  				[deltaMsecs := deltaMsecs + MillisecondClockMask + 1].
  			 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