[Vm-dev] VM Maker: VMMaker.oscog-eem.204.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Aug 16 19:56:01 UTC 2012


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.204.mcz

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

Name: VMMaker.oscog-eem.204
Author: eem
Time: 16 August 2012, 12:53:08.745 pm
UUID: c98d555c-fbda-404f-9ebe-0a4e0c6dc800
Ancestors: VMMaker.oscog-eem.203

Integrate primitiveUtcWithOffset and add David Lewis' implementation
of 64-bit usec prims to Interpreter (since they conflict with those
in InterpreterPrimitives).

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

Item was changed:
  ----- Method: Interpreter class>>initializePrimitiveTable (in category 'initialization') -----
(excessive size, no diff calculated)

Item was added:
+ ----- Method: Interpreter>>primitiveLocalMicrosecondClock (in category 'system control primitives') -----
+ primitiveLocalMicrosecondClock
+ 	"Answer the local microseconds since the Smalltalk epoch. The value is
+ 	derived from the Posix epoch with a constant offset corresponding to
+ 	elapsed microseconds between the two epochs according to RFC 868,
+ 	and with an offset duration corresponding to the current offset of local
+ 	time from UTC."
+ 	
+ 	| clock offset offsetMillis epochDelta uSecs |
+ 
+ 	<export: true>
+ 	<var: #clock type: 'usqLong'>
+ 	<var: #offset type: 'int'>
+ 	<var: #offsetMillis type: 'usqLong'>
+ 	<var: #epochDelta declareC: 'static usqLong epochDelta= 2177452800000000ULL'>
+ 	(self cCode: 'ioUtcWithOffset(&clock, &offset)' inSmalltalk: [-1]) = -1
+ 		ifTrue: [^ self primitiveFail].
+ 	clock := clock + epochDelta. "adjust for nominal Smalltalk epoch"
+ 	offsetMillis := offset.
+ 	offsetMillis := offsetMillis * 1000000.
+ 	clock := clock + offsetMillis. "adjust for local time offset"
+ 	uSecs := self positive64BitIntegerFor: clock.
+ 	self pop: 1 thenPush: uSecs.
+ !

Item was added:
+ ----- Method: Interpreter>>primitiveUTCMicrosecondClock (in category 'system control primitives') -----
+ primitiveUTCMicrosecondClock
+ 	"Answer the UTC microseconds since the Smalltalk epoch. The value is
+ 	derived from the Posix epoch with a constant offset corresponding to
+ 	elapsed microseconds between the two epochs according to RFC 868."
+ 	| clock epochDelta uSecs |
+ 
+ 	<export: true>
+ 	<var: #clock type: 'usqLong'>
+ 	<var: #offset type: 'int'>
+ 	<var: #epochDelta declareC: 'static usqLong epochDelta= 2177452800000000ULL'>
+ 	(self cCode: 'ioUtcWithOffset(&clock, &offset)' inSmalltalk: [-1]) = -1
+ 		ifTrue: [^ self primitiveFail].
+ 	clock := clock + epochDelta.
+ 	uSecs := self positive64BitIntegerFor: clock.
+ 	self pop: 1 thenPush: uSecs.
+ !

Item was added:
+ ----- Method: InterpreterPrimitives>>primitiveUtcWithOffset (in category 'system control primitives') -----
+ primitiveUtcWithOffset
+ 	"Answer an array with UTC microseconds since the Posix epoch and
+ 	the current seconds offset from GMT in the local time zone.
+ 	This is a named (not numbered) primitive in the null module (ie the VM)"
+ 	| offset resultArray |
+ 
+ 	<export: true>
+ 	<var: #clock type: 'sqLong'>
+ 	offset := self ioUTCMicroseconds - self ioLocalMicroseconds.
+ 	objectMemory pushRemappableOop: (self positive64BitIntegerFor: self ioUTCMicroseconds).
+ 	resultArray := objectMemory instantiateClass: objectMemory classArray indexableSize: 2.
+ 	self stObject: resultArray at: 1 put: objectMemory popRemappableOop.
+ 	self stObject: resultArray at: 2 put: (objectMemory integerObjectOf: offset).
+ 	self pop: 1 thenPush: resultArray
+ !



More information about the Vm-dev mailing list