smalltalk.rc
changeset 686 1e48a0068d34
parent 680 d327b2c1b486
child 687 2909ff03ad8b
equal deleted inserted replaced
685:e615c43bc12a 686:1e48a0068d34
   318     Smalltalk exit
   318     Smalltalk exit
   319 ].
   319 ].
   320 !
   320 !
   321 
   321 
   322 "/
   322 "/
       
   323 "/ Memory settings. NOTE that all these settings may be overwritten by
       
   324 "/                  settings.stx which stores the Launcher's settings.
       
   325 
       
   326 "/
   323 "/ this starts the incremental GC earlier
   327 "/ this starts the incremental GC earlier
   324 "/ (default is 500000)
   328 "/ (default is 500000)
   325 "/ the number given is the number of bytes which have to be allocated
   329 "/ the number given is the number of bytes which have to be allocated
   326 "/ since the last GC, to start the incremental GC running.
   330 "/ since the last GC, to start the incremental GC running.
   327 "/ (see ObjectMemory>>documentation)
   331 "/ (see ObjectMemory>>documentation)
   388 "/ another experimental (and a secret for now, since I don't want
   392 "/ another experimental (and a secret for now, since I don't want
   389 "/ you to play with those ;-)
   393 "/ you to play with those ;-)
   390 "/ For now, this is experimental. Once the best numbers
   394 "/ For now, this is experimental. Once the best numbers
   391 "/ have been found, I'll hardwire them and document it ...
   395 "/ have been found, I'll hardwire them and document it ...
   392 
   396 
   393 |a needToReactivate|
   397 |tenureParams|
   394 
   398 
   395 ObjectMemory newSpaceSize > (500*1024) ifTrue:[
   399 ObjectMemory newSpaceSize > (500*1024) ifTrue:[
   396     a := #(nil nil nil nil -16 -4 -2 -2 0 0 16 nil) copy.
   400     tenureParams := #(nil nil nil nil -16 -4 -2 -2 0 0 16 nil) copy.
   397 ] ifFalse:[
   401 ] ifFalse:[
   398 "/         min max cpy /32 /16 /8 /4 /2 /4 /8 /16 /32 "
   402 "/         min max cpy /32 /16 /8 /4 /2 /4 /8 /16 /32 "
   399     "/
   403     "/
   400     "/ slow tenure - keeps objects longer in newSpace,
   404     "/ slow tenure - keeps objects longer in newSpace,
   401     "/  producing more scavenge overhead, but releasing IGC somewhat
   405     "/  producing more scavenge overhead, but releasing IGC somewhat
   402     "/
   406     "/
   403 "/  a := #(nil nil nil -100 -8 -4 -1  1 2  4  8   16 nil) copy.
   407 "/  tenureParams := #(nil nil nil -100 -8 -4 -1  1  2 4 8 16 nil) copy.
   404 "/  a := #(nil nil nil nil -16 -4  0  0  0 4 16 nil) copy.
   408 "/  tenureParams := #(nil nil nil nil -16 -4  0  0  0 4 16 nil) copy.
   405 
   409 
   406     "fast tenure"
       
   407     "/
   410     "/
   408     "/ fast tenure - moves objects earlier into oldSpace,
   411     "/ fast tenure - moves objects earlier into oldSpace,
   409     "/ releasing newSpace collector; however, the oldSpace IGC
   412     "/ releasing newSpace collector; however, the oldSpace IGC
   410     "/ may have more work to do.
   413     "/ may have more work to do.
   411     "/
   414     "/
   412     a := #(nil nil nil nil -20 -8 -3 -1 -1 1 16 nil) copy.
   415     tenureParams := #(nil nil nil nil -20 -8 -3 -1 -1 1 16 nil) copy.
   413 ].
   416 ].
   414 ObjectMemory tenureParameters:a.
   417 ObjectMemory tenureParameters:tenureParams.
   415 !
   418 !
   416 
   419 
   417 "/
   420 "/
   418 "/ this defines stuff relating to the host we are running on
   421 "/ this defines stuff relating to the host we are running on
   419 "/
   422 "/
   447 "/      - disable the code below,
   450 "/      - disable the code below,
   448 "/      - or start stx with a suppress argument.
   451 "/      - or start stx with a suppress argument.
   449 "/
   452 "/
   450 
   453 
   451 (Smalltalk isStandAloneApp not
   454 (Smalltalk isStandAloneApp not
   452 and:[Smalltalk isPlugin not
   455  and:[Smalltalk isPlugin not
   453 and:[Display notNil
   456  and:[Display notNil
   454 ]]) ifTrue:[
   457 ]]) ifTrue:[
   455     ((Smalltalk commandLineArguments includes:'--noLicenceBox')
   458     ((Smalltalk commandLineArguments includes:'--noLicenceBox')
   456      or:[(Smalltalk commandLineArguments includes:'--quick')
   459      or:[(Smalltalk commandLineArguments includes:'--quick')
   457      or:[(Smalltalk commandLineArguments includes:'--faststart')
   460      or:[(Smalltalk commandLineArguments includes:'--faststart')
   458      or:[(Smalltalk commandLineArguments includes:'--fastStart')
   461      or:[(Smalltalk commandLineArguments includes:'--fastStart')
   465 	    ] do:[
   468 	    ] do:[
   466 		(LicenceBox open) ifFalse:[
   469 		(LicenceBox open) ifFalse:[
   467 		    'smalltalk.rc [info]: licence conditions not accepted.' infoPrintCR.
   470 		    'smalltalk.rc [info]: licence conditions not accepted.' infoPrintCR.
   468 		    Smalltalk exit
   471 		    Smalltalk exit
   469 		].
   472 		].
   470 		Smalltalk at:#LicenceBox put:nil.
   473 		Smalltalk removeClass:LicenceBox.
   471 	    ].
   474 	    ].
   472 	]
   475 	]
   473     ]
   476     ]
   474 ].
   477 ].
   475 !
   478 !
   520 "/
   523 "/
   521 Smalltalk at:#Double put:Float.
   524 Smalltalk at:#Double put:Float.
   522 
   525 
   523 Smalltalk at:#Browser put:SystemBrowser.
   526 Smalltalk at:#Browser put:SystemBrowser.
   524 !
   527 !
       
   528 |file|
   525 
   529 
   526 "/
   530 "/
   527 "/ read private (per user) stuff
   531 "/ read private (per user) stuff
   528 "/
   532 "/
   529 (Smalltalk commandLine includes:'-F') ifTrue:[
   533 (Smalltalk commandLine includes:'-F') ifTrue:[
   530     |idx file|
   534     |idx file|
   531 
   535 
   532     idx := Smalltalk commandLine indexOf:'-F'.
   536     idx := Smalltalk commandLine indexOf:'-F'.
   533     file := Smalltalk commandLine at:idx + 1.
   537     file := Smalltalk commandLine at:idx + 1.
   534     ('smalltalk.rc [info]: reading ''' , file , '''...') infoPrintCR.
       
   535     Smalltalk fileIn:file.
       
   536 ] ifFalse:[
   538 ] ifFalse:[
   537     'smalltalk.rc [info]: reading ''private.rc''...' infoPrintCR.
   539     file := 'private.rc'.
   538     Smalltalk fileIn:'private.rc'.
   540 ].
   539 ].
   541 ('smalltalk.rc [info]: reading ''' , file , '''...') infoPrintCR.
       
   542 Smalltalk fileIn:file.
   540 
   543 
   541 Screen notNil ifTrue:[
   544 Screen notNil ifTrue:[
   542     "/
   545     "/
   543     "/ read saved configuration settings (if any)
   546     "/ read saved configuration settings (if any)
   544     "/
   547     "/
   545     "/ 'smalltalk.rc [info]: reading ''settings.stx''...' infoPrintCR.
   548     "/ 'smalltalk.rc [info]: reading ''settings.stx''...' infoPrintCR.
   546     Object abortSignal handle:[:ex |
   549     AbortOperationRequest handle:[:ex |
   547 	ex return
   550 	ex return
   548     ] do:[
   551     ] do:[
   549 	(Smalltalk fileIn:'settings.stx') ifTrue:[
   552 	(Smalltalk fileIn:'settings.stx') ifTrue:[
   550 	    'smalltalk.rc [info]: loaded preferences from ''settings.stx''' infoPrintCR.
   553 	    'smalltalk.rc [info]: loaded preferences from ''settings.stx''' infoPrintCR.
   551 	]
   554 	]
   586 "/        '***** I will use a plain b&w viewStyle as a fallBack' errorPrintCR.
   589 "/        '***** I will use a plain b&w viewStyle as a fallBack' errorPrintCR.
   587 "/        anyWrong := true.
   590 "/        anyWrong := true.
   588 "/        missing := missing , '''resources'' '.
   591 "/        missing := missing , '''resources'' '.
   589 "/    ].
   592 "/    ].
   590 
   593 
   591     (Smalltalk getPackageFileName:'stx/libbasic/source/Object.st') isNil ifTrue:[
   594     (Smalltalk getPackageFileName:'stx/libbasic/source/Object.st') isNil and:[
   592      (Smalltalk getSystemFileName:'source/Object.st') isNil ifTrue:[
   595 	(Smalltalk getPackageFileName:'stx/libbasic/Object.st') isNil and:[
   593       (Smalltalk getSystemFileName:'source/source.zip') isNil ifTrue:[
   596 	(Smalltalk getSystemFileName:'source/Object.st') isNil and:[
   594 	(Smalltalk getSystemFileName:'source/libbasic.zip') isNil ifTrue:[
   597 	(Smalltalk getSystemFileName:'source/source.zip') isNil and:[
   595 	  (Smalltalk getSourceFileName:'libbasic/Object.st') isNil ifTrue:[
   598 	(Smalltalk getSystemFileName:'source/libbasic.zip') isNil and:[
       
   599 	(Smalltalk getSourceFileName:'libbasic/Object.st') isNil and:[
   596 	    "/
   600 	    "/
   597 	    "/ there may still be a SourceCodeManager ...
   601 	    "/ there may still be a SourceCodeManager ...
   598 	    "/
   602 	    "/
   599 	    (Smalltalk at:#SourceCodeManager) isNil ifTrue:[
   603 	    (Smalltalk at:#SourceCodeManager) isNil ifTrue:[
   600 		'***********************************************************************' errorPrintCR.
   604 		'***********************************************************************' errorPrintCR.
   602 		'***** ' errorPrintCR.
   606 		'***** ' errorPrintCR.
   603 		'***** the browser/debugger may not be able to show sourcecode.' errorPrintCR.
   607 		'***** the browser/debugger may not be able to show sourcecode.' errorPrintCR.
   604 		'***** Also, autoloading may fail if sourceFiles are missing.' errorPrintCR.
   608 		'***** Also, autoloading may fail if sourceFiles are missing.' errorPrintCR.
   605 		anyWrong := true.
   609 		anyWrong := true.
   606 		missing := missing , '''source'' '.
   610 		missing := missing , '''source'' '.
   607 	    ]
   611     ]]]]]]].
   608 	  ]
       
   609 	]
       
   610       ]
       
   611      ]
       
   612     ].
       
   613 
   612 
   614 "/
   613 "/
   615 "/ no longer needed - if we have the package,
   614 "/ no longer needed - if we have the package,
   616 "/ we also have the bitmaps ...
   615 "/ we also have the bitmaps ...
   617 "/
   616 "/
   656 "/
   655 "/
   657 "/ save an initial image; this will speedup the next startup
   656 "/ save an initial image; this will speedup the next startup
   658 "/ (since all autoload-stuff will already be initialized)
   657 "/ (since all autoload-stuff will already be initialized)
   659 "/
   658 "/
   660 ((Smalltalk commandLineArguments includes:'--quick')
   659 ((Smalltalk commandLineArguments includes:'--quick')
   661 or:[ (Smalltalk commandLineArguments includes:'--faststart')
   660  or:[(Smalltalk commandLineArguments includes:'--faststart')
   662 or:[ (Smalltalk commandLineArguments includes:'--fastStart')
   661  or:[(Smalltalk commandLineArguments includes:'--fastStart')
   663 or:[ (Smalltalk isPlugin)
   662  or:[(Smalltalk isPlugin)
   664 ]]]) ifFalse:[
   663 ]]]) ifFalse:[
   665     'st.img' asFilename exists ifFalse:[
   664     ('st.img' asFilename exists not and:['.' asFilename isWritable]) ifTrue:[
   666 	'.' asFilename isWritable ifTrue:[
   665 	|doneWithStartupStuff|
   667 	    |doneWithStartupStuff|
   666 
   668 
   667 	doneWithStartupStuff := Semaphore new.
   669 	    doneWithStartupStuff := Semaphore new.
   668 
   670 
   669 	Smalltalk addStartBlock:[
   671 	    Smalltalk
   670 	    [
   672 		addStartBlock:
   671 		doneWithStartupStuff wait.
   673 		[
   672 		   'smalltalk.rc [info]: saving initial image for faster future startup...' infoPrintCR.
   674 		    [
   673 		   ObjectMemory primSnapShotOn:'st.img'
   675 			doneWithStartupStuff wait.
   674 	    ] forkAt:1.
   676 			   'smalltalk.rc [info]: saving initial image for faster future startup...' infoPrintCR.
   675 	    [
   677 			   ObjectMemory primSnapShotOn:'st.img'
   676 		Delay waitForSeconds:10.
   678 		    ] forkAt:1
   677 		doneWithStartupStuff signal
   679 		].
   678 	    ] forkAt:1.
   680 
   679 	].
   681 	    Smalltalk addStartBlock:
   680     ].
   682 		[
   681 ].
   683 		    [
       
   684 			Delay waitForSeconds:10.
       
   685 			doneWithStartupStuff signal
       
   686 		    ] forkAt:1
       
   687 		].
       
   688 	]
       
   689     ]
       
   690 ].