[PATCH] Fix (3 perform: #~= with: 3.0)

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

[PATCH] Fix (3 perform: #~= with: 3.0)

Paolo Bonzini
This stupid (almost embarrassing...) bug happens because, in the more
common idiom "3 ~= 3.0", the VM optimizes out the method calls.  In the
case of the JIT however this does not happen, and this causes the
simpler idiom to fail as well (and the Complex package to fail the test
suite).

While not perfect, the testsuite results are good enough.

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix (3 perform: #~= with: 3.0)

Paolo Bonzini-2
Paolo Bonzini wrote:
> This stupid (almost embarrassing...) bug happens because, in the more
> common idiom "3 ~= 3.0", the VM optimizes out the method calls.  In the
> case of the JIT however this does not happen, and this causes the
> simpler idiom to fail as well (and the Complex package to fail the test
> suite).
>
> While not perfect, the testsuite results are good enough.

Ehm, the patch.

Paolo

2007-12-10  Paolo Bonzini  <[hidden email]>

        * kernel/Number.st: Fix thinko in #retryInequalityCoercing:,


--- orig/kernel/Number.st
+++ mod/kernel/Number.st
@@ -252,8 +252,8 @@ implicit type coercing code for binary o
  selfGen := self generality.
  aNumGen := aNumber generality.
  aNumGen isNil ifTrue: [^true].
- selfGen > aNumGen ifTrue: [^false == (self ~= (self coerce: aNumber))].
- selfGen < aNumGen ifTrue: [^false == ((aNumber coerce: self) ~= aNumber)].
+ selfGen > aNumGen ifTrue: [^false == (self = (self coerce: aNumber))].
+ selfGen < aNumGen ifTrue: [^false == ((aNumber coerce: self) = aNumber)].
  self retryError
     ]
 




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk