[squeak-dev] The Trunk: Kernel-eem.630.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Sep 27 15:46:09 UTC 2011


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

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

Name: Kernel-eem.630
Author: eem
Time: 27 September 2011, 8:45:29.372 am
UUID: 71012e54-3304-4e32-9ab0-46fa56f149c5
Ancestors: Kernel-nice.629

Provide a hook for subclasses to substitute an altered
method when deocmpiling.  This aoids an infinite recursion
decompiling installed MwMethodWrapper methods.

=============== Diff against Kernel-nice.629 ===============

Item was changed:
  ----- Method: CompiledMethod>>decompile (in category 'decompiling') -----
  decompile
  	"Return the decompiled parse tree that represents self"
  
  	|  class selector |
  	class := self methodClass ifNil: [Object].
  	selector := self selector ifNil: [self defaultSelector].
+ 	^class decompilerClass new decompile: selector in: class method: self methodForDecompile!
- 	^class decompilerClass new decompile: selector in: class method: self.!

Item was changed:
  ----- Method: CompiledMethod>>decompileWithTemps (in category 'decompiling') -----
  decompileWithTemps
  	"Return the decompiled parse tree that represents self, but get the temp names
  	 by compiling the sourcecode..."
  
  	|  class selector |
  	class := self methodClass ifNil: [Object].
  	selector := self selector ifNil: [self defaultSelector].
  
  	(self fileIndex > 0 and: [(SourceFiles at: self fileIndex) isNil]) ifTrue: [
  			"Emergency or no source file -- decompile without temp names "
  			^self decompile.
  	].
  	^((self decompilerClass new withTempNames: self methodNode schematicTempNamesString)
  						decompile: selector
  						in: class
+ 						method: self methodForDecompile)!
- 						method: self)!

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."
  	| trailer source |
+ 	(self properties includesKey: #source) ifTrue:
+ 		[^self properties at: #source].
  	trailer := self trailer.
  
  	trailer tempNames ifNotNil: [:namesString | 
  		"Magic sources -- decompile with temp names"
  		^ ((class decompilerClass new withTempNames: namesString)
+ 				decompile: selector in: class method: self methodForDecompile)
- 				decompile: selector in: class method: self)
  			decompileString].
  	
  	trailer sourceCode ifNotNil: [:code | ^ code ].
  	
  	trailer hasSourcePointer ifFalse: [
  		"No source pointer -- decompile without temp names"
+ 		^ (class decompilerClass new decompile: selector in: class method: self methodForDecompile)
- 		^ (class decompilerClass new decompile: selector in: class method: self)
  			decompileString].
  
  	"Situation normal;  read the sourceCode from the file"
  	source := [self getSourceFromFileAt: trailer sourcePointer]
  				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 ifNil: [
  			"Something really wrong -- decompile blind (no temps)"
+ 			 (class decompilerClass new decompile: selector in: class method: self methodForDecompile)
- 			 (class decompilerClass new decompile: selector in: class method: self)
  				decompileString]!

Item was added:
+ ----- Method: CompiledMethod>>methodForDecompile (in category 'decompiling') -----
+ methodForDecompile
+ 	"This is a hook to allow recursive methods like MwMethodWrapper to avoid infinite recursion."
+ 	^self!




More information about the Squeak-dev mailing list