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

commits at source.squeak.org commits at source.squeak.org
Thu Sep 29 21:10:33 UTC 2011


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

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

Name: Kernel-eem.632
Author: eem
Time: 29 September 2011, 2:09:31.751 pm
UUID: 807c955e-061f-4006-b9c2-981ffd241b4c
Ancestors: Kernel-ul.631

Avoid work in common case of setting method's source
pointer to zero when already zero.

=============== Diff against Kernel-ul.631 ===============

Item was changed:
  ----- Method: CompiledMethod>>setSourcePointer: (in category 'source code management') -----
  setSourcePointer: srcPointer
+ 	"We can't change the trailer of existing method, since it could have a
+ 	 completely different format. Therefore we need to generate a copy
+ 	 with new trailer, containing a srcPointer, and then #become it."
- 	"We can't change the trailer of existing method, since
- 	it could have completely different format. Therefore we need to
- 	generate a copy with new trailer, containing an scrPointer, and then
- 	#become it"
  	| trailer copy start |
+ 	trailer := srcPointer = 0
+ 				ifTrue: "catch the common case of setting the source pointer to 0 when already 0"
+ 					[self sourcePointer = 0 ifTrue:
+ 						[^self].
+ 					 CompiledMethodTrailer empty]
+ 				ifFalse:
+ 					[CompiledMethodTrailer new sourcePointer: srcPointer].
- 	trailer := CompiledMethodTrailer new sourcePointer: srcPointer.
  	copy := self copyWithTrailerBytes: trailer.
  
  	"ar 3/31/2010: Be a bit more clever since #become: is slow.
  	If the old and the new trailer have the same size, just replace it."
+ 	(self trailer class == trailer class and:[self size = copy size])
+ 		ifTrue:
+ 			[start := self endPC + 1.
+ 			self replaceFrom: start to: self size with: copy startingAt: start]
+ 		ifFalse:
+ 			[self becomeForward: copy].
- 	(self trailer class == trailer class and:[self size = copy size]) ifTrue:[
- 		start := self endPC + 1.
- 		self replaceFrom: start to: self size with: copy startingAt: start.
- 	] ifFalse:[self becomeForward: copy].
  
  	^self "will be copy if #become was needed"
  !




More information about the Squeak-dev mailing list