Worrying issue re compilation in Pharo 1.4

GM
Graham McLeod
Sun, Jun 24, 2012 11:22 PM

Hi Guys

I am trying to use  Pharo1.4  Latest update: #14438 as downloaded in the
Moose 4.7 image.
I am loving most of the changes and system tools - well done all!

But

I am coming up with a worrying bug where there is a difference between
Source code and decompiled source code.
Specifically, this occurs with two set methods which point to the wrong
instance variable slot.
So, when the code runs, the wrong variables are updated.

Here is an example:

Class definition:
Thing subclass: #Relationship
instanceVariableNames: 'context fromNode properties relType toNode'
classVariableNames: ''
poolDictionaries: ''
category: 'Sapiento'

Source Code:
relType: anObject
relType := anObject
Byte Codes:
13 <10> pushTemp: 0
14 <62> popIntoRcvr: 2
15 <78> returnSelf
Decompiled Code:
relType: anObject
properties := anObject

NOTE: properties is updated instead of relType.

I may have added a new instance variable since the original class
definition.
Are there known issues / available fixes around this?

Please advise
Thanks in advance.

Graham

Hi Guys I am trying to use Pharo1.4 Latest update: #14438 as downloaded in the Moose 4.7 image. I am loving most of the changes and system tools - well done all! But I am coming up with a worrying bug where there is a difference between Source code and decompiled source code. Specifically, this occurs with two set methods which point to the wrong instance variable slot. So, when the code runs, the wrong variables are updated. Here is an example: Class definition: Thing subclass: #Relationship instanceVariableNames: 'context fromNode properties relType toNode' classVariableNames: '' poolDictionaries: '' category: 'Sapiento' Source Code: relType: anObject relType := anObject Byte Codes: 13 <10> pushTemp: 0 14 <62> popIntoRcvr: 2 15 <78> returnSelf Decompiled Code: relType: anObject properties := anObject NOTE: properties is updated instead of relType. I may have added a new instance variable since the original class definition. Are there known issues / available fixes around this? Please advise Thanks in advance. Graham
MD
Marcus Denker
Mon, Jun 25, 2012 7:18 AM

On Jun 25, 2012, at 1:22 AM, Graham McLeod wrote:

Here is an example:

Class definition:
Thing subclass: #Relationship
instanceVariableNames: 'context fromNode properties relType toNode'
classVariableNames: ''
poolDictionaries: ''
category: 'Sapiento'

Source Code:
relType: anObject
relType := anObject
Byte Codes:
13 <10> pushTemp: 0
14 <62> popIntoRcvr: 2
15 <78> returnSelf
Decompiled Code:
relType: anObject
properties := anObject

NOTE: properties is updated instead of relType.

It seems that the method has not been recompiled correctly when you added instance variables.

The decompiled code and the bytecode are in sync:  14 <62> popIntoRcvr: 2 is storing into
the properties instance variable, and the decompiled code shows it correctly.
But the bytecode should have been regenerated and do  14 <62> popIntoRcvr: 3

So the bug is definitly related to not recompiling the methods after the shape of the class was changed.

Marcus

--
Marcus Denker -- http://marcusdenker.de

On Jun 25, 2012, at 1:22 AM, Graham McLeod wrote: > > Here is an example: > > Class definition: > Thing subclass: #Relationship > instanceVariableNames: 'context fromNode properties relType toNode' > classVariableNames: '' > poolDictionaries: '' > category: 'Sapiento' > > Source Code: > relType: anObject > relType := anObject > Byte Codes: > 13 <10> pushTemp: 0 > 14 <62> popIntoRcvr: 2 > 15 <78> returnSelf > Decompiled Code: > relType: anObject > properties := anObject > > NOTE: properties is updated instead of relType. > It seems that the method has not been recompiled correctly when you added instance variables. The decompiled code and the bytecode are in sync: 14 <62> popIntoRcvr: 2 is storing into the properties instance variable, and the decompiled code shows it correctly. But the bytecode should have been regenerated and do 14 <62> popIntoRcvr: 3 So the bug is definitly related to not recompiling the methods after the shape of the class was changed. Marcus -- Marcus Denker -- http://marcusdenker.de
GM
Graham McLeod
Mon, Jun 25, 2012 3:50 PM

Hi Marcus,

Your answer is as I suspected.
The suggestion to add an instance variable, forcing a recompile, from
Andrew P Black, seems to resolve the problem..
There still remains the question of how the system allowed the situation
to arise in the first place tho..

Thanks for the help.
KR
Graham

Marcus Denker wrote:

On Jun 25, 2012, at 1:22 AM, Graham McLeod wrote:

Here is an example:

Class definition:
Thing subclass: #Relationship
instanceVariableNames: 'context fromNode properties relType toNode'
classVariableNames: ''
poolDictionaries: ''
category: 'Sapiento'

Source Code:
relType: anObject
relType := anObject
Byte Codes:
13<10>  pushTemp: 0
14<62>  popIntoRcvr: 2
15<78>  returnSelf
Decompiled Code:
relType: anObject
properties := anObject

NOTE: properties is updated instead of relType.

It seems that the method has not been recompiled correctly when you added instance variables.

The decompiled code and the bytecode are in sync:  14<62>  popIntoRcvr: 2 is storing into
the properties instance variable, and the decompiled code shows it correctly.
But the bytecode should have been regenerated and do  14<62>  popIntoRcvr: 3

So the bug is definitly related to not recompiling the methods after the shape of the class was changed.

Marcus

--
Marcus Denker -- http://marcusdenker.de

Hi Marcus, Your answer is as I suspected. The suggestion to add an instance variable, forcing a recompile, from Andrew P Black, seems to resolve the problem.. There still remains the question of how the system allowed the situation to arise in the first place tho.. Thanks for the help. KR Graham Marcus Denker wrote: > On Jun 25, 2012, at 1:22 AM, Graham McLeod wrote: >> Here is an example: >> >> Class definition: >> Thing subclass: #Relationship >> instanceVariableNames: 'context fromNode properties relType toNode' >> classVariableNames: '' >> poolDictionaries: '' >> category: 'Sapiento' >> >> Source Code: >> relType: anObject >> relType := anObject >> Byte Codes: >> 13<10> pushTemp: 0 >> 14<62> popIntoRcvr: 2 >> 15<78> returnSelf >> Decompiled Code: >> relType: anObject >> properties := anObject >> >> NOTE: properties is updated instead of relType. >> > > It seems that the method has not been recompiled correctly when you added instance variables. > > The decompiled code and the bytecode are in sync: 14<62> popIntoRcvr: 2 is storing into > the properties instance variable, and the decompiled code shows it correctly. > But the bytecode should have been regenerated and do 14<62> popIntoRcvr: 3 > > So the bug is definitly related to not recompiling the methods after the shape of the class was changed. > > Marcus > > > -- > Marcus Denker -- http://marcusdenker.de > >
AP
Andrew P. Black
Tue, Jun 26, 2012 5:04 PM

On 25 Jun 2012, at 08:50 , Graham McLeod wrote:

There still remains the question of how the system allowed the situation to arise in the first place tho..

Indeed: this should never happen.  So, if you can reproduce the problem, you should report it as a bug in the 1.4 bug tracker.

http://code.google.com/p/pharo/issues/list

Andrew
On 25 Jun 2012, at 08:50 , Graham McLeod wrote: > There still remains the question of how the system allowed the situation to arise in the first place tho.. Indeed: this should never happen. So, if you can reproduce the problem, you should report it as a bug in the 1.4 bug tracker. http://code.google.com/p/pharo/issues/list Andrew
MD
Marcus Denker
Tue, Jun 26, 2012 5:49 PM

On Jun 26, 2012, at 7:04 PM, Andrew P. Black wrote:

On 25 Jun 2012, at 08:50 , Graham McLeod wrote:

There still remains the question of how the system allowed the situation to arise in the first place tho..

Indeed: this should never happen.  So, if you can reproduce the problem, you should report it as a bug in the 1.4 bug tracker.

http://code.google.com/p/pharo/issues/list

Yes! As far as I know, there is no bug reported regarding any problems with this... we are, though, completely rewriting this
part of the system for 2.0:
-> the old system change notifycation mechanism will be replaced with a new system base on Announcements.
-> the old class builder will be replaced by one based on the work in the context of first class Slots
(see the OOPSLA Paper of Toon and Camillo: http://scg.unibe.ch/scgbib?query=Verw11b&display=abstract )
-> instead of recompiling, we will just change the offsets of the iVars on the level of the bytecode intermediate representation
of the new pharo compiler.

This is not yet in 2.0... but we are woking on it.

Marcus

--
Marcus Denker -- http://marcusdenker.de

On Jun 26, 2012, at 7:04 PM, Andrew P. Black wrote: > > On 25 Jun 2012, at 08:50 , Graham McLeod wrote: > >> There still remains the question of how the system allowed the situation to arise in the first place tho.. > > Indeed: this should never happen. So, if you can reproduce the problem, you should report it as a bug in the 1.4 bug tracker. > > http://code.google.com/p/pharo/issues/list > Yes! As far as I know, there is no bug reported regarding any problems with this... we are, though, completely rewriting this part of the system for 2.0: -> the old system change notifycation mechanism will be replaced with a new system base on Announcements. -> the old class builder will be replaced by one based on the work in the context of first class Slots (see the OOPSLA Paper of Toon and Camillo: http://scg.unibe.ch/scgbib?query=Verw11b&display=abstract ) -> instead of recompiling, we will just change the offsets of the iVars on the level of the bytecode intermediate representation of the new pharo compiler. This is not yet in 2.0... but we are woking on it. Marcus -- Marcus Denker -- http://marcusdenker.de
PM
Philippe Marschall
Tue, Jun 26, 2012 7:31 PM

On Tue, Jun 26, 2012 at 7:49 PM, Marcus Denker marcus.denker@inria.fr wrote:

On Jun 26, 2012, at 7:04 PM, Andrew P. Black wrote:

On 25 Jun 2012, at 08:50 , Graham McLeod wrote:

There still remains the question of how the system allowed the situation to arise in the first place tho..

Indeed: this should never happen.  So, if you can reproduce the problem, you should report it as a bug in the 1.4 bug tracker.

http://code.google.com/p/pharo/issues/list

Yes! As far as I know, there is no bug reported regarding any problems with this... we are, though, completely rewriting this
part of the system for 2.0:
       -> the old system change notifycation mechanism will be replaced with a new system base on Announcements.
       -> the old class builder will be replaced by one based on the work in the context of first class Slots
               (see the OOPSLA Paper of Toon and Camillo: http://scg.unibe.ch/scgbib?query=Verw11b&display=abstract )
       -> instead of recompiling, we will just change the offsets of the iVars on the level of the bytecode intermediate representation
            of the new pharo compiler.

Nice!

Cheers
Philippe

On Tue, Jun 26, 2012 at 7:49 PM, Marcus Denker <marcus.denker@inria.fr> wrote: > > On Jun 26, 2012, at 7:04 PM, Andrew P. Black wrote: > >> >> On 25 Jun 2012, at 08:50 , Graham McLeod wrote: >> >>> There still remains the question of how the system allowed the situation to arise in the first place tho.. >> >> Indeed: this should never happen.  So, if you can reproduce the problem, you should report it as a bug in the 1.4 bug tracker. >> >> http://code.google.com/p/pharo/issues/list >> > Yes! As far as I know, there is no bug reported regarding any problems with this... we are, though, completely rewriting this > part of the system for 2.0: >        -> the old system change notifycation mechanism will be replaced with a new system base on Announcements. >        -> the old class builder will be replaced by one based on the work in the context of first class Slots >                (see the OOPSLA Paper of Toon and Camillo: http://scg.unibe.ch/scgbib?query=Verw11b&display=abstract ) >        -> instead of recompiling, we will just change the offsets of the iVars on the level of the bytecode intermediate representation >             of the new pharo compiler. Nice! Cheers Philippe
GM
Graham McLeod
Tue, Jun 26, 2012 11:34 PM

Thanks all.
I have not been able to reproduce the problem.
It may have been a unique sequence of actions unlikely to recur.
The new strategy sounds good.

KR
Graham

Philippe Marschall wrote:

On Tue, Jun 26, 2012 at 7:49 PM, Marcus Denkermarcus.denker@inria.fr  wrote:

On Jun 26, 2012, at 7:04 PM, Andrew P. Black wrote:

On 25 Jun 2012, at 08:50 , Graham McLeod wrote:

There still remains the question of how the system allowed the situation to arise in the first place tho..

Indeed: this should never happen.  So, if you can reproduce the problem, you should report it as a bug in the 1.4 bug tracker.

http://code.google.com/p/pharo/issues/list

Yes! As far as I know, there is no bug reported regarding any problems with this... we are, though, completely rewriting this
part of the system for 2.0:
->  the old system change notifycation mechanism will be replaced with a new system base on Announcements.
->  the old class builder will be replaced by one based on the work in the context of first class Slots
(see the OOPSLA Paper of Toon and Camillo: http://scg.unibe.ch/scgbib?query=Verw11b&display=abstract )
->  instead of recompiling, we will just change the offsets of the iVars on the level of the bytecode intermediate representation
of the new pharo compiler.

Thanks all. I have not been able to reproduce the problem. It may have been a unique sequence of actions unlikely to recur. The new strategy sounds good. KR Graham Philippe Marschall wrote: > On Tue, Jun 26, 2012 at 7:49 PM, Marcus Denker<marcus.denker@inria.fr> wrote: >> On Jun 26, 2012, at 7:04 PM, Andrew P. Black wrote: >> >>> On 25 Jun 2012, at 08:50 , Graham McLeod wrote: >>> >>>> There still remains the question of how the system allowed the situation to arise in the first place tho.. >>> Indeed: this should never happen. So, if you can reproduce the problem, you should report it as a bug in the 1.4 bug tracker. >>> >>> http://code.google.com/p/pharo/issues/list >>> >> Yes! As far as I know, there is no bug reported regarding any problems with this... we are, though, completely rewriting this >> part of the system for 2.0: >> -> the old system change notifycation mechanism will be replaced with a new system base on Announcements. >> -> the old class builder will be replaced by one based on the work in the context of first class Slots >> (see the OOPSLA Paper of Toon and Camillo: http://scg.unibe.ch/scgbib?query=Verw11b&display=abstract ) >> -> instead of recompiling, we will just change the offsets of the iVars on the level of the bytecode intermediate representation >> of the new pharo compiler. > > Nice! > > Cheers > Philippe > > _______________________________________________ > Esug-list mailing list > Esug-list@lists.esug.org > http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
RS
Richard Sargent
Wed, Jun 27, 2012 4:26 PM

I can recall seeing a problem similar to this some years ago in VisualAge
Smalltalk. VisualAge Smalltalk uses the ENVY version control system (I think
very highly of it!). I was able to determine what the developer had done
"wrong", so it is possible that something similar exists with Pharo.

Specifically, if one browses the differences between the currently loaded
edition and another version, one could have an opportunity to load the
alternate edition of the class definition itself through the Differences
Browser. I found that this failed to recompile the methods, and resulted in
methods referring to wrong the wrong instance variable offsets.

I know nothing about Pharo, what version control it has, and what change
browsing capabilities it has. So, I cannot say that it is the same problem,
just that it is a possibility.

Good luck,
Richard


From: Graham McLeod [mailto:mcleod@iafrica.com]
Sent: June-27-12 1:34 AM
To: Philippe Marschall
Cc: ESUG Mailing list; Andrew P. Black
Subject: Re: [Esug-list] Worrying issue re compilation in Pharo 1.4

Thanks all.
I have not been able to reproduce the problem.
It may have been a unique sequence of actions unlikely to recur.
The new strategy sounds good.

KR
Graham

Philippe Marschall wrote:

On Tue, Jun 26, 2012 at 7:49 PM, Marcus Denker
mailto:marcus.denker@inria.fr marcus.denker@inria.fr wrote:

On Jun 26, 2012, at 7:04 PM, Andrew P. Black wrote:

On 25 Jun 2012, at 08:50 , Graham McLeod wrote:

There still remains the question of how the system allowed the situation to
arise in the first place tho..

Indeed: this should never happen.  So, if you can reproduce the problem, you
should report it as a bug in the 1.4 bug tracker.

http://code.google.com/p/pharo/issues/list

Yes! As far as I know, there is no bug reported regarding any problems with
this... we are, though, completely rewriting this

part of the system for 2.0:

   -> the old system change notifycation mechanism will be replaced with

a new system base on Announcements.

   -> the old class builder will be replaced by one based on the work in

the context of first class Slots

           (see the OOPSLA Paper of Toon and Camillo:

http://scg.unibe.ch/scgbib?query=Verw11b
http://scg.unibe.ch/scgbib?query=Verw11b&display=abstract
&display=abstract )

   -> instead of recompiling, we will just change the offsets of the

iVars on the level of the bytecode intermediate representation

        of the new pharo compiler.

Nice!

Cheers

Philippe


Esug-list mailing list

Esug-list@lists.esug.org

http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

I can recall seeing a problem similar to this some years ago in VisualAge Smalltalk. VisualAge Smalltalk uses the ENVY version control system (I think very highly of it!). I was able to determine what the developer had done "wrong", so it is possible that something similar exists with Pharo. Specifically, if one browses the differences between the currently loaded edition and another version, one could have an opportunity to load the alternate edition of the class definition itself through the Differences Browser. I found that this failed to recompile the methods, and resulted in methods referring to wrong the wrong instance variable offsets. I know nothing about Pharo, what version control it has, and what change browsing capabilities it has. So, I cannot say that it is the same problem, just that it is a possibility. Good luck, Richard _____ From: Graham McLeod [mailto:mcleod@iafrica.com] Sent: June-27-12 1:34 AM To: Philippe Marschall Cc: ESUG Mailing list; Andrew P. Black Subject: Re: [Esug-list] Worrying issue re compilation in Pharo 1.4 Thanks all. I have not been able to reproduce the problem. It may have been a unique sequence of actions unlikely to recur. The new strategy sounds good. KR Graham Philippe Marschall wrote: On Tue, Jun 26, 2012 at 7:49 PM, Marcus Denker <mailto:marcus.denker@inria.fr> <marcus.denker@inria.fr> wrote: On Jun 26, 2012, at 7:04 PM, Andrew P. Black wrote: On 25 Jun 2012, at 08:50 , Graham McLeod wrote: There still remains the question of how the system allowed the situation to arise in the first place tho.. Indeed: this should never happen. So, if you can reproduce the problem, you should report it as a bug in the 1.4 bug tracker. http://code.google.com/p/pharo/issues/list Yes! As far as I know, there is no bug reported regarding any problems with this... we are, though, completely rewriting this part of the system for 2.0: -> the old system change notifycation mechanism will be replaced with a new system base on Announcements. -> the old class builder will be replaced by one based on the work in the context of first class Slots (see the OOPSLA Paper of Toon and Camillo: http://scg.unibe.ch/scgbib?query=Verw11b <http://scg.unibe.ch/scgbib?query=Verw11b&display=abstract> &display=abstract ) -> instead of recompiling, we will just change the offsets of the iVars on the level of the bytecode intermediate representation of the new pharo compiler. Nice! Cheers Philippe _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org