On Wed, Dec 23, 2009 at 2:16 PM, Stéphane Ducasse <[email protected]
> wrote:

> > 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 ???
>
> VM code put it to nil.
> The idea is that the methodDict is stored in the class or method cat
> and nil is put in place of the methodDict.
>
> Then when the VM detects that the methodDict is nil then it copies the
> methodDict stored into the category
> This way you know which class has been used during your interaction.
>
> We tried to use it with mathieu but we often got all the classes back on
> place.
> And it crashed a lot :)
>
>
Thanks Stef. After a discussion with Andreas in Squeak-dev mailing list, I
wanted to ask you too.

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, through the message induceMDFault ?   If
it is always through induceMDFault   the only sender is to discover used
classes with ImageSegment.  So...it is used ONLY in that?

The possibility of using #instVarAt:put: accidentally is rejected 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.

thanks

Mariano

ps: yes, I am thinking in clean up all this class discovery to another place
than ImageSegment what I wonder if those messages for MD faults should be
put off too.



> Stef
>
> >
> > Thank you very much.
> >
> > Marian
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [email protected]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to