Levente Uzonyi uploaded a new version of Chronology-Core to project The Trunk:
http://source.squeak.org/trunk/Chronology-Core-ul.55.mcz
==================== Summary ====================
Name: Chronology-Core-ul.55
Author: ul
Time: 31 May 2020, 12:10:20.250221 am
UUID: ea36b609-177c-405a-b64e-9988deb3d26e
Ancestors: Chronology-Core-nice.52
Automatically update the time zone cached by the VM every 30 minutes:
- copied and modified Eliot's accessor to primitive 243 to do the actual updating (Time class >> #primitiveUpdateTimeZone)
- update happens when Time class >> #posixMicrosecondClockWithOffset or Time class >> #posixMicrosecondClockWithOffset: are sent. Other low-level accessors of the VM time zone are not updating the cached time zone value (e.g. Time class >> #localMicrosecondClockPrimitive)
- actual update happens in Time class >> #updateTimeZoneCacheAt:
- postscript activates the update mechanism which can be turned off by evaluating [ Time classPool at: #UpdateVMTimeZoneCacheAt put: nil ]
Other changes:
- do not send Time class >> #initialize from DateAndTime class >> #startUp:. Let Time have its own #startUp: method instead. Postscript adds Time to the startUpList before DateAndTime.
- do not send super initialize from DateAndTime class >> #initialize
- do not send #automaticTimezone to DateAndTime on startup, because that's just an accessor with no side effects
- do not overwrite set variables in Time class >> #initialize
- assert that the value passed to Time class >> #clockPolicy: is one of the known values
=============== Diff against Chronology-Core-nice.52 ===============
Item was changed:
----- Method: DateAndTime class>>initialize (in category 'initialize-release') -----
initialize
- super initialize.
-
ClockProvider := Time.
PosixEpochJulianDays := 2440588.
InitializeFromPrimitive := self canInitializeFromPrimitive.
Smalltalk addToStartUpList: self.
self startUp: true
!
Item was changed:
----- Method: DateAndTime class>>startUp: (in category 'system startup') -----
startUp: startingAfresh
"Set local timezone"
startingAfresh
ifTrue: [InitializeFromPrimitive := self canInitializeFromPrimitive.
Time initialize. "set LastClockTick to 0".
+ self now]!
- self now.
- self automaticTimezone]!
Item was changed:
Magnitude subclass: #Time
instanceVariableNames: 'seconds nanos'
+ classVariableNames: 'ClockPolicy HighResClockTicksPerMillisecond LastClockTick UpdateVMTimeZoneCacheAt UseHighResClockForTiming'
- classVariableNames: 'ClockPolicy HighResClockTicksPerMillisecond LastClockTick UseHighResClockForTiming'
poolDictionaries: 'ChronologyConstants'
category: 'Chronology-Core'!
!Time commentStamp: 'dew 10/23/2004 17:58' prior: 0!
This represents a particular point in time during any given day. For example, '5:19:45 pm'.
If you need a point in time on a particular day, use DateAndTime. If you need a duration of time, use Duration.
!
Item was changed:
----- Method: Time class>>clockPolicy: (in category 'class initialization') -----
clockPolicy: aSymbol
"When sequencial calls are made to DateAndTime now, it may be desirable to
force the system clock to be monotonic, and it may be desirable for the clock
to appear to be strictly increasing with no repeat values. The ClockPolicy
identifies which of several possible strategies to use.
Allowable values are
#acceptPlatformTime
#monotonicAllowDuplicates
#monotonicForceMicrosecondIncrement
#monotonicForceNanosecondIncrement "
+ self assert: (
+ #(
+ acceptPlatformTime
+ monotonicAllowDuplicates
+ monotonicForceMicrosecondIncrement
+ monotonicForceNanosecondIncrement) includes: aSymbol).
ClockPolicy := aSymbol!
Item was changed:
----- Method: Time class>>initialize (in category 'class initialization') -----
initialize
+ " self initialize "
- "Time initialize"
+ LastClockTick ifNil: [ LastClockTick := 0 ].
- "Initialize at startup time to protect for the case of an image saved with bad LastClockTick"
- LastClockTick := 0.
+ HighResClockTicksPerMillisecond ifNil: [ HighResClockTicksPerMillisecond := 0 ].
- HighResClockTicksPerMillisecond := 0.
+ ClockPolicy ifNil: [
+ "self clockPolicy: #acceptPlatformTime."
+ self clockPolicy: #monotonicAllowDuplicates.
+ "self clockPolicy: #monotonicForceMicrosecondIncrement."
+ "self clockPolicy: #monotonicForceNanosecondIncrement." ]!
- "self clockPolicy: #acceptPlatformTime."
- self clockPolicy: #monotonicAllowDuplicates.
- "self clockPolicy: #monotonicForceMicrosecondIncrement."
- "self clockPolicy: #monotonicForceNanosecondIncrement."
- !
Item was changed:
----- Method: Time class>>posixMicrosecondClockWithOffset (in category 'clock') -----
posixMicrosecondClockWithOffset
"Answer an array with local microseconds since the Posix epoch and the
current seconds offset from GMT in the local time zone."
+ | array posixUtcValue |
- | array utcValue |
array := self primPosixMicrosecondClockWithOffset.
+ posixUtcValue := array at: 1.
+ (self updateTimeZoneCacheAt: posixUtcValue) ifTrue: [ "Time zone may have changed: fetch again."
+ self primPosixMicrosecondClockWithOffset: array.
+ posixUtcValue := array at: 1 ].
ClockPolicy caseOf: {
[#acceptPlatformTime] -> [^ array] .
[#monotonicAllowDuplicates] -> [
+ posixUtcValue > LastClockTick
+ ifTrue: [LastClockTick := posixUtcValue]
- utcValue := array at: 1.
- utcValue > LastClockTick
- ifTrue: [LastClockTick := utcValue]
ifFalse: [array at: 1 put: LastClockTick]] .
[#monotonicForceMicrosecondIncrement] -> [
+ posixUtcValue > LastClockTick
+ ifTrue: [LastClockTick := posixUtcValue]
- utcValue := array at: 1.
- utcValue > LastClockTick
- ifTrue: [LastClockTick := utcValue]
ifFalse: [LastClockTick := LastClockTick + 1. "add one microsecond"
array at: 1 put: LastClockTick]] .
[#monotonicForceNanosecondIncrement] -> [
+ posixUtcValue > LastClockTick
+ ifTrue: [LastClockTick := posixUtcValue]
- utcValue := array at: 1.
- utcValue > LastClockTick
- ifTrue: [LastClockTick := utcValue]
ifFalse: [LastClockTick := LastClockTick + (1 / 1000). "add one nanosecond"
array at: 1 put: LastClockTick]]
} otherwise: [].
+ ^array!
- ^array
-
- !
Item was changed:
----- Method: Time class>>posixMicrosecondClockWithOffset: (in category 'clock') -----
posixMicrosecondClockWithOffset: aDateAndTime
"Initialize aDateAndTime initialized with local microseconds since the Posix
epoch and the current seconds offset from GMT in the local time zone."
+ | posixUtcValue |
-
- | utcValue |
self primPosixMicrosecondClockWithOffset: aDateAndTime.
+ posixUtcValue := aDateAndTime utcMicroseconds.
+ (self updateTimeZoneCacheAt: posixUtcValue) ifTrue: [ "Time zone may have changed: fetch again."
+ self primPosixMicrosecondClockWithOffset: aDateAndTime .
+ posixUtcValue := aDateAndTime utcMicroseconds ].
ClockPolicy caseOf: {
[#acceptPlatformTime] -> [^ aDateAndTime] .
[#monotonicAllowDuplicates] -> [
+ posixUtcValue > LastClockTick
+ ifTrue: [LastClockTick := posixUtcValue]
- utcValue := aDateAndTime utcMicroseconds.
- utcValue > LastClockTick
- ifTrue: [LastClockTick := utcValue]
ifFalse: [aDateAndTime utcMicroseconds: LastClockTick]] .
[#monotonicForceMicrosecondIncrement] -> [
+ posixUtcValue > LastClockTick
+ ifTrue: [LastClockTick := posixUtcValue]
- utcValue := aDateAndTime utcMicroseconds.
- utcValue > LastClockTick
- ifTrue: [LastClockTick := utcValue]
ifFalse: [LastClockTick := LastClockTick + 1. "add one microsecond"
aDateAndTime utcMicroseconds: LastClockTick]] .
[#monotonicForceNanosecondIncrement] -> [
+ posixUtcValue > LastClockTick
+ ifTrue: [LastClockTick := posixUtcValue]
- utcValue := aDateAndTime utcMicroseconds.
- utcValue > LastClockTick
- ifTrue: [LastClockTick := utcValue]
ifFalse: [LastClockTick := LastClockTick + (1 / 1000). "add one nanosecond"
aDateAndTime utcMicroseconds: LastClockTick]]
} otherwise: [].
+ ^aDateAndTime!
- ^aDateAndTime
- !
Item was added:
+ ----- Method: Time class>>primitiveUpdateTimeZone (in category 'clock') -----
+ primitiveUpdateTimeZone
+ "Update the VMs notion of the current time zone. The VM sets its notion
+ of the time zone once at start-up. If one wants the VM to keep its notion
+ up-to-date arrange to invoke this primitive periodically."
+
+ <primitive: 243>
+ ^nil "Return nil instead of self to indicate that the primitive failed."!
Item was added:
+ ----- Method: Time class>>startUp: (in category 'system startup') -----
+ startUp: resuming
+
+ resuming ifTrue: [
+ LastClockTick := 0 ]!
Item was added:
+ ----- Method: Time class>>updateTimeZoneCacheAt: (in category 'clock') -----
+ updateTimeZoneCacheAt: posixUtcMicrosecondClock
+ "Tell the VM to update its cached time zone value if the POSIX UTC time reached the valute stored in UpdateVMTimeZoneCacheAt has been reached. Assume that posixUtcMicrosecondClock is an integer with the current POSIX UTC microsecond clock value. Return true when the cache was updated to indicate that the time zone may have changed."
+
+ | updateInterval |
+ UpdateVMTimeZoneCacheAt ifNil: [
+ "Automatic update is disabled."
+ ^false ].
+ posixUtcMicrosecondClock < UpdateVMTimeZoneCacheAt ifTrue: [ ^false ].
+ self primitiveUpdateTimeZone ifNil: [
+ "The primitive failed."
+ ^false ].
+ updateInterval := 1800000000. "This could be a preference but 30 minutes matches all upcoming DST change times."
+ UpdateVMTimeZoneCacheAt := posixUtcMicrosecondClock // updateInterval + 1 * updateInterval "Round up posixUtcMicrosecondClock to the next multiple of updateInterval.".
+ ^true!
Item was changed:
+ (PackageInfo named: 'Chronology-Core') postscript: '"Make sure UpdateVMTimeZoneCacheAt of Time is initialized."
+ Time classPool at: #UpdateVMTimeZoneCacheAt put: 0.
+ "Separated Time''s startup duties from DateAndTime."
+ Smalltalk addToStartUpList: Time before: DateAndTime'!
- (PackageInfo named: 'Chronology-Core') postscript: 'DateAndTime startUp: true.
- HashedCollection rehashAll.
- '!
Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI:
http://source.squeak.org/FFI/FFI-Kernel-mt.79.mcz
==================== Summary ====================
Name: FFI-Kernel-mt.79
Author: mt
Time: 30 May 2020, 4:56:51.283231 pm
UUID: 2191ddfe-e9ae-844c-bf19-71cc0ab214dd
Ancestors: FFI-Kernel-mt.77
Fixes a bug with wrong byte alignment for double and longlong and ulonglong on 32-bit non-ARM Unix-based platforms.
Start documenting Squeak FFI's relationship to "int" and "long" with the flag #ffiLongVsInt. If you spot an implication somewhere, just put this flag in the code.
Because byte alignment is stored in atomic types, re-initialize those if the platform changed on image start up. This also affects structure types.
(Skip mt.78 because that number rests in our treated inbox for now.)
=============== Diff against FFI-Kernel-mt.77 ===============
Item was changed:
----- Method: ExternalStructure class>>install (in category 'system startup') -----
install
+ "Resume the system on a new platform. Recompile all structures to account for different word size etc."
- "Resume the system on a new platform. Recompile all structures to accound for different word size etc."
self recompileStructures.!
Item was changed:
----- Method: ExternalType class>>initializeAtomicTypes (in category 'class initialization') -----
initializeAtomicTypes
"ExternalType initialize"
+
| atomicType byteSize type typeName byteAlignment |
+ self flag: #ffiLongVsInt. "For a discussion about long vs. int see http://forum.world.st/Re-squeak-dev-64-bit-FFI-was-porting-Croquet-to-Squea…."
+
#(
"name atomic id byte size byte alignment"
('void' 0 0 0)
('bool' 1 1 1)
('byte' 2 1 1)
('sbyte' 3 1 1)
('ushort' 4 2 2)
('short' 5 2 2)
+ "!!!!!!" ('ulong' 6 4 "!!!!!!" 4)
+ "!!!!!!" ('long' 7 4 "!!!!!!" 4)
+ ('ulonglong' 8 8 8) "v.i."
+ ('longlong' 9 8 8) "v.i."
- ('ulong' 6 4 4)
- ('long' 7 4 4)
- ('ulonglong' 8 8 8)
- ('longlong' 9 8 8)
('char' 10 1 1)
('schar' 11 1 1)
('float' 12 4 4)
+ ('double' 13 8 8) "v.i."
+ "TODO: ('longdouble' 14 10 16? 4?)"
- ('double' 13 8 8)
) do:[:typeSpec| | compiled |
typeName := typeSpec first.
atomicType := typeSpec second.
byteSize := typeSpec third.
byteAlignment := typeSpec fourth.
+
+ "0) On 32-bits Windows and MacOS, double and long long have an alignment of 8. But on 32-bit Linux, their alignment is 4. But not on a 32-bit Raspberry Pi OS."
+ (FFIPlatformDescription current wordSize = 4
+ and: [FFIPlatformDescription current isUnix
+ and: [FFIPlatformDescription current isARM not]]) ifTrue: [
+ (#('double' 'longlong' 'ulonglong') includes: typeName) ifTrue: [
+ byteAlignment := 4]].
+
+ "1) Regular type"
- "On 32 bits Windows and MacOS, double and long have an alignment of 8. But on Linux, their alignment is 4"
- (FFIPlatformDescription current wordSize = 4 and: [FFIPlatformDescription current isUnix]) ifTrue: [
- (#('double longlong ulonglong') includes: typeName) ifTrue: [
- byteAlignment := 4
- ]
- ].
compiled := WordArray with: ((byteSize bitOr: FFIFlagAtomic) bitOr:
(atomicType bitShift: FFIAtomicTypeShift)).
type := (AtomicTypes at: typeName).
+ type
+ compiledSpec: compiled;
- type compiledSpec: compiled;
byteAlignment: byteAlignment.
+
+ "2) Pointer type"
compiled := WordArray with: ((self pointerSpec bitOr: FFIFlagAtomic) bitOr:
(atomicType bitShift: FFIAtomicTypeShift)).
type asPointerType
byteAlignment: self pointerAlignment;
compiledSpec: compiled.
].!
Item was added:
+ ----- Method: ExternalType class>>platformChangedFrom:to: (in category 'system startup') -----
+ platformChangedFrom: lastPlatform to: currentPlatform
+ "Byte size or byte alignment for atomic types might be different on the new platform."
+
+ self initializeAtomicTypes.
+ self initializeStructureTypes.!
Item was changed:
----- Method: FFIPlatformDescription class>>startUp: (in category 'system startup') -----
startUp: resuming
"Notify all FFI classes about platform changes."
resuming ifTrue: [
LastPlatform in: [:lastPlatform | self newCurrent in: [:currentPlatform |
lastPlatform = currentPlatform
ifTrue: [
self flag: #discuss. "mt: Maybe add #platformResuming?"
ExternalAddress allBeNull]
ifFalse: [
LastPlatform := currentPlatform. "Update now. See #current."
+ { ExternalType. ExternalAddress. ExternalObject. FFIExternalSharedPool }
- self flag: #discuss. "mt: Maybe directly call ExternalStructure?"
- { ExternalAddress. ExternalObject. FFIExternalSharedPool }
do: [:cls | cls
platformChangedFrom: lastPlatform
to: currentPlatform] ]]] ].!
Marcel Taeumel uploaded a new version of FFI-Pools to project FFI:
http://source.squeak.org/FFI/FFI-Pools-mt.17.mcz
==================== Summary ====================
Name: FFI-Pools-mt.17
Author: mt
Time: 28 May 2020, 10:52:12.071313 am
UUID: 35276a12-4bcf-044c-9a7f-8c440d94fc5d
Ancestors: FFI-Pools-mt.16
Avoid external pool initialization when the basic FFI mechansim is loaded.
Not sure this is useful anyway because actual external pools have to define their own #initialize to be updated on code-load time if the FFI mechanism is already loaded.
This should also fix the VMMaker build script again.
=============== Diff against FFI-Pools-mt.16 ===============
Item was changed:
----- Method: FFIExternalSharedPool class>>initialize (in category 'class initialization') -----
initialize
"self initialize"
+ "self initializeAllFromGeneratedProgramOutput"!
- self initializeAllFromGeneratedProgramOutput!
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1662.mcz
==================== Summary ====================
Name: Morphic-mt.1662
Author: mt
Time: 27 May 2020, 4:30:03.194043 pm
UUID: 3e759a12-fae1-084f-8fb2-28de0dc8460b
Ancestors: Morphic-mt.1661
Adds "recover method versions" to Extras menu. Complements Tools-mt.970.
=============== Diff against Morphic-mt.1661 ===============
Item was changed:
----- Method: TheWorldMainDockingBar>>extrasMenuOn: (in category 'submenu - extras') -----
extrasMenuOn: aDockingBar
aDockingBar addItem: [ :it|
it contents: 'Extras' translated;
addSubMenu: [:menu|
menu addItem:[:item|
item
contents: 'Recover Changes' translated;
help: 'Recover changes after a crash' translated;
icon: MenuIcons smallDocumentClockIcon;
target: ChangeList;
selector: #browseRecentLog].
+ menu addItem:[:item|
+ item
+ contents: 'Recover Method Versions' translated;
+ help: 'Recover versions of deleted methods' translated;
+ target: ChangeList;
+ selector: #browseMethodVersions].
menu addLine.
menu addItem:[:item|
item
contents: 'Themes & Colors' translated;
subMenuUpdater: self
selector: #themesAndWindowColorsOn: ].
menu addItem:[:item|
item
contents: 'Language' translated;
subMenuUpdater: self
selector: #languageTranslatorsOn: ].
menu addItem:[:item|
item
contents: 'Set Author Initials' translated;
help: 'Sets the author initials' translated;
icon: MenuIcons smallUserQuestionIcon;
target: Utilities;
selector: #setAuthorInitials].
menu addItem:[:item|
item
contents: 'Restore Display (r)' translated;
help: 'Redraws the entire display' translated;
target: Project current;
selector: #restoreDisplay].
menu addItem:[:item|
item
contents: 'Rebuild Menus' translated;
help: 'Rebuilds the menu bar' translated;
target: TheWorldMainDockingBar;
selector: #updateInstances].
menu addLine.
menu addItem:[:item|
item
contents: 'Start Profiler' translated;
help: 'Starts the profiler' translated;
icon: MenuIcons smallTimerIcon;
target: self;
selector: #startMessageTally].
menu addItem:[:item|
item
contents: 'Collect Garbage' translated;
help: 'Run the garbage collector and report space usage' translated;
target: Utilities;
selector: #garbageCollectAndReport].
menu addItem:[:item|
item
contents: 'Purge Undo Records' translated;
help: 'Save space by removing all the undo information remembered in all projects' translated;
target: CommandHistory;
selector: #resetAllHistory].
menu addItem:[:item|
item
contents: 'VM statistics' translated;
help: 'Virtual Machine information' translated;
target: self;
selector: #vmStatistics].
menu addLine.
menu addItem:[:item|
item
contents: 'Graphical Imports' translated;
help: 'View the global repository called ImageImports; you can easily import external graphics into ImageImports via the FileList' translated;
target: (Imports default);
selector: #viewImages].
menu addItem:[:item|
item
contents: 'Standard Graphics Library' translated;
help: 'Lets you view and change the system''s standard library of graphics' translated;
target: ScriptingSystem;
selector: #inspectFormDictionary].
menu addItem:[:item|
item
contents: 'Annotation Setup' translated;
help: 'Click here to get a little window that will allow you to specify which types of annotations, in which order, you wish to see in the annotation panes of browsers and other tools' translated;
target: Preferences;
selector: #editAnnotations].
menu addItem:[:item|
item
contents: 'Browse My Changes' translated;
help: 'Browse all of my changes since the last time #condenseSources was run.' translated;
target: SystemNavigation new;
selector: #browseMyChanges].
] ]!
Item was changed:
+ (PackageInfo named: 'Morphic') postscript: 'TheWorldMainDockingBar updateInstances.'!
- (PackageInfo named: 'Morphic') postscript: '"Set a smoother scrolling, especially useful for trackpads"
- HandMorph minimumWheelDelta: 20.
- Smalltalk sendMouseWheelEvents: true.'!