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

commits at source.squeak.org commits at source.squeak.org
Mon Oct 21 01:42:32 UTC 2013


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

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

Name: VMMaker.oscog-eem.470
Author: eem
Time: 20 October 2013, 6:39:45.083 pm
UUID: f2c1d9b6-9136-4c2f-872e-7744f8d1b580
Ancestors: VMMaker.oscog-eem.469

Simplify the sorting sweep.  Throw away all free lists.  Link large
chunks through sortedFreeChunks and add small chunks to their
free lists, reversing the small lists post sweep.

Still have to implement rebuilding the free tree.  But free space is
sorted.

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

Item was added:
+ ----- Method: SpurMemoryManager>>freeSmallObject: (in category 'free space') -----
+ freeSmallObject: objOop
+ 	| bytes index |
+ 	bytes := self bytesInObject: objOop.
+ 	index := bytes / self allocationUnit.
+ 	self assert: index < self numFreeLists.
+ 	self setFree: objOop. 
+ 	self storePointer: self freeChunkNextIndex ofFreeChunk: objOop withValue: (freeLists at: index).
+ 	freeLists at: index put: objOop.!

Item was changed:
  ----- Method: SpurMemoryManager>>freeUnmarkedObjectsNilUnmarkedWeaklingSlotsAndSortAndCoallesceFreeSpace (in category 'gc - global') -----
  freeUnmarkedObjectsNilUnmarkedWeaklingSlotsAndSortAndCoallesceFreeSpace
+ 	"Sweep all of old space, freeing unmarked objects, nilling the unmarked slots of weaklings,
+ 	 coallescing free chunks, and sorting free space.  Small free chunks are sorted in address
+ 	 order on each small list head.  Large free chunks are sorted on the sortedFreeChunks list."
+ 	| lastLargeFree |
  	self checkFreeSpace.
  	scavenger forgetUnmarkedRememberedObjects.
- 	"for coallescing, specifically detatchLargeFreeObject: below, link large chunks to their tree nodes."
- 	self buildPrevLinksForLargeFreeChunks.
  	self checkFreeSpace.
+ 	"for sorting free space throw away the list heads, rebuilding them for small free chunks below."
+ 	self resetFreeListHeads.
+ 	sortedFreeChunks := lastLargeFree := 0.
- 	"for sorting free space throw away the small list heads, rebuilding them below.".
- 	self resetSmallFreeListHeads.
  	self allOldSpaceEntitiesForCoallescingDo:
  		[:o|
  		(self isMarked: o)
  			ifTrue:
  				[self setIsMarkedOf: o to: false.
  				 ((self isWeakNonImm: o)
  				 and: [self nilUnmarkedWeaklingSlots: o]) ifTrue:
  					[coInterpreter signalFinalization: o]]
  			ifFalse: "unmarked; two cases, an unreachable object or a free chunk."
  				[| here next |
  				 self assert: (self isRemembered: o) not. "scavenger should have cleared this above"
  				 here := o.
  				 next := self objectAfter: here limit: endOfMemory.
+ 				 (self isMarked: next) ifFalse: "coallescing; rare case"
+ 					[self assert: (self isRemembered: o) not.
+ 					 [statCoallesces := statCoallesces + 1.
+ 					  here := self coallesce: here and: next.
+ 					  next := self objectAfter: here limit: endOfMemory.
+ 					  next = endOfMemory or: [self isMarked: next]] whileFalse].
+ 				 (self isLargeFreeObject: here)
+ 					ifTrue:
+ 						[lastLargeFree = 0
+ 							ifTrue: [sortedFreeChunks := here]
+ 							ifFalse:
+ 								[self setFree: here.
+ 								 self storePointer: self freeChunkNextAddressIndex ofFreeChunk: lastLargeFree withValue: here].
+ 						 lastLargeFree := here]
+ 					ifFalse:
+ 						[self freeSmallObject: here]]].
+ 	lastLargeFree ~= 0 ifTrue:
+ 		[self storePointer: self freeChunkNextAddressIndex ofFreeChunk: lastLargeFree withValue: 0].
+ 	totalFreeOldSpace := self reverseSmallListHeads.
+ 	totalFreeOldSpace := totalFreeOldSpace + self rebuildFreeTreeFromSortedFreeChunks.
- 				 (self isMarked: next)
- 					ifTrue: "common case"
- 						[(self isLargeFreeObject: o) ifFalse:
- 							[self sortedFreeObject: o]]
- 					ifFalse: "coallescing; rare case"
- 						[self assert: (self isRemembered: o) not.
- 						 (self isLargeFreeObject: o) ifTrue:
- 							[self detatchLargeFreeObject: o].
- 						 [statCoallesces := statCoallesces + 1.
- 						  here := self coallesce: here and: next.
- 						  next := self objectAfter: here limit: endOfMemory.
- 						  next = endOfMemory or: [self isMarked: next]] whileFalse.
- 						 self sortedFreeObject: here]]].
  	self checkFreeSpace!

Item was changed:
  ----- Method: SpurMemoryManager>>isLargeFreeObject: (in category 'free space') -----
  isLargeFreeObject: objOop
+ 	^(self bytesInObject: objOop)  / self allocationUnit >= self numFreeLists!
- 	^(self isFreeObject: objOop)
- 	  and: [(self bytesInObject: objOop)  / self allocationUnit >= self numFreeLists]!

Item was added:
+ ----- Method: SpurMemoryManager>>resetFreeListHeads (in category 'free space') -----
+ resetFreeListHeads
+ 	0 to: self numFreeLists - 1 do:
+ 		[:i| freeLists at: i put: 0]!

Item was added:
+ ----- Method: SpurMemoryManager>>reverseSmallListHeads (in category 'free space') -----
+ reverseSmallListHeads
+ 	"After freeUnmarkedObjectsNilUnmarkedWeaklingSlotsAndSortAndCoallesceFreeSpace
+ 	 all small free chunks will be on the free lists in reverse address order.  Reverse each list,
+ 	 summing the ammount of space.  Answer the sum of bytes of free space on these small lists."
+ 	| total |
+ 	total := 0.
+ 	1 to: self numFreeLists - 1 do:
+ 		[:i| | bytes node prev next |
+ 		 bytes := i * self allocationUnit.
+ 		 node := freeLists at: i.
+ 		 prev := 0.
+ 		 [node ~= 0] whileTrue:
+ 			[next := self fetchPointer: self freeChunkNextIndex ofObject: node.
+ 			 self storePointer: self freeChunkNextIndex ofFreeChunk: node withValue: prev.
+ 			 prev := node.
+ 			 node := next.
+ 			 total := total + bytes].
+ 		 freeLists at: i put: node].
+ 	^total!

Item was added:
+ ----- Method: SpurMemoryManager>>setFree: (in category 'free space') -----
+ setFree: objOop
+ 	"turn the object into a free chunk, zeroing classIndex, format, isGrey,isPinned,isRemembered,isImmutable & ?."
+ 	self long32At: objOop put: 0!



More information about the Vm-dev mailing list