# HG changeset patch # User Stefan Vogel # Date 1161714462 -7200 # Node ID a3f6265978ad444cf36016fdf9bb0baca05e791b # Parent 87c242cb7475c4f739ecd8261d1444f55a6fa0a4 Start bachgroundCollector and -Finalizer in mainStartup diff -r 87c242cb7475 -r a3f6265978ad Smalltalk.st --- a/Smalltalk.st Tue Oct 24 20:20:51 2006 +0200 +++ b/Smalltalk.st Tue Oct 24 20:27:42 2006 +0200 @@ -9,6 +9,8 @@ other person. No title to or ownership of the software is hereby transferred. " +'From Smalltalk/X, Version:5.3.2 on 24-10-2006 at 20:21:17' ! + "{ Package: 'stx:libbasic' }" Object subclass:#Smalltalk @@ -911,6 +913,52 @@ "Created: 20.6.1997 / 16:58:28 / cg" ! ! +!Smalltalk class methodsFor:'binary storage'! + +addGlobalsForBinaryStorageTo:globalDictionary + |pools| + + pools := Set new. + + self keysAndValuesDo:[:key :value | + (key includes:$:) ifFalse:[ "/ skip classVars + (value ~~ self + and:[value notNil]) ifTrue:[ + value isClass ifTrue:[ + value addGlobalsForBinaryStorageTo:globalDictionary. + pools addAll:value sharedPools + ] ifFalse:[ + globalDictionary at:(key->value) put:self + ]. + value notNil ifTrue:[ + globalDictionary at:value put:self + ] + ] + ] + ]. + + pools do:[:poolDictionary| + poolDictionary addGlobalsForBinaryStorageTo:globalDictionary + ] + + "Modified: 19.3.1997 / 18:15:25 / cg" + "Created: 21.3.1997 / 15:40:31 / cg" +! + +storeBinaryDefinitionOf:anObject on:stream manager:manager + |string| + + anObject class == Association ifTrue:[ + string := 'Smalltalk associationAt: ', anObject key storeString + ] ifFalse: [ + string := 'Smalltalk at: ', (self keyAtValue: anObject) storeString + ]. + stream nextNumber:2 put:string size. + stream nextPutBytes:(string size) from:string startingAt:1. +"/ string do:[:char | stream nextPut:char asciiValue] + + "Modified: 19.3.1997 / 18:49:14 / cg" +! ! !Smalltalk class methodsFor:'browsing'! @@ -1853,6 +1901,15 @@ ] ! ! +!Smalltalk class methodsFor:'inspecting'! + +inspectorClass + "{ Pragma: +optSpace }" + + "redefined to launch a DictionaryInspector (instead of the default Inspector)." + + ^ DictionaryInspectorView +! ! !Smalltalk class methodsFor:'message control'! @@ -2678,22 +2735,22 @@ if there is a display, start its event dispatcher " Display notNil ifTrue:[ - Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | - SaveEmergencyImage == true ifTrue:[ - 'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. - ObjectMemory primSnapShotOn:'crash.img'. - ]. - 'Display [warning]: broken display connection - exit.' infoPrintCR. - self exit. - ]. - Display startDispatch. + Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | + SaveEmergencyImage == true ifTrue:[ + 'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. + ObjectMemory primSnapShotOn:'crash.img'. + ]. + 'Display [warning]: broken display connection - exit.' infoPrintCR. + self exit. + ]. + Display startDispatch. ]. idx := CommandLineArguments indexOf:'--browserWindow:'. IsPlugin := (idx ~~ 0). IsPlugin ifTrue:[ - self browserWindowStartup. - "/ not reached + self browserWindowStartup. + "/ not reached ]. Initializing := false. @@ -2704,50 +2761,50 @@ "/ Therefore, it is now done by an extra user-process. process := [ - StartBlocks notNil ifTrue:[ - StartBlocks do:[:aBlock| - aBlock value - ]. - StartBlocks := nil. - ]. - ImageStartBlocks notNil ifTrue:[ - ImageStartBlocks do:[:aBlock| - aBlock value - ]. - ]. - StandAlone ifFalse:[ - (SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" - thisIsARestart ifTrue:[ - Transcript cr. - Transcript showCR:('Smalltalk restarted from:' - , imageName - , ' (saved ' - , ObjectMemory imageSaveTime printString - , ')' ). - ] ifFalse:[ - Transcript showCR:(self hello). - Transcript showCR:(self copyrightString). - Transcript cr. - ]. - Transcript cr. - ]. - - DemoMode==true ifTrue:[ - Transcript showCR:'*** Restricted use: ***'. - Transcript showCR:'*** This program may be used for education only. ***'. - Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. - Transcript showCR:'*** for more details. ***'. - Transcript cr. - ]. - ]. - - thisIsARestart ifTrue:[ - "/ - "/ the final late notification - users can now assume that - "/ views, forms etc. have been recreated. - - ObjectMemory changed:#returnFromSnapshot. - ] + StartBlocks notNil ifTrue:[ + StartBlocks do:[:aBlock| + aBlock value + ]. + StartBlocks := nil. + ]. + ImageStartBlocks notNil ifTrue:[ + ImageStartBlocks do:[:aBlock| + aBlock value + ]. + ]. + StandAlone ifFalse:[ + (SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" + thisIsARestart ifTrue:[ + Transcript cr. + Transcript showCR:('Smalltalk restarted from:' + , imageName + , ' (saved ' + , ObjectMemory imageSaveTime printString + , ')' ). + ] ifFalse:[ + Transcript showCR:(self hello). + Transcript showCR:(self copyrightString). + Transcript cr. + ]. + Transcript cr. + ]. + + DemoMode==true ifTrue:[ + Transcript showCR:'*** Restricted use: ***'. + Transcript showCR:'*** This program may be used for education only. ***'. + Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. + Transcript showCR:'*** for more details. ***'. + Transcript cr. + ]. + ]. + + thisIsARestart ifTrue:[ + "/ + "/ the final late notification - users can now assume that + "/ views, forms etc. have been recreated. + + ObjectMemory changed:#returnFromSnapshot. + ] ] newProcess. @@ -2757,65 +2814,67 @@ process resume. process := nil. + ObjectMemory startBackgroundCollectorAt:5. + ObjectMemory startBackgroundFinalizationAt:5. "/ start a process, which evaluates the startupClass>>startupSelector "/ message. (StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ - " - allow more customization by reading an image specific rc-file - " - thisIsARestart ifTrue:[ - (imageName asFilename hasSuffix:'img') ifTrue:[ - imageName := imageName copyWithoutLast:4 - ]. - self fileIn:(imageName , '.rc') - ]. + " + allow more customization by reading an image specific rc-file + " + thisIsARestart ifTrue:[ + (imageName asFilename hasSuffix:'img') ifTrue:[ + imageName := imageName copyWithoutLast:4 + ]. + self fileIn:(imageName , '.rc') + ]. "/ Display notNil ifTrue:[ "/ Display exitOnLastClose:true. "/ ]. "/ Processor exitWhenNoMoreUserProcesses:true. - process := [ - StandAlone ifTrue:[ - AbortOperationRequest handle:[:ex | - 'Smalltalk [info]: aborted - exit.' infoPrintCR. - OperatingSystem exit:1 - ] do:[ - StartupClass perform:StartupSelector withArguments:StartupArguments. - ] - ] ifFalse:[ - StartupClass perform:StartupSelector withArguments:StartupArguments. - ]. - - "/ - "/ non-GUI apps exit after the startup; - "/ assume that GUI apps have created & opened some view ... - "/ - Display isNil ifTrue:[ - 'Smalltalk [info]: no Display - exit.' infoPrintCR. - Smalltalk exit. - ]. - "/ - "/ GUI apps exit after the last user process has finished - "/ - Display exitOnLastClose:true. - Processor exitWhenNoMoreUserProcesses:true. - ] newProcess. - process priority:(Processor userSchedulingPriority). - process name:'main'. - process beGroupLeader. - process resume. - process := true. "do not refer to process" + process := [ + StandAlone ifTrue:[ + AbortOperationRequest handle:[:ex | + 'Smalltalk [info]: aborted - exit.' infoPrintCR. + OperatingSystem exit:1 + ] do:[ + StartupClass perform:StartupSelector withArguments:StartupArguments. + ] + ] ifFalse:[ + StartupClass perform:StartupSelector withArguments:StartupArguments. + ]. + + "/ + "/ non-GUI apps exit after the startup; + "/ assume that GUI apps have created & opened some view ... + "/ + Display isNil ifTrue:[ + 'Smalltalk [info]: no Display - exit.' infoPrintCR. + Smalltalk exit. + ]. + "/ + "/ GUI apps exit after the last user process has finished + "/ + Display exitOnLastClose:true. + Processor exitWhenNoMoreUserProcesses:true. + ] newProcess. + process priority:(Processor userSchedulingPriority). + process name:'main'. + process beGroupLeader. + process resume. + process := true. "do not refer to process" ]. StandAlone ifTrue:[ - Display notNil ifTrue:[ - FlyByHelp notNil ifTrue:[ - FlyByHelp start - ]. - ]. + Display notNil ifTrue:[ + FlyByHelp notNil ifTrue:[ + FlyByHelp start + ]. + ]. ]. " @@ -2825,11 +2884,11 @@ ((Display notNil and:[graphicalMode]) or:[process notNil or:[HeadlessOperation]]) ifTrue:[ - Processor dispatchLoop. + Processor dispatchLoop. ] ifFalse:[ - StandAlone ifFalse:[ - self readEvalPrint - ] + StandAlone ifFalse:[ + self readEvalPrint + ] ]. "done - the last process finished" @@ -6886,5 +6945,5 @@ !Smalltalk class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.774 2006-10-24 07:50:11 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.775 2006-10-24 18:27:42 stefan Exp $' ! !