[Squeak5.2][ProjectLoading][Documentation] ImageSegment comeFullyUpOnReload: smartRefStream

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

[Squeak5.2][ProjectLoading][Documentation] ImageSegment comeFullyUpOnReload: smartRefStream

Hannes Hirzel
Hello

Each Object  implements the message

     comeFullyUpOnReload

that means activities which have to be done after the object has been
reloaded from a file or stream.

The default is to do nothing.


     Object
     comeFullyUpOnReload: smartRefStream
           "Normally this read-in object is exactly what we want to store. 7/26/96 tk"

           ^ self

http://wiki.squeak.org/squeak/1280


But ImageSegment objects use a specialized method which hdoes a lot

http://wiki.squeak.org/squeak/1281
ImageSegment comeFullyUpOnReload: smartRefStream


The method comment of ImageSegment comeFullyUpOnReload: smartRefStream
-------------------------------------------------------------------------------------------------------------
comeFullyUpOnReload: smartRefStream
        "fix up the objects in the segment that changed size.  An object in
the segment is the wrong size for the modern version of the class.
Construct a fake class that is the old size.  Replace the modern class
with the old one in outPointers.  Load the segment. Traverse the
instances, making new instances by copying fields, and running
conversion messages.  Keep the new instances.  Bulk forward become the
old to the new.  Let go of the fake objects and classes.
        After the install (below), arrayOfRoots is filled in. Globalize new
classes.  Caller may want to do some special install on certain
objects in arrayOfRoots.
        May want to write the segment out to disk in its new form."
-------------------------------------------------------------------------------------------------------------

Interestingly if you add returns and spaces and number we have a
pretty nice description of the algorithm


The same this time with returns and empty lines
-------------------------------------------------------------------------------------------------------------

        "fix up the objects in the segment that changed size.
         An object in the segment is the wrong size for the modern
version of the class.

         1. Construct a fake class that is the old size.

         2. Replace the modern class with the old one in outPointers.

         3. Load the segment.

         4. Traverse the instances,
               making new instances by copying fields,
               and running conversion messages.

         5. Keep the new instances.

         6. Bulk forward become the old to the new.

         7. Let go of the fake objects and classes.
       
         8. After the install (below), arrayOfRoots is filled in.

         9. Globalize new classes.

         10. Caller may want to do some special install on certain
objects in arrayOfRoots.
       
         11. May want to write the segment out to disk in its new form."
-------------------------------------------------------------------------------------------------------------

The method is difficult to understand and I assume this is where
Trygve Reenskaug would say that we need a CONTEXT and an INTERACTION
object.....

Note: DiskProxy also implements has also a complex implementation of
comeFullyUpOnReload

Regards
Hannes