Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.630.mcz
==================== Summary ====================
Name: Kernel-ul.630
Author: ul
Time: 27 September 2011, 6:09:18.907 pm
UUID: 87434805-2f3c-c446-b12b-3af3c0043cea
Ancestors: Kernel-nice.629
Fix for the recently introduced MethodDictionary bug reported by Mariano Martinez Peck on the Pharo list and some other things.
- added MethodDictionary class >> #newForCapacity: to reduce the complexity of the various methods which create new instances with a given capacity (#grow, #rehash, #removeAll). These changes make some comments unnecessary.
- fix: #sizeFor: should allow 75% load factor
=============== Diff against Kernel-nice.629 ===============
Item was changed:
----- Method: MethodDictionary class>>new (in category 'instance creation') -----
new
+ "Create a new instance with 32 slots, which can hold at most 24 methods before growing is necessary."
- "Create a new instance with 32 slots. See the comment of #sizeFor: why the argument is 16."
+ ^self newForCapacity: 32!
- ^self new: 16!
Item was changed:
----- Method: MethodDictionary class>>new: (in category 'instance creation') -----
new: numberOfElements
+ "Create an instance large enough to hold numberOfElements methods without growing."
- "Create an instance large enough to hold numberOfElements without growing. Note that the basic size must be a power of 2. It is VITAL (see grow) that size gets doubled if numberOfElements is a power of 2"
+ ^self newForCapacity: (self sizeFor: numberOfElements)!
- | size |
- size := self sizeFor: numberOfElements.
- ^(self basicNew: size) initialize: size!
Item was added:
+ ----- Method: MethodDictionary class>>newForCapacity: (in category 'private') -----
+ newForCapacity: capacity
+ "Create an instance with the given capacity which must be a power of two."
+
+ ^(self basicNew: capacity) initialize: capacity!
Item was changed:
----- Method: MethodDictionary class>>sizeFor: (in category 'sizing') -----
sizeFor: numberOfElements
"Return the minimum capacity of a dictionary that can hold numberOfElements elements. At least 25% of the array must be empty and the return value must be a power of 2."
+ ^(numberOfElements * 4 // 3) asLargerPowerOfTwo!
- ^1 bitShift: (numberOfElements * 4 // 3) highBit!
Item was changed:
----- Method: MethodDictionary>>grow (in category 'private') -----
grow
| newSelf |
+ newSelf := self species newForCapacity: self basicSize * 2.
- newSelf := self species new: self basicSize. "This will double the size"
1 to: self basicSize do: [ :i |
(self basicAt: i) ifNotNil: [ :key |
newSelf at: key put: (array at: i) ] ].
self become: newSelf!
Item was changed:
----- Method: MethodDictionary>>rehash (in category 'private') -----
rehash
| newInstance |
+ newInstance := self species newForCapacity: self basicSize.
- newInstance := self species new: self basicSize - 1. "Make sure it has the same capacity"
1 to: self basicSize do: [ :index |
(self basicAt: index) ifNotNil: [ :key |
newInstance at: key put: (array at: index) ] ].
self copyFrom: newInstance!
Item was changed:
----- Method: MethodDictionary>>removeAll (in category 'removing') -----
removeAll
+ "Remove all elements from this collection. Preserve the capacity"
- "This provides a faster way than repeated become.
- a single become is still in use to prevent system crash."
| newSelf |
tally = 0 ifTrue: [^self].
+ newSelf := self species newForCapacity: self basicSize.
- newSelf := self species new: self basicSize - 1. "This will preserve the capacity"
self copyFrom: newSelf!
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.630.mcz
==================== Summary ====================
Name: Kernel-ul.630
Author: ul
Time: 27 September 2011, 6:09:18.907 pm
UUID: 87434805-2f3c-c446-b12b-3af3c0043cea
Ancestors: Kernel-nice.629
Fix for the recently introduced MethodDictionary bug reported by Mariano Martinez Peck on the Pharo list and some other things.
- added MethodDictionary class >> #newForCapacity: to reduce the complexity of the various methods which create new instances with a given capacity (#grow, #rehash, #removeAll). These changes make some comments unnecessary.
- fix: #sizeFor: should allow 75% load factor
=============== Diff against Kernel-nice.629 ===============
Item was changed:
----- Method: MethodDictionary class>>new (in category 'instance creation') -----
new
+ "Create a new instance with 32 slots, which can hold at most 24 methods before growing is necessary."
- "Create a new instance with 32 slots. See the comment of #sizeFor: why the argument is 16."
+ ^self newForCapacity: 32!
- ^self new: 16!
Item was changed:
----- Method: MethodDictionary class>>new: (in category 'instance creation') -----
new: numberOfElements
+ "Create an instance large enough to hold numberOfElements methods without growing."
- "Create an instance large enough to hold numberOfElements without growing. Note that the basic size must be a power of 2. It is VITAL (see grow) that size gets doubled if numberOfElements is a power of 2"
+ ^self newForCapacity: (self sizeFor: numberOfElements)!
- | size |
- size := self sizeFor: numberOfElements.
- ^(self basicNew: size) initialize: size!
Item was added:
+ ----- Method: MethodDictionary class>>newForCapacity: (in category 'private') -----
+ newForCapacity: capacity
+ "Create an instance with the given capacity which must be a power of two."
+
+ ^(self basicNew: capacity) initialize: capacity!
Item was changed:
----- Method: MethodDictionary class>>sizeFor: (in category 'sizing') -----
sizeFor: numberOfElements
"Return the minimum capacity of a dictionary that can hold numberOfElements elements. At least 25% of the array must be empty and the return value must be a power of 2."
+ ^(numberOfElements * 4 // 3) asLargerPowerOfTwo!
- ^1 bitShift: (numberOfElements * 4 // 3) highBit!
Item was changed:
----- Method: MethodDictionary>>grow (in category 'private') -----
grow
| newSelf |
+ newSelf := self species newForCapacity: self basicSize * 2.
- newSelf := self species new: self basicSize. "This will double the size"
1 to: self basicSize do: [ :i |
(self basicAt: i) ifNotNil: [ :key |
newSelf at: key put: (array at: i) ] ].
self become: newSelf!
Item was changed:
----- Method: MethodDictionary>>rehash (in category 'private') -----
rehash
| newInstance |
+ newInstance := self species newForCapacity: self basicSize.
- newInstance := self species new: self basicSize - 1. "Make sure it has the same capacity"
1 to: self basicSize do: [ :index |
(self basicAt: index) ifNotNil: [ :key |
newInstance at: key put: (array at: index) ] ].
self copyFrom: newInstance!
Item was changed:
----- Method: MethodDictionary>>removeAll (in category 'removing') -----
removeAll
+ "Remove all elements from this collection. Preserve the capacity"
- "This provides a faster way than repeated become.
- a single become is still in use to prevent system crash."
| newSelf |
tally = 0 ifTrue: [^self].
+ newSelf := self species newForCapacity: self basicSize.
- newSelf := self species new: self basicSize - 1. "This will preserve the capacity"
self copyFrom: newSelf!
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.630.mcz
==================== Summary ====================
Name: Kernel-ul.630
Author: ul
Time: 27 September 2011, 6:09:18.907 pm
UUID: 87434805-2f3c-c446-b12b-3af3c0043cea
Ancestors: Kernel-nice.629
Fix for the recently introduced MethodDictionary bug reported by Mariano Martinez Peck on the Pharo list and some other things.
- added MethodDictionary class >> #newForCapacity: to reduce the complexity of the various methods which create new instances with a given capacity (#grow, #rehash, #removeAll). These changes make some comments unnecessary.
- fix: #sizeFor: should allow 75% load factor
=============== Diff against Kernel-nice.629 ===============
Item was changed:
----- Method: MethodDictionary class>>new (in category 'instance creation') -----
new
+ "Create a new instance with 32 slots, which can hold at most 24 methods before growing is necessary."
- "Create a new instance with 32 slots. See the comment of #sizeFor: why the argument is 16."
+ ^self newForCapacity: 32!
- ^self new: 16!
Item was changed:
----- Method: MethodDictionary class>>new: (in category 'instance creation') -----
new: numberOfElements
+ "Create an instance large enough to hold numberOfElements methods without growing."
- "Create an instance large enough to hold numberOfElements without growing. Note that the basic size must be a power of 2. It is VITAL (see grow) that size gets doubled if numberOfElements is a power of 2"
+ ^self newForCapacity: (self sizeFor: numberOfElements)!
- | size |
- size := self sizeFor: numberOfElements.
- ^(self basicNew: size) initialize: size!
Item was added:
+ ----- Method: MethodDictionary class>>newForCapacity: (in category 'private') -----
+ newForCapacity: capacity
+ "Create an instance with the given capacity which must be a power of two."
+
+ ^(self basicNew: capacity) initialize: capacity!
Item was changed:
----- Method: MethodDictionary class>>sizeFor: (in category 'sizing') -----
sizeFor: numberOfElements
"Return the minimum capacity of a dictionary that can hold numberOfElements elements. At least 25% of the array must be empty and the return value must be a power of 2."
+ ^(numberOfElements * 4 // 3) asLargerPowerOfTwo!
- ^1 bitShift: (numberOfElements * 4 // 3) highBit!
Item was changed:
----- Method: MethodDictionary>>grow (in category 'private') -----
grow
| newSelf |
+ newSelf := self species newForCapacity: self basicSize * 2.
- newSelf := self species new: self basicSize. "This will double the size"
1 to: self basicSize do: [ :i |
(self basicAt: i) ifNotNil: [ :key |
newSelf at: key put: (array at: i) ] ].
self become: newSelf!
Item was changed:
----- Method: MethodDictionary>>rehash (in category 'private') -----
rehash
| newInstance |
+ newInstance := self species newForCapacity: self basicSize.
- newInstance := self species new: self basicSize - 1. "Make sure it has the same capacity"
1 to: self basicSize do: [ :index |
(self basicAt: index) ifNotNil: [ :key |
newInstance at: key put: (array at: index) ] ].
self copyFrom: newInstance!
Item was changed:
----- Method: MethodDictionary>>removeAll (in category 'removing') -----
removeAll
+ "Remove all elements from this collection. Preserve the capacity"
- "This provides a faster way than repeated become.
- a single become is still in use to prevent system crash."
| newSelf |
tally = 0 ifTrue: [^self].
+ newSelf := self species newForCapacity: self basicSize.
- newSelf := self species new: self basicSize - 1. "This will preserve the capacity"
self copyFrom: newSelf!
Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.216.mcz
==================== Summary ====================
Name: Compiler-eem.216
Author: eem
Time: 27 September 2011, 8:55:43.391 am
UUID: 6876b6f4-047e-4ed9-81e6-9f49c02fcd00
Ancestors: Compiler-eem.215
Use the methodForDecompile hook in decompile:in:. This
fixes infinite recursion when decompiling installed wrapper
methods. Needs Kernel-eem.630.
=============== Diff against Compiler-eem.215 ===============
Item was changed:
----- Method: Decompiler>>decompile:in: (in category 'public access') -----
decompile: aSelector in: aClass
"See Decompiler|decompile:in:method:. The method is found by looking up
the message, aSelector, in the method dictionary of the class, aClass."
^self
decompile: aSelector
in: aClass
+ method: (aClass compiledMethodAt: aSelector) methodForDecompile!
- method: (aClass compiledMethodAt: aSelector)!