[squeak-dev] The Trunk: Compiler-ul.86.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Oct 1 04:01:30 UTC 2009


Andreas Raab uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-ul.86.mcz

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

Name: Compiler-ul.86
Author: ul
Time: 30 September 2009, 3:03:27 am
UUID: aed23852-da1c-3b4f-88e8-33c860f282dd
Ancestors: Compiler-jcg.85

- new #scanFor: for LiteralDictionary too

=============== Diff against Compiler-jcg.85 ===============

Item was changed:
  ----- Method: LiteralDictionary>>scanFor: (in category 'as yet unclassified') -----
  scanFor: anObject
+ 	"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
- 	"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or zero if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
- 	| element start finish |
- 	finish := array size.
- 	start := (anObject hash \\ finish) + 1.
  
+ 	| index start |
+ 	index := start := anObject hash \\ array size + 1.
+ 	[ 
+ 		| element |
+ 		((element := array at: index) == nil or: [
+ 			self literalEquality: element key and: anObject ])
+ 				ifTrue: [ ^index ].
+ 		(index := index \\ array size + 1) = start ] whileFalse.
+ 	self errorNoFreeSpace!
- 	"Search from (hash mod size) to the end."
- 	start to: finish do:
- 		[:index | ((element := array at: index) == nil
- 					or: [self literalEquality: element key and: anObject])
- 					ifTrue: [^ index ]].
- 
- 	"Search from 1 to where we started."
- 	1 to: start-1 do:
- 		[:index | ((element := array at: index) == nil
- 					or: [self literalEquality: element key and: anObject])
- 					ifTrue: [^ index ]].
- 
- 	^ 0  "No match AND no empty slot"!




More information about the Squeak-dev mailing list