The Trunk: Kernel-nice.430.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-nice.430.mcz

commits-2
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.430.mcz

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

Name: Kernel-nice.430
Author: nice
Time: 22 March 2010, 9:58:57.062 pm
UUID: 0b52ed47-5bac-5946-9625-04599fb094a3
Ancestors: Kernel-laza.429

Don't use closeTo: when comparing compiledMethod.
Either two methods are equals or not (or we could fuzzify String equality to with sameAs: or other trick....).
The hack was previously necessary due to roundoff errors in printing and reading a Float.
This is not the case anymore: Float literals now storeOn: and readFrom: exactly..


=============== Diff against Kernel-laza.429 ===============

Item was changed:
  ----- Method: CompiledMethod>>= (in category 'comparing') -----
  = method
  | numLits |
  "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].
  self initialPC to: self endPC do:
  [:i | (self at: i) = (method at: i) ifFalse: [^false]].
  (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 = lit2]) ifFalse:
  [(i = 1 and: [#(117 120) includes: self primitive])
- ifTrue: [lit1 isArray
- ifTrue:
- [(lit2 isArray and: [lit1 allButLast = lit2 allButLast]) ifFalse:
- [^false]]
- ifFalse: "ExternalLibraryFunction"
- [(lit1 analogousCodeTo: lit2) ifFalse:
- [^false]]] ifFalse:
- [i = (numLits - 1) ifTrue: "properties"
- [(self properties analogousCodeTo: method properties) ifFalse:
- [^false]] ifFalse:
- [lit1 isFloat
  ifTrue:
+ [lit1 isArray
+ ifTrue:
+ [(lit2 isArray and: [lit1 allButLast = lit2 allButLast])
+ ifFalse: [^false]]
+ ifFalse: "ExternalLibraryFunction"
+ [(lit1 analogousCodeTo: lit2)
+ ifFalse: [^false]]]
- ["Floats match if values are close, due to roundoff error."
- (lit1 closeTo: lit2) ifFalse: [^false]. self flag: 'just checking'. self halt]
  ifFalse:
+ [i = (numLits - 1)
+ ifTrue: "properties"
+ [(self properties analogousCodeTo: method properties)
+ ifFalse: [^false]]
+ ifFalse: [^false]]]].
- ["any other discrepancy is a failure"
- ^ false]]]]].
  ^true!