VM Maker: VMMaker.oscog-EstebanLorenzano.1869.mcz

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

VM Maker: VMMaker.oscog-EstebanLorenzano.1869.mcz

commits-2
 
Esteban Lorenzano uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-EstebanLorenzano.1869.mcz

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

Name: VMMaker.oscog-EstebanLorenzano.1869
Author: EstebanLorenzano
Time: 26 May 2016, 1:49:23.32419 pm
UUID: 6ccd2249-0a2c-4279-90b4-861c39f29859
Ancestors: VMMaker.oscog-eem.1868

last change breaks cCode: '' (strings).
this commit fixes some, but not all... I don't know what to do with this (from UnixOSProcessPlugin):

self cCode: 'sigchldHandlerAction.sa_sigaction = reapChildProcess'

(that dot there...)


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

Item was changed:
  ----- Method: FloatArrayPlugin>>primitiveLength (in category 'arithmetic primitives') -----
  primitiveLength
 
  "Primitive. Compute the length of the argument (sqrt of sum of component squares)."
 
  | rcvr rcvrPtr length result |
  <export: true>
  <var: #rcvrPtr type:'float *'>
  <var: #result type:'double '>
  rcvr := interpreterProxy stackObjectValue: 0.
  interpreterProxy failed ifTrue:[^nil].
  interpreterProxy success: (interpreterProxy isWords: rcvr).
  interpreterProxy failed ifTrue:[^nil].
  length := interpreterProxy stSizeOf: rcvr.
  interpreterProxy success: true.
  rcvrPtr := self cCoerce: (interpreterProxy firstIndexableField: rcvr) to: 'float *'.
  result := 0.0.
  0 to: length-1 do:[:i|
  result := result + ((self cCoerce: (rcvrPtr at: i) to: 'double') * (self cCoerce: (rcvrPtr at: i) to: 'double')).
  ].
+ result := self cCode: [self sqrt:result] inSmalltalk: [result sqrt].
- result := self cCode: 'sqrt(result)' inSmalltalk: [result sqrt].
  interpreterProxy pop: 1 thenPush: (interpreterProxy floatObjectOf: result)!

Item was changed:
  ----- Method: FloatArrayPlugin>>primitiveNormalize (in category 'arithmetic primitives') -----
  primitiveNormalize
 
  "Primitive. Normalize the argument (A FloatArray) in place."
 
  | rcvr rcvrPtr length len |
  <export: true>
  <var: #rcvrPtr type:'float *'>
  <var: #len type:'double '>
  rcvr := interpreterProxy stackObjectValue: 0.
  interpreterProxy failed ifTrue:[^nil].
  interpreterProxy success: (interpreterProxy isWords: rcvr).
  interpreterProxy failed ifTrue:[^nil].
  length := interpreterProxy stSizeOf: rcvr.
  interpreterProxy success: true.
  rcvrPtr := self cCoerce: (interpreterProxy firstIndexableField: rcvr) to: 'float *'.
  len := 0.0.
  0 to: length-1 do:[:i|
  len := len + ((self cCoerce: (rcvrPtr at: i) to: 'double') * (self cCoerce: (rcvrPtr at: i) to: 'double')).
  ].
  interpreterProxy success: (len > 0.0).
  interpreterProxy failed ifTrue:[^nil].
 
+ len := self cCode: [self sqrt:len] inSmalltalk: [len sqrt].
- len := self cCode: 'sqrt(len)' inSmalltalk: [len sqrt].
  0 to: length-1 do:[:i|
  rcvrPtr at: i put: ((self cCoerce: (rcvrPtr at: i) to: 'double') / len).
  ].
 
  "Leave receiver on the stack."!

Item was changed:
  ----- Method: SoundPlugin>>primitiveSoundGetRecordingSampleRate (in category 'primitives') -----
  primitiveSoundGetRecordingSampleRate
  "Return a float representing the actual sampling rate during recording. Fail if not currently recording."
 
  | rate |
  <var: #rate type: 'double '>
  self primitive: 'primitiveSoundGetRecordingSampleRate'.
