Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1439.mcz
==================== Summary ====================
Name: System-mt.1439
Author: mt
Time: 9 December 2023, 8:18:20.344807 am
UUID: 32d474f2-ed75-4949-8608-7cf067ec2b3e
Ancestors: System-mt.1438
Make #imageHeaderFlagAt:put: more robust and let it answer the prior value correctly.
=============== Diff against System-mt.1438 ===============
Item was changed:
----- Method: SmalltalkImage>>doMixedArithmetic: (in category 'system attributes') -----
doMixedArithmetic: aBoolean
"Answer whether the VM can handle arithmetic conversions:
SmallInteger arithmeticOp: Float (Small or Boxed)
SmallInteger compareOp: Float (Small or Boxed)
Else, the primitives will fail in case of mixed arithmetic, and conversion
should be performed in the image.
This flag persists across snapshots, stored in the image header."
self vmParameterAt: 75 put: aBoolean.
+ "^(self imageHeaderFlagAt: 6 put: aBoolean not) not"!
- "self imageHeaderFlagAt: 6 put: aBoolean not"!
Item was changed:
----- Method: SmalltalkImage>>imageHeaderFlagAt:put: (in category 'vm parameters') -----
imageHeaderFlagAt: bitIndex put: aBoolean
"Persist image header flag. See commentary in #vmParameterAt:.
Set or clear the flag (or bit) and the given bitIndex."
| mask |
mask := 1 << bitIndex.
+ ^ [(self vmParameterAt: 48 put: ((self vmParameterAt: 48 ifAbsent: [^ false] "non-Cog") bitClear: mask)
+ + (aBoolean ifTrue: [mask] ifFalse: [0])) anyMask: mask "prior value"]
+ on: Error do: [:ex | false "Unrecognized bit. Too high?"]!
- ^ self vmParameterAt: 48 put: ((self vmParameterAt: 48 ifAbsent: [^ nil]) bitClear: mask)
- + (aBoolean ifTrue: [mask] ifFalse: [0])!
Item was changed:
----- Method: SmalltalkImage>>upscaleDisplayOnHighDPI: (in category 'system attributes') -----
upscaleDisplayOnHighDPI: aBoolean
"See commentary in #upscaleDisplayOnHighDPI."
+ ^ self vmVMMakerVersion > 3185 "i.e., later than OSVM 2022-06"
+ ifTrue: [(self imageHeaderFlagAt: 8 put: aBoolean not) not]
+ ifFalse: [true "Not supported. Please upgrade your VM."]!
- ^ self imageHeaderFlagAt: 8 put: aBoolean not!
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1438.mcz
==================== Summary ====================
Name: System-mt.1438
Author: mt
Time: 8 December 2023, 11:31:27.809415 am
UUID: 75344910-1154-0c45-b3f4-88ab0d6479c6
Ancestors: System-codefrau.1437
Adds #imageHeaderFlagAt:(put:) as a more readable interface for VM parameter 48. In the postscript, finally set flags 0 and 8. Updates commentary here and there.
=============== Diff against System-codefrau.1437 ===============
Item was added:
+ ----- Method: SmalltalkImage>>doMixedArithmetic (in category 'system attributes') -----
+ doMixedArithmetic
+ "Answer whether the VM can handle arithmetic conversions:
+ SmallInteger arithmeticOp: Float (Small or Boxed)
+ SmallInteger compareOp: Float (Small or Boxed)
+ Else, the primitives will fail in case of mixed arithmetic, and conversion
+ should be performed in the image."
+
+ ^ self vmParameterAt: 75 ifAbsent: [true]
+ "^ (self imageHeaderFlagAt: 6) negated"!
Item was added:
+ ----- Method: SmalltalkImage>>doMixedArithmetic: (in category 'system attributes') -----
+ doMixedArithmetic: aBoolean
+ "Answer whether the VM can handle arithmetic conversions:
+ SmallInteger arithmeticOp: Float (Small or Boxed)
+ SmallInteger compareOp: Float (Small or Boxed)
+ Else, the primitives will fail in case of mixed arithmetic, and conversion
+ should be performed in the image.
+ This flag persists across snapshots, stored in the image header."
+
+ self vmParameterAt: 75 put: aBoolean.
+ "self imageHeaderFlagAt: 6 put: aBoolean not"!
Item was added:
+ ----- Method: SmalltalkImage>>flagInterpretedMethods (in category 'system attributes') -----
+ flagInterpretedMethods
+ "The Cog VM can be instructed to set the flag bit of CompiledMethods that
+ it executes but will only interpret. This can be used e.g. to profile startup.
+ See CompiledMethod>>#flag & CompiledMethod>>#clearFlag."
+
+ ^ self imageHeaderFlagAt: 1!
Item was changed:
----- Method: SmalltalkImage>>flagInterpretedMethods: (in category 'system attributes') -----
flagInterpretedMethods: aBoolean
"The Cog VM can be instructed to set the flag bit of CompiledMethods that
it executes but will only interpret. This can be used e.g. to profile startup.
See CompiledMethod>>#flag & CompiledMethod>>#clearFlag.
This flag persists across snapshots, stored in the image header."
+ ^ self imageHeaderFlagAt: 1 put: aBoolean!
- self vmParameterAt: 48 put: ((self vmParameterAt: 48) bitClear: 2) + (aBoolean ifTrue: [2] ifFalse: [0])!
Item was added:
+ ----- Method: SmalltalkImage>>imageHeaderFlagAt: (in category 'vm parameters') -----
+ imageHeaderFlagAt: bitIndex
+ "Access image header flags. Answer whether the flag at the given bitIndex is raised (or set)."
+
+ ^ (self vmParameterAt: 48 ifAbsent: 0) anyMask: 1 << bitIndex!
Item was added:
+ ----- Method: SmalltalkImage>>imageHeaderFlagAt:put: (in category 'vm parameters') -----
+ imageHeaderFlagAt: bitIndex put: aBoolean
+ "Persist image header flag. See commentary in #vmParameterAt:.
+ Set or clear the flag (or bit) and the given bitIndex."
+
+ | mask |
+ mask := 1 << bitIndex.
+ ^ self vmParameterAt: 48 put: ((self vmParameterAt: 48 ifAbsent: [^ nil]) bitClear: mask)
+ + (aBoolean ifTrue: [mask] ifFalse: [0])!
Item was added:
+ ----- Method: SmalltalkImage>>processHasThreadAffinityInstVar (in category 'system attributes') -----
+ processHasThreadAffinityInstVar
+ "The threaded VM needs to know if the 4th inst var of Process
+ is threadAffinity which it uses to control process-to-thread binding."
+
+ | flag |
+ flag := self imageHeaderFlagAt: 0.
+ self assert: [flag ==> [(Process instVarNames at: 4) = 'threadAffinity']].
+ ^ flag!
Item was added:
+ ----- Method: SmalltalkImage>>processHasThreadAffinityInstVar: (in category 'system attributes') -----
+ processHasThreadAffinityInstVar: aBoolean
+ "The threaded VM needs to know if the 4th inst var of Process
+ is threadAffinity which it uses to control process-to-thread binding.
+ This flag persists across snapshots, stored in the image header."
+
+ self assert: [aBoolean ==> [(Process instVarNames at: 4) = 'threadAffinity']].
+ ^ self imageHeaderFlagAt: 0 put: aBoolean!
Item was removed:
- ----- Method: SmalltalkImage>>processHasThreadIdInstVar: (in category 'system attributes') -----
- processHasThreadIdInstVar: aBoolean
- "The threaded VM needs to know if the 4th inst var of Process
- is threadId which it uses to control process-to-thread binding.
- This flag persists across snapshots, stored in the image header."
- aBoolean ifTrue: [self assert: (Process instVarNames at: 4) = 'threadId'].
- self vmParameterAt: 48 put: ((self vmParameterAt: 48) bitClear: 1) + (aBoolean ifTrue: [1] ifFalse: [0])!
Item was changed:
----- Method: SmalltalkImage>>processPreemptionYields (in category 'system attributes') -----
processPreemptionYields
"Answer whether the VM causes a process to yield on process preemption,
i.e. to put a preempted process at the back of its run queue. If the parameter
is unavailable (non-Cog VMs) or bit 2 (4) is 0 then preemption yields."
+ ^ (self imageHeaderFlagAt: 2) not!
- ^(self vmParameterAt: 48 ifAbsent: 0) noMask: 4!
Item was changed:
----- Method: SmalltalkImage>>processPreemptionYields: (in category 'system attributes') -----
processPreemptionYields: aBoolean
"The Cog VM can be instructed not to yield on process preemption,
i.e. not to put a preempted process at the back of its run queue. By
default preempting a process causes it to yield (Blue Book semantics)
which can have unfortunate effects.
This flag persists across snapshots, stored in the image header."
+ ^ self imageHeaderFlagAt: 2 put: aBoolean not!
- [self vmParameterAt: 48 put: ((self vmParameterAt: 48) bitClear: 4) + (aBoolean ifTrue: [0] ifFalse: [4])]
- on: Error
- do: ["no VM parameter 48, do nothing"]!
Item was changed:
----- Method: SmalltalkImage>>sendMouseWheelEvents (in category 'system attributes') -----
sendMouseWheelEvents
"The Cog VM can be instructed to deliver mouse wheel events as mouse wheel events.
By default mouse wheel events are mapped to arrow events.
This flag persists across snapshots, stored in the image header."
+ ^ self imageHeaderFlagAt: 5!
- ^(self vmParameterAt: 48 ifAbsent: 0) anyMask: 32!
Item was changed:
----- Method: SmalltalkImage>>sendMouseWheelEvents: (in category 'system attributes') -----
sendMouseWheelEvents: aBoolean
"The Cog VM can be instructed to deliver mouse wheel events as mouse wheel events.
By default mouse wheel events are mapped to arrow events.
This flag persists across snapshots, stored in the image header."
+ ^ self imageHeaderFlagAt: 5 put: aBoolean!
- self vmParameterAt: 48 put: ((self vmParameterAt: 48) bitClear: 32) + (aBoolean ifTrue: [32] ifFalse: [0])!
Item was changed:
----- Method: SmalltalkImage>>supportsQueueingFinalization (in category 'system attributes') -----
supportsQueueingFinalization
"Answer whether the VM queues individual weak arrays for finalization, instead
of signalling the finalization semaphore once for all arrays and having the
WeakRegistry mechanism finalize all weak arrays, whether they need to or not."
"SmalltalkImage current supportsQueueingFinalization"
+ ^ self imageHeaderFlagAt: 4!
- ^(self vmParameterAt: 48 ifAbsent: 0) anyMask: 16!
Item was changed:
----- Method: SmalltalkImage>>supportsQueueingFinalization: (in category 'system attributes') -----
supportsQueueingFinalization: aBoolean
"Determine whether the VM queues individual weak arrays for finalization, instead
of signalling the finalization semaphore once for all arrays and having the
WeakRegistry mechanism finalize all weak arrays, whether they need to or not.
This flag persists across snapshots, stored in the image header."
"SmalltalkImage current supportsQueueingFinalization: true"
+ ^ self imageHeaderFlagAt: 4 put: aBoolean!
- self vmParameterAt: 48 put: ((self vmParameterAt: 48 ifAbsent: [^false]) bitClear: 16) + (aBoolean ifTrue: [16] ifFalse: [0])!
Item was added:
+ ----- Method: SmalltalkImage>>upscaleDisplayOnHighDPI (in category 'system attributes') -----
+ upscaleDisplayOnHighDPI
+ "When the VM detects a platform with high-DPI display, should it
+ take measures to upscale transparently so that the image can
+ work with the good-ol' low-DPI assumption? Older VMs did this
+ by default on some platforms. Older images (5.3 and before)
+ do not support high resolutions very well. The old 'demo mode'
+ was quite limited. Huge fonts a hassle."
+
+ self flag: #todo. "mt: As of December 2023, there is no platform
+ code that does the upscaling (again) if the host platform fails to do
+ so. For example, macOS 12+ does not support this anymore.
+ Windows 11, however, still supports platform-based upscaling."
+
+ ^ (self imageHeaderFlagAt: 8) not!
Item was added:
+ ----- Method: SmalltalkImage>>upscaleDisplayOnHighDPI: (in category 'system attributes') -----
+ upscaleDisplayOnHighDPI: aBoolean
+ "See commentary in #upscaleDisplayOnHighDPI."
+
+ ^ self imageHeaderFlagAt: 8 put: aBoolean not!
Item was changed:
----- Method: SmalltalkImage>>vmParameterAt: (in category 'vm parameters') -----
vmParameterAt: parameterIndex
"parameterIndex is a positive integer corresponding to one of the VM's internal parameter/metric registers.
Answer with the current value of that register. Fail if parameterIndex is invalid or has no corresponding register.
Coerce positive integers for parameterIndices unknown to teh VM to nil.
VM parameters are numbered as follows:
1 byte size of old-space (read-only)
2 byte size of young-space (read-only)
3 byte size of object memory (read-only)
4 allocationCount (read-only; nil in Cog VMs)
5 allocations between GCs (read-write; nil in Cog VMs)
6 survivor count tenuring threshold (read-write)
7 full GCs since startup (read-only)
8 total milliseconds in full GCs since startup (read-only)
9 incremental GCs since startup (read-only; scavenging GCs on Spur)
10 total milliseconds in incremental/scavenging GCs since startup (read-only)
11 tenures of surving objects since startup/last write (read-write)
12 event trace mask; if 1 << eventType is set in the mask then event received by primGetNextEvent: will be printed to stderr.
13 VM ticker start microseconds (Croquet/QwaqVM only)
14 VM ticker count (Croquet/QwaqVM only)
15 VM ticker call count (Croquet/QwaqVM only)
16 total microseconds in idle since startup
17 proportion of code zone available for use (Sista VMs only; read-write)
18 total milliseconds in full GC compaction since startup (a portion of parameter 8)
19 scavenge threshold; the effective size of eden
20 utc microseconds at VM start-up (actually at time initialization, which precedes image load) (newer Cog VMs only).
21 root (remembered) table size (read-only)
22 root (remembered) table overflows since startup (read-only)
23 bytes of extra memory to reserve for VM buffers, plugins, etc.
24 memory threshold above which to shrink object memory (read-write)
25 ammount to grow by when growing object memory (read-write)
26 interruptChecksEveryNms - force an ioProcessEvents every N milliseconds (read-write)
27 number of times mark loop iterated for current IGC/FGC (read-only) includes ALL marking
28 number of times sweep loop iterated for current IGC/FGC (read-only)
29 number of times make forward loop iterated for current IGC/FGC (read-only)
30 number of times compact move loop iterated for current IGC/FGC (read-only)
31 number of grow memory requests (read-only)
32 number of shrink memory requests (read-only)
33 number of root table entries used for current IGC/FGC (read-only)
34 bytes allocated in total since start-up or reset (read-write)
35 number of survivor objects after current IGC/FGC (read-only)
36 millisecond clock when current IGC/FGC completed (read-only)
37 number of marked objects for Roots of the world, not including Root Table entries for current IGC/FGC (read-only)
38 milliseconds taken by current IGC (read-only)
39 Number of finalization signals for Weak Objects pending when current IGC/FGC completed (read-only)
40 BytesPerWord for this image
41 imageFormatVersion for the VM
42 number of stack pages in use (Cog Stack VM only, otherwise nil)
43 desired number of stack pages (stored in image file header, max 65535; Cog VMs only, otherwise nil)
44 size of eden, in bytes (Cog VMs only, otherwise nil)
45 desired size of eden, in bytes (stored in image file header; Cog VMs only, otherwise nil)
46 size of machine code zone, in bytes (stored in image file header; Cog JIT VM only, otherwise nil)
47 desired size of machine code zone, in bytes (applies at startup only, stored in image file header; Cog JIT VM only)
48 various properties stored in the image header (that instruct the VM) as an integer encoding an array of bit flags.
+ Bit 0: in a threaded VM, if set, tells the VM that the image's Process class has threadAffinity as its 5th inst var
+ (after nextLink, suspendedContext, priority & myList)
+ Bit 1: in Cog JIT VMs, if set, asks the VM to set the flag bit in interpreted methods
- Bit 0: tells the VM that the image's Process class has threadId as its 5th inst var (after nextLink, suspendedContext, priority & myList)
- Bit 1: on Cog JIT VMs asks the VM to set the flag bit in interpreted methods
Bit 2: if set, preempting a process puts it to the head of its run queue, not the back,
i.e. preempting a process by a higher priority one will not cause the preempted process to yield
to others at the same priority.
+ Bit 3: (unassigned)
+ Bit 4: in a Spur VM, if set, causes weaklings and ephemerons to be queued individually for finalization
- Bit 3: in a muilt-threaded VM, if set, the Window system will only be accessed from the first VM thread
- Bit 4: in a Spur vm, if set, causes weaklings and ephemerons to be queued individually for finalization
Bit 5: if set, implies wheel events will be delivered as such and not mapped to arrow key events
Bit 6: if set, implies arithmetic primitives will fail if given arguments of different types (float vs int)
+ Bit 7: if set, causes times delivered from file primitives to be in UTC rather than local time
+ Bit 8: if set, implies the VM will not upscale the display on high DPI monitors; older VMs did this by default.
49 the size of the external semaphore table (read-write; Cog VMs only)
50-51 reserved for VM parameters that persist in the image (such as eden above)
52 root (remembered) table maximum size (read-only)
53 the number of oldSpace segments (Spur only, otherwise nil)
54 total size of free old space (Spur only, otherwise nil)
55 ratio of growth and image size at or above which a GC will be performed post scavenge (Spur only, otherwise nil)
56 number of process switches since startup (read-only)
57 number of ioProcessEvents calls since startup (read-only)
58 number of forceInterruptCheck (Cog VMs) or quickCheckInterruptCalls (non-Cog VMs) calls since startup (read-only)
59 number of check event calls since startup (read-only)
60 number of stack page overflows since startup (read-only; Cog VMs only)
61 number of stack page divorces since startup (read-only; Cog VMs only)
62 number of machine code zone compactions since startup (read-only; Cog VMs only)
63 milliseconds taken by machine code zone compactions since startup (read-only; Cog VMs only)
64 current number of machine code methods (read-only; Cog VMs only)
65 In newer Cog VMs a set of flags describing VM features,
if non-zero bit 0 implies multiple bytecode set support;
if non-zero bit 1 implies read-only object support;
if non-zero bit 2 implies the VM suffers from using an ITIMER heartbeat (if 0 it has a thread that provides the heartbeat)
(read-only; Cog VMs only; nil in older Cog VMs, a boolean answering multiple bytecode support in not so old Cog VMs)
if non-zero bit 3 implies the VM supports cross-platform BIT_IDENTICAL_FLOATING_POINT arithmetic
if non-zero bit 4 implies the VM can catch exceptions in FFI calls and answer them as primitive failures
if non-zero bit 5 implies the VM's suspend primitive backs up the process to before the wait if it was waiting on a condition variable
66 the byte size of a stack page in the stack zone (read-only; Cog VMs only)
67 the maximum allowed size of old space in bytes, 0 implies no internal limit (Spur VMs only).
68 the average number of live stack pages when scanned by GC (at scavenge/gc/become et al)
69 the maximum number of live stack pages when scanned by GC (at scavenge/gc/become et al)
70 the value of VM_PROXY_MAJOR (the interpreterProxy major version number)
71 the value of VM_PROXY_MINOR (the interpreterProxy minor version number)
72 total milliseconds in full GCs Mark phase since startup (read-only)
73 total milliseconds in full GCs Sweep phase since startup (read-only, can be 0 depending on compactors)
74 maximum pause time due to segment allocation
75 whether arithmetic primitives will do mixed type arithmetic; if false they fail for different receiver and argument types
76 the minimum unused headroom in all stack pages; Cog VMs only"
<primitive: 254>
(parameterIndex isInteger
and: [parameterIndex > 0]) ifTrue:
[^nil].
self primitiveFailed!
Item was changed:
----- Method: SmalltalkImage>>vmParameterAt:ifAbsent: (in category 'vm parameters') -----
vmParameterAt: parameterIndex ifAbsent: defaultValueOrBlock
+ "Answer a VM parameter or defaultValueOrBlock value if out of range or if the VM
+ does not provide a value for this parameter. A VM parameter is typically numeric
+ or boolean, and if not implemented will be nil."
+
+ ^ (self vmParameterAt: parameterIndex) ifNil: defaultValueOrBlock!
- "Answer a VM parameter or defaultValueOrBlock value if out of range or if the VM does not provide a value for this parameter. A VM parameter is typically numeric or boolean, and if not implemented will be nil."
- ^ (self vmParameterAt: parameterIndex) ifNil: [defaultValueOrBlock value]!
Item was changed:
----- Method: SmalltalkImage>>vmParameterAt:put: (in category 'vm parameters') -----
vmParameterAt: parameterIndex put: newValue
"parameterIndex is a positive integer corresponding to one of the VM's internal
parameter/metric registers. Store newValue (a positive integer) into that
register and answer with the previous value that was stored there.
Fail if newValue is out of range, if parameterIndex has no corresponding
register, or if the corresponding register is read-only.
As of late 2020 the parameters which can be set are
5 allocations between GCs (read-write; nil in Cog VMs)
6 survivor count tenuring threshold (read-write)
11 tenures of surving objects since startup/last write (read-write)
12 event trace mask; if 1 << eventType is set in the mask then event received by primGetNextEvent: will be printed to stderr.
17 proportion of code zone available for use (Sista VMs only)
23 bytes of extra memory to reserve for VM buffers, plugins, etc.
24 memory threshold above whichto shrink object memory (read-write)
25 memory headroom when growing object memory (read-write)
26 interruptChecksEveryNms - force an ioProcessEvents every N milliseconds (read-write)
34 bytes allocated in total since start-up or reset (read-write)
43 desired number of stack pages (stored in image file header, max 65535; Cog VMs only, otherwise nil)
45 desired size of eden, in bytes (stored in image file header; Cog VMs only, otherwise nil)
47 desired size of machine code zone, in bytes (applies at startup only, stored in image file header; Cog JIT VM only)
+ 48 various properties of the Cog VM as an integer encoding an array of bit flags; see commentary in #vmParameterAt:
- 48 various properties of the Cog VM as an integer encoding an array of bit flags.
- Bit 0: tells the VM that the image's Process class has threadId as its 5th inst var (after nextLink, suspendedContext, priority & myList)
- Bit 1: on Cog JIT VMs asks the VM to set the flag bit in interpreted methods
- Bit 2: if set, preempting a process puts it to the head of its run queue, not the back,
- i.e. preempting a process by a higher priority one will not cause the preempted process to yield
- to others at the same priority.
- Bit 3: in a muilt-threaded VM, if set, the Window system will only be accessed from the first VM thread
- Bit 4: in a Spur vm, if set, causes weaklings and ephemerons to be queued individually for finalization
49 the size of the external semaphore table (read-write; Cog VMs only)
55 ratio of growth and image size at or above which a GC will be performed post scavenge (Spur only, otherwise nil)
67 the maximum allowed size of old space in bytes, 0 implies no internal limit (Spur only).
68 the average number of live stack pages when scanned by GC (at scavenge/gc/become et al)
69 the maximum number of live stack pages when scanned by GC (at scavenge/gc/become et al)
74 maximum pause time due to segment allocation
75 whether arithmetic primitives will do mixed type arithmetic; if false they fail for different receiver and argument types"
<primitive: 254>
self primitiveFailed!
Item was changed:
+ (PackageInfo named: 'System') postscript: '"In Process, threadId/threadAffinity have been around for a long time."
+ Smalltalk processHasThreadAffinityInstVar: true.
+ "Squeak 6.0 and above have #scaleFactor support in image."
+ Smalltalk upscaleDisplayOnHighDPI: false.'!
- (PackageInfo named: 'System') postscript: 'Smalltalk installLowSpaceWatcher.
-
- SystemNavigation initializeAuthors. "Adds Marius Dörbandt (mad)"'!
Marcel Taeumel uploaded a new version of SystemReporter to project The Trunk:
http://source.squeak.org/trunk/SystemReporter-mt.65.mcz
==================== Summary ====================
Name: SystemReporter-mt.65
Author: mt
Time: 8 December 2023, 11:15:43.342415 am
UUID: 464dd47a-879c-d245-bd50-8cef28d4b758
Ancestors: SystemReporter-tpr.64
Update description for image-header flags reported as of today.
=============== Diff against SystemReporter-tpr.64 ===============
Item was changed:
----- Method: SystemReporter>>reportVMParameters: (in category 'reporting') -----
reportVMParameters: aStream
| vmParameters isStack isCog isSpur |
self header: 'Virtual Machine Parameters' on: aStream.
vmParameters := Smalltalk vm getVMParameters.
isStack := (vmParameters at: 42 ifAbsent: [0]) ~= 0. "42 = number of stack pages available"
isCog := isStack and: [(vmParameters at: 46) ~= 0]. "46 is machine code zone size"
isSpur := isStack and: [(vmParameters at: 41) anyMask: 2r10000]. "41 is imageFormatVersion for the VM; bit 16 is the Spur bit"
(isSpur
ifFalse:
[#( 1 'size of old space'
2 'size of young+old space'
3 'size of memory'
4 'allocationCount'
5 'allocations between GCs')]
ifTrue:
[#( 1 'size of old space'
2 'used bytes in new space (used eden + used past space)'
3 'size of heap')]),
#( 6 'survivor count tenuring threshold'
7 'full GCs since startup'
8 'total milliseconds in full GCs since startup'),
(isSpur
ifFalse: [#( 9 'incremental GCs since startup'
10 'total milliseconds in incremental GCs since startup'
11 'tenures of surving objects since startup'),
{12 to: 19. 'specific to the translating VM'}]
ifTrue: [#( 9 'scavenging GCs since startup'
10 'total milliseconds in scavenging GCs since startup'
11 'tenures of surving objects since startup'
12 'event trace mask (for debugging input events)'
13 'VM ticker start microseconds (Croquet/QwaqVM)'
14 'VM ticker count (Croquet/QwaqVM)'
15 'VM ticker call count (Croquet/QwaqVM)'
16 'total microseconds in idle since startup'
17 'proportion of code zone available for use (Sista VMs only; read-write)'
18 'total milliseconds in full GC compaction since startup (a portion of parameter 8)'
19 'scavenge threshold; the effective size of eden')]),
#( 20 'utc microseconds at startup (if non-zero)'
21 'root/remembered table size (occupancy)'
22 'root/remembered table overflows since startup'
23 'bytes of extra memory to reserve for VM buffers, plugins, etc.'
24 'free memory threshold above which object memory will be shrunk'
25 'memory headroom when growing object memory'),
(isStack
ifFalse:
[#( 26 'interruptChecksEveryNms - force an ioProcessEvents every N milliseconds, in case the image is not calling getNextEvent often')]
ifTrue:
[#( 26 'heartbeat period (ms; see #58)')]),
(isSpur
ifFalse:
[#( 27 'number of times mark loop iterated for current IGC/FGC includes ALL marking'
28 'number of times sweep loop iterated for current IGC/FGC'
29 'number of times make forward loop iterated for current IGC/FGC'
30 'number of times compact move loop iterated for current IGC/FGC')]
ifTrue: [#()]),
#( 31 'number of grow memory requests'
32 'number of shrink memory requests'),
(isSpur
ifFalse:
[#( 33 'number of root table entries used for current IGC/FGC'
34 'number of allocations done before current IGC/FGC'
35 'number of survivor objects after current IGC/FGC'
36 'millisecond clock when current IGC/FGC completed'
37 'number of marked objects for Roots of the world, not including Root Table entries for current IGC/FGC'
38 'milliseconds taken by current IGC'
39 'Number of finalization signals for Weak Objects pending when current IGC/FGC completed')]
ifTrue:
[#( 33 'number of root table entries at last scavenge'
35 'number of survivor objects at last scavenge (if non-zero)'
36 'millisecond clock when current scavenge completed'
38 'milliseconds taken by current scavenge'
39 'Number of finalization signals for Weak Objects pending when current SGC/FGC completed')]),
#( 40 'VM word size - 4 or 8'),
(isStack
ifTrue:
[#(
41 'imageFormatVersion for the VM'
42 'number of stack pages available'
43 'desired number of stack pages (stored in image file header, max 65535)'
44 'size of eden, in bytes'
45 'desired size of eden, in bytes (stored in image file header)'
46 'machine code zone size, in bytes (0 in Stack VM)'
47 'desired machine code zone size (0 => default 1Mb to 2Mb depending on processor)'),
+ { 48. 'Persistent image header flags\ bit 0: if set, implies Process has threadAffinity as its 4th inst var\ bit 1: if set, methods that are interpreted will have the flag bit set in their header\ bit 2: if set, implies preempting a process does *not* put it to the back of its run queue\ bit 3: (unassigned)\ bit 4: if set, implies the new finalization scheme where WeakArrays are queued\ bit 5: if set, implies wheel events will be delivered as such and not mapped to arrow key events\ bit 6: if set, implies arithmetic primitives will *fail* if given arguments of different types (float vs int)\ bit 7: if set, causes times delivered from file primitives to be in UTC rather than local time\ bit 8: if set, implies the VM will *not* upscale the display on high DPI monitors; older VMs did this by default.' withCRs },
- { 48. 'Persistent image header flags\ bit 0: implies Process has threadId as its 4th inst var\ bit 1: if set, methods that are interpreted will have the flag bit set in their header\ bit 2: if set, implies preempting a process does not put it to the back of its run queue\ bit 3: if set, implies the GUI should run on the first thread and event queues should not be accessed from other threads\ bit 4: if set, implies the new finalization scheme where WeakArrays are queued\ bit 5: if set, implies wheel events will be delivered as such and not mapped to arrow key events\ bit 6: if set, implies arithmetic primitives will fail if given arguments of different types (float vs int)\ bit 7: if set, causes times delivered from file primitives to be in UTC rather than local time.' withCRs },
#( 49 'max size the image promises to grow the external semaphore table to'),
(isSpur
ifFalse:
[{ 50 to: 51. 'reserved for VM parameters that persist in the image (such as size of eden above)'.
52 to: 56. 'specific to Spur' }]
ifTrue:
[{ 50 to: 51. 'reserved for VM parameters that persist in the image (such as size of eden above)' },
#( 52 'root/remembered table capacity'
53 'number of old space segments'
54 'total free old space'
55 'ratio of growth and image size at or above which a GC will be performed post scavenge')]),
#( 56 'number of process switches since startup'
57 'number of ioProcessEvents calls since startup'
58 'number of forceInterruptCheck calls since startup'
59 'number of check event calls since startup'
60 'number of stack page overflows since startup'
61 'number of stack page divorces since startup'
62 'compiled code compactions since startup'),
(isCog
ifFalse:
[#()]
ifTrue:
[#( 63 'total milliseconds in compiled code compactions since startup'
64 'the number of methods that currently have jitted machine-code')]),
{ 65. 'Cog feature flags\ bit 0: set if the VM supports MULTIPLE_BYTECODE_SETS.\ bit 1: set if the VM supports read-only objects (IMMUTABILITY).\ bit 2: set if the VM has an ITIMER_HEARTBEAT\ bit 3: set if the VM supports cross-platform BIT_IDENTICAL_FLOATING_POINT arithmetic\ bit 4: set if the VM can catch exceptions in FFI calls and answer them as primitive failures\ bit 5: set if the VM has primitives 568 and 578, versions of the suspend primitive which back up the process to before the wait if it was waiting on a condition variable' withCRs.
66. 'the byte size of a stack page'.},
(isSpur
ifFalse:
[{ 67 to: 69. 'reserved for more Cog-related info' }]
ifTrue:
[#( 67 'the maximum allowed size of old space (if zero there is no limit)'
68 'the average number of live stack pages when scanned by scavenge/gc/become'
69 'the maximum number of live stack pages when scanned by scavenge/gc/become')]),
#( 70 'the vmProxyMajorVersion (the interpreterProxy VM_MAJOR_VERSION)'
71 'the vmProxyMinorVersion (the interpreterProxy VM_MINOR_VERSION)'),
(isSpur
ifFalse: [#()]
ifTrue:
[#( 72 'milliseconds spent marking since startup'
73 'reserved for more Spur-related info'
74 'reserved for more Spur-related info'
75 'do mixed arithmetic; if false binary arithmetic primitives will fail unless receiver and argument are of the same type')]),
(isCog
ifFalse: [#()]
ifTrue: [#(76 'minimum unused bytes of headroom on all stack pages')])]
ifFalse:
[#()])
pairsDo: [:idx :desc | | value values |
(idx isInteger ifTrue: [idx] ifFalse: [idx last]) <= vmParameters size ifTrue:
[aStream nextPut: $#.
idx isInteger
ifTrue:
[value := vmParameters at: idx.
aStream
print: idx; tab: (idx < 10 ifTrue: [2] ifFalse: [1]);
nextPutAll: ((value isInteger and: [idx ~= 41])
ifTrue: [(desc includesSubstring: 'bit 0:')
ifTrue: [value printStringBase: 2 nDigits: value highBit]
ifFalse: [value asStringWithCommas]]
ifFalse: [value printString])]
ifFalse:
[value := vmParameters at: idx first.
aStream print: idx first; next: 2 put: $.; print: idx last; tab.
values := idx collect: [:i| vmParameters at: i].
values asSet size = 1
ifTrue: [aStream print: value]
ifFalse: [values do: [:v| aStream print: v] separatedBy: [aStream nextPutAll: ', ']]].
aStream tab; nextPutAll: desc; cr]]!
Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.549.mcz
==================== Summary ====================
Name: Graphics-mt.549
Author: mt
Time: 8 December 2023, 9:44:03.724103 am
UUID: d73c6d39-cf42-6549-9068-c9f2201aeb9b
Ancestors: Graphics-dtl.548
Expand commentary for #px, now that I realized that mixed-arithmetic is the reason why float*int is faster than int*float. Might still be a bug in the VM though.
=============== Diff against Graphics-dtl.548 ===============
Item was changed:
----- Method: Number>>px (in category '*Graphics-scale factor') -----
px
"Convert the receiver representing raw pixels at 100% (96ppi) to the current scale factor. Note that you currently have to do this manually for all graphics-related properties and layout-specific measures such as #borderWidth: and #layoutInset:. Only for model windows (see #initialExtent) that are no dialogs, that scaling will happen automatically in ToolBuilder."
| scaleFactor |
self = 0 ifTrue: [^ self].
(scaleFactor := RealEstateAgent scaleFactor) = 1 ifTrue: [^ self].
^ self > 4
ifTrue: [(scaleFactor * self) rounded]
ifFalse: [(scaleFactor * self) truncated]
+ "For self > 4, we recommend #rounded instead of #truncated. For smaller values, however, rounding makes no sense because we have no sub-pixel access and things would look too big too soon. Also, #scaleFactor might be a float and self is usually an integer. Thus, self should be on the right side of the multiplication to speed up the whole thing...because mixed-arithmetic seems to only be optimized this way around."!
- "For self > 4, we recommend #rounded instead of #truncated. For smaller values, however, rounding makes no sense because we have no sub-pixel access and things would look too big too soon. Also, #scaleFactor might be a float and self is usually an integer. Thus, self should be on the right side of the multiplication to speed up the whole thing."!
Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1540.mcz
==================== Summary ====================
Name: Kernel-mt.1540
Author: mt
Time: 7 December 2023, 6:27:07.742165 pm
UUID: ba67389c-7503-cf43-aacf-7f2b355eacd2
Ancestors: Kernel-mt.1539
To make use of #sendTo: support in messages sends, also provide receiver-less protocol for instance creation.
Please see the comment in MessageSend >> #asMessage.
Yes, we can still discuss and change this back if there are strong arguments against having receiver-less support for message sends. To my understanding, Message is too low-level and can have that lookupClass side effect for #sentTo:. Clients are better off using message-send objects.
=============== Diff against Kernel-mt.1539 ===============
Item was added:
+ ----- Method: MessageSend class>>selector: (in category 'instance creation - message') -----
+ selector: aSymbol
+ "Convenience for message protocol, i.e., #sendTo:".
+
+ ^ self selector: aSymbol arguments: #()!
Item was added:
+ ----- Method: MessageSend class>>selector:argument: (in category 'instance creation - message') -----
+ selector: aSymbol argument: aParameter
+ "Convenience for message protocol, i.e., #sendTo:".
+
+ ^ self selector: aSymbol arguments: {aParameter}!
Item was added:
+ ----- Method: MessageSend class>>selector:arguments: (in category 'instance creation - message') -----
+ selector: aSymbol arguments: anArray
+ "Convenience for message protocol, i.e., #sendTo:".
+
+ ^ self new
+ selector: aSymbol;
+ arguments: anArray;
+ yourself!
Item was added:
+ ----- Method: WeakMessageSend class>>selector: (in category 'instance creation - message') -----
+ selector: aSymbol
+ "Convenience for message protocol, i.e., #sendTo:".
+
+ ^ self selector: aSymbol arguments: #()
+ !
Item was added:
+ ----- Method: WeakMessageSend class>>selector:argument: (in category 'instance creation - message') -----
+ selector: aSymbol argument: aParameter
+ "Convenience for message protocol, i.e., #sendTo:".
+
+ ^ self selector: aSymbol arguments: {aParameter}!
Item was added:
+ ----- Method: WeakMessageSend class>>selector:arguments: (in category 'instance creation - message') -----
+ selector: aSymbol arguments: anArray
+ "Convenience for message protocol, i.e., #sendTo:".
+
+ ^ self new
+ selector: aSymbol;
+ arguments: anArray;
+ yourself!
Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.1242.mcz
==================== Summary ====================
Name: Tools-mt.1242
Author: mt
Time: 7 December 2023, 2:35:42.117684 pm
UUID: 30554d32-bbf8-9d49-a42c-1f453746a8cf
Ancestors: Tools-mt.1241
For the title of object-explorer windows, reuse #asExplorerString instead of deciding for something inconsistent with how those objects are normally represented in that tool's tree view.
=============== Diff against Tools-mt.1241 ===============
Item was changed:
----- Method: ObjectExplorer>>labelString (in category 'accessing') -----
labelString
+ ^ [self rootObject asExplorerString] ifError: ['a ' , self rootObject class]!
- ^ [self rootObject printStringLimitedTo: 40] ifError: ['a ' , self rootObject class]!
Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ct.1022.mcz
==================== Summary ====================
Name: Collections-ct.1022
Author: ct
Time: 21 October 2022, 2:24:04.563911 pm
UUID: 6c7815e3-3bf9-be4b-a8cb-ae2373cb6658
Ancestors: Collections-nice.1021
Proposal: Adds PositionableStream>>#peek:. The implementation is taken from Damien Cassou (dc). [1]
[1] https://github.com/hpi-swa/Squot/blob/4bf8e3b685ef9cbc195b7eca77d53a482833b…
=============== Diff against Collections-nice.1021 ===============
Item was added:
+ ----- Method: PositionableStream>>peek: (in category 'accessing') -----
+ peek: anInteger
+ "Answer what would be returned if the message next: anInteger were sent to the receiver. If the receiver has less than anInteger more elements, only answer so many elements as available."
+
+ | oldPosition result |
+ oldPosition := position.
+ result := self next: anInteger.
+ position := oldPosition.
+ ^ result!
Vanessa Freudenberg uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-codefrau.1437.mcz
==================== Summary ====================
Name: System-codefrau.1437
Author: codefrau
Time: 6 December 2023, 5:36:49.489134 pm
UUID: e437daf4-9ac8-4645-85b0-e285113f09ab
Ancestors: System-mt.1436
Reset WordSize on snapshot, for VMs capable of converting the image between 64 and 32 bits (like SqueakJS).
=============== Diff against System-mt.1436 ===============
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."
+ EndianCache := WordSize := PlatformNameCache := nil.!
- EndianCache := PlatformNameCache := nil.!