VM Maker: VMMaker.oscog-dtl.1730.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker.oscog-dtl.1730.mcz

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

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

Name: VMMaker.oscog-dtl.1730
Author: dtl
Time: 16 March 2016, 9:06:26.74934 pm
UUID: ad4e53e1-bdbc-4cb9-b5fb-f1229ca4e19f
Ancestors: VMMaker.oscog-nice.1729

Allow primitiveUtcWithOffset to accept an optional parameter with an array or object with two or more slots to store UTC posix microseconds and time zone offset in seconds. Compatibility with VMM trunk. Note, consider incorporating ioUtcWithOffset from SVN trunk to provide true atomic primitive.

=============== Diff against VMMaker.oscog-nice.1729 ===============

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.
- "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)"
  | epochDelta offset resultArray utcMicroseconds |
 
  <export: true>
  <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.
  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].
- resultArray := objectMemory instantiateClass: objectMemory classArray indexableSize: 2.
  objectMemory storePointer: 0 ofObject: resultArray withValue: objectMemory popRemappableOop.
  objectMemory storePointerUnchecked: 1 ofObject: resultArray withValue: (objectMemory integerObjectOf: offset).
  self pop: 1 thenPush: resultArray
  !

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-dtl.1730.mcz

Levente Uzonyi
 
Hi Dave,

Wouldn't it be better if the primitive were failing for more than one
argument?
Also, I liked Bert's idea to use the Squeak epoch, and I understand that
you want to keep this primitive to use the Unix epoch, but in my opinion
this is the best time to add the new primitive for the other variant.
Are these changes going to appear in the Cog branch too?

Levente

On Thu, 17 Mar 2016, [hidden email] wrote:

>
> David T. Lewis uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker.oscog-dtl.1730.mcz
>
> ==================== Summary ====================
>
> Name: VMMaker.oscog-dtl.1730
> Author: dtl
> Time: 16 March 2016, 9:06:26.74934 pm
> UUID: ad4e53e1-bdbc-4cb9-b5fb-f1229ca4e19f
> Ancestors: VMMaker.oscog-nice.1729
>
> Allow primitiveUtcWithOffset to accept an optional parameter with an array or object with two or more slots to store UTC posix microseconds and time zone offset in seconds. Compatibility with VMM trunk. Note, consider incorporating ioUtcWithOffset from SVN trunk to provide true atomic primitive.
>
> =============== Diff against VMMaker.oscog-nice.1729 ===============
>
> 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.
> - "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)"
>   | epochDelta offset resultArray utcMicroseconds |
>
>   <export: true>
>   <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.
>   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].
> - resultArray := objectMemory instantiateClass: objectMemory classArray indexableSize: 2.
>   objectMemory storePointer: 0 ofObject: resultArray withValue: objectMemory popRemappableOop.
>   objectMemory storePointerUnchecked: 1 ofObject: resultArray withValue: (objectMemory integerObjectOf: offset).
>   self pop: 1 thenPush: resultArray
>  !
>
>
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-dtl.1730.mcz

David T. Lewis
 
Hi Levente,

I am away and cannot check it right now, but the primitive is supposed to
be doing exactly what you say. It should accept zero or one arguments, and
fail otherwise. If the argument is provided, it must be an object with
room to store two or more pointers, otherwise the primitive should fail.
If either of these is not happening, it's a bug.

VMMaker.oscog-dtl.1730.mcz is an update to the oscog branch that should
add the ability to accept the optional parameter for Cog/Spur. Hopefully I
got the update right, I'm not sure I tested it as well as I should have
last night.

If we want to add a variant of the primitive that answers time relative to
Smalltalk epoch then yes, now would be a good time to do it.

Dave

>
> Hi Dave,
>
> Wouldn't it be better if the primitive were failing for more than one
> argument?
> Also, I liked Bert's idea to use the Squeak epoch, and I understand that
> you want to keep this primitive to use the Unix epoch, but in my opinion
> this is the best time to add the new primitive for the other variant.
> Are these changes going to appear in the Cog branch too?
>
> Levente
>
> On Thu, 17 Mar 2016, [hidden email] wrote:
>
>>
>> David T. Lewis uploaded a new version of VMMaker to project VM Maker:
>> http://source.squeak.org/VMMaker/VMMaker.oscog-dtl.1730.mcz
>>
>> ==================== Summary ====================
>>
>> Name: VMMaker.oscog-dtl.1730
>> Author: dtl
>> Time: 16 March 2016, 9:06:26.74934 pm
>> UUID: ad4e53e1-bdbc-4cb9-b5fb-f1229ca4e19f
>> Ancestors: VMMaker.oscog-nice.1729
>>
>> Allow primitiveUtcWithOffset to accept an optional parameter with an
>> array or object with two or more slots to store UTC posix microseconds
>> and time zone offset in seconds. Compatibility with VMM trunk. Note,
>> consider incorporating ioUtcWithOffset from SVN trunk to provide true
>> atomic primitive.
>>
>> =============== Diff against VMMaker.oscog-nice.1729 ===============
>>
>> 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.
>> - "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)"
>>   | epochDelta offset resultArray utcMicroseconds |
>>
>>   <export: true>
>>   <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.
>>   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].
>> - resultArray := objectMemory instantiateClass: objectMemory classArray
>> indexableSize: 2.
>>   objectMemory storePointer: 0 ofObject: resultArray withValue:
>> objectMemory popRemappableOop.
>>   objectMemory storePointerUnchecked: 1 ofObject: resultArray withValue:
>> (objectMemory integerObjectOf: offset).
>>   self pop: 1 thenPush: resultArray
>>  !
>>
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-dtl.1730.mcz

