Maybe we can add this to the cleanUpForRelease script.

Cheers
-- 
Miguel Cobá
http://miguel.leugim.com.mx
--- Begin Message ---
Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.411.mcz

==================== Summary ====================

Name: Kernel-ar.411
Author: ar
Time: 26 February 2010, 7:36:40.257 pm
UUID: b69a28db-8475-bc4b-89ed-285ccf3841cd
Ancestors: Kernel-ul.410

Add MethodDictionary class>>compactAllInstances to save space in releases. 
Compacting all MDs in my images saves 600k in image size which isn't bad at all.

=============== Diff against Kernel-ul.410 ===============

Item was added:
+ ----- Method: MethodDictionary class>>compactAllInstances (in category 
'initialization') -----
+ compactAllInstances   "MethodDictionary compactAllInstances"
+       "Compacts all MethodDictionaries to save space"
+ 
+       | oldInstances newInstances |
+       oldInstances := self allInstances.
+       newInstances := oldInstances collect:[:md|
+               (self new: md size) 
+                       compactCopyFrom: md;
+                       yourself].
+       oldInstances elementsForwardIdentityTo: newInstances.
+ !

Item was added:
+ ----- Method: MethodDictionary>>compactCopyFrom: (in category 'private') -----
+ compactCopyFrom: sourceMD
+       "Copy the contents of source dictionary without growing"
+ 
+       sourceMD keysAndValuesDo:[:key :value| | index |
+               index := self scanFor: key.
+               (self basicAt: index) ifNotNil:[self error: 'Something is 
horribly broken'].
+               self basicAt: index put: key.
+               array at: index put: value.
+               tally := tally + 1.
+       ].
+       self size = self capacity ifTrue:[self grow]. "grow only if we reach 
capacity"
+ !



--- End Message ---
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to