MNU sendsToSuper in inheritanceButtonColor

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

MNU sendsToSuper in inheritanceButtonColor

K. K. Subramaniam
Hi,

I got a MNU: sendsToSuper in CodeHolder>>inheritanceButtonColor while browsing
methods (log attached).

currentCompiledMethod was nil this method. The initial test reads:
  ((currentCompiledMethod isKindOf: CompiledMethod) and: [Preferences
decorateBrowserButtons]) ifFalse: [ ^Color transparent ].

I presume currentCompiledMethod can be nil when this method is called. So I
changed the test to:
    (Preferences decorateBrowserButtons
                or: [currentCompiledMethod isKindOf: CompiledMethod])
                        ifFalse: [ ^ Color transparent ].
to make it more robust.

Is this the right fix? .. Subbu



SqueakDebug.log (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: MNU sendsToSuper in inheritanceButtonColor

Levente Uzonyi-2
On Sat, 9 Jan 2010, K. K. Subramaniam wrote:

> Hi,
>
> I got a MNU: sendsToSuper in CodeHolder>>inheritanceButtonColor while browsing
> methods (log attached).
>
> currentCompiledMethod was nil this method. The initial test reads:
>  ((currentCompiledMethod isKindOf: CompiledMethod) and: [Preferences
> decorateBrowserButtons]) ifFalse: [ ^Color transparent ].
>
> I presume currentCompiledMethod can be nil when this method is called. So I
> changed the test to:
>   (Preferences decorateBrowserButtons
> or: [currentCompiledMethod isKindOf: CompiledMethod])
> ifFalse: [ ^ Color transparent ].
> to make it more robust.
>
> Is this the right fix? .. Subbu
>

No it's not, that would make the test weaker instead of more robust, since
if Preferences >> #decorateBrowserButtons returns true (which is the default
behavior) the other check is simply bypassed and the execution continues
without returning Color transparent.

Fixing this issue won't be easy, because it's a concurreny issue. The
execution normally never reaches the #sendsToSuper send, the method should
return after the first line. But the code passes the first line,
because currentCompiledMethod's value is not nil. Later at some other place
currentCompiledMethod's value is changed to nil, but this happens before
the code reaches the #sendsToSuper send. I guess  MessageSet >>
#selectedMessage replaces the value of currentCompiledMethod when it
reaches this line:
  currentCompiledMethod := class compiledMethodAt: selector ifAbsent: [nil].
So this problem should be fixed in another way.


Levente

Reply | Threaded
Open this post in threaded view
|

Re: MNU sendsToSuper in inheritanceButtonColor

Levente Uzonyi-2
On Sat, 9 Jan 2010, Levente Uzonyi wrote:

> ...
> code reaches the #sendsToSuper send. I guess  MessageSet >> #selectedMessage

MessageNames(MessageSet) >> #contents may change the value to nil too.


Levente

> replaces the value of currentCompiledMethod when it reaches this line:
> currentCompiledMethod := class compiledMethodAt: selector ifAbsent:
> [nil].
> So this problem should be fixed in another way.
>
>
> Levente
>
>

Reply | Threaded
Open this post in threaded view
|

Re: MNU sendsToSuper in inheritanceButtonColor

K. K. Subramaniam
In reply to this post by Levente Uzonyi-2
On Saturday 09 January 2010 11:54:58 am Levente Uzonyi wrote:
> Fixing this issue won't be easy, because it's a concurreny issue. The
> execution normally never reaches the #sendsToSuper send, the method should
> return after the first line. But the code passes the first line,
> because currentCompiledMethod's value is not nil. Later at some other
>  place  currentCompiledMethod's value is changed to nil, but this happens
>  before the code reaches the #sendsToSuper send
You're right. Thanks.

How about moving the compiledMethod check just after flags := 0?

  flags := 0.
  ((currentCompiledMethod isKindOf: CompiledMethod) and:
      [currentCompiledMethod sendsToSuper]) ifTrue: [ flags := flags bitOr: 2 ].

Subbu