[Vm-dev] VM Maker: VMMaker.oscog-eem.2791.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Aug 20 01:21:14 UTC 2020
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2791.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2791
Author: eem
Time: 19 August 2020, 6:21:04.014485 pm
UUID: 04cdce33-b4a9-4acb-982e-ed9393a1783b
Ancestors: VMMaker.oscog-eem.2790
Looking at class indentityHash distributions in my current VMMaker image it is clear that setting the classTableIndex to point at the start of the last used page is not a good strategy, and leads to far too sparse a class table. So change the policy and set the classTableIndex to the first unused slot (unless bootstrapping).
=============== Diff against VMMaker.oscog-eem.2790 ===============
Item was changed:
----- Method: SpurMemoryManager>>setHiddenRootsObj: (in category 'class table') -----
setHiddenRootsObj: anOop
hiddenRootsObj := anOop.
self cCode: [self assert: self validClassTableRootPages]
inSmalltalk: [numClassTablePages ifNotNil:
[self assert: self validClassTableRootPages]].
classTableFirstPage := self fetchPointer: 0 ofObject: hiddenRootsObj.
self assert: (self numSlotsOf: classTableFirstPage) - 1 = self classTableMinorIndexMask.
"Hack fix. A bug in markAndTraceClassOf: caused the class of the first class table page
to be changed from its pun. This can be restored manually, but we do it here too."
self flag: 'remove at some stage'.
(self classIndexOf: classTableFirstPage) ~= self arrayClassIndexPun ifTrue:
[self setClassIndexOf: classTableFirstPage to: self arrayClassIndexPun].
- "Set classTableIndex to the start of the last used page (excepting first page).
- Set numClassTablePages to the number of used pages."
numClassTablePages := self classTableRootSlots.
+ self bootstrapping ifTrue:
+ ["Set classTableIndex to the start of the last used page (excepting first page).
+ Set numClassTablePages to the number of used pages."
+ 2 to: numClassTablePages - 1 do:
+ [:i|
+ (self fetchPointer: i ofObject: hiddenRootsObj) = nilObj ifTrue:
+ [numClassTablePages := i.
+ classTableIndex := (i - 1 max: 1) << self classTableMajorIndexShift.
+ ^self]].
+ "no unused pages; set it to the start of the second page."
+ classTableIndex := 1 << self classTableMajorIndexShift.
+ ^self].
+ "If loading an image, set the classTableIndex to the first unused slot in the class table after the first page.
+ Set numClassTablePages to the number of used pages.
+ Set classTableIndex to point at the first unused entry. First set it to the max as a sentinel."
+ classTableIndex := numClassTablePages << self classTableMajorIndexShift.
+ 1 to: numClassTablePages - 1 do:
+ [:i| | page j |
+ (page := self fetchPointer: i ofObject: hiddenRootsObj) = nilObj
+ ifFalse:
+ [classTableIndex >> self classTableMajorIndexShift > i ifTrue:
+ [j := 0.
+ [j < self classTablePageSize] whileTrue:
+ [(self fetchPointer: j ofObject: page) = nilObj ifTrue:
+ [classTableIndex := i << self classTableMajorIndexShift + j.
+ j := self classTablePageSize].
+ j := j + 1]]]
+ ifTrue:
+ [classTableIndex >> self classTableMajorIndexShift > i ifTrue:
+ [classTableIndex := (i - 1 max: 1) << self classTableMajorIndexShift].
+ numClassTablePages := i.
+ self assert: (self classOrNilAtIndex: classTableIndex) = nilObj.
+ ^self]].
+ "no unused slots; set it to the start of the second page."
+ classTableIndex >> self classTableMajorIndexShift >= numClassTablePages ifTrue:
+ [classTableIndex := 1 << self classTableMajorIndexShift].
+ self assert: (self classOrNilAtIndex: classTableIndex) = nilObj!
- 2 to: numClassTablePages - 1 do:
- [:i|
- (self fetchPointer: i ofObject: hiddenRootsObj) = nilObj ifTrue:
- [numClassTablePages := i.
- classTableIndex := (numClassTablePages - 1 max: 1) << self classTableMajorIndexShift.
- ^self]].
- "no unused pages; set it to the start of the second page."
- classTableIndex := 1 << self classTableMajorIndexShift!
More information about the Vm-dev
mailing list