+ rate := self snd_GetRecordingSampleRate.  "fail if not recording"
- rate := self cCode: 'snd_GetRecordingSampleRate()'.  "fail if not recording"
  ^rate asFloatObj!

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-EstebanLorenzano.1869.mcz

Levente Uzonyi
 
On Thu, 26 May 2016, [hidden email] wrote:

>
> Esteban Lorenzano uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker.oscog-EstebanLorenzano.1869.mcz
>
> ==================== Summary ====================
>
> Name: VMMaker.oscog-EstebanLorenzano.1869
> Author: EstebanLorenzano
> Time: 26 May 2016, 1:49:23.32419 pm
> UUID: 6ccd2249-0a2c-4279-90b4-861c39f29859
> Ancestors: VMMaker.oscog-eem.1868
>
> last change breaks cCode: '' (strings).
> this commit fixes some, but not all... I don't know what to do with this (from UnixOSProcessPlugin):
>
> self cCode: 'sigchldHandlerAction.sa_sigaction = reapChildProcess'
>
> (that dot there...)
>
>
> =============== Diff against VMMaker.oscog-eem.1868 ===============
>

snip

> Item was changed:
>  ----- Method: SoundPlugin>>primitiveSoundGetRecordingSampleRate (in category 'primitives') -----
>  primitiveSoundGetRecordingSampleRate
>   "Return a float representing the actual sampling rate during recording. Fail if not currently recording."
>
>   | rate |
>   <var: #rate type: 'double '>
>   self primitive: 'primitiveSoundGetRecordingSampleRate'.
> + rate := self snd_GetRecordingSampleRate.  "fail if not recording"
> - rate := self cCode: 'snd_GetRecordingSampleRate()'.  "fail if not recording"

Are we okay with selectors containing underscores in the VMMaker package?
If I'm not mistaken, this is the first such method.

Levente

>   ^rate asFloatObj!
>
>
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-EstebanLorenzano.1869.mcz

timrowledge


> On 26-05-2016, at 9:18 AM, Levente Uzonyi <[hidden email]> wrote:
>
>> + rate := self snd_GetRecordingSampleRate.  "fail if not recording"
>> - rate := self cCode: 'snd_GetRecordingSampleRate()'.  "fail if not recording"
>
> Are we okay with selectors containing underscores in the VMMaker package?
> If I'm not mistaken, this is the first such method.

Personally I really, really, dislike them. So at least in that sense  we’re not ok with them...

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
"Bother" said Pooh, and deleted his message base


Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-EstebanLorenzano.1869.mcz

David T. Lewis
 
I agree with Tim.

Dave

>
>
>> On 26-05-2016, at 9:18 AM, Levente Uzonyi <[hidden email]> wrote:
>>
>>> + rate := self snd_GetRecordingSampleRate.  "fail if not recording"
>>> - rate := self cCode: 'snd_GetRecordingSampleRate()'.  "fail if not
>>> recording"
>>
>> Are we okay with selectors containing underscores in the VMMaker
>> package?
>> If I'm not mistaken, this is the first such method.
>
> Personally I really, really, dislike them. So at least in that sense
> we’re not ok with them...
>
> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> "Bother" said Pooh, and deleted his message base
>
>


Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-EstebanLorenzano.1869.mcz

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

    yes, sorry about that.  I didn't notice until just now.  I've fixed it properly, so will skip your commit.  Forgive me.

On Thu, May 26, 2016 at 4:51 AM, <[hidden email]> wrote:

Esteban Lorenzano uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-EstebanLorenzano.1869.mcz

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

