Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3311.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3311 Author: eem Time: 16 March 2023, 12:40:54.390562 pm UUID: 635091b8-f80a-43b2-817b-14723e9d73c2 Ancestors: VMMaker.oscog-eem.3310
Implement SpurSegmentManager>>segmentContainingObj: via binary search for the benefit of the IGC. Make stack page printing less confusing (include the baseAddress). Include a benchmark primitive to run the scavenge (we have garbageCollectMost, but the benchmark answers the time taken as measured by the high-res timer). Cull some unused simulation methods.
=============== Diff against VMMaker.oscog-eem.3310 ===============
Item was added: + ----- Method: CoInterpreterPrimitives>>primitiveBenchmarkScavenge (in category 'benchmark primitives') ----- + primitiveBenchmarkScavenge + <option: #VMBenchmarks> + <export: true> + self primitiveReturnTimeTakenFor: + [objectMemory hasSpurMemoryManagerAPI + ifTrue: [objectMemory scavengingGC] + ifFalse: [objectMemory incrementalGC]. + self integerObjectOf: (objectMemory bytesLeft: false)]!
Item was changed: ----- Method: CogStackPageSurrogate>>printOn: (in category 'printing') ----- printOn: aStream super printOn: aStream. + aStream space. + self baseAddress printOn: aStream base: 16. + aStream nextPut: $@. + aStream space; print: address; nextPut: $/. - aStream nextPut: $@; print: address; nextPut: $/. address printOn: aStream base: 16!
Item was removed: - ----- Method: CogVMSimulator>>sqMemoryExtraBytesLeft: (in category 'memory access') ----- - sqMemoryExtraBytesLeft: includingSwap - ^0!
Item was removed: - ----- Method: InterpreterSimulator>>sqMemoryExtraBytesLeft: (in category 'memory access') ----- - sqMemoryExtraBytesLeft: includingSwap - ^0!
Item was changed: ----- Method: SpurSegmentManager>>segmentContainingObj: (in category 'accessing') ----- segmentContainingObj: objOop + "Answer the segment containing an object. This is mostly for assert checking, but + variations on the incremental GC may use it in anger. Binary search is (of course) + marginally slower than linear search for a single segment (e.g. in a 720k object heap, + 67.1ms vs 61.3ms, or 9.5% slower to derive the segment containing every old space + entity), but usefully faster for many segments (e.g. 92.7ms vs 116ms, or 20% faster + in the same heap extended with enough large arrays to require 11 segments; and this + is pessimal; there are fewer objects at high addresses since the large arrays are there)." <export: true> <returnTypeC: #'SpurSegmentInfo *'> + | high low mid seg | + low := 0. mid := numSegments // 2. high := numSegments - 1. + [seg := segments at: mid. + (self oop: objOop isGreaterThanOrEqualTo: seg segStart) + ifTrue: + [mid = high + ifTrue: + [^(self oop: objOop isLessThan: seg segLimit) ifTrue: + [seg]] + ifFalse: + [low := mid. + mid := mid + high + 1 // 2]] + ifFalse: + [high := mid - 1. + mid := low + mid // 2]. + low <= high] whileTrue. - numSegments - 1 to: 0 by: -1 do: - [:i| - objOop >= (segments at: i) segStart ifTrue: - [^self addressOf: (segments at: i)]]. ^nil!
Item was removed: - ----- Method: StackInterpreterSimulator>>sqMemoryExtraBytesLeft: (in category 'memory access') ----- - sqMemoryExtraBytesLeft: includingSwap - ^0!
Hi Eliot (eem), hi Tom (WoC) --
Note that implicit int conversions (-Wint-conversion) are errors (!) these days.
For example in SpurSegmentManager >> #segmentContainingObj:, the expression
seg := segments at: mid.
will not (always) compile because the types "int" and "SpurSegmentInfo*" must match or be casted explicitely.
Here is an exemplary compiler error (MSYS2, clang 15.0.5):
... ../../../src/spur32.cog/gcc3x-cointerp.c:61910:7: error: assigning to 'sqInt' (aka 'int') from incompatible type 'SpurSegmentInfo' seg = GIV(segments)[mid]; ^ ~~~~~~~~~~~~~~~~~~ ...
Best, Marcel Am 16.03.2023 20:42:00 schrieb commits@source.squeak.org commits@source.squeak.org:
Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3311.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3311 Author: eem Time: 16 March 2023, 12:40:54.390562 pm UUID: 635091b8-f80a-43b2-817b-14723e9d73c2 Ancestors: VMMaker.oscog-eem.3310
Implement SpurSegmentManager>>segmentContainingObj: via binary search for the benefit of the IGC. Make stack page printing less confusing (include the baseAddress). Include a benchmark primitive to run the scavenge (we have garbageCollectMost, but the benchmark answers the time taken as measured by the high-res timer). Cull some unused simulation methods.
=============== Diff against VMMaker.oscog-eem.3310 ===============
Item was added: + ----- Method: CoInterpreterPrimitives>>primitiveBenchmarkScavenge (in category 'benchmark primitives') ----- + primitiveBenchmarkScavenge + + + self primitiveReturnTimeTakenFor: + [objectMemory hasSpurMemoryManagerAPI + ifTrue: [objectMemory scavengingGC] + ifFalse: [objectMemory incrementalGC]. + self integerObjectOf: (objectMemory bytesLeft: false)]!
Item was changed: ----- Method: CogStackPageSurrogate>>printOn: (in category 'printing') ----- printOn: aStream super printOn: aStream. + aStream space. + self baseAddress printOn: aStream base: 16. + aStream nextPut: $@. + aStream space; print: address; nextPut: $/. - aStream nextPut: $@; print: address; nextPut: $/. address printOn: aStream base: 16!
Item was removed: - ----- Method: CogVMSimulator>>sqMemoryExtraBytesLeft: (in category 'memory access') ----- - sqMemoryExtraBytesLeft: includingSwap - ^0!
Item was removed: - ----- Method: InterpreterSimulator>>sqMemoryExtraBytesLeft: (in category 'memory access') ----- - sqMemoryExtraBytesLeft: includingSwap - ^0!
Item was changed: ----- Method: SpurSegmentManager>>segmentContainingObj: (in category 'accessing') ----- segmentContainingObj: objOop + "Answer the segment containing an object. This is mostly for assert checking, but + variations on the incremental GC may use it in anger. Binary search is (of course) + marginally slower than linear search for a single segment (e.g. in a 720k object heap, + 67.1ms vs 61.3ms, or 9.5% slower to derive the segment containing every old space + entity), but usefully faster for many segments (e.g. 92.7ms vs 116ms, or 20% faster + in the same heap extended with enough large arrays to require 11 segments; and this + is pessimal; there are fewer objects at high addresses since the large arrays are there)."
+ | high low mid seg | + low := 0. mid := numSegments // 2. high := numSegments - 1. + [seg := segments at: mid. + (self oop: objOop isGreaterThanOrEqualTo: seg segStart) + ifTrue: + [mid = high + ifTrue: + [^(self oop: objOop isLessThan: seg segLimit) ifTrue: + [seg]] + ifFalse: + [low := mid. + mid := mid + high + 1 // 2]] + ifFalse: + [high := mid - 1. + mid := low + mid // 2]. + low <= high] whileTrue. - numSegments - 1 to: 0 by: -1 do: - [:i| - objOop >= (segments at: i) segStart ifTrue: - [^self addressOf: (segments at: i)]]. ^nil!
Item was removed: - ----- Method: StackInterpreterSimulator>>sqMemoryExtraBytesLeft: (in category 'memory access') ----- - sqMemoryExtraBytesLeft: includingSwap - ^0!
vm-dev@lists.squeakfoundation.org