[squeak-dev] The Trunk: System-eem.438.mcz

commits at source.squeak.org commits at source.squeak.org
Tue May 24 01:15:02 UTC 2011


Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.438.mcz

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

Name: System-eem.438
Author: eem
Time: 23 May 2011, 6:14:14.008 pm
UUID: c038f616-9da6-4abd-94be-1b5d43c9ed03
Ancestors: System-ul.437

Use literalsDo: in place of literals do: in some
SystemNavigation trawling code.

=============== Diff against System-ul.437 ===============

Item was changed:
  ----- Method: SystemNavigation>>allGlobalRefsWithout: (in category 'query') -----
  allGlobalRefsWithout: classesAndMessagesPair 
  	"Answer a set of symbols that may be refs to Global names. In some  
  	sense we should only need the associations, but this will also catch, eg,  
  	HTML tag types. This method computes its result in the absence of  
  	specified classes and messages."
  	"may be a problem if namespaces are introduced as for the moment  
  	only Smalltalk is queried. sd 29/4/03"
  	| globalRefs absentClasses absentSelectors |
  	globalRefs := IdentitySet new: CompiledMethod instanceCount.
  	absentClasses := classesAndMessagesPair first.
  	absentSelectors := classesAndMessagesPair second.
  	self flag: #shouldBeRewrittenUsingSmalltalkAllClassesDo:.
  	"sd 29/04/03"
  	Cursor execute
  		showWhile: [Smalltalk classNames
  				do: [:cName | ((absentClasses includes: cName)
  						ifTrue: [{}]
  						ifFalse: [{Smalltalk at: cName. (Smalltalk at: cName) class}])
  						do: [:cl | (absentSelectors isEmpty
  								ifTrue: [cl selectors]
  								ifFalse: [cl selectors copyWithoutAll: absentSelectors])
  								do: [:sel | "Include all capitalized symbols for good 
  									measure"
+ 									(cl compiledMethodAt: sel) literalsDo: [:m |
+ 										((m isSymbol)
+ 												and: [m size > 0
+ 														and: [m first canBeGlobalVarInitial]])
+ 											ifTrue: [globalRefs add: m].
+ 										(m isMemberOf: Array)
+ 											ifTrue: [m
+ 													do: [:x | ((x isSymbol)
+ 																and: [x size > 0
+ 																		and: [x first canBeGlobalVarInitial]])
+ 															ifTrue: [globalRefs add: x]]].
+ 										m isVariableBinding
+ 											ifTrue: [m key
+ 													ifNotNil: [globalRefs add: m key]]]]]]].
- 									(cl compiledMethodAt: sel) literals
- 										do: [:m | 
- 											((m isSymbol)
- 													and: [m size > 0
- 															and: [m first canBeGlobalVarInitial]])
- 												ifTrue: [globalRefs add: m].
- 											(m isMemberOf: Array)
- 												ifTrue: [m
- 														do: [:x | ((x isSymbol)
- 																	and: [x size > 0
- 																			and: [x first canBeGlobalVarInitial]])
- 																ifTrue: [globalRefs add: x]]].
- 											m isVariableBinding
- 												ifTrue: [m key
- 														ifNotNil: [globalRefs add: m key]]]]]]].
  	^ globalRefs!

Item was changed:
  ----- Method: SystemNavigation>>allReferencesToPool:from: (in category 'query') -----
  allReferencesToPool: aPool from: aClass
  	"Answer all the references to variables from aPool"
  	| list |
  	list := OrderedCollection new.
  	aClass withAllSubclassesDo:[:cls|
+ 		cls selectorsAndMethodsDo:[:sel :meth|
+ 			(meth hasLiteralSuchThat: [:lit| lit isVariableBinding and:[(aPool bindingOf: lit key) notNil]]) ifTrue:
+ 				[list add:(MethodReference new setStandardClass: cls methodSymbol: sel)]]].
- 		cls selectorsAndMethodsDo:[:sel :meth| | ref |
- 			ref := meth literals detect:[:lit|
- 				lit isVariableBinding and:[(aPool bindingOf: lit key) notNil]
- 			] ifNone:[nil].
- 			ref ifNotNil:[
- 				list add:(MethodReference new setStandardClass: cls methodSymbol: sel)
- 			].
- 		].
- 	].
  	^list!

Item was changed:
  ----- Method: SystemNavigation>>allSentMessagesWithout: (in category 'query') -----
  allSentMessagesWithout: classesAndMessagesPair 
  	"Answer the set of selectors which are sent somewhere in the system,  
  	computed in the absence of the supplied classes and messages."
  	| sent absentClasses absentSelectors |
  	sent := IdentitySet new: CompiledMethod instanceCount.
  	absentClasses := classesAndMessagesPair first.
  	absentSelectors := classesAndMessagesPair second.
  	self flag: #shouldBeRewrittenUsingSmalltalkAllClassesDo:.
  	"sd 29/04/03"
  	Cursor execute showWhile: [
  		Smalltalk classNames , Smalltalk traitNames do: [:name |
  			((absentClasses includes: name)
  				ifTrue: [{}]
  				ifFalse: [{Smalltalk at: name. (Smalltalk at: name) classSide}])
  					do: [:each | (absentSelectors isEmpty
  						ifTrue: [each selectors]
  						ifFalse: [each selectors copyWithoutAll: absentSelectors])
  						do: [:sel | "Include all sels, but not if sent by self"
+ 							(each compiledMethodAt: sel) literalsDo: [:m | 
- 							(each compiledMethodAt: sel) literals
- 								do: [:m | 
  									(m isSymbol)
  										ifTrue: ["might be sent"
  											m == sel
  												ifFalse: [sent add: m]].
  									(m isMemberOf: Array)
  										ifTrue: ["might be performed"
  											m
  												do: [:x | (x isSymbol)
  														ifTrue: [x == sel
  																ifFalse: [sent add: x]]]]]]]].
  			"The following may be sent without being in any literal frame"
  			1
  				to: Smalltalk specialSelectorSize
  				do: [:index | sent
  						add: (Smalltalk specialSelectorAt: index)]].
  	Smalltalk presumedSentMessages
  		do: [:sel | sent add: sel].
  	^ sent!




More information about the Squeak-dev mailing list