<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2014-12-02 1:12 GMT+01:00  <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>&gt;</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&gt;&gt;isSmallFloatValue: (in category &#39;interpreter access&#39;) -----<br>
  isSmallFloatValue: aFloat<br>
        &lt;inline: true&gt;<br>
        &lt;var: #aFloat type: #double&gt;<br>
        | exponent |<br>
        exponent := self<br>
                                        cCode:<br>
                                                [| rawFloat |<br>
                                                 rawFloat := (self cCoerce: (self addressOf: aFloat) to: &#39;sqLong *&#39;) at: 0.<br></blockquote><div><br></div><div><br>Pointer aliasing usage apart, shouldn&#39;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 &gt;&gt; 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: &quot;Float nan &amp; Float infinity exponent = -1, so mask to make &gt; 0&quot;<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&gt;&gt;testImmediateFloats (in category &#39;tests&#39;) -----<br>
+ testImmediateFloats<br>
+       &quot;self new testImmediateFloats&quot;<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 &lt;&lt; (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>