CompiledMethod

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

CompiledMethod

Benjamin Van Ryseghem
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: CompiledMethod

Eliot Miranda-2


2010/9/9 Benjamin Van Ryseghem <[hidden email]>
Hi everybody,


I wonder if it's normal than two different methods can have the same CompiledMethod ?

By example :

Class >> foo
    'foo'

and

Class >> foo2
    'foo'

If I evaluate (Class methodDict at: #foo) = (Class methodDict at: #foo2), it answers true.

Maybe the CompiledMethod >> = should test the source ?

There are many definitions of method equality.  If you ant to test the source you can test the source, (C >> #foo) getSourceFromFile asString = (C >> #foo2) getSourceFromFile asString.  You can test the decompilation of a method (C>>#foo) decompileString = (C>>#foo2) decompileString.

The current definition tests whether the bytecodes and literals are the same, not the selector or the source code.  That's a useful definition, but not the only one.  It is close to the decompile version but faster, and is useful in e.g. testing whether the compiler has changed, since if on recompiling a method is still = the compiler is producing the same bytecode for a compilation.  That's what I use it for and it's an important use.

cheers
Eliot




Ben

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: CompiledMethod

Mariano Martinez Peck
Hi Benjamin. Yes, this is a known "problem".

Check http://forum.world.st/problem-with-CompiledMethod-equality-tt2221276.html#a2221276

2010/9/9 Eliot Miranda <[hidden email]>


2010/9/9 Benjamin Van Ryseghem <[hidden email]>

Hi everybody,


I wonder if it's normal than two different methods can have the same CompiledMethod ?

By example :

Class >> foo
    'foo'

and

Class >> foo2
    'foo'

If I evaluate (Class methodDict at: #foo) = (Class methodDict at: #foo2), it answers true.

Maybe the CompiledMethod >> = should test the source ?

There are many definitions of method equality.  If you ant to test the source you can test the source, (C >> #foo) getSourceFromFile asString = (C >> #foo2) getSourceFromFile asString.  You can test the decompilation of a method (C>>#foo) decompileString = (C>>#foo2) decompileString.

The current definition tests whether the bytecodes and literals are the same, not the selector or the source code.  That's a useful definition, but not the only one.  It is close to the decompile version but faster, and is useful in e.g. testing whether the compiler has changed, since if on recompiling a method is still = the compiler is producing the same bytecode for a compilation.  That's what I use it for and it's an important use.

cheers
Eliot




Ben

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project