[Vm-dev] VM Maker: VMMaker.oscog-eem.3252.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Sep 5 19:03:20 UTC 2022
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3252.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3252
Author: eem
Time: 5 September 2022, 12:02:57.424605 pm
UUID: 5066f56e-737f-44de-a9a8-91e1670f9fc0
Ancestors: VMMaker.oscog-nice.3251
Integrate a couple of fixes/clean-ups from the incremental GC branch.
=============== Diff against VMMaker.oscog-nice.3251 ===============
Item was changed:
----- Method: SpurMemoryManager>>addToFreeTree:bytes: (in category 'free space') -----
addToFreeTree: freeChunk bytes: chunkBytes
"Add freeChunk to the large free chunk tree.
For the benefit of sortedFreeObject:, answer the treeNode it is added
to, if it is added to the next list of a freeTreeNode, otherwise answer 0."
| childBytes parent child |
+ self initFreeTreeChunk: freeChunk bytes: chunkBytes.
- self assert: (self isFreeObject: freeChunk).
- self assert: chunkBytes = (self bytesInBody: freeChunk).
- self assert: chunkBytes >= (self numFreeLists * self allocationUnit).
- self
- storePointer: self freeChunkNextIndex ofFreeChunk: freeChunk withValue: 0;
- storePointer: self freeChunkPrevIndex ofFreeChunk: freeChunk withValue: 0;
- storePointer: self freeChunkParentIndex ofFreeChunk: freeChunk withValue: 0;
- storePointer: self freeChunkSmallerIndex ofFreeChunk: freeChunk withValue: 0;
- storePointer: self freeChunkLargerIndex ofFreeChunk: freeChunk withValue: 0.
"Large chunk list organized as a tree, each node of which is a list of chunks of the same size.
Beneath the node are smaller and larger blocks."
parent := 0.
child := freeLists at: 0.
[child ~= 0] whileTrue:
[childBytes := self bytesInBody: child.
"check for overlap; could write this as self oop: (self objectAfter: freeChunk) isLessThanOrEqualTo: child...
but that relies on headers being correct, etc. So keep it clumsy..."
self assert: ((self oop: freeChunk + chunkBytes - self baseHeaderSize isLessThanOrEqualTo: child)
or: [self oop: freeChunk isGreaterThanOrEqualTo: child + childBytes - self baseHeaderSize]).
childBytes = chunkBytes ifTrue: "size match; add to list at node."
[self setNextFreeChunkOf: freeChunk withValue: (self fetchPointer: self freeChunkNextIndex ofFreeChunk: child) isLilliputianSize: false.
self setNextFreeChunkOf: child withValue: freeChunk isLilliputianSize: false.
^child].
"walk down the tree"
parent := child.
child := self fetchPointer: (childBytes > chunkBytes
ifTrue: [self freeChunkSmallerIndex]
ifFalse: [self freeChunkLargerIndex])
ofFreeChunk: child].
parent = 0 ifTrue:
[self assert: (freeLists at: 0) = 0.
freeLists at: 0 put: freeChunk.
freeListsMask := freeListsMask bitOr: 1.
^0].
self assert: (freeListsMask anyMask: 1).
"insert in tree"
self storePointer: self freeChunkParentIndex
ofFreeChunk: freeChunk
withValue: parent.
self storePointer: (childBytes > chunkBytes
ifTrue: [self freeChunkSmallerIndex]
ifFalse: [self freeChunkLargerIndex])
ofFreeChunk: parent
withValue: freeChunk.
^0!
Item was changed:
----- Method: SpurMemoryManager>>indexOf:in: (in category 'debug support') -----
indexOf: anElement in: anObject
<api>
| fmt numSlots |
fmt := self formatOf: anObject.
fmt <= self lastPointerFormat ifTrue:
[numSlots := self numSlotsOf: anObject.
0 to: numSlots do:
[:i| anElement = (self fetchPointer: i ofMaybeForwardedObject: anObject) ifTrue: [^i]].
-1].
fmt >= self firstByteFormat ifTrue:
[fmt >= self firstCompiledMethodFormat ifTrue:
[^self primitiveFailFor: PrimErrUnsupported].
numSlots := self numBytesOfBytes: anObject.
0 to: numSlots do:
+ [:i| anElement = (self fetchByte: i ofObject: anObject) ifTrue: [^i]].
- [:i| (self fetchByte: i ofObject: anObject) ifTrue: [^i]].
-1].
fmt >= self firstShortFormat ifTrue:
[numSlots := self num16BitUnitsOf: anObject.
0 to: numSlots do:
[:i| anElement = (self fetchUnsignedShort16: i ofObject: anObject) ifTrue: [^i]].
-1].
fmt = self sixtyFourBitIndexableFormat ifTrue:
[numSlots := self num64BitUnitsOf: anObject.
0 to: numSlots do:
[:i| anElement = (self fetchLong64: i ofObject: anObject) ifTrue: [^i]].
-1].
fmt >= self firstLongFormat ifTrue:
[numSlots := self num32BitUnitsOf: anObject.
0 to: numSlots do:
[:i| anElement = (self fetchLong32: i ofObject: anObject) ifTrue: [^i]].
-1].
^-1!
Item was added:
+ ----- Method: SpurMemoryManager>>initFreeTreeChunk:bytes: (in category 'free space') -----
+ initFreeTreeChunk: freeChunk bytes: chunkBytes
+
+ self assert: (self isFreeObject: freeChunk).
+ self assert: chunkBytes = (self bytesInBody: freeChunk).
+ self assert: chunkBytes >= (self numFreeLists * self allocationUnit).
+ self
+ storePointer: self freeChunkNextIndex ofFreeChunk: freeChunk withValue: 0;
+ storePointer: self freeChunkPrevIndex ofFreeChunk: freeChunk withValue: 0;
+ storePointer: self freeChunkParentIndex ofFreeChunk: freeChunk withValue: 0;
+ storePointer: self freeChunkSmallerIndex ofFreeChunk: freeChunk withValue: 0;
+ storePointer: self freeChunkLargerIndex ofFreeChunk: freeChunk withValue: 0.
+ !
More information about the Vm-dev
mailing list