[Vm-dev] VM Maker: VMMaker.oscog.seperateMarking-WoC.3311.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Jan 14 15:54:26 UTC 2023

Tom Braun uploaded a new version of VMMaker to project VM Maker:

==================== Summary ====================

Name: VMMaker.oscog.seperateMarking-WoC.3311
Author: WoC
Time: 14 January 2023, 4:54:00.77254 pm
UUID: ffbdd1a4-a1ff-4a71-b10a-ad0765ed5251
Ancestors: VMMaker.oscog.seperateMarking-eem.3310

prevent compaction to try to create objects of size 8 byte as this is currently not possible

=============== Diff against VMMaker.oscog.seperateMarking-eem.3310 ===============

Item was added:
+ ----- Method: SpurIncrementalCompactingSweeper>>canTolerateObjStartingAt:sized:inSegment: (in category 'as yet unclassified') -----
+ canTolerateObjStartingAt: address sized: numBytes inSegment: segInfo
+ 	"do not copy and object that would overflow the segment or leave only 8 bytes, as the smallest
+ 	object size is 16 bytes and we would violate heap parsability (until slim bridges or another hack
+ 	mitigating this limitation comes around)"
+ 	<var: 'segInfo' type: #'SpurSegmentInfo *'>
+ 	| bridgeAddress |
+ 	bridgeAddress := segInfo segLimit - manager bridgeSize.
+ 	^ (self oop: address + numBytes isLessThan: bridgeAddress)
+ 		and: [address + numBytes + 8 ~= bridgeAddress]!

Item was changed:
  ----- Method: SpurIncrementalCompactingSweeper>>compactSegment:freeStart:segIndex: (in category 'incremental compact') -----
  compactSegment: segInfo freeStart: initialFreeStart segIndex: segIndex
  	<var: 'segInfo' type: #'SpurSegmentInfo *'>
  	| fillStart |
  	fillStart := initialFreeStart.
  	self deny: segIndex = 0. "Cannot compact seg 0"
  	manager segmentManager
  		allEntitiesInSegment: segInfo
  			[:entity |
  			(manager isFreeObject: entity)
  					[manager detachFreeObject: entity.
  					currentsCycleSeenObjectCount := currentsCycleSeenObjectCount + 1.
  					 "To avoid confusing too much Spur (especially the leak/free checks), we mark the free chunk as a word object."
  					 manager set: entity classIndexTo: manager wordSizeClassIndexPun formatTo: manager wordIndexableFormat]
  					(manager isPinned: entity)
  						ifTrue: [manager debugger].
  					(manager isMarked: entity)
  						ifTrue: [| bytesToCopy |
  							"note: we copy even forwarders if they are marked so they cannot get lost"
  							manager makeWhite: entity.
  							"I really hat that this can happen :( . The marker will keep track of which segments contain pinned objects.
  							If the pinned object is created during sweeping and compacting, we cannot know about it while working at
  							our plan we did at the start of sweeping and compacting"
  							(manager isPinned: entity)
  								ifTrue: [self abortCompactionAt: entity in: segInfo].
  							bytesToCopy := manager bytesInBody: entity. 
+ 							(self canTolerateObjStartingAt: fillStart sized: bytesToCopy inSegment: segmentToFill)
- 							(self would: fillStart + bytesToCopy overflowSegment: segmentToFill)
  								ifFalse: [
  									self abortCompactionAt: entity in: segInfo.
  									^ fillStart].
  							"let's make copying more expensive. Number is just a guess"
  							currentsCycleSeenObjectCount := currentsCycleSeenObjectCount + 100.
  							self migrate: entity sized: bytesToCopy to: fillStart.
  							fillStart := fillStart + bytesToCopy.
  							self assert: (self oop: fillStart isLessThan: (segmentToFill segLimit - manager bridgeSize))]
  						ifFalse: [self handleUnmarkedEntity: entity]]].
  	"we want to advance to the next segment from the bridge"
  	currentObject := currentSegmentsBridge.
  	^ fillStart!