Levente Uzonyi
 
Hi Dave,

You're right. I missed that check at the beginning of the method.

Levente

On Thu, 17 Mar 2016, David T. Lewis wrote:

>
> Hi Levente,
>
> I am away and cannot check it right now, but the primitive is supposed to
> be doing exactly what you say. It should accept zero or one arguments, and
> fail otherwise. If the argument is provided, it must be an object with
> room to store two or more pointers, otherwise the primitive should fail.
> If either of these is not happening, it's a bug.
>
> VMMaker.oscog-dtl.1730.mcz is an update to the oscog branch that should
> add the ability to accept the optional parameter for Cog/Spur. Hopefully I
> got the update right, I'm not sure I tested it as well as I should have
> last night.
>
> If we want to add a variant of the primitive that answers time relative to
> Smalltalk epoch then yes, now would be a good time to do it.
>
> Dave
>
>>
>> Hi Dave,
>>
>> Wouldn't it be better if the primitive were failing for more than one
>> argument?
>> Also, I liked Bert's idea to use the Squeak epoch, and I understand that
>> you want to keep this primitive to use the Unix epoch, but in my opinion
>> this is the best time to add the new primitive for the other variant.
>> Are these changes going to appear in the Cog branch too?
>>
>> Levente
>>
>> On Thu, 17 Mar 2016, [hidden email] wrote:
>>
>>>
>>> David T. Lewis uploaded a new version of VMMaker to project VM Maker:
>>> http://source.squeak.org/VMMaker/VMMaker.oscog-dtl.1730.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: VMMaker.oscog-dtl.1730
>>> Author: dtl
>>> Time: 16 March 2016, 9:06:26.74934 pm
>>> UUID: ad4e53e1-bdbc-4cb9-b5fb-f1229ca4e19f
>>> Ancestors: VMMaker.oscog-nice.1729
>>>
>>> Allow primitiveUtcWithOffset to accept an optional parameter with an
>>> array or object with two or more slots to store UTC posix microseconds
>>> and time zone offset in seconds. Compatibility with VMM trunk. Note,
>>> consider incorporating ioUtcWithOffset from SVN trunk to provide true
>>> atomic primitive.
>>>
>>> =============== Diff against VMMaker.oscog-nice.1729 ===============
>>>
>>> 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.
>>> - "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)"
>>>   | epochDelta offset resultArray utcMicroseconds |
>>>
>>>   <export: true>
>>>   <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.
>>>   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].
>>> - resultArray := objectMemory instantiateClass: objectMemory classArray
>>> indexableSize: 2.
>>>   objectMemory storePointer: 0 ofObject: resultArray withValue:
>>> objectMemory popRemappableOop.
>>>   objectMemory storePointerUnchecked: 1 ofObject: resultArray withValue:
>>> (objectMemory integerObjectOf: offset).
>>>   self pop: 1 thenPush: resultArray
>>>  !
>>>
>>>
>>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-dtl.1730.mcz

Eliot Miranda-2
In reply to this post by commits-2
 
Hi David,

On Wed, Mar 16, 2016 at 6:07 PM, <[hidden email]> wrote:

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

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

Name: VMMaker.oscog-dtl.1730
Author: dtl
Time: 16 March 2016, 9:06:26.74934 pm
UUID: ad4e53e1-bdbc-4cb9-b5fb-f1229ca4e19f
Ancestors: VMMaker.oscog-nice.1729

Allow primitiveUtcWithOffset to accept an optional parameter with an array or object with two or more slots to store UTC posix microseconds and time zone offset in seconds. Compatibility with VMM trunk. Note, consider incorporating ioUtcWithOffset from SVN trunk to provide true atomic primitive.

Feel free to move the code over.
 

=============== Diff against VMMaker.oscog-nice.1729 ===============

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.
-       "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)"
        | epochDelta offset resultArray utcMicroseconds |

        <export: true>
        <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.
        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].
-       resultArray := objectMemory instantiateClass: objectMemory classArray indexableSize: 2.
        objectMemory storePointer: 0 ofObject: resultArray withValue: objectMemory popRemappableOop.
        objectMemory storePointerUnchecked: 1 ofObject: resultArray withValue: (objectMemory integerObjectOf: offset).
        self pop: 1 thenPush: resultArray
  !




--
_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-dtl.1730.mcz

David T. Lewis
 
On Fri, Mar 18, 2016 at 01:31:23PM -0700, Eliot Miranda wrote:

