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

commits at source.squeak.org commits at source.squeak.org
Tue Feb 14 00:17:40 UTC 2012


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

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

Name: Kernel-eem.669
Author: eem
Time: 13 February 2012, 4:16:39.081 pm
UUID: a0cd06b2-129d-4601-b1f2-a2ef622e8ff0
Ancestors: Kernel-eem.668

Fix CompiledMethod>>#= for class-side methods where
the methodClassAssociation is not unique.

=============== Diff against Kernel-eem.668 ===============

Item was changed:
  ----- Method: CompiledMethod>>= (in category 'comparing') -----
  = method
+ 	"Answer whether the receiver implements the same code as the argument, method.
+ 	 Here ``same code'' means that if the receiver's source is compiled with the same
+ 	 compiler it should produce the same sequence of bytecodes and literals, same
+ 	 trailer and same properties.  Hence this definition of #= (only one of many plausible
+ 	 definitions) can be used to quickly identify changes in the compiler's output."
  	| numLits |
+ 	method isCompiledMethod ifFalse: [^false].
- 	"Answer whether the receiver implements the same code as the 
- 	argument, method."
- 	(method isKindOf: CompiledMethod) ifFalse: [^false].
  	self size = method size ifFalse: [^false].
+ 	self header = method header ifFalse: [^false]. "N.B. includes numLiterals comparison."
- 	self header = method header ifFalse: [^false].
  	self initialPC to: self endPC do:
  		[:i | (self at: i) = (method at: i) ifFalse: [^false]].
+ 	numLits := self numLiterals.
- 	(numLits := self numLiterals) ~= method numLiterals ifTrue: [^false].
- 	"``Dont bother checking FFI and named primitives''
- 	 (#(117 120) includes: self primitive) ifTrue: [^ true]."
  	1 to: numLits do:
  		[:i| | lit1 lit2 |
  		lit1 := self literalAt: i.
  		lit2 := method literalAt: i.
  		(lit1 == lit2 or: [lit1 literalEqual: lit2]) ifFalse:
  			[(i = 1 and: [#(117 120) includes: self primitive])
  				ifTrue:
  					[lit1 isArray
  						ifTrue:
+ 							[(lit2 isArray and: [lit1 allButLast = lit2 allButLast]) ifFalse:
+ 								[^false]]
- 							[(lit2 isArray and: [lit1 allButLast = lit2 allButLast])
- 								ifFalse: [^false]]
  						ifFalse: "ExternalLibraryFunction"
+ 							[(lit1 analogousCodeTo: lit2) ifFalse:
+ 								[^false]]]
- 							[(lit1 analogousCodeTo: lit2)
- 								ifFalse: [^false]]]
  				ifFalse:
  					[i = (numLits - 1)
  						ifTrue: "properties"
  							[(self properties analogousCodeTo: method properties)
  								ifFalse: [^false]]
+ 						ifFalse: "last literal (methodClassAssociation) of class-side methods is not unique"
+ 							[(i = numLits
+ 							 and: [lit1 isVariableBinding
+ 							 and: [lit2 isVariableBinding
+ 							 and: [lit1 key == lit2 key
+ 							 and: [lit1 value == lit2 value]]]]) ifFalse:
+ 								[^false]]]]].
- 						ifFalse: [^false]]]].
  	^true!



More information about the Squeak-dev mailing list