Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3060.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3060
Author: eem
Time: 6 September 2021, 7:40:34.416094 pm
UUID: 638e8714-df7b-4450-85ee-b5093d25822d
Ancestors: VMMaker.oscog-eem.3059
Fix a regression in image segment loading introduced by VMMaker.oscog-eem.2819. The old image segment array shortening code created a header ambiguous with a slimbridge if the array was in new space. In this case we also have to shorten the array's normal slot count so its header is taken as a slimbridge.
=============== Diff against VMMaker.oscog-eem.3059 ===============
Item was changed:
----- Method: Spur32BitMemoryManager>>objectAfterMaybeSlimBridge:limit: (in category 'object enumeration-private') -----
objectAfterMaybeSlimBridge: objOop limit: limit
"Object parsing.
1. all objects have at least a word following the header, for a forwarding pointer.
2. objects with an overflow size have a preceding word with a saturated numSlots. If the word
following an object doesn't have a saturated numSlots field it must be a single-header object.
If the word following does have a saturated numSlots it must be the overflow size word.
This variation on objectAfter:limit: allows for a single (64-bit) word bridge which may be needed
to bridge from an almost full pastSpace to eden. It is only used in the flat enumerators that use
startAddressForBridgedHeapEnumeration and enumerate over pastSpace, eden and oldSpace
in that order. Note that the order for allObjects, and allInstances enumerates over oldSpace first.
This hack is cheap. It increases the size of the objectAfter code, but saves two extra copies of
the inner loop, since the inner loop now enumerates over all of pastSpace, eden and oldSpace.
The test for a slim bridge is only performed if applied to an overflow header, and typically only
+ 1 in 400 objects have overflow headers in 32-bits, 1 in 500 in 64-bits. The complication is that
- 1 in 400 objects have overflow headers in 32-bits, 1 in 500 in 64-bits. The complication is that
image segment loading evaporates the word array by setting the overflow slots to 1, and this
+ is ambiguous with a slimbridge. The resolution is that if the segmentArray has an overflow header,
+ and is in new space, then it slot size can be zeroed and its overflow header changed to a slimbridge."
- is ambiguous with a slimbridge. The resolution is that slimbridges are used only in new space."
<inline: true>
| followingWordAddress followingWord |
followingWordAddress := self addressAfter: objOop.
(self oop: followingWordAddress isGreaterThanOrEqualTo: limit) ifTrue:
[^limit].
self flag: #endianness.
followingWord := self longAt: followingWordAddress + 4.
^followingWord >> self numSlotsHalfShift = self numSlotsMask
ifTrue: [((self oop: objOop isLessThan: oldSpaceStart)
and: [1 = (self longAt: followingWordAddress)]) "i.e. the raw overflow slots in the overflow word"
ifTrue: [followingWordAddress + self baseHeaderSize + self baseHeaderSize] "skip the one word slimbridge"
ifFalse: [followingWordAddress + self baseHeaderSize]]
ifFalse: [followingWordAddress]!
Item was changed:
----- Method: Spur64BitMemoryManager>>objectAfterMaybeSlimBridge:limit: (in category 'object enumeration-private') -----
objectAfterMaybeSlimBridge: objOop limit: limit
"Object parsing.
1. all objects have at least a word following the header, for a forwarding pointer.
2. objects with an overflow size have a preceding word with a saturated numSlots. If the word
following an object doesn't have a saturated numSlots field it must be a single-header object.
If the word following does have a saturated numSlots it must be the overflow size word.
This variation on objectAfter:limit: allows for a single (64-bit) word bridge which may be needed
to bridge from an almost full pastSpace to eden. It is only used in the flat enumerators that use
startAddressForBridgedHeapEnumeration and enumerate over pastSpace, eden and oldSpace
in that order. Note that the order for allObjects, and allInstances enumerates over oldSpace first.
This hack is cheap. It increases the size of the objectAfter code, but saves two extra copies of
the inner loop, since the inner loop now enumerates over all of pastSpace, eden and oldSpace.
The test for a slim bridge is only performed if applied to an overflow header, and typically only
1 in 400 objects have overflow headers in 32-bits, 1 in 500 in 64-bits. The complication is that
image segment loading evaporates the word array by setting the overflow slots to 1, and this
+ is ambiguous with a slimbridge. The resolution is that if the segmentArray has an overflow header,
+ and is in new space, then it slot size can be zeroed and its overflow header changed to a slimbridge."
- is ambiguous with a slimbridge. The resolution is that slimbridges are used only in new space."
<inline: true>
| followingWordAddress followingWord |
followingWordAddress := self addressAfter: objOop.
(self oop: followingWordAddress isGreaterThanOrEqualTo: limit) ifTrue:
[^limit].
self flag: #endianness.
followingWord := self longAt: followingWordAddress.
^followingWord >> self numSlotsFullShift = self numSlotsMask
ifTrue:
[((self oop: objOop isLessThan: oldSpaceStart)
and: [(followingWord bitAnd: 16rFFFFFFFFFFFFFF) = 1])
ifTrue: [followingWordAddress + self baseHeaderSize + self baseHeaderSize] "skip the one word slimbridge"
ifFalse: [followingWordAddress + self baseHeaderSize]]
ifFalse: [followingWordAddress]!
Item was changed:
----- Method: SpurMemoryManager>>loadImageSegmentFrom:outPointers: (in category 'image segment in/out') -----
loadImageSegmentFrom: segmentWordArray outPointers: outPointerArray
"This primitive is called from Smalltalk as...
<imageSegment> loadSegmentFrom: aWordArray outPointers: anArray."
"This primitive will load a binary image segment created by primitiveStoreImageSegment.
It expects the outPointer array to be of the proper size, and the wordArray to be well formed.
It will return as its value the original array of roots, and the segmentWordArray will become an
array of the loaded objects. If this primitive should fail, the segmentWordArray will, sadly, have
been reduced to an unrecognizable and unusable jumble. But what more could you have done
with it anyway?
The primitive, if it succeeds, also becomes the segmentWordArray into the array of loaded objects.
This allows fixing up of loaded objects directly, without nextObject, which Spur doesn't support."
<inline: #never>
| segmentLimit segmentStart segVersion errorCode numLoadedObjects loadedObjectsArray |
segmentLimit := self numSlotsOf: segmentWordArray.
(self objectBytesForSlots: segmentLimit) < (self allocationUnit "version info" + self baseHeaderSize "one object header") ifTrue:
[^PrimErrBadArgument halt].
"Verify format. If the format is wrong, word-swap (since ImageSegment data are 32-bit longs).
If it is still wrong, undo the damage and fail."
segVersion := self longAt: segmentWordArray + self baseHeaderSize.
(coInterpreter readableFormat: (segVersion bitAnd: 16rFFFFFF "low 3 bytes")) ifFalse:
[self reverseBytesIn32BitWordsIn: segmentWordArray.
segVersion := self longAt: segmentWordArray + self baseHeaderSize.
(coInterpreter readableFormat: (segVersion bitAnd: 16rFFFFFF "low 3 bytes")) ifFalse:
[self reverseBytesIn32BitWordsIn: segmentWordArray.
^PrimErrBadArgument halt]].
segmentStart := segmentWordArray + self baseHeaderSize + self allocationUnit.
segmentLimit := segmentLimit * self bytesPerOop + segmentWordArray + self baseHeaderSize.
"Notionally reverse the Byte type objects if the data is from opposite endian machine.
Test top byte. $d on the Mac or $s on the PC. Rest of word is equal. If Spur is ever
ported to big-endian machines then the segment may have to be byte/word swapped,
but so far it only runs on little-endian machines, so for now just fail if endianness is wrong."
self flag: #endianness.
(segVersion >> 24 bitAnd: 16rFF) ~= (self imageSegmentVersion >> 24 bitAnd: 16rFF) ifTrue:
"Reverse the byte-type objects once"
[true
ifTrue: [^PrimErrBadArgument halt]
ifFalse:
[self byteSwapByteObjectsFrom: (self objectStartingAt: segmentStart)
to: segmentLimit
flipFloatsIf: false]].
"Avoid having to remember by arranging that there are no young outPointers if segment is in old space."
(self isOldObject: segmentWordArray) ifTrue:
[errorCode := self ensureNoNewObjectsIn: outPointerArray.
errorCode ~= 0 ifTrue:
[^errorCode]].
"scan through mapping oops and validating class references. Defer entering any
class objects into the class table and/or pinning objects until a second pass."
errorCode := self mapOopsAndValidateClassRefsFrom: segmentStart to: segmentLimit outPointers: outPointerArray.
errorCode > 0 ifTrue:
[^errorCode].
numLoadedObjects := errorCode negated.
loadedObjectsArray := self allocateSlots: numLoadedObjects format: self arrayFormat classIndex: ClassArrayCompactIndex.
loadedObjectsArray ifNil:
[^PrimErrNoMemory halt].
"Scan for classes contained in the segment, entering them into the class table.
Classes are at the front, after the root array and have the remembered bit set."
errorCode := self enterClassesIntoClassTableFrom: segmentStart to: segmentLimit.
errorCode ~= 0 ifTrue:
[^errorCode].
"Make a final pass, assigning class indices and/or pinning pinned objects and collecting the loaded objects in loadedObjectsArray"
self assignClassIndicesAndPinFrom: segmentStart to: segmentLimit outPointers: outPointerArray filling: loadedObjectsArray.
"Evaporate the container, leaving the newly loaded objects in place."
(self hasOverflowHeader: segmentWordArray)
+ ifTrue: "N.B. setting the overflow slots to 1 creates a slimbridge in eden, so we also need to delete the overflow slot count in the segment itself"
+ [(self oop: segmentWordArray isLessThan: oldSpaceStart)
+ ifTrue:
+ [self rawOverflowSlotsOf: segmentWordArray put: 0.
+ self rawNumSlotsOf: segmentWordArray put: 0]
+ ifFalse:
+ [self rawOverflowSlotsOf: segmentWordArray put: self allocationUnit / self bytesPerOop]]
- ifTrue: [self rawOverflowSlotsOf: segmentWordArray put: self allocationUnit / self bytesPerOop]
ifFalse: [self rawNumSlotsOf: segmentWordArray put: self allocationUnit / self bytesPerOop].
"Finally forward the segmentWordArray to the loadedObjectsArray"
self forward: segmentWordArray to: loadedObjectsArray.
self runLeakCheckerFor: GCCheckImageSegment.
^self objectStartingAt: segmentStart!
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: f5f0e7d98effd7217dded6ed9397b2cac1f787ad
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/f5f0e7d98effd7217d…
Author: Tim Rowledge <tim(a)rowledge.org>
Date: 2021-09-06 (Mon, 06 Sep 2021)
Changed paths:
M building/linux64ARMv8/squeak.cog.spur/build/mvm
A platforms/Cross/plugins/BitBltPlugin/BitBltArm64.c
A platforms/Cross/plugins/BitBltPlugin/BitBltArm64.h
M platforms/Cross/plugins/BitBltPlugin/BitBltArmSimdAsm.hdr
M platforms/Cross/plugins/BitBltPlugin/BitBltDispatch.c
M platforms/Cross/plugins/BitBltPlugin/BitBltDispatch.h
M platforms/Cross/plugins/BitBltPlugin/BitBltGeneric.c
M platforms/Cross/plugins/BitBltPlugin/BitBltInternal.h
M platforms/unix/config/configure
M platforms/unix/plugins/BitBltPlugin/acinclude.m4
Log Message:
-----------
ARMv8 BitBLT enhancements from Ben Avison, plus include order fixes
Add in Ben's BitBLT improvements for AMRv8, plus some more generic BLT improvements for ARMv6 , re-worked a little to handle the include-order changes
Co-Authored-By: bavison <3324657+bavison(a)users.noreply.github.com>
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: 70cd4bd06d8eb27c66946abf13e72586399eb83a
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/70cd4bd06d8eb27c66…
Author: Tim Rowledge <tim(a)rowledge.org>
Date: 2021-09-06 (Mon, 06 Sep 2021)
Changed paths:
A build.linux64ARMv8/squeak.cog.spur/build/mvm
A platforms/Cross/plugins/BitBltPlugin/BitBltArm64.c
A platforms/Cross/plugins/BitBltPlugin/BitBltArm64.h
M platforms/Cross/plugins/BitBltPlugin/BitBltArmSimdAsm.hdr
M platforms/Cross/plugins/BitBltPlugin/BitBltArmSimdSourceWord.s
M platforms/Cross/plugins/BitBltPlugin/BitBltDispatch.c
M platforms/Cross/plugins/BitBltPlugin/BitBltDispatch.h
M platforms/Cross/plugins/BitBltPlugin/BitBltGeneric.c
M platforms/Cross/plugins/BitBltPlugin/BitBltInternal.h
M platforms/unix/config/configure
M platforms/unix/plugins/BitBltPlugin/acinclude.m4
Log Message:
-----------
ARMv8 BitBLT enhancements from Ben Avison, plus include order fixes
Add in Ben's BitBLT improvements for AMRv8, plus some more generic BLT improvements for ARMv6 , re-worked a little to handle the include-order changes
Co-Authored-By: bavison <3324657+bavison(a)users.noreply.github.com>
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: f1108f586f49b5f4e78be066337891af0bfd83e8
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/f1108f586f49b5f4e7…
Author: Tim Rowledge <tim(a)rowledge.org>
Date: 2021-09-06 (Mon, 06 Sep 2021)
Changed paths:
R build.linux64ARMv8/squeak.cog.spur/build/mvm
R platforms/Cross/plugins/BitBltPlugin/BitBltArm64.c
R platforms/Cross/plugins/BitBltPlugin/BitBltArm64.h
M platforms/Cross/plugins/BitBltPlugin/BitBltArmSimdAsm.hdr
M platforms/Cross/plugins/BitBltPlugin/BitBltArmSimdSourceWord.s
M platforms/Cross/plugins/BitBltPlugin/BitBltDispatch.c
M platforms/Cross/plugins/BitBltPlugin/BitBltDispatch.h
M platforms/Cross/plugins/BitBltPlugin/BitBltGeneric.c
M platforms/Cross/plugins/BitBltPlugin/BitBltInternal.h
M platforms/unix/config/configure
M platforms/unix/plugins/BitBltPlugin/acinclude.m4
Log Message:
-----------
Revert "ARMv8 BitBLT enhancements from Ben Avison, plus include order fixes"
This reverts commit 70cd4bd06d8eb27c66946abf13e72586399eb83a.
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: 015a1114b5b9c59fe64d4306ce6a8e36a684429d
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/015a1114b5b9c59fe6…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2021-09-05 (Sun, 05 Sep 2021)
Changed paths:
M src/plugins/FFTPlugin/FFTPlugin.c
M src/spur32.cog.lowcode/cogit.h
M src/spur32.cog.lowcode/cogitARMv5.c
M src/spur32.cog.lowcode/cogitIA32.c
M src/spur32.cog.lowcode/cointerp.c
M src/spur32.cog.lowcode/cointerp.h
R src/spur32.cog.lowcode/examplePlugins.ext
R src/spur32.cog.lowcode/examplePlugins.int
M src/spur32.cog.lowcode/gcc3x-cointerp.c
R src/spur32.cog.newspeak/examplePlugins.ext
R src/spur32.cog.newspeak/examplePlugins.int
M src/spur32.cog/cogit.h
M src/spur32.cog/cogitARMv5.c
M src/spur32.cog/cogitIA32.c
M src/spur32.cog/cointerp.c
M src/spur32.cog/cointerp.h
M src/spur32.cog/cointerpmt.c
M src/spur32.cog/cointerpmt.h
R src/spur32.cog/examplePlugins.ext
R src/spur32.cog/examplePlugins.int
M src/spur32.cog/gcc3x-cointerp.c
M src/spur32.cog/gcc3x-cointerpmt.c
M src/spur32.sista/cogit.h
M src/spur32.sista/cogitARMv5.c
M src/spur32.sista/cogitIA32.c
M src/spur32.sista/cointerp.c
M src/spur32.sista/cointerp.h
R src/spur32.sista/examplePlugins.ext
R src/spur32.sista/examplePlugins.int
M src/spur32.sista/gcc3x-cointerp.c
R src/spur32.stack.lowcode/examplePlugins.ext
R src/spur32.stack.lowcode/examplePlugins.int
M src/spur32.stack.lowcode/gcc3x-interp.c
M src/spur32.stack.lowcode/interp.c
R src/spur32.stack.newspeak/examplePlugins.ext
R src/spur32.stack.newspeak/examplePlugins.int
R src/spur32.stack/examplePlugins.ext
R src/spur32.stack/examplePlugins.int
M src/spur32.stack/gcc3x-interp.c
M src/spur32.stack/interp.c
M src/spur32.stack/validImage.c
M src/spur64.cog.lowcode/cogit.h
M src/spur64.cog.lowcode/cogitARMv8.c
M src/spur64.cog.lowcode/cogitX64SysV.c
M src/spur64.cog.lowcode/cogitX64WIN64.c
M src/spur64.cog.lowcode/cointerp.c
M src/spur64.cog.lowcode/cointerp.h
R src/spur64.cog.lowcode/examplePlugins.ext
R src/spur64.cog.lowcode/examplePlugins.int
M src/spur64.cog.lowcode/gcc3x-cointerp.c
R src/spur64.cog.newspeak/examplePlugins.ext
R src/spur64.cog.newspeak/examplePlugins.int
M src/spur64.cog/cogit.h
M src/spur64.cog/cogitARMv8.c
M src/spur64.cog/cogitX64SysV.c
M src/spur64.cog/cogitX64WIN64.c
M src/spur64.cog/cointerp.c
M src/spur64.cog/cointerp.h
M src/spur64.cog/cointerpmt.c
M src/spur64.cog/cointerpmt.h
R src/spur64.cog/examplePlugins.ext
R src/spur64.cog/examplePlugins.int
M src/spur64.cog/gcc3x-cointerp.c
M src/spur64.cog/gcc3x-cointerpmt.c
M src/spur64.sista/cogit.h
M src/spur64.sista/cogitARMv8.c
M src/spur64.sista/cogitX64SysV.c
M src/spur64.sista/cogitX64WIN64.c
M src/spur64.sista/cointerp.c
M src/spur64.sista/cointerp.h
R src/spur64.sista/examplePlugins.ext
R src/spur64.sista/examplePlugins.int
M src/spur64.sista/gcc3x-cointerp.c
R src/spur64.stack.lowcode/examplePlugins.ext
R src/spur64.stack.lowcode/examplePlugins.int
M src/spur64.stack.lowcode/gcc3x-interp.c
M src/spur64.stack.lowcode/interp.c
R src/spur64.stack.newspeak/examplePlugins.ext
R src/spur64.stack.newspeak/examplePlugins.int
R src/spur64.stack/examplePlugins.ext
R src/spur64.stack/examplePlugins.int
M src/spur64.stack/gcc3x-interp.c
M src/spur64.stack/interp.c
M src/spur64.stack/validImage.c
M src/v3.cog/cogit.h
M src/v3.cog/cogitARMv5.c
M src/v3.cog/cogitIA32.c
M src/v3.cog/cointerp.c
M src/v3.cog/cointerp.h
R src/v3.cog/examplePlugins.ext
R src/v3.cog/examplePlugins.int
M src/v3.cog/gcc3x-cointerp.c
R src/v3.stack/examplePlugins.ext
R src/v3.stack/examplePlugins.int
M src/v3.stack/gcc3x-interp.c
M src/v3.stack/interp.c
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.3058
Leak Checking: replace all sends of cr and/or eek in the leak checking printing
with a send of eekcr, implemented in StackInterpreter as a never inlined method,
suitable for placing a breakpoint on.
Slang: fix multiple NeverInline function attributes.
Oops; VMMaker.oscog-eem.3051 regressed primitiveSetOrHasIdentityHash; remember
to convert from SmallInteger to inetger and validate the hash is in range.
FFTPlugin: mark primitives with FastCPrimitiveFlag &
FastCPrimitiveAlignForFloatsFlag. Save a few cycles in marshalling.
Nuke the duplicated examplePlugins.ext/int, leaving src/examplePlugins.ext/int
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3057.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3057
Author: eem
Time: 5 September 2021, 6:45:35.1444 pm
UUID: 6b8c61a5-14be-45c1-affd-a59a0c6a668d
Ancestors: VMMaker.oscog-eem.3056
Leak checking: eek is as useful (as a breakpoint) in production as in the simulator.
=============== Diff against VMMaker.oscog-eem.3056 ===============
Item was changed:
ObjectMemory subclass: #NewObjectMemory
+ instanceVariableNames: 'coInterpreter freeStart reserveStart scavengeThreshold needGCFlag edenBytes checkForLeaks statGCEndUsecs heapMap leakDetected'
- instanceVariableNames: 'coInterpreter freeStart reserveStart scavengeThreshold needGCFlag edenBytes checkForLeaks statGCEndUsecs heapMap'
classVariableNames: ''
poolDictionaries: ''
category: 'VMMaker-Interpreter'!
!NewObjectMemory commentStamp: '<historical>' prior: 0!
I am a refinement of ObjectMemory that eliminates the need for pushRemappableOop:/popRemappableOop in the interpreter proper. Certain primitives that do major allocation may still want to provoke a garbage collection and hence may still need to remap private pointers. But the interpreter subclass of this class does not have to provided it reserves sufficient space for it to make progress to the next scavenge point (send or backward branch).!
Item was changed:
----- Method: NewObjectMemory class>>mustBeGlobal: (in category 'translation') -----
mustBeGlobal: var
"Answer if a variable must be global and exported. Used for inst vars that are accessed from VM support code."
^(super mustBeGlobal: var)
+ or: [#('checkForLeaks' 'leakDetected') includes: var]!
- or: ['checkForLeaks' = var]!
Item was changed:
----- Method: NewObjectMemory>>eek (in category 'memory access') -----
eek
+ <inline: #never>
+ leakDetected := true!
- <inline: true>!
Item was changed:
----- Method: NewObjectMemory>>initialize (in category 'initialization') -----
initialize
"Initialize NewObjectMemory when simulating the VM inside Smalltalk."
super initialize.
checkForLeaks := 0.
+ needGCFlag := leakDetected := false.
- needGCFlag := false.
heapMap := CogCheck32BitHeapMap new!
Item was changed:
CogClass subclass: #SpurMemoryManager
(excessive size, no diff calculated)
Item was changed:
----- Method: SpurMemoryManager class>>mustBeGlobal: (in category 'translation') -----
mustBeGlobal: var
"Answer if a variable must be global and exported. Used for inst vars that are accessed from VM support code."
+ ^#('checkForLeaks' 'maxOldSpaceSize' 'leakDetected') includes: var!
- ^#('checkForLeaks' 'maxOldSpaceSize') includes: var!
Item was changed:
----- Method: SpurMemoryManager>>eek (in category 'debug support') -----
eek
+ <inline: #never>
+ leakDetected := true!
- <inline: true>!
Item was changed:
----- Method: SpurMemoryManager>>initialize (in category 'initialization') -----
initialize
"We can put all initializations that set something to 0 or to false here.
In C all global variables are initialized to 0, and 0 is false."
| moreThanEnough |
remapBuffer := Array new: RemapBufferSize.
remapBufferCount := extraRootCount := 0. "see below"
freeListsMask := totalFreeOldSpace := lowSpaceThreshold := 0.
checkForLeaks := 0.
+ needGCFlag := signalLowSpace := marking := leakDetected := false.
- needGCFlag := signalLowSpace := marking := false.
becomeEffectsFlags := gcPhaseInProgress := validatedIntegerClassFlags := 0.
statScavenges := statIncrGCs := statFullGCs := 0.
statMaxAllocSegmentTime := 0.
statMarkUsecs := statSweepUsecs := statScavengeGCUsecs := statIncrGCUsecs := statFullGCUsecs := statCompactionUsecs := statGCEndUsecs := gcSweepEndUsecs := 0.
statSGCDeltaUsecs := statIGCDeltaUsecs := statFGCDeltaUsecs := 0.
statGrowMemory := statShrinkMemory := statRootTableCount := statAllocatedBytes := 0.
statRootTableOverflows := statMarkCount := statCompactPassCount := statCoalesces := 0.
"We can initialize things that are allocated but are lazily initialized."
unscannedEphemerons := SpurContiguousObjStack new.
"we can initialize things that are virtual in C."
scavenger := SpurGenerationScavenger simulatorClass new manager: self; yourself.
segmentManager := SpurSegmentManager simulatorClass new manager: self; yourself.
compactor := self class compactorClass simulatorClass new manager: self; yourself.
"We can also initialize here anything that is only for simulation."
heapMap := CogCheck32BitHeapMap new.
"N.B. We *don't* initialize extraRoots because we don't simulate it."
"This is needed on 64-bits. We don't want a simulation creating a huge heap by default.
By default use 512Mb on 64-bits, 256Mb on 32-bits."
moreThanEnough := 1024 * 1024 * 1024 / (16 / self wordSize). "One million dollars, ha ha ha ha ha,... ha, ha ha ha ha, ..."
maxOldSpaceSize := self class initializationOptions
ifNotNil: [:initOpts| initOpts at: #maxOldSpaceSize ifAbsent: [moreThanEnough]]
ifNil: [moreThanEnough]!