>  
> Hi David,
>
> On Wed, Mar 16, 2016 at 6:07 PM, <[hidden email]> wrote:
>
> >
> > David T. Lewis uploaded a new version of VMMaker to project VM Maker:
> > http://source.squeak.org/VMMaker/VMMaker.oscog-dtl.1730.mcz
> >
> > ==================== Summary ====================
> >
> > Name: VMMaker.oscog-dtl.1730
> > Author: dtl
> > Time: 16 March 2016, 9:06:26.74934 pm
> > UUID: ad4e53e1-bdbc-4cb9-b5fb-f1229ca4e19f
> > Ancestors: VMMaker.oscog-nice.1729
> >
> > Allow primitiveUtcWithOffset to accept an optional parameter with an array
> > or object with two or more slots to store UTC posix microseconds and time
> > zone offset in seconds. Compatibility with VMM trunk. Note, consider
> > incorporating ioUtcWithOffset from SVN trunk to provide true atomic
> > primitive.
> >
>
> Feel free to move the code over.
>

Hi Eliot,

Do you mean move ioUtcWithOffset over? If so I will be happy to do that,
although maybe until a few days or weeks from now. I would let you know
in advance before making any changes. I definitely don't want to touch
something like that without your approval.

Dave

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-dtl.1730.mcz

Eliot Miranda-2
 


On Fri, Mar 18, 2016 at 2:51 PM, David T. Lewis <[hidden email]> wrote:

On Fri, Mar 18, 2016 at 01:31:23PM -0700, Eliot Miranda wrote:
>
> Hi David,
>
> On Wed, Mar 16, 2016 at 6:07 PM, <[hidden email]> wrote:
>
> >
> > David T. Lewis uploaded a new version of VMMaker to project VM Maker:
> > http://source.squeak.org/VMMaker/VMMaker.oscog-dtl.1730.mcz
> >
> > ==================== Summary ====================
> >
> > Name: VMMaker.oscog-dtl.1730
> > Author: dtl
> > Time: 16 March 2016, 9:06:26.74934 pm
> > UUID: ad4e53e1-bdbc-4cb9-b5fb-f1229ca4e19f
> > Ancestors: VMMaker.oscog-nice.1729
> >
> > Allow primitiveUtcWithOffset to accept an optional parameter with an array
> > or object with two or more slots to store UTC posix microseconds and time
> > zone offset in seconds. Compatibility with VMM trunk. Note, consider
> > incorporating ioUtcWithOffset from SVN trunk to provide true atomic
> > primitive.
> >
>
> Feel free to move the code over.
>

Hi Eliot,

Do you mean move ioUtcWithOffset over? If so I will be happy to do that,
although maybe until a few days or weeks from now. I would let you know
in advance before making any changes. I definitely don't want to touch
something like that without your approval.

Yes.  And no hurry.  Remember that at some point I plan to implement the clock following scheme I wrote up recently, and that may introduce some renamings.  But getting the concepts such as atomic access to UTC and offset in one go is still important, even if things get rewritten a little.

_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-dtl.1730.mcz

David T. Lewis
 
On Fri, Mar 18, 2016 at 03:02:20PM -0700, Eliot Miranda wrote:

>  
> On Fri, Mar 18, 2016 at 2:51 PM, David T. Lewis <[hidden email]> wrote:
>
> >
> > On Fri, Mar 18, 2016 at 01:31:23PM -0700, Eliot Miranda wrote:
> > >
> > > Hi David,
> > >
> > > On Wed, Mar 16, 2016 at 6:07 PM, <[hidden email]> wrote:
> > >
> > > >
> > > > David T. Lewis uploaded a new version of VMMaker to project VM Maker:
> > > > http://source.squeak.org/VMMaker/VMMaker.oscog-dtl.1730.mcz
> > > >
> > > > ==================== Summary ====================
> > > >
> > > > Name: VMMaker.oscog-dtl.1730
> > > > Author: dtl
> > > > Time: 16 March 2016, 9:06:26.74934 pm
> > > > UUID: ad4e53e1-bdbc-4cb9-b5fb-f1229ca4e19f
> > > > Ancestors: VMMaker.oscog-nice.1729
> > > >
> > > > Allow primitiveUtcWithOffset to accept an optional parameter with an
> > array
> > > > or object with two or more slots to store UTC posix microseconds and
> > time
> > > > zone offset in seconds. Compatibility with VMM trunk. Note, consider
> > > > incorporating ioUtcWithOffset from SVN trunk to provide true atomic
> > > > primitive.
> > > >
> > >
> > > Feel free to move the code over.
> > >
> >
> > Hi Eliot,
> >
> > Do you mean move ioUtcWithOffset over? If so I will be happy to do that,
> > although maybe until a few days or weeks from now. I would let you know
> > in advance before making any changes. I definitely don't want to touch
> > something like that without your approval.
> >
>
> Yes.  And no hurry.  Remember that at some point I plan to implement the
> clock following scheme I wrote up recently, and that may introduce some
> renamings.  But getting the concepts such as atomic access to UTC and
> offset in one go is still important, even if things get rewritten a little.
>

OK good, I'll get to it as soon as I can, and I will let you know in advance
before changing anything.

Dave