[Vm-dev] VM Maker: VMMaker.oscog-eem.150.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Feb 29 00:55:37 UTC 2012


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.150.mcz

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

Name: VMMaker.oscog-eem.150
Author: eem
Time: 28 February 2012, 4:38:28.752 pm
UUID: f2172fad-371a-4789-a4e6-cae3c679bcd2
Ancestors: VMMaker.oscog-eem.149

Disable filling of the weakRoots table during fullGC.
Move the boinds check to the point of insertion.

=============== Diff against VMMaker.oscog-eem.149 ===============

Item was changed:
  ----- Method: NewObjectMemory>>fullGC (in category 'garbage collection') -----
  fullGC
  	"Do a mark/sweep garbage collection of the entire object memory. Free inaccessible objects but do not move them."
  
  	<inline: false>
  	fullGCLock > 0 ifTrue:
  		[self warning: 'aborting fullGC because fullGCLock > 0'.
  		 ^self].
  	self initializeFreeBlocksPreSweep.
  	self runLeakCheckerForFullGC: true.
  	self preGCAction: GCModeFull.
  	gcStartUsecs := self ioUTCMicrosecondsNow.
  	statSweepCount := statMarkCount := statMkFwdCount := statCompMoveCount := 0.
  	self clearRootsTable.
+ 	self initWeakTableForIncrementalGC: false.
  	youngStart := self startOfMemory.  "process all of memory"
  	self markPhase: true.
  	"Sweep phase returns the number of survivors.
  	Use the up-to-date version instead the one from startup."
  	totalObjectCount := self sweepPhaseForFullGC.
  	self runLeakCheckerForFullGC: true.
  	self fullCompaction.
  	statFullGCs := statFullGCs + 1.
  	statGCEndUsecs := self ioUTCMicrosecondsNow.
  	statFullGCUsecs := statFullGCUsecs + (statGCEndUsecs - gcStartUsecs).
  	self capturePendingFinalizationSignals.
  
  	youngStart := freeStart.  "reset the young object boundary"
  	self postGCAction.
  	self runLeakCheckerForFullGC: true!

Item was changed:
  ----- Method: NewObjectMemory>>incrementalGC (in category 'garbage collection') -----
  incrementalGC
  	"Do a mark/sweep garbage collection of just the young object
  	area of object memory (i.e., objects above youngStart), using
  	the root table to identify objects containing pointers to
  	young objects from the old object area."
  	| survivorCount weDidGrow |
  	<inline: false>
  
  	rootTableCount >= RootTableSize ifTrue:
  		["root table overflow; cannot do an incremental GC (this should be very rare)"
  		 statRootTableOverflows := statRootTableOverflows + 1.
  		 ^self fullGC].
  
  	self initializeFreeBlocksPreSweep.
  	self runLeakCheckerForFullGC: false.
  
  	self preGCAction: GCModeIncr.
  	"incremental GC and compaction"
  
  	gcStartUsecs := self ioUTCMicrosecondsNow.
- 	weakRootCount := 0.
  	statSweepCount := statMarkCount := statMkFwdCount := statCompMoveCount := 0.
+ 	self initWeakTableForIncrementalGC: true.
  	self markPhase: false.
+ 	self assert: weakRootCount <= WeakRootTableSize.
- 	weakRootCount <= WeakRootTableSize ifFalse:
- 		[self error: 'weakRoots table overflow'].
  	1 to: weakRootCount do:
  		[:i| self finalizeReference: (weakRoots at: i)].
  	survivorCount := self sweepPhase.
  	self runLeakCheckerForFullGC: false.
  	self incrementalCompaction.
  	statIncrGCs := statIncrGCs + 1.
  	statGCEndUsecs := self ioUTCMicrosecondsNow.
  	statIGCDeltaUsecs := statGCEndUsecs - gcStartUsecs.
  	statIncrGCUsecs := statIncrGCUsecs + statIGCDeltaUsecs.
  	self capturePendingFinalizationSignals.
  	
  	statRootTableCount  := rootTableCount.
  	statSurvivorCount := survivorCount.
  	weDidGrow := false.
  	(((survivorCount > tenuringThreshold)
  	 or: [rootTableCount >= RootTableRedZone])
  	 or: [forceTenureFlag == true]) ifTrue:
  		["move up the young space boundary if
  		  * there are too many survivors:
  			this limits the number of objects that must be
  			processed on future incremental GC's
  		  * we're about to overflow the roots table:
  			this limits the number of full GCs that may be caused
  			by root table overflows in the near future"
  		forceTenureFlag := false.
  		statTenures := statTenures + 1.
  		self clearRootsTable.
  		((self freeSize < growHeadroom)
  		 and: [gcBiasToGrow > 0]) ifTrue:
  			[self biasToGrow.
  			 weDidGrow := true].
  		youngStart := freeStart].
  	self postGCAction.
  	
  	self runLeakCheckerForFullGC: false.
  	weDidGrow ifTrue:
  		[self biasToGrowCheckGCLimit]!

