[Vm-dev] VM Maker: VMMaker.oscog-eem.988.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Dec 16 01:12:30 UTC 2014
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.988.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.988
Author: eem
Time: 15 December 2014, 5:09:23.088 pm
UUID: 76d73591-5a89-416d-b6f7-90cd2a89ffcb
Ancestors: VMMaker.oscog-eem.987
Fix isSmallFloatValue: for the low boundary case.
Eliminate an obsolete type declaration.
=============== Diff against VMMaker.oscog-eem.987 ===============
Item was changed:
----- Method: Spur64BitMemoryManager>>isSmallFloatValue: (in category 'interpreter access') -----
isSmallFloatValue: aFloat
<inline: true>
<var: #aFloat type: #double>
+ | exponent rawFloat |
+ rawFloat := self
+ cCode: [(self cCoerce: (self addressOf: aFloat) to: 'sqLong *') at: 0]
+ inSmalltalk: [(aFloat at: 1) << 32 + (aFloat at: 2)].
+ exponent := rawFloat >> 52 bitAnd: 16r7FF.
+ ^exponent > self smallFloatExponentOffset
+ ifTrue: [exponent <= (255 + self smallFloatExponentOffset)]
+ ifFalse:
+ [(rawFloat bitAnd: (1 << 52 - 1)) = 0
+ ifTrue: [exponent = 0]
+ ifFalse: [exponent = self smallFloatExponentOffset]]!
- | 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!
Item was changed:
----- Method: Spur64BitMemoryManager>>smallFloatValueOf: (in category 'interpreter access') -----
smallFloatValueOf: oop
"Answer the C double precision floating point value of the argument, a SmallFloat.
See section 61-bit Immediate Floats in the SpurMemoryManager class comment.
msb lsb
Decode: [8expsubset][52mantissa][1s][3tags]
shift away tags: [ 000 ][8expsubset][52mantissa][1s]
add exponent offset: [ 11 exponent ][52mantissa][1s]
rot sign: [1s][ 11 exponent ][52mantissa]"
| rot |
<returnTypeC: #double>
- <var: #result type: #double>
self assert: (oop bitAnd: self tagMask) = self smallFloatTag.
rot := oop >> self numTagBits.
rot > 1 ifTrue:
[rot := rot + (self smallFloatExponentOffset << (self smallFloatMantissaBits + 1))].
rot := self rotateRight: rot.
^self cCode: [(self cCoerce: (self addressOf: rot) to: #'double *') at: 0]
inSmalltalk:
[(Float new: 2)
at: 1 put: rot >> 32;
at: 2 put: (rot bitAnd: 16rFFFFFFFF);
yourself]!
More information about the Vm-dev
mailing list