The Trunk: Kernel-ul.444.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-ul.444.mcz

commits-2
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.444.mcz

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

Name: Kernel-ul.444
Author: ul
Time: 19 April 2010, 2:33:10.77 am
UUID: 9e17b787-82e5-e947-99da-7ca2d6c2c97a
Ancestors: Kernel-ar.443, Kernel-ul.441

- merged

=============== Diff against Kernel-ar.443 ===============

Item was added:
+ ----- Method: MethodDictionary>>compact (in category 'private') -----
+ compact
+ "Make sure that I have the highest possible load factor (at least 50%)."
+
+ self become: self compactWithoutBecome!

Item was changed:
  ----- Method: MethodDictionary class>>rehashAllInstances (in category 'initialization') -----
  rehashAllInstances
 
  | instances newInstances |
  instances := self allInstances asArray.
+ newInstances := self allInstances collect: #rehashWithoutBecome.
- newInstances := self allInstances collect: [ :each | each rehashWithoutBecome ].
  instances elementsExchangeIdentityWith: newInstances!

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

Item was added:
+ ----- Method: MethodDictionary>>compactWithoutBecome (in category 'private') -----
+ compactWithoutBecome
+ "Return a copy of self which has the highest possible load factor (at least 50%)."
+
+ | newSelf |
+ newSelf := self class new: self size.
+ self keysAndValuesDo: [ :key :value |
+ newSelf at: key put: value ].
+ ^newSelf!

Item was removed:
- ----- 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"
- !