Item was added:
+ ----- Method: SpurIncrementalCompactingSweeper>>isSegmentBeingPartiallyCompacted: (in category 'testing') -----
+ isSegmentBeingPartiallyCompacted: segInfo 
+ 	<var: 'segInfo' type: #'SpurSegmentInfo *'>
+ 	"Swizzle is abused to note a segment as being compacted. 
+ 		swizzle = 0 -> not compacted
+ 		swizzle = 1 -> compacted 
+ 		swizzle > 7 -> aborted compaction; swizzle is set to the objOop of the object after the compacted part"
+ 	^ segInfo swizzle > 7!

Item was changed:
  ----- Method: SpurIncrementalCompactingSweeper>>occupyRestOfFreeCompactedIntoSegment (in category 'incremental compact') -----
+ 	"we cannot create objects of size 8. To set currentCopyToPointer 8 byte before the bridge should be prevented by the
+ 	code in the copying logic, but better save than sorry"
+ 	self assert: (currentCopyToPointer + 8 ~= segmentToFill segLimit - manager bridgeSize).
  	"do not overwrite the bridge"
  	(self oop: currentCopyToPointer isGreaterThanOrEqualTo: segmentToFill segLimit - manager bridgeSize)
  		ifTrue: [^ self].
  		initFreeChunkWithBytes: segmentToFill segSize - manager bridgeSize + segmentToFill segStart - currentCopyToPointer
  		at: currentCopyToPointer.
  	"avoid confusing spur, especially for leak checks"
  		set: (manager objectStartingAt: currentCopyToPointer)
  		classIndexTo: manager wordSizeClassIndexPun 
  		formatTo: manager wordIndexableFormat!

Item was changed:
  ----- Method: SpurIncrementalCompactingSweeper>>setFreeChunkOfCompactedIntoSegment (in category 'incremental compact') -----
  	shouldCompact ifFalse: [^ self].
  	"do not overwrite the bridge"
  	(self oop: currentCopyToPointer isGreaterThanOrEqualTo: segmentToFill segLimit - manager bridgeSize)
  		ifTrue: [^ self].
  	self assert: segmentToFill notNil.
+ 	"we cannot create an object sized 8 bytes. 16 bytes is the minimum dictated by Spur"
+ 	self assert:  currentCopyToPointer + 8 ~= (segmentToFill segLimit - manager bridgeSize).
- 	self assert: (self oop: currentCopyToPointer isLessThan: segmentToFill segLimit - manager bridgeSize).
  	coInterpreter cr; 
  		print: 'after compaction freeing from: '; printHex: currentCopyToPointer; 
+ 		print: ' to: '; printHex: segmentToFill segLimit - manager bridgeSize ;
- 		print: ' to: '; printHex: segmentToFill segStart + segmentToFill segSize - manager bridgeSize + segmentToFill segStart - currentCopyToPointer ;
  	  tab; flush.
+ 	self assert: (manager isFreeObject: (manager objectStartingAt: currentCopyToPointer)) not.
+ 	(manager isFreeObject: (manager objectStartingAt: currentCopyToPointer)) not
+ 		ifFalse: [manager debugger].
  		addFreeChunkWithBytes: segmentToFill segSize - manager bridgeSize + segmentToFill segStart - currentCopyToPointer 
  		at: currentCopyToPointer.
  	"we have compacted into segmentToFill. It is now not empty anymore and we need to look for a new one"
  	segmentToFill := nil

Item was removed:
- ----- Method: SpurIncrementalCompactingSweeper>>would:overflowSegment: (in category 'compaction planning') -----
- would: address overflowSegment: segInfo
- 	^ (self oop: address isLessThan: (segInfo segLimit - manager bridgeSize))!

More information about the Vm-dev mailing list