[Q] How do I reset a MethodContext? (was: [MAGMA] Image Grow [PIM]
[DANGEROUS?])
Chris Muller
afunkyobject at yahoo.com
Tue Oct 21 21:39:41 UTC 2003
I'm glad you found a work-around. As you said, this is a crude solution that I
don't think is suitable for Magma. We need to find a "correct" solution.
To do that, though, I need to understand the nature of BlockContexts and
MethodContexts and how and when their receiver gets set. I imagine, when the
block is executed, slots that were allocated at compile time to hold certain
external references are populated. That's why, without true BC's, we can't
execute a Block more than once at a time (because the variables would get
overlayed with the second execution).
So this will probably get fixed with VI4 / true BC's. When is that?
Until then, let's see if we can come up with a non-Magma example of the
problem, then maybe someone can help us out with it.
The three blocks in MagmaSession>>initializeSerializer appear to be the ones
retaining the state of their last execution. Let me know if you are able to
reproduce the problem simply in a pristine 3.6gamma. I'll see if I can too.
Regards,
Chris
--- Giovanni Giorgi <jj at objectsroot.com> wrote:
> Hi Chris!
> I have done a simple method to purge magma session.
>
> Chris Muller wrote:
> [...]
>
> >Also, unfortunately, there is a known bug I haven't been able to figure out.
> I
> >think it might be a Squeak limitation but I'm not sure. If you are familiar
> >with the mechanics of MethodContexts and BlockContexts, perhaps you will
> have
> >an easy answer! First, this simple script demonstrates the problem:
> >
> >
> Hem....I am not so strong in MethodContexts ;(
>
> >[...]
> >Do you or anyone else know how to get hold of these MethodContexts
> >programmatically? If so, I can put this clean-up as part of the disconnect.
> >
> >I'm sorry this problem has affected you, I hope we can find a solution.
> >
> >
> Do not worry. I will find a solution ;) with my....personal way... ;)
> [gio si prying the Squeak Gods....
> Alan&Dan Can we help us?!?!?]
>
> I have done a small method:
> ====================================
> purgeMagmaSessions
> | ms |
> "PIMDB purgeMagmaSessions"
> ms _ MagmaSession allInstances.
> Transcript cr; show: ms size asString.
> "First Step:"
> ms do: [ : each | each become: String new ].
> "Second strong step:"
> ms _ MagmaSession allInstances.
> ms
> do: [:elem | elem isConnected
> ifFalse: [| objList |
> objList _ Smalltalk pointersTo: elem.
> objList
> do: [:mc | mc class == MethodContext
> ifTrue: [ mc receiver: nil. Transcript
> show:'#'.]
> ifFalse: [ "Transcript cr; show:
> 'Excluding:' , mc asString"]]]].
> Smalltalk garbageCollect.
> Transcript cr; show: ms size asString.
> ====================================
> This method is very very crude and can lead problems because uses a very
> simple idea to work.
> My image started with 114 magma sessions and ended up with 0 sessions !!!
> You should wait a little and/or try it two times.
> Can you review it and incorporate in the next magma release?
>
> --
> [ [ [ JJ ] ] ] | First, they ignore you. Then they laugh
> | at you. Then they fight you. Then you win
> http://www.siforge.org | Mahatma Ghandi
>
>
More information about the Squeak-dev
mailing list
|