[Vm-dev] VM Maker: VMMaker.oscog-EstebanLorenzano.1869.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu May 26 11:52:11 UTC 2016
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!
More information about the Vm-dev
mailing list