[Vm-dev] VM Maker: VMMaker.oscog-eem.960.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Dec 2 00:14:13 UTC 2014
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.960.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.960
Author: eem
Time: 1 December 2014, 4:11:42.232 pm
UUID: 1b13b4c0-c9f8-4441-a0fa-08b7cd13a92a
Ancestors: VMMaker.oscog-eem.959
Add some SmallFloat64 tests.
Hence fix isSmallFloatValue: for simulation.
=============== Diff against VMMaker.oscog-eem.959 ===============
Item was changed:
----- Method: Spur64BitMemoryManager>>isSmallFloatValue: (in category 'interpreter access') -----
isSmallFloatValue: aFloat
<inline: true>
<var: #aFloat type: #double>
| exponent |
exponent := self
cCode:
[| rawFloat |
rawFloat := (self cCoerce: (self addressOf: aFloat) to: 'sqLong *') at: 0.
rawFloat >> 52 bitAnd: 16r7FF]
+ inSmalltalk: [self smallFloatExponentOffset
+ + (aFloat isFinite
+ ifTrue:
+ [aFloat = 0.0
+ ifTrue: [0]
+ ifFalse: [aFloat exponent + 127]]
+ ifFalse: "Float nan & Float infinity exponent = -1, so mask to make > 0"
+ [aFloat exponent bitAnd: SmallInteger maxVal])].
+ ^exponent
+ between: self smallFloatExponentOffset
+ and: 255 + self smallFloatExponentOffset!
- inSmalltalk: [aFloat exponent].
- ^exponent between: -127 and: 127!
Item was added:
+ ----- Method: StackInterpreterTests>>testImmediateFloats (in category 'tests') -----
+ testImmediateFloats
+ "self new testImmediateFloats"
+ | vm smm smallFloatOop |
+ vm := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur64BitMemoryManager).
+ smm := vm objectMemory.
+ #(0.0 -0.0 1.0e38 -1.0e38 1.0e-38 -1.0e-38 2.0 -2.0) do:
+ [:f| | sfo |
+ vm initPrimCall.
+ self shouldnt: [sfo := smm smallFloatObjectOf: f] raise: Error.
+ self assert: (smm smallFloatValueOf: sfo) equals: f.
+ self assert: ((smm exponentOfSmallFloat: sfo) between: -126 and: 127)].
+ {Float nan. Float infinity. Float negativeInfinity. 1.0e-39. 1.0e39 } do:
+ [:f| self deny: (smm isSmallFloatValue: f)].
+ vm initPrimCall.
+ smallFloatOop := smm smallFloatTag + (1 << (smm smallFloatMantissaBits + smm numTagBits)).
+ self shouldnt: [smm floatValueOf: smallFloatOop] raise: Error.
+ self deny: vm failed.
+ self assert: (smm isSmallFloatValue: (smm floatValueOf: smallFloatOop)).
+ self assert: (smm floatObjectOf: (smm floatValueOf: smallFloatOop)) equals: smallFloatOop.
+ vm initPrimCall.
+ smallFloatOop := ((1 bitShift: 64) - 1 bitClear: (1 bitShift: smm numTagBits + 1) - 1) + smm smallFloatTag.
+ self shouldnt: [smm floatValueOf: smallFloatOop] raise: Error.
+ self deny: vm failed.
+ self assert: (smm isSmallFloatValue: (smm floatValueOf: smallFloatOop)).
+ self assert: (smm floatObjectOf: (smm floatValueOf: smallFloatOop)) equals: smallFloatOop!
More information about the Vm-dev
mailing list