Chris Muller uploaded a new version of System to project The Trunk: http://source.squeak.org/trunk/System-cmm.1451.mcz
==================== Summary ====================
Name: System-cmm.1451 Author: cmm Time: 25 March 2024, 7:37:55.127523 pm UUID: 29d336c2-1aa8-40f1-914f-7b2b23873523 Ancestors: System-eem.1450
Added Smalltalk>>#previousPlatformName to support detecting and responding to platform changes between image restarts.
=============== Diff against System-eem.1450 ===============
Item was changed: Object subclass: #SmalltalkImage instanceVariableNames: 'globals' + classVariableNames: 'EndianCache LastImageName LastQuitLogPosition LastStats PlatformNameCache PreviousPlatformName ShutDownList SourceFileVersionString StartUpList StartupStamp VMMakerVersion WordSize' - classVariableNames: 'EndianCache LastImageName LastQuitLogPosition LastStats PlatformNameCache ShutDownList SourceFileVersionString StartUpList StartupStamp VMMakerVersion WordSize' poolDictionaries: '' category: 'System-Support'!
!SmalltalkImage commentStamp: 'dtl 3/6/2010 14:00' prior: 0! I represent the current image and runtime environment, including system organization, the virtual machine, object memory, plugins and source files. My instance variable #globals is a reference to the system dictionary of global variables and class names.
My singleton instance is called Smalltalk.!
Item was changed: ----- Method: SmalltalkImage>>cleanUpSystemAttributeCaches (in category 'housekeeping') ----- cleanUpSystemAttributeCaches "Reset platform-specific values. This MUST BE called directly before the image is snapshotted. Note that this can't safely be done on start-up because Smalltalk is too late in the start-up sequence. See commentary in #getSystemAttribute:."
self flag: #discuss. "mt: Such caches might better be managed by the VM itself. A primitive-based cache protocol could help. On a fresh (VM) start-up, those values would then be nil (or uninitialized) automatically." + PreviousPlatformName := PlatformNameCache. - EndianCache := WordSize := PlatformNameCache := nil.!
Item was added: + ----- Method: SmalltalkImage>>previousPlatformName (in category 'os') ----- + previousPlatformName + "Answer the name of the previous OS platform that ran this image, useful for detecting and responding to platform changes." + ^ PreviousPlatformName ifNil: [ 'unknown' ]!
Item was changed: ----- Method: SmalltalkImage>>snapshot:andQuit:withExitCode:embedded: (in category 'snapshot and quit') ----- snapshot: save andQuit: quit withExitCode: exitCode embedded: embeddedFlag "Mark the changes file and close all files as part of #processShutdownList. If save is true, save the current state of this Smalltalk in the image file. If quit is true, then exit to the outer OS shell. If exitCode is not nil, then use it as exit code. The latter part of this method runs when resuming a previously saved image. This resume logic checks for a document file to process when starting up."
| resuming msg | Object flushDependents. Object flushEvents.
(SourceFiles at: 2) ifNotNil:[ msg := String streamContents: [ :s | s nextPutAll: '----'; nextPutAll: (save ifTrue: [ quit ifTrue: [ 'QUIT' ] ifFalse: [ 'SNAPSHOT' ] ] ifFalse: [quit ifTrue: [ 'QUIT/NOSAVE' ] ifFalse: [ 'NOP' ]]); nextPutAll: '----'; print: Date dateAndTimeNow; space; nextPutAll: (FileDirectory default localNameFor: self imageName); nextPutAll: ' priorSource: '; print: LastQuitLogPosition ]. self assureStartupStampLogged. save ifTrue: [ LastQuitLogPosition := (SourceFiles at: 2) setToEnd; position ]. self logChange: msg. Transcript cr; show: msg].
self processShutDownList: quit. Cursor write show. + save ifTrue: + [self cleanUpSystemAttributeCaches. - save ifTrue: [ - self cleanUpSystemAttributeCaches. resuming := embeddedFlag ifTrue: [self snapshotEmbeddedPrimitive] + ifFalse: + [PlatformNameCache := nil. + self snapshotPrimitive]] "<-- PC frozen here on image file" - ifFalse: [self snapshotPrimitive]] "<-- PC frozen here on image file" ifFalse: [resuming := false]. (quit and: [resuming == false]) ifTrue: [exitCode ifNil: [ self quitPrimitive ] ifNotNil: [ self quitPrimitive: exitCode ] ]. Cursor normal show. self startUpPostSnapshot: resuming == true. Project current wakeUpTopWindow. "Now it's time to raise an error" resuming == nil ifTrue: [self error:'Failed to write image file (disk full?)']. ^ resuming!
squeak-dev@lists.squeakfoundation.org