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

commits at source.squeak.org commits at source.squeak.org
Wed Mar 23 19:43:25 UTC 2016


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

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

Name: VMMaker.oscog-eem.1739
Author: eem
Time: 23 March 2016, 12:41:48.73939 pm
UUID: e9e980a3-1fc0-4425-acb8-f1f02f1977b0
Ancestors: VMMaker.oscog-eem.1738

Fix a slip in my correction of primitiveUtcWithOffset (wrong arg count check), and use ioLocalSecondsOffset to get the timezone, hence avoiding the need for the atomic accessor for both clock and timezone offset (the offset can only be changed from the system, and hence won't change while this primitive is executing).

Add a Smalltalk epoch version primitiveUtcAndTimezoneOffset and give it primitive #244.

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

Item was added:
+ ----- Method: InterpreterPrimitives>>primitiveUtcAndTimezoneOffset (in category 'system control primitives') -----
+ primitiveUtcAndTimezoneOffset
+ 	"Answer an array with UTC microseconds since the Smalltalk epoch and the
+ 	current seconds offset from GMT in the local time zone. Any pointer object
+ 	 with two or more slots) may be supplied as a parameter."
+ 	| resultArray |
+ 	argumentCount > 0
+ 		ifTrue:
+ 			[argumentCount > 1 ifTrue: [^self primitiveFailFor: PrimErrBadNumArgs].
+ 			 resultArray := self stackTop.
+ 			 ((objectMemory isPointers: resultArray)
+ 			  and: [(objectMemory lengthOf: resultArray) >= 2]) ifFalse:
+ 				[^self primitiveFailFor: PrimErrBadArgument]]
+ 		ifFalse: [resultArray := objectMemory instantiateClass: objectMemory classArray indexableSize: 2].
+ 	"N.B. No pushRemappableOop:/popRemappableOop in Cog because positive64BitIntegerFor: et al use
+ 	 eeInstantiate... allocators which are guaranteed not to do a GC."
+ 	objectMemory
+ 		storePointerUnchecked: 1 ofObject: resultArray withValue: (objectMemory integerObjectOf: self ioLocalSecondsOffset);
+ 		storePointer: 0 ofObject: resultArray withValue: (self positive64BitIntegerFor: self ioUTCMicroseconds).
+ 	self pop: argumentCount thenPush: resultArray!

Item was changed:
  ----- 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. An empty two
  	element array (or any object with two or more slots) may be supplied
  	as a parameter.
  	This is a named (not numbered) primitive in the null module (ie the VM)"
+ 	| epochDelta resultArray |
- 	| epochDelta offset resultArray utcMicroseconds |
  	<export: true>
  	<var: #epochDelta declareC: 'static usqLong epochDelta = 2177452800000000ULL'>
- 	<var: #utcMicroseconds type: #usqLong>
- 	<var: #offset type: #sqLong>
  	self cCode: '' inSmalltalk: [epochDelta := 2177452800000000].
+ 	argumentCount > 0
- 	utcMicroseconds := self ioUTCMicroseconds.
- 	offset := self ioLocalMicroseconds - utcMicroseconds.
- 	offset := offset / 1000000.
- 	argumentCount >= 0
  		ifTrue:
  			[argumentCount > 1 ifTrue: [^self primitiveFailFor: PrimErrBadNumArgs].
  			 resultArray := self stackTop.
  			 ((objectMemory isPointers: resultArray)
  			  and: [(objectMemory lengthOf: resultArray) >= 2]) ifFalse:
  				[^self primitiveFailFor: PrimErrBadArgument]]
  		ifFalse: [resultArray := objectMemory instantiateClass: objectMemory classArray indexableSize: 2].
  	"N.B. No pushRemappableOop:/popRemappableOop in Cog because positive64BitIntegerFor: et al use
  	 eeInstantiate... allocators which are guaranteed not to do a GC."
  	objectMemory
+ 		storePointerUnchecked: 1 ofObject: resultArray withValue: (objectMemory integerObjectOf: self ioLocalSecondsOffset);
+ 		storePointer: 0 ofObject: resultArray withValue: (self positive64BitIntegerFor: self ioUTCMicroseconds - epochDelta).
- 		storePointer: 0 ofObject: resultArray withValue: (self positive64BitIntegerFor: utcMicroseconds - epochDelta);
- 		storePointerUnchecked: 1 ofObject: resultArray withValue: (objectMemory integerObjectOf: offset).
  	self pop: argumentCount thenPush: resultArray!

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



More information about the Vm-dev mailing list