Perform majorShrink with no pointing device

Boris_Gaertner at msg.de Boris_Gaertner at msg.de
Mon Dec 10 14:25:25 UTC 2001


Mike Rutenberg wrote:

>>How do you use Smalltalk majorShrink in any case, 
>>since the top project in the standard image is a Morphic?
>>Is there some standard way of making a MVC project the head?

This is my proposal to make a MVC project the head:


1. Enter the top Project
2. Create a new mvc project
3. enter the mvc project that you created
4. Open a workspace and execute the following piece of code:


  | topProject this toBeDeleted |

 topProject := Project allProjects
                  detect: [:p | p isTopProject].

  this := Project current.
  topProject setParent: this.
  this setParent: this.
    "  to prepare a major shrink, you may with to delete all other 
projects: "
  toBeDeleted := Project allProjects reject: [:p | p == this].
  toBeDeleted do: [:p | Project deletingProject: p].


5. Execute "Project allProjects" with "inspect it"
   You should see one single project.



Second step: Preparation of a major shrink.

To do a major shrink on a computer without a pointing device
I tried this:

1. File in the attached changes set.
2. Open a workspace an execute the following statement:

        Smalltalk setStartUpActivity: #majorShrink.

3. Open the Transcript
4. Save the image and exit Smalltalk.
5. Start Smalltalk again.


A few words about the change set:
It  adds the Class variable StartUpActivity to the class
SystemDictionary.
It modifies the instance method snapshot:andQuit:embedded:
of class SystemDictionary. This is the method that is
entered when you restart Smalltalk.

The following passage is added: 


   < ... >
         StartUpActivity notNil
             ifTrue: [ | selector |
                        selector := StartUpActivity.
                        StartUpActivity := nil.
                        (self respondsTo: selector)
                           ifTrue: [self perform: selector]
                     ].

The value of StartUpActivity is expected to be either nil
or the name of a message that SystemDictionary understands.

This is very simple: When there is a startup activity, it is
executed at start up. To avoid repeated execution at every
startup, the variable StartUpActivity is also set to nil.

For your convenience, the following instance method
is added:


setStartUpActivity: aSymbol

  StartUpActivity := aSymbol

*****************************************************

My attempts to perform a major shrink with Squeak3.1beta-4478.changes
revealed a few serious problems: Among other things it was tried to
remove Class False! Reduction worked better when I added this
(in method majorShrink):
    [Smalltalk removeAllUnSentMessages > 0]
       whileTrue:
         [Smalltalk unusedClasses do:
             [:c |  (#(#False #True #Week 
                               #ReadOnlyVariableBinding
                               #UndefinedObject)
                         includes: c)
                       ifFalse: [(Smalltalk at: c) removeFromSystem]].
    ].


The next attempt revealed that method removal loops for ever:
The last 38 method to be removed are retrieved again and again.

To overcome this I changed the Smalltalk removeAllUnSentMessages > 0
to Smalltalk removeAllUnSentMessages > 38 and could finally create a
1.9 MBytes image with 721 classes. The image size is twice the sice of
a reduced image of Squeak 2.7. The new image contains a lot of obsolete
classes (more than 200!) That is really a surprise


When started, that image ran into an error: The message
fetchExternalSettingsIn: was sent to the removed class
ServerDirectory.
That error happened in ExternalSettings>>startUp.
One should perhaps simply remove that call of fetchExternalSettingsIn:.



A lot of other activities caused errors, too:
*Open an mvc projects (there are no projects in a reduced image)
*Selecting "browse hierarchy" from a class hierarchy browser
  (class HierarchyBrowser was removed, but Browser>>spawnHierarchy
  has a reference to it.).

I think these problems are well-known, but if you really want to
perform a major shrink, you will have to solve a few problems
first.

Cheers Boris




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20011210/c8edbbb7/attachment.htm


More information about the Squeak-dev mailing list