[HACK] #majorShrink updates to create mini Squeak for 2.7

JArchibald at aol.com JArchibald at aol.com
Sun Jan 9 05:40:41 UTC 2000


All--

In the most recent releases of Squeak, I have encountered problems in running 
#majorShrink, the mechanism to create a mini version. One problem is that the 
source of record for version and change information is supplied by classes 
which are deleted by the shrinking process (eg, EToy). Some more vital 
class(es) should be chosen as residence for this information. Also, the 
recent substantial rearrangement of the system organization leaves many 
pieces which are not removed by #majorShrink.

Attached is a fileIn which will create a mini Squeak of 916K (Mac PPC) for 
the 2.7 distribution. This is not quite as tight as the 864K which I was 
getting with 2.6, but a lot of new stuff has been added. It is no way 
definitive; it is just a hack to get a small image corresponding to 
#majorShrink of version 2.4 or thereabouts. Those who know can perhaps 
identify many additional things that can (or should) be removed. Perhaps I 
have removed too much. I would appreciate receiving notice of anything 
fitting either of these categories.

For those who have not used #majorShrink before:- 
(1) start with the distributed 2.7 system
(2) close all windows
(3) fileIn this change set
(4) execute the expression in the comment at the head of 
SystemDictionary>>majorShrink
    "Smalltalk majorShrink; abandonSources; lastRemoval"
