[squeak-dev] The Trunk: Kernel-ul.325.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Dec 8 06:22:52 UTC 2009


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

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

Name: Kernel-ul.325
Author: ul
Time: 8 December 2009, 7:03:36 am
UUID: 4f783a4d-1f0d-4248-8e31-6bf866b519ad
Ancestors: Kernel-ar.324

- don't parse the method if the selector is not an alias selector in CompiledMethod >> #getSourceFor:in:. This improves source fetching performance.

=============== Diff against Kernel-ar.324 ===============

Item was changed:
  ----- Method: CompiledMethod>>getSourceFor:in: (in category 'source code management') -----
  getSourceFor: selector in: class
  	"Retrieve or reconstruct the source code for this method."
  	| flagByte source |
  	flagByte := self last.
  	(flagByte = 0
  		or: [flagByte = 251 "some source-less methods have flag = 251, rest = 0"
  			and: [((1 to: 3) allSatisfy: [:i | (self at: self size - i) = 0])]])
  		ifTrue:
  		["No source pointer -- decompile without temp names"
  		^ (class decompilerClass new decompile: selector in: class method: self)
  			decompileString].
  	flagByte < 252 ifTrue:
  		["Magic sources -- decompile with temp names"
  		^ ((class decompilerClass new withTempNames: self tempNamesString)
  				decompile: selector in: class method: self)
  			decompileString].
  
  	"Situation normal;  read the sourceCode from the file"
  	
  	source := [self getSourceFromFile]
  				on: Error
  		"An error can happen here if, for example, the changes file has been truncated by an aborted download.  The present solution is to ignore the error and fall back on the decompiler.  A more thorough solution should probably trigger a systematic invalidation of all source pointers past the end of the changes file.  Consider that, as time goes on, the changes file will eventually grow large enough to cover the lost code, and then instead of falling into this error case, random source code will get returned."
  				do: [ :ex | ex return: nil].
  		
  	^source
+ 		ifNotNil: [
+ 			| sourceSelector |
- 		ifNotNil:
- 			[| sourceSelector |
  			"I think this is something to do with the traits system.  It would be ncie if someone
  			 documented this.  It looks like an egregious hack to me. eem 9/5/2009 09:04"
+ 			(class isAliasSelector: selector)
+ 				ifFalse: [ source ]
+ 				ifTrue: [ "Only alias selectors need this replacement"
+ 					 sourceSelector := Parser parserClass new parseSelector: source.
+ 					 sourceSelector = selector
+ 						ifTrue: [ source ]
+ 						ifFalse: [ self replace: sourceSelector with: selector in: source ] ] ]
+ 		ifNil: [
+ 			"Something really wrong -- decompile blind (no temps)"
- 			 sourceSelector := Parser parserClass new parseSelector: source.
- 			 sourceSelector = selector
- 				ifTrue: [source]
- 				ifFalse: [self replace: sourceSelector with: selector in: source]]
- 		ifNil:
- 			["Something really wrong -- decompile blind (no temps)"
  			 (class decompilerClass new decompile: selector in: class method: self)
  				decompileString]!




More information about the Squeak-dev mailing list