[Newcompiler] Re: NewCompiler-ms.273.mcz
Klaus D. Witzel
klaus.witzel at cobss.com
Sat Sep 8 07:12:01 UTC 2007
> - Add a more powerfull way for comparing compiled method
...
>
> Article:
> * http://www.squeaksource.com/NewCompiler.html
>
> Download:
> * http://www.squeaksource.com/NewCompiler/NewCompiler-ms.273.mcz
Hi Math,
the same primitive can be used by many methods but with different fallback
code (in case the primitive fails). This so can make two methods unequal.
I'd suggest to eliminate the check for
(self primitive > 0 and: [self primitive = method primitive])
ifTrue:[^true].
Now since comparision of primitive numbers was formerly subsummed by
self header = method header ifFalse: [^false].
, I'd suggest to put primitive number comparision back as
self primitive = method primitive
ifFalse: [^false].
Also,
self initialPC to: self endPC do:
was formerly guarded by
self size = method size ifFalse: [^false].
Without such a guard, it's not impossible that you compare elements which
are not bytecode.
Last but not least: comparing the literals must parallel the way the
compiler compares the literals, see call sites of #addLiteral:, i.e.
#pushLiteral: in BytecodeGenerator. With other words, not using #= for
literal comparision but instead use #literalEqual:.
For the case of float literal comparision (which should be done by Float
itself in its override of #literalEqual:) I'd suggest to ask the Squeak
community about their opinion, their use cases and their numerical
tolerance.
As always, I'm open to critique :)
/Klaus
More information about the Newcompiler
mailing list