(5) answer 'yes' to all prompts
(6) save the resulting image
[BTW, on Windows'95, you must save image to a new name to get a small image. 
Somehow just saving it (to original name) doesn't reclaim the disk space, and 
you end up with an image file the same size as the original (even though 
'most of it' is not there). Another sWindles'xx feature (I haven't tried it 
on Win'98, though). Anyone know anything about this?]

I always thought it was nice to have a demo system (when you needed it) in 
your pocket on a floppy. After all, Smalltalk should occasionally be 'small'. 
The mini Squeak system does fit on a floppy (VM included).

Cheers,
Jerry.
-------------- next part --------------
'From Squeak2.7 of 5 January 2000 [latest update: #1762] on 8 January 2000 at 10:48:14 pm'!

!SystemDictionary methodsFor: 'shrinking' stamp: 'jla 1/8/2000 22:20'!
discardFor2Point7
	"Discard additional classes"
"2.7"
	SystemOrganization removeCategoriesMatching: 'VMConstruction-*'.
	SystemOrganization removeCategoriesMatching: 'Speech-*'.
	SystemOrganization removeCategoriesMatching: 'Sound-*'.
	SystemOrganization removeCategoriesMatching: 'Balloon3D-*'.
	SystemOrganization removeSystemCategory: 'ST80-Morphic'.
	SystemOrganization removeSystemCategory: 'Tools-File Contents Browser'.
	SystemOrganization removeSystemCategory: 'System-Digital Signatures'.
	Smalltalk removeClassNamed: #ProjectController.
	Smalltalk removeClassNamed: #ProjectView.
	Smalltalk removeClassNamed: #Project.
	Smalltalk removeClassNamed: #Environment.
"2.6"
	Smalltalk removeClassNamed: #Component1.
	SystemOrganization removeSystemCategory: 'Squeak-TestPlugins'.
	SystemOrganization removeSystemCategory: 'Squeak-Applescript'.
	SystemOrganization removeSystemCategory: 'VRML-BaseNodes'.
	SystemOrganization removeSystemCategory: 'VRML-Definition'.! !

!SystemDictionary methodsFor: 'shrinking' stamp: 'jla 1/8/2000 22:20'!
majorShrink    "Smalltalk majorShrink; abandonSources; lastRemoval"
	"This method throws out lots of the system that is not needed for, eg, operation in a hand-held PC.  Currently, since it discards Morphic, majorShrink must be run in an MVC project.  Moreover, since it throws out projects, it shouod be run in the top (and only) project.  majorShrink altogether saves about 5,620k in Squeak 2.4"

"First delete all the PlayWithMe windows and projects, and the class Component1"

	Wonderland removeActorPrototypesFromSystem.
	Player freeUnreferencedSubclasses.
	MorphicModel removeUninstantiatedModels.
	Utilities classPool at: #ScrapsBook put: nil.
"==>"	Smalltalk discardFor2Point7.
	Smalltalk discardVMConstruction.  "666k"
	Smalltalk discardSoundSynthesis.  "358k"
	Smalltalk discardOddsAndEnds.  "158k"
	Smalltalk discardNetworking.  "243k"
	Smalltalk discardMorphic.  "2,494k"
	Symbol rehash.  "40k"
	"Above by itself saves about 3,960k"

"
	| a | a _ Smalltalk garbageCollect.
	Smalltalk majorShrink.
	Smalltalk garbageCollect - a
"
	"Remove references to a few classes to be deleted, so that they won't leave obsolete versions around."
	FileList removeSelector: #fileIntoNewChangeSet.
	ChangeSet class compile: 'defaultName
		^ ''Changes'' ' classified: 'initialization'.
	ScreenController removeSelector: #openChangeManager.
	ScreenController removeSelector: #exitProject.
	ScreenController removeSelector: #openProject.
	ScreenController removeSelector: #viewImageImports.

	"Now delete lots of classes.."
	SystemOrganization removeSystemCategory: 'Graphics-Symbols'.
	SystemOrganization removeSystemCategory: 'Graphics-Files'.
	SystemOrganization removeSystemCategory: 'Interface-Projects'.
	SystemOrganization removeSystemCategory: 'System-Object Storage'.

	Smalltalk removeClassNamed: #FormSetFont.
	Smalltalk removeClassNamed: #FontSet.
	Smalltalk removeClassNamed: #InstructionPrinter.
	Smalltalk removeClassNamed: #ChangeSorter.
	Smalltalk removeClassNamed: #DualChangeSorter.
	Smalltalk removeClassNamed: #EmphasizedMenu.
	Smalltalk removeClassNamed: #MessageTally.

	StringHolder class removeSelector: #originalWorkspaceContents.
	CompiledMethod removeSelector: #symbolic.

	RemoteString removeSelector: #makeNewTextAttVersion.
	Utilities class removeSelector: #absorbUpdatesFromServer.
	Smalltalk removeClassNamed: #PenPointRecorder.
	Smalltalk removeClassNamed: #Path.
	Smalltalk removeClassNamed: #Base64MimeConverter.
	Smalltalk removeClassNamed: #EToySystem.
	Smalltalk removeClassNamed: #RWBinaryOrTextStream.
	Smalltalk removeClassNamed: #AttributedTextStream.
	Smalltalk removeClassNamed: #CornerRounder.
	Smalltalk removeClassNamed: #WordNet.
	Smalltalk removeClassNamed: #SelectorBrowser.

	TextStyle allSubInstancesDo:
		[:ts | ts newFontArray: (ts fontArray copyFrom: 1 to: (2 min: ts fontArray size))].
	ListParagraph initialize.
	PopUpMenu initialize.
	StandardSystemView initialize.

	Smalltalk noChanges.
	ChangeSorter classPool at: #AllChangeSets 
		put: (OrderedCollection with: Smalltalk changes).
	ScriptingSystem _ nil.
	SystemDictionary removeSelector: #majorShrink.

	[Smalltalk removeAllUnSentMessages > 0]
		whileTrue:
		[Smalltalk unusedClasses do: [:c | (Smalltalk at: c) removeFromSystem]].
	SystemOrganization removeEmptyCategories.
	Smalltalk allClassesDo: [:c | c zapOrganization].
	Symbol rehash.! !

!SystemDictionary methodsFor: 'sources, change log' stamp: 'jla 1/8/2000 03:07'!
lastUpdateString
	"Smalltalk lastUpdateString"
	| aNumber |
	aNumber _ "ChangeSorter highestNumberedChangeSet" 1762.
	^ (aNumber notNil and: [aNumber > 0])
		ifTrue:
			['latest update: #', aNumber printString]
		ifFalse:
			['No updates present.']! !

!SystemDictionary methodsFor: 'sources, change log' stamp: 'jla 1/8/2000 03:02'!
version
	"Answer the version of this release."

	^ "EToySystem version" 'Squeak2.7' , ' of ' , "EToySystem versionDate" '5 January 2000'! !




More information about the Squeak-dev mailing list