What are MethodDictionary faults?

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

What are MethodDictionary faults?

Mariano Martinez Peck
Hi folks:  I am trying to understand ImageSegment methods like activeClasses, swapOutInactiveClasses, discoverActiveClasses among others. One of the comments of those methods says:

"NOTE:  discoverActiveClasses uses Squeak's ability to detect and recover from faults due to a nil method dictionary.  It staches the method dict in with the organization during the time when discovery is in progress (Gag me with a spoon).  This is why the faults need to be cleared promptly before resuming normal work with the system.  It is also important that classes *do not* refer directly to their method dictionary, but only via the accessor message."

So, it seems to HACK (it forces a fault) this MD fault recover to discover inactive classes and other things. Ok, forget that hack for a moment.

What questions is, what are these faults?  Why a method dictionary can be in nil ? How is this produced ? And how is it fixed?

I saw for example this:

Behaviour>>methodDict
    methodDict == nil ifTrue: [self recoverFromMDFaultWithTrace].
    ^ methodDict


But again...how can that be nil ???

Thank you very much.

Marian



Reply | Threaded
Open this post in threaded view
|

Re: What are MethodDictionary faults?

Andreas.Raab
Mariano Martinez Peck wrote:
> What questions is, what are these faults?  Why a method dictionary can
> be in nil ? How is this produced ? And how is it fixed?

These faults are messages generated by the VM when a class has no method
dictionary. Why? Because it can be used to discover which classes are used.

> But again...how can that be nil ???

See ClassDescription>>induceMDFault.

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Re: What are MethodDictionary faults?

Mariano Martinez Peck


On Wed, Dec 23, 2009 at 2:59 PM, Andreas Raab <[hidden email]> wrote:
Mariano Martinez Peck wrote:
What questions is, what are these faults?  Why a method dictionary can be in nil ? How is this produced ? And how is it fixed?

These faults are messages generated by the VM when a class has no method dictionary. Why? Because it can be used to discover which classes are used.
 

But again...how can that be nil ???

See ClassDescription>>induceMDFault.



Ok. Perfect. I could perfectly saw that when trying to discover used classes. I also saw the method ClassDescription>> induceMDFault.
 
However, I still have this question:

Forget about discovering classes, could be possible that for a certain situation the VM puts a nil to a method directory or always that happens this is done with that intention, throught the message induceMDFault ?   If it is always throught induceMDFault   the only sender is to discover used classes with ImageSegment.  So...it is used ONLY in that?
 
Cheers,
 - Andreas




Reply | Threaded
Open this post in threaded view
|

Re: What are MethodDictionary faults?

Andreas.Raab
Mariano Martinez Peck wrote:
> Forget about discovering classes, could be possible that for a certain
> situation the VM puts a nil to a method directory or always that happens
> this is done with that intention, throught the message induceMDFault ?  
> If it is always throught induceMDFault   the only sender is to discover
> used classes with ImageSegment.  So...it is used ONLY in that?

