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

commits at source.squeak.org commits at source.squeak.org
Wed Jan 11 15:13:33 UTC 2023


Tom Braun uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog.seperateMarking-WoC.3297.mcz

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

Name: VMMaker.oscog.seperateMarking-WoC.3297
Author: WoC
Time: 11 January 2023, 4:13:04.345352 pm
UUID: 780fb35b-f951-40ed-b0fc-035c4f9caa78
Ancestors: VMMaker.oscog.seperateMarking-WoC.3296

- remove unneeded method (introduced to solve an error that lied somewehere else)

- skip marking young objects

=============== Diff against VMMaker.oscog.seperateMarking-WoC.3296 ===============

Item was removed:
- ----- Method: SpurIncrementalGarbageCollector>>doScavengeWithoutIncrementalCollect: (in category 'scavenge') -----
- doScavengeWithoutIncrementalCollect: tenuringCriterion
- 	
- 	super doScavengeWithoutIncrementalCollect: tenuringCriterion.
- 	
- 	coInterpreter resolveForwardersInStackPages.!

Item was changed:
  ----- Method: SpurIncrementalMarker>>incrementalMark (in category 'marking - incremental') -----
  incrementalMark
  	"does one marking cycle. Breaks after a certain amount of slots is marked and the last object, that amount is crossed in, is completely scanned"
  
  	| currentObj slotsLeft |
  	"manager objStack: manager markStack do: [:index :page | Transcript showln: (manager fetchPointer: index ofObject: page)].
  	manager sizeOfObjStack: manager markStack"
  	currentObj := manager popObjStack: manager markStack.
  	"skip young objects. They get already scanned as they are part of the roots"
  	[(currentObj notNil) and: [(manager isNonImmediate: currentObj) and: [manager isYoung: currentObj]]]
  			whileTrue: [(manager isInClassTable: currentObj) ifTrue: [self setIsMarkedOf: currentObj ].
  				currentObj := manager popObjStack: manager markStack].
  	
  	currentObj
  		ifNil: [^ true]. "there is nothing more on the stack and we are done"
  		
  	slotsLeft := SlotLimitPerPass.
  	
  	[
  		| slotNumber slotsToVisit startIndex |
  		
  		"after passing the limit we push the current index on the stack. Is the currentObj only an index? "
  		(manager isImmediate: currentObj)
  			ifTrue: [startIndex := manager integerValueOf: currentObj.
  				currentObj := manager popObjStack: manager markStack.]
  			ifFalse: [startIndex := 0.
  				
  				self assert: (manager isFreeObject: currentObj) not.
  				(manager isForwarded: currentObj)
  					ifTrue: [currentObj := manager followForwarded: currentObj].
  				
  				self flag: #Todo. "young objects can fall out of a forwarder. Do not follow them"
  				self assert: (manager isYoung: currentObj) not.
  				
+ 				(manager isYoung: currentObj)
+ 					ifTrue: ["trick to skip young object"
+ 						startIndex := manager numStrongSlotsOfInephemeral: currentObj]
+ 					ifFalse: [self markAndTraceClassOf: currentObj.
- 				self markAndTraceClassOf: currentObj.
  				
+ 						"eager color the object black. Either it will get scanned completely and the color is correct
+ 						or we have at least scanned some of the slots. In the second case the mutator could 
+ 						modify one of the slots of the object that already were scanned and we would could lose
+ 						this object. Therefore color the object early to trigger the write barrier on writes. There will
+ 						be some overhead (trigger the barrier always although only the already scanned slots are
+ 						technically black) but it seems we need to do this for correctness"
+ 						self blackenObject: currentObj]].
- 				"eager color the object black. Either it will get scanned completely and the color is correct
- 				or we have at least scanned some of the slots. In the second case the mutator could 
- 				modify one of the slots of the object that already were scanned and we would could lose
- 				this object. Therefore color the object early to trigger the write barrier on writes. There will
- 				be some overhead (trigger the barrier always although only the already scanned slots are
- 				technically black) but it seems we need to do this for correctness"
- 				self blackenObject: currentObj].
  			
  		slotNumber := manager numStrongSlotsOfInephemeral: currentObj.
  		slotsToVisit := slotNumber - startIndex.
  		
  		slotsLeft - slotsToVisit < 0
  			ifTrue: [ | countThatCanBeVisited |
  				countThatCanBeVisited := slotsToVisit - slotsLeft.
  				self 
  					markFrom: startIndex
  					nSlots: countThatCanBeVisited
  					of: currentObj.
  						
  				"If we need to abort earlier we push the index and the currently scanned object on the marking stack. Otherwise it is not possible
  				for immediates to be on the stack (they have no fields to be scanned) -> we can use the immediated to detect this pattern"
  				(manager topOfObjStack: manager markStack) ~= currentObj ifTrue: 
  						[manager push: currentObj onObjStack: manager markStack].
  				manager 
  					push: (manager integerObjectOf: startIndex + countThatCanBeVisited) 
  					onObjStack: manager markStack.
  				
  				"we need to abort early to not run into some extreme corner cases (giant objects) that would explode our mark time assumptions"
  				^ false]
  			ifFalse: ["we can mark all"
  				slotsLeft := slotsLeft - slotsToVisit.
  				
  				self markFrom: startIndex nSlots: slotsToVisit of: currentObj].		
  
  		currentObj := manager popObjStack: manager markStack.
  		
  		[(currentObj notNil) and: [(manager isNonImmediate: currentObj) and: [manager isYoung: currentObj]]]
  			whileTrue: [(manager isInClassTable: currentObj) ifTrue: [self setIsMarkedOf: currentObj].
  				currentObj := manager popObjStack: manager markStack].
  	"repeat while there still are objects"
  	currentObj notNil] whileTrue.
  
  	^ true!



More information about the Vm-dev mailing list