[Vm-dev] [commit][3152] Make sure to compile the SmallFloat64
primitives.
commits at squeakvm.org
commits at squeakvm.org
Wed Nov 26 19:57:33 UTC 2014
Revision: 3152
Author: eliot
Date: 2014-11-26 11:57:25 -0800 (Wed, 26 Nov 2014)
Log Message:
-----------
Make sure to compile the SmallFloat64 primitives.
Modified Paths:
--------------
branches/Cog/image/MorphFloat.st
Modified: branches/Cog/image/MorphFloat.st
===================================================================
--- branches/Cog/image/MorphFloat.st 2014-11-26 01:09:16 UTC (rev 3151)
+++ branches/Cog/image/MorphFloat.st 2014-11-26 19:57:25 UTC (rev 3152)
@@ -102,7 +102,27 @@
[:s :m|
m methodClassAssociation: binding].
bfc organization removeEmptyCategories; sortCategories].
+ "shrink method dictionaries after removals; rehash does not shrink :-("
+ {boxedFloat. boxedFloat class} do:
+ [:bfc| | nmd |
+ nmd := MethodDictionary new.
+ bfc selectorsAndMethodsDo:
+ [:s :m| nmd at: s put: m].
+ bfc methodDict: nmd].
+ "Compile the SmallFloat64 primitives.
+ These have primitive number 500 + the corresponding boxed primitive number"
+ boxedFloat selectors do:
+ [:s| | code |
+ code := (boxedFloat sourceCodeAt: s) asString.
+ code := code copyReplaceAll: '<primitive: ' with: '<primitive: 5'.
+ smallFloat
+ compile: code
+ classified: (boxedFloat organization categoryOfElement: s)
+ withStamp: 'eem 11/25/2014 7:54'
+ notifying: nil].
+ smallFloat organization sortCategories.
+
boxedFloat comment: 'My instances hold 64-bit Floats in heap objects. This is the only representation on 32-bit systems. But on 64-bit systems SmallFloat64 holds a subset of the full 64-bit double-precision range in immediate objects.'
stamp: 'eem 11/25/2014 7:54'.
smallFloat comment: 'My instances represent 64-bit Floats whose exponent fits in 8 bits as immediate objects. This representation is only available on 64-bit systems, not 32-bit systems.'
More information about the Vm-dev
mailing list