The Trunk: Traits-nice.284.mcz

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

The Trunk: Traits-nice.284.mcz

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

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

Name: Traits-nice.284
Author: nice
Time: 22 March 2010, 10:00:16.495 pm
UUID: da456581-abc7-5b49-83c8-9940314b08e6
Ancestors: Traits-ar.283

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 Traits-ar.283 ===============

Item was changed:
  ----- Method: CompiledMethod>>sameTraitCodeAs: (in category '*Traits-NanoKernel') -----
  sameTraitCodeAs: method
  "Answer whether the receiver implements the same code as the
  argument, method. Does not look at properties/pragmas since they
  do not affect the resulting code."
  | numLits |
  (method isKindOf: CompiledMethod) ifFalse: [^false].
  self methodHome == method methodHome ifFalse:[^false].
  (self properties analogousCodeTo: method properties) 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].
  1 to: numLits-2 do:[:i| | lit1 lit2 |
  lit1 := self literalAt: i.
  lit2 := method literalAt: i.
  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:[
+ "any other discrepancy is a failure"^ false]]].
- lit1 isFloat
- ifTrue:[(lit1 closeTo: lit2) ifFalse: [^false]]
- ifFalse:["any other discrepancy is a failure"^ false]]]].
  ^true!