[Vm-dev] VM Maker: VMMaker.oscog-eem.1738.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Mar 23 19:24:44 UTC 2016
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1738.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1738
Author: eem
Time: 23 March 2016, 12:23:01.545398 pm
UUID: 4025874f-971e-4cf2-86f4-c59e7b0b4a55
Ancestors: VMMaker.oscog-eem.1737
Fix a slip in VMMaker.oscog-dtl.1730; if the primitive failed having taken an argument that was not pointers of length 2 or more, it would have left the stack off by one. Nuke the push/popRemappableOop cuz in Cog it isn't required.
=============== Diff against VMMaker.oscog-eem.1737 ===============
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 offset resultArray utcMicroseconds |
-
<export: true>
+ <var: #epochDelta declareC: 'static usqLong epochDelta = 2177452800000000ULL'>
- <var: #epochDelta declareC: 'static usqLong epochDelta= 2177452800000000ULL'>
<var: #utcMicroseconds type: #usqLong>
<var: #offset type: #sqLong>
- argumentCount > 1 ifTrue: [^self primitiveFailFor: PrimErrBadNumArgs].
self cCode: '' inSmalltalk: [epochDelta := 2177452800000000].
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]]
- objectMemory pushRemappableOop: (self positive64BitIntegerFor: utcMicroseconds - epochDelta).
- argumentCount > 0
- ifTrue: [resultArray := self popStack.
- ((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
+ storePointer: 0 ofObject: resultArray withValue: (self positive64BitIntegerFor: utcMicroseconds - epochDelta);
+ storePointerUnchecked: 1 ofObject: resultArray withValue: (objectMemory integerObjectOf: offset).
+ self pop: argumentCount thenPush: resultArray!
- objectMemory storePointer: 0 ofObject: resultArray withValue: objectMemory popRemappableOop.
- objectMemory storePointerUnchecked: 1 ofObject: resultArray withValue: (objectMemory integerObjectOf: offset).
- self pop: 1 thenPush: resultArray
- !
More information about the Vm-dev
mailing list