If we ignore the possibility of bugs causing it (i.e. using
#instVarAt:put: accidentally) then yes. At least I'm not aware of any
other use.

   - A.

Reply | Threaded
Open this post in threaded view
|

Re: Re: What are MethodDictionary faults?

Mariano Martinez Peck


On Wed, Dec 23, 2009 at 3:10 PM, Andreas Raab <[hidden email]> wrote:
Mariano Martinez Peck wrote:
Forget about discovering classes, could be possible that for a certain situation the VM puts a nil to a method directory or always that happens this is done with that intention, throught the message induceMDFault ?   If it is always throught induceMDFault   the only sender is to discover used classes with ImageSegment.  So...it is used ONLY in that?

If we ignore the possibility of bugs causing it (i.e. using #instVarAt:put: accidentally) then yes. At least I'm not aware of any other use.


That's true. But it I understood correctly, not even in that case the recover will work. Because the recover will search the methodDict in the category (organization). So, if I just set a nil to the methodDict using #instVarAt:put:  but I don't "backup" the methodDic in the category, the recover won't work.

I am right ?

Cheers,

Mariano


Reply | Threaded
Open this post in threaded view
|

Re: What are MethodDictionary faults?

Andreas.Raab
Mariano Martinez Peck wrote:
> That's true. But it I understood correctly, not even in that case the
> recover will work. Because the recover will search the methodDict in the
> category (organization). So, if I just set a nil to the methodDict using
> #instVarAt:put:  but I don't "backup" the methodDic in the category, the
> recover won't work.
>
> I am right ?

That's correct. Small meta note: I don't like playing "20 questions"
very much. If you have a theory or want to verify something it's better
to post your theory and have people comment on it. Posting one question
to get a yes/no, then posting another one to get a yes/no tires me very
quickly :-) See also the always appropriate essay from Eric Raymond:

http://www.catb.org/~esr/faqs/smart-questions.html

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Re: What are MethodDictionary faults?

Mariano Martinez Peck


On Wed, Dec 23, 2009 at 3:24 PM, Andreas Raab <[hidden email]> wrote:
Mariano Martinez Peck wrote:
That's true. But it I understood correctly, not even in that case the recover will work. Because the recover will search the methodDict in the category (organization). So, if I just set a nil to the methodDict using #instVarAt:put:  but I don't "backup" the methodDic in the category, the recover won't work.

I am right ?

That's correct. Small meta note: I don't like playing "20 questions" very much. If you have a theory or want to verify something it's better to post your theory and have people comment on it. Posting one question to get a yes/no, then posting another one to get a yes/no tires me very quickly :-) See also the always appropriate essay from Eric Raymond:

http://www.catb.org/~esr/faqs/smart-questions.html


Well....You don't HAVE to answer me. This is a public space :)  In addition, I didn't have a theory. I just realized that after the following emails. If I would had a theory I would wrote it completely. Anyway, thanks for the help it helped me to understood.
 
Kind regards,

Mariano

Cheers,
 - Andreas




Reply | Threaded
Open this post in threaded view
|

Re: What are MethodDictionary faults?

Andreas.Raab
Mariano Martinez Peck wrote:

>     That's correct. Small meta note: I don't like playing "20 questions"
>     very much. If you have a theory or want to verify something it's
>     better to post your theory and have people comment on it. Posting
>     one question to get a yes/no, then posting another one to get a
>     yes/no tires me very quickly :-) See also the always appropriate
>     essay from Eric Raymond:
>
>     http://www.catb.org/~esr/faqs/smart-questions.html
>     <http://www.catb.org/%7Eesr/faqs/smart-questions.html>
>
>
> Well....You don't HAVE to answer me. This is a public space :)

Sure. And I'll ignore you as a repeat offender in the future :-) But it
was a good opportunity to drop in a link to ESR's essay  and hopefully
some people will click on it and ask better questions as a result.

Cheers,
   - Andreas

> In addition, I didn't have a theory. I just realized that after the
> following emails. If I would had a theory I would wrote it completely.
> Anyway, thanks for the help it helped me to understood.
>  
> Kind regards,
>
> Mariano
>
>     Cheers,
>      - Andreas
>
>
>
> ------------------------------------------------------------------------
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Re: What are MethodDictionary faults?

Mariano Martinez Peck


On Wed, Dec 23, 2009 at 4:00 PM, Andreas Raab <[hidden email]> wrote:
Mariano Martinez Peck wrote:
   That's correct. Small meta note: I don't like playing "20 questions"
   very much. If you have a theory or want to verify something it's
   better to post your theory and have people comment on it. Posting
   one question to get a yes/no, then posting another one to get a
   yes/no tires me very quickly :-) See also the always appropriate
   essay from Eric Raymond:

   http://www.catb.org/~esr/faqs/smart-questions.html
   <http://www.catb.org/%7Eesr/faqs/smart-questions.html>



Well....You don't HAVE to answer me. This is a public space :)

Sure. And I'll ignore you as a repeat offender in the future :-)

ok...
 
But it was a good opportunity to drop in a link to ESR's essay  and hopefully some people will click on it and ask better questions as a result.


Yes, it seems a good link. I started to reading it but it is too long so I keep it so that I can read it when I have more time.
 
Cheers,
 - Andreas

In addition, I didn't have a theory. I just realized that after the following emails. If I would had a theory I would wrote it completely. Anyway, thanks for the help it helped me to understood.
 Kind regards,

Mariano

   Cheers,
    - Andreas



------------------------------------------------------------------------