<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2014-12-02 1:12 GMT+01:00 <span dir="ltr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:<br>
<a href="http://source.squeak.org/VMMaker/VMMaker.oscog-eem.960.mcz" target="_blank">http://source.squeak.org/VMMaker/VMMaker.oscog-eem.960.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: VMMaker.oscog-eem.960<br>
Author: eem<br>
Time: 1 December 2014, 4:11:42.232 pm<br>
UUID: 1b13b4c0-c9f8-4441-a0fa-08b7cd13a92a<br>
Ancestors: VMMaker.oscog-eem.959<br>
<br>
Add some SmallFloat64 tests.<br>
Hence fix isSmallFloatValue: for simulation.<br>
<br>
=============== Diff against VMMaker.oscog-eem.959 ===============<br>
<br>
Item was changed:<br>
----- Method: Spur64BitMemoryManager>>isSmallFloatValue: (in category 'interpreter access') -----<br>
isSmallFloatValue: aFloat<br>
<inline: true><br>
<var: #aFloat type: #double><br>
| exponent |<br>
exponent := self<br>
cCode:<br>
[| rawFloat |<br>
rawFloat := (self cCoerce: (self addressOf: aFloat) to: 'sqLong *') at: 0.<br></blockquote><div><br></div><div><br>Pointer aliasing usage apart, shouldn't it be usqLong * ?<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
rawFloat >> 52 bitAnd: 16r7FF]<br>
+ inSmalltalk: [self smallFloatExponentOffset<br>
+ + (aFloat isFinite<br>
+ ifTrue:<br>
+ [aFloat = 0.0<br>
+ ifTrue: [0]<br>
+ ifFalse: [aFloat exponent + 127]]<br>
+ ifFalse: "Float nan & Float infinity exponent = -1, so mask to make > 0"<br>
+ [aFloat exponent bitAnd: SmallInteger maxVal])].<br>
+ ^exponent<br>
+ between: self smallFloatExponentOffset<br>
+ and: 255 + self smallFloatExponentOffset!<br>
- inSmalltalk: [aFloat exponent].<br>
- ^exponent between: -127 and: 127!<br>
<br>
Item was added:<br>
+ ----- Method: StackInterpreterTests>>testImmediateFloats (in category 'tests') -----<br>
+ testImmediateFloats<br>
+ "self new testImmediateFloats"<br>
+ | vm smm smallFloatOop |<br>
+ vm := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur64BitMemoryManager).<br>
+ smm := vm objectMemory.<br>
+ #(0.0 -0.0 1.0e38 -1.0e38 1.0e-38 -1.0e-38 2.0 -2.0) do:<br>
+ [:f| | sfo |<br>
+ vm initPrimCall.<br>
+ self shouldnt: [sfo := smm smallFloatObjectOf: f] raise: Error.<br>
+ self assert: (smm smallFloatValueOf: sfo) equals: f.<br>
+ self assert: ((smm exponentOfSmallFloat: sfo) between: -126 and: 127)].<br>
+ {Float nan. Float infinity. Float negativeInfinity. 1.0e-39. 1.0e39 } do:<br>
+ [:f| self deny: (smm isSmallFloatValue: f)].<br>
+ vm initPrimCall.<br>
+ smallFloatOop := smm smallFloatTag + (1 << (smm smallFloatMantissaBits + smm numTagBits)).<br>
+ self shouldnt: [smm floatValueOf: smallFloatOop] raise: Error.<br>
+ self deny: vm failed.<br>
+ self assert: (smm isSmallFloatValue: (smm floatValueOf: smallFloatOop)).<br>
+ self assert: (smm floatObjectOf: (smm floatValueOf: smallFloatOop)) equals: smallFloatOop.<br>
+ vm initPrimCall.<br>
+ smallFloatOop := ((1 bitShift: 64) - 1 bitClear: (1 bitShift: smm numTagBits + 1) - 1) + smm smallFloatTag.<br>
+ self shouldnt: [smm floatValueOf: smallFloatOop] raise: Error.<br>
+ self deny: vm failed.<br>
+ self assert: (smm isSmallFloatValue: (smm floatValueOf: smallFloatOop)).<br>
+ self assert: (smm floatObjectOf: (smm floatValueOf: smallFloatOop)) equals: smallFloatOop!<br>
<br>
</blockquote></div><br></div></div>