Archiving information from a plugin

David T. Lewis lewis at
Tue Nov 8 19:01:02 UTC 2005

On Tue, Nov 08, 2005 at 10:05:19AM -0800, Alan Sibley wrote:
> I hope this is the best mailing list for this question...

Actually, the general purpose list might have been better, but
this is fine too.

> I am writing a squeak plugin and have two questions.
> My plugin has internal objects that are modified by various primitives.
> I would like to archive this information from one run to the next.
> A) are squeak ids passed into my plugin ("oops")... are they
>    only good for the single execution of the primitive (can
>    I save these off in the plugin... and expect to see them
>    around later?... does garbage collection move these guys?).

No, the oops can and will change any time a garbage collection
occurs. They definitely will change when you save and restart your
image, but it's probably more important for you to know that they
also can change within your primitive at any time you call a function
that allocates a new object.

There is a special stack that is used to protect objects in this
case, see #pushRemappableOop: and #popRemappableOop and look
around at other plugins to find examples of how they are used.

> B) is there a prescribed way to archive information from a plugin
>    at "save image" time and later restore it at "load image" time?
>    My plugin can create an ascii string to store off state. I could
>    have a primitive save and restore the state... but how do I have these
>    primitives called. Is there an existing hook for something like this.

For one example of how you could do this, load OSProcessPlugin from
Squeak Map and look at the methods OSProcessPlugin>>stringFromCString:
and OSProcessPlugin>>primitiveVersionString.


More information about the Vm-dev mailing list