[squeak-dev] The Trunk: Collections-mt.898.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jun 16 06:55:41 UTC 2020


Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.898.mcz

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

Name: Collections-mt.898
Author: mt
Time: 16 June 2020, 8:55:38.416917 am
UUID: 89207449-befb-f84f-83a0-ff0d727d40bc
Ancestors: Collections-mt.896, Collections-ul.897

Merges ancestry. 

Does somebody know where to find Collections-ul.896?

=============== Diff against Collections-mt.896 ===============

Item was removed:
- ----- Method: ByteArray>>atAllPut: (in category 'accessing') -----
- atAllPut: value
- 	"Fill the receiver with the given value"
- 
- 	<primitive: 145>
- 	super atAllPut: value!

Item was changed:
  ----- Method: String>>< (in category 'comparing') -----
  < aString 
  	"Answer whether the receiver sorts before aString.
  	The collation order is simple ascii (with case differences)."
  
+ 	^(self compareWith: aString) < 0!
- 	^ (self compare: self with: aString collated: AsciiOrder) = 1!

Item was changed:
  ----- Method: String>><= (in category 'comparing') -----
  <= aString 
  	"Answer whether the receiver sorts before or equal to aString.
  	The collation order is simple ascii (with case differences)."
  	
+ 	^(self compareWith: aString) <= 0!
- 	^ (self compare: self with: aString collated: AsciiOrder) <= 2!

Item was changed:
  ----- Method: String>>= (in category 'comparing') -----
  = aString 
  	"Answer whether the receiver sorts equally as aString.
  	The collation order is simple ascii (with case differences)."
  	
  	self == aString ifTrue: [ ^true ].
  	aString isString ifFalse: [ ^false ].
  	self size = aString size ifFalse: [ ^false ].
+ 	^ (self compareWith: aString) = 0!
- 	^ (self compare: self with: aString collated: AsciiOrder) = 2!

Item was changed:
  ----- Method: String>>> (in category 'comparing') -----
  > aString 
  	"Answer whether the receiver sorts after aString.
  	The collation order is simple ascii (with case differences)."
  
+ 	^(self compareWith: aString) > 0!
- 	^ (self compare: self with: aString collated: AsciiOrder) = 3!

Item was changed:
  ----- Method: String>>>= (in category 'comparing') -----
  >= aString 
  	"Answer whether the receiver sorts after or equal to aString.
  	The collation order is simple ascii (with case differences)."
  
+ 	^(self compareWith: aString) >= 0!
- 	^ (self compare: self with: aString collated: AsciiOrder) >= 2!

Item was changed:
  ----- Method: String>>compare:caseSensitive: (in category 'comparing') -----
  compare: aString caseSensitive: aBool
  	"Answer a comparison code telling how the receiver sorts relative to aString:
  		1 - before
  		2 - equal
  		3 - after.
  	"
  	| map |
  	map := aBool ifTrue:[CaseSensitiveOrder] ifFalse:[CaseInsensitiveOrder].
+ 	^(self compareWith: aString collated: map) + 2!
- 	^self compare: self with: aString collated: map!

Item was added:
+ ----- Method: String>>compareWith: (in category 'comparing') -----
+ compareWith: aString
+ 
+ 	"<primitive: 158>"
+ 	^(self compare: self with: aString collated: AsciiOrder) - 2!

Item was added:
+ ----- Method: String>>compareWith:collated: (in category 'comparing') -----
+ compareWith: aString collated: collation
+ 
+ 	"<primitive: 158>"
+ 	^(self compare: self with: aString collated: collation) - 2!

Item was removed:
- ----- Method: WeakIdentityDictionary>>cleanupIndex: (in category 'private') -----
- cleanupIndex: anInteger
- 	array at: anInteger put: vacuum.
- 	tally := tally - 1.
- 	self fixCollisionsFrom: anInteger.!

Item was changed:
  ----- Method: WeakIdentityDictionary>>fixCollisionsFrom: (in category 'private') -----
  fixCollisionsFrom: start
  	"The element at start has been removed and replaced by vacuum.
  	This method moves forward from there, relocating any entries
  	that had been placed below due to collisions with this one."
  
  	| element index |
  	index := start.
  	[ (element := array at: (index := index \\ array size + 1)) == vacuum ] whileFalse: [
  		element
  			ifNil:
  				[ "The binding at this slot was reclaimed - finish the cleanup"
  				array at: index put: vacuum.
  				tally := tally - 1 ]
  			ifNotNil:
  				[| newIndex |
+ 				(newIndex := self scanFor: element key) = index ifFalse: [
- 				(newIndex := self scanWithoutGarbagingFor: element key) = index ifFalse: [
  					array 
  						at: newIndex put: element;
  						at: index put: vacuum ] ] ]!

Item was changed:
  ----- Method: WeakIdentityDictionary>>removeKey:ifAbsent: (in category 'removing') -----
  removeKey: key ifAbsent: aBlock 
  	"Remove key (and its associated value) from the receiver. If key is not in 
  	the receiver, answer the result of evaluating aBlock. Otherwise, answer 
  	the value externally named by key."
  
  	| index association |
  	index := self scanFor: key.
  	(association := (array at: index)) == vacuum ifTrue: [ ^aBlock value ].
+ 	array at: index put: vacuum.
+ 	tally := tally - 1.
+ 	self fixCollisionsFrom: index.
- 	self cleanupIndex: index.
  	^association value!

Item was changed:
  ----- Method: WeakIdentityDictionary>>scanFor: (in category 'private') -----
  scanFor: anObject
  	"Scan the array for the first slot containing either
  	- a vacuum object indicating an empty slot
  	- or a binding whose key matches anObject.
+ 	Answer the index of that slot or raise an error if no slot is found which should never happen."
- 	Answer the index of that slot or raise an error if no slot is found.
- 	When garbage collected slots are encountered, perform a clean-up."
  
+ 	| index start size |
+ 	index := start := anObject scaledIdentityHash \\ (size := array size) + 1.
+ 	[ 
+ 		(array at: index) ifNotNil: [ :element |
+ 			(element == vacuum or: [ element key == anObject ])
+ 				ifTrue: [ ^index ] ].
+ 		(index := index \\ size + 1) = start ] whileFalse.
- 	| index start rescan |	
- 	[
- 		rescan := false.
- 		index := start := anObject scaledIdentityHash \\ array size + 1.
- 		[ 
- 			(array at: index) 
- 				ifNil:
- 					["Object at this slot has been garbage collected.
- 					A rescan is necessary because fixing collisions
- 					might have moved the target before current index."
- 					self cleanupIndex: index.
- 					rescan := true]
- 				ifNotNil:
- 					[:element | (element == vacuum or: [ element key == anObject ])
- 						ifTrue: [ ^index ].
- 					(index := index \\ array size + 1) = start ] ] whileFalse.
- 		rescan ] whileTrue.
  	self errorNoFreeSpace!

Item was changed:
  ----- Method: WeakIdentityDictionary>>scanForEmptySlotFor: (in category 'private') -----
  scanForEmptySlotFor: anObject
+ 	"Scan the array for the first empty slot marked by vacuum object or nil.
+ 	Answer the index of that slot or raise an error if no slot is found, which should never happen."
- 	"Scan the array for the first empty slot marked by vacuum object.
- 	Answer the index of that slot or raise an error if no slot is found.
- 	Ignore the slots that have been garbage collected (those containing nil)."
  
  	| index start |	
  	index := start := anObject scaledIdentityHash \\ array size + 1.
  	[ 
+ 		| element |
+ 		((element := array at: index) == vacuum or: [ element == nil ]) ifTrue: [ ^index ].
- 		(array at: index) 
- 			ifNotNil:
- 				[:element | element == vacuum ifTrue: [ ^index ] ].
  		(index := index \\ array size + 1) = start ] whileFalse.
  	self errorNoFreeSpace!

Item was removed:
- ----- Method: WeakIdentityDictionary>>scanWithoutGarbagingFor: (in category 'private') -----
- scanWithoutGarbagingFor: anObject
- 	"Scan the array for the first slot containing either
- 	- a vacuum object indicating an empty slot
- 	- or a binding whose key matches anObject.
- 	Answer the index of that slot or raise an error if no slot is found.
- 	Ignore the slots that have been garbage collected (those containing nil)"
- 
- 	| index start |	
- 	index := start := anObject scaledIdentityHash \\ array size + 1.
- 	[ 
- 		(array at: index) 
- 			ifNotNil:
- 				[:element | (element == vacuum or: [ element key == anObject ])
- 					ifTrue: [ ^index ] ].
- 		(index := index \\ array size + 1) = start ] whileFalse.
- 	self errorNoFreeSpace!



More information about the Squeak-dev mailing list