Name: VMMaker.oscog-EstebanLorenzano.1869
Author: EstebanLorenzano
Time: 26 May 2016, 1:49:23.32419 pm
UUID: 6ccd2249-0a2c-4279-90b4-861c39f29859
Ancestors: VMMaker.oscog-eem.1868

last change breaks cCode: '' (strings).
this commit fixes some, but not all... I don't know what to do with this (from UnixOSProcessPlugin):

self cCode: 'sigchldHandlerAction.sa_sigaction = reapChildProcess'

(that dot there...)


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

Item was changed:
  ----- Method: FloatArrayPlugin>>primitiveLength (in category 'arithmetic primitives') -----
  primitiveLength

        "Primitive. Compute the length of the argument (sqrt of sum of component squares)."

        | rcvr rcvrPtr length result |
        <export: true>
        <var: #rcvrPtr type:'float *'>
        <var: #result type:'double '>
        rcvr := interpreterProxy stackObjectValue: 0.
        interpreterProxy failed ifTrue:[^nil].
        interpreterProxy success: (interpreterProxy isWords: rcvr).
        interpreterProxy failed ifTrue:[^nil].
        length := interpreterProxy stSizeOf: rcvr.
        interpreterProxy success: true.
        rcvrPtr := self cCoerce: (interpreterProxy firstIndexableField: rcvr) to: 'float *'.
        result := 0.0.
        0 to: length-1 do:[:i|
                result := result + ((self cCoerce: (rcvrPtr at: i) to: 'double') * (self cCoerce: (rcvrPtr at: i) to: 'double')).
        ].
+       result := self cCode: [self sqrt:result] inSmalltalk: [result sqrt].
-       result := self cCode: 'sqrt(result)' inSmalltalk: [result sqrt].
        interpreterProxy pop: 1 thenPush: (interpreterProxy floatObjectOf: result)!

Item was changed:
  ----- Method: FloatArrayPlugin>>primitiveNormalize (in category 'arithmetic primitives') -----
  primitiveNormalize

        "Primitive. Normalize the argument (A FloatArray) in place."

        | rcvr rcvrPtr length len |
        <export: true>
        <var: #rcvrPtr type:'float *'>
        <var: #len type:'double '>
        rcvr := interpreterProxy stackObjectValue: 0.
        interpreterProxy failed ifTrue:[^nil].
        interpreterProxy success: (interpreterProxy isWords: rcvr).
        interpreterProxy failed ifTrue:[^nil].
        length := interpreterProxy stSizeOf: rcvr.
        interpreterProxy success: true.
        rcvrPtr := self cCoerce: (interpreterProxy firstIndexableField: rcvr) to: 'float *'.
        len := 0.0.
        0 to: length-1 do:[:i|
                len := len + ((self cCoerce: (rcvrPtr at: i) to: 'double') * (self cCoerce: (rcvrPtr at: i) to: 'double')).
        ].
        interpreterProxy success: (len > 0.0).
        interpreterProxy failed ifTrue:[^nil].

+       len := self cCode: [self sqrt:len] inSmalltalk: [len sqrt].
-       len := self cCode: 'sqrt(len)' inSmalltalk: [len sqrt].
        0 to: length-1 do:[:i|
                rcvrPtr at: i put: ((self cCoerce: (rcvrPtr at: i) to: 'double') / len).
        ].

        "Leave receiver on the stack."!

Item was changed:
  ----- Method: SoundPlugin>>primitiveSoundGetRecordingSampleRate (in category 'primitives') -----
  primitiveSoundGetRecordingSampleRate
        "Return a float representing the actual sampling rate during recording. Fail if not currently recording."

        | rate |
        <var: #rate type: 'double '>
        self primitive: 'primitiveSoundGetRecordingSampleRate'.
+       rate := self snd_GetRecordingSampleRate.  "fail if not recording"
-       rate := self cCode: 'snd_GetRecordingSampleRate()'.  "fail if not recording"
        ^rate asFloatObj!




--
_,,,^..^,,,_
best, Eliot