Marcel Taeumel uploaded a new version of System to project The Trunk: http://source.squeak.org/trunk/System-mt.1416.mcz
==================== Summary ====================
Name: System-mt.1416 Author: mt Time: 16 June 2023, 9:14:18.416484 am UUID: 9bdd0613-8cb2-ff41-bb40-a6c1a1d83ceb Ancestors: System-eem.1415
Fixes regression from System-eem.1415. We must clear the PlatformNameCache directly before snapshotting.
Here, Cursor class >> #currentCursor: needs #platformName again but is called after the shutdown code. Might happen elsewhere. This fix documents the issue and brings system-attribute cache-invalidation closer to the snapshot primitive. A VM-based cache might even be better for certain values of primitive 149.
=============== Diff against System-eem.1415 ===============
Item was added: + ----- 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." + + EndianCache := PlatformNameCache := nil.!
Item was changed: ----- Method: SmalltalkImage>>getSystemAttribute: (in category 'private') ----- getSystemAttribute: attributeID "Optional. Answer the string for the system attribute with the given integer ID. Answer nil if the given attribute is not defined on this platform. On platforms that support invoking programs from command lines (e.g., Unix), this mechanism can be used to pass command line arguments to programs written in Squeak. + + NOTE THAT the answered string needs to be allocated. It might thus + be useful to cache it for the current session to not stress the scavenger + too much. For example, see #platformName.
By convention, the first command line argument that is not a VM configuration option is considered a 'document' to be filed in. Such a document can add methods and classes, can contain a serialized object, can include code to be executed, or any combination of these.
Currently defined attributes include: -1000 1000th command line argument that specify VM options ... -1 first command line argument that specify VM options 0 the full path name for currently executing VM (or, on some platforms, just the path name of the VM's directory) 1 full path name of this image (better use primImageName instead) 2 first command-line argument for Squeak programs. + Note: if Preferences readDocumentAtStartup is set, this first + argument is treated as a URL to a Squeak document to open. - Note: if Preferences readDocumentAtStartup is set, this first argument is treated as a URL to a Squeak document to open. 3 second command-line argument for Squeak programs ... 1000 1000th command line argument for Squeak programs 1001 this platform's operating system 'Mac OS', 'Win32', 'unix', ... 1002 operating system version 1003 this platform's processor type 1004 vm version 1005 window system name 1006 vm build id 1007 Interpreter class (Cog VM only) 1008 Cogit class (Cog VM only) 1009 Platform source version (Cog VM only?) 1201 max filename length (Mac OS only) 1202 file last error (Mac OS only) 10001 hardware details (Win32 only) 10002 operating system details (Win32 only) 10003 graphics hardware details (Win32 only) "
<primitive: 149> ^ nil!
Item was changed: ----- Method: SmalltalkImage>>processShutDownList: (in category 'snapshot and quit') ----- processShutDownList: quitting + "Send #shutDown to each class that needs to wrap up before a snapshot." - "Send #shutDown to each class that needs to wrap up before a snapshot. - Also void the various caches; this can't safely be done on start-up because - Smalltalk is too late in the start-up sequence."
+ self send: #shutDown: toClassesNamedIn: ShutDownList with: quitting.! - self send: #shutDown: toClassesNamedIn: ShutDownList with: quitting. - EndianCache := PlatformNameCache := nil!
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. + resuming := embeddedFlag + ifTrue: [self snapshotEmbeddedPrimitive] + ifFalse: [self snapshotPrimitive]] "<-- PC frozen here on image file" - save ifTrue: [resuming := embeddedFlag - ifTrue: [self snapshotEmbeddedPrimitive] - 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!
packages@lists.squeakfoundation.org