[squeak-dev] The Trunk: System-ul.386.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Oct 17 02:02:39 UTC 2010


Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.386.mcz

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

Name: System-ul.386
Author: ul
Time: 17 October 2010, 3:47:32.279 am
UUID: ab697adc-2dad-6d44-8fc3-7b1ce671f7a5
Ancestors: System-ul.385

- use blocks instead of symbols
- compact the HashedCollections in the image segments instead of just rehashing them
- don't use SortedCollection in SystemNavigation >> #allMethodsSelect:, it's very slow (O(n^2) time) when lots of methods are selected

=============== Diff against System-ul.385 ===============

Item was changed:
  ----- Method: ImageSegment>>rehashSets (in category 'fileIn/Out') -----
  rehashSets
  	"I have just been brought in and converted to live objects.  Find all Sets and Dictionaries in the newly created objects and rehash them.  Segment is near then end of memory, since is was newly brought in (and a new object created for it).
  	Also, collect all classes of receivers of blocks.  Return them.  Caller will check if they have been reshaped."
  
  	| object hashedCollections receiverClasses inSeg |
  	object := segment.
  	hashedCollections := OrderedCollection new.
  		"have to collect them, because Dictionary makes a copy, and that winds up at the end of memory and gets rehashed and makes another one."
  	receiverClasses := IdentitySet new.
  	inSeg := true.
  	[object := object nextObject.  
  		object == endMarker ifTrue: [inSeg := false].	"off end"
  		object isInMemory ifTrue: [
  			(object isKindOf: HashedCollection) ifTrue: [hashedCollections add: object].
  			object isBlock ifTrue: [inSeg ifTrue: [
  					receiverClasses add: object receiver class]].	
  			object class == MethodContext ifTrue: [inSeg ifTrue: [
  					receiverClasses add: object receiver class]].	
  			]. 
  		object == 0] whileFalse.
+ 	hashedCollections do: [ :each | each compact ]. "our purpose"
- 	hashedCollections do: #rehash. "our purpose"
  	^ receiverClasses	"our secondary job"
  !

Item was changed:
  ----- Method: ImageSegment>>restoreEndianness (in category 'fileIn/Out') -----
  restoreEndianness
  	"Fix endianness (byte order) of any objects not already fixed.  Do this by discovering classes that need a startUp message sent to each instance, and sending it.
  	I have just been brought in and converted to live objects.  Find all Sets and Dictionaries in the newly created objects and rehash them.  Segment is near then end of memory, since is was newly brought in (and a new object created for it).
  	Also, collect all classes of receivers of blocks which refer to instance variables.  Return them.  Caller will check if they have been reshaped."
  
  	| object hashedCollections receiverClasses inSeg noStartUpNeeded startUps cls msg |
  
  	object := segment.
  	hashedCollections := OrderedCollection new.
  		"have to collect them, because Dictionary makes a copy, and that winds up at the end of memory and gets rehashed and makes another one."
  	receiverClasses := IdentitySet new.
  	noStartUpNeeded := IdentitySet new.	"classes that don't have a per-instance startUp message"
  	startUps := IdentityDictionary new.	"class -> MessageSend of a startUp message"
  	inSeg := true.
  	[object := object nextObject.  "all the way to the end of memory to catch remade objects"
  		object == endMarker ifTrue: [inSeg := false].	"off end"
  		object isInMemory ifTrue: [
  			(object isKindOf: HashedCollection) ifTrue: [hashedCollections add: object].
  			(object isKindOf: ContextPart) ifTrue: [
  				(inSeg and: [object hasInstVarRef]) ifTrue: [
  					receiverClasses add: object receiver class]].
  			inSeg ifTrue: [
  				(noStartUpNeeded includes: object class) ifFalse: [
  					cls := object class.
  					(msg := startUps at: cls ifAbsent: [nil]) ifNil: [
  						msg := cls startUpFrom: self.	"a Message, if we need to swap bytes this time"
  						msg ifNil: [noStartUpNeeded add: cls]
  							ifNotNil: [startUps at: cls put: msg]].
  					msg ifNotNil: [msg sentTo: object]]]]. 
  		object == 0] whileFalse.
+ 	hashedCollections do: [ :each | each compact ]. "our purpose"
- 	hashedCollections do: #rehash.	"our purpose"
  	^ receiverClasses	"our secondary job"
  !

Item was changed:
  ----- Method: ObjectFinalizerCollection>>finalize (in category 'finalization') -----
  finalize
  	"Finalize all elements in this collection. The elements are expected to be ObjectFinalizers, but can be any object which understands #finalize."
  
+ 	self do: [ :each | each finalize ]!
- 	self do: #finalize!

Item was changed:
  ----- Method: SystemNavigation>>allMethodsSelect: (in category 'query') -----
  allMethodsSelect: aBlock 
  	"Answer a SortedCollection of each method that, when used as the block  
  	argument to aBlock, gives a true result."
  	| aCollection |
+ 	aCollection := OrderedCollection new.
- 	aCollection := SortedCollection new.
  	Cursor execute
  		showWhile: [self
  				allBehaviorsDo: [:class | class
  						selectorsAndMethodsDo: [:sel :m | (aBlock value: m)
  								ifTrue: [aCollection
  										add: (MethodReference new setStandardClass: class methodSymbol: sel)]]]].
+ 	^ aCollection sort!
- 	^ aCollection!




More information about the Squeak-dev mailing list