Item was changed:
  ----- Method: NewObjectMemory>>lastPointerOf:recordWeakRoot: (in category 'object enumeration') -----
  lastPointerOf: oop recordWeakRoot: recordWeakRoot "<Boolean>"
  	"Return the byte offset of the last pointer field of the given object.  
  	 Works with CompiledMethods, as well as ordinary objects. 
  	 Can be used even when the type bits are not correct.
  	 This is a version of lastPointerOf: for markAndTrace:.
  	 Already overridden to trace stack pages for the StackInterpreter.
  	 Override to ask coInterpreter to determine literalCount of methods."
  	| fmt sz header contextSize numLiterals |
  	<inline: true>
  	<asmLabel: false>
  	header := self baseHeader: oop.
  	fmt := self formatOfHeader: header.
  	fmt <= 4 ifTrue:
  		[fmt >= 3 ifTrue:
  			[fmt = 4 ifTrue:
+ 				[(recordWeakRoot and: [weakRootCount >= 0]) ifTrue:
- 				[recordWeakRoot ifTrue:
  					["And remember as weak root"
+ 					 (weakRootCount := weakRootCount + 1) <= WeakRootTableSize ifFalse:
+ 						[self error: 'weakRoots table overflow'].
- 					 weakRootCount := weakRootCount + 1.
- 					 self assert: weakRootCount <= WeakRootTableSize.
  					 weakRoots at: weakRootCount put: oop].
  				"Do not trace the object's indexed fields if it's a weak class"
  				^(self nonWeakFieldsOf: oop) << ShiftForWord].
  			"So fmt is 3"
  			(self isContextHeader: header) ifTrue:
  				[coInterpreter setTraceFlagOnContextsFramesPageIfNeeded: oop.
  				 "contexts end at the stack pointer avoiding having to init fields beyond it"
  				 contextSize := coInterpreter fetchStackPointerOf: oop.
  				 self assert: ReceiverIndex + contextSize < (self lengthOf: oop baseHeader: header format: fmt).
  				 ^CtxtTempFrameStart + contextSize * BytesPerWord]].
  		 sz := self sizeBitsOfSafe: oop.
  		 ^sz - BaseHeaderSize  "all pointers" ].
  	fmt < 12 ifTrue: [^0]. "no pointers"
  
  	"CompiledMethod: contains both pointers and bytes"
  	numLiterals := coInterpreter literalCountOf: oop.
  	^numLiterals * BytesPerWord + BaseHeaderSize!

Item was changed:
  ----- Method: ObjectMemory>>fullGC (in category 'garbage collection') -----
  fullGC
  	"Do a mark/sweep garbage collection of the entire object memory. Free inaccessible objects but do not move them."
  
  	<inline: false>
  	DoAssertionChecks ifTrue:
  		[self reverseDisplayFrom: 0 to: 7.
  		 self clearLeakMapAndMapAccessibleObjects.
  		 self checkHeapIntegrity].
  	self preGCAction: GCModeFull.
  	gcStartUsecs := self ioUTCMicrosecondsNow.
  	statSweepCount := statMarkCount := statMkFwdCount := statCompMoveCount := 0.
  	self clearRootsTable.
+ 	self initWeakTableForIncrementalGC: false.
  	youngStart := self startOfMemory.  "process all of memory"
  	self markPhase.
  	"Sweep phase returns the number of survivors.
  	Use the up-to-date version instead the one from startup."
  	totalObjectCount := self sweepPhase.
  	self fullCompaction.
  	allocationCount := 0.
  	statFullGCs := statFullGCs + 1.
  	statGCEndTime := self ioMicroMSecs.
  	statFullGCUsecs := statFullGCUsecs + (self ioUTCMicrosecondsNow - gcStartUsecs).
  	self capturePendingFinalizationSignals.
  
  	youngStart := freeBlock.  "reset the young object boundary"
  	self postGCAction.
  	DoAssertionChecks ifTrue:
  		[self clearLeakMapAndMapAccessibleObjects.
  		 self checkHeapIntegrity.
  		 self reverseDisplayFrom: 0 to: 7]!

Item was changed:
  ----- Method: ObjectMemory>>incrementalGC (in category 'garbage collection') -----
  incrementalGC
  	"Do a mark/sweep garbage collection of just the young object 
  	area of object memory (i.e., objects above youngStart), using 
  	the root table to identify objects containing pointers to 
  	young objects from the old object area."
  	| survivorCount weDidGrow |
  	<inline: false>
  	rootTableCount >= RootTableSize
  		ifTrue: ["root table overflow; cannot do an incremental GC (this should be very rare)"
  			statRootTableOverflows := statRootTableOverflows + 1.
  			^ self fullGC].
  
  	DoAssertionChecks ifTrue:
  		[self reverseDisplayFrom: 8 to: 15.
  		 self checkHeapIntegrity.
  		 self checkInterpreterIntegrity.
  		 self validate].
  
  	self preGCAction: GCModeIncr.
  	"incremental GC and compaction"
  
  	gcStartUsecs := self ioUTCMicrosecondsNow.
- 	weakRootCount := 0.
  	statSweepCount := statMarkCount := statMkFwdCount := statCompMoveCount := 0.
+ 	self initWeakTableForIncrementalGC: true.
  	self markPhase.
+ 	self assert: weakRootCount <= WeakRootTableSize.
- 	weakRootCount <= WeakRootTableSize ifFalse:
- 		[self error: 'weakRoots table overflow'].
  	1 to: weakRootCount do:[:i| self finalizeReference: (weakRoots at: i)].
  	survivorCount := self sweepPhase.
  	self incrementalCompaction.
  	statAllocationCount := allocationCount.
  	allocationCount := 0.
  	statIncrGCs := statIncrGCs + 1.
  	statGCEndTime := self ioMicroMSecs.
  	statIGCDeltaUsecs := self ioUTCMicrosecondsNow - gcStartUsecs.
  	statIncrGCUsecs := statIncrGCUsecs + statIGCDeltaUsecs.
  	self capturePendingFinalizationSignals.
  
  	self forceInterruptCheck. "Force an an interrupt check ASAP.We could choose to be clever here and only do this under certain time conditions. Keep it simple for now"
  	
  	statRootTableCount  := rootTableCount.
  	statSurvivorCount := survivorCount.
  	weDidGrow := false.
  	(((survivorCount > tenuringThreshold)
  			or: [rootTableCount >= RootTableRedZone])
  			or: [forceTenureFlag == true])
  		ifTrue: ["move up the young space boundary if 
  			* there are too many survivors: 
  			this limits the number of objects that must be 
  			processed on future incremental GC's 
  			* we're about to overflow the roots table 
  			this limits the number of full GCs that may be caused 
  			by root table overflows in the near future"
  			forceTenureFlag := false.
  			statTenures := statTenures + 1.
  			self clearRootsTable.
  			(((self sizeOfFree: freeBlock) < growHeadroom) and: 
  				[gcBiasToGrow > 0]) 
  				ifTrue: [self biasToGrow.
  						weDidGrow := true].
  			youngStart := freeBlock].
  	self postGCAction.
  	DoAssertionChecks ifTrue:
  		[self validate.
  		 self checkHeapIntegrity.
  		 self checkInterpreterIntegrity.
  		 self reverseDisplayFrom: 8 to: 15].
  	weDidGrow ifTrue: [self biasToGrowCheckGCLimit]!

Item was added:
+ ----- Method: ObjectMemory>>initWeakTableForIncrementalGC: (in category 'gc -- mark and sweep') -----
+ initWeakTableForIncrementalGC: trueIfIncrementalGC
+ 	"The weakRoots table is only used for incrementalGC.
+ 	 Enable it by setting weakRootCount to 0.
+ 	 Disable it by making it negative."
+ 	weakRootCount := trueIfIncrementalGC ifTrue: [0] ifFalse: [-1]!

Item was changed:
  ----- Method: ObjectMemory>>lastPointerOf:recordWeakRoot: (in category 'gc -- mark and sweep') -----
  lastPointerOf: oop recordWeakRoot: recordWeakRoot "<Boolean>"
  	"Return the byte offset of the last pointer field of the given object.  
  	 Works with CompiledMethods, as well as ordinary objects. 
  	 Can be used even when the type bits are not correct.
  	 This is a version of lastPointerOf: for markAndTrace:."
  	| fmt sz header contextSize |
  	<inline: true>
  	header := self baseHeader: oop.
  	fmt := self formatOfHeader: header.
  	fmt <= 4 ifTrue:
  		[fmt >= 3 ifTrue:
  			[fmt = 4 ifTrue:
+ 				[(recordWeakRoot and: [weakRootCount >= 0]) ifTrue:
- 				[recordWeakRoot ifTrue:
  					["And remember as weak root"
+ 					 (weakRootCount := weakRootCount + 1) <= WeakRootTableSize ifFalse:
+ 						[self error: 'weakRoots table overflow'].
- 					 weakRootCount := weakRootCount + 1.
- 					 self assert: weakRootCount <= WeakRootTableSize.
  					 weakRoots at: weakRootCount put: oop].
  				"Do not trace the object's indexed fields if it's a weak class"
  				^(self nonWeakFieldsOf: oop) << ShiftForWord].
  			"So fmt is 3"
  			(self isContextHeader: header) ifTrue:
  				["contexts end at the stack pointer avoiding having to init fields beyond it"
  				 contextSize := self fetchStackPointerOf: oop.
  				 ^CtxtTempFrameStart + contextSize * BytesPerWord]].
  		 sz := self sizeBitsOfSafe: oop.
  		 ^sz - BaseHeaderSize  "all pointers" ].
  	fmt < 12 ifTrue: [^0]. "no pointers"
  
  	"CompiledMethod: contains both pointers and bytes:"
  	^(self literalCountOf: oop) * BytesPerWord + BaseHeaderSize!



More information about the Vm